ZaiZai hai 1 ano
pai
achega
7447cb7cca
Modificáronse 1 ficheiros con 13 adicións e 11 borrados
  1. 13 11
      src/views/alter/admin/components/order/addModal.vue

+ 13 - 11
src/views/alter/admin/components/order/addModal.vue

@@ -111,7 +111,7 @@
                             <el-link type="primary" @click="changeShowClick">添加</el-link>
                         </template>
                         <div class="hc-table-ref-box no-border">
-                            <el-table class="w-full" :data="tableData1" row-key="id" height="100%" highlight-current-row border>
+                            <el-table class="w-full" :data="tableData[tableIndex]?.formList" row-key="id" height="100%" highlight-current-row border>
                                 <el-table-column type="index" label="序号" />
                                 <el-table-column prop="formNumber" label="清单编号" />
                                 <el-table-column prop="formName" label="清单名称" />
@@ -162,7 +162,7 @@
 import { nextTick, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { getDictionaryData } from '~uti/tools'
-import { arrIndex, arrToKey, getArrValue, getObjValue, isNullES } from 'js-fast-way'
+import { arrIndex, arrToKey, getArrValue, getObjValue, isArray, isNullES } from 'js-fast-way'
 
 //子组件
 import ChangeRequest from './changeRequest.vue'
@@ -318,39 +318,41 @@ const addChangeNode = async () => {
 //删除变更申请部位
 const delChangeNode = (index) => {
     tableData.value.splice(index, 1)
+    tableIndex.value = -1
 }
 
 //变更申请部位 行被点击
 const changeNodeItem = ref({})
-const tableData1 = ref([])
+const tableIndex = ref(-1)
 const rowChangeNodeClick = ({ row, index }) => {
-    console.log(index)
+    if (!isArray(row.formList)) {
+        tableData.value[index].formList = []
+    }
+    tableIndex.value = index
     changeNodeItem.value = row
-    tableData1.value = getArrValue(row.formList)
 }
 
 //删除变更申请清单
 const tableFormListDel = (index) => {
-    tableData1.value.splice(index, 1)
+    tableData.value[tableIndex.value].formList.splice(index, 1)
 }
 
 //变更清单的添加弹窗
 const isChangeShow = ref(false)
 const changeIds = ref('')
 const changeShowClick = () => {
-    const row = changeNodeItem.value
-    if (isNullES(row.id)) {
+    if (isNullES(changeNodeItem.value['id'])) {
         window.$message.warning('请先选择变更申请部位')
         return false
     }
-    changeIds.value = arrToKey(tableData1.value, 'id')
+    changeIds.value = arrToKey(tableData.value[tableIndex.value].formList, 'id')
     isChangeShow.value = true
 }
 
 //确认选择完成
 const changeNodeFinish = (data) => {
-    tableData1.value.push(...data)
-
+    tableData.value[tableIndex.value].formList.push(...data)
+    console.log(tableData.value)
 }