xiejun
2024-01-12 7aa9a5df273e2df95a7005a8a78004b684a53287
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTreeform.vue
@@ -1,110 +1,57 @@
<template>
  <div>
    <avue-form v-model="loneTreeNewForm" :option="option" v-if="flag == 'renonly'">
    <avue-form v-model="loneTreeNewForm" :option="renonlyOption" v-if="flag == 'renonly'">
    </avue-form>
      <avue-form v-model="loneTreeNewForm" :option="this.options" @submit="submits" v-else-if="flag == 'edit'">
      <avue-form v-model="loneTreeNewForm" :option="this.editOption" @submit="submits" v-else-if="flag == 'edit'">
    </avue-form>
    <div>
<!--     编码规则-->
      <el-dialog  :visible.sync="MasterdialogVisible"   title="为【编码规则】选取值" append-to-body>
        <template>
          <el-select v-model="SelectValue" placeholder="请选择" style="width: 135px">
            <el-option
              v-for="item in SelectOption"
              :key="item.value"
              :label="item.label"
              :value="item.value"
              style="width: 150px">
            </el-option>
          </el-select>
          <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>
        <div style="height: 30px">
          <div style="display: inline-block;float: left;border: 1px solid #eee;padding: 5px;margin-top: 5px;font-size: 14px " >已设置的值为:[{{this.loneTreeNewForm.coderuleoidName}}]</div>
          <div style="padding-top: 10px;display: flex; justify-content: flex-end;float: right;overflow: hidden" >
            <el-button type="primary" size="small" @click="MasterHandlerClick">确定</el-button>
            <el-button  size="small" @click="MasterdialogVisible=false">取消</el-button>
          </div>
        </div>
      </el-dialog>
      <ThemeChildren
        ref="ThemeMasterChildren"
        dialogTitle="编码规则"
        codeName="codeRuleOidName"
        codeType="coderule"
        code-lcstatus="Released"
        :visible.sync="MasterdialogVisible"
        :SelectOption="SelectOption"
        :TreeAddform="loneTreeNewForm"
        @defineHandler="handlerDefine"
      ></ThemeChildren>
<!--      关键属性查询规则-->
      <el-dialog  :visible.sync="KeydialogVisible"   title="为【关键属性查询规则】选取值" append-to-body>
        <template>
          <el-select v-model="SelectValue" placeholder="请选择" style="width: 135px">
            <el-option
              v-for="item in SelectOption"
              :key="item.value"
              :label="item.label"
              :value="item.value"
              style="width: 150px">
            </el-option>
          </el-select>
          <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>
        <div style="height: 30px">
          <div style="display: inline-block;float: left;border: 1px solid #eee;padding: 5px;margin-top: 5px;font-size: 14px " >已设置的值为:[{{this.loneTreeNewForm.codekeyattrrepeatoidName}}]</div>
          <div style="padding-top: 10px;display: flex; justify-content: flex-end;float: right;overflow: hidden" >
            <el-button type="primary" size="small" @click="KeyHandlerClick">确定</el-button>
            <el-button  size="small" @click="KeydialogVisible=false">取消</el-button>
          </div>
        </div>
      </el-dialog>
      <!--      相似项查询规则-->
      <el-dialog  :visible.sync="SimidialogVisible"   title="为【相似项查询规则】选取值" append-to-body>
        <template>
          <el-select v-model="SelectValue" placeholder="请选择" style="width: 135px">
            <el-option
              v-for="item in SelectOption"
              :key="item.value"
              :label="item.label"
              :value="item.value"
              style="width: 150px">
            </el-option>
          </el-select>
          <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>
        <div style="height: 30px">
          <div style="display: inline-block;float: left;border: 1px solid #eee;padding: 5px;margin-top: 5px;font-size: 14px " >已设置的值为:[{{this.loneTreeNewForm.codeResembleRuleOidName}}]</div>
          <div style="padding-top: 10px;display: flex; justify-content: flex-end;float: right;overflow: hidden" >
            <el-button type="primary" size="small" @click="simHandlerClick">确定</el-button>
            <el-button  size="small" @click="SimidialogVisible=false">取消</el-button>
          </div>
        </div>
      </el-dialog>
      <ThemeChildren
        ref="ThemeKeyChildren"
        :SelectOption="SelectOption"
        :TreeAddform="loneTreeNewForm"
        :visible.sync="KeydialogVisible"
        code-lcstatus="Enabled"
        codeName="codeKeyAttrRepeatOidName"
        codeType="codekeyattrrepeat"
        dialogTitle="关键属性查询规则"
        @defineHandler="handlerDefine"
      ></ThemeChildren>
      <!--      相似项查询规则 codeResembleRuleOidName SimidialogVisible-->
      <ThemeChildren
        ref="ThemeSimChildren"
        :SelectOption="SelectOption"
        :TreeAddform="loneTreeNewForm"
        :visible.sync="SimidialogVisible"
        code-lcstatus="Enabled"
        codeName="codeResembleRuleOidName"
        codeType="coderesemblerule"
        dialogTitle="相似项查询规则"
        @defineHandler="handlerDefine"
      ></ThemeChildren>
