ludc
2023-07-19 2025087a8dec8f2d301459b9d41c9ef00f6f9289
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="overflow:hidden;">
        <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,20 +58,20 @@
        </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"
                   style="height: calc(100vh - 230px);"
                   @node-click="nodeClick"
                   class="classifyTree"
        >
        </avue-tree>
        </div>
      </basic-container>
    </el-aside>
    <el-main>
      <basic-container style="height: 85vh; max-height: 155vh; ">
      <basic-container style="height: calc(100vh - 150px);">
        <!--        右侧表格-->
        <avue-tabs :option="tabOption" @change="handleChange"></avue-tabs>
        <span v-if="type.prop==='tab1'">
@@ -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="高级查询">
@@ -120,10 +124,10 @@
                      <div style="margin-bottom: 5px"><el-tag>主题库分类</el-tag></div>
                      <!--                      克隆模板的树 沿用首页树的loading和option,但是data和v-model绑定的数据创建一个新的变量,另外点击方法也是重新获取来操作克隆模板的数据-->
                        <avue-tree  v-model="TreeAvueform" v-loading="loading" :data="Treedata"
                                   :defaultExpandAll="false"
                                   :option="Treeoption"
                                   style="height: 50.5vh;margin-right: 10px"
                                   @node-click="ClonenodeClick"
                                    :defaultExpandAll="false"
                                    :option="Treeoption"
                                    style="height: 50.5vh;margin-right: 10px"
                                    @node-click="ClonenodeClick"
                        >
                        </avue-tree>
                    </el-aside>
@@ -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,17 @@
                    </el-dialog>
                </el-dialog>
            </template>
                  <template #menu="{ size, row }">
                  <template #menu="{ size, row ,index}">
                    <el-button type="text"
                               v-if="row.lcStatus == 'Editing'"
                               icon="el-icon-edit-outline "
                               :size="size"
                               @click="$refs.textCrud.rowEdit(row)">编辑</el-button>
                    <el-button type="text"
                               v-if="row.lcStatus == 'Editing'"
                               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')"
@@ -197,7 +212,7 @@
          </avue-crud>
          </basic-container>
          <templatePro :ProData="this.ProData" :crudOid="this.crudOid" :crudArray="this.crudArray" :Formlist="this.Formlist" :codeClassifyOid="this.codeClassifyOid"></templatePro>
          <templatePro :ProData="this.ProData" :crudOid="this.crudOid" :crudLCStatus="this.crudLCStatus" :crudArray="this.crudArray" :Formlist="this.Formlist" :codeClassifyOid="this.codeClassifyOid"></templatePro>
        </span>
        <!--     编码规则-->
        <el-dialog  :visible.sync="MasterdialogVisible"   title="为【编码规则】选取值" append-to-body>
@@ -326,11 +341,11 @@
  //使用inject接收参数
  //Treeoption左侧树新增表单项 Treedata左侧树节点 配置项 crudTreeOption右侧表格配置项 crudTreeData右侧表格显示内容
  //Treeform右侧表单配置项
  inject: [, "crudTreeData"],
  inject: ["crudTreeData"],
  data() {
    return {
      //树节点显示隐藏
      TreeFlag:false,
      TreeFlagCode:false,
      //编码规则
      MasterdialogVisible:false,
      masterData:[],
@@ -400,6 +415,8 @@
      addFlag:false,
      // 表格当前行id
      crudOid:"",
      //当前选中模板状态
      crudLCStatus:'',
      //表格当前选择数组
      crudArray:[],
      //模板属性展示内容
@@ -621,13 +638,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 +665,8 @@
        height:180,
        selection:true,
        addBtn:this.Formlist.length<=0  && this.nodeClickList != "",
        editBtn:false,
        delBtn:false,
        column: [
          {
            label: "模板编号",
@@ -675,18 +705,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 +752,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 +779,6 @@
        this.KeySelectLIst=[]
        this.$set(this.TreeAddform,'codeKeyAttrRepeatOidName',this.KeyName)
        this.$set(this.TreeAddform,'codeKeyAttrRepeatOid',this.KeyOid)
        console.log(this.TreeAddform)
      }
    },
    //关键属性查询
@@ -837,7 +857,6 @@
      this.simSelectList=row;
      this.simName=row[0].name;
      this.simOid=row[0].oid;
      console.log('oid',this.oid)
    },
    //相似项项接口
    simdefaultRend(){
@@ -895,7 +914,6 @@
    //业务类型接口
    btmdefaultRend(masterParameter){
      referDataGrid({valueField:'id',isMuti:'false',...masterParameter}).then(res=>{
        // console.log(res)
        this.BtmData=res.data.data.records
      })
    },
@@ -906,8 +924,9 @@
    //行单选事件
    selectHandle(selection,row){
      this.crudOid=row.oid;
      this.crudLCStatus=row.lcStatus;
      this.crudArray=selection;
      gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': this.Formlist[0].oid}).then(res => {
      gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': row.oid}).then(res => {
        this.ProData = res.data.data;
      }).catch(res => {
        this.$message.error(res)
@@ -954,7 +973,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 +1050,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 +1129,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 +1152,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 +1239,6 @@
          });
        })
      }
      console.log('123',this.codeClassifyOid)
    },
    //模板管理修改
    CrudRowUpdata(row,index,done) {
@@ -1366,6 +1392,15 @@
</script>
<style lang="scss" scoped>
.el-container{
  height: 100%;
}
.el-aside {
  height: calc(100% - 30px);
}
.el-main {
  height: calc(100% - 30px);
}
.el-form {
  display: flex;
  flex-wrap: wrap; /* 设置可换行,以便在小屏幕设备上使用多行布局 */