|
|
@ -5,18 +5,27 @@ |
|
|
|
<u-form-item label="故障描述" prop="describes" required> |
|
|
|
<u-input v-model="form.describes" placeholder="请输入故障描述" /> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}编码`" prop="deviceNumber" required> |
|
|
|
<u-input v-model="form.deviceNumber" |
|
|
|
:placeholder="`请输入${type=='DEVICE'?'设备' : '模具'}编码`" disabled/> |
|
|
|
<view class="right-button" @click="chickRightButton"> |
|
|
|
扫描 |
|
|
|
<u-form-item label="所属厂区" prop="factoryAreaNumber" required> |
|
|
|
<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'?'设备' : '模具'}名称`" prop="deviceName" required class="disabled"> |
|
|
|
<u-input v-model="form.deviceName" :placeholder="`请输入${type=='DEVICE'?'设备' : '模具'}名称`" disabled /> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="所属厂区" prop="factoryAreaName" required class="disabled"> |
|
|
|
<u-input v-model="form.factoryAreaName" placeholder="请输入所属厂区" disabled /> |
|
|
|
<u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}`" prop="deviceNumber" required> |
|
|
|
<view class="select" @click="openSingleColumn('deviceNumber',form.deviceNumber,deviceList)"> |
|
|
|
<view class="input" v-if='form.deviceNumber'> |
|
|
|
{{selectFormat(form.deviceNumber,deviceList)}} |
|
|
|
</view> |
|
|
|
<view class="placeholder" v-else> |
|
|
|
{{`请选择${type=='DEVICE'?'设备' : '模具'}`}} |
|
|
|
</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,appDeviceMoldType)"> |
|
|
@ -59,6 +68,7 @@ |
|
|
|
import * as moldApi from "@/api/mold.js" |
|
|
|
import * as dictApi from "@/api/dict.js" |
|
|
|
import * as uploadApi from "@/api/upload.js" |
|
|
|
import * as deptApi from "@/api/dept.js" |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
@ -66,6 +76,8 @@ |
|
|
|
loading: false, |
|
|
|
type: "", |
|
|
|
appDeviceMoldType: [], |
|
|
|
factoryAreaList:[],//工厂列表 |
|
|
|
deviceList:[],//设备列表 |
|
|
|
form: { |
|
|
|
describes: "", |
|
|
|
deviceNumber: '', |
|
|
@ -95,30 +107,44 @@ |
|
|
|
this.getDetailsByNumber() |
|
|
|
} |
|
|
|
}, |
|
|
|
// 获取厂区列表 |
|
|
|
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 =[] |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 根据设备/模具号查询信息 |
|
|
|
getDetailsByNumber() { |
|
|
|
const data = { |
|
|
|
number: this.form.deviceNumber, |
|
|
|
id: '' |
|
|
|
} |
|
|
|
if (this.type == 'DEVICE') { |
|
|
|
deviceApi.getDeviceDetailsByNumber(data).then((res) => { |
|
|
|
if (res.data) { |
|
|
|
this.form.deviceName = res.data.name |
|
|
|
this.form.factoryAreaName = res.data.factoryAreaName |
|
|
|
this.form.factoryAreaNumber = res.data.factoryAreaNumber |
|
|
|
} else { |
|
|
|
this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`) |
|
|
|
deviceApi.getDeviceByFactoryAreaNumber(this.form.factoryAreaNumber).then((res) => { |
|
|
|
if (res.data&&res.data.length>0) { |
|
|
|
res.data.map(item => { |
|
|
|
item.value = item.number |
|
|
|
item.label = item.name |
|
|
|
}) |
|
|
|
this.deviceList = res.data |
|
|
|
}else{ |
|
|
|
this.deviceList = [] |
|
|
|
} |
|
|
|
}) |
|
|
|
} else if (this.type == 'MOLD') { |
|
|
|
moldApi.getMoldDetailsByNumber(data).then((res) => { |
|
|
|
if (res.data) { |
|
|
|
this.form.deviceName = res.data.name |
|
|
|
this.form.factoryAreaName = res.data.factoryAreaName |
|
|
|
this.form.factoryAreaNumber = res.data.factoryAreaNumber |
|
|
|
} else { |
|
|
|
this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`) |
|
|
|
moldApi.getMoldByFactoryAreaNumber(this.form.factoryAreaNumber).then((res) => { |
|
|
|
if (res.data&&res.data.length>0) { |
|
|
|
res.data.map(item => { |
|
|
|
item.value = item.number |
|
|
|
item.label = item.name |
|
|
|
}) |
|
|
|
this.deviceList = res.data |
|
|
|
}else{ |
|
|
|
this.deviceList = [] |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
@ -130,16 +156,16 @@ |
|
|
|
this.$modal.showToast('请输入故障描述') |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.form.deviceNumber) { |
|
|
|
this.$modal.showToast(`请输入${this.type=='DEVICE'?'设备' : '模具'}编码`) |
|
|
|
if (!this.form.factoryAreaNumber) { |
|
|
|
this.$modal.showToast(`请选择选择所属厂区`) |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.form.deviceName) { |
|
|
|
this.$modal.showToast(`请输入${this.type=='DEVICE'?'设备' : '模具'}名称`) |
|
|
|
if (!this.form.deviceNumber) { |
|
|
|
this.$modal.showToast(`请选择${this.type=='DEVICE'?'设备' : '模具'}`) |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.form.factoryAreaName) { |
|
|
|
this.$modal.showToast('请输入所属厂区') |
|
|
|
if (!this.form.receiverType) { |
|
|
|
this.$modal.showToast(`请选择类型'}`) |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.imgList.length == 0) { |
|
|
@ -150,6 +176,7 @@ |
|
|
|
describes: this.form.describes, |
|
|
|
deviceNumber: this.form.deviceNumber, |
|
|
|
factoryAreaNumber: this.form.factoryAreaNumber, |
|
|
|
receiverType: this.form.receiverType, |
|
|
|
type: this.type, |
|
|
|
filePathList: this.imgList, |
|
|
|
} |
|
|
@ -197,6 +224,11 @@ |
|
|
|
// 单列模式点击确定之后 |
|
|
|
chooseSingleColumn(e) { |
|
|
|
this.form[this.field] = e[0].value |
|
|
|
if(this.field == 'factoryAreaNumber'){ |
|
|
|
this.form.deviceNumber = '' |
|
|
|
this.form.deviceName = '' |
|
|
|
this.getDetailsByNumber() |
|
|
|
} |
|
|
|
this.singleColumnShow = false |
|
|
|
this.$emit('singleColumn', this.field, this.form[this.field]) |
|
|
|
this.$forceUpdate() |
|
|
@ -233,6 +265,8 @@ |
|
|
|
async onLoad(option) { |
|
|
|
if (option.type) this.type = option.type; |
|
|
|
this.appDeviceMoldType = await dictApi.getDict('app_device_mold_type') |
|
|
|
this.appDeviceMoldType = this.appDeviceMoldType.filter((item=>item.value!="MOLD")) |
|
|
|
this.getFactoryAreaList() |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|