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

feat(任务): 检验小组

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