lihang
2023-07-13 7ce592bb5a5b9e0dc78786e727f042b95ebc81c8
Source/UBCS-WEB/src/components/Tree/classifyTrees.vue
@@ -3,16 +3,22 @@
  <el-container>
    <!--    左侧菜单-->
    <el-aside >
      <basic-container style="height: 85vh; max-height: 155vh; overflow-y: scroll;"@click.native="handleClickOutside" >
        <div @click.native="handleClickOutside">
      <basic-container style="height: 85vh; max-height: 155vh; overflow-y: scroll;">
        <div>
          <div style="display: flex;justify-content: space-around">
            <el-button plain size="small" type="primary" @click="TreeAdd">添加</el-button>
            <el-button plain size="small" type="primary" @click="TreeEdit">修改</el-button>
            <el-button plain size="small" type="primary" @click="TreeDel">删除</el-button>
<!--            <el-button plain size="small" type="primary" @click="ExportExcel">导出</el-button>-->
<!--            <el-button plain size="small" type="primary" @click="ImportExcel">导入</el-button>-->
            <el-button plain size="small" type="primary" @click="flushed">刷新</el-button>
        <div>
          <div style="display: flex; flex-direction: column;">
            <div style="display: flex;">
              <el-button plain size="small" type="primary" @click="TreeAdd">添加</el-button>
              <el-button plain size="small" type="primary" @click="TreeEdit">修改</el-button>
              <el-button plain size="small" type="primary" @click="TreeDel">删除</el-button>
              <el-button plain size="small" type="primary" @click="flushed">刷新</el-button>
            </div>
            <div style="display: flex; margin-top: 10px">
              <el-button plain size="small" type="primary" @click="Enable">启用</el-button>
              <el-button plain size="small" type="primary" @click="Deactivate">停用</el-button>
              <el-button plain size="small" type="primary" @click="ImportExcel">导入</el-button>
              <el-button plain size="small" type="primary" @click="ExportExcel">导出</el-button>
            </div>
          </div>
          <div style="display: flex;justify-content: space-around;margin-top: 5px;margin-bottom: 5px">
          </div>
@@ -33,7 +39,7 @@
            <el-form-item label="编码规则:" label-width="150px">
              <el-input v-model="TreeAddform.codeRuleOidName" autocomplete="off" style="width: 585px" @focus="CodeFoucus"></el-input>
            </el-form-item>
            <el-form-item label="业务类型:" label-width="150px" v-if="TreeFlag==false">
            <el-form-item label="业务类型:" label-width="150px" v-if="TreeFlagCode==false">
              <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">
@@ -52,13 +58,13 @@
        </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="TreeFlag" ::nodeClickList="nodeClickList"></classifyTreeform>
          <classifyTreeform ref="childForm" :loneTreeNewForm="TreeList" :nodeList="nodeList" :flag="'edit'" @MasterHandler="MasterHandler" :Editclose=" ()=>{TreeEditFormVisible=false}" :TreeFlag="TreeFlagCode" ::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"
                   style="height: 80.5vh;padding-top: 5px;padding-bottom: 30px"
                   @node-click=" nodeClick"
                   @check-change="checkChange"
                   @node-click="nodeClick"
                   class="classifyTree"
        >
        </avue-tree>
        </div>
@@ -73,7 +79,7 @@
        </span>
        <span v-else-if="type.prop==='tab2'">
            <basic-container>
               <avue-crud v-model="crudForm" v-loading="FormLoing" :data="this.Formlist" :option="this.crudTreeOption"
               <avue-crud ref="textCrud" v-model="crudForm" v-loading="FormLoing" :data="this.Formlist" :option="this.crudTreeOption"
                          @row-save="CrudRowSave"
                          @row-del="CrudRowDel"
                          @row-update="CrudRowUpdata"
@@ -83,8 +89,6 @@
            <template slot="menuLeft">
              <el-button plain size="small" type="primary" @click="FindeHanler">查询</el-button>
              <el-button plain size="small" type="primary" @click="TemRefresh">刷新</el-button>
            <el-button plain size="small" type="primary" @click="Enable">启用</el-button>
            <el-button plain size="small" type="primary" @click="Deactivate">停用</el-button>
              <el-button plain size="small" type="primary" @click="CloneBtn">从其它模板克隆</el-button>
              <!--              查询对话框-->
           <el-dialog :visible.sync="FindFormVisible" append-to-body title="高级查询">
@@ -145,6 +149,7 @@
                            <avue-crud v-model="ClonecrudForm" v-loading="FormLoing" :data="this.CloneFormlist"
                                       :option="this.ClonecrudTreeOption"
                                       @selection-change="selectionChange"
                            ></avue-crud>
                         </div>
                       </el-main>
@@ -165,7 +170,16 @@
                    </el-dialog>
                </el-dialog>
            </template>
                  <template #menu="{ size, row }">
                  <template #menu="{ size, row ,index}">
                    <el-button type="text"
                               v-if="row.lcStatus != 'Released'"
                               icon="el-icon-edit-outline "
                                :size="size"
                                @click="$refs.textCrud.rowEdit(row)">编辑</el-button>
                    <el-button type="text"
                               icon="el-icon-delete"
                               :size="size"
                               @click="$refs.textCrud.rowDel(row,index)">删除</el-button>
                <el-button
                  v-show="row.lcStatus === 'Released'"
                  @click="upAndStopAndStart(row, 'upVersion')"
