| | |
| | | <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", |
| | |
| | | }, |
| | | //保存 |
| | | 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) { |