ludc
2023-08-04 eb0adae7a31a1797afacd7b6acdf034ef1e5cc57
Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
@@ -1,6 +1,6 @@
<template>
  <div>
    <div style="display: flex;flex-wrap: wrap;" v-if="this.crudArrayFlag" class="app">
    <div style="display: flex;flex-wrap: wrap; display: inline-block" v-if="this.crudArrayFlag" class="app" >
      <el-button-group>
      <!--新增-->
      <el-button v-if="attrEditVisible == false && attrFlagChiledren==false && editOpenFlag &&  (!checkStatus || crudLCStatus=='Editing' )" size="small" type="primary" icon="el-icon-plus" plain @click="busineHandle">添加 {{ msg }}</el-button>
@@ -332,6 +332,7 @@
<script>
import {AttrByBtm, gridCodeClassifyTemplateAttr, batchAddSave, copyto,listByFlag} from '@/api/template/templateAttr'
import {getList} from "@/api/refer/table";
import func from "@/util/func";
export default {
  name: "attrCrud .vue",
@@ -385,6 +386,11 @@
        if(newval){
          this.editOpenFlag=false
        }
      }
    },
    crudArrayFlag:{
      handler(newval,olaval){
        console.log('crudArrayFlag',newval)
      }
    },
    crudArray:{
@@ -1618,7 +1624,10 @@
      this.addVisible = true;
      this.busineSelectList = []
      this.busineAddList = [];
      this.BuineAttrByBtm()
      this.BuineAttrByBtm();
      this.$nextTick(() => {
        this.$refs.AddOriginPlace.doLayout();
      })
    },
    //业务类型数据
    BuineAttrByBtm(masterParameter){
@@ -1686,14 +1695,70 @@
    },
    //保存
    addsHandler(event) {
      batchAddSave(JSON.parse(JSON.stringify(this.ProData))).then(res => {
        this.$message.success('保存成功')
        this.editOpenFlag=false;
        // 调用父组件修改按钮状态
        this.$emit('editCloseChildren')
      }).catch(()=>{
        this.$message.warning('保存失败,请查看控制台输出!')
      this.$refs.referAttrCrud.sort("orderNum");
      var ischeck = true;
      console.log(this.ProData)
      this.ProData.forEach((item,index)=>{
        if((item.requireFlag && item.requireFlag.toString()=='true') && (item.readOnlyFlag && item.readOnlyFlag.toString()=='true')){
          this.$message.warning(item.name+"("+item.id+")必输的属性不能是只读");
          console.log(item)
          ischeck=false;
          return;
        }
        var num=0;
        if(item.componentRule){
          //组合规则
          num++
          console.log('componentRule',num)
        }
        if(item.enumString || item.enumId){
          //枚举
          num++
          console.log('enumString',num)
        }
        if(item.referConfig || item.referBtmId){
          //参照
          num++
          console.log('referConfig',num)
        }
        if(item.codeDateFormat){
          //时间格式
          num++
          console.log('codeDateFormat',num)
        }
        //如果空后台返回none
        if(item.classifyInvokeLevel && item.classifyInvokeLevel != 'none'){
          //分类注入
          num++
          console.log('classifyInvokeLevel',num)
          console.log(item.classifyInvokeLevel)
        }
        if(num>1 && ischeck){
          this.$message({
            showClose: true,
            message: item.name+"("+item.id+") 属性只能是组合规则,枚举,参照,时间格式,分类注入中的一种",
            type: 'warning'
          });
          ischeck=false;
          return;
        }
      })
      if(!ischeck){
        return ;
      }
      // 新函数用于执行batchAddSave方法
      const executeBatchAddSave = () => {
        batchAddSave(JSON.parse(JSON.stringify(this.ProData))).then(res => {
          this.$message.success('保存成功')
          this.editOpenFlag=false;
          // 调用父组件修改按钮状态
          this.$emit('editCloseChildren')
        }).catch(()=>{
          this.$message.warning('保存失败,请查看控制台输出!')
        });
      }
      // 所有if条件和逻辑通过后调用executeBatchAddSave函数
      executeBatchAddSave();
    },
    //表格行编辑
    handleCellClicks(row, column) {