Commit 2226922b authored by 沈翠玲's avatar 沈翠玲

报工人员多选

parent 8c6f39cb
...@@ -145,10 +145,12 @@ const install = (Vue, vm) => { ...@@ -145,10 +145,12 @@ const install = (Vue, vm) => {
getIpqcCode: (params = {}) => getIpqcCode: (params = {}) =>
vm.$u.get(config.adminPath + '/system/autocode/get/IPQC_CODE', params), vm.$u.get(config.adminPath + '/system/autocode/get/IPQC_CODE', params),
//查看人员管理精确查询
getMdWorkunitWorkerByUserName: (params = {}) =>
vm.$u.get(config.adminPath + '/mes/md/workunitWorker/getMdWorkunitWorkerByUserName', params),
//查看人员管理 //查看人员管理
userQuery: (params = {}) => userQuery: (params = {}) =>
vm.$u.get(config.adminPath + '/mes/md/workunitWorker/getMdWorkunitWorkerByUserName', params), vm.$u.get(config.adminPath + '/mes/md/workunitWorker/list', params),
//增加缺陷记录 //增加缺陷记录
addDefectrecord: (params = {}) => addDefectrecord: (params = {}) =>
vm.$u.putJson(config.adminPath + '/mes/qc/defectrecord', params), vm.$u.putJson(config.adminPath + '/mes/qc/defectrecord', params),
......
...@@ -3,13 +3,20 @@ ...@@ -3,13 +3,20 @@
<view class="search"> <view class="search">
<u-form :model="tableParams" labelAlign="right" class="tableForm"> <u-form :model="tableParams" labelAlign="right" class="tableForm">
<u-form-item :label="$t('工号')" label-width="60px" name="userName"> <u-form-item :label="$t('工号')" label-width="60px" name="userName">
<u-input type="text" v-model="tableParams.userName" :placeholder="$t('请扫描/输入工号')" @confirm="confirmUserName($event)"/> <uni-easyinput type="text" v-model="tableParams.userName" :placeholder="$t('请输入编号')" />
</u-form-item>
<u-form-item :label="$t('姓名')" label-width="60px" name="nickName">
<uni-easyinput type="text" v-model="tableParams.nickName" :placeholder="$t('请输入名称')" />
</u-form-item>
<u-form-item>
<u-button class="btn" @click="handleClick" type="primary" size="medium">{{$t('搜索')}}</u-button>
</u-form-item> </u-form-item>
</u-form> </u-form>
</view> </view>
<view> <view>
<zb-table ref="zbTable" rowKey="userName" :columns="tableColumn" :data="tableData" :stripe="true" @toggleRowSelection="toggleRowSelection"></zb-table> <zb-table ref="zbTable" rowKey="userName" :columns="tableColumn" :data="tableData" :stripe="true" @toggleRowSelection="toggleRowSelection"></zb-table>
</view> </view>
<view class="uni-pagination-box"><uni-pagination show-icon :page-size="params.pageSize" :current="params.pageNum" :total="total" @change="change" /></view>
</view> </view>
</template> </template>
...@@ -26,6 +33,8 @@ export default { ...@@ -26,6 +33,8 @@ export default {
data() { data() {
return { return {
params: { params: {
pageNum: 1,
pageSize: 10,
workunitId: this.data?.workunitId || null workunitId: this.data?.workunitId || null
}, },
total: 0, total: 0,
...@@ -36,6 +45,10 @@ export default { ...@@ -36,6 +45,10 @@ export default {
tableData: [], tableData: [],
tableSelectData: [], tableSelectData: [],
tableColumn: [ tableColumn: [
{
type: 'selection',
width: 40
},
{ {
name: 'userName', name: 'userName',
label: i18n.t('工号'), label: i18n.t('工号'),
...@@ -61,15 +74,10 @@ export default { ...@@ -61,15 +74,10 @@ export default {
// } // }
// }, // },
mounted() { mounted() {
// this.getList(); this.getList();
// this.data.workstationName // this.data.workstationName
}, },
methods: { methods: {
confirmUserName(e) {
this.tableParams.userName = e
if (!this.tableParams.userName) return this.$u.toast(i18n.t('请输入报工人工号'))
this.handleClick()
},
handleClick() { handleClick() {
if (this.tableParams.userName) { if (this.tableParams.userName) {
this.params.userName = this.tableParams.userName; this.params.userName = this.tableParams.userName;
...@@ -81,16 +89,27 @@ export default { ...@@ -81,16 +89,27 @@ export default {
} else { } else {
delete this.params.nickName delete this.params.nickName
} }
this.params.pageNum = 1;
this.getList(); this.getList();
}, },
async getList() { async getList() {
const res = await this.$u.api.userQuery(this.params); const res = await this.$u.api.userQuery(this.params);
if (res.code == 200 && res.data) { console.log(res, 'res');
this.tableData.push(res.data) if (res.code == 200) {
} else { this.tableData = res.rows.map((item) => {
this.$u.toast(i18n.t('查不到报工人数据')) return {
...item,
workunitName: this.data?.workunitName || null
};
});
this.total = res.total;
} }
}, },
// 分页触发
change(e) {
this.params.pageNum = e.current;
this.getList();
},
toggleRowSelection(checked, arr) { toggleRowSelection(checked, arr) {
this.tableSelectData = arr; this.tableSelectData = arr;
......
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
</u-form-item> </u-form-item>
</u-col> </u-col>
<u-col span="6"> <u-col span="6">
<u-form-item :label="$t('工序:')" prop="nickName"> <u-form-item :label="$t('工序:')" prop="processName">
{{ feedback.processName }} {{ feedback.processName }}
</u-form-item> </u-form-item>
</u-col> </u-col>
...@@ -327,13 +327,16 @@ ...@@ -327,13 +327,16 @@
</u-form-item> </u-form-item>
</u-col> </u-col>
<u-col :span="6"> <u-col :span="6">
<u-form-item :label="$t('报工人:')" prop="nickName"> <u-form-item :label="$t('报工人:')" prop="chooseName">
<u-input v-model="feedback.nickName" disabled></u-input> <view>
<u-tag :text="item.nickName" class="mytag" bg-color="#2972f4" color="#fff" closeable @close="tagClick" v-for="(item, index) in userList" :key="index" />
</view>
<u-input v-model="feedback.chooseName" :focus="isFocusUser" @confirm="onUserConfirm($event)"></u-input>
<u-button <u-button
@tap="getCode(feedback)" @tap="getCode(feedback)"
type="success" type="success"
size="mini" size="mini"
>{{ $t('报工人员扫码') }}</u-button >{{ $t('选择人员') }}</u-button
> >
</u-form-item> </u-form-item>
</u-col> </u-col>
...@@ -1148,6 +1151,7 @@ export default { ...@@ -1148,6 +1151,7 @@ export default {
materialReturnVisible: false, materialReturnVisible: false,
materialReturn: false, materialReturn: false,
isFocus: false, isFocus: false,
isFocusUser: false,
stockInVisible: false, stockInVisible: false,
material: false, material: false,
feedingInspectionList: [], feedingInspectionList: [],
...@@ -1262,6 +1266,7 @@ export default { ...@@ -1262,6 +1266,7 @@ export default {
timeTest: { timeTest: {
isshow: true, isshow: true,
}, },
userList: []
} }
}, },
// watch() { // watch() {
...@@ -1456,15 +1461,35 @@ export default { ...@@ -1456,15 +1461,35 @@ export default {
}, },
}, },
methods: { methods: {
tagClick(index) {
this.userList.splice(index, 1)
},
async onUserConfirm(item) {
if (this.userList.find(v => v.userName === item) || this.userList.find(v => v.nickName === item)) {
return
}
const res = await this.$u.api.getMdWorkunitWorkerByUserName({
workunitId: this.feedbackForms[0].workunitId,
userName: item
});
if (res.code == 200 && res.data) {
this.userList.push(res.data)
this.feedbackForms[0].chooseName = ''
setTimeout(() => {
this.feedbackForms[0].chooseName = ''
}, 200)
} else {
this.$u.toast(i18n.t('查不到报工人数据'))
}
this.isFocusUser = true
},
cellStyle({ row, column, rowIndex, columnIndex }) { cellStyle({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 1 && !this.isWaiXie) { if (columnIndex === 1 && !this.isWaiXie) {
return { color: '#3578ff !important' } return { color: '#3578ff !important' }
} }
return '' return ''
}, },
handleChangePackNum(feedback, i) {
this.getWorkorderDirectiveList(feedback, i, true)
},
handleSubmitConfirmlKnifeTemp() { handleSubmitConfirmlKnifeTemp() {
this.knifeTempVisible = true this.knifeTempVisible = true
this.$refs.appScan.closed() this.$refs.appScan.closed()
...@@ -1571,15 +1596,6 @@ export default { ...@@ -1571,15 +1596,6 @@ export default {
return i18n.t('打印/报工') return i18n.t('打印/报工')
} }
}, },
sizeclick(feedback, row, i) {
if (row.isEncase) {
this.handleBlPackagePrintInfo(feedback, row, i)
} else if (row.feedbackQuantity) {
this.rePackageInfoPrint(feedback, row, i)
} else {
this.handleSubmitPackageFeedback(feedback, row, i)
}
},
// cellClick(row, index, column) { // cellClick(row, index, column) {
// if (column.name === 'arrangeCode') { // if (column.name === 'arrangeCode') {
// this.tableDataDetail = row.proWorkorderList; // this.tableDataDetail = row.proWorkorderList;
...@@ -1941,23 +1957,15 @@ export default { ...@@ -1941,23 +1957,15 @@ export default {
this.feedbackForms[0].abnormalRemark = tableSelectData[0].remark this.feedbackForms[0].abnormalRemark = tableSelectData[0].remark
}, },
userDetermine() { userDetermine() {
let nick = ''
let user = ''
const tableSelectData = JSON.parse( const tableSelectData = JSON.parse(
JSON.stringify(this.$refs.userPersonnelRef.tableData) JSON.stringify(this.$refs.userPersonnelRef.tableSelectData)
) )
const a = tableSelectData.length - 1 const a = tableSelectData.length - 1
tableSelectData.forEach((item) => { tableSelectData.forEach((item) => {
if (item.nickName === tableSelectData[a].nickName) { if (this.userList.findIndex(v => v.userName === item.userName) < 0) {
nick = nick + item.nickName this.userList.push(item)
user = user + item.userName
} else {
nick = nick + item.nickName + ','
user = user + item.userName + ','
} }
}) })
this.usePersonData.nickName = nick
this.usePersonData.userName = user
}, },
stopReasonSubmit() { stopReasonSubmit() {
this.tableSelectData.forEach((item) => { this.tableSelectData.forEach((item) => {
...@@ -2247,7 +2255,7 @@ export default { ...@@ -2247,7 +2255,7 @@ export default {
// this.reset(); // this.reset();
this.feedbackUnQuantityFu = 0 this.feedbackUnQuantityFu = 0
this.feedbackQuantityFu = 0 this.feedbackQuantityFu = 0
this.userList = []
this.feedbackForms = [] this.feedbackForms = []
let flagPackage = [] let flagPackage = []
this.tableSelectData.forEach((item, index) => { this.tableSelectData.forEach((item, index) => {
...@@ -2287,6 +2295,7 @@ export default { ...@@ -2287,6 +2295,7 @@ export default {
netWeight: 0, netWeight: 0,
minPackageNum: 0, minPackageNum: 0,
workorderList: [], workorderList: [],
chooseName: '',
workorderOption: [], workorderOption: [],
directiveData: {}, directiveData: {},
sizeData: {}, sizeData: {},
...@@ -2402,310 +2411,6 @@ export default { ...@@ -2402,310 +2411,6 @@ export default {
// 如果选择了包装工序、非包装工序提示:“包装工序禁止多选报工” // 如果选择了包装工序、非包装工序提示:“包装工序禁止多选报工”
this.proVisible = true this.proVisible = true
}, },
// 获取指令列表
getWorkorderDirectiveList(rows, index, flag) {
this.getWorkorderDirectiveLoading = true
let row = this.feedbackForms[index]
this.$u.api
.workOrderSoDirectiveApi({
encasementNum: row.encasementNum,
mergePack: row.mergePack || 0,
packNum: row.packNum,
quantity: row.quantity,
taskId: row.taskId,
workorderId: row.workorderId,
})
.then((res) => {
this.getWorkorderDirectiveLoading = false
if (res.code === 200) {
this.copyFeedBackForms = JSON.parse(
JSON.stringify(this.feedbackForms)
)
if (res.data.directiveList) {
row.tableDirectiveData = res.data.directiveList.map((item) => {
return {
...item,
reportQuantity:
(Number(item.packageNum) || 0) -
(Number(item.feedbackQuantity) || 0),
}
})
row.listTabPro = [
{
name: i18n.t('指令列表'),
},
]
row.tableDirectiveData.push({
reportQuantity: 0,
netWeight: 0,
printbtn: true,
})
} else {
row.tableDirectiveData = []
}
if (res.data.orderPackageList) {
row.tableOrderData = res.data.orderPackageList.map((item) => {
return {
...item,
reportQuantity:
(Number(item.packageNum) || 0) -
(Number(item.feedbackQuantity) || 0),
}
})
row.listTabPro = [
{
name: i18n.t('报工列表'),
},
]
row.tableOrderData.push({
reportQuantity: 0,
netWeight: 0,
printbtn: true,
})
} else {
row.tableOrderData = []
}
if (res.data.sizeList) {
const Sizelist = []
res.data.sizeList.forEach((item) => {
let distributes = []
if (item.distributes) {
distributes = item.distributes.map((v) => ({
...v,
standardSizeIdx: ' ',
feedbackQuantity: ' ',
highlight: true,
qrcode: item.qrcode,
}))
}
Sizelist.push(
{
...item,
feedbackQuantity: item.feedbackQuantity,
reportQuantity:
(Number(item.packageNum) || 0) -
(Number(item.feedbackQuantity) || 0),
},
...distributes
)
})
row.tableSizeData = JSON.parse(JSON.stringify(Sizelist))
row.listTabPro = [
{
name: i18n.t('SIZE列表'),
},
]
row.tableSizeColumn[1].label = res.data.sizeColumnName
} else {
row.tableSizeData = []
}
} else {
if (flag) {
// this.$set(this.feedbackForms, index, this.copyFeedBackForms[index])
this.$set(
this.feedbackForms[index],
'packNum',
this.copyFeedBackForms[index].packNum
)
this.$set(
this.feedbackForms[index],
'encasementNum',
this.copyFeedBackForms[index].encasementNum
)
this.$set(
this.feedbackForms[index],
'mergePack',
this.copyFeedBackForms[index].mergePack
)
}
row.tableDirectiveData = []
row.tableSizeData = []
row.tableOrderData = []
row.listTabPro = []
}
})
},
rePackageInfoPrint(item, row, i) {
uni.showModal({
title: i18n.t('系统提示'),
content: i18n.t('是否确认补打?'),
success: (res) => {
if (res.confirm) {
if (!item.printTemplate) {
return this.$u.toast(i18n.t('请选择打印模版'))
}
if (item.printTemplate && !this.vuex_printConnect) {
this.$u.toast(i18n.t('打印机连接失败'))
return
}
item.feedbackTime = this.parseTime(new Date())
this.$u.api
.rePackageInfoPrint({
workorderId: item.workorderId,
qrcode: row.qrcode,
})
.then((res) => {
if (res.code === 200) {
// this.proVisible = false;
// item.quantityUnqualify = 0;
// this.$u.toast('上报成功');
// this.getWorkorderDirectiveList(item, i)
if (item.printTemplate) {
let params = {}
res.data.forEach((datas) => {
params = {
reportName: 'mysql:' + item.printTemplate,
values: {
packagePrint: datas,
},
}
this.printPdfSocket(params)
})
}
this.getTaskList()
}
})
}
},
})
},
handleBlPackagePrintInfo(item, row, i) {
if (item.printTemplate && !this.vuex_printConnect) {
this.$u.toast(i18n.t('打印机连接失败'))
return
}
if (!item.printTemplate) {
return this.$u.toast(i18n.t('请选择打印模版'))
}
if (!row.grossWeight || !row.packageStandard) {
this.$u.toast(i18n.t('请录入毛重、装箱规格'))
return
}
item.feedbackTime = this.parseTime(new Date())
this.$u.api
.blPackagePrintInfo({
taskWorkunitId: item.taskWorkunitId,
qrcode: row.qrcode,
workorderId: item.workorderId,
grossWeight: row.grossWeight,
packageStandard: row.packageStandard,
boxWeight: row.boxWeight,
})
.then((res) => {
if (res.code === 200) {
// this.proVisible = false;
this.$u.toast(i18n.t('打印成功'))
this.getWorkorderDirectiveList(item, i)
if (item.printTemplate) {
let params = {}
res.data.forEach((datas) => {
params = {
reportName: 'mysql:' + item.printTemplate,
values: {
packagePrint: datas,
},
}
this.printPdfSocket(params)
})
}
this.getTaskList()
}
})
},
handleSubmitPackageFeedback(item, row, i) {
if (item.printTemplate && !this.vuex_printConnect) {
this.$u.toast(i18n.t('打印机连接失败'))
return
}
if (row.distributes && row.distributes.length > 0) {
const arr = this.$refs['feedSizeRef'][i].currentRow.filter(
(v) => v.qrcode === row.qrcode
)
if (!arr || !arr.length || arr.length !== row.distributes.length) {
return this.$u.toast(i18n.t('请点击确认SIZE数量后再报工'))
}
}
item.feedbackTime = this.parseTime(new Date())
this.$u.api
.feedBackPackage({
taskWorkunitId: item.taskWorkunitId,
checkBy: item.checkBy,
encasementNum: item.encasementNum,
mergePack: item.mergePack,
packNum: item.packNum,
printTemplate: item.printTemplate,
quantityUnqualify: item.quantityUnqualify,
taskId: item.taskId,
nickName: item.nickName,
userName: item.userName,
feedbackTime: item.feedbackTime,
workorderId: item.workorderId,
'reportData.netWeight': row.netWeight,
'reportData.reportQuantity': row.reportQuantity,
'reportData.packageNum': row.packageNum,
'reportData.qrcode': row.qrcode,
'reportData.workorderSoDirectiveId': row.workorderSoDirectiveId,
'reportData.workorderSoSizeItemId': row.workorderSoSizeItemId,
})
.then((res) => {
if (res.code === 200) {
// this.proVisible = false;
item.quantityUnqualify = 0
this.$u.toast(i18n.t('上报成功'))
this.getWorkorderDirectiveList(item, i)
if (item.printTemplate) {
let params = {}
res.data.forEach((datas) => {
params = {
reportName: 'mysql:' + item.printTemplate,
values: {
packagePrint: datas,
},
}
this.printPdfSocket(params)
})
}
this.getTaskList()
}
})
},
// 获取SIZE列表
getWorkorderSizeList(id, index) {
let row = this.feedbackForms[index]
this.$u.api
.workOrderSoSizeItemApi({
workorderId: id,
})
.then((res) => {
let columns = []
if (res.code === 200) {
for (const key in res.data.columns) {
if (res.data.columns.hasOwnProperty.call(res.data.columns, key)) {
const element = res.data.columns[key]
let obj = {
name: key,
label: element,
}
if (key === 'reportQuantity') {
obj.width = 130
obj.type = 'slot'
obj.slot = 'reportQuantity'
}
columns.push(obj)
}
}
// columns.unshift({
// name: 'reportQuantity',
// label: '本次包装数量',
// width: 130,
// type: 'slot',
// slot: 'reportQuantity'
// })
row.tableSizeColumn = columns
row.tableSizeData = res.data.sizeList
}
})
},
async doException() { async doException() {
if (this.tableSelectData.length > 1) { if (this.tableSelectData.length > 1) {
...@@ -2763,7 +2468,8 @@ export default { ...@@ -2763,7 +2468,8 @@ export default {
this.feedbackQuantityFu = 0 this.feedbackQuantityFu = 0
this.timeTest.isshow = false this.timeTest.isshow = false
this.feedbackForms.forEach((item) => { this.feedbackForms.forEach((item) => {
if (!item.nickName) { item.userName = this.userList.map(v => v.userName).join(',')
if (!item.userName) {
this.$u.toast(i18n.t('报工人不能为空')) this.$u.toast(i18n.t('报工人不能为空'))
this.proVisible = true this.proVisible = true
this.$refs.uModal.clearLoading() this.$refs.uModal.clearLoading()
...@@ -3600,6 +3306,9 @@ export default { ...@@ -3600,6 +3306,9 @@ export default {
background: #ecf5ff !important; background: #ecf5ff !important;
} }
} }
.mytag {
padding: 6px 3px;
}
</style> </style>
<style lang="scss"> <style lang="scss">
.mynotable { .mynotable {
......
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