zhangh 2 anni fa
parent
commit
0042dfa901

+ 9 - 0
src/api/exctab/excelmodel.js

@@ -127,4 +127,13 @@ export const getExcelHtml = (params) => {
         method: 'get',
         params
     })
+}
+
+//清表生成html
+export const submitExcelRelationWbsTreeAndElement = (data) => {
+    return request({
+        url: ' /api/blade-manager/wbsFormElement/submitExcelRelationWbsTreeAndElement',
+        method: 'post',
+        data
+    })
 }

+ 4 - 0
src/styles/xiaoyu.scss

@@ -48,6 +48,10 @@
     margin-top: 25px;
 }
 
+.martop40 {
+    margin-top: 40px;
+}
+
 .marbottom5 {
     margin-bottom: 5px;
 }

+ 238 - 9
src/views/exctab/ElementIdentification/index.vue

@@ -100,46 +100,187 @@
       </el-col>
     </el-row>
 
+    <!-- 关联公共WBS模板 -->
     <el-dialog
       title="关联公共WBS模板"
+      class="excelBox"
       :visible.sync="AssociatedPublicTap"
-      width="30%"
+      modal-append-to-body
+      append-to-body
       :before-close="AssociatedPublicClose"
     >
-      <span>这是一段信息</span>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-select
+            style="width:400px;"
+            v-model="GLExcelFrom.name"
+            placeholder="请选择"
+            @change="changetherr()"
+          >
+            <el-option
+              v-for="(item,key) in GLExcelData"
+              :key="key"
+              :label="item.name"
+              :value="item.id"
+            >
+            </el-option>
+          </el-select>
+          <el-scrollbar style="margin-top:20px;height:50vh;">
+            <el-input
+              style="width:400px;"
+              v-model.trim="GLExcelFrom.search"
+              placeholder="请输入需要选择的内容"
+            ></el-input>
+            <el-tree
+              :filter-node-method="filterNode222"
+              @node-click="handleNodeClickExcel"
+              ref="tree"
+              class="filter-tree"
+              style="margin-top:10px;"
+              :props="GLExcelProps"
+              :data="exceldata"
+              node-key="id"
+              accordion
+            >
+            </el-tree>
+          </el-scrollbar>
+        </el-col>
+        <el-col :span="12">
+          <el-button
+            type="primary"
+            style="float:right;"
+            class="marbottom20"
+            @click="addElementMD"
+            :disabled="addElement"
+          >新增元素信息表</el-button>
+
+          <el-table
+            :data="addTableData"
+            border
+            style="width: 100%"
+          >
+            <el-table-column
+              prop="tableName"
+              label="已有元素表名称"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="name"
+              label="操作"
+              align="center"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  type="primary"
+                  size="mini"
+                  v-show="!scope.row.checknd"
+                >关联</el-button>
+                <el-button
+                  type="primary"
+                  size="mini"
+                  v-show="scope.row.checknd"
+                >取消关联</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+
+          <div v-if="addElement">
+            <div class="flexBetween martop40">
+              <el-input
+                v-model="addElementForm.name"
+                placeholder="请输入表名"
+              ></el-input>
+              <el-select
+                class="marleft10"
+                v-model="addElementForm.region"
+                placeholder="请选择表类型"
+              >
+                <el-option
+                  v-for="(item,index) in dataType"
+                  :key="index"
+                  :label="item.dictValue"
+                  :value="item.dictKey"
+                ></el-option>
+              </el-select>
+            </div>
+            <el-select
+              style="width:100%;"
+              class="martop20 "
+              v-model="addElementForm.region"
+              placeholder="请选择所属方"
+            >
+              <el-option
+                v-for="(item,index) in exceltypeData"
+                :key="index"
+                :label="item.dictValue"
+                :value="item.dictKey"
+              ></el-option>
+            </el-select>
+          </div>
+        </el-col>
+      </el-row>
       <span
         slot="footer"
         class="dialog-footer"
+        style="display: flex;justify-content: center;align-items: center;"
       >
-        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button @click="AssociatedPublicClose()">取 消</el-button>
         <el-button
+          style="margin-left:30px;"
           type="primary"
-          @click="dialogVisible = false"
+          @click="saveElementMD()"
         >确 定</el-button>
       </span>
     </el-dialog>
   </basic-container>
 </template>
 <script>
-import { tabLazytree, detailExcel } from "@/api/exctab/excelmodel";
+import { tabLazytree, detailExcel, excelType, submitExcelRelationWbsTreeAndElement } from "@/api/exctab/excelmodel";
 import { dictionarydataType } from "@/api/exctab/editelement";
 import { getColByTabId } from "@/api/manager/AdjustForm";
