|
|
@ -2,6 +2,17 @@ |
|
|
|
<!-- 添加维修工单 --> |
|
|
|
<view class="add-form-container"> |
|
|
|
<u-form :model="form" ref="form1" label-width="160rpx"> |
|
|
|
<u-form-item label="转办类型" prop="status" required> |
|
|
|
<view class="select" @click="openSingleColumn('status',form.status,tansferType)"> |
|
|
|
<view class="input" v-if='form.status || form.status == 0'> |
|
|
|
{{selectFormat(form.status,tansferType)}} |
|
|
|
</view> |
|
|
|
<view class="placeholder" v-else> |
|
|
|
{{`请选择转办类型`}} |
|
|
|
</view> |
|
|
|
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> |
|
|
|
</view> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="类型" prop="receiverType" required> |
|
|
|
<view class="select" @click="openSingleColumn('receiverType',form.receiverType,deviceMoldType)"> |
|
|
|
<view class="input" v-if='form.receiverType'> |
|
|
@ -13,13 +24,24 @@ |
|
|
|
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> |
|
|
|
</view> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`" prop="deviceNumber" required> |
|
|
|
<u-form-item label="厂区名称" prop="factoryAreaNumber" required v-if="form.status==1"> |
|
|
|
<view class="select" @click="openSingleColumn('factoryAreaNumber',form.factoryAreaNumber,factoryAreaList)"> |
|
|
|
<view class="input" v-if='form.factoryAreaNumber'> |
|
|
|
{{selectFormat(form.factoryAreaNumber,factoryAreaList)}} |
|
|
|
</view> |
|
|
|
<view class="placeholder" v-else> |
|
|
|
{{`请选择厂区名称`}} |
|
|
|
</view> |
|
|
|
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> |
|
|
|
</view> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`" prop="deviceNumber" required v-if="form.status==0"> |
|
|
|
<u-input v-model="form.deviceNumber" :placeholder="`请输入${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`" @blur="blur()" /> |
|
|
|
<view class="right-button" @click="chickRightButton"> |
|
|
|
扫描 |
|
|
|
</view> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`" prop="deviceNumber" required class="disabled"> |
|
|
|
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`" prop="deviceNumber" required class="disabled" v-if="form.status==0"> |
|
|
|
<u-input v-model="form.deviceName" :placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`" disabled/> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="维修人员" prop="describes" required> |
|
|
@ -82,6 +104,7 @@ |
|
|
|
deviceNumber: '', |
|
|
|
deviceName: '', |
|
|
|
receiverUserId: '', |
|
|
|
status:0 |
|
|
|
}, |
|
|
|
deviceList: [], //设备列表 |
|
|
|
singleColumnShow: false, |
|
|
@ -91,6 +114,16 @@ |
|
|
|
// 维修人员 |
|
|
|
selecUserList: [], //维修人员 |
|
|
|
isShowSelecUser: false, |
|
|
|
|
|
|
|
// 转办类型 |
|
|
|
tansferType:[{ |
|
|
|
value:0, |
|
|
|
label:'设备' |
|
|
|
},{ |
|
|
|
value:1, |
|
|
|
label:'人员' |
|
|
|
}], |
|
|
|
deviceNumber:'',//主页面设备编码 |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
@ -101,8 +134,15 @@ |
|
|
|
this.$modal.showToast('请选择类型') |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.form.deviceNumber) { |
|
|
|
this.$modal.showToast(`请选择${this.type=='DEVICE'||this.type=='TECH'?'设备' : '模具'}编码`) |
|
|
|
if(this.form.status == 0){ |
|
|
|
if (!this.form.deviceNumber) { |
|
|
|
this.$modal.showToast(`请选择${this.type=='DEVICE'||this.type=='TECH'?'设备' : '模具'}编码`) |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!this.form.factoryAreaNumber) { |
|
|
|
this.$modal.showToast('请选择厂区') |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.form.receiverUserId) { |
|
|
@ -112,9 +152,10 @@ |
|
|
|
const data = { |
|
|
|
id: this.form && this.form.id ? this.form.id : '', |
|
|
|
receiverType: this.form.receiverType, |
|
|
|
deviceNumber: this.form.deviceNumber, |
|
|
|
deviceNumber: this.form.status == 0 ? this.form.deviceNumber : this.deviceNumber, |
|
|
|
receiverUserId: this.form.receiverUserId, |
|
|
|
factoryAreaNumber: this.form.factoryAreaNumber, |
|
|
|
status: this.form.status, |
|
|
|
} |
|
|
|
this.$modal.confirm('是否转办维修工单').then(() => { |
|
|
|
this.$modal.loading('加载中') |
|
|
@ -257,6 +298,8 @@ |
|
|
|
this.form.factoryAreaNumber = this.choosesingleColumnItem[0].factoryAreaNumber |
|
|
|
this.form.receiverUserId = undefined |
|
|
|
this.getSelecUser() |
|
|
|
}else if(this.field == 'factoryAreaNumber'){ |
|
|
|
this.getSelecUser() |
|
|
|
} |
|
|
|
this.singleColumnShow = false |
|
|
|
this.$emit('singleColumn', this.field, this.form[this.field]) |
|
|
@ -288,7 +331,6 @@ |
|
|
|
let data = { |
|
|
|
classType: this.type, |
|
|
|
factoryAreaNumber: this.form.factoryAreaNumber, |
|
|
|
flag: 1 |
|
|
|
} |
|
|
|
let arr = [] |
|
|
|
if (this.form.maintenances) { |
|
|
@ -324,13 +366,30 @@ |
|
|
|
this.form[this.field] = this.chooseUserInfo |
|
|
|
this.isShowSelecUser = false |
|
|
|
}, |
|
|
|
// 获取厂区列表 |
|
|
|
getFactoryAreaList() { |
|
|
|
deptApi.getFactoryAreaList().then((res) => { |
|
|
|
if (res.data && res.data.length > 0) { |
|
|
|
res.data.map(item => { |
|
|
|
item.value = item.id |
|
|
|
item.label = item.name |
|
|
|
}) |
|
|
|
this.factoryAreaList = res.data |
|
|
|
} else { |
|
|
|
this.factoryAreaList = [] |
|
|
|
} |
|
|
|
}).catch(()=>{}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
async onLoad(option) { |
|
|
|
if (option.type) this.type = option.type; |
|
|
|
if (option.id) this.form.id = option.id; |
|
|
|
if (option.deviceNumber) this.deviceNumber = option.deviceNumber; |
|
|
|
|
|
|
|
this.deviceMoldType = await dictApi.getDict('app_device_mold_type') |
|
|
|
this.form.receiverType = this.deviceMoldType[0].value |
|
|
|
// this.deviceMoldType = this.deviceMoldType.filter(item => item.value != this.type) |
|
|
|
this.getFactoryAreaList() |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|