فهرست منبع

fix:修复表单模板配置响应式失效的bug

luoaoxuan 1 سال پیش
والد
کامیت
8a42729448
2فایلهای تغییر یافته به همراه57 افزوده شده و 6 حذف شده
  1. 6 5
      src/views/component/formTemplate/index.vue
  2. 51 1
      src/views/system/fasc/facilityEnvConfig.vue

+ 6 - 5
src/views/component/formTemplate/index.vue

@@ -391,11 +391,12 @@ export default {
                 const liu_cheng_shu_ju_ = JSON.parse(this.form.liu_cheng_shu_ju_)
                 console.log(liu_cheng_shu_ju_.nodeList)
                 liu_cheng_shu_ju_.nodeList.forEach((item, index) => {
-                    this.subForm[index] = {}
-                    this.subForm[index].jie_dian_ming_cheng_ = item.nodeName
-                    this.subForm[index].chu_li_ren_ = item.executor
-                    this.subForm[index].fang_shi_ = item.conditionType
-                    this.subForm[index].yong_hu_lei_xing_ = item.executeType
+                    this.$set(this.subForm, index, {
+                        jie_dian_ming_cheng_: item.nodeName,
+                        chu_li_ren_: item.executor,
+                        fang_shi_: item.conditionType,
+                        yong_hu_lei_xing_: item.executeType
+                    })
                 })
             } else {
                 this.form.di_dian_ = this.level

+ 51 - 1
src/views/system/fasc/facilityEnvConfig.vue

@@ -243,6 +243,9 @@
                             <div class="search-item" style="width:60px">
                                 <el-button type="primary" size="mini" icon="el-icon-download" @click="exportExcel">导出</el-button>
                             </div>
+                            <div v-if="trueList.length>0" class="search-item" style="width:110px">
+                                <el-button type="info" size="mini" icon="el-icon-setting" @click="settingData">使用默认数据</el-button>
+                            </div>
                             <div class="search-item" style="width:60px">
                                 <el-button type="danger" size="mini" icon="el-icon-delete" @click="removeItem">删除</el-button>
                             </div>
@@ -895,6 +898,49 @@ export default {
                     break
             }
         },
+        // 使用默认数据
+        settingData () {
+            this.$confirm('使用默认数据后子表中为空的字段将会被以上数据代替,是否继续?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+            })
+                .then(() => {
+                    this.subForm.forEach(item => {
+                        if (item.bu_men_ === '') {
+                            item.bu_men_ = this.form.bian_zhi_bu_men_
+                        }
+                        if (item.jian_ce_gang_wei_ === '') {
+                            item.jian_ce_gang_wei_ = this.form.gang_wei_
+                        }
+                        if (item.kong_zhi_tiao_jia === '') {
+                            item.kong_zhi_tiao_jia = this.form.tiao_jian_
+                        }
+                        if (item.jian_ce_ri_qi_ === '') {
+                            item.jian_ce_ri_qi_ = this.form.jian_ce_ri_qi_
+                        }
+                        if (item.ri_qi_lie_biao_ === '') {
+                            item.ri_qi_lie_biao_ = this.form.ri_qi_lie_biao_
+                        }
+                        if (item.jian_ce_zhou_qi_ === '') {
+                            item.jian_ce_zhou_qi_ = this.form.zhou_qi_
+                        }
+                        if (item.lie_biao_shu_ju_ && this.form.lie_biao_shu_ju_) {
+                            const main = JSON.parse(this.form.lie_biao_shu_ju_)
+                            const sub = JSON.parse(item.lie_biao_shu_ju_)
+                            sub.forEach((i, index) => {
+                                if (i.range.length === 0 || i.range === [null, null]) {
+                                    i.range = main[index].range
+                                }
+                                if (i.fixValue === '') {
+                                    i.fixValue = main[index].fixValue
+                                }
+                            })
+                            item.lie_biao_shu_ju_ = JSON.stringify(sub)
+                        }
+                    })
+                })
+        },
         // 当前页码改变
         handleCurrentChange (val) {
             this.currentPage = val
@@ -1229,6 +1275,9 @@ export default {
             const workBook = xlsx.read(dataBinary, { type: 'binary', cellDates: true })
             const workSheet = workBook.Sheets[workBook.SheetNames[0]]
             const data = xlsx.utils.sheet_to_json(workSheet)
+            if (!this.form.lei_xing_) {
+                return this.$message.warning('请先选择类型!')
+            }
             if (data.length === 0) {
                 return this.$message.warning('文件内容为空!')
             }
@@ -1246,7 +1295,8 @@ export default {
                     deviceno2_: item['监控设备编号'] || '',
                     jian_ce_ri_qi_: '',
                     ri_qi_lie_biao_: '',
-                    zi_wai_deng_wai_j: this.$utils.guid()
+                    zi_wai_deng_wai_j: this.$utils.guid(),
+                    lie_biao_shu_ju_: this.form.lie_biao_shu_ju_
                 })
             })
             this.$message.success('导入成功!')