Commit 03ddbe34 authored by jingnan's avatar jingnan 👀

Merge branch 'dev' of http://94.191.100.41/tfmom/tf-mom-web into dev

parents daa6b458 3eac2332
......@@ -3,7 +3,7 @@
<dee-up-table
table-height="auto"
selection-row
:data="filtetData"
:data="filterData"
:columns="columns"
@selection-change="handleSelectionChange"
>
......@@ -34,7 +34,12 @@ export default {
icon: '/icons/c-add.png',
handler: {
click: () => {
if (this.filterData.filter(item => !item.extProcessSkillUserId).length === 0) {
this.handleAdd(false)
this.changeOpertotList()
} else {
this.$utils.showMessageError('请选择操作者并保存')
}
}
}
},
......@@ -93,7 +98,7 @@ export default {
return (<span>{data.extProcessSkillUser.dxUserInfo.name}</span>)
} else {
return (
<el-select v-model={data.extProcessSkillUser} size='small' valueKey='id'
<el-select v-model={data.extProcessSkillUser} size='small' valueKey='id' filterable
on-change={() => {}}>
{
that.opertorList.map(x => <el-option disabled={x.disabled} label={x.dxUserInfo.name} value={x}/>)
......@@ -114,9 +119,7 @@ export default {
}
} else {
return (<el-select v-model={data.isMasterOperator} size='small'
on-change={(val) => {
that.changeMasterOperator(index, val)
}}>
on-change={() => {}}>
{
that.isMasterList.map(x => <el-option label={x.label} value={x.value}/>)
}
......@@ -129,15 +132,19 @@ export default {
}
},
computed: {
filtetData() {
filterData() {
return this.tableData.filter(el => (el.operator !== 'REMOVE')) || []
}
},
watch: {
'basicData.prodTask': {
'basicData.id': {
handler: function(val, oval) {
if (!val) return
if (val.length) this.tableData = [...this.basicData.prodTask]
if (val) {
if (this.basicData.prodTask && this.basicData.prodTask.length > 0) {
this.tableData = [...this.basicData.prodTask.filter(item => item.subTypeName === 'FitOut')]
}
}
this.getOpertorList()
},
deep: true,
......@@ -149,6 +156,21 @@ export default {
mounted() {
},
methods: {
// 操作者下拉框修改,已选的人不能再选
changeOpertotList() {
const arr = []
this.filterData.forEach(element => {
arr.push(element.extProcessSkillUserId)
})
this.opertorList.forEach(item => {
if (arr.includes(item.id)) {
item.disabled = true
} else {
item.disabled = false
}
})
},
// 获取操作者下拉框数据
getOpertorList() {
const params = {
'pageFrom': 1,
......@@ -214,7 +236,8 @@ export default {
})
}
})
this.form.prodTask = [...this.tableData]
this.basicData.prodTask = [...this.tableData]
this.changeOpertotList()
}
)
} else {
......@@ -224,22 +247,40 @@ export default {
save(row, index) {
row.extProcessSkillUserId = row.extProcessSkillUser.id
if (!row.extProcessSkillUserId) return this.$utils.showMessageError('请选择操作者')
this.tableData[index] = row
this.$set(this.tableData[index], 'isEdit', false)
this.$set(this.tableData[index], 'show', false)
this.form.prodTask = [...this.tableData]
row.isEdit = false
row.show = false
this.tableData.forEach((item, i) => {
if (item.operator !== 'REMOVE') {
if (item.operator === 'ADD') {
if (row.onlyID === item.onlyID) {
this.$set(this.tableData, i, row)
}
} else {
if (row.extProcessSkillUserId === item.extProcessSkillUserId) {
this.$set(this.tableData, i, row)
}
}
}
})
if (!(row.operator === 'ADD' && !row.isMasterOperator)) {
this.changeMasterOperator(index, row)
}
this.basicData.prodTask = [...this.tableData]
},
// 修改主操作手,只能有一个主操作手
changeMasterOperator(index, val) {
this.tableData.forEach(item => {
this.filterData.forEach(item => {
if (!item.onlyID) {
item.operator = 'MODIFY'
}
item.isMasterOperator = false
})
this.tableData[index].isMasterOperator = true
this.form.prodTask = [...this.tableData]
this.filterData[index].isMasterOperator = true
},
handleAdd() {
const newObj = {
isEdit: true,
show: true,
isEdit: true, // 是否编辑
show: true, // 是否新增
extProcessSkillUser: {},
extProcessSkillUserId: '',
extProcessSkillUserIdType: 'ExtProcessSkillUser',
......
<template>
<div class="ReassignWorkersCheck">
<dee-up-table
table-height="auto"
selection-row
:data="filterData"
:columns="columns"
@selection-change="handleSelectionChange"
>
<dee-tools slot="header" :tools="tools" mode="normal" />
</dee-up-table>
</div>
</template>
<script>
export default {
name: 'ReassignWorkersCheck',
componentName: '检验执行重新派工',
props: {
form: {
type: Object,
default: () => {}
},
basicData: {
type: Object,
default: () => {}
}
},
data() {
const that = this
return {
tools: [{
name: '新增',
icon: '/icons/c-add.png',
handler: {
click: () => {
if (this.filterData.filter(item => !item.extProcessSkillUserId).length === 0) {
this.handleAdd(false)
this.changeOpertotList()
} else {
this.$utils.showMessageError('请选择检验员并保存')
}
}
}
},
{
name: '删除',
icon: '/icons/c-creatbackups.png',
handler: {
click: () => {
this.handleDetele()
}
}
}],
isMasterList: [{
label: '是',
value: true
}, {
label: '否',
value: false
}],
opertorList: [],
selectedRow: [],
tableData: [],
columns: [
{ title: '操作', key: 'operate', align: 'center', hideTip: true, component: {
show: true,
name: 'EditTableRow',
props: {
btns: [
{
operation: '保存',
handleClick: (row, index) => {
this.save(row, index)
},
icon: '/icons/b-save.png',
showFun: (row) => {
return row.show
}
}
]
}
}, width: 100 },
{
title: '检验员', key: 'extProcessSkillUserId', align: 'center', component: {
render: function(h, data, column, index) {
if (!data.show) {
return (<span>{data.extProcessSkillUser.dxUserInfo.name}</span>)
} else {
return (
<el-select v-model={data.extProcessSkillUser} size='small' valueKey='id' filterable
on-change={() => {}}>
{
that.opertorList.map(x => <el-option disabled={x.disabled} label={x.dxUserInfo.name} value={x}/>)
}
</el-select>)
}
}
}
}
]
}
},
computed: {
filterData() {
return this.tableData.filter(el => (el.operator !== 'REMOVE')) || []
}
},
watch: {
'basicData.id': {
handler: function(val, oval) {
if (!val) return
if (val) {
if (this.basicData.prodTask && this.basicData.prodTask.length > 0) {
this.tableData = [...this.basicData.prodTask.filter(item => item.subTypeName === 'CheckOut')]
}
}
this.getOpertorList()
},
deep: true,
immediate: true
}
},
created() {
},
mounted() {
},
methods: {
// 操作者下拉框修改,已选的人不能再选
changeOpertotList() {
const arr = []
this.filterData.forEach(element => {
arr.push(element.extProcessSkillUserId)
})
this.opertorList.forEach(item => {
if (arr.includes(item.id)) {
item.disabled = true
} else {
item.disabled = false
}
})
},
getOpertorList() {
const params = {
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'children': [{
'items': [{
'fieldName': 'extProcessSkillId',
'operator': 'EQ',
'value': this.basicData.extProcessSkillId
}],
'operator': 'AND'
}],
'items': [],
'operator': 'AND'
},
'openProps': [{
'name': 'extProcessSkill'
}],
'sortItem': [{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}],
'toValidateKeys': ''
}
this.$api.searchApi('ExtProcessSkillUser', params).then(res => {
if (res.items.content.length) {
const arr = []
this.basicData.prodTask.forEach(element => {
arr.push(element.extProcessSkillUserId)
})
res.items.content.forEach(item => {
if (arr.includes(item.id)) {
item.disabled = true
} else {
item.disabled = false
}
})
this.opertorList = res.items.content
}
})
},
handleSelectionChange(val) {
this.selectedRow = val
},
handleDetele() {
if (this.selectedRow.length) {
this.$utils.showConfirm(
'你是否确定删除选中的数据吗?',
'提示',
'warning',
'确定',
'取消',
() => {
this.selectedRow.forEach(item => {
if (item.onlyID) {
this.tableData = this.tableData.filter(el => (el.onlyID !== item.onlyID)) || []
} else {
this.tableData.forEach(ele => {
if (ele.id === item.id) {
ele.operator = 'REMOVE'
}
})
}
})
this.basicData.prodTask = [...this.tableData]
this.changeOpertotList()
}
)
} else {
this.$utils.showMessageError('请先选择需要删除的数据')
}
},
save(row, index) {
row.extProcessSkillUserId = row.extProcessSkillUser.id
if (!row.extProcessSkillUserId) return this.$utils.showMessageError('请选择检验员')
row.isEdit = false
row.show = false
this.tableData.forEach((item, i) => {
if (item.operator !== 'REMOVE') {
if (item.operator === 'ADD') {
if (row.onlyID === item.onlyID) {
this.$set(this.tableData, i, row)
}
} else {
if (row.extProcessSkillUserId === item.extProcessSkillUserId) {
this.$set(this.tableData, i, row)
}
}
}
})
this.basicData.prodTask = [...this.tableData]
},
// 修改主操作手,只能有一个主操作手
handleAdd() {
const newObj = {
show: true,
extProcessSkillUser: {},
extProcessSkillUserId: '',
extProcessSkillUserIdType: 'ExtProcessSkillUser',
extProcessSkillId: this.basicData.extProcessSkillId,
extProcessSkillIdType: 'ExtProcessSkill',
joExecutePlanId: this.basicData.id,
joExecutePlanIdType: 'JoExecutePlan',
isMasterOperator: false,
operator: 'ADD',
onlyID: new Date().getTime().toString(),
subTypeName: 'CheckOut',
taskState: 'N',
isConfirm: 'N'
}
this.tableData.push(newObj)
}
}
}
</script>
<style lang="scss">
</style>
......@@ -26,7 +26,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col v-if="activeName === '0'" :span="8">
<el-form-item label="班组:">
<el-select v-model="searchFormData.group" placeholder="班组" @change="changeGroup">
<el-option
......@@ -72,9 +72,9 @@
</div>
</dee-tab>
</template>
<template slot="paneR">
<template v-if="activeName === '0'" slot="paneR">
<div class="sub-title" style="margin:0 10px">
执行派工
检验派工
</div>
<div class="group-list">
<div v-for="(item, index) in groupUserList" :key="index" class="group-list-box" :class="{'active': item.isSelect}" @click="changeGroupUser(item)">
......@@ -130,7 +130,7 @@ export default {
postionList: [],
groupList: [],
groupUserList: [],
activeName: 0,
activeName: '0',
defaultPercent: 78,
indexRow: {
title: '序号',
......@@ -292,7 +292,9 @@ export default {
changePostion() {
const postion = this.postionList.find(r => r.id === this.searchFormData.postion)
this.$set(this.searchFormData, 'postionName', postion && postion.extcode || '')
if (this.activeName === '0') {
this.getGroup()
}
this.getTableData()
},
getGroup() {
......
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