Commit 8afa1cb8 authored by 高滢's avatar 高滢

feat(任务): 检验小组

parent cc9d76c1
...@@ -280,7 +280,7 @@ export function getUseCaseListByScenario(data) { ...@@ -280,7 +280,7 @@ export function getUseCaseListByScenario(data) {
} }
export function getInspection() { export function getInspection() {
return request({ return request({
url: '/system/user/getInspection', url: '/system/user/getInspectionNew',
method: 'post' method: 'post'
}) })
} }
......
...@@ -203,12 +203,8 @@ ...@@ -203,12 +203,8 @@
<el-table-column label="姓名" align="left" prop="nickName"> <el-table-column label="姓名" align="left" prop="nickName">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<span v-if="row.userId !== ''"> <span v-if="row.userId !== ''">
<span v-show="row.status.toString() === '1'" <span v-show="row.status == '1'">{{ row.name }}(已停用)</span>
>{{ row.name }}(已停用)</span <span v-show="row.status == '0'">{{ row.name }}</span>
>
<span v-show="row.status.toString() === '0'">{{
row.name
}}</span>
</span> </span>
<el-select <el-select
v-else v-else
...@@ -219,7 +215,7 @@ ...@@ -219,7 +215,7 @@
<el-option <el-option
v-for="(item, index) in userList" v-for="(item, index) in userList"
:key="index" :key="index"
:label="item.nickName" :label="item.nickname"
:value="item.userId" :value="item.userId"
:disabled="item.disabled" :disabled="item.disabled"
> >
...@@ -238,25 +234,24 @@ ...@@ -238,25 +234,24 @@
<el-table-column label="所属部门" align="left" prop="dept"> <el-table-column label="所属部门" align="left" prop="dept">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<span v-if="row.userId === ''">-</span> <span v-if="row.userId === ''">-</span>
<span v-else-if="row.dept === null"> - </span> <span v-else>{{ row.deptName ? row.deptName : '-' }}</span>
<span v-else>{{ row.dept.deptName || '-' }}</span>
</template>
</el-table-column>
<el-table-column
prop="orderIndex"
label="排序"
width="160"
align="center"
>
<template slot-scope="scope">
<div v-if="scope.row.userId !== ''" class="sortable-handle">
<icon-park type="sort-three" size="14" fill="#F9A221" />
</div>
<div v-else>
<span>-</span>
</div>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column-->
<!-- prop="orderIndex"-->
<!-- label="排序"-->
<!-- width="160"-->
<!-- align="center"-->
<!-- >-->
<!-- <template slot-scope="scope">-->
<!-- <div v-if="scope.row.userId !== ''" class="sortable-handle">-->
<!-- <icon-park type="sort-three" size="14" fill="#F9A221" />-->
<!-- </div>-->
<!-- <div v-else>-->
<!-- <span>-</span>-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column <el-table-column
width="160" width="160"
label="操作" label="操作"
...@@ -353,7 +348,6 @@ import Sortable from 'sortablejs' ...@@ -353,7 +348,6 @@ import Sortable from 'sortablejs'
import CarInfo from '../new/components/CarInfo' import CarInfo from '../new/components/CarInfo'
import PartInfo from '../new/components/PartInfo' import PartInfo from '../new/components/PartInfo'
import { selectSamplePage } from '@/api/system/sample' import { selectSamplePage } from '@/api/system/sample'
import { getUserByRole } from '@/api/system/user'
import { componentSelect } from '@/api/system/sample' import { componentSelect } from '@/api/system/sample'
import { import {
createTask, createTask,
...@@ -364,10 +358,8 @@ import { ...@@ -364,10 +358,8 @@ import {
updateTask updateTask
} from '@/api/task/task' } from '@/api/task/task'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { getDicts } from '@/api/system/dict/data'
import DocumentInfo from '@/views/task/new/components/DocumentInfo.vue'
import { getByStandardId } from '@/api/task/new' import { getByStandardId } from '@/api/task/new'
import { number } from 'echarts' import { getInspection } from '../../../api/task/task'
export default { export default {
dicts: [ dicts: [
'sys_task_status', 'sys_task_status',
...@@ -676,10 +668,10 @@ export default { ...@@ -676,10 +668,10 @@ export default {
this.getUserByRole() this.getUserByRole()
// 查询样品信息(整车、零件) // 查询样品信息(整车、零件)
// this.getSampleInformation() // this.getSampleInformation()
this.$nextTick(() => { // this.$nextTick(() => {
this.leaderTop() // this.leaderTop()
this.rowDrop() // this.rowDrop()
}) // })
this.getComponentSelect() this.getComponentSelect()
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
}, },
...@@ -794,6 +786,7 @@ export default { ...@@ -794,6 +786,7 @@ export default {
} }
// 文件 // 文件
this.passDocumentInfoArr = this.taskDetail.fileList this.passDocumentInfoArr = this.taskDetail.fileList
this.leaderTop()
}) })
}, },
selectAll() { selectAll() {
...@@ -892,7 +885,7 @@ export default { ...@@ -892,7 +885,7 @@ export default {
}) })
}, },
getUserByRole() { getUserByRole() {
getUserByRole({ roleName: '检验员' }).then(response => { getInspection().then(response => {
this.userList = response.data this.userList = response.data
.filter(obj => obj.status.toString() !== '1') .filter(obj => obj.status.toString() !== '1')
.map(obj => { .map(obj => {
...@@ -911,44 +904,15 @@ export default { ...@@ -911,44 +904,15 @@ export default {
this.currentPartSampleInformation = cards this.currentPartSampleInformation = cards
console.log('PartInfo组件传值', cards) console.log('PartInfo组件传值', cards)
}, },
// getSampleInformation() {
// // 查询整车样品信息
// selectSamplePage({ pageNum: 1, pageSize: 999, flag: 0 }).then(
// response => {
// this.vehicleSampleInformationList = response.rows
// console.log(
// 'vehicleSampleInformationList',
// this.vehicleSampleInformationList
// )
// }
// )
// // 查询零件样品信息
// selectSamplePage({ pageNum: 1, pageSize: 999, flag: 1 }).then(
// response => {
// this.partSampleInformationList = response.rows
// console.log(
// 'partSampleInformationList',
// this.partSampleInformationList
// )
// }
// )
// },
/** 主检角色置顶逻辑 */ /** 主检角色置顶逻辑 */
leaderTop() { leaderTop() {
if (this.tableData.length !== 0) { if (this.tableData.length !== 0) {
this.tableData.findIndex((item, index) => {
// 循环遍历数组是否有主检
if (item.isLeader === 1) {
let obj = {} let obj = {}
this.tableData.length &&
this.tableData.forEach((item, index) => { this.tableData.forEach((item, index) => {
// 在数组中循环遍历找到主检并置顶 // 在数组中循环遍历找到主检并置顶
if (item.isLeader === 1) { if (item.isLeader === 1) {
obj = item obj = item
this.tableData.splice(index, 1) this.tableData.splice(index, 1)
return
}
})
this.tableData.unshift(obj) this.tableData.unshift(obj)
} }
}) })
...@@ -1043,50 +1007,45 @@ export default { ...@@ -1043,50 +1007,45 @@ export default {
closeOnClickModal: false, closeOnClickModal: false,
confirmButtonClass: 'queryBtn' confirmButtonClass: 'queryBtn'
}).then(() => { }).then(() => {
console.log(this.userList, row)
// 把当前人取消禁用 // 把当前人取消禁用
if (row.status === '0') { // if (row.status === '0') {
this.userList.find( this.userList.find(
item => item.userId.toString() === row.userId.toString() // eslint-disable-next-line eqeqeq
item => item.userId == row.userId
).disabled = false ).disabled = false
this.tableData = this.tableData.filter( this.tableData = this.tableData.filter(
item => item.userId !== row.userId item => item.userId !== row.userId
) )
this.tableData = this.tableData.map((item, index) => {
if (index === 0) {
return { ...item, isLeader: 1 }
} else {
return { ...item, isLeader: 0 }
}
})
} else {
this.tableData = this.tableData.filter(
item => item.userId !== row.userId
)
}
}) })
}, },
handleNameChange(value) { handleNameChange(value) {
console.log('value', value) console.log('value', value)
this.userId = value this.userId = value
const selectData = this.userList.find(item => item.userId === value) // eslint-disable-next-line eqeqeq
const selectData = this.userList.find(item => item.userId == value)
this.tableData.forEach(data => { this.tableData.forEach(data => {
if (data.userId === '') { if (data.userId === '') {
data.nickName = selectData.nickName console.log('selectData', selectData)
data.name = selectData.nickName data.nickName = selectData.nickname
data.name = selectData.nickname
data.userId = selectData.userId data.userId = selectData.userId
data.dept = selectData.dept data.dept = selectData.deptName
data.deptName = selectData.deptName
data.status = '0' data.status = '0'
if (selectData.roleId.includes(112)) {
data.isLeader = 1
} else {
data.isLeader = 0
}
} }
}) })
// 已被选择的人做禁用 // 已被选择的人做禁用
this.userList.find(item => item.userId === this.userId).disabled = true // eslint-disable-next-line eqeqeq
this.userList.find(item => item.userId == this.userId).disabled = true
this.userId = '' this.userId = ''
this.leaderTop() // this.leaderTop()
if (this.tableData.length === 1) { console.log(this.tableData)
this.tableData[0].isLeader = 1
} else {
this.tableData[this.tableData.length - 1].isLeader = 0
}
}, },
/** /**
* 保存人员 * 保存人员
...@@ -1121,6 +1080,7 @@ export default { ...@@ -1121,6 +1080,7 @@ export default {
num++ num++
} }
}) })
console.log('lastObj', lastObj)
if (lastObj.userId === '' || num === 1) { if (lastObj.userId === '' || num === 1) {
this.$message.error('请填写完此成员信息') this.$message.error('请填写完此成员信息')
return return
...@@ -1147,14 +1107,6 @@ export default { ...@@ -1147,14 +1107,6 @@ export default {
this.$message.error('请保存小组成员信息') this.$message.error('请保存小组成员信息')
return return
} }
// else if (this.currentVehicleSampleInformation.length === 0) {
// this.$message.error('请填写整车样品信息')
// return
// }
// else if (this.currentPartSampleInformation.length === 0) {
// this.$message.error('请填写零部件样品信息')
// return
// }
this.$confirm('是否确认进行发布功能', '发布', { this.$confirm('是否确认进行发布功能', '发布', {
confirmButtonText: '确定', confirmButtonText: '确定',
concelButtonText: '取消', concelButtonText: '取消',
......
...@@ -212,17 +212,17 @@ ...@@ -212,17 +212,17 @@
} }
" "
> >
<template v-if="$index == 0"> <!-- <template v-if="$index == 0">-->
<el-option <!-- <el-option-->
v-for="(item, index) in mainUserList" <!-- v-for="(item, index) in mainUserList"-->
:key="index" <!-- :key="index"-->
:label="item.nickName" <!-- :label="item.nickName"-->
:value="item.userId" <!-- :value="item.userId"-->
:disabled="item.disabled" <!-- :disabled="item.disabled"-->
> <!-- >-->
</el-option> <!-- </el-option>-->
</template> <!-- </template>-->
<template v-else> <!-- <template v-else>-->
<el-option <el-option
v-for="(item, index) in userList" v-for="(item, index) in userList"
:key="index" :key="index"
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
:disabled="item.disabled" :disabled="item.disabled"
> >
</el-option> </el-option>
</template> <!-- </template>-->
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
...@@ -247,13 +247,7 @@ ...@@ -247,13 +247,7 @@
<template slot-scope="{ row, $index }"> <template slot-scope="{ row, $index }">
<span v-if="row.userId === ''">-</span> <span v-if="row.userId === ''">-</span>
<span v-else-if="row.dept === null"> - </span> <span v-else-if="row.dept === null"> - </span>
<span v-else-if="$index === 0">{{ <span v-else>{{ row.deptName ? row.deptName : '-' }}</span>
row.dept.deptName || row.dept || '-'
}}</span>
<span v-else-if="$index >= 1">
{{ row.dept.deptName || row.dept || '-' }}</span
>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column <!-- <el-table-column
...@@ -374,7 +368,6 @@ import Sortable from 'sortablejs' ...@@ -374,7 +368,6 @@ import Sortable from 'sortablejs'
import CarInfo from './components/CarInfo' import CarInfo from './components/CarInfo'
import PartInfo from './components/PartInfo' import PartInfo from './components/PartInfo'
import { selectSamplePage } from '@/api/system/sample' import { selectSamplePage } from '@/api/system/sample'
import { getUserByRole } from '@/api/system/user'
import { componentSelect } from '@/api/system/sample' import { componentSelect } from '@/api/system/sample'
import { import {
createTask, createTask,
...@@ -386,8 +379,6 @@ import { ...@@ -386,8 +379,6 @@ import {
getInspection getInspection
} from '@/api/task/task' } from '@/api/task/task'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { getDicts } from '@/api/system/dict/data'
import DocumentInfo from '@/views/task/new/components/DocumentInfo.vue'
import { getByStandardId } from '@/api/task/new' import { getByStandardId } from '@/api/task/new'
export default { export default {
dicts: [ dicts: [
...@@ -713,23 +704,13 @@ export default { ...@@ -713,23 +704,13 @@ export default {
// } // }
// }, // },
}, },
async created() { created() {
// this.$store.dispatch('testScenario/setTestScenarioList')
// 对字典:inspection_item, 做处理
this.getUserByRole() this.getUserByRole()
// this.initWebSocket()
// 查询样品信息(整车、零件)
// await this.getTaskType(1)
// this.getSampleInformation()
this.getTemporaryStorage() this.getTemporaryStorage()
this.$nextTick(() => {
this.leaderTop()
this.rowDrop()
this.taskId = this.$route.query.taskId this.taskId = this.$route.query.taskId
if (this.taskId !== undefined) { if (this.taskId !== undefined) {
this.getTaskDetail(this.taskId) this.getTaskDetail(this.taskId)
} }
})
this.getComponentSelect() this.getComponentSelect()
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
}, },
...@@ -883,21 +864,19 @@ export default { ...@@ -883,21 +864,19 @@ export default {
}) })
}, },
getUserByRole() { getUserByRole() {
getUserByRole({ roleName: '主检' }).then(response => { getInspection().then(response => {
this.mainUserList = response.data this.userList = response.data
.filter(obj => obj.status.toString() !== '1') .filter(obj => obj.status.toString() !== '1')
.map(obj => { .map(obj => {
return { ...obj, disabled: false } return { ...obj, disabled: false }
}) })
})
getInspection().then(response => { this.mainUserList = response.data
this.userList = response.data
.filter(obj => obj.status.toString() !== '1') .filter(obj => obj.status.toString() !== '1')
.map(obj => { .map(obj => {
return { ...obj, disabled: false } return { ...obj, disabled: false }
}) })
console.log(this.userList) console.log('this.userList', this.userList)
}) })
}, },
handleCarsChange(cards) { handleCarsChange(cards) {
...@@ -950,19 +929,12 @@ export default { ...@@ -950,19 +929,12 @@ export default {
/** 主检角色置顶逻辑 */ /** 主检角色置顶逻辑 */
leaderTop() { leaderTop() {
if (this.tableData.length !== 0) { if (this.tableData.length !== 0) {
this.tableData.findIndex((item, index) => {
// 循环遍历数组是否有主检
if (item.isLeader === 1) {
let obj = {} let obj = {}
this.tableData.length &&
this.tableData.forEach((item, index) => { this.tableData.forEach((item, index) => {
// 在数组中循环遍历找到主检并置顶 // 在数组中循环遍历找到主检并置顶
if (item.isLeader === 1) { if (item.isLeader === 1) {
obj = item obj = item
this.tableData.splice(index, 1) this.tableData.splice(index, 1)
return
}
})
this.tableData.unshift(obj) this.tableData.unshift(obj)
} }
}) })
...@@ -1073,68 +1045,35 @@ export default { ...@@ -1073,68 +1045,35 @@ export default {
// item => item.userId !== row.userId // item => item.userId !== row.userId
// ) // )
this.tableData.splice(index, 1) this.tableData.splice(index, 1)
this.tableData = this.tableData.map((item, index) => { // this.tableData = this.tableData.map((item, index) => {
if (index === 0) { // if (index === 0) {
return { ...item, isLeader: 1 } // return { ...item, isLeader: 1 }
} else { // } else {
return { ...item, isLeader: 0 } // return { ...item, isLeader: 0 }
} // }
}) // })
} else { } else {
// this.tableData = this.tableData.filter(
// item => item.userId !== row.userId
// )
this.tableData.splice(index, 1) this.tableData.splice(index, 1)
} }
}) })
}, },
handleNameChange(value, index) { handleNameChange(value, index) {
this.userId = value this.userId = value
let selectData = [] const selectData = this.userList.find(item => item.userId === value)
if (index === 0) {
selectData = this.mainUserList.find(item => item.userId === value)
} else {
selectData = this.userList.find(item => item.userId === value)
}
// this.tableData.forEach((data, index) => {
// if (data.userId === '') {
// data.nickName = selectData.nickName
// data.name = selectData.nickName
// data.userId = selectData.userId
// data.dept = selectData.dept
// data.status = '0'
// }
// })
if (index === 0) {
this.tableData[index].nickName = selectData.nickName
this.tableData[index].name = selectData.nickName
this.tableData[index].userId = selectData.userId
this.tableData[index].dept = selectData.dept
this.tableData[index].status = '0'
} else {
this.tableData[index].nickName = selectData.nickname this.tableData[index].nickName = selectData.nickname
this.tableData[index].name = selectData.nickname this.tableData[index].name = selectData.nickname
this.tableData[index].userId = selectData.userId this.tableData[index].userId = selectData.userId
this.tableData[index].dept = selectData.deptName this.tableData[index].dept = selectData.deptName
this.tableData[index].deptName = selectData.deptName
this.tableData[index].status = '0' this.tableData[index].status = '0'
} if (selectData.roleId.includes(112)) {
// 已被选择的人做禁用 this.tableData[index].isLeader = 1
if (index === 0) {
this.mainUserList.find(
item => item.userId === this.userId
).disabled = true
} else { } else {
this.userList.find(item => item.userId === this.userId).disabled = true this.tableData[index].isLeader = 0
} }
// eslint-disable-next-line eqeqeq
this.userList.find(item => item.userId == this.userId).disabled = true
this.userId = '' this.userId = ''
this.leaderTop()
if (this.tableData.length === 1) {
this.tableData[0].isLeader = 1
} else {
this.tableData[this.tableData.length - 1].isLeader = 0
}
}, },
/** /**
* 保存人员 * 保存人员
...@@ -1194,8 +1133,8 @@ export default { ...@@ -1194,8 +1133,8 @@ export default {
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
console.log( console.log(
this.model.inspectionItemList.find( this.model.inspectionItemList.find(
item => item == 'grfis' || item == 'trfis' item => item === 'grfis' || item === 'trfis'
) != undefined ) !== undefined
) )
console.log(this.currentVehicleSampleInformation) console.log(this.currentVehicleSampleInformation)
if (valid) { if (valid) {
...@@ -1211,12 +1150,12 @@ export default { ...@@ -1211,12 +1150,12 @@ export default {
return return
} else if ( } else if (
this.model.inspectionItemList.find( this.model.inspectionItemList.find(
item => item == 'grfis' || item == 'trfis' item => item === 'grfis' || item === 'trfis'
) != undefined && ) !== undefined &&
(this.currentVehicleSampleInformation.length == 0 || (this.currentVehicleSampleInformation.length === 0 ||
this.currentVehicleSampleInformation.find( this.currentVehicleSampleInformation.find(
item => item.sampleId == '' item => item.sampleId === ''
) != undefined) ) !== undefined)
) { ) {
this.$message.error('请填写整车样品信息') this.$message.error('请填写整车样品信息')
return return
......
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