Ver código fonte

前端: 导入合同,二级单位批量赋值

baichengfei 4 anos atrás
pai
commit
f5cebb822f

+ 10 - 0
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-import/index.vue

@@ -289,6 +289,7 @@
              </template>
            </el-table-column>
           <el-table-column  prop="SecondUnit"  min-width="110" label="二级单位" align="center" show-overflow-tooltip>
+            <template slot="header" slot-scope="scope">二级单位&nbsp;&nbsp;<i @click="batchSetSecUnit" class="el-icon-arrow-down" style="cursor: pointer;"></i> </template>
             <template slot-scope="scope">
               <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.SecondUnit'" :rules="rules.SecondUnit">
                 <el-select filterable size="small" v-model="scope.row.SecondUnit" placeholder="请选择" style="width: 100%">
@@ -877,6 +878,15 @@
           }
         })
       },
+      batchSetSecUnit () {
+        let that = this
+        let selectedId = that.tableDataList.tableData[0].SecondUnit
+        if (selectedId) {
+          that.tableDataList.tableData.forEach((item, index) => {
+            that.$set(that.tableDataList.tableData[index], 'SecondUnit', selectedId)
+          })
+        }
+      },
       // 状态判断
       statusFun () {
         let data = {