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