田源
2023-06-30 0f519667314c451c4267ba5d6c074ab91e5f2706
Source/UBCS-WEB/src/components/Tree/classifyTreeform.vue
@@ -2,19 +2,10 @@
  <div>
    <avue-form v-model="loneTreeNewForm" :option="option" @submit="submit" v-if="flag == 'renonly'">
    </avue-form>
    <avue-form v-model="loneTreeNewForm" :option="options" @submit="submit" v-else-if="flag == 'edit'">
    <avue-form v-model="loneTreeNewForm" :option="options" @submit="submits" v-else-if="flag == 'edit'">
    </avue-form>
    <div>
      <el-dialog  :visible.sync="dialogVisible"   title="为【编码规则】选取值" append-to-body>
        <div>
          <el-input placeholder="请选择内容" v-model="masterInput" class="input-with-select">
            <el-select v-model="MasterSearchSelects"  placeholder="请选择">
              <el-option label="英文名称" value="0"></el-option>
              <el-option label="中文名称" value="1"></el-option>
            </el-select>
            <el-button slot="append" icon="el-icon-search"></el-button>
          </el-input>
        </div>
        <avue-crud :data="masterData" :option="masterOption" @select="masterSelect"></avue-crud>
        <div style="padding-top: 10px;display: flex; justify-content: flex-end" >
          <el-button type="primary" size="small" @click="MasterHandlerClick">确定</el-button>
@@ -27,30 +18,23 @@
<script>
import {defaultReferDataGrid} from '@/api/MasterData/master'
import {TreeEditSave} from '@/api/template/templateAttr'
export default {
  name: "classifyTreeform.vue",
  props: ['loneTreeNewForm','flag'],
  data() {
    return {
      name:"",
      oid:"",
      masterInput:'',
      MasterSearchSelects:"",
      masterData:[
        {
          id:'001',
          name:'001',
          description:'001'
        },
        {
          id:'002',
          name:'002',
          description:'002'
        }
      ],
      masterData:[],
      masterOption:{
        addBtn:false,
        index:true,
        border:true,
        selection:true,
        menu:false,
        height:380,
        column:[
          {
@@ -80,7 +64,7 @@
          {
            label: '主题库/分类编号',
            prop: 'btmtypeid',
            labelWidth:128,
            labelWidth:135,
            readonly: true,
            rules: [{
              required: true,
@@ -92,7 +76,7 @@
            label: '主题库/分类名称',
            prop: 'name',
            readonly: true,
            labelWidth:128,
            labelWidth:135,
            rules: [{
              required: true,
              message: "主题库/分类名称",
@@ -137,8 +121,6 @@
        ]
      },
      options: {
        submitBtn:false,
        emptyBtn:false,
        column: [
          {
            label: '主题库/分类编号',
@@ -199,11 +181,16 @@
    }
  },
  created() {
      this.defaultRend()
  },
  methods: {
    submit(form, done) {
      this.$message.success(JSON.stringify(form));
    submits(form,done){
      console.log(this.loneTreeNewForm)
      TreeEditSave(this.loneTreeNewForm).then(res=>{
        this.$message.success('修改成功');
      }).catch(res=>{
        this.$message.error(res)
      })
      done()
    },
    error(err) {
@@ -215,26 +202,35 @@
      console.log(this.dialogVisible)
    },
    MasterHandlerClick(){
      if(this.masterSelectList.length>1){
        this.$message.warning('只能选择一条数据')
      }else if(this.masterSelectList.length<=0){
        this.$message.warning('请选择一条数据')
      }else {
        this.dialogVisible=false;
        this.masterSelectList=[]
        this.loneTreeNewForm.codeRuleOidName=this.name;
        this.loneTreeNewForm.codeRuleOid=this.oid;
        console.log(this.masterSelectList)
      }
    },
    defaultRend(){
      defaultReferDataGrid({
        referType:'coderule',
        isMuti:'false',
        'conditionMap["lcstatus"]':'Released'
      }).then(res=>{
        console.log('---',res)
        this.masterData=res.data.records;
      })
      // if(this.masterSelectList.length>1){
      //   this.$message.warning('只能选择一条数据')
      // }else if(this.masterSelectList.length<=0){
      //   this.$message.warning('请选择一条数据')
      // }else {
      //   this.dialogVisible=false;
      //   console.log(this.masterInput)
      //   console.log(this.MasterSearchSelect)
      // }
    },
    masterSelect(row){
      console.log(row)
      this.masterSelectList=row;
      this.name=row[0].name;
      this.oid=row[0].oid;
      console.log('oid',this.oid)
    }
  }
}