田源
2023-08-02 9941378cc6e6eefa0f927cde165c47c5585c00ea
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -24,7 +24,7 @@
          </div>
        </div>
        <!--        树节点添加对话框-->
        <el-dialog :title="this.TreeFlag ? '添加分类' :'添加主题库'" :visible.sync="TreeAddFormVisible" append-to-body
        <el-dialog :title="this.TreeFlag ? '添加分类' :'添加主题库'" :visible.sync="TreeAddFormVisible"  v-loading="AddLoading" append-to-body
                   style="width: 1700px;margin: auto">
          <el-form :model="TreeAddform" :rules="rules">
            <el-form-item :label="this.TreeFlag ? '分类编号:' :'主题库编号:'" label-width="150px" style="display: inline-block" prop="id">
@@ -33,7 +33,7 @@
            <el-form-item :label="this.TreeFlag ? '分类名称:' :'主题库名称:'" label-width="110px" style="display: inline-block" prop="name">
              <el-input v-model="TreeAddform.name" autocomplete="off" style="width: 170px"></el-input>
            </el-form-item>
            <el-form-item label="存储的业务类型:" label-width="150px" v-if="TreeFlagCode==false" prop="btmTypeName">
            <el-form-item label="存储的业务类型:" label-width="150px" v-if="TreeFlagCode" prop="btmTypeName">
              <el-input v-model="TreeAddform.btmTypeName" autocomplete="off" style="width: 585px" @focus="btmFoucus"></el-input>
            </el-form-item>
            <el-form-item label="描述:" label-width="150px">
@@ -58,7 +58,7 @@
        </el-dialog>
        <!--        修改对话框-->
        <el-dialog :visible.sync="TreeEditFormVisible" append-to-body title="修改分类">
          <classifyTreeform ref="childForm" :loneTreeNewForm="TreeList" :nodeList="nodeList" :flag="'edit'" @MasterHandler="MasterHandler" :Editclose=" ()=>{TreeEditFormVisible=false}" :TreeFlag="TreeFlagCode" ::nodeClickList="nodeClickList" @referTreeForm="referTreeForm" @flushed="flushed"></classifyTreeform>
          <classifyTreeform ref="childForm" :loneTreeNewForm="TreeList" :nodeList="nodeList" :flag="'edit'" @MasterHandler="MasterHandler" :Editclose=" ()=>{TreeEditFormVisible=false}" :TreeFlag="editTreeFLagCode" :nodeClickList="nodeClickList" @referTreeForm="referTreeForm" @flushed="flushed"></classifyTreeform>
        </el-dialog>
        <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="CloneTreedata" :defaultExpandAll="false"
                   :option="Treeoption"
@@ -350,11 +350,17 @@
  inject: ["crudTreeData"],
  data() {
    return {
      AddLoading:false,
      // 定义一个变量来保存树请求的数量
      requestCount:0,
      //导入状态框
      ThemeImportVisible:false,
      selectRow:'',
      selectList:[],
      //树节点显示隐藏
      TreeFlagCode:false,
      TreeFlagCode:true,
      //修改节点显示隐藏
      editTreeFLagCode:false,
      //编码规则
      MasterdialogVisible:false,
      masterData:[],
@@ -655,6 +661,13 @@
      showEditBtn:false,
    }
  },
  watch:{
    TreeFlagCode:{
      handler(newval,oldval){
        console.log('TreeFlagCode',newval)
      }
    }
  },
  //tab栏默认是表格
  mounted() {
    this.type = this.tabOption.column[0];
@@ -665,7 +678,7 @@
        this.$refs.tree.setCurrentKey(null)
        this.nodeClickList = {}
        this.TreeList=[]
        this.TreeFlagCode=false;
        this.TreeFlagCode=true;
      }
    }, true)
  },
