wangting
2023-08-07 db860f9c08a23fe916121a2c76001e05d2acee3e
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -24,9 +24,9 @@
          </div>
        </div>
        <!--        树节点添加对话框-->
        <el-dialog :title="this.TreeFlag ? '添加分类' :'添加主题库'" :visible.sync="TreeAddFormVisible"  v-loading="AddLoading" append-to-body
        <el-dialog :title="this.TreeFlag ? '添加分类' :'添加主题库'" :before-close="TreeEscHandler" :visible.sync="TreeAddFormVisible"  v-loading="AddLoading" append-to-body
                   style="width: 1700px;margin: auto">
          <el-form :model="TreeAddform" :rules="rules">
          <el-form ref="myForm" :model="TreeAddform" :rules="rules">
            <el-form-item :label="this.TreeFlag ? '分类编号:' :'主题库编号:'" label-width="150px" style="display: inline-block" prop="id">
              <el-input v-model="TreeAddform.id" autocomplete="off" style="width: 170px"></el-input>
            </el-form-item>
@@ -52,7 +52,7 @@
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button @click="TreeAddFormVisible = false">取 消</el-button>
            <el-button @click="TreeEscHandler">取 消</el-button>
            <el-button type="primary" @click="TreeAddHandler">确 定</el-button>
          </div>
        </el-dialog>
@@ -121,12 +121,12 @@
        </div>
           </el-dialog>
              <!--            模板克隆  -->
                <el-dialog :visible.sync="CloneVisible" append-to-body title="克隆模板">
                <el-dialog :visible.sync="CloneVisible" append-to-body title="克隆模板" :before-close="cloneClose">
                  <el-container>
                    <el-aside width="300px">
                      <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"
                        <avue-tree ref="cloneTree" v-model="TreeAvueform" v-loading="loading" :data="Treedata"
                                    :defaultExpandAll="false"
                                    :option="Treeoption"
                                    style="height: 50.5vh;margin-right: 10px"
@@ -160,7 +160,7 @@
                    </el-container >
                   <div style="display: flex; justify-content: flex-end; align-items: center;margin-top: 10px" >
                     <el-button size="small " type="primary" @click="Clonehandler">确定</el-button>
                     <el-button size="small" @click="CloneVisible=false" >取消</el-button>
                     <el-button size="small" @click="cloneClose" >取消</el-button>
                   </div>
                      <el-dialog
                        width="30%"
@@ -231,7 +231,11 @@
            <el-input style="width: 260px;margin-left: 15px" placeholder="输入值后进行模糊查询" v-model="SelectFInd"></el-input>
            <el-button size="small"  type="primary" plain @click="SelectFindeHandler" style="margin-left: 20px">查询</el-button>
          </template>
          <avue-crud :data="masterData" :option="masterOption" @select="masterSelect"></avue-crud>
          <avue-crud :data="masterData" :option="masterOption" @row-click="masterSelect">
            <template slot="radio" slot-scope="{row}">
              <el-radio v-model="masterRow" :label="row.$index" style="padding-left: 10px !important;">{{''}}</el-radio>
            </template>
          </avue-crud>
          <div style="height: 30px">
            <div style="display: inline-block;float: left;border: 1px solid #eee;padding: 5px;margin-top: 5px;font-size: 14px " >已设置的值为:[{{this.TreeAddform.coderuleoidName ==''?'未设置值':this.TreeAddform.coderuleoidName}}]</div>
            <div style="padding-top: 10px;display: flex; justify-content: flex-end;float: right;overflow: hidden" >
