From 3c856329cfcc713a4af88019d7b32d395974662d Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期四, 08 八月 2024 14:48:12 +0800
Subject: [PATCH] 1.生产工单 工艺路线版 新增修改时 工序新增子项设备
---
src/views/workOrder/workOrderList.vue | 397 +++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 319 insertions(+), 78 deletions(-)
diff --git a/src/views/workOrder/workOrderList.vue b/src/views/workOrder/workOrderList.vue
index 4afa633..8347e7f 100644
--- a/src/views/workOrder/workOrderList.vue
+++ b/src/views/workOrder/workOrderList.vue
@@ -135,6 +135,8 @@
:data="tableData"
:height="isExpandForm?tableHeight:(tableHeight+80)+'px'"
border
+ :summary-method="getSummaries"
+ show-summary
:row-class-name="tableRowClassName"
:style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px'}"
highlight-current-row
@@ -357,7 +359,7 @@
v-if="mesSetting.workOrder"
class="el-icon-files"
style="cursor: pointer;color:#42b983;margin-right: 15px"
- @click="pre(row,1)"
+ @click.stop="pre(row,1)"
/>
</el-tooltip>
@@ -365,12 +367,12 @@
<i
class="el-icon-edit-outline"
:style="{color:$store.state.settings.theme}"
- @click="edit('edit',row)"
+ @click.stop="edit('edit',row)"
/>
</el-tooltip>
<el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
- <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click="del(row)" />
+ <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click.stop="del(row)" />
</el-tooltip>
<el-tooltip class="item" effect="dark" content="鎵撳嵃宸ュ崟" placement="top">
@@ -383,7 +385,7 @@
:style="{color:$store.state.settings.theme}"
class="el-icon-printer"
style="cursor: pointer;margin-right: 15px"
- @click="handlePrint(row.wo_code,row.saleOrderCod)"
+ @click.stop="handlePrint(row.wo_code,row.saleOrderCod)"
/>
</el-tooltip>
@@ -392,7 +394,7 @@
class="el-icon-view"
style="cursor: pointer;"
:style="{color:$store.state.settings.theme}"
- @click="edit('view',row)"
+ @click.stop="edit('view',row)"
/>
</el-tooltip>
@@ -469,7 +471,7 @@
<el-table-column
label="宸ュ簭鍗曚环"
show-tooltip-when-overflow
- prop="stepprice"
+ prop="unprice"
/>
<el-table-column
label="宸茬敓浜ф暟閲�"
@@ -763,8 +765,95 @@
highlight-current-row
:header-cell-style="this.$headerCellStyle"
:cell-style="this.$cellStyle"
- row-key="stepcode"
>
+ <el-table-column type="expand">
+ <template slot-scope="props">
+
+ <el-table
+ :data="props.row.children"
+ style="width: 96%;margin: auto;"
+ border
+ row-key="eqp_code"
+ :row-class-name="tableRowClassName"
+ >
+ <el-table-column
+ prop="eqp_code"
+ label="璁惧/寰�鏉ョ紪鐮�"
+ min-width="120"
+ />
+ <el-table-column
+ prop="eqp_name"
+ label="璁惧/寰�鏉ュ悕绉�"
+ min-width="120"
+ />
+ <!-- <el-table-column-->
+ <!-- prop="eqp_value"-->
+ <!-- label="璁惧鑺傛媿"-->
+ <!-- min-width="150"-->
+ <!-- >-->
+ <!-- <template slot-scope="{row}">-->
+ <!-- <div style="display: flex;align-items: center">-->
+ <!-- <el-input-->
+ <!-- v-model="row.eqp_value"-->
+ <!-- placeholder="璇疯緭鍏�"-->
+ <!-- oninput="value=value.replace(/[^0-9.]/g,'')"-->
+ <!-- @change="val=>eqpValueChange(val,row)"-->
+ <!-- />-->
+ <!-- <div style="margin-left: 5px">绉�</div>-->
+ <!-- </div>-->
+ <!-- </template>-->
+ <!-- </el-table-column>-->
+ <!-- <el-table-column-->
+ <!-- prop="stand_value"-->
+ <!-- label="鐢熶骇鑺傛媿"-->
+ <!-- min-width="120"-->
+ <!-- >-->
+ <!-- <template slot-scope="{row}">-->
+ <!-- <div>{{ row.stand_value + ' ' + '绉�/娆�' }}</div>-->
+ <!-- </template>-->
+ <!-- </el-table-column>-->
+ <!-- <el-table-column-->
+ <!-- prop="cavity_qty"-->
+ <!-- label="鑵斿瀷鏁�"-->
+ <!-- min-width="120"-->
+ <!-- >-->
+ <!-- <template slot-scope="{row}">-->
+ <!-- <el-input-->
+ <!-- v-model="row.cavity_qty"-->
+ <!-- placeholder="璇疯緭鍏�"-->
+ <!-- oninput="value=value.replace(/[^0-9.]/g,'')"-->
+ <!-- @change="val=>cavityQtyChange(val,row)"-->
+ <!-- />-->
+ <!-- </template>-->
+ <!-- </el-table-column>-->
+ <el-table-column
+ prop="unprice"
+ label="璁惧宸ヤ环"
+ min-width="120"
+ >
+ <template slot-scope="{row}">
+ <el-input v-model="row.unprice" oninput="value=value.replace(/[^0-9.]/g,'')" />
+ </template>
+ </el-table-column>
+ <!-- v-if="!sourceType"-->
+ <el-table-column
+
+ prop="enable"
+ label="鏄惁鍚敤"
+ min-width="150"
+ >
+ <template slot-scope="{row}">
+ <el-switch
+ v-model="row.enable"
+ inactive-value="N"
+ active-value="Y"
+ />
+ </template>
+ </el-table-column>
+ </el-table>
+ </template>
+ </el-table-column>
+
<el-table-column
type="index"
label="搴忓彿"
@@ -781,17 +870,16 @@
show-tooltip-when-overflow
/>
<el-table-column
- prop="stepprice"
+ prop="unprice"
label="鐢熶骇鍗曚环"
show-tooltip-when-overflow
>
<template slot-scope="{row}">
<el-input
- v-model="row.stepprice"
+ v-model="row.unprice"
placeholder="璇疯緭鍏ュ伐搴忓崟浠�"
oninput="value=value.replace(/[^0-9.]/g,'')"
style="width: 100%"
- @click=""
/>
</template>
</el-table-column>
@@ -1335,7 +1423,7 @@
>
<div class="elForm">
<el-form-item label="閿�鍞崟鍙�:" class="formContent">
- {{ formApprove.saleOrderCode ?formApprove.saleOrderCode :'/' }}
+ {{ formApprove.saleOrderCode ? formApprove.saleOrderCode : '/' }}
</el-form-item>
<el-form-item label="宸ュ崟缂栧彿:" class="formContent">
{{ formApprove.mesordercode }}
@@ -1464,7 +1552,7 @@
>
<div class="elForm">
<el-form-item label="閿�鍞崟鍙�:" class="formContent">
- {{ formApprove.saleOrderCode ?formApprove.saleOrderCode :'/' }}
+ {{ formApprove.saleOrderCode ? formApprove.saleOrderCode : '/' }}
</el-form-item>
<el-form-item label="宸ュ崟缂栧彿:" class="formContent">
{{ formApprove.mesordercode }}
@@ -2183,7 +2271,7 @@
<el-dialog
v-el-drag-dialog
class="sop"
- title="璁惧SOP棰勮"
+ title="SOP棰勮"
:visible.sync="SopDialogVisible"
width="800px"
:close-on-click-modal="false"
@@ -2221,7 +2309,8 @@
type="primary"
style="margin-left: 37px"
@click="view"
- >棰� 瑙�/涓� 杞�</el-button>
+ >棰� 瑙�/涓� 杞�
+ </el-button>
<span slot="footer" class="dialog-footer">
<div class="footerButton">
@@ -2256,13 +2345,14 @@
UpdateMesOrderStepSearch
} from '@/api/WorkOrder'
import { PartSelect } from '@/api/ProductModel'
-import { PrentOrganization, PrentOrganizationNoCompany, StepData } from '@/api/GeneralBasicData'
+import { PrentOrganization, PrentOrganizationNoCompany, StepData, StepEqpData } from '@/api/GeneralBasicData'
import Sortable from 'sortablejs'
import ElDragSelect from '@/components/DragSelect'
import { MesOrderPrintSearch } from '@/api/GridReport' // base on element-ui
import DateType from '@/components/DateType'
import { PartSelectRpute, RouteSelectStep } from '@/api/basicSettings'
import { DeviceSopSearch } from '@/api/DeviceManager'
+
export default {
name: 'WorkOrderList',
components: {
@@ -2539,7 +2629,14 @@
},
sopArr: [],
routeCode: '', // 宸ヨ壓璺嚎code
- partCode: ''
+ partCode: '',
+
+ StepEqpArr: [],
+
+ editStepEqpArr: [],
+
+ flag1: false
+
}
},
watch: {
@@ -2550,13 +2647,43 @@
console.log(val, 1)
const arr = JSON.parse(JSON.stringify(this.stepTableData))
const arrStepcode = arr.map(i => i.stepcode)
+
+ console.log(arr, 3)
this.stepTableData = []
val.forEach(i => {
+ let children = []
+
+ if (arrStepcode.includes(i)) { // 瀛愰」淇濇寔涓嶅彉
+ children = arr.find(j => j.stepcode === i).children
+ } else {
+ // 1.鍏堟煡鎵捐嚜宸卞師鏈夊瓙椤规槸鍚︽湁
+ console.log(this.editStepEqpArr.find(j => j.step_code === i), 'this.editStepEqpArr.find(j => j.step_code === i)')
+ if (this.editStepEqpArr.find(j => j.step_code === i)) {
+ children = this.editStepEqpArr.find(j => j.step_code === i).children
+
+ console.log(children, 10)
+ } else {
+ // 鍐嶆煡鎵� 鍘嗗彶鏈�鏂版垨鑰呭熀纭�璧勬枡鏄惁鏈�
+ if (this.sourceType) {
+ children = this.StepEqpArr.find(j => j.step_code === i).children
+ console.log(children, 11)
+ }
+ if (!this.sourceType) {
+ children = this.StepEqpArr.find(j => j.step_code === i).children
+ console.log(children, 12)
+ }
+ }
+ }
+
this.stepTableData.push(
{
stepcode: i,
stepname: this.stepSelectArr.find(j => j.stepcode === i).stepname,
- stepprice: arrStepcode.includes(i) ? arr.find(j => j.stepcode === i).stepprice : 0
+ unprice: arrStepcode.includes(i) ? arr.find(j => j.stepcode === i).unprice : 0,
+ // children:arrStepcode.includes(i)? arr.find(j => j.stepcode === i).children:
+
+ children
+
}
)
})
@@ -2575,6 +2702,12 @@
// })
},
methods: {
+ // 宸ュ簭璁惧鍩虹璧勬枡
+ async getStepEqpData() {
+ const { data: res } = await StepEqpData()
+ this.StepEqpArr = res
+ },
+
// 寮瑰嚭妗嗗叧闂�
handleSopClose() {
this.SopDialogVisible = false
@@ -2614,6 +2747,7 @@
},
// 宸ュ簭鏉ユ簮鍒囨崲
sourceTypeChange(val) {
+ this.flag1 = false
this.stepTableData = []
if (val) {
this.getMesOrderNewStepContent()
@@ -2660,6 +2794,7 @@
if (res.code === '200') {
this.getSelect()
this.getPrentOrganizationNoCompany()
+ this.getStepEqpData()
}
})
},
@@ -2773,7 +2908,7 @@
this.operation = operation
this.dialogVisible = true
this.dialogForm.data_sources = 'MES'
-
+ this.sourceType = true
this.$nextTick(() => {
this.setSort()
})
@@ -2878,10 +3013,32 @@
}
const { data: res } = await UpdateMesOrderStepSearch(data)
this.dialogForm.mesmaxqty = res.canupdate_qty
+ this.editStepEqpArr = JSON.parse(JSON.stringify(res.stepdata))
+ this.flag1 = res.stepdata.length !== 0
+ // console.log(this.editStepEqpArr.find(i => i.step_code === '102'))
if (this.mesSetting.route) { // 鎸夊伐鑹鸿矾绾胯蛋妯″紡
- if (!this.dialogForm.routecode) {
+ if (this.dialogForm.routecode) {
await this.getPartcodeChangeDialog()
+ // this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ res.stepdata.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.step_code,
+ stepname: i.stepname,
+ unprice: i.unprice,
+ children: i.children
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+
+ this.dialogVisible = true
+ this.$nextTick(() => {
+ this.setSort()
+ })
+
+ return
}
if (res.stepdata.length > 0) {
@@ -2890,11 +3047,13 @@
{
stepcode: i.step_code,
stepname: i.stepname,
- stepprice: i.stepprice
+ unprice: i.unprice,
+ children: i.children
}
)
})
this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ this.sourceType = true
} else {
const data2 = {
wkshopcode: this.dialogForm.wkshopcode,
@@ -2907,11 +3066,13 @@
{
stepcode: i.step_code,
// stepname: i.stepname,
- stepprice: i.stepprice
+ unprice: i.unprice,
+ children: i.children
}
)
})
this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ this.sourceType = false
}
}
} else {
@@ -2921,12 +3082,15 @@
{
stepcode: i.step_code,
stepname: i.stepname,
- stepprice: i.stepprice
+ unprice: i.unprice,
+ children: i.children
}
)
})
this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ this.sourceType = true
} else {
+ this.sourceType = false
await this.getBasicProcessData()
}
}
@@ -2937,7 +3101,7 @@
})
},
// 鎸夊伐搴忔ā寮忚蛋鐨勬椂鍊� 寮曠敤鍩虹璧勬枡 宸ヨ壓
- async getBasicProcessData() {
+ async getBasicProcessData() {
const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
res.sort((a, b) => a.step_seq - b.step_seq)
this.stepTableData = []
@@ -2946,7 +3110,8 @@
{
stepcode: i.step_code,
stepname: i.step_name,
- stepprice: i.unprice
+ unprice: i.unprice,
+ children: i.children
}
)
})
@@ -2972,7 +3137,7 @@
}
},
- async getPartcodeChangeDialog() {
+ async getPartcodeChangeDialog() {
const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
this.routecodeArr = res
@@ -2990,54 +3155,88 @@
},
// 宸ヨ壓璺嚎鍊兼敼鍙�
async routecodeChange() {
- const data = {
- partcode: this.dialogForm.partcode,
- routecode: this.dialogForm.routecode
+ if (!this.flag1) {
+ const data = {
+ partcode: this.dialogForm.partcode,
+ routecode: this.dialogForm.routecode
+ }
+ const { data: res } = await RouteSelectStep(data)
+ console.log(res, 887)
+ this.stepSelectedValue = []
+ this.stepTableData = []
+ if (res.length > 0) {
+ res.sort((a, b) => a.step_seq - b.step_seq)
+ res.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.code,
+ // stepname: i.stepname,
+ unprice: i.unprice,
+ children: i.children
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ }
}
- const { data: res } = await RouteSelectStep(data)
- this.stepSelectedValue = []
- this.stepTableData = []
- if (res.length > 0) {
- res.sort((a, b) => a.step_seq - b.step_seq)
- res.forEach(i => {
- this.stepTableData.push(
- {
- stepcode: i.step_code,
- // stepname: i.stepname,
- stepprice: i.unprice
- }
- )
- })
- this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ if (this.flag1 && !this.sourceType) {
+ const data = {
+ partcode: this.dialogForm.partcode,
+ routecode: this.dialogForm.routecode
+ }
+ const { data: res } = await RouteSelectStep(data)
+ console.log(res, 887)
+ this.stepSelectedValue = []
+ this.stepTableData = []
+ if (res.length > 0) {
+ res.sort((a, b) => a.step_seq - b.step_seq)
+ res.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.code,
+ // stepname: i.stepname,
+ unprice: i.unprice,
+ children: i.children
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ }
}
},
- async getMesOrderNewStepContent() {
+ async getMesOrderNewStepContent() {
// if (!this.mesSetting.route && this.operation === 'edit') {
// return
// }
- const data = {
- routecode: this.dialogForm.routecode,
- wkshopcode: this.dialogForm.wkshopcode,
- partcode: this.dialogForm.partcode
- }
- const { data: res } = await MesOrderNewStepContent(data)
- // console.log(res)
- this.stepSelectedValue = []
- this.stepTableData = []
- if (res.length > 0) {
- res.forEach(i => {
- this.stepTableData.push(
- {
- stepcode: i.step_code,
- // stepname: i.stepname,
- stepprice: i.stepprice
- }
- )
- })
- this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ if (this.sourceType) {
+ const data = {
+ routecode: this.dialogForm.routecode,
+ wkshopcode: this.dialogForm.wkshopcode,
+ partcode: this.dialogForm.partcode
+ }
+ const { data: res } = await MesOrderNewStepContent(data)
+ // console.log(res)
+ this.stepSelectedValue = []
+ this.stepTableData = []
+ if (res.length > 0) {
+ res.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.step_code,
+ // stepname: i.stepname,
+ unprice: i.unprice,
+ children: i.children
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ }
+ } else {
+ console.log(9)
+ await this.routecodeChange()
}
},
@@ -3066,6 +3265,7 @@
this.stepSelectedValue = []
this.stepTableData = []
+ this.flag1 = false
this.$refs.dialogForm.clearValidate()
},
// 瀵硅瘽妗嗗彇娑�
@@ -3088,20 +3288,33 @@
return this.$message.info('姝ゅ伐鍗曠殑鏈�澶т慨鏀规暟鍊间负锛�' + this.dialogForm.mesmaxqty)
}
- const workListSub = []
+ const WorkListSub = []
this.stepTableData.forEach((i, j) => {
- workListSub.push(
+ const children = []
+ if (i.children.length > 0) {
+ i.children.forEach(k => {
+ if (k.enable === 'Y') {
+ children.push({
+ eqpcode: k.eqp_code,
+ unprice: parseFloat(k.unprice)
+ })
+ }
+ })
+ }
+
+ WorkListSub.push(
{
stepseq: j + 1,
stepcode: i.stepcode,
- stepprice: i.stepprice,
+ unprice: i.unprice,
isbott: j === 0 ? 'Y' : 'N',
- isend: j === this.stepTableData.length - 1 ? 'Y' : 'N'
+ isend: j === this.stepTableData.length - 1 ? 'Y' : 'N',
+ WorkEqpListSub: children
}
)
})
- if (workListSub.length === 0) {
+ if (WorkListSub.length === 0) {
return this.$message.info('宸ュ簭涓嶈兘涓虹┖锛�')
}
@@ -3116,10 +3329,10 @@
woqty: this.dialogForm.mesqty, // 宸ュ崟鏁伴噺
deliverydate: this.dialogForm.deliverydate, // 浜や粯鏃堕棿
data_sources: this.dialogForm.data_sources, // 鏁版嵁鏉ユ簮
- isstep: workListSub.length > 0 ? 'Y' : 'N', //
+ isstep: WorkListSub.length > 0 ? 'Y' : 'N', //
difference: this.dialogForm.mesqty - this.dialogForm.mesqtyinit, // 鏁版嵁宸��
routecode: this.dialogForm.routecode,
- workListSub
+ WorkListSub
}
this.$store.state.app.buttonIsDisabled = true
@@ -3219,10 +3432,10 @@
div.scrollTop = div.scrollHeight // 婊氬姩鏉′綅浜庢渶搴曢儴
})
- // const div = document.getElementById('qrCode')
- // 杩欎箞澶氫唬鐮佸彧闇�瑕佽繖涓�鍙ュ疄鐜版垜浠墍闇�瑕佺殑鍔熻兘锛屽畾浣峝iv婊氬姩鏉′綅缃湪搴曢儴锛宻crollHeight璁$畻鍑篸iv鐨勯珮搴︼紝鍐峴crollTop 璁剧疆婊氬姩鏉$殑楂樺害涓哄灏�
- // div.scrollTop = div.scrollHeight // 婊氬姩鏉′綅浜庢渶搴曢儴
- // div.scrollTop = 0 // 婊氬姩鏉′綅浜庢渶椤堕儴
+ // const div = document.getElementById('qrCode')
+ // 杩欎箞澶氫唬鐮佸彧闇�瑕佽繖涓�鍙ュ疄鐜版垜浠墍闇�瑕佺殑鍔熻兘锛屽畾浣峝iv婊氬姩鏉′綅缃湪搴曢儴锛宻crollHeight璁$畻鍑篸iv鐨勯珮搴︼紝鍐峴crollTop 璁剧疆婊氬姩鏉$殑楂樺害涓哄灏�
+ // div.scrollTop = div.scrollHeight // 婊氬姩鏉′綅浜庢渶搴曢儴
+ // div.scrollTop = 0 // 婊氬姩鏉′綅浜庢渶椤堕儴
})
}
})
@@ -3657,6 +3870,34 @@
},
stepSelectedValueChange(val) {
// console.log(val, 123)
+ },
+ getSummaries(param) {
+ const { columns, data } = param
+ const sums = []
+ const i = 9
+ columns.forEach((column, index) => {
+ if (index === i) {
+ sums[index] = '鎬绘暟'
+ return
+ }
+ const values = data.map(item => Number(item[column.property]))
+ if (column.property === 'plan_qty') {
+ sums[index] = values.reduce((prev, curr) => {
+ const value = Number(curr)
+ if (!isNaN(value)) {
+ return prev + curr
+ // return Math.round(prev * 100) / 100 + Math.round(curr * 100) / 100
+ }
+ }, 0)
+
+ sums[index] += ''
+ }
+ })
+
+ this.$nextTick(() => {
+ this.$refs.tableDataRef.doLayout()
+ })
+ return sums
}
}
}
@@ -3976,8 +4217,8 @@
}
</style>
<style>
-.sortable-ghost{
+.sortable-ghost {
opacity: .8;
- color: #fff!important;
- background: #42b983!important;
+ color: #fff !important;
+ background: #42b983 !important;
}
--
Gitblit v1.9.3