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",
@@ -387,8 +388,14 @@
        }
      }
    },
    crudArrayFlag:{
      handler(newval,olaval){
        console.log('crudArrayFlag',newval)
      }
    },
    crudArray:{
      handler(newval,oldval){
        console.log('crudArray',newval)
        if(newval != undefined){
          if(newval.length>=1){
            this.crudArrayFlag=true
@@ -1686,14 +1693,63 @@
    },
    //保存
    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++
        }
        if(item.enumString || item.enumId){
          //枚举
          num++
        }
        if(item.referConfig || item.referBtmId){
          //参照
          num++
        }
        if(item.codeDateFormat){
          //时间格式
          num++
        }
        if(item.classifyInvokeLevel){
          //分类注入
          num++
        }
        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) {