Browse Source

清表模板相关问题修复

gangyj 3 years ago
parent
commit
640697ed71
1 changed files with 44 additions and 41 deletions
  1. 44 41
      src/views/exctab/excelmodel/excelmodel.vue

+ 44 - 41
src/views/exctab/excelmodel/excelmodel.vue

@@ -48,7 +48,6 @@
                 <i
                   class="el-icon-delete marleft10"
                   @click.stop="deleteExcelM(data,node)"
-                  v-if="!data.hasChildren&&data.fileType!=1"
                 ></i>
               </span>
             </div>
@@ -156,7 +155,7 @@
           ref="excelForm"
           :model="excelForm"
           label-width="80px"
-          rules="rules"
+          :rules="rules"
         >
           <div style="display: flex;justify-content: space-between;">
             <el-form-item
@@ -209,9 +208,8 @@
                 ></el-option>
               </el-select>
             </div>
-            <div class="leftscroll">
+            <div class="leftscroll" v-loading="loading">
               <avue-tree
-                :loading="loading"
                 :option="option2"
                 :data="wbsdata"
                 @node-click="nodeClickExcel"
@@ -229,41 +227,34 @@
           </div>
           <!-- 右侧关联 -->
           <template>
-            <table
-              class="right"
-              width="49%"
-              bordercolor="#DCDCDC"
-              border="1px"
-            >
-              <thead>
-                <tr>
-                  <td>表名</td>
-                  <td>操作</td>
-                </tr>
-              </thead>
-              <tbody>
-                <tr
-                  v-for="(val,index) in tableData"
-                  :key="index"
-                >
-                  <td style="width:50%;">{{val.tableName}}</td>
-                  <td style="text-align: center;height:30px;">
-                    <el-button
-                      v-if="val.isLinkTable!=2"
-                      type="info"
-                      size="small"
-                      @click="relation(index)"
-                    >关联</el-button>
-                    <el-button
-                      v-if="val.isLinkTable==2"
-                      type="warning"
-                      size="small"
-                      @click="Disassociate(index)"
-                    >取消关联</el-button>
-                  </td>
-                </tr>
-              </tbody>
-            </table>
+            <el-table
+              :data="tableData"
+              border height="502px"
+              style="width: 100%;margin-left:20px">
+              <el-table-column
+                prop="tableName"
+                label="表名">
+              </el-table-column>
+              <el-table-column
+                label="操作"
+                align="center"
+                width="120">
+                <template slot-scope="scope">
+                  <el-button
+                    v-if="scope.row.isLinkTable!=2"
+                    type="info"
+                    size="small"
+                    @click="relation(scope.$index)"
+                  >关联</el-button>
+                  <el-button
+                    v-if="scope.row.isLinkTable==2"
+                    type="warning"
+                    size="small"
+                    @click="Disassociate(scope.$index)"
+                  >取消关联</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
           </template>
         </div>
       </div>
@@ -405,8 +396,10 @@ export default {
       }
     },
     async wbstree () {//wbs树懒加载
+      this.loading = true;
       const { data: res } = await wbstree({ parentId: 0, wbsId: this.excelForm.wbsId, wbsType: this.excelForm.wbsType })
       console.log(res);
+      this.loading = false
       if (res.code === 200) {
         res.data.forEach((val) => {
           if (!val.hasChildren) {
@@ -454,6 +447,10 @@ export default {
       const { data: res } = await Excelmodify(wbsExclTabParmVO)
       console.log(res);
       if (res.code === 200) {
+        this.$message({
+          type: 'success',
+          message: '保存成功'
+        })
         let ids = ''
         if (wbsExclTabParmVO.id) {
           ids = this.treeNode.parentId
@@ -605,6 +602,14 @@ export default {
     },
     deleteExcelM (data, node) {//删除
       console.log(node);
+      if(data.hasChildren){
+        this.$message({
+          type: 'warning',
+          message: '该节点下有子节点,无法删除'
+        })
+        return;
+      }
+
       const _that = this
       this.$confirm('确定将选择数据删除?', '', {
         confirmButtonText: '确定',
@@ -642,9 +647,7 @@ export default {
       if (val) {
         this.wbsmodel.forEach((da) => {
           if (da.id == val) {
-            this.loading = true
             this.excelForm.wbsType = da.wbsType
-            this.loading = false
           }
         })
       }