@@ -255,7 +259,11 @@
            <el-input style="width: 260px;margin-left: 15px" placeholder="输入值后进行模糊查询" v-model="SelectFInd"></el-input>
            <el-button size="small"  type="primary" plain @click="KeySelectFindeHandler" style="margin-left: 20px">查询</el-button>
          </template>
          <avue-crud :data="KeyData" :option="masterOption" @select="KeySelect"></avue-crud>
          <avue-crud :data="KeyData" :option="masterOption" @row-click="KeySelect">
            <template slot="radio" slot-scope="{row}">
              <el-radio v-model="masterRow" :label="row.$index" style="padding-left: 10px !important;">{{''}}</el-radio>
            </template>
          </avue-crud>
          <div style="height: 30px">
            <div style="display: inline-block;float: left;border: 1px solid #eeeeee;padding: 5px;margin-top: 5px;font-size: 14px " >已设置的值为:[{{this.TreeAddform.codeKeyAttrRepeatOidName ==''?'未设置值':this.TreeAddform.codekeyattrrepeatoidName}}]</div>
            <div style="padding-top: 10px;display: flex; justify-content: flex-end;float: right;overflow: hidden" >
@@ -279,7 +287,11 @@
            <el-input style="width: 260px;margin-left: 15px" placeholder="输入值后进行模糊查询" v-model="SelectFInd"></el-input>
            <el-button size="small"  type="primary" plain @click="SimSelectFindeHandler" style="margin-left: 20px">查询</el-button>
          </template>
          <avue-crud :data="simData" :option="masterOption" @select="simSelect"></avue-crud>
          <avue-crud :data="simData" :option="masterOption" @row-click="simSelect">
            <template slot="radio" slot-scope="{row}">
              <el-radio v-model="masterRow" :label="row.$index" style="padding-left: 10px !important;">{{''}}</el-radio>
            </template>
          </avue-crud>
          <div style="height: 30px">
            <div style="display: inline-block;float: left;border: 1px solid #eee;padding: 5px;margin-top: 5px;font-size: 14px " >已设置的值为:[{{this.TreeAddform.codeResembleRuleOidName ==''?'未设置值':this.TreeAddform.codeResembleRuleOidName}}]</div>
            <div style="padding-top: 10px;display: flex; justify-content: flex-end;float: right;overflow: hidden" >
@@ -427,7 +439,7 @@
          label: '英文名称'
        }
      ],
      SelectValue:"",
      SelectValue:"id",
      SelectFInd:"",
      addFlag:false,
      // 表格当前行id
@@ -498,10 +510,10 @@
      },
      rules: {
        id: [
          { required: true, message: '请输入名称', trigger: 'blur' },
          { required: true, message: '请输入编号', trigger: 'blur' },
        ],
        name:[
          { required: true, message: '请输入编号', trigger: 'blur' },
          { required: true, message: '请输入名称', trigger: 'blur' },
        ],
        btmTypeName:[
          { required: true, message: '请选择业务类型', trigger: 'blur' },
@@ -672,11 +684,7 @@
    }
  },
  watch:{
    TreeFlagCode:{
      handler(newval,oldval){
        console.log('TreeFlagCode',newval)
      }
    }
  },
  //tab栏默认是表格
  mounted() {
@@ -753,6 +761,8 @@
  },
  methods: {
    // 关闭弹窗
    /** 导入 */
    ImportExcel(){
      this.ThemeImportVisible=true;
@@ -774,11 +784,11 @@
    },
    //编码多选
    masterSelect(row){
    if(row.length>0){
      this.masterRow=row.$index;
      this.masterSelectList=row;
      this.masterName=row[0].name;
      this.masterOid=row[0].oid;
    }
      this.masterName=row.name;
      this.masterOid=row.oid;
    },
    //编码规则查询
    SelectFindeHandler(){
@@ -787,15 +797,11 @@
          'conditionMap[id]':this.SelectFInd
        }
        this.MasterdefaultRend(masterParameter);
        this.SelectValue=""
        this.SelectFInd=""
      }else if(this.SelectValue == 'name'){
        const masterParameter={
          'conditionMap[name]':this.SelectFInd
        }
        this.MasterdefaultRend(masterParameter)
        this.SelectValue=""
        this.SelectFInd=""
      }
    },
    //编码规则确定