+import { selectByNodeTable } from "@/api/manager/wbstree";
+import { getList, tabLazytreeAll, } from '@/api/exctab/excelmodel'
 export default {
   data () {
     return {
+      //#region 左侧树节点
       treeData: [],
       treeProps: {
         label: 'name',
         children: 'children',
         isLeaf: 'hasChildren'
       },
+      //#endregion
       excelSrc: '',
       from: {
         id: '',
         extension: '',
       },
-      tableData: [],
+      tableData: [],//外层table
       dataType: [],
+      AssociatedPublicTap: false,
+      //#region 弹框属性
+      GLExcelFrom: {
+        id: "",
+        name: '',
+        search: '',//搜素框舒服的值
+      },
+      GLExcelData: [],//
+      GLExcelProps: {
+        label: 'name',
+        children: 'children',
+        disabled: 'hasChildren',
+        // isLeaf: !'hasChildren',
+      },
+      exceldata: [],//清表模板树数据
+      addTableData: [],//新增元素信息表
+      exceltypeData: [],//清表类型
+      addElement: false,
+      addElementForm: {
+
+      }
+      //#endregion
     }
   },
   methods: {
@@ -179,14 +320,95 @@ export default {
         // this.tableData = res.data
       }
     },
+    //#endregion
+
+    //#region 关联公共WBS模板弹框
     establish () {//关联WBS并创建元素
+      this.getList()
+      this.AssociatedPublicTap = true
+    },
+    AssociatedPublicClose () {//关联公共WBS模板关闭事件
 
     },
-    //#endregion
+    changetherr () {//下拉框change事件
+      if (this.GLExcelFrom.name != "") {
+        this.GLExcelFrom.search = ''
+        this.tabLazytreeAll()
+      }
+    },
+    filterNode222 (value, data) {//搜索显示隐藏事件
+      if (!value) return true;
+      return data.name.indexOf(value) !== -1;
+    },
+    addElementMD () {//新增元素信息表按钮
+      this.excelType()
+      this.addElement = true
+    },
+    async getList () {//获取清表模板信息
+      const { data: res } = await getList({
+        current: 1,
+        size: 100000,
+        parentId: 0,
+        wbstype: 1,//公有
+      })
+      console.log(res);
+      if (res.code === 200 && res.msg === '操作成功') {
+        this.GLExcelData = res.data.records
+      }
+    },
+    async tabLazytreeAll () {//清表树信息
+      const { data: res } = await tabLazytreeAll({
+        modeId: this.GLExcelFrom.name,
+        name: this.GLExcelFrom.search,
 
-    //#region 
-    AssociatedPublicClose () {//关联公共WBS模板关闭事件
+      })
+      console.log(res);
+      if (res.code === 200 && res.msg === '操作成功') {
+        this.exceldata = res.data
+      }
+    },
+    handleNodeClickExcel (data) {//点击节点事件
+      console.log(data);
+      if (!data.hasChildren) {
+        this.selectByNodeTable(data.id)
+      }
+    },
+    async selectByNodeTable (id) {//获取清表信息
+      const { data: res } = await selectByNodeTable({ id })
+      console.log(res);
+      if (res.code == 200) {
+        if (res.data.length > 0) {
+          res.data.forEach(val => {
+            if (val.isLinkTable == 2) {
+              val.checknd = true
+            } else {
+              val.checknd = false
+            }
+          })
+        }
+        this.addTableData = res.data
+      }
+    },
+    async excelType () {//清表类型
+      const { data: res } = await excelType({ code: 'sys_excltab_type' })
+      console.log(res);
+      if (res.code === 200) {
+        this.exceltypeData = res.data
+      }
+    },
+    saveElementMD () {//保存按钮
 
+    },
+    async submitExcelRelationWbsTreeAndElement () {
+      const { data: res } = await submitExcelRelationWbsTreeAndElement({
+        deptName: "测试表单22222223",
+        wbsId: 1,
+        parentId: "1541657303195742209",
+        tableType: 2,
+        tableOwner: 2,
+        elementList: []
+      })
+      console.log(res);
     },
     //#endregion
 
@@ -224,6 +446,13 @@ export default {
     },
     //#endregion
   },
+  watch: {
+    'GLExcelFrom.search' (val) {
+      if (this.exceldata) {
+        this.$refs.tree.filter(val);
+      }
+    }
+  },
   created () {
   }
 }

+ 2 - 1
src/views/manager/projectinfo/tree.vue

@@ -2103,7 +2103,8 @@ export default {
       this.getList({
         current: 1,
         size: 100000,
-        parentId: 0
+        parentId: 0,
+        wbstype: 2,//私有
       })
       this.GLExcelFrom.name = scope.row.modeId
       setTimeout(() => {