|
@@ -10,7 +10,7 @@
|
|
>
|
|
>
|
|
<el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
|
|
<el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
|
|
<!--所属产线-->
|
|
<!--所属产线-->
|
|
- <el-form-item v-if="$store.state.account.user.roles.indexOf('舱体') < 0 || $store.state.account.user.roles.indexOf('框体') < 0" label='所属产线:' prop="zoneId">
|
|
|
|
|
|
+ <el-form-item v-if="$store.state.account.user.roles.indexOf('舱体') < 0 && $store.state.account.user.roles.indexOf('框体') < 0" label='所属产线:' prop="zoneId">
|
|
<el-select
|
|
<el-select
|
|
v-model="tenant.zoneId"
|
|
v-model="tenant.zoneId"
|
|
:placeholder='$t("common.pleaseSelect")'
|
|
:placeholder='$t("common.pleaseSelect")'
|
|
@@ -100,6 +100,7 @@ export default {
|
|
type: 'add',
|
|
type: 'add',
|
|
zoneList: [],
|
|
zoneList: [],
|
|
tableData: [],
|
|
tableData: [],
|
|
|
|
+ oldVal: {},
|
|
tenant: this.initTenant(),
|
|
tenant: this.initTenant(),
|
|
screenWidth: 0,
|
|
screenWidth: 0,
|
|
width: this.initWidth(),
|
|
width: this.initWidth(),
|
|
@@ -110,13 +111,51 @@ export default {
|
|
roles: [],
|
|
roles: [],
|
|
rules: {
|
|
rules: {
|
|
name: [
|
|
name: [
|
|
- { required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
|
|
|
|
+ { required: true, message: this.$t("rules.require"), trigger: 'blur' },
|
|
|
|
+ { validator: (rule, value, callback) => {
|
|
|
|
+ if(this.type === "edit" && value === this.oldVal.name){
|
|
|
|
+ return callback()
|
|
|
|
+ }
|
|
|
|
+ if (value.trim().length > 0) {
|
|
|
|
+ trayMgrApi.checkField({"name":value})
|
|
|
|
+ .then((response) => {
|
|
|
|
+ const res = response.data
|
|
|
|
+ if (res.data) {
|
|
|
|
+ callback('托盘名称重复')
|
|
|
|
+ } else {
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ }, trigger: 'blur'
|
|
|
|
+ }
|
|
],
|
|
],
|
|
zoneId: [
|
|
zoneId: [
|
|
{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
],
|
|
],
|
|
no: [
|
|
no: [
|
|
- { required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
|
|
|
|
+ { required: true, message: this.$t("rules.require"), trigger: 'blur' },
|
|
|
|
+ { validator: (rule, value, callback) => {
|
|
|
|
+ if(this.type === "edit" && value === this.oldVal.no){
|
|
|
|
+ return callback()
|
|
|
|
+ }
|
|
|
|
+ if (value.trim().length > 0) {
|
|
|
|
+ trayMgrApi.checkField({"no":value})
|
|
|
|
+ .then((response) => {
|
|
|
|
+ const res = response.data
|
|
|
|
+ if (res.data) {
|
|
|
|
+ callback('物料编码重复')
|
|
|
|
+ } else {
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ }, trigger: 'blur'
|
|
|
|
+ }
|
|
],
|
|
],
|
|
num: [
|
|
num: [
|
|
{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
@@ -166,6 +205,9 @@ export default {
|
|
res = res.data;
|
|
res = res.data;
|
|
if (res.isSuccess) {
|
|
if (res.isSuccess) {
|
|
this.zoneList = res.data;
|
|
this.zoneList = res.data;
|
|
|
|
+ if(this.zoneList.length == 1){
|
|
|
|
+ this.zoneId = this.zoneList[0].id
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -239,6 +281,7 @@ export default {
|
|
}
|
|
}
|
|
// 字典表
|
|
// 字典表
|
|
this.dicts = dicts
|
|
this.dicts = dicts
|
|
|
|
+ this.oldVal = {...val }
|
|
},
|
|
},
|
|
close () {
|
|
close () {
|
|
this.$emit('close')
|
|
this.$emit('close')
|