@@ -846,15 +852,11 @@
          'conditionMap[id]':this.SelectFInd
        }
        this.KeydefaultRend(masterParameter);
        this.SelectValue="";
        this.SelectFInd="";
      }else if(this.SelectValue == 'name'){
        const masterParameter={
          'conditionMap[name]':this.SelectFInd
        }
        this.KeydefaultRend(masterParameter)
        this.SelectValue=""
        this.SelectFInd=""
      }
    },
    //关键属性接口
@@ -869,9 +871,10 @@
    },
    // 关键多选
    KeySelect(row){
      this.masterRow=row.$index;
      this.KeySelectLIst=row;
      this.KeyName=row[0].name;
      this.KeyOid=row[0].oid;
      this.KeyName=row.name;
      this.KeyOid=row.oid;
    },
    //关键失焦
    simFouce(){
@@ -899,22 +902,19 @@
          'conditionMap[id]':this.SelectFInd
        }
        this.simdefaultRend(masterParameter);
        this.SelectValue=""
        this.SelectFInd=""
      }else if(this.SelectValue == 'name'){
        const masterParameter={
          'conditionMap[name]':this.SelectFInd
        }
        this.simdefaultRend(masterParameter)
        this.SelectValue=""
        this.SelectFInd=""
      }
    },
    //  相似项多选
    simSelect(row){
      this.masterRow=row.$index;
      this.simSelectList=row;
      this.simName=row[0].name;
      this.simOid=row[0].oid;
      this.simName=row.name;
      this.simOid=row.oid;
    },
    //相似项项接口
    simdefaultRend(){
@@ -952,15 +952,11 @@
          'conditionMap[id]':this.SelectFInd
        }
        this.btmdefaultRend(masterParameter);
        this.SelectValue=""
        this.SelectFInd=""
      }else if(this.SelectValue == 'name'){
        const masterParameter={
          'conditionMap[name]':this.SelectFInd
        }
        this.btmdefaultRend(masterParameter);
        this.SelectValue="";
        this.SelectFInd="";
      }
    },
    //业务类型多选
@@ -1042,32 +1038,43 @@
        loading.close();
      }
    },
    //树节点取消事件
    TreeEscHandler(){
      this.TreeAddform={};
      this.TreeAddFormVisible=false;
      // 关闭弹窗清空校验
      this.$refs.myForm.clearValidate();
    },
    //树节点添加事件
    TreeAddHandler() {
      const data = this.TreeAddform;
      // data.btmtypename= this.TreeList.btmtypename
      this.$set(data, "parentCodeClassifyOid", this.nodeClickList.oid);
      TreeSave(data)
        .then(() => {
          this.$message({
            type: "success",
            message: "添加成功!",
      if ((!this.TreeAddform.id || !this.TreeAddform.name) || (this.TreeFlagCode && !this.TreeAddform.btmTypeName)) {
        this.$message.warning('请输入内容!');
      }else {
        const data = this.TreeAddform;
        // data.btmtypename= this.TreeList.btmtypename
        this.$set(data, "parentCodeClassifyOid", this.nodeClickList.oid);
        TreeSave(data)
          .then(() => {
            this.$message({
              type: "success",
              message: "添加成功!",
            });
            Object.keys(this.TreeAddform).forEach(key => {
              this.TreeAddform[key] = "";
            });
            this.getAttr();
            this.TreeAddFormVisible = false;
            //添加完成后右侧清空
            this.ProData=[];
            this.Formlist=[];
          })
          .catch((res) => {
            this.$message({
              type: "warning",
              message: res,
            });
          });
          Object.keys(this.TreeAddform).forEach(key => {
            this.TreeAddform[key] = "";
          });
          this.getAttr();
          this.TreeAddFormVisible = false;
          //添加完成后右侧清空
          this.ProData=[];
          this.Formlist=[];
        })
        .catch((res) => {
          this.$message({
            type: "warning",
            message: res,
          });
        });
      }
    },
    //树节点删除按钮
    TreeDel() {
@@ -1221,6 +1228,7 @@
      this.editTreeFLagCode = !data.parentId;
      this.nodeClickList = data;
      this.selectRow = 0;
      this.crudArray=[]
      try {
        this.requestCount += 1;
        const [res1, res2, res3] = await Promise.all([
@@ -1340,7 +1348,7 @@
            message: "添加成功!"
          });
          done(row)
          this.CrudRend()
          this.TemRefresh();
        }).catch(res => {
          this.$message({
            type: 'info',
@@ -1352,7 +1360,7 @@
    //模板管理修改
    CrudRowUpdata(row,index,done) {
      editSave(row).then(() => {
        this.CrudRend()
        this.TemRefresh();
        this.$message({
          type: "success",
          message: "操作成功!"
@@ -1365,13 +1373,20 @@
    //模板管理删除
    CrudRowDel(row) {
      deleteData(row).then(()=> {
        this.CrudRend()
        this.TemRefresh();
      }).catch(res => {
        this.$message({
          type: 'info',
          message: res
        });
      })
    },
    //克隆取消
    cloneClose(){
      this.$refs.cloneTree.setCurrentKey(null)
      this.ClonenodeClickList = {}
      this.CloneFormlist=[]
      this.CloneVisible=false;
    },
    //克隆模板查询
    CloneEnterFind(){
@@ -1421,29 +1436,32 @@
      }
    },
    //克隆模板单选框改变
    selectionChange(row){
      this.CloneSelect=row;
      //双向绑定,提交表单输入框回填上当前选择的数据
      this.CloneModel.id=row[0].id;
      this.CloneModel.name=row[0].name;
      //这里有点绕,CloneSelect是我选择框选择的数据。等于this.nodeClickList.oid是因为,克隆模板传递数据要把当前选择树的oid传递给后端。而不是当前要克隆模板的oid
      this.CloneSelect[0].codeclassifyoid=this.nodeClickList.oid
    selectionChange(row) {
      this.CloneSelect = row;
      const { id, name } = row[0];
      this.CloneModel = { id, name };
      this.CloneSelect[0].codeclassifyoid = this.nodeClickList.oid;
      console.log('row',row)
      console.log('CloneSelect',this.CloneSelect)
      console.log('CloneModel',this.CloneModel)
    },
    //克隆表单提交
    Clonesubmit(row,done){
      //重新赋值CloneSelect传递的数据为输入框可以修改的数据,CloneModel提交表单输入框双向绑定数据
      this.CloneSelect[0].id=this.CloneModel.id;
      this.CloneSelect[0].name=this.CloneModel.name;
      copy(this.CloneSelect[0]).then(()=>{
        //因为是嵌套弹窗所以手动关闭CloneinnerVisible,CloneVisible两个弹窗。
        this.CloneinnerVisible=false
        this.CloneVisible=false
        this.$message.success("复制成功")
        this.CrudRend()
        done(row)
      }).catch(res=>{
        done(res)
      })
    Clonesubmit(row, done) {
      // 重新赋值CloneSelect传递的数据为输入框可以修改的数据,CloneModel提交表单输入框双向绑定数据
      Object.assign(this.CloneSelect[0], this.CloneModel);
      // CloneSelect数组第一项 匹配CloneModel对象
      copy(this.CloneSelect[0])
        .then(() => {
          // 因为是嵌套弹窗所以手动关闭CloneinnerVisible,CloneVisible两个弹窗。
          this.CloneinnerVisible = false;
          this.CloneVisible = false;
          this.$message.success("复制成功");
          this.TemRefresh();
          done(row);
        })
        .catch((error) => {
          done(error);
        });
    },
    //刷新
    TemRefresh() {