@@ -326,11 +340,11 @@
  //使用inject接收参数
  //Treeoption左侧树新增表单项 Treedata左侧树节点 配置项 crudTreeOption右侧表格配置项 crudTreeData右侧表格显示内容
  //Treeform右侧表单配置项
  inject: [, "crudTreeData"],
  inject: ["crudTreeData"],
  data() {
    return {
      //树节点显示隐藏
      TreeFlag:false,
      TreeFlagCode:false,
      //编码规则
      MasterdialogVisible:false,
      masterData:[],
@@ -621,13 +635,24 @@
          funAPi: startRelease,
          load: 'startReleaseLoad'
        }
      }
      },
      //模板管理编辑
      showEditBtn:false,
    }
  },
  //tab栏默认是表格
  mounted() {
    this.type = this.tabOption.column[0];
    this.getAttr();
    const treeEle = this.$refs.tree.$el
    treeEle.addEventListener('click', (e) => {
      if (e.target.nodeName !== 'SPAN') {
        this.$refs.tree.setCurrentKey(null)
        this.nodeClickList = {}
        this.TreeList=[]
        this.TreeFlagCode=false;
      }
    }, true)
  },
  computed:{
    crudTreeOption(){
@@ -637,6 +662,8 @@
        height:180,
        selection:true,
        addBtn:this.Formlist.length<=0  && this.nodeClickList != "",
        editBtn:false,
        delBtn:false,
        column: [
          {
            label: "模板编号",
@@ -675,18 +702,10 @@
    }
  },
  methods: {
    //树节点失去焦点
    handleClickOutside(event) {
      const treeElement = this.$refs.tree.$el;
      const targetElement = event.target;
      if (!treeElement.contains(targetElement)) {
        // 在树组件外部点击,清空选择状态
        // this.nodeClickList=[];
        // this.CloneTreeAvueform={}
        console.log(this.nodeClickList  )
        console.log(this.CloneTreeAvueform)
      }
    },
    //模板管理已发布编辑
    // checkShowEditBtn() {
    //   this.showEditBtn = this.Formlist.some(item => item.lcStatus === 'Released');
    // },
    //编码规则失焦
    CodeFoucus(){
      this.MasterdialogVisible=true;
@@ -730,7 +749,6 @@
        this.$set(this.TreeAddform,'codeRuleOidName',this.masterName)
        this.$set(this.TreeAddform,'codeRuleOid',this.masterOid)
        this.$emit('MasterHandler',this.loneTreeNewForm)
        console.log(this.loneTreeNewForm)
      }
    },
    //编码接口
@@ -758,7 +776,6 @@
        this.KeySelectLIst=[]
        this.$set(this.TreeAddform,'codeKeyAttrRepeatOidName',this.KeyName)
        this.$set(this.TreeAddform,'codeKeyAttrRepeatOid',this.KeyOid)
        console.log(this.TreeAddform)
      }
    },
    //关键属性查询
@@ -837,7 +854,6 @@
      this.simSelectList=row;
      this.simName=row[0].name;
      this.simOid=row[0].oid;
      console.log('oid',this.oid)
    },
    //相似项项接口
    simdefaultRend(){
@@ -954,7 +970,6 @@
      const data = this.TreeAddform;
      // data.btmtypename= this.TreeList.btmtypename
      this.$set(data, "parentCodeClassifyOid", this.nodeClickList.oid);
      console.log("data", data);
      TreeSave(data)
        .then(() => {
          this.$message({
@@ -1032,14 +1047,13 @@
    },
    //修改回填
    TreeEdit() {
      if (this.nodeClickList == "") {
      if ( Object.keys(this.nodeClickList).length<1) {
        this.$message({
          type: 'warning',
          message: '请先从树上选择一条数据!'
        });
      } else {
        this.TreeEditFormVisible = true;
        console.log(this.TreeList)
      }
    },
    //树刷新
@@ -1112,9 +1126,8 @@
    //树点击事件
    async nodeClick(data) {
      //定义一个模板属性id,数据是模板管理表格里面的oid
      console.log('树',data)
      if(data.parentId == ""){
        this.TreeFlag=true;
        this.TreeFlagCode=true;
      }
      this.nodeClickList = data
      this.ProData=[]
@@ -1136,14 +1149,25 @@
          this.$message.error(res)
        })
        //  基本信息表单数据
        await getObjectByOid(this.nodeClickList.oid).then(res => {
          this.TreeList = res.data.data;
        }).catch(res => {
          this.$message.error(res)
        })
          await getObjectByOid(this.nodeClickList.oid).then(res => {
            this.TreeList = res.data.data;
          }).catch(res => {
            this.$message.error(res)
          })
      } catch (error) {
        this.$message.error(error)
      }
    },
    treeClick(e) {
      console.log(e);
    },
    //基本信息表单刷新
    referTreeForm(){
       getObjectByOid(this.nodeClickList.oid).then(res => {
        this.TreeList = res.data.data;
      }).catch(res => {
        this.$message.error(res)
      })
    },
    //克隆模板树的点击切换数据
    async ClonenodeClick(data){
@@ -1212,7 +1236,6 @@
          });
        })
      }
      console.log('123',this.codeClassifyOid)
    },
    //模板管理修改
    CrudRowUpdata(row,index,done) {