-
+
@@ -287,7 +287,8 @@
bpmOrgAddress: {
visible: false,
addressType: "user",
- multiple: false
+ multiple: false,
+ isRequired: false
},
palRelationAddressVisible: false,
title: '',
@@ -299,7 +300,8 @@
method: '',
wsId: this.$store.getters.getWsIdFn,
teamId: this.$store.getters.getTeamIdFn,
- multiple: false
+ multiple: false,
+ isRequired: false
},
propertyData: [
{
@@ -311,6 +313,7 @@
size: 'medium',
currPropertyId: '',
currPropertyType: '',
+ currPropertyLabel: '',
currGroup: '',
currCategory: '',
currMethod: '',
@@ -409,37 +412,53 @@
}
this.tableDialogVisible = false
},
- saveStringPropVal(attrId, value, attrSource) {// 保存文本属性内容
+ saveStringPropVal(attrId, value, attrSource,obj) {// 保存文本属性内容
if (value == undefined) {
value = '';
}
+ if (obj.isRequired !== undefined && obj.isRequired && value == '') {
+ this.$message({message: `[${obj.label}]不允许为空`,type: 'warning'});
+ return false
+ }
if (attrSource && attrSource == 'default') {
this.saveDefaultpropToDb(attrId, value);
} else {
this.saveCustomPropToDb(attrId, value);
}
},
- saveNumberPropVal(attrId, value, attrSource) {// 保存数字类型内容
+ saveNumberPropVal(attrId, value, attrSource,obj) {// 保存数字类型内容
if (value == undefined) {
value = '';
}
+ if (obj.isRequired !== undefined && obj.isRequired && value == '') {
+ this.$message({message: `[${obj.label}]不允许为空`,type: 'warning'});
+ return false
+ }
if (attrSource && attrSource == 'default') {
this.saveDefaultpropToDb(attrId, value);
} else {
this.saveCustomPropToDb(attrId, value);
}
},
- saveSingleSelectVal(attrId, value, attrSource) {// 保存boolean,单选类型内容
+ saveSingleSelectVal(attrId, value, attrSource,obj) {// 保存boolean,单选类型内容
if (value == undefined) {
value = '';
}
+ if (obj.isRequired !== undefined && obj.isRequired && value == '') {
+ this.$message({message: `[${obj.label}]不允许为空`,type: 'warning'});
+ return false
+ }
if (attrSource && attrSource == 'default') {
this.saveDefaultpropToDb(attrId, value);
} else {
this.saveCustomPropToDb(attrId, value);
}
},
- saveMultipleSelectVal(attrId, value, attrSource) {// 保存多选类型内容
+ saveMultipleSelectVal(attrId, value, attrSource,obj) {// 保存多选类型内容
+ if (obj.isRequired !== undefined && obj.isRequired && value == '') {
+ this.$message({message: `[${obj.label}]不允许为空`,type: 'warning'});
+ return false
+ }
value = value.join(',');
if (attrSource && attrSource == 'default') {
this.saveDefaultpropToDb(attrId, value);
@@ -499,10 +518,11 @@
console.log(error);
})
},
- choiceRelationComponent(ref, type, id, label, readonly, fileIds, shapeIds) {// PAL模型/形状选择组件
+ choiceRelationComponent(ref, type, id, label, readonly, fileIds, shapeIds,isRequired) {// PAL模型/形状选择组件
if (!readonly) {
this.currPropertyId = id;
this.currPropertyType = type;
+ this.currPropertyLabel = label
const method = ref.method;
if (method.indexOf('.') > -1) {
this.currCategory = method.substring(0, method.indexOf('.'));
@@ -521,36 +541,46 @@
this.relation.category = this.currCategory;
this.relation.method = this.currMethod;
this.relation.multiple = ref.multiple;
+ this.relation.isRequired = isRequired
this.palRelationAddressVisible = true;
}
},
- choiceBpmOrgAddressComponent(group, type, id, readonly) {// 平台地址簿组件(责任部门责任人)
+ choiceBpmOrgAddressComponent(group, type, id, readonly,isRequired,label) {// 平台地址簿组件(责任部门责任人)
if (!readonly) {
this.currPropertyId = id;
this.currPropertyType = type;
+ this.currPropertyLabel = label
if (type == "deptAddress") {// 责任部门
this.title = '责任部门';
this.bpmOrgAddress.addressType = 'dept';
this.bpmOrgAddress.visible = true;
+ this.bpmOrgAddress.isRequired = isRequired
} else if (type == "userAddress") {// 责任人
this.title = '责任人';
this.bpmOrgAddress.addressType = 'user';
this.bpmOrgAddress.visible = true;
+ this.bpmOrgAddress.isRequired = isRequired
}
}
},
- choiceAwsOrgComponent(ref, type, id, label, readonly) {// AWS平台部门/人员/角色组件
+ choiceAwsOrgComponent(ref, type, id, label, readonly,isRequired) {// AWS平台部门/人员/角色组件
if (!readonly) {
this.currPropertyId = id;
this.currPropertyType = type;
+ this.currPropertyLabel = label
this.title = label;
this.bpmOrgAddress.addressType = ref.scope.join(',');
this.bpmOrgAddress.multiple = ref.multiple;
this.bpmOrgAddress.visible = true;
+ this.bpmOrgAddress.isRequired = isRequired
}
},
saveBpmOrgAddressResult(data) {
this.bpmOrgAddress.visible = false;
+ if (this.bpmOrgAddress.isRequired && data.length == 0) {
+ this.$message({message: `[${this.currPropertyLabel}]不允许为空`,type: 'warning'});
+ return false;
+ }
// 保存
const params = [];
for (let i = 0; i < data.length; i++) {
@@ -560,6 +590,10 @@
},
// 调用关联组件保存函数
saveRelationResult(data) {
+ if(this.relation.isRequired && data.length == 0) {
+ this.$message({message: `[${this.currPropertyLabel}]不允许为空`,type: 'warning'});
+ return false;
+ }
// 返回结果
const jsonContent = {
fileId : this.id,
@@ -665,6 +699,11 @@
.property-item {
margin-top: 15px;
}
+ .required::before{
+ content: '*';
+ color: red;
+ padding-right: 2px;
+ }
.property-label {
width: 11%;
display: inline-block;