Commit a455e6c4 authored by mzx's avatar mzx

Merge remote-tracking branch 'origin/develop' into develop

parents 5c82e18d db32413d
......@@ -146,6 +146,15 @@ export function updateTask(data) {
})
}
// 任务暂存编辑
export function editTemporaryStorage(data) {
return request({
url: '/task/editTemporaryStorage',
method: 'post',
data
})
}
/// 任务删除
export function removeTask(data) {
return request({
......
......@@ -209,6 +209,7 @@
<el-input
v-model="editParamsForm.identificationCode"
placeholder="请输入车辆识别码"
maxlength="50"
clearable
style="width: 90%"
/>
......@@ -217,6 +218,7 @@
<el-input
v-model="editParamsForm.sampleNumber"
placeholder="请输入样品编号"
maxlength="50"
clearable
style="width: 90%"
/>
......@@ -225,6 +227,7 @@
<el-input
v-model="editParamsForm.sampleName"
placeholder="请输入样品名称"
maxlength="50"
clearable
style="width: 90%"
/>
......@@ -233,6 +236,7 @@
<el-input
v-model="editParamsForm.sampleSender"
placeholder="请输入送样者"
maxlength="50"
clearable
style="width: 90%"
/>
......@@ -270,6 +274,7 @@
v-model="editParamsForm.manufacturingEnterprise"
placeholder="请输入生产企业"
clearable
maxlength="50"
style="width: 90%"
/>
</el-form-item>
......@@ -405,7 +410,8 @@ export default {
{ required: true, message: '请输入送样者', trigger: 'blur' }
],
numberOfSamples: [
{ required: true, message: '请输入样品数量', trigger: 'blur' }
{ required: true, message: '请输入样品数量', trigger: 'blur' },
{ pattern: /^\d*$/, message: '只能输入数字', trigger: 'blur' }
],
deliveryDate: [
{ required: true, message: '请选择送样日期', trigger: 'change' }
......
......@@ -302,6 +302,7 @@ import { selectSamplePage } from '@/api/system/sample'
import { getUserByRole } from '@/api/system/user'
import {
createTask,
editTemporaryStorage,
getTaskById,
getTemporaryStorage,
temporaryTask,
......@@ -550,7 +551,9 @@ export default {
label: '车企五'
}
],
taskId: undefined
taskId: undefined,
// 暂存数据
taskTemporaryStorage: null
}
},
watch: {
......@@ -630,7 +633,6 @@ export default {
item.check = true
}
})
debugger
console.log('检验项目', this.inspectionItemList)
// 把detail转到model里(任务信息)
for (const key in this.taskDetail) {
......@@ -656,17 +658,21 @@ export default {
console.log('小组table', this.tableData)
console.log('this.userList', this.userList)
// 整车样品信息
if (this.taskDetail.completeVehicleSample !== null) {
this.carInfoArr = this.taskDetail.completeVehicleSample
this.carInfoArr.forEach(item => {
item.sampleId = item.id
item.flag = 0
})
}
// 零件样品信息
if (this.taskDetail.partVehicleSample !== null) {
this.partInfoArr = this.taskDetail.partVehicleSample
this.partInfoArr.forEach(item => {
item.sampleId = item.id
item.flag = 1
})
}
console.log('零件样品信息', this.partInfoArr)
console.log('model', this.model)
})
......@@ -691,7 +697,7 @@ export default {
this.rules.testScenarioList[0].required = false
} else {
// this.$route.meta.title = '发起新任务'
this.getTemporaryStorage()
// this.getTemporaryStorage()
}
})
},
......@@ -699,6 +705,57 @@ export default {
getTemporaryStorage() {
getTemporaryStorage().then(response => {
console.log('暂存数据', response)
if (response.data !== null) {
this.taskTemporaryStorage = response.data
// 任务信息-(检验依据、检验项目)
this.model.standardId = this.taskTemporaryStorage.standardId
this.taskTemporaryStorage.taskList =
this.taskTemporaryStorage.taskList.split(',')
this.model.inspectionItemList = this.taskTemporaryStorage.taskList
this.inspectionItemList.forEach(item => {
if (this.taskTemporaryStorage.taskList.includes(item.value)) {
item.check = true
}
})
console.log('检验项目', this.inspectionItemList)
// 把detail转到model里(任务信息)
for (const key in this.taskTemporaryStorage) {
// eslint-disable-next-line no-prototype-builtins
if (this.model.hasOwnProperty(key)) {
this.model[key] = this.taskTemporaryStorage[key]
}
}
// 小组信息
this.tableData = this.taskTemporaryStorage.auditors
console.log('ddd', this.tableData)
this.tableData.forEach(item => {
item.nickName = item.name
item.dept = { deptName: item.deptName }
item.disabled = true
// 为下拉框做准备
this.userList.forEach(user => {
if (user.userId.toString() === item.userId.toString()) {
user.disabled = true
}
})
})
// 整车样品信息
if (this.taskTemporaryStorage.completeVehicleSample !== null) {
this.carInfoArr = this.taskTemporaryStorage.completeVehicleSample
this.carInfoArr.forEach(item => {
item.sampleId = item.id
item.flag = 0
})
}
// 零件样品信息
if (this.taskTemporaryStorage.partVehicleSample !== null) {
this.partInfoArr = this.taskTemporaryStorage.partVehicleSample
this.partInfoArr.forEach(item => {
item.sampleId = item.id
item.flag = 1
})
}
}
})
},
getUserByRole() {
......@@ -991,6 +1048,13 @@ export default {
})
} else {
this.taskCreateRequest.id = this.taskId
// 去除样品信息多余属性
this.taskCreateRequest.sample.forEach(item => {
delete item.id
})
this.taskCreateRequest.partSample.forEach(item => {
delete item.id
})
updateTask(this.taskCreateRequest).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess('修改成功')
......@@ -1041,6 +1105,18 @@ export default {
this.taskCreateRequest.sample = this.currentVehicleSampleInformation
this.taskCreateRequest.partSample = this.currentPartSampleInformation
console.log('暂存', this.taskCreateRequest)
if (this.taskTemporaryStorage !== null) {
// 暂存有数据再次暂存走编辑
this.taskCreateRequest.id = this.taskTemporaryStorage.id
editTemporaryStorage(this.taskCreateRequest).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess('暂存成功')
this.$router.push({
path: '/task/on'
})
}
})
} else {
temporaryTask(this.taskCreateRequest).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess('暂存成功')
......@@ -1049,6 +1125,7 @@ export default {
})
}
})
}
})
// 假装跳转详情页
// this.$router.push({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment