Commit 0a9da7db authored by jiaxu.yan's avatar jiaxu.yan

feat: 检验内容库、我发起的任务、任务添加、任务编辑、任务详情、待办任务、已办任务、已归档任务

parent c144859b
...@@ -10,3 +10,19 @@ export function manufacturerData(data) { ...@@ -10,3 +10,19 @@ export function manufacturerData(data) {
data data
}) })
} }
/**
* 根据标准获取子任务类型
* @param {*} data
* @returns
*/
export function getByStandardId(data) {
return request({
url: '/standard/getByStandardId',
method: 'post',
data
})
}
...@@ -20,7 +20,7 @@ empty ...@@ -20,7 +20,7 @@ empty
<ul class="select-list"> <ul class="select-list">
<template v-for="item in standardList"> <template v-for="item in standardList">
<li <li
@click="selectStandard(item.id)" @click="selectStandard(item)"
:class="item.id === standard ? 'selected' : ''" :class="item.id === standard ? 'selected' : ''"
> >
<el-tooltip <el-tooltip
...@@ -70,6 +70,9 @@ export default { ...@@ -70,6 +70,9 @@ export default {
}, },
created() { created() {
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
if (this.standardList.length > 0) {
this.selectStandard(this.standardList[0])
}
}, },
computed: { computed: {
...mapGetters(['standard', 'standardList']) ...mapGetters(['standard', 'standardList'])
......
...@@ -18,6 +18,7 @@ const getters = { ...@@ -18,6 +18,7 @@ const getters = {
sidebarRouters: state => state.permission.sidebarRouters, sidebarRouters: state => state.permission.sidebarRouters,
companyFiles: state => state.processing.companyFiles, companyFiles: state => state.processing.companyFiles,
standard: state => state.standard.standard, standard: state => state.standard.standard,
standard_name: state => state.standard.standard_name,
standardList: state => state.standard.standardList, standardList: state => state.standard.standardList,
testScenarioList: state => state.testScenario.testScenarioList, testScenarioList: state => state.testScenario.testScenarioList,
dept: state => state.user.dept dept: state => state.user.dept
......
...@@ -3,6 +3,7 @@ const standard = { ...@@ -3,6 +3,7 @@ const standard = {
namespaced: true, namespaced: true,
state: { state: {
standard: '', standard: '',
standard_name: '',
standardList: [] standardList: []
}, },
...@@ -12,12 +13,16 @@ const standard = { ...@@ -12,12 +13,16 @@ const standard = {
}, },
SET_STANDARD_LIST: (state, standardList) => { SET_STANDARD_LIST: (state, standardList) => {
state.standardList = standardList state.standardList = standardList
} },
SET_STANDARDNAME: (state, standard) => {
state.standard_name = standard
},
}, },
actions: { actions: {
setStandard({ commit }, standard) { setStandard({ commit }, standard) {
commit('SET_STANDARD', standard) commit('SET_STANDARD', standard.id)
commit('SET_STANDARDNAME', standard.name)
}, },
setStandardList({ commit }, name) { setStandardList({ commit }, name) {
getStandardList({ getStandardList({
......
...@@ -282,6 +282,7 @@ import page from '@/mixins/page' ...@@ -282,6 +282,7 @@ import page from '@/mixins/page'
import vehicleModelDialog from './components/vehicleModelDialog' import vehicleModelDialog from './components/vehicleModelDialog'
import documentReviewDialog from './components/documentReviewDialog' import documentReviewDialog from './components/documentReviewDialog'
import request from '@/utils/request' import request from '@/utils/request'
import { getByStandardId } from '@/api/task/new'
export default { export default {
components: { components: {
'vehiclemodel-dialog': vehicleModelDialog, 'vehiclemodel-dialog': vehicleModelDialog,
...@@ -294,20 +295,7 @@ export default { ...@@ -294,20 +295,7 @@ export default {
listUrl: '/review/standard/list', listUrl: '/review/standard/list',
totalTest: 0, totalTest: 0,
tableTestData: [], tableTestData: [],
reviewTypeList: [ reviewTypeList: [],
{
label: '体系审查',
value: 'system'
},
{
label: '车型审查',
value: 'car'
},
{
label: '车型试验',
value: 'test'
}
],
showSearch: true, showSearch: true,
tableData: [], tableData: [],
queryParams: { queryParams: {
...@@ -353,7 +341,7 @@ export default { ...@@ -353,7 +341,7 @@ export default {
'$store.getters.standard': { '$store.getters.standard': {
handler(newVal, oldVal) { handler(newVal, oldVal) {
this.queryParams.standardId = newVal this.queryParams.standardId = newVal
this.loadData() this.getTaskType(newVal)
} }
}, },
refreshList(val) { refreshList(val) {
...@@ -369,9 +357,48 @@ export default { ...@@ -369,9 +357,48 @@ export default {
} }
} }
}, },
created() {
this.getTaskType(this.$store.getters.standard)
},
methods: { methods: {
getTaskType(id) {
getByStandardId({
id
}).then(response => {
console.log(response)
this.reviewTypeList = response.rows.map(i => {
if (i.dictValue === 'sraif') {
return {
label: '体系审查',
value: 'system'
}
} else if (i.dictValue === 'grfis') {
return {
label: '车型审查',
value: 'car'
}
} else {
return {
label: '车型试验',
value: 'test'
}
}
})
if (this.reviewTypeList.length) {
this.queryParams.type = this.reviewTypeList[0].value
if (this.queryParams.type === 'test') {
this.queryParamsTest.pageNum = 1
this.loadTestData()
} else {
this.queryParams.pageNum = 1
this.loadData()
}
}
})
},
handleTab(v) { handleTab(v) {
if (v.index === '2') { console.log(v)
if (v.name === 'test') {
this.queryParamsTest.pageNum = 1 this.queryParamsTest.pageNum = 1
this.loadTestData() this.loadTestData()
} else { } else {
...@@ -434,7 +461,7 @@ export default { ...@@ -434,7 +461,7 @@ export default {
offset: this.queryParamsTest.offset, offset: this.queryParamsTest.offset,
searchFields: this.queryParamsTest.searchFields, searchFields: this.queryParamsTest.searchFields,
orderBy: this.queryParamsTest.orderBy, orderBy: this.queryParamsTest.orderBy,
name: '汽车整车信息安全技术要求' name: this.$store.getters.standard_name
} }
this.loading = true this.loading = true
request({ request({
......
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
clearable clearable
> >
<el-option <el-option
v-for="dict in dict.type.inspection_item" v-for="dict in taskTypeList"
:key="dict.value" :key="dict.dictValue"
:label="dict.label" :label="dict.dictLabel"
:value="dict.value" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -259,12 +259,14 @@ ...@@ -259,12 +259,14 @@
import page from '@/mixins/page' import page from '@/mixins/page'
import { pdfDownload } from '@/api/task/task' import { pdfDownload } from '@/api/task/task'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { getByStandardId } from '@/api/task/new'
export default { export default {
dicts: ['sys_scene_type', 'task_type', 'inspection_item'], dicts: ['sys_scene_type', 'task_type', 'inspection_item'],
mixins: [page], mixins: [page],
data() { data() {
return { return {
listUrl: '/task/findFinish', listUrl: '/task/findFinish',
taskTypeList: [],
showSearch: true, showSearch: true,
tableData: [] tableData: []
} }
...@@ -273,12 +275,29 @@ export default { ...@@ -273,12 +275,29 @@ export default {
computed: { computed: {
...mapGetters(['userId', 'standardList']) ...mapGetters(['userId', 'standardList'])
}, },
watch: {
watch: {}, // 监控标准修改
'queryParams.standardId': {
handler(newValue, oldValue) {
this.taskTypeList = []
if (newValue) {
this.getTaskType(newValue)
}
}
}
},
created() { created() {
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
}, },
methods: { methods: {
getTaskType(id) {
getByStandardId({
id
}).then(response => {
console.log(response)
this.taskTypeList = response.rows
})
},
/* 跳转到问卷详情*/ /* 跳转到问卷详情*/
goNext(url) { goNext(url) {
this.$router.push({ path: url }) this.$router.push({ path: url })
......
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
clearable clearable
> >
<el-option <el-option
v-for="dict in dict.type.inspection_item" v-for="dict in taskTypeList"
:key="dict.value" :key="dict.dictValue"
:label="dict.label" :label="dict.dictLabel"
:value="dict.value" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -234,11 +234,13 @@ ...@@ -234,11 +234,13 @@
import page from '@/mixins/page' import page from '@/mixins/page'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { pdfDownload } from '@/api/task/task' import { pdfDownload } from '@/api/task/task'
import { getByStandardId } from '@/api/task/new'
export default { export default {
mixins: [page], mixins: [page],
dicts: ['inspection_item'], dicts: ['inspection_item'],
data() { data() {
return { return {
taskTypeList: [],
listUrl: '/task/findUserFinish', listUrl: '/task/findUserFinish',
showSearch: true, showSearch: true,
tableData: [] tableData: []
...@@ -247,10 +249,29 @@ export default { ...@@ -247,10 +249,29 @@ export default {
computed: { computed: {
...mapGetters(['userId', 'standardList']) ...mapGetters(['userId', 'standardList'])
}, },
watch: {
// 监控标准修改
'queryParams.standardId': {
handler(newValue, oldValue) {
this.taskTypeList = []
if (newValue) {
this.getTaskType(newValue)
}
}
}
},
created() { created() {
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
}, },
methods: { methods: {
getTaskType(id) {
getByStandardId({
id
}).then(response => {
console.log(response)
this.taskTypeList = response.rows
})
},
/** /**
* 检验报告 * 检验报告
*/ */
......
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
clearable clearable
> >
<el-option <el-option
v-for="dict in dict.type.inspection_item" v-for="dict in taskTypeList"
:key="dict.value" :key="dict.dictValue"
:label="dict.label" :label="dict.dictLabel"
:value="dict.value" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -408,7 +408,7 @@ import { ...@@ -408,7 +408,7 @@ import {
getScenarioList, getScenarioList,
reviewTaskStart reviewTaskStart
} from '@/api/task/task' } from '@/api/task/task'
import { getByStandardId } from '@/api/task/new'
export default { export default {
dicts: [ dicts: [
'inspection_item', 'inspection_item',
...@@ -423,6 +423,7 @@ export default { ...@@ -423,6 +423,7 @@ export default {
mixins: [page], mixins: [page],
data() { data() {
return { return {
taskTypeList: [],
// 子任务内容跳转文字map // 子任务内容跳转文字map
dialogManager: { dialogManager: {
dialogVisible: false, dialogVisible: false,
...@@ -444,10 +445,29 @@ export default { ...@@ -444,10 +445,29 @@ export default {
computed: { computed: {
...mapGetters(['userId', 'standardList']) ...mapGetters(['userId', 'standardList'])
}, },
watch: {
// 监控标准修改
'queryParams.standardId': {
handler(newValue, oldValue) {
this.taskTypeList = []
if (newValue) {
this.getTaskType(newValue)
}
}
}
},
created() { created() {
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
}, },
methods: { methods: {
getTaskType(id) {
getByStandardId({
id
}).then(response => {
console.log(response)
this.taskTypeList = response.rows
})
},
/** /**
* 企业留档文件 * 企业留档文件
* @param item 对象 * @param item 对象
......
...@@ -282,6 +282,7 @@ import page from '@/mixins/page' ...@@ -282,6 +282,7 @@ import page from '@/mixins/page'
import vehicleModelDialog from './components/vehicleModelDialog' import vehicleModelDialog from './components/vehicleModelDialog'
import documentReviewDialog from './components/documentReviewDialog' import documentReviewDialog from './components/documentReviewDialog'
import request from '@/utils/request' import request from '@/utils/request'
import { getByStandardId } from '@/api/task/new'
export default { export default {
components: { components: {
'vehiclemodel-dialog': vehicleModelDialog, 'vehiclemodel-dialog': vehicleModelDialog,
...@@ -294,20 +295,7 @@ export default { ...@@ -294,20 +295,7 @@ export default {
listUrl: '/review/standard/list', listUrl: '/review/standard/list',
totalTest: 0, totalTest: 0,
tableTestData: [], tableTestData: [],
reviewTypeList: [ reviewTypeList: [],
{
label: '体系审查',
value: 'system'
},
{
label: '车型审查',
value: 'car'
},
{
label: '车型试验',
value: 'test'
}
],
showSearch: true, showSearch: true,
tableData: [], tableData: [],
queryParams: { queryParams: {
...@@ -353,7 +341,7 @@ export default { ...@@ -353,7 +341,7 @@ export default {
'$store.getters.standard': { '$store.getters.standard': {
handler(newVal, oldVal) { handler(newVal, oldVal) {
this.queryParams.standardId = newVal this.queryParams.standardId = newVal
this.loadData() this.getTaskType(newVal)
} }
}, },
refreshList(val) { refreshList(val) {
...@@ -369,9 +357,48 @@ export default { ...@@ -369,9 +357,48 @@ export default {
} }
} }
}, },
created() {
this.getTaskType(this.$store.getters.standard)
},
methods: { methods: {
getTaskType(id) {
getByStandardId({
id
}).then(response => {
console.log(response)
this.reviewTypeList = response.rows.map(i => {
if (i.dictValue === 'sraif') {
return {
label: '体系审查',
value: 'system'
}
} else if (i.dictValue === 'grfis') {
return {
label: '车型审查',
value: 'car'
}
} else {
return {
label: '车型试验',
value: 'test'
}
}
})
if (this.reviewTypeList.length) {
this.queryParams.type = this.reviewTypeList[0].value
if (this.queryParams.type === 'test') {
this.queryParamsTest.pageNum = 1
this.loadTestData()
} else {
this.queryParams.pageNum = 1
this.loadData()
}
}
})
},
handleTab(v) { handleTab(v) {
if (v.index === '2') { console.log(v)
if (v.name === 'test') {
this.queryParamsTest.pageNum = 1 this.queryParamsTest.pageNum = 1
this.loadTestData() this.loadTestData()
} else { } else {
...@@ -434,7 +461,7 @@ export default { ...@@ -434,7 +461,7 @@ export default {
offset: this.queryParamsTest.offset, offset: this.queryParamsTest.offset,
searchFields: this.queryParamsTest.searchFields, searchFields: this.queryParamsTest.searchFields,
orderBy: this.queryParamsTest.orderBy, orderBy: this.queryParamsTest.orderBy,
name: '汽车整车信息安全技术要求' name: this.$store.getters.standard_name
} }
this.loading = true this.loading = true
request({ request({
......
...@@ -449,6 +449,14 @@ ...@@ -449,6 +449,14 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24">
<el-form-item label="签字图片" prop="signaturePicture">
<ImageUpload
v-model="form.signaturePicture"
:limit="1"
></ImageUpload>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -622,6 +630,9 @@ export default { ...@@ -622,6 +630,9 @@ export default {
trigger: ['blur', 'change'] trigger: ['blur', 'change']
} }
], ],
signaturePicture: [
{ required: true, message: '请上传签字图片', trigger: 'blur' }
],
phonenumber: [ phonenumber: [
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
v-model="model.standardId" v-model="model.standardId"
style="width: 100%" style="width: 100%"
clearable clearable
@change="changeStandard"
> >
<el-option <el-option
v-for="(item, key) in standardList" v-for="(item, key) in standardList"
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-show="model.standardId === '1'" :gutter="20"> <el-row v-show="model.standardId" :gutter="20">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="检验项目(可多选)" prop="inspectionItemList"> <el-form-item label="检验项目(可多选)" prop="inspectionItemList">
<div class="test-scenario-container"> <div class="test-scenario-container">
...@@ -346,7 +347,7 @@ import { ...@@ -346,7 +347,7 @@ import {
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { getDicts } from '@/api/system/dict/data' import { getDicts } from '@/api/system/dict/data'
import DocumentInfo from '@/views/task/new/components/DocumentInfo.vue' import DocumentInfo from '@/views/task/new/components/DocumentInfo.vue'
import { getByStandardId } from '@/api/task/new'
export default { export default {
dicts: [ dicts: [
'sys_task_status', 'sys_task_status',
...@@ -446,14 +447,14 @@ export default { ...@@ -446,14 +447,14 @@ export default {
tableData: [], tableData: [],
inspectionItemList: [], inspectionItemList: [],
rules: { rules: {
testScenarioList: [ // testScenarioList: [
{ // {
type: 'array', // type: 'array',
required: true, // required: true,
message: '请至少选择一个测试场景', // message: '请至少选择一个测试场景',
trigger: 'change' // trigger: 'change'
} // }
], // ],
inspectionItemList: [ inspectionItemList: [
{ {
type: 'array', type: 'array',
...@@ -629,6 +630,13 @@ export default { ...@@ -629,6 +630,13 @@ export default {
...mapGetters(['standard', 'standardList', 'testScenarioList']) ...mapGetters(['standard', 'standardList', 'testScenarioList'])
}, },
methods: { methods: {
changeStandard(e) {
this.taskDetail.taskList = []
this.getInspectionItemDict(e)
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
},
handleDocumentInfoChange(value) { handleDocumentInfoChange(value) {
this.documentInfoArr = value this.documentInfoArr = value
}, },
...@@ -640,12 +648,7 @@ export default { ...@@ -640,12 +648,7 @@ export default {
this.model.standardId = this.taskDetail.standardId this.model.standardId = this.taskDetail.standardId
this.taskDetail.taskList = this.taskDetail.taskList.split(',') this.taskDetail.taskList = this.taskDetail.taskList.split(',')
this.model.inspectionItemList = this.taskDetail.taskList this.model.inspectionItemList = this.taskDetail.taskList
this.inspectionItemList.forEach(item => { this.getInspectionItemDict(this.taskDetail.standardId)
if (this.taskDetail.taskList.includes(item.value)) {
item.check = true
}
})
console.log('检验项目', this.inspectionItemList)
// 把detail转到model里(任务信息) // 把detail转到model里(任务信息)
for (const key in this.taskDetail) { for (const key in this.taskDetail) {
// eslint-disable-next-line no-prototype-builtins // eslint-disable-next-line no-prototype-builtins
...@@ -712,9 +715,13 @@ export default { ...@@ -712,9 +715,13 @@ export default {
return obj.value return obj.value
}) })
}, },
getInspectionItemDict() { getInspectionItemDict(id) {
getDicts('inspection_item').then(response => { getByStandardId({
this.inspectionItemList = response.data.map( id
}).then(response => {
console.log(response)
this.inspectionItemList = []
this.inspectionItemList = response.rows.map(
({ dictValue, dictLabel, ...rest }) => ({ ({ dictValue, dictLabel, ...rest }) => ({
label: dictLabel, label: dictLabel,
value: dictValue, value: dictValue,
...@@ -722,14 +729,15 @@ export default { ...@@ -722,14 +729,15 @@ export default {
...rest ...rest
}) })
) )
console.log('aaa', this.inspectionItemList) this.inspectionItemList.forEach(item => {
if (this.taskDetail.taskList.includes(item.value)) {
item.check = true
}
})
// 当编辑时 // 当编辑时
this.taskId = this.$route.query.taskId
if (this.taskId !== undefined) { if (this.taskId !== undefined) {
// this.$route.meta.title = '编辑任务' // this.$route.meta.title = '编辑任务'
this.getTaskDetail(this.taskId)
this.rules.inspectionItemList[0].required = false this.rules.inspectionItemList[0].required = false
this.rules.testScenarioList[0].required = false
} else { } else {
this.getTemporaryStorage() this.getTemporaryStorage()
} }
...@@ -802,7 +810,8 @@ export default { ...@@ -802,7 +810,8 @@ export default {
return { ...obj, disabled: false } return { ...obj, disabled: false }
}) })
console.log('this.userList-1', this.userList) console.log('this.userList-1', this.userList)
this.getInspectionItemDict() this.taskId = this.$route.query.taskId
this.getTaskDetail(this.taskId)
}) })
}, },
handleCarsChange(cards) { handleCarsChange(cards) {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-show="model.standardId === '1'" :gutter="20"> <el-row v-show="model.standardId" :gutter="20">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="检验项目(可多选)" prop="inspectionItemList"> <el-form-item label="检验项目(可多选)" prop="inspectionItemList">
<div class="test-scenario-container"> <div class="test-scenario-container">
...@@ -345,7 +345,7 @@ import { ...@@ -345,7 +345,7 @@ import {
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { getDicts } from '@/api/system/dict/data' import { getDicts } from '@/api/system/dict/data'
import DocumentInfo from '@/views/task/new/components/DocumentInfo.vue' import DocumentInfo from '@/views/task/new/components/DocumentInfo.vue'
import { getByStandardId } from '@/api/task/new'
export default { export default {
dicts: [ dicts: [
'sys_task_status', 'sys_task_status',
...@@ -426,7 +426,6 @@ export default { ...@@ -426,7 +426,6 @@ export default {
websock: null, websock: null,
testScenarioShow: false, testScenarioShow: false,
userId: '', userId: '',
standardId: '1',
showTestScenario: false, showTestScenario: false,
// 新增/保存 - 对象 // 新增/保存 - 对象
model: { model: {
...@@ -586,6 +585,18 @@ export default { ...@@ -586,6 +585,18 @@ export default {
} }
} }
}, },
// 监控标准修改
'model.standardId': {
handler(newValue, oldValue) {
if (newValue) {
this.model.inspectionItemList = []
this.getTaskType(newValue)
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
}
}
},
'model.inspectionItemList': { 'model.inspectionItemList': {
handler(newValue, oldValue) { handler(newValue, oldValue) {
console.log('bne', newValue) console.log('bne', newValue)
...@@ -611,7 +622,7 @@ export default { ...@@ -611,7 +622,7 @@ export default {
// this.rules.testScenarioList[0].required = false // this.rules.testScenarioList[0].required = false
// } // }
} }
}, }
// 'model.testScenarioList': { // 'model.testScenarioList': {
// handler(newValue, oldValue) { // handler(newValue, oldValue) {
// if (newValue.length > 0) { // if (newValue.length > 0) {
...@@ -621,16 +632,6 @@ export default { ...@@ -621,16 +632,6 @@ export default {
// } // }
// } // }
// }, // },
standardId: {
handler(newValue, oldValue) {
console.log('standardId', newValue)
if (newValue === '1') {
this.standardId = '1'
} else if (newValue === '2') {
this.standardId = '2'
}
}
}
}, },
created() { created() {
// this.$store.dispatch('testScenario/setTestScenarioList') // this.$store.dispatch('testScenario/setTestScenarioList')
...@@ -652,6 +653,34 @@ export default { ...@@ -652,6 +653,34 @@ export default {
// this.websock.close() // 离开路由之后断开websocket连接 // this.websock.close() // 离开路由之后断开websocket连接
// }, // },
methods: { methods: {
getTaskType(id) {
getByStandardId({
id
}).then(response => {
console.log(response)
this.inspectionItemList = []
this.inspectionItemList = response.rows.map(
({ dictValue, dictLabel, ...rest }) => ({
label: dictLabel,
value: dictValue,
check: false,
...rest
})
)
console.log('aaa', this.inspectionItemList)
// 当编辑时
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()
}
})
},
getTaskDetail(taskId) { getTaskDetail(taskId) {
getTaskById({ id: taskId }).then(response => { getTaskById({ id: taskId }).then(response => {
console.log('response', response) console.log('response', response)
...@@ -718,30 +747,6 @@ export default { ...@@ -718,30 +747,6 @@ export default {
return obj.value return obj.value
}) })
}, },
getInspectionItemDict() {
getDicts('inspection_item').then(response => {
this.inspectionItemList = response.data.map(
({ dictValue, dictLabel, ...rest }) => ({
label: dictLabel,
value: dictValue,
check: false,
...rest
})
)
console.log('aaa', this.inspectionItemList)
// 当编辑时
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() {
getTemporaryStorage().then(response => { getTemporaryStorage().then(response => {
...@@ -822,7 +827,6 @@ export default { ...@@ -822,7 +827,6 @@ export default {
return { ...obj, disabled: false } return { ...obj, disabled: false }
}) })
console.log('this.userList-1', this.userList) console.log('this.userList-1', this.userList)
this.getInspectionItemDict()
}) })
}, },
handleCarsChange(cards) { handleCarsChange(cards) {
......
...@@ -59,10 +59,10 @@ ...@@ -59,10 +59,10 @@
clearable clearable
> >
<el-option <el-option
v-for="dict in dict.type.inspection_item" v-for="dict in taskTypeList"
:key="dict.value" :key="dict.dictValue"
:label="dict.label" :label="dict.dictLabel"
:value="dict.value" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -512,6 +512,7 @@ import { getHourDiff } from '@/utils/diff' ...@@ -512,6 +512,7 @@ import { getHourDiff } from '@/utils/diff'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { reviewTaskStart, pdfDownload, removeTask } from '@/api/task/task' import { reviewTaskStart, pdfDownload, removeTask } from '@/api/task/task'
import request from '@/utils/request' import request from '@/utils/request'
import { getByStandardId } from '@/api/task/new'
export default { export default {
dicts: [ dicts: [
'inspection_item', 'inspection_item',
...@@ -543,6 +544,7 @@ export default { ...@@ -543,6 +544,7 @@ export default {
value: 'FINISH' value: 'FINISH'
} }
], ],
taskTypeList: [],
// 子任务内容跳转文字map // 子任务内容跳转文字map
dialogVisible: false, dialogVisible: false,
listUrl: '/task/findCreate', listUrl: '/task/findCreate',
...@@ -561,10 +563,30 @@ export default { ...@@ -561,10 +563,30 @@ export default {
computed: { computed: {
...mapGetters(['userId', 'standardList']) ...mapGetters(['userId', 'standardList'])
}, },
watch: {
// 监控标准修改
'queryParams.standardId': {
handler(newValue, oldValue) {
this.taskTypeList = []
if (newValue) {
this.getTaskType(newValue)
}
}
}
},
created() { created() {
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
}, },
methods: { methods: {
getTaskType(id) {
getByStandardId({
id
}).then(response => {
console.log(response)
this.taskTypeList = response.rows
})
},
/** /**
* 下载pdf * 下载pdf
*/ */
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-show="model.formType === '1'" :gutter="20"> <el-row :gutter="20">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="检验项目(可多选)" prop="inspectionItemList"> <el-form-item label="检验项目(可多选)" prop="inspectionItemList">
<div class="test-scenario-container"> <div class="test-scenario-container">
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-show="testScenarioShow" :gutter="20"> <!-- <el-row v-show="testScenarioShow" :gutter="20">
<el-col :span="24"> <el-col :span="24">
<el-form-item <el-form-item
label="请选择测试场景(可多选)" label="请选择测试场景(可多选)"
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row> -->
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="任务编号" prop="taskNo"> <el-form-item label="任务编号" prop="taskNo">
...@@ -275,6 +275,7 @@ import { createTask, getTaskById } from '@/api/task/task' ...@@ -275,6 +275,7 @@ import { createTask, getTaskById } from '@/api/task/task'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { getDicts } from '@/api/system/dict/data' import { getDicts } from '@/api/system/dict/data'
import DocumentInfo from '@/views/task/new/components/DocumentInfo.vue' import DocumentInfo from '@/views/task/new/components/DocumentInfo.vue'
import { getByStandardId } from '@/api/task/new'
export default { export default {
dicts: [ dicts: [
'sys_task_status', 'sys_task_status',
...@@ -371,16 +372,7 @@ export default { ...@@ -371,16 +372,7 @@ export default {
// 小组成员回显数据 // 小组成员回显数据
tableData: [], tableData: [],
inspectionItemList: [], inspectionItemList: [],
// testScenarioList: [],
rules: { rules: {
// testScenarioList: [
// {
// type: 'array',
// required: true,
// message: '请至少选择一个测试场景',
// trigger: 'change'
// }
// ],
inspectionItemList: [ inspectionItemList: [
{ {
type: 'array', type: 'array',
...@@ -504,44 +496,34 @@ export default { ...@@ -504,44 +496,34 @@ export default {
this.$refs.form.validateField('inspectionItemList') this.$refs.form.validateField('inspectionItemList')
} }
console.log('aaaa', newValue) console.log('aaaa', newValue)
// if (
// (newValue.length === 1 && newValue.includes('trfis')) ||
// (newValue.length === 2 &&
// newValue.includes('trfis') &&
// newValue.includes('sraif'))
// ) {
// this.rules.testScenarioList[0].required = true
// this.testScenarioShow = true
// } else {
// this.testScenarioShow = false
// this.rules.testScenarioList[0].required = false
// }
}
},
'model.testScenarioList': {
handler(newValue, oldValue) {
if (newValue.length > 0) {
this.$refs.form.clearValidate('testScenarioList')
} else {
this.$refs.form.validateField('testScenarioList')
}
}
},
formType: {
handler(newValue, oldValue) {
console.log('formType', newValue)
if (newValue === '1') {
this.formType = '1'
} else if (newValue === '2') {
this.formType = '2'
}
} }
} }
// 'model.testScenarioList': {
// handler(newValue, oldValue) {
// if (newValue.length > 0) {
// this.$refs.form.clearValidate('testScenarioList')
// } else {
// this.$refs.form.validateField('testScenarioList')
// }
// }
// },
// formType: {
// handler(newValue, oldValue) {
// console.log('formType', newValue)
// if (newValue === '1') {
// this.formType = '1'
// } else if (newValue === '2') {
// this.formType = '2'
// }
// }
// }
}, },
created() { created() {
// 接收路由传参 // 接收路由传参
// this.$store.dispatch('testScenario/setTestScenarioList') // this.$store.dispatch('testScenario/setTestScenarioList')
this.getInspectionItemDict() // 查询详情
const taskId = this.$route.query.taskId
this.getTaskDetail(taskId)
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
}, },
computed: { computed: {
...@@ -552,13 +534,7 @@ export default { ...@@ -552,13 +534,7 @@ export default {
getTaskById({ id: taskId }).then(response => { getTaskById({ id: taskId }).then(response => {
console.log('response', response) console.log('response', response)
this.taskDetail = response.data this.taskDetail = response.data
// 任务信息-(检验依据、检验项目) this.getInspectionItemDict(this.taskDetail.standardId)
this.model.formType = this.taskDetail.standardId
this.inspectionItemList.forEach(item => {
if (this.taskDetail.taskList.split(',').includes(item.value)) {
item.check = true
}
})
// 测试场景 // 测试场景
if (this.taskDetail.testScenarioList !== null) { if (this.taskDetail.testScenarioList !== null) {
this.testScenarioList.forEach(item => { this.testScenarioList.forEach(item => {
...@@ -614,9 +590,12 @@ export default { ...@@ -614,9 +590,12 @@ export default {
// } // }
}) })
}, },
getInspectionItemDict() { getInspectionItemDict(id) {
getDicts('inspection_item').then(response => { getByStandardId({
this.inspectionItemList = response.data.map( id
}).then(response => {
console.log(response)
this.inspectionItemList = response.rows.map(
({ dictValue, dictLabel, ...rest }) => ({ ({ dictValue, dictLabel, ...rest }) => ({
label: dictLabel, label: dictLabel,
value: dictValue, value: dictValue,
...@@ -624,9 +603,12 @@ export default { ...@@ -624,9 +603,12 @@ export default {
...rest ...rest
}) })
) )
// 查询详情 // 任务信息-(检验依据、检验项目)
const taskId = this.$route.query.taskId this.inspectionItemList.forEach(item => {
this.getTaskDetail(taskId) if (this.taskDetail.taskList.split(',').includes(item.value)) {
item.check = true
}
})
}) })
}, },
backPage() { backPage() {
...@@ -751,19 +733,19 @@ export default { ...@@ -751,19 +733,19 @@ export default {
this.model.inspectionItemList.push(item.value) this.model.inspectionItemList.push(item.value)
} }
console.log('李斯特', this.model.inspectionItemList) console.log('李斯特', this.model.inspectionItemList)
},
handleTestScenario(item) {
if (this.model.testScenarioList.includes(item.value)) {
this.model.testScenarioList.splice(
this.model.testScenarioList.indexOf(item.label),
1
)
item.check = false
} else {
item.check = true
this.model.testScenarioList.push(item.value)
}
} }
// handleTestScenario(item) {
// if (this.model.testScenarioList.includes(item.value)) {
// this.model.testScenarioList.splice(
// this.model.testScenarioList.indexOf(item.label),
// 1
// )
// item.check = false
// } else {
// item.check = true
// this.model.testScenarioList.push(item.value)
// }
// }
} }
} }
</script> </script>
......
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