<!--      存储的业务类型-->
      <el-dialog  :visible.sync="BtmdialogVisible"   title="为【业务类型】选取值" append-to-body>
        <template>
          <el-select v-model="SelectValue" placeholder="请选择" style="width: 135px !important;">
            <el-option
              v-for="item in SelectOption"
              :key="item.value"
              :label="item.label"
              :value="item.value"
              style="width: 130px">
            </el-option>
          </el-select>
          <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" @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.loneTreeNewForm.btmTypeName}}]</div>
          <div style="padding-top: 10px;display: flex; justify-content: flex-end;float: right;overflow: hidden" >
            <el-button type="primary" size="small" @click="btmHandlerClick">确定</el-button>
            <el-button  size="small" @click="BtmdialogVisible=false">取消</el-button>
          </div>
        </div>
      </el-dialog>
      <ThemeChildren
        ref="ThemeBtmChildren"
        :SelectOption="btmSelectOption"
        :TreeAddform="loneTreeNewForm"
        :visible.sync="BtmdialogVisible"
        codeName="btmTypeName"
        codeType="btmCode"
        dialogTitle="业务类型"
        @defineHandler="handlerDefine"
      ></ThemeChildren>
    </div>
  </div>
</template>
@@ -112,28 +59,16 @@
<script>
import {defaultReferDataGrid,referDataGrid} from '@/api/MasterData/master'
import {TreeEditSave} from '@/api/template/templateAttr'
import ThemeChildren from '@/components/FormTemplate/ThemeChildren'
export default {
  components: {ThemeChildren},
  name: "classifyTreeform.vue",
  props: ['loneTreeNewForm','flag','Editclose','TreeFlag','nodeClickList'],
  data() {
    return {
      masterRow:0,
      SelectFInd:"",
      masterName:"",
      masterOid:"",
      KeyName:"",
      KeyOid:"",
      simName:"",
      simOid:"",
      btmName:"",
      btmOid:"",
      btmId:"",
      masterRow:null,
      masterInput:'',
      MasterSearchSelects:"",
      masterData:[],
      KeyData:[],
      simData:[],
      BtmData:[],
      SelectOption:[
        {
          value: 'name',
@@ -144,56 +79,16 @@
          label: '英文名称'
        }
      ],
      SelectValue:"",
      btmOption:{
        addBtn:false,
        index:true,
        border:true,
        selection:true,
        menu:false,
        height:380,
        column:[
          {
            label:'业务类型编号',
            prop:'id'
          },
          {
            label:'业务类型名称',
            prop:'name'
          },
          {
            label:'描述',
            prop:'description'
          }
        ]
      },
      masterOption:{
        addBtn:false,
        index:true,
        border:true,
        menu:false,
        height:380,
        column:[
          {
            label: '',
            prop: 'radio',
            width: 60,
            display: false
          },
          {
            label:'英文名称',
            prop:'id'
          },
          {
            label:'中文名称',
            prop:'name'
          },
          {
            label:'描述',
            prop:'description'
          }
        ]
      },
      btmSelectOption:[
        {
          value: 'id',
          label: '业务类型编号'
        },
        {
          value: 'name',
          label: '业务类型名称'
        },
      ],
      MasterdialogVisible:false,
      KeydialogVisible:false,
      SimidialogVisible:false,
@@ -202,10 +97,10 @@
        name: "哈哈",
        sex: "男"
      },
      option: {
      renonlyOption: {
        submitBtn:false,
        emptyBtn:false,
        columnBtn:false,
        column: [
          {
            label: '主题库/分类编号',
@@ -254,7 +149,7 @@
          },
          {
            label:"关键属性查询规则",
            prop:"codekeyattrrepeatoidName",
            prop:"codeKeyAttrRepeatOidName",
            labelWidth:128,
            disabled: true,
          },
@@ -264,6 +159,23 @@
            labelWidth:128,
            disabled: true,
          },
          {
            label: '是否参与关键属性校验',
            prop: 'isParticipateCheck',
            type: 'switch',
            activeColor: "#13ce66",
            inactiveColor: "#ff4949",
            labelWidth:160,
            disabled: true,
            dicData: [{
              label: '否',
              value: 0
            }, {
              label: '是',
              value: 1
            }
            ]
          }
        ]
      },
@@ -275,7 +187,7 @@
    }
  },
  computed:{
    options(){
    editOption(){
      return{
          column: [
            {
@@ -320,12 +232,12 @@
              label:"编码规则",
              prop:"codeRuleOidName",
              labelWidth:128,
              focus:this.CodeFoucus,
              focus:this.CodeFocus,
              readonly: true,
            },
            {
              label:"关键属性查询规则",
              prop:"codekeyattrrepeatoidName",
              prop:"codeKeyAttrRepeatOidName",
              labelWidth:128,
              focus:this.Keyfouce,
              readonly: true,
@@ -337,7 +249,22 @@
              focus: this.simFouce,
              readonly: true,
            },
            {
              label: '是否参与关键属性校验',
              prop: 'isParticipateCheck',
              type: 'switch',
              activeColor: "#13ce66",
              inactiveColor: "#ff4949",
              labelWidth:160,
              dicData: [{
                label: '否',
                value: 0
              }, {
                label: '是',
                value: 1
              }
              ]
            }
          ]
      }
@@ -346,13 +273,41 @@
  watch:{
    TreeFlag:{
      handler(newval,oldval){
        console.log(newval)
        // console.log(newval)
      }
    }
  },
  created() {
  },
  methods: {
    //树编辑参照子组件事件
    handlerDefine(val) {
      const codeTypeMap = {
        coderule: {
          nameKey: 'codeRuleOidName',
          oidKey: 'codeRuleOid'
        },
        codekeyattrrepeat: {
          nameKey: 'codeKeyAttrRepeatOidName',
          oidKey: 'codeKeyAttrRepeatOid'
        },
        coderesemblerule: {
          nameKey: 'codeResembleRuleOidName',
          oidKey: 'codeResembleRuleOid'
        },
        btmCode: {
          nameKey: 'btmTypeName',
          oidKey: 'btmTypeId'
        }
      };
      const codeType = codeTypeMap[val.codeType];
      if (codeType) {
        this.$set(this.loneTreeNewForm, codeType.nameKey, val.crudName);
        this.$set(this.loneTreeNewForm, codeType.oidKey, val.crudOid);
        this.$emit('MasterHandler', this.loneTreeNewForm);
      }
    },
    submits(form,done){
      if(this.TreeFlag){
        TreeEditSave(this.loneTreeNewForm).then(res=>{
@@ -377,216 +332,27 @@
    error(err) {
      this.$message.success(err);
    },
    //编码规则查询
    SelectFindeHandler(){
      if(this.SelectValue == 'id'){
        const masterParameter={
          '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=""
      }
    },
    //编码规则失焦
    CodeFoucus(){
    CodeFocus(){
      this.MasterdialogVisible=true;
      this.MasterdefaultRend()
    },
    //编码规则确定
    MasterHandlerClick(){
      if(this.masterSelectList.length>1){
        this.$message.warning('只能选择一条数据')
      }else if(this.masterSelectList.length<=0){
        this.$message.warning('请选择一条数据')
      }else {
        this.MasterdialogVisible=false;
        this.masterSelectList=[]
        this.$set(this.loneTreeNewForm,'codeRuleOidName',this.masterName)
        this.$set(this.loneTreeNewForm,'codeRuleOid',this.masterOid)
        this.$emit('MasterHandler',this.loneTreeNewForm)
      }
    },
    //编码多选
    masterSelect(row){
      this.masterSelectList=row;
      this.masterName=row[0].name;
      this.masterOid=row[0].oid;
    },
    //编码接口
    MasterdefaultRend(masterParameter){
      defaultReferDataGrid({
        referType:'coderule',
        isMuti:'false',
        'conditionMap["lcstatus"]':'Released',
        ...masterParameter
      }).then(res=>{
        this.masterData=res.data.records;
      })
      this.$refs.ThemeMasterChildren.defaultSearchRend()
    },
    //关键属性失焦
    Keyfouce(){
      this.KeydialogVisible=true;
      this.KeydefaultRend()
    },
    //关键属性确定
    KeyHandlerClick(){
      if(this.KeySelectLIst.length>1){
        this.$message.warning('只能选择一条数据')
      }else if(this.KeySelectLIst.length<=0){
        this.$message.warning('请选择一条数据')
      }else {
        this.KeydialogVisible=false;
        this.KeySelectLIst=[]
        this.$set(this.loneTreeNewForm,'codekeyattrrepeatoidName',this.KeyName)
        this.$set(this.loneTreeNewForm,'codekeyattrrepeatoid',this.KeyOid)
        this.$emit('MasterHandler',this.loneTreeNewForm)
      }
    },
    //关键属性查询
    KeySelectFindeHandler(){
      if(this.SelectValue == 'id'){
        const masterParameter={
          '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="";
      }
    },
    //关键属性接口
    KeydefaultRend(){
      defaultReferDataGrid({
        referType:'codekeyattrrepeat',
        isMuti:'false',
        'conditionMap["lcstatus"]':'Enabled'
      }).then(res=>{
        this.KeyData=res.data.records;
      })
    },
    //关键多选
    KeySelect(row){
      this.KeySelectLIst=row;
      this.KeyName=row[0].name;
      this.KeyOid=row[0].oid;
      this.$refs.ThemeKeyChildren.defaultSearchRend();
    },
    //相似项失焦
    simFouce(){
      this.SimidialogVisible=true;
      this.simdefaultRend()
      this.$refs.ThemeSimChildren.defaultSearchRend();
    },
    //相似项确定
    simHandlerClick(){
      if(this.simSelectList.length>1){
        this.$message.warning('只能选择一条数据')
      }else if(this.simSelectList.length<=0){
        this.$message.warning('请选择一条数据')
      }else {
        this.SimidialogVisible=false;
        this.simSelectList=[]
        this.$set(this.loneTreeNewForm,'codeResembleRuleOidName',this.simName)
        this.$set(this.loneTreeNewForm,'codeResembleRuleOid',this.simOid)
        this.$emit('MasterHandler',this.loneTreeNewForm)
      }
    },
    //相似项查询
    SimSelectFindeHandler(){
      if(this.SelectValue == 'id'){
        const masterParameter={
          '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.simSelectList=row;
      this.simName=row[0].name;
      this.simOid=row[0].oid;
    },
    //相似项项接口
    simdefaultRend(){
      defaultReferDataGrid({
        referType:'coderesemblerule',
        isMuti:'false',
        'conditionMap["lcstatus"]':'Enabled'
      }).then(res=>{
        this.simData=res.data.records;
      })
    },
    //业务类型失焦
    btmFoucus(){
      this.BtmdialogVisible=true;
      this.btmdefaultRend()
      this.BtmdialogVisible = true;
      this.$refs.ThemeBtmChildren.btmDefaultRend();
    },
    //业务类型确定
    btmHandlerClick(){
      if(this.btmSelectList.length>1){
        this.$message.warning('只能选择一条数据')
      }else if(this.btmSelectList.length<=0){
        this.$message.warning('请选择一条数据')
      }else {
        this.BtmdialogVisible=false;
        this.btmSelectList=[]
        this.$set(this.loneTreeNewForm,'btmTypeName',this.btmName ||this.btmOid)
        this.$set(this.loneTreeNewForm,'btmTypeId',this.btmId)
        this.$emit('MasterHandler',this.loneTreeNewForm)
      }
    },
    //业务类型查询
    BtmSelectFindeHandler(){
      if(this.SelectValue == 'id'){
        const masterParameter={
          '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.btmSelectList=row;
      this.btmName=row.name;
      this.btmOid=row.oid;
      this.btmId=row.id;
    },
    //业务类型接口
    btmdefaultRend(masterParameter){
      referDataGrid({valueField:'id',isMuti:'false',...masterParameter}).then(res=>{
        this.BtmData=res.data.data.records
      })
    }
  }
}
</script>