|
@ -2,19 +2,22 @@ |
|
|
<!-- 添加维修工单 --> |
|
|
<!-- 添加维修工单 --> |
|
|
<view class="add-form-container"> |
|
|
<view class="add-form-container"> |
|
|
<u-form :model="form" ref="form1" label-width="160rpx"> |
|
|
<u-form :model="form" ref="form1" label-width="160rpx"> |
|
|
<u-form-item label="故障描述" prop="describes" required> |
|
|
<u-form-item label="检修描述" prop="name" required> |
|
|
<u-input v-model="form.describes" placeholder="请输入故障描述" /> |
|
|
<u-input v-model="form.name" placeholder="请输入检修描述" maxlength="50"/> |
|
|
</u-form-item> |
|
|
</u-form-item> |
|
|
<u-form-item label="故障真因" prop="describes" required> |
|
|
<u-form-item label="预估人数" prop="peoples" required> |
|
|
<u-input v-model="form.describes1" placeholder="请输入故障真因" /> |
|
|
<u-input v-model="form.peoples" type="number" placeholder="请输入预估人数" maxlength="50"/> |
|
|
</u-form-item> |
|
|
</u-form-item> |
|
|
<u-form-item label="解决措施" prop="describes" required> |
|
|
<u-form-item label="预估分钟" prop="estimatedMinutes" required> |
|
|
<u-input type='textarea' v-model="form.workOut" placeholder="请输入解决措施" /> |
|
|
<u-input v-model="form.estimatedMinutes" type="number" placeholder="请输入预估分钟" maxlength="50"/> |
|
|
</u-form-item> |
|
|
</u-form-item> |
|
|
<u-form-item label="维修人员" prop="describes" required> |
|
|
<u-form-item label="实际分钟" prop="actualMinutes" required> |
|
|
|
|
|
<u-input v-model="form.actualMinutes" type="number" placeholder="请输入实际分钟" maxlength="50"/> |
|
|
|
|
|
</u-form-item> |
|
|
|
|
|
<u-form-item label="责任人" prop="chargePeoples" required> |
|
|
<view class="select" @click="openSelecUser"> |
|
|
<view class="select" @click="openSelecUser"> |
|
|
<view class="input" v-if='form.maintenances'> |
|
|
<view class="input" v-if='form.chargePeoples'> |
|
|
{{selectFormatCheck(form.maintenances,selecUserList)}} |
|
|
{{selectFormatCheck(form.chargePeoples,selecUserList)}} |
|
|
</view> |
|
|
</view> |
|
|
<view class="placeholder" v-else> |
|
|
<view class="placeholder" v-else> |
|
|
请选择维修人员 |
|
|
请选择维修人员 |
|
@ -22,12 +25,42 @@ |
|
|
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> |
|
|
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> |
|
|
</view> |
|
|
</view> |
|
|
</u-form-item> |
|
|
</u-form-item> |
|
|
|
|
|
<u-form-item label="完成情况" prop="status" required> |
|
|
|
|
|
<view class="select" @click="openSingleColumn('status',form.status,jxDetailsStatus,'form')"> |
|
|
|
|
|
<view class="input" v-if='form.status'> |
|
|
|
|
|
{{selectFormat(form.status,jxDetailsStatus)}} |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="placeholder" v-else> |
|
|
|
|
|
{{`请选择完成情况`}} |
|
|
|
|
|
</view> |
|
|
|
|
|
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon> |
|
|
|
|
|
</view> |
|
|
|
|
|
</u-form-item> |
|
|
|
|
|
<u-form-item label="完成时间" prop="completionTime" required v-if='form.status == 0'> |
|
|
|
|
|
<view class="select" @click="openDatetime('completionTime',formatDate,params,formatValue)"> |
|
|
|
|
|
<view class="input" v-if='formatDate'> |
|
|
|
|
|
{{formatDate}} |
|
|
|
|
|
</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="engineer"> |
|
|
|
|
|
<u-input v-model="form.engineer" placeholder="请输入工程师确认" maxlength="50"/> |
|
|
|
|
|
</u-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<u-form-item label="未完成原因" prop="uncompleted" required v-if='form.status == 1'> |
|
|
|
|
|
<u-input type='textarea' v-model="form.uncompleted" placeholder="请输入未完成原因" maxlength="200"/> |
|
|
|
|
|
</u-form-item> |
|
|
</u-form> |
|
|
</u-form> |
|
|
|
|
|
|
|
|
<view class="list"> |
|
|
<view class="list"> |
|
|
<view class="title"> |
|
|
<view class="title"> |
|
|
<span>*</span>备件 |
|
|
<span>*</span>备件 |
|
|
</view> |
|
|
</view> |
|
|
<view class="item " v-for="(item,index) in form.itemNUmbers" :key="index"> |
|
|
<view class="item " v-for="(item,index) in form.itemNumbers" :key="index"> |
|
|
<view class="item-box"> |
|
|
<view class="item-box"> |
|
|
<view class="spare-title"> |
|
|
<view class="spare-title"> |
|
|
<view class="title-txt"> |
|
|
<view class="title-txt"> |
|
@ -64,7 +97,7 @@ |
|
|
<view class="popup"> |
|
|
<view class="popup"> |
|
|
<u-form :model="form1" ref="form1" label-width="160rpx"> |
|
|
<u-form :model="form1" ref="form1" label-width="160rpx"> |
|
|
<u-form-item :label="`备件`" prop="number" required> |
|
|
<u-form-item :label="`备件`" prop="number" required> |
|
|
<view class="select" @click="openSingleColumn('number',form1.number,sparePartsList)"> |
|
|
<view class="select" @click="openSingleColumn('number',form1.number,sparePartsList,'form1')"> |
|
|
<view class="input" v-if='form1.number'> |
|
|
<view class="input" v-if='form1.number'> |
|
|
{{selectFormat(form1.number,sparePartsList)}} |
|
|
{{selectFormat(form1.number,sparePartsList)}} |
|
|
</view> |
|
|
</view> |
|
@ -101,13 +134,15 @@ |
|
|
</u-popup> |
|
|
</u-popup> |
|
|
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue' |
|
|
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue' |
|
|
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select> |
|
|
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select> |
|
|
|
|
|
<u-picker mode="time" v-model="datetimeShow" :default-time='datetimeDefaultValue' :params="params" @confirm='chooseDatetime'></u-picker> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import * as repairOrderApi from "@/api/repairOrder.js" |
|
|
import * as overhaulOrderApi from "@/api/overhaulOrder.js" |
|
|
import * as sparePartsApi from "@/api/spareParts.js" |
|
|
import * as sparePartsApi from "@/api/spareParts.js" |
|
|
import * as deptApi from "@/api/dept.js" |
|
|
import * as deptApi from "@/api/dept.js" |
|
|
|
|
|
import * as dictApi from "@/api/dict.js" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
@ -119,57 +154,108 @@ |
|
|
isPopupShow: false, |
|
|
isPopupShow: false, |
|
|
sparePartsList: [], |
|
|
sparePartsList: [], |
|
|
// 下拉框字段 |
|
|
// 下拉框字段 |
|
|
|
|
|
from:'',//下拉选 是主还是子 |
|
|
singleColumnShow: false, |
|
|
singleColumnShow: false, |
|
|
singleColumnDefaultValue: [], |
|
|
singleColumnDefaultValue: [], |
|
|
singleColumnList: [], |
|
|
singleColumnList: [], |
|
|
field: '', |
|
|
field: '', |
|
|
// 维修人员 |
|
|
// 负责人员 |
|
|
selecUserList: [], //维修人员 |
|
|
selecUserList: [], //负责人员 |
|
|
isShowSelecUser: false, |
|
|
isShowSelecUser: false, |
|
|
|
|
|
jxDetailsStatus:[],//完成情况 |
|
|
form: { |
|
|
form: { |
|
|
maintenanceNumber: '', |
|
|
number: '', |
|
|
describes: '', |
|
|
name:'', |
|
|
describes1: '', |
|
|
peoples: '', |
|
|
workOut: '', |
|
|
estimatedMinutes: '', |
|
|
maintenances: '', |
|
|
actualMinutes: '', |
|
|
itemNUmbers: [], |
|
|
chargePeoples: '', |
|
|
|
|
|
status: '', |
|
|
|
|
|
completionTime: '', |
|
|
|
|
|
engineer: '', |
|
|
|
|
|
uncompleted: '', |
|
|
|
|
|
itemNumbers:[] |
|
|
}, |
|
|
}, |
|
|
|
|
|
formatDate:'',//日期展示 |
|
|
form1: { |
|
|
form1: { |
|
|
number: "", |
|
|
number: "", |
|
|
qty: '' |
|
|
qty: '' |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 时间参数 |
|
|
|
|
|
datetimeShow:false, |
|
|
|
|
|
params:{ |
|
|
|
|
|
year: true, |
|
|
|
|
|
month: true, |
|
|
|
|
|
day: true, |
|
|
|
|
|
hour: true, |
|
|
|
|
|
minute: true, |
|
|
|
|
|
second: true, |
|
|
|
|
|
timestamp: true, |
|
|
|
|
|
}, |
|
|
|
|
|
datetimeDefaultValue:'', |
|
|
|
|
|
formatValue:'YYYY-MM-DD hh:mm:ss' |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
// 触发提交表单 |
|
|
// 触发提交表单 |
|
|
submit() { |
|
|
submit() { |
|
|
// 校验 |
|
|
// 校验 |
|
|
if (!this.form.describes) { |
|
|
if (!this.form.name) { |
|
|
this.$modal.showToast('请输入故障描述') |
|
|
this.$modal.showToast('请输入检修描述') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (!this.form.peoples) { |
|
|
|
|
|
this.$modal.showToast('请输入预估人数') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (this.form.peoples>100) { |
|
|
|
|
|
this.$modal.showToast('预估人数不得超出100') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (!this.form.estimatedMinutes) { |
|
|
|
|
|
this.$modal.showToast(`请输入预估分钟`) |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (!this.form.describes1) { |
|
|
if (!this.form.actualMinutes) { |
|
|
this.$modal.showToast(`请输入故障真因`) |
|
|
this.$modal.showToast('请输入实际分钟') |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (!this.form.workOut) { |
|
|
if (!this.form.chargePeoples) { |
|
|
this.$modal.showToast('请输入解决措施') |
|
|
this.$modal.showToast('请选择负责人') |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (!this.form.maintenances) { |
|
|
if (!this.form.status) { |
|
|
this.$modal.showToast('请选择维修人员') |
|
|
this.$modal.showToast('请选择完成情况') |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (this.form.itemNUmbers.length === 0) { |
|
|
if(this.form.status == 0){ |
|
|
|
|
|
if (!this.form.completionTime) { |
|
|
|
|
|
this.$modal.showToast('请选择完成时间') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if (!this.form.engineer) { |
|
|
|
|
|
// this.$modal.showToast('请输入工程师') |
|
|
|
|
|
// return; |
|
|
|
|
|
// } |
|
|
|
|
|
if(this.form.status == 1){ |
|
|
|
|
|
if (!this.form.uncompleted) { |
|
|
|
|
|
this.$modal.showToast('请输入未完成原因') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.form.itemNumbers.length === 0) { |
|
|
this.$modal.showToast('请选择备件') |
|
|
this.$modal.showToast('请选择备件') |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
console.log(this.form) |
|
|
|
|
|
if (this.form.id) { |
|
|
if (this.form.id) { |
|
|
this.$modal.confirm('是否修改维修内容').then(() => { |
|
|
this.$modal.confirm('是否修改检修内容').then(() => { |
|
|
this.$modal.loading('加载中') |
|
|
this.$modal.loading('加载中') |
|
|
this.loading = true |
|
|
this.loading = true |
|
|
repairOrderApi.repairOrderDetailUpdate(this.form).then((res) => { |
|
|
overhaulOrderApi.overhaulOrderDetailUpdate(this.form).then((res) => { |
|
|
this.$modal.closeLoading() |
|
|
this.$modal.closeLoading() |
|
|
if (res.data) { |
|
|
if (res.data) { |
|
|
this.$modal.showToast('修改成功') |
|
|
this.$modal.showToast('修改成功') |
|
@ -187,10 +273,10 @@ |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
this.$modal.confirm('是否添加维修内容').then(() => { |
|
|
this.$modal.confirm('是否添加检修内容').then(() => { |
|
|
this.$modal.loading('加载中') |
|
|
this.$modal.loading('加载中') |
|
|
this.loading = true |
|
|
this.loading = true |
|
|
repairOrderApi.repairOrderDetailCreate(this.form).then((res) => { |
|
|
overhaulOrderApi.overhaulOrderDetailCreate(this.form).then((res) => { |
|
|
this.$modal.closeLoading() |
|
|
this.$modal.closeLoading() |
|
|
if (res.data) { |
|
|
if (res.data) { |
|
|
this.$modal.showToast('添加成功') |
|
|
this.$modal.showToast('添加成功') |
|
@ -221,16 +307,16 @@ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 获取人员列表 |
|
|
// 获取责任人员列表 |
|
|
async getSelecUser() { |
|
|
async getSelecUser() { |
|
|
let data = { |
|
|
let data = { |
|
|
classType: this.type, |
|
|
classType: this.type, |
|
|
factoryAreaNumber: this.factoryAreaNumber, |
|
|
factoryAreaNumber: this.factoryAreaNumber, |
|
|
flag: 1 |
|
|
flag: 0 |
|
|
} |
|
|
} |
|
|
let arr = [] |
|
|
let arr = [] |
|
|
if (this.form.maintenances) { |
|
|
if (this.form.chargePeoples) { |
|
|
arr = this.form.maintenances.split(',') |
|
|
arr = this.form.chargePeoples.split(',') |
|
|
} |
|
|
} |
|
|
await deptApi.getSelecUser(data).then(res => { |
|
|
await deptApi.getSelecUser(data).then(res => { |
|
|
res.data.forEach(item => { |
|
|
res.data.forEach(item => { |
|
@ -253,13 +339,13 @@ |
|
|
}, |
|
|
}, |
|
|
// 多选选择框回显 |
|
|
// 多选选择框回显 |
|
|
selectFormatCheck(val, array) { |
|
|
selectFormatCheck(val, array) { |
|
|
const arr = val.split(',') |
|
|
const arr = val.split(',').map(parseFloat) |
|
|
let str = array.filter(item => arr.includes(item.id)).map(item => item.name).join(',') |
|
|
let str = array.filter(item => arr.includes(item.id)).map(item => item.name).join(',') |
|
|
return str |
|
|
return str |
|
|
}, |
|
|
}, |
|
|
// 选择人员 |
|
|
// 选择人员 |
|
|
chooseUser() { |
|
|
chooseUser() { |
|
|
this.form.maintenances = this.chooseUserList.join(',') |
|
|
this.form.chargePeoples = this.chooseUserList.join(',') |
|
|
this.isShowSelecUser = false |
|
|
this.isShowSelecUser = false |
|
|
}, |
|
|
}, |
|
|
selectFormat(val, array) { |
|
|
selectFormat(val, array) { |
|
@ -267,8 +353,9 @@ |
|
|
return str |
|
|
return str |
|
|
}, |
|
|
}, |
|
|
// 单列模式 |
|
|
// 单列模式 |
|
|
openSingleColumn(field, val, list) { |
|
|
openSingleColumn(field, val, list,from) { |
|
|
if (field == 'deviceNumber' && this.form.id) return; |
|
|
if (field == 'deviceNumber' && this.form.id) return; |
|
|
|
|
|
this.from = from |
|
|
this.singleColumnList = list |
|
|
this.singleColumnList = list |
|
|
this.field = field |
|
|
this.field = field |
|
|
if (val) { |
|
|
if (val) { |
|
@ -280,9 +367,7 @@ |
|
|
}, |
|
|
}, |
|
|
// 单列模式点击确定之后 |
|
|
// 单列模式点击确定之后 |
|
|
chooseSingleColumn(e) { |
|
|
chooseSingleColumn(e) { |
|
|
console.log(e[0]) |
|
|
this[this.from][this.field] = e[0].value |
|
|
this.form1[this.field] = e[0].value |
|
|
|
|
|
|
|
|
|
|
|
this.singleColumnShow = false |
|
|
this.singleColumnShow = false |
|
|
this.$emit('singleColumn', this.field, this.form[this.field]) |
|
|
this.$emit('singleColumn', this.field, this.form[this.field]) |
|
|
this.$forceUpdate() |
|
|
this.$forceUpdate() |
|
@ -315,34 +400,71 @@ |
|
|
this.$modal.showToast('请输入数量') |
|
|
this.$modal.showToast('请输入数量') |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (this.form.itemNUmbers && this.form.itemNUmbers.length > 0) { |
|
|
if (this.form.itemNumbers && this.form.itemNumbers.length > 0) { |
|
|
let arr = this.form.itemNUmbers.filter(item => item.number == this.form1.number) |
|
|
let arr = this.form.itemNumbers.filter(item => item.number == this.form1.number) |
|
|
if (arr && arr.length > 0) { |
|
|
if (arr && arr.length > 0) { |
|
|
this.$modal.showToast('该备件已添加') |
|
|
this.$modal.showToast('该备件已添加') |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.form.itemNUmbers.push(this.form1) |
|
|
this.form.itemNumbers.push(this.form1) |
|
|
this.isPopupShow = false |
|
|
this.isPopupShow = false |
|
|
}, |
|
|
}, |
|
|
// 删除备件 |
|
|
// 删除备件 |
|
|
delSpareParts(index) { |
|
|
delSpareParts(index) { |
|
|
this.form.itemNUmbers.splice(index, 1) |
|
|
this.form.itemNumbers.splice(index, 1) |
|
|
} |
|
|
}, |
|
|
|
|
|
openDatetime(field,val,params,formatValue){ |
|
|
|
|
|
this.params = params |
|
|
|
|
|
this.formatValue =formatValue |
|
|
|
|
|
this.field = field |
|
|
|
|
|
this.form[this.field] = val ? val :'' |
|
|
|
|
|
this.datetimeDefaultValue = val ? val :this.$time.formatDate() |
|
|
|
|
|
this.datetimeShow = true |
|
|
|
|
|
}, |
|
|
|
|
|
// 日期模式点击确定之后 |
|
|
|
|
|
chooseDatetime(e){ |
|
|
|
|
|
let array1 = [] |
|
|
|
|
|
let array2 = [] |
|
|
|
|
|
if(this.formatValue.indexOf('YYYY')>-1){ |
|
|
|
|
|
array1.push(e.year) |
|
|
|
|
|
} |
|
|
|
|
|
if(this.formatValue.indexOf('MM')>-1){ |
|
|
|
|
|
array1.push(e.month) |
|
|
|
|
|
} |
|
|
|
|
|
if(this.formatValue.indexOf('DD')>-1){ |
|
|
|
|
|
array1.push(e.day) |
|
|
|
|
|
} |
|
|
|
|
|
if(this.formatValue.indexOf('hh')>-1){ |
|
|
|
|
|
array2.push(e.hour) |
|
|
|
|
|
} |
|
|
|
|
|
if(this.formatValue.indexOf('mm')>-1){ |
|
|
|
|
|
array2.push(e.minute) |
|
|
|
|
|
} |
|
|
|
|
|
if(this.formatValue.indexOf('ss')>-1){ |
|
|
|
|
|
array2.push(e.second) |
|
|
|
|
|
} |
|
|
|
|
|
let str = array1.join('-') + ' ' + array2.join(':') |
|
|
|
|
|
this.formatDate = str |
|
|
|
|
|
this.form[this.field] = e.timestamp |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
async onLoad(option) { |
|
|
async onLoad(option) { |
|
|
console.log(option) |
|
|
|
|
|
if (option.type) this.type = option.type; |
|
|
if (option.type) this.type = option.type; |
|
|
if (option.factoryAreaNumber) this.factoryAreaNumber = option.factoryAreaNumber; |
|
|
if (option.factoryAreaNumber) this.factoryAreaNumber = option.factoryAreaNumber; |
|
|
if (option.number) this.form.maintenanceNumber = option.number; |
|
|
if (option.number) this.form.number = option.number; |
|
|
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option |
|
|
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option |
|
|
.data)).id) { |
|
|
.data)).id) { |
|
|
this.form = JSON.parse(decodeURIComponent(option.data)) |
|
|
this.form = JSON.parse(decodeURIComponent(option.data)) |
|
|
this.$set(this.form,'itemNUmbers',this.form.items) |
|
|
this.$set(this.form,'itemNumbers',this.form.items) |
|
|
|
|
|
this.formatDate = this.$time.formatDate(this.form.completionTime) |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
this.jxDetailsStatus = await dictApi.getDict('jx_details_status') |
|
|
|
|
|
|
|
|
await this.getSelecUser() |
|
|
await this.getSelecUser() |
|
|
await this.getSparePartsList() |
|
|
await this.getSparePartsList() |
|
|
} |
|
|
} |
|
|