whj 1 年之前
父節點
當前提交
ae01eef30f
共有 1 個文件被更改,包括 18 次插入13 次删除
  1. 18 13
      src/views/sb/info/SbInfoC.vue

+ 18 - 13
src/views/sb/info/SbInfoC.vue

@@ -286,14 +286,14 @@
                         <a-input v-model.trim="createdUserName" placeholder="请输入操作人"/>
                       </a-col>
                       <a-col :span="8">
-                        <a-button type="primary" @click="getLogBySbId({sbId: record.id,createdUserName})">查询</a-button>
-                        <a-button style="margin-left: 8px" @click="()=>{getLogBySbId({sbId: record.id});createdUserName=''}">重置</a-button>
+                        <a-button type="primary" @click="getLogBySbId(record,createdUserName)">查询</a-button>
+                        <a-button style="margin-left: 8px" @click="()=>{getLogBySbId(record);createdUserName=''}">重置</a-button>
                         <a-button style="margin-left: 8px" type="primary" icon="plus" @click="addLogBySb(record)">新增</a-button>
                       </a-col>
-                    </a-row>
+                    </a-row> 
 
                   </div>
-                  <a-table :columns="childColumns1" :data-source="childMap">
+                  <a-table rowKey="id" :columns="childColumns1" :data-source="record.childMap">
                     <template #sbMeasureLogCredential="text">
                       <a @click="$refs.listModal.base(text)">查看</a>
                     </template>
@@ -420,6 +420,7 @@ export default {
         status: this.$route.query.status || this.status
       },
       expand: false,
+      record:{},
       depreciationTypeMap: {},
       visible: true,
       dateRange: [],
@@ -1062,24 +1063,28 @@ export default {
       this.$refs.table.refresh(true)
     },
     onExpand (expanded, record) { // expanded判断展开or收缩操作,record当前行数据
-      console.log(expanded, record)
       this.childMap = []
-      if (expanded) {
-        this.getLogBySbId({ sbId: record.id })
-      }
+         getLogBySbId({ sbId: record.id }).then(res => {
+        record.childMap = res.data.rows
+        this.$forceUpdate()
+
+      })
     },
-    getLogBySbId (params) {
-      getLogBySbId(params).then(res => {
-        this.childMap = res.data.rows
+    getLogBySbId(record,createdUserName){
+ getLogBySbId({ sbId: record.id,createdUserName }).then(res => {
+        record.childMap = res.data.rows
+        this.$forceUpdate()
+
       })
     },
     addLogBySb (record) {
+      this.record = record
       this.$refs.addLogForm.base(record)
     },
     handleLogOk (val) {
       getLogBySbId({ sbId: val.sbId }).then(res => {
-        this.childMap = res.data
-        this.$refs.table.refresh(true)
+        this.record.childMap = res.data.rows
+        this.$forceUpdate()
       })
     },
     doImport () {