@@ -738,17 +751,12 @@
    ExportExcel(){
      if(this.nodeClickList){
        exportClassify({oid:this.nodeClickList.oid}).then(res=>{
          console.log(res)
          func.downloadFileByBlob(res);
          func.downloadFileByBlobHandler(res);
        })
      }else {
        this.$message.warning('请先选择要导出的主题库分类')
      }
    },
    //模板管理已发布编辑
    // checkShowEditBtn() {
    //   this.showEditBtn = this.Formlist.some(item => item.lcStatus === 'Released');
    // },
    //编码规则失焦
    CodeFoucus(){
      this.MasterdialogVisible=true;
@@ -966,30 +974,7 @@
      this.crudOid=row.oid;
      this.crudLCStatus=row.lcStatus;
      this.crudArray.push(row);
      console.log(row.$index)
      gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': row.oid}).then(res => {
        this.ProData = res.data.data;
        //分类注入数据格式
        this.ProData =  res.data.data.map((item) => {
          //如果分类注入classifyInvokeAttr为空说明是初始状态
          if(item.classifyInvokeAttr !== ''){
            if (!item.hasOwnProperty('classifyInvokeText')) { // 检查classifyInvokeText属性是否存在
              item = {
                ...item,
                classifyInvokeText: {
                  "注入类型": item.classifyInvokeAttr,
                  "注入类型名称": item.classifyInvokeAttrName,
                  "层级设置": item.classifyInvokeLevel,
                  "是否可修改": item.classifyInvokeEditFlag
                }
              };
            }
          }
          return item;
        });
      }).catch(res => {
        this.$message.error(res)
      })
      this.gridCode()
    },
    //分类树数据处理
    getAttr() {
@@ -1003,8 +988,16 @@
        })
        //调用修改属性名方法
        this.ModifyProperties(this.CloneTreedata, 'name', 'label');
        console.log(this.CloneTreedata)
        this.CloneTreedata = this.CloneTreedata.map(item => {
          if (item.attributes.lcStatus === "Disabled") {
            item.label += '【停用】';
          }
          return item;
        });
      }).catch(res => {
        this.$message.error(res)
      })
    },
    //定义一个修改数据属性名的方法
@@ -1020,11 +1013,22 @@
      }
    },
    //树节点添加按钮
    TreeAdd() {
      this.TreeAddFormVisible = true;
      // 判断当前是否有点击子项
      if (this.nodeClickList !== "") {
        this.TreeFlag = true
    async TreeAdd() {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.3)'
      });
      try {
        //新增表头名称
        this.TreeFlag=!this.nodeClickList
        await new Promise(resolve => setTimeout(resolve, 500));
        this.TreeAddFormVisible = true;
        loading.close();
      } catch (error) {
        this.$message.error(error);
        loading.close();
      }
    },
    //树节点添加事件
