From 599a565adfdb4fb04ab6a8f17fcf0995e25d8810 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 15 二月 2023 15:25:30 +0800
Subject: [PATCH] 1.生产开报工新增计件方式2.班组、人员计件工资报表改变
---
src/views/scgl/sckbg.vue | 218 ++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 170 insertions(+), 48 deletions(-)
diff --git a/src/views/scgl/sckbg.vue b/src/views/scgl/sckbg.vue
index 027cbb0..6e0f512 100644
--- a/src/views/scgl/sckbg.vue
+++ b/src/views/scgl/sckbg.vue
@@ -593,7 +593,16 @@
<el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'" label="涓嬮亾宸ュ簭锛�">
<div style="width: 200px">{{ dialogForm.nextstepname }}</div>
</el-form-item>
- <el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'" prop="usergroupcode" label="鐢熶骇鐝粍锛�">
+
+ <el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'" prop="reckway" label="璁′欢鏂瑰紡锛�">
+
+ <el-radio-group v-model="dialogForm.reckway" style="width: 200px;" @change="reckwayChange">
+ <el-radio label="group">鐝粍</el-radio>
+ <el-radio label="person">涓汉</el-radio>
+ </el-radio-group>
+ </el-form-item>
+
+ <el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'&&dialogForm.reckway==='group'" prop="usergroupcode" label="鐢熶骇鐝粍锛�">
<el-select
v-model="dialogForm.usergroupcode"
style="width: 200px;"
@@ -608,6 +617,23 @@
/>
</el-select>
</el-form-item>
+
+ <el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'&&dialogForm.reckway==='person'" prop="operation" label="鎶ュ伐浜哄憳锛�">
+ <el-select
+ v-model="dialogForm.operation"
+ style="width: 200px;"
+ placeholder="璇烽�夋嫨"
+ @change="usergroupChange"
+ >
+ <el-option
+ v-for="item in OperationArr"
+ :key="item.usercode"
+ :label="item.username"
+ :value="item.usercode"
+ />
+ </el-select>
+ </el-form-item>
+
<el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'" label="璁惧鍚嶇О锛�" prop="eqpcode">
<el-select
v-model="dialogForm.eqpcode"
@@ -649,24 +675,25 @@
<!-- <el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'" label="鎶ュ伐浜哄憳锛�">-->
<!-- <el-input v-model="dialogForm.remarks" type="textarea" style="width: 200px;" />-->
<!-- </el-form-item>-->
- <el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'" label="鎶ュ伐浜猴細">
- <el-select
- v-model="dialogForm.operation"
- style="width: 200px;"
- placeholder="璇烽�夋嫨"
- >
- <el-option
- v-for="item in OperationArr"
- :key="item.usercode"
- :label="item.username"
- :value="item.usercode"
- />
- </el-select>
- </el-form-item>
+ <!-- 娉ㄩ噴-->
+ <!-- <el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'" label="鎶ュ伐浜猴細">-->
+ <!-- <el-select-->
+ <!-- v-model="dialogForm.operation"-->
+ <!-- style="width: 200px;"-->
+ <!-- placeholder="璇烽�夋嫨"-->
+ <!-- >-->
+ <!-- <el-option-->
+ <!-- v-for="item in OperationArr"-->
+ <!-- :key="item.usercode"-->
+ <!-- :label="item.username"-->
+ <!-- :value="item.usercode"-->
+ <!-- />-->
+ <!-- </el-select>-->
+ <!-- </el-form-item>-->
<el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'" label="澶囨敞锛�">
<el-input v-model="dialogForm.remarks" type="textarea" style="width: 200px;" />
</el-form-item>
- <div v-if="dialogTitle==='鑷埗鎶ュ伐'">
+ <div v-if="dialogTitle==='鑷埗鎶ュ伐'&&dialogForm.reckway==='group'">
<i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 浜哄憳鍒楄〃
<el-button v-waves type="primary" style="margin: 10px 0" @click="userAdd">澧炶</el-button>
<el-table
@@ -693,7 +720,7 @@
show-tooltip-when-overflow
>
<template slot-scope="{row}">
- <div v-if="row.isVisible===0">{{ row.username }}</div>
+
<el-select
v-if="row.isVisible===1"
v-model="row.username"
@@ -708,8 +735,25 @@
:value="item.usercode"
/>
</el-select>
+ <div v-else>{{ row.username }}</div>
</template>
</el-table-column>
+ <el-table-column
+ prop="ratio"
+ label="鍒嗛厤姣斾緥(%)"
+ show-tooltip-when-overflow
+ >
+ <template slot-scope="{row}">
+ <el-input
+ v-if="row.isVisible===1||row.isVisible===2"
+ v-model="row.ratio"
+ oninput="value=value.replace(/[^0-9.]/g,'')"
+ placeholder="璇疯緭鍏�"
+ />
+ <div v-else> {{ row.ratio }}</div>
+ </template>
+ </el-table-column>
+
<el-table-column
prop="RowNum"
label="鎿嶄綔"
@@ -717,9 +761,10 @@
>
<template slot-scope="{row}">
<div class="operationClass">
- <el-button v-if="row.isVisible===0" v-waves type="text" @click="userDel(row)">鍒犻櫎</el-button>
- <el-button v-if="row.isVisible===1&&!userIsSave" v-waves type="text" @click="userSave(row)">淇濆瓨</el-button>
+ <el-button v-if="(row.isVisible===1&&!userIsSave)||row.isVisible===2" v-waves type="text" @click="userSave(row)">淇濆瓨</el-button>
<el-button v-if="row.isVisible===1" v-waves type="text" @click="userCancel(row)">鍙栨秷</el-button>
+ <el-button v-if="row.isVisible===0" v-waves type="text" @click="userDel(row)">鍒犻櫎</el-button>
+ <el-button v-if="row.isVisible===0" v-waves type="text" @click="editRatio(row)">淇敼姣斾緥</el-button>
</div>
</template>
</el-table-column>
@@ -1062,20 +1107,21 @@
<div style="width: 200px">{{ badDialogForm.ng_qty }}</div>
</el-form-item>
- <el-form-item label="缁翠慨浜哄憳锛�">
- <el-select
- v-model="badDialogForm.operation"
- style="width: 200px;"
- placeholder="璇烽�夋嫨"
- >
- <el-option
- v-for="item in OperationArr"
- :key="item.usercode"
- :label="item.username"
- :value="item.usercode"
- />
- </el-select>
- </el-form-item>
+ <!-- 娉ㄩ噴-->
+ <!-- <el-form-item label="缁翠慨浜哄憳锛�">-->
+ <!-- <el-select-->
+ <!-- v-model="badDialogForm.operation"-->
+ <!-- style="width: 200px;"-->
+ <!-- placeholder="璇烽�夋嫨"-->
+ <!-- >-->
+ <!-- <el-option-->
+ <!-- v-for="item in OperationArr"-->
+ <!-- :key="item.usercode"-->
+ <!-- :label="item.username"-->
+ <!-- :value="item.usercode"-->
+ <!-- />-->
+ <!-- </el-select>-->
+ <!-- </el-form-item>-->
</el-form>
<div style="margin-bottom:20px">
@@ -1310,6 +1356,8 @@
startqtySum: '', // 涓嶈兘瓒呰繃鐨勬暟鍊�
+ reckway: 'group', // 璁′欢鏂瑰紡
+
operation: getCookie('navTabId'), // 鎶ュ伐浜猴紙鏀舵枡浜猴級
remarks: ''// 澶囨敞
@@ -1354,6 +1402,9 @@
],
startqty: [
{ required: true, message: '璇疯緭鍏ユ姤宸ユ暟閲�', trigger: ['blur', 'change'] }
+ ],
+ operation: [
+ { required: true, message: '璇烽�夋嫨鎶ュ伐浜哄憳', trigger: ['blur', 'change'] }
]
},
activeName: '',
@@ -1454,7 +1505,16 @@
this.getMesOrderSelectUserAll() // 鑾峰彇鎵�鏈変汉鍛�
},
methods: {
-
+ // 璁′欢鏂瑰紡鍊兼敼鍙樻椂
+ reckwayChange() {
+ this.dialogForm.usergroupcode = ''
+ this.dialogForm.operation = ''
+ this.userTableData = []
+ // console.log(this.$refs.dialogForm, 'log')
+ // this.$nextTick(() => {
+ // this.$refs.dialogForm.resetFields()
+ // })
+ },
tableRowClassName({ row, rowIndex }) {
return 'custom-row'
},
@@ -1871,12 +1931,46 @@
number = number === 0 ? (10 + Math.random()) : number
item.isVisible = 0
item.number = number
+ // item.ratio = parseFloat((100 / this.userTableData.length).toFixed(2))
})
this.ZZuserArr = [...this.ZZuserArr].filter(x => [...this.userTableData].every(y => y.usercode !== x.usercode))
+ this.calculatedValue()
this.$refs.tableDataRef.doLayout()
},
+ calculatedValue() {
+ const total = 100; let value = 0
+ this.userTableData.forEach(item => {
+ item.ratio = parseFloat((100 / this.userTableData.length).toFixed(2))
+ value += item.ratio
+ })
+ console.log(value, 1)
+ if (value !== total) {
+ // let temp = this.userTableData
+ // temp[temp.length-1].ratio=temp[temp.length-1].ratio+(total-value)
+ this.userTableData[ this.userTableData.length - 1].ratio = parseFloat((this.userTableData[ this.userTableData.length - 1].ratio + (total - value)).toFixed(2))
+ }
+ },
+ // 淇敼鍒嗛厤姣斿垪
+ editRatio(row) {
+ // console.log(row, 'row')
+ this.userTableData.forEach((item, index) => {
+ if (item.number === row.number) {
+ const number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗�
+
+ this.userTableData.splice(index, 1, {
+ usercode: row.usercode,
+ username: row.username,
+ ratio: row.ratio,
+ isVisible: 2,
+ number: number === 0 ? (10 + Math.random()) : number
+
+ })
+ }
+ })
+ },
+
// 鐢ㄦ埛娣诲姞
userAdd() {
if (this.userTableData.find(i => i.isVisible === 1)) {
@@ -1885,7 +1979,8 @@
let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗�
number = number === 0 ? (10 + Math.random()) : number
console.log(this.userTableData, 6)
- this.userTableData.unshift({ usercode: '', username: '', isVisible: 1, number: number })
+ this.userTableData.unshift({ usercode: '', username: '', isVisible: 1, number: number, ratio: 0 })
+ this.calculatedValue()
},
// 鐢ㄦ埛鍒楄〃鍒犻櫎
userDel(row) {
@@ -1899,12 +1994,17 @@
this.userTableData.splice(index, 1)
}
})
+
+ this.calculatedValue()
},
// 鐢ㄦ埛鍒楄〃淇濆瓨
userSave(row) {
console.log(row, 123)
if (row.usercode === '') {
return this.$message.info('浜哄憳鍚嶇О涓嶈兘涓虹┖锛�')
+ }
+ if (row.ratio === '') {
+ return this.$message.info('鍒嗛厤姣斿垪涓嶈兘涓虹┖锛�')
}
this.ZZuserArr.forEach((item, index) => {
@@ -1981,7 +2081,11 @@
this.dialogForm.startqtySum = '' // 涓嶈兘瓒呰繃鐨勬暟鍊�
+ this.dialogForm.reckway = '' // 璁′欢鏂瑰紡
+
this.dialogForm.nextstepcode = '' // 涓嬮亾宸ュ簭缂栫爜
+
+ this.dialogForm.reckway = 'group'
this.dialogForm.remarks = '' // 澶囨敞
this.dialogForm.operation = getCookie('navTabId') // 鎶ュ伐浜猴紙鏀舵枡浜猴級
@@ -2055,7 +2159,8 @@
this.dialogVisible = false
this.$message.success('鏀舵枡鎴愬姛锛�')
if (this.dialogForm.nextstepcode === '') {
- this.WXprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.inuser).username)
+ // this.WXprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.inuser).username)
+ this.WXprint2(this.OperationArr.find(item => item.usercode === getCookie('navTabId')).username)
this.dialogVisible2 = true
}
this.tabClick()
@@ -2093,14 +2198,8 @@
if (parseFloat(this.dialogForm.startqtySum) < parseFloat(this.dialogForm.startqty) + parseFloat(this.dialogForm.noputqty)) {
return this.$message.info('鎶ュ伐鏁伴噺鍔犱笉鑹暟閲忎笉鑳藉ぇ浜庝簡鏈姤鏁伴噺!')
}
- if (this.userTableData.length < 1) {
+ if (this.userTableData.length < 1 && this.dialogForm.reckway === 'group') {
return this.$message.info('浜哄憳鍒楄〃涓嶈兘涓虹┖!')
- }
-
- if (parseFloat(this.dialogForm.noputqty) > 0) {
- if (this.dialogForm.badcode.length < 1) {
- return this.$message.info('璇烽�夋嫨涓嶈壇鍘熷洜锛�')
- }
}
// this.userTableData = [...new Set(this.userTableData)]// 鏁扮粍鍘婚噸
this.userTableData = this.userTableData.filter(item => item.usercode !== '')
@@ -2108,8 +2207,26 @@
this.userTableData = this.userTableData.filter((currentValue, currentIndex, selfArr) => {
return selfArr.findIndex(item => item.usercode === currentValue.usercode) === currentIndex
})
+
+ if (this.dialogForm.reckway === 'group') {
+ let sum = 0
+ this.userTableData.forEach(item => {
+ sum += item.ratio
+ })
+ if (sum !== 100) {
+ return this.$message.info('鍒嗛厤姣斾緥鎬诲拰蹇呴』涓�100锛�')
+ }
+ }
+
+ if (parseFloat(this.dialogForm.noputqty) > 0) {
+ if (this.dialogForm.badcode.length < 1) {
+ return this.$message.info('璇烽�夋嫨涓嶈壇鍘熷洜锛�')
+ }
+ }
+
// console.log(this.userTableData, 1)
- const reportuser = this.userTableData.map(item => item.usercode).join(';')
+ // const reportuser = this.userTableData.map(item => item.usercode).join(';')// 涓昏鏀圭殑鏄繖閲岀殑鏍煎紡
+ console.log(this.dialogForm.operation, 'dialogForm.operation')
const data = {
mesordercode: this.dialogForm.wo_code, // 宸ュ崟缂栧彿
partcode: this.dialogForm.partcode, // 浜у搧缂栫爜
@@ -2117,23 +2234,28 @@
stepcode: this.dialogForm.stepcode, // 宸ュ簭缂栫爜
eqpcode: this.dialogForm.eqpcode, // 璁惧缂栫爜
usergroupcode: this.dialogForm.usergroupcode, // 鐝粍缂栫爜
- reportuser: reportuser, // 鎶ュ伐浜哄憳
+ // reportuser: reportuser, // 鎶ュ伐浜哄憳
+ reportuser: this.dialogForm.reckway === 'group' ? this.userTableData : [{ usercode: this.dialogForm.operation, ratio: 100 }],
taskqty: this.dialogForm.planqty, // 浠诲姟鏁伴噺
// startqty: this.dialogForm.startqty, // 寮�宸ユ暟閲�
startqty: this.dialogForm.reportqty, // 寮�宸ユ暟閲�
// reportqty: this.dialogForm.reportqty, // 鎶ュ伐鏁伴噺
reportqty: this.dialogForm.startqty, // 鎶ュ伐鏁伴噺
remarks: this.dialogForm.remarks, // 澶囨敞
+ reckway: this.dialogForm.reckway, // 璁′欢鏂瑰紡
ngqty: this.dialogForm.noputqty === '' ? 0 : this.dialogForm.noputqty, // 涓嶈壇鏁伴噺
badcode: this.dialogForm.badcode.length < 1 ? '' : this.dialogForm.badcode.join(';')// 涓嶈壇鍘熷洜
}
+
+ // console.log(JSON.stringify(data), 'data')
+ console.log(data, 'data')
this.$store.state.app.buttonIsDisabled = true
SavaMesOrderStepReport(data).then(res => {
if (res.code === '200') {
this.dialogVisible = false
this.$message.success('鎶ュ伐鎴愬姛锛�')
if (this.dialogForm.nextstepcode === '') {
- this.ZZprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.operation).username)
+ this.ZZprint2(this.OperationArr.find(item => item.usercode === getCookie('navTabId')).username)
this.dialogVisible2 = true
}
this.tabClick()
@@ -2224,11 +2346,11 @@
Data: this.badTableDataDialog
}
this.$store.state.app.buttonIsDisabled = true
- EditOrderNgStepSeave(data, this.badDialogForm.operation).then(res => {
+ EditOrderNgStepSeave(data, getCookie('navTabId')).then(res => {
if (res.code === '200' || res.code === '301') {
this.getBadList()
this.badDialogVisible = false
- this.badPrint(this.OperationArr.find(item => item.usercode === this.badDialogForm.operation).username)
+ this.badPrint(this.OperationArr.find(item => item.usercode === getCookie('navTabId')).username)
this.dialogVisible2 = true
this.$message.success('淇濆瓨鎴愬姛锛�')
--
Gitblit v1.9.3