Просмотр исходного кода

增加出库管理手动输入位置信息功能

shaogen1995 4 лет назад
Родитель
Сommit
5a7237163e
1 измененных файлов с 27 добавлено и 5 удалено
  1. 27 5
      src/views/holding/holding2_add.vue

+ 27 - 5
src/views/holding/holding2_add.vue

@@ -85,8 +85,8 @@
               <el-table-column prop="age" label="藏品年代" width="130">
               </el-table-column>
               <el-table-column label="出库位置" width="230">
-                <template #default>
-
+                <template #default='scopt'>
+                  <el-input  v-model="tableData[scopt.$index].outPath" placeholder="请输入位置"></el-input>
                 </template>
               </el-table-column>
             </el-table>
@@ -117,6 +117,9 @@ export default {
   },
   data () {
     return {
+      // 手动输入的每个藏品位置
+      // location: [],
+      locations: {},
       // 传递给弹窗的表格数据,用来筛选
       myTemp: [],
       // 处理从子组件拿到的数据的id集合数组
@@ -177,6 +180,8 @@ export default {
       this.tableData.forEach(v => {
         if (v.integrity.length <= 2) v.integrity = this.spoil(v.integrity)
         if (v.goodsTypeId.length <= 2) v.goodsTypeId = this.category(v.goodsTypeId)
+        // 位置信息数组
+        if (!v.outPath) v.outPath = ''
       })
     },
     // 多层选择器的事件
@@ -196,7 +201,7 @@ export default {
         type: 'warning'
       }).then(async () => {
         const temp = this.goodsIds
-        this.delArr.forEach(v => {
+        this.delArr.forEach((v) => {
           // 删除数据,刷新页面
           this.tableData.forEach((item, index) => {
             // eslint-disable-next-line
@@ -214,6 +219,12 @@ export default {
           type: 'success',
           message: '删除成功!'
         })
+        // 更新藏品位置信息
+        this.locations = {}
+        this.tableData.forEach((v, i) => {
+          // this.location = this.location.splice(i, 1)
+          this.locations[v.id] = this.tableData[i].outPath
+        })
       }).catch(() => {
         this.$message({
           type: 'info',
@@ -231,7 +242,11 @@ export default {
     },
     // 点击返回
     goBack () {
-      const obj = { description: this.fromData.textarea, goodsIds: this.goodsIds.join(','), id: this.mydata.id, status: null, type: this.fromData.source }
+      // 手动整理所有输入的出库位置信息
+      this.tableData.forEach((v, i) => {
+        this.locations[v.id] = this.tableData[i].outPath
+      })
+      const obj = { description: this.fromData.textarea, goodsIds: this.goodsIds.join(','), id: this.mydata.id, status: null, type: this.fromData.source, location: this.locations }
       this.$confirm('您需要保存这条数据吗?', '提示', {
         confirmButtonText: '保存',
         cancelButtonText: '放弃',
@@ -256,7 +271,12 @@ export default {
     // 点击提交
     async submit () {
       if (this.fromData.textarea === '') return this.$message.warning('出库说明不能为空')
-      const obj = { description: this.fromData.textarea, goodsIds: this.goodsIds.join(','), id: this.mydata.id, status: 1, type: this.fromData.source }
+      // 手动整理所有输入的出库位置信息
+      this.tableData.forEach((v, i) => {
+        this.locations[v.id] = this.tableData[i].outPath
+      })
+      const obj = { description: this.fromData.textarea, goodsIds: this.goodsIds.join(','), id: this.mydata.id, status: 1, type: this.fromData.source, location: this.locations }
+      // console.log(999, obj)
       await holding1submit(obj)
       this.$message.success('提交成功')
       this.$router.push('/layout/holding2')
@@ -283,6 +303,8 @@ export default {
       this.tableData.forEach(v => {
         v.integrity = this.spoil(v.integrity)
         v.goodsTypeId = this.category(v.goodsTypeId)
+        // 回显出库位置
+        // this.location.push(v.outPath)
       })
 
       this.goodsIds = this.mydata.goodsIds.split(',')