@@ -1197,39 +1201,59 @@
    },
    //树点击事件
    async nodeClick(data) {
      //定义一个模板属性id,数据是模板管理表格里面的oid
      if(data.parentId == ""){
        this.TreeFlagCode=true;
      }
      this.nodeClickList = data
      this.ProData=[];
      this.selectRow=0;
      console.log(data);
      //操作新增和修改的业务类型隐藏
      this.TreeFlagCode = !data;
      this.editTreeFLagCode = !data.parentId;
      this.nodeClickList = data;
      this.selectRow = 0;
      try {
        await TreeObjcet(data.oid).then(res => {
          this.FlagObj = res.data.data
        }).catch(res => {
          this.$message.error(res)
        })
        //模板管理表格数据
        await gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]': data.oid}).then(res => {
          this.Formlist = res.data.data.filter(item => {
            if (item.codeclassifyoid != "") {
              this.codeClassifyOid = item.codeclassifyoid
              return item.codeclassifyoid == this.nodeClickList.oid
            }
          })
        }).catch(res => {
          this.$message.error(res)
        })
        //  基本信息表单数据
          await getObjectByOid(this.nodeClickList.oid).then(res => {
            this.TreeList = res.data.data;
          }).catch(res => {
            this.$message.error(res)
          })
        this.requestCount += 1;
        const [res1, res2, res3] = await Promise.all([
          TreeObjcet(data.oid),
          gridCodeClassifyTemplate({ 'conditionMap[codeclassifyoid]': data.oid }),
          getObjectByOid(data.oid)
        ]);
        this.FlagObj = res1.data.data;
        this.Formlist = res2.data.data.filter(item => {
          if (item.codeclassifyoid != "") {
            this.codeClassifyOid = item.codeclassifyoid;
            return item.codeclassifyoid == this.nodeClickList.oid;
          }
        });
        if (this.Formlist.length >= 1) {
          this.crudLCStatus = this.Formlist[this.selectRow].lcStatus;
          this.crudArray.push(this.Formlist[this.selectRow]);
          this.crudOid = this.Formlist[this.selectRow].oid;
          await this.gridCode();
        } else {
          this.ProData = [];
          this.crudOid=''
        }
        this.TreeList = res3.data.data;
      } catch (error) {
        this.$message.error(error)
        this.$message.error(error);
      }
    },
    async gridCode() {
      try {
        const res = await gridCodeClassifyTemplateAttr({ 'conditionMap[classifyTemplateOid]': this.Formlist[this.selectRow].oid, limit: -1 });
        this.ProData = res.data.data.map(item => {
          if (item.classifyInvokeAttr !== '') {
            if (!item.hasOwnProperty('classifyInvokeText')) {
              item.classifyInvokeText = {
                '注入类型': item.classifyInvokeAttr,
                '注入类型名称': item.classifyInvokeAttrName,
                '层级设置': item.classifyInvokeLevel,
                '是否可修改': item.classifyInvokeEditFlag
              };
            }
          }
          return item;
        });
      } catch (error) {
        this.$message.error(error);
      }
    },
    treeClick(e) {
@@ -1296,7 +1320,6 @@
        });
      } else {
        this.$set(row, "codeclassifyoid", this.nodeClickList.oid)
        console.log(this.nodeClickList)
        addSave(row).then(() => {
          this.$message({
            type: "success",
@@ -1336,20 +1359,6 @@
        });
      })
    },
    //模板管理表格查询,只有一条数据没必要做搜索
    /*nterFind() {
      if (this.findText == "") {
        gridCodeClassifyTemplate().then(res => {
          this.Formlist = res.data.data
        })
      } else {
        gridCodeClassifyTemplate().then(res => {
          this.Formlist = res.data.data.filter(item => {
            return item.name.includes(this.findText)
          })
        })
      }
    },*/
    //克隆模板查询
    CloneEnterFind(){
      gridCodeClassifyTemplate().then(res => {
@@ -1424,12 +1433,37 @@
    },
    //刷新
    TemRefresh() {
      this.FormLoing = true
      this.FormLoing = true;
      if (this.nodeClickList.oid != "") {
        gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]': this.nodeClickList.oid}).then(res => {
          this.Formlist = res.data.data.filter(item => {
            return item.codeclassifyoid == this.nodeClickList.oid
          })
          this.crudLCStatus=this.Formlist[this.selectRow].lcStatus;
          this.crudArray.push(this.Formlist[this.selectRow]);
          gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]':  res.data.data[this.selectRow].oid,limit:-1}).then(res => {
            this.ProData = res.data.data;
            //分类注入数据格式
            this.ProData =  res.data.data.map((item) => {
              //如果分类注入classifyInvokeAttr为空说明是初始状态
              if(item.classifyInvokeAttr !== ''){
                if (!item.hasOwnProperty('classifyInvokeText')) { // 检查classifyInvokeText属性是否存在
                  item = {
                    ...item,
                    classifyInvokeText: {
                      "注入类型": item.classifyInvokeAttr,
                      "注入类型名称": item.classifyInvokeAttrName,
                      "层级设置": item.classifyInvokeLevel,
                      "是否可修改": item.classifyInvokeEditFlag
                    }
                  };
                }
              }
              return item;
            });
          }).catch(res => {
            this.$message.error(res)
          })
        })
      } else {
        this.FormLoing = true