Commit 97d94b02 authored by jiaxu.yan's avatar jiaxu.yan

Merge branch 'develop' of http://gitlab.91isoft.com:90/car-test/web into develop

parents 39052f7b 4e607736
......@@ -163,3 +163,21 @@ export function getTaskById(data) {
data
})
}
// 暂存任务
export function temporaryTask(data) {
return request({
url: '/task/temporaryStorage',
method: 'post',
data
})
}
export function getTemporaryStorage(data) {
return request({
url: '/task/getTemporaryStorage',
method: 'post',
data
})
}
<template>
<page-standard>
<el-form ref="form" :model="model" :rules="rules">
<!-- <el-form-item label="选择任务类型">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- :type="formType === 1 ? 'primary' : 'default'"-->
<!-- round-->
<!-- @click="formType = 1"-->
<!-- >体系审查任务-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- :type="formType === 2 ? 'primary' : 'default'"-->
<!-- round-->
<!-- @click="formType = 2"-->
<!-- >车型测评任务-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- :type="formType === 3 ? 'primary' : 'default'"-->
<!-- round-->
<!-- @click="formType = 3"-->
<!-- >车型检验任务-->
<!-- </el-button>-->
<!-- </el-form-item>-->
<!-- <div class="subtitle">任务信息</div>-->
<div class="tip-navigation">
<div class="tip"></div>
<div class="tip-title">任务信息</div>
......@@ -32,8 +8,12 @@
<div class="global-left-margin">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="检验依据" prop="formType">
<el-select v-model="model.formType" style="width: 100%" clearable>
<el-form-item label="检验依据" prop="standardId">
<el-select
v-model="model.standardId"
style="width: 100%"
clearable
>
<el-option
v-for="(item, key) in standardList"
:key="key"
......@@ -44,7 +24,7 @@
</el-form-item>
</el-col>
</el-row>
<el-row v-show="model.formType === '1'" :gutter="20">
<el-row v-show="model.standardId === '1'" :gutter="20">
<el-col :span="24">
<el-form-item label="检验项目(可多选)" prop="inspectionItemList">
<div class="test-scenario-container">
......@@ -176,43 +156,6 @@
/>
</el-form-item>
</el-col>
<!-- <el-col :span="8">-->
<!-- <el-form-item label="车辆类型" prop="vehicleType">-->
<!-- <el-input-->
<!-- v-model="model.vehicleType"-->
<!-- placeholder="请输入"-->
<!-- clearable-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="车辆识别码" prop="vehicleIdentificationNumber">-->
<!-- <el-input-->
<!-- v-model="model.vehicleIdentificationNumber"-->
<!-- placeholder="请输入"-->
<!-- clearable-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="保密等级" prop="confidentialityLevel">-->
<!-- <el-select-->
<!-- v-model="model.confidentialityLevel"-->
<!-- placeholder="请选择"-->
<!-- clearable-->
<!-- style="width: 100%"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="(item, index) in dict.type.confidentiality_level"-->
<!-- :key="index"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- >-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
</el-row>
</div>
<div class="tip-navigation">
......@@ -311,132 +254,6 @@
>添加小组成员</el-button
>
</div>
<!-- <div class="subtitle" style="margin-top: 20px">报告信息</div>-->
<!-- <el-row :gutter="20">-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="样品名称" prop="sampleName">-->
<!-- <el-input-->
<!-- v-model="model.sampleName"-->
<!-- placeholder="请输入"-->
<!-- clearable-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="生产企业" prop="productionEnterprise">-->
<!-- <el-select-->
<!-- v-model="model.productionEnterprise"-->
<!-- placeholder="请选择"-->
<!-- clearable-->
<!-- filterable-->
<!-- style="width: 100%"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="(item, index) in productionEnterpriseList"-->
<!-- :key="index"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- >-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="商标" prop="trademark">-->
<!-- <ImageUpload-->
<!-- v-model="model.trademark"-->
<!-- :is-show-tip="false"-->
<!-- :limit="1"-->
<!-- ></ImageUpload>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="送样者" prop="sampleSender">-->
<!-- <el-input-->
<!-- v-model="model.sampleSender"-->
<!-- placeholder="请输入"-->
<!-- clearable-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="送样日期 " prop="sampleDeliveryDate">-->
<!-- <el-date-picker-->
<!-- v-model="model.sampleDeliveryDate"-->
<!-- style="width: 100%"-->
<!-- type="date"-->
<!-- placeholder="选择日期"-->
<!-- >-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="样品数量" prop="sampleQuantity">-->
<!-- <el-input-->
<!-- v-model="model.sampleQuantity"-->
<!-- placeholder="请输入"-->
<!-- clearable-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="生产日期 " prop="productionDate">-->
<!-- <el-date-picker-->
<!-- v-model="model.productionDate"-->
<!-- style="width: 100%"-->
<!-- type="date"-->
<!-- placeholder="选择日期"-->
<!-- >-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="检验依据" prop="inspectionBasis">-->
<!-- <el-input-->
<!-- v-model="model.inspectionBasis"-->
<!-- placeholder="请输入"-->
<!-- clearable-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- &lt;!&ndash; <el-col :span="8">&ndash;&gt;-->
<!-- &lt;!&ndash; <el-form-item label="检验项目" prop="inspectionItem">&ndash;&gt;-->
<!-- &lt;!&ndash; <el-select&ndash;&gt;-->
<!-- &lt;!&ndash; v-model="model.inspectionItem"&ndash;&gt;-->
<!-- &lt;!&ndash; style="width: 100%"&ndash;&gt;-->
<!-- &lt;!&ndash; placeholder="请选择"&ndash;&gt;-->
<!-- &lt;!&ndash; clearable&ndash;&gt;-->
<!-- &lt;!&ndash; >&ndash;&gt;-->
<!-- &lt;!&ndash; <el-option&ndash;&gt;-->
<!-- &lt;!&ndash; v-for="dict in dict.type.sys_pro"&ndash;&gt;-->
<!-- &lt;!&ndash; :key="dict.value"&ndash;&gt;-->
<!-- &lt;!&ndash; :label="dict.label"&ndash;&gt;-->
<!-- &lt;!&ndash; :value="dict.value"&ndash;&gt;-->
<!-- &lt;!&ndash; />&ndash;&gt;-->
<!-- &lt;!&ndash; </el-select>&ndash;&gt;-->
<!-- &lt;!&ndash; </el-form-item>&ndash;&gt;-->
<!-- &lt;!&ndash; </el-col>&ndash;&gt;-->
<!-- </el-row>-->
<!-- 检验项目 -->
<!-- <div v-show="model.formType === '2'">-->
<!-- <div class="subtitle" style="margin-top: 20px">检验项目</div>-->
<!-- <div class="test-scenario-container">-->
<!-- <div-->
<!-- v-for="(item, index) in inspectionItemList"-->
<!-- :key="index"-->
<!-- :class="{-->
<!-- 'test-scenario': item.check === false,-->
<!-- 'check-test-scenario': item.check === true-->
<!-- }"-->
<!-- @click="handleInspectionItem(item)"-->
<!-- >-->
<!-- <div>{{ item.label }}</div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- 整车样品信息 -->
<div class="tip-navigation">
<div class="tip"></div>
......@@ -460,26 +277,14 @@
@change="handleModChange"
/>
</el-form>
<!-- <div class="bottom-button">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- size="mini"-->
<!-- style="width: 120px"-->
<!-- @click="handleSave"-->
<!-- >暂存-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- size="mini"-->
<!-- style="width: 120px"-->
<!-- @click="handleAdd"-->
<!-- >发布-->
<!-- </el-button>-->
<!--返回按钮-->
<div class="bottom-btn">
<footer-button type="default" icon="hard-disk-one" @click="handleSave">
<footer-button
v-show="taskId === undefined"
type="default"
icon="hard-disk-one"
@click="handleSave"
>
暂存
</footer-button>
<footer-button type="primary" icon="check-small" @click="handleAdd">
......@@ -495,7 +300,13 @@ import CarInfo from './components/CarInfo'
import PartInfo from './components/PartInfo'
import { selectSamplePage } from '@/api/system/sample'
import { getUserByRole } from '@/api/system/user'
import { createTask, getTaskById, updateTask } from '@/api/task/task'
import {
createTask,
getTaskById,
getTemporaryStorage,
temporaryTask,
updateTask
} from '@/api/task/task'
import { mapGetters } from 'vuex'
import { getDicts } from '@/api/system/dict/data'
export default {
......@@ -513,7 +324,7 @@ export default {
return {
// 最终提交
taskCreateRequest: {
standardId: 1, // 检验依据
standardId: '', // 检验依据
taskList: [], // 选择的任务(检查项目)
taskNo: '', // 任务编号
taskName: '', // 任务名称
......@@ -571,7 +382,7 @@ export default {
partSampleInformationList: [],
websock: null,
userId: '',
formType: '1',
standardId: '1',
showTestScenario: false,
// 新增/保存 - 对象
model: {
......@@ -586,7 +397,7 @@ export default {
entrustedUnitCode: '', // 委托单位邮政编码
testScenarioList: [],
inspectionItemList: [],
formType: ''
standardId: ''
},
loading: false,
// 小组成员回显数据
......@@ -641,7 +452,7 @@ export default {
trigger: 'change'
}
],
formType: [
standardId: [
{ required: true, message: '请选择检验依据', trigger: 'change' }
],
taskNo: [
......@@ -776,13 +587,13 @@ export default {
}
}
},
formType: {
standardId: {
handler(newValue, oldValue) {
console.log('formType', newValue)
console.log('standardId', newValue)
if (newValue === '1') {
this.formType = '1'
this.standardId = '1'
} else if (newValue === '2') {
this.formType = '2'
this.standardId = '2'
}
}
}
......@@ -811,7 +622,7 @@ export default {
console.log('response', response)
this.taskDetail = response.data
// 任务信息-(检验依据、检验项目)
this.model.formType = this.taskDetail.standardId
this.model.standardId = this.taskDetail.standardId
this.taskDetail.taskList = this.taskDetail.taskList.split(',')
this.model.inspectionItemList = this.taskDetail.taskList
this.inspectionItemList.forEach(item => {
......@@ -874,12 +685,22 @@ export default {
// 当编辑时
this.taskId = this.$route.query.taskId
if (this.taskId !== undefined) {
// this.$route.meta.title = '编辑任务'
this.getTaskDetail(this.taskId)
this.rules.inspectionItemList[0].required = false
this.rules.testScenarioList[0].required = false
} else {
// this.$route.meta.title = '发起新任务'
this.getTemporaryStorage()
}
})
},
// 查看是否有暂存数据
getTemporaryStorage() {
getTemporaryStorage().then(response => {
console.log('暂存数据', response)
})
},
getUserByRole() {
getUserByRole({ roleName: '检验员' }).then(response => {
this.userList = response.data.map(obj => {
......@@ -1120,7 +941,6 @@ export default {
},
// 保存
handleAdd() {
console.log('a', this.inspectionItemList)
this.$refs.form.validate(valid => {
if (valid) {
// 判断小组信息、整车样品信息、零件样品信息有无数据
......@@ -1134,6 +954,15 @@ export default {
this.$message.error('请填写零件样品信息')
return
}
this.$confirm('是否确认进行发布功能', '发布', {
confirmButtonText: '确定',
concelButtonText: '取消',
type: 'warning',
customClass: 'box-logout',
cancelButtonClass: 'resetBtn',
closeOnClickModal: false,
confirmButtonClass: 'queryBtn'
}).then(() => {
// 开始窜数据
for (const key in this.model) {
// eslint-disable-next-line no-prototype-builtins
......@@ -1148,7 +977,8 @@ export default {
})
this.taskCreateRequest.auditors = this.tableData
this.taskCreateRequest.sample = this.currentVehicleSampleInformation
this.taskCreateRequest.partSample = this.currentPartSampleInformation
this.taskCreateRequest.partSample =
this.currentPartSampleInformation
console.log('发布...', this.taskCreateRequest)
if (this.taskId === undefined) {
createTask(this.taskCreateRequest).then(response => {
......@@ -1170,23 +1000,81 @@ export default {
}
})
}
})
}
})
},
// 暂存
handleSave() {
// this.$refs.form.validate(valid => {
// if (valid) {
// this.$modal.msgSuccess('暂存成功')
// }
// })
// 假装跳转详情页
// 都为空时不能暂存
if (
this.areAllPropertiesEmpty(this.model) &&
this.tableData.length === 0 &&
this.currentVehicleSampleInformation.length === 0 &&
this.currentPartSampleInformation.length === 0
) {
this.$modal.msgError('请填写部分内容再进行暂存')
return
}
this.$confirm('是否确认进行暂存功能', '暂存', {
confirmButtonText: '确定',
concelButtonText: '取消',
type: 'warning',
customClass: 'box-logout',
cancelButtonClass: 'resetBtn',
closeOnClickModal: false,
confirmButtonClass: 'queryBtn'
}).then(() => {
// 窜数据
for (const key in this.model) {
// eslint-disable-next-line no-prototype-builtins
if (this.taskCreateRequest.hasOwnProperty(key)) {
this.taskCreateRequest[key] = this.model[key]
}
}
this.taskCreateRequest.taskList = this.model.inspectionItemList
this.tableData.forEach(item => {
item.deptName = item.dept.deptName
item.name = item.nickName
})
this.taskCreateRequest.auditors = this.tableData
this.taskCreateRequest.sample = this.currentVehicleSampleInformation
this.taskCreateRequest.partSample = this.currentPartSampleInformation
console.log('暂存', this.taskCreateRequest)
temporaryTask(this.taskCreateRequest).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess('暂存成功')
this.$router.push({
path: '/task/task-detail',
query: {
taskId: '1763404524439060481'
path: '/task/on'
})
}
})
})
// 假装跳转详情页
// this.$router.push({
// path: '/task/task-detail',
// query: {
// taskId: '1763404524439060481'
// }
// })
},
// 判断一个对象里的数据是否为空
areAllPropertiesEmpty(obj) {
for (const key in obj) {
const value = obj[key]
if (Array.isArray(value)) {
if (value.length > 0) {
return false // 数组不为空,返回false
}
} else if (typeof value === 'object' && value !== null) {
if (!this.areAllPropertiesEmpty(value)) {
return false // 对象中的属性不为空,返回false
}
} else if (value !== '' && value !== null && value !== undefined) {
return false // 其他类型的属性不为空,返回false
}
}
return true
}
}
}
......
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