ludc
2023-08-04 42c17fe468ceea7e5eed7fec520b9858bed02e85
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -24,7 +24,7 @@
          </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-item :label="this.TreeFlag ? '分类编号:' :'主题库编号:'" label-width="150px" style="display: inline-block" prop="id">
@@ -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%"
@@ -303,7 +303,11 @@
            <el-input style="width: 260px;margin-left: 15px" placeholder="输入值后进行模糊查询" v-model="SelectFInd"></el-input>
            <el-button size="small"  type="primary" plain @click="BtmSelectFindeHandler" style="margin-left: 20px">查询</el-button>
          </template>
          <avue-crud :data="BtmData" :option="masterOption" @select="btmSelect"></avue-crud>
          <avue-crud :data="BtmData" :option="masterOption" @row-click="btmSelect">
            <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.btmTypeName}}]</div>
            <div style="padding-top: 10px;display: flex; justify-content: flex-end;float: right;overflow: hidden" >
@@ -350,9 +354,10 @@
  inject: ["crudTreeData"],
  data() {
    return {
      masterRow:null,
      AddLoading:false,
      // 定义一个变量来保存树请求的数量
      requestCount:0,
      requestCount:null,
      //导入状态框
      ThemeImportVisible:false,
      selectRow:'',
@@ -389,10 +394,15 @@
        addBtn:false,
        index:true,
        border:true,
        selection:true,
        menu:false,
        height:380,
        column:[
          {
            label: '',
            prop: 'radio',
            width: 60,
            display: false
          },
          {
            label:'英文名称',
            prop:'id'
@@ -417,7 +427,7 @@
          label: '英文名称'
        }
      ],
      SelectValue:"",
      SelectValue:"id",
      SelectFInd:"",
      addFlag:false,
      // 表格当前行id
@@ -488,10 +498,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' },
@@ -662,11 +672,7 @@
    }
  },
  watch:{
    TreeFlagCode:{
      handler(newval,oldval){
        console.log('TreeFlagCode',newval)
      }
    }
  },
  //tab栏默认是表格
  mounted() {
@@ -743,6 +749,8 @@
  },
  methods: {
    // 关闭弹窗
    /** 导入 */
    ImportExcel(){
      this.ThemeImportVisible=true;
@@ -777,15 +785,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=""
      }
    },
    //编码规则确定
@@ -836,15 +840,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=""
      }
    },
    //关键属性接口
@@ -889,15 +889,11 @@
          '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=""
      }
    },
    //  相似项多选
@@ -942,22 +938,19 @@
          '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="";
      }
    },
    //业务类型多选
    btmSelect(row){
      this.masterRow=row.$index;
      this.btmSelectList=row;
      this.btmName=row[0].name;
      this.btmOid=row[0].id;
      this.btmName=row.name;
      this.btmOid=row.id;
    },
    //业务类型接口
    btmdefaultRend(masterParameter){
@@ -988,8 +981,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)
      })
    },
    //定义一个修改数据属性名的方法
@@ -1023,6 +1024,11 @@
        loading.close();
      }
    },
    //树节点取消事件
    TreeEscHandler(){
      this.TreeAddform={};
      this.TreeAddFormVisible=false
    },
    //树节点添加事件
    TreeAddHandler() {
      const data = this.TreeAddform;
@@ -1039,6 +1045,9 @@
          });
          this.getAttr();
          this.TreeAddFormVisible = false;
          //添加完成后右侧清空
          this.ProData=[];
          this.Formlist=[];
        })
        .catch((res) => {
          this.$message({
@@ -1199,6 +1208,7 @@
      this.editTreeFLagCode = !data.parentId;
      this.nodeClickList = data;
      this.selectRow = 0;
      this.crudArray=[]
      try {
        this.requestCount += 1;
        const [res1, res2, res3] = await Promise.all([
@@ -1220,6 +1230,7 @@
          await this.gridCode();
        } else {
          this.ProData = [];
          this.crudOid=''
        }
        this.TreeList = res3.data.data;
      } catch (error) {
@@ -1317,7 +1328,7 @@
            message: "添加成功!"
          });
          done(row)
          this.CrudRend()
          this.TemRefresh();
        }).catch(res => {
          this.$message({
            type: 'info',
@@ -1329,7 +1340,7 @@
    //模板管理修改
    CrudRowUpdata(row,index,done) {
      editSave(row).then(() => {
        this.CrudRend()
        this.TemRefresh();
        this.$message({
          type: "success",
          message: "操作成功!"
@@ -1342,13 +1353,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(){
@@ -1398,29 +1416,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() {