田源
2023-08-01 da327aebecb89925e1ccd3cef41dce51a150cb7f
主题库分类添加和修改-父节点操作存储业务类型
已修改3个文件
146 ■■■■■ 文件已修改
Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTreeform.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue 140 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
@@ -1681,6 +1681,7 @@
      batchAddSave(JSON.parse(JSON.stringify(this.ProData))).then(res => {
        this.$message.success('保存成功')
        this.editOpenFlag=false;
        // 调用父组件修改按钮状态
        this.$emit('editCloseChildren')
      }).catch(()=>{
        this.$message.warning('保存失败,请查看控制台输出!')
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTreeform.vue
@@ -334,6 +334,11 @@
    }
  },
  watch:{
    TreeFlag:{
      handler(newval,oldval){
        console.log(newval)
      }
    }
  },
  created() {
  },
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">
@@ -350,6 +350,9 @@
  inject: ["crudTreeData"],
  data() {
    return {
      AddLoading:false,
      // 定义一个变量来保存树请求的数量
      requestCount:0,
      //导入状态框
      ThemeImportVisible:false,
      selectRow:'',
@@ -656,6 +659,13 @@
      showEditBtn:false,
    }
  },
  watch:{
    TreeFlagCode:{
      handler(newval,oldval){
        console.log('TreeFlagCode',newval)
      }
    }
  },
  //tab栏默认是表格
  mounted() {
    this.type = this.tabOption.column[0];
@@ -728,9 +738,6 @@
    }
  },
  created() {
  },
  watch:{
  },
  methods: {
@@ -996,11 +1003,23 @@
      }
    },
    //树节点添加按钮
    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 {
        if (this.nodeClickList !== "") {
          this.TreeFlag = true;
        }
        await new Promise(resolve => setTimeout(resolve, 500));
        this.TreeAddFormVisible = true;
        loading.close();
      } catch (error) {
        this.$message.error(error);
        loading.close();
      }
    },
    //树节点添加事件
@@ -1173,72 +1192,61 @@
    },
    //树点击事件
    async nodeClick(data) {
      //定义一个模板属性id,数据是模板管理表格里面的oid
      if(data.parentId == ""){
        this.TreeFlagCode=true;
      console.log(data);
      if (data.parentId === "") {
        this.TreeFlagCode = true;
      }else {
        this.TreeFlagCode =false;
      }
      this.nodeClickList = data
      this.selectRow=0;
      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
            }
          })
          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;
            this.gridCode()
          }else {
              this.ProData = [];
        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;
          }
        }).catch(res => {
          this.$message.error(res)
        })
        //  基本信息表单数据
          await getObjectByOid(this.nodeClickList.oid).then(res => {
            this.TreeList = res.data.data;
          }).catch(res => {
            this.$message.error(res)
          })
        });
        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.TreeList = res3.data.data;
      } catch (error) {
        this.$message.error(error)
        this.$message.error(error);
      }
    },
    gridCode(){
      gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': this.Formlist[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
                }
    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(res => {
        this.$message.error(res)
      })
      } catch (error) {
        this.$message.error(error);
      }
    },
    treeClick(e) {
      console.log(e);
@@ -1423,6 +1431,8 @@
          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;
            //分类注入数据格式