From f0066d970ee587f38343eb7911df5352c08a20fd Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期三, 12 十一月 2025 09:29:48 +0800
Subject: [PATCH] 1.存货档案 批量绑定工艺路线
---
src/views/materialManager/inventoryList.vue | 737 +++++++++++++++++++++++++++++++++++++++++++++++++-------
src/api/ProductModel.js | 17 +
2 files changed, 655 insertions(+), 99 deletions(-)
diff --git a/src/api/ProductModel.js b/src/api/ProductModel.js
index 34ea5c9..eaa87bb 100644
--- a/src/api/ProductModel.js
+++ b/src/api/ProductModel.js
@@ -133,3 +133,20 @@
})
}
+// 瀛樿揣妗f鍏宠仈宸ヨ壓(宸ヨ壓璺嚎/宸ュ簭)鏌ヨ澶氬瓨璐�
+export function TMaterielFileAssociationRouteList(data) {
+ return request({
+ url: 'ProductModel/TMaterielFileAssociationRouteList',
+ method: 'post',
+ data
+ })
+}
+
+// 瀛樿揣妗f鍏宠仈宸ヨ壓(宸ヨ壓璺嚎鎴栧伐搴�)鎻愪氦澶氬瓨璐�
+export function SaveTMaterielFileList(data) {
+ return request({
+ url: 'ProductModel/SaveTMaterielFileList',
+ method: 'post',
+ data
+ })
+}
diff --git a/src/views/materialManager/inventoryList.vue b/src/views/materialManager/inventoryList.vue
index cc79c02..3b285ad 100644
--- a/src/views/materialManager/inventoryList.vue
+++ b/src/views/materialManager/inventoryList.vue
@@ -62,16 +62,39 @@
style=" width:calc(100% - 300px);"
>
<div class="bodyTopButtonGroup" style="justify-content: space-between">
- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
+ <el-button
+ v-waves
+ :size="buttonSize"
+ type="primary"
+ icon="el-icon-circle-plus-outline"
+ @click="add('add')"
+ >鏂板
+ </el-button>
<div style="display: flex">
<el-button
v-waves
+ :size="buttonSize"
type="success"
+ icon="el-icon-help"
+ :disabled="multipleSelection.length===0"
+ @click="batchRouteClick"
+ >鎵归噺缁戝畾宸ヨ壓
+ </el-button>
+ <el-button
+ v-waves
+ type="success"
+ :size="buttonSize"
icon="el-icon-download"
@click="$router.push('./../systemSetting/dataImport?fileCode=8')"
>瀵煎叆
</el-button>
- <el-button v-waves icon="el-icon-refresh-right" @click="syncERP">鍚屾瀛樿揣妗f</el-button>
+ <el-button
+ v-waves
+ :size="buttonSize"
+ icon="el-icon-refresh-right"
+ @click="syncERP"
+ >鍚屾瀛樿揣妗f
+ </el-button>
</div>
</div>
@@ -79,19 +102,31 @@
<el-form
ref="form"
:model="form"
- label-width="100px"
+ :label-width="buttonSize==='medium'?'100px':'80px'"
inline
style="display: flex;"
>
<div class="elForm">
<el-form-item label="瀛樿揣缂栫爜" style=" display: flex;">
- <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" />
+ <el-input
+ v-model="form.partcode"
+ placeholder="璇疯緭鍏�"
+ :style="{minWidth:'100px',width:formItemWidth+'px'}"
+ />
</el-form-item>
<el-form-item label="瀛樿揣鍚嶇О" style=" display: flex;">
- <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" />
+ <el-input
+ v-model="form.partname"
+ placeholder="璇疯緭鍏�"
+ :style="{minWidth:'100px',width:formItemWidth+'px'}"
+ />
</el-form-item>
<el-form-item label="瀛樿揣瑙勬牸" style=" display: flex;">
- <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" />
+ <el-input
+ v-model="form.partspec"
+ placeholder="璇疯緭鍏�"
+ :style="{minWidth:'100px',width:formItemWidth+'px'}"
+ />
</el-form-item>
<!-- <el-form-item label="鐢ㄦ埛缂栫爜" style=" display: flex;">-->
<!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />-->
@@ -118,12 +153,20 @@
>
<el-button
v-waves
+ :size="buttonSize"
type="primary"
icon="el-icon-search"
@click="getTMaterielData($refs.treeLeftRef.getCurrentNode())"
>鏌ヨ
</el-button>
- <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
+ <el-button
+ v-waves
+ :size="buttonSize"
+ type="info"
+ icon="el-icon-refresh"
+ @click="reset"
+ >閲嶇疆
+ </el-button>
</div>
</el-form>
<div
@@ -158,12 +201,21 @@
highlight-current-row
:header-cell-style="this.$headerCellStyle"
:cell-style="this.$cellStyle"
+ row-key="partcode"
@sort-change="sortChange"
+ @select="handleSelectionChange"
+ @select-all="handleAllChange"
>
<!-- prop="RowNum"-->
<el-table-column
- prop="rowNum"
+ type="selection"
width="50"
+ :reserve-selection="true"
+ fixed
+ />
+ <el-table-column
+ prop="rowNum"
+ width="70"
fixed
label="搴忓彿"
/>
@@ -190,68 +242,6 @@
{{ row.partspec ? row.partspec : '/' }}
</template>
</el-table-column>
-
-<!-- <el-table-column-->
-<!-- prop="priuserdefnvc1"-->
-<!-- label="瀹㈡埛鍚嶇О"-->
-<!-- width="110"-->
-<!-- sortable="custom"-->
-<!-- >-->
-<!-- <template slot-scope="{row}">-->
-<!-- {{ row.priuserdefnvc1 ? row.priuserdefnvc1 : '/' }}-->
-<!-- </template>-->
-<!-- </el-table-column>-->
-<!-- <el-table-column-->
-<!-- prop="priuserdefnvc6"-->
-<!-- label="瀹㈡埛缂栫爜"-->
-<!-- width="110"-->
-<!-- sortable="custom"-->
-<!-- >-->
-<!-- <template slot-scope="{row}">-->
-<!-- {{ row.priuserdefnvc6 ? row.priuserdefnvc6 : '/' }}-->
-<!-- </template>-->
-<!-- </el-table-column>-->
-<!-- <el-table-column-->
-<!-- prop="priuserdefnvc2"-->
-<!-- label="瀵瑰唴鍚嶇О"-->
-<!-- width="110"-->
-<!-- sortable="custom"-->
-<!-- >-->
-<!-- <template slot-scope="{row}">-->
-<!-- {{ row.priuserdefnvc2 ? row.priuserdefnvc2 : '/' }}-->
-<!-- </template>-->
-<!-- </el-table-column>-->
-<!-- <el-table-column-->
-<!-- prop="priuserdefnvc3"-->
-<!-- label="CTP鏃ユ湡"-->
-<!-- width="110"-->
-<!-- sortable="custom"-->
-<!-- >-->
-<!-- <template slot-scope="{row}">-->
-<!-- {{ row.priuserdefnvc3 ? row.priuserdefnvc3 : '/' }}-->
-<!-- </template>-->
-<!-- </el-table-column>-->
-<!-- <el-table-column-->
-<!-- prop="priuserdefnvc4"-->
-<!-- label="閽㈠垁缂栧彿"-->
-<!-- width="110"-->
-<!-- sortable="custom"-->
-<!-- >-->
-<!-- <template slot-scope="{row}">-->
-<!-- {{ row.priuserdefnvc4 ? row.priuserdefnvc4 : '/' }}-->
-<!-- </template>-->
-<!-- </el-table-column>-->
-<!-- <el-table-column-->
-<!-- prop="priuserdefnvc5"-->
-<!-- label="鐩掑瀷"-->
-<!-- width="110"-->
-<!-- sortable="custom"-->
-<!-- >-->
-<!-- <template slot-scope="{row}">-->
-<!-- {{ row.priuserdefnvc5 ? row.priuserdefnvc5 : '/' }}-->
-<!-- </template>-->
-<!-- </el-table-column>-->
-
<el-table-column
prop="idinventoryclassname"
label="鎵�灞炵被鍒�"
@@ -415,9 +405,14 @@
<span slot="footer" class="dialog-footer">
<div class="footerButton">
- <el-button v-waves @click="dialogVisibleClassCancel">鍙� 娑�</el-button>
<el-button
v-waves
+ :size="buttonSize"
+ @click="dialogVisibleClassCancel"
+ >鍙� 娑�</el-button>
+ <el-button
+ v-waves
+ :size="buttonSize"
type="primary"
:loading="$store.state.app.buttonIsDisabled"
:disabled="$store.state.app.buttonIsDisabled"
@@ -646,9 +641,14 @@
<span slot="footer" class="dialog-footer">
<div class="footerButton">
- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>
<el-button
v-waves
+ :size="buttonSize"
+ @click="dialogVisibleCancel"
+ >鍙� 娑�</el-button>
+ <el-button
+ v-waves
+ :size="buttonSize"
type="primary"
:loading="$store.state.app.buttonIsDisabled"
:disabled="$store.state.app.buttonIsDisabled"
@@ -686,7 +686,7 @@
:key="item.code"
:style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme:'1px solid #eee'}"
class="myCheckbox"
- @click="myCheckboxClick(item)"
+ @click="myCheckboxClick(item,'single')"
>
<!-- <input-->
<!-- class="myCheckboxInput"-->
@@ -706,7 +706,7 @@
:name="item.name"
:label="item.name"
:checked="item.isSelected2"
- @change="myCheckboxInputClick(item)"
+ @change="myCheckboxInputClick(item,'single')"
/>
<div class="myCheckboxInputLabel">{{ item.name }}</div>
@@ -785,10 +785,15 @@
</div>
<span slot="footer" class="dialog-footer">
<div class="footerButton">
- <el-button v-waves @click="routeDialogVisibleCancel">鍙� 娑�</el-button>
+ <el-button
+ v-waves
+ :size="buttonSize"
+ @click="routeDialogVisibleCancel"
+ >鍙� 娑�</el-button>
<el-button
v-waves
type="primary"
+ :size="buttonSize"
:loading="$store.state.app.buttonIsDisabled"
:disabled="$store.state.app.buttonIsDisabled"
@click="routeDialogVisibleConfirm"
@@ -900,9 +905,14 @@
<span slot="footer" class="dialog-footer">
<div class="footerButton">
- <el-button v-waves @click="stepDialogVisibleCancel">鍙� 娑�</el-button>
<el-button
v-waves
+ :size="buttonSize"
+ @click="stepDialogVisibleCancel"
+ >鍙� 娑�</el-button>
+ <el-button
+ v-waves
+ :size="buttonSize"
type="primary"
:loading="$store.state.app.buttonIsDisabled"
:disabled="$store.state.app.buttonIsDisabled"
@@ -911,6 +921,290 @@
</div>
</span>
</el-dialog>
+
+ <!-- 鎵归噺缁戝畾宸ヨ壓璺嚎瀵硅瘽妗�-->
+ <el-dialog
+ v-el-drag-dialog
+ :close-on-click-modal="false"
+ title="鎵归噺鍏宠仈宸ヨ壓璺嚎"
+ :visible.sync="dialogVisibleBatchRoute"
+ width="1430px"
+ top="5vh"
+ class="dialogVisibleRoute"
+ @closed="handleCloseBatchRoute"
+ @close="handleCloseBatchRoute"
+ >
+
+ <div style="display: flex">
+ <div style="width:600px;height: 600px;overflow: auto;margin-right: 30px">
+ <div style="margin-bottom: 10px;">
+ <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 浜у搧鍚嶇О锛�
+ </div>
+ <div class="batchPortCode">
+ <el-button
+ v-for="(i,index) in batchRouteData"
+ :key="i.partcode"
+ :type="!i.defalutroutecode?'warning':'success'"
+ :plain="batchRouteDataSelectedIndex!==index"
+ style="margin-bottom: 10px"
+ @click="partcodeSelected(i,index)"
+ >{{ i.partname }}
+ </el-button>
+ <!-- <el-button v-for="i in 100" type="success" plain style="margin-bottom: 10px">鎴愬姛鎸夐挳{{ i }}</el-button>-->
+ </div>
+ </div>
+ <div style="width:calc(100% - 460px)">
+ <div style="margin-bottom: 10px">
+ <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 宸ヨ壓璺嚎闆嗗悎
+ </div>
+
+ <div class="myCheckboxGroup">
+ <!-- v-for="item in batchRouteDataSelected"-->
+ <div
+ v-for="item in batchRouteDataSelected"
+ :key="item.routecode"
+ class="myCheckbox"
+ :style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme:'1px solid #eee'}"
+ @click="myCheckboxClick(item,'batch')"
+ >
+
+ <!-- <input-->
+ <!-- class="myCheckboxInput"-->
+ <!-- type="checkbox"-->
+ <!-- :value="item.code"-->
+ <!-- :name="item.name"-->
+ <!-- :style="{color:item.isSelected2?'#42b983':'#fff'}"-->
+ <!-- @click="myCheckboxInputClick(item)"-->
+ <!-- >{{ item.name }}-->
+ <!-- 鐖跺瓙鐐瑰嚮浜嬩欢涓嶅奖鍝�-->
+ <!-- onClick="event.cancelBubble = true"-->
+ <el-checkbox
+ :key="item.routecode"
+ v-model="item.isSelected2"
+ :checked="item.isSelected2"
+ class="myCheckboxInput"
+ :value="item.routecode"
+ :name="item.routename"
+ :label="item.routename"
+ @change="myCheckboxInputClick(item,'batch')"
+ />
+
+ <div class="myCheckboxInputLabel">{{ item.routename }}</div>
+
+ </div>
+ </div>
+
+ <el-divider />
+ <div>
+ <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 榛樿宸ヨ壓璺嚎
+ </div>
+ <div style="margin-top: 20px">
+ <el-select
+ v-model="defaultroute_code"
+ filterable
+ style="width: 200px;"
+ placeholder="璇烽�夋嫨"
+ class="defaultroute_code"
+ @change="batchRouteChange"
+ >
+ <el-option
+ v-for="item in defaultroute_codeArr"
+ :key="item.routecode"
+ :label="item.routename"
+ :value="item.routecode"
+ />
+ </el-select>
+ </div>
+ <el-divider />
+ <div style="margin-bottom: 10px">
+ <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 宸ュ簭鍒楄〃
+ </div>
+ <div style="overflow-y: scroll">
+ <el-table
+ ref="projectTableData"
+ :data="projectTableData"
+ border
+ height="280"
+ :row-class-name="tableRowClassName"
+ highlight-current-row
+ :header-cell-style="this.$headerCellStyle"
+ :cell-style="this.$cellStyle"
+ >
+ <el-table-column
+ prop="seq"
+ width="100"
+ label="宸ュ簭搴忓彿"
+ fixed
+ />
+ <el-table-column
+ prop="stepcode"
+ show-tooltip-when-overflow
+ label="宸ュ簭缂栫爜"
+ />
+ <el-table-column
+ prop="stepname"
+ label="宸ュ簭鍚嶇О"
+ show-tooltip-when-overflow
+ />
+ <el-table-column
+ prop="enable"
+ label="鍚敤鐘舵��"
+ show-tooltip-when-overflow
+ fixed="right"
+ >
+ <template slot-scope="{row}">
+ <div v-if="row.enable==='Y'">
+ <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
+ 鏄�
+ </div>
+ <div v-if="row.enable==='N'">
+ <i class="el-icon-info" style="margin-right: 2px" />
+ 鍚�
+ </div>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+ </div>
+ </div>
+ <span slot="footer" class="dialog-footer">
+ <div class="footerButton">
+ <el-button
+ v-waves
+ :size="buttonSize"
+ @click="batchRouteDialogVisibleCancel"
+ >鍙� 娑�</el-button>
+ <el-button
+ v-waves
+ type="primary"
+ :size="buttonSize"
+ :loading="$store.state.app.buttonIsDisabled"
+ :disabled="$store.state.app.buttonIsDisabled"
+ @click="batchRouteDialogVisibleConfirm"
+ >纭� 瀹�</el-button>
+ </div>
+ </span>
+ </el-dialog>
+
+ <!-- 鎸夊伐鑹鸿蛋 鎵归噺缁戝畾宸ヨ壓 鎸夊伐搴忚蛋瀵硅瘽妗�-->
+ <el-dialog
+ v-el-drag-dialog
+ :close-on-click-modal="false"
+ title="鍏宠仈宸ュ簭"
+ :visible.sync="dialogVisibleBatchStep"
+ width="1430px"
+ top="5vh"
+ class="dialogVisibleStep"
+ @closed="handleCloseBatchStep"
+ @close="handleCloseBatchStep"
+ >
+ <div style="display: flex">
+ <div style="width:600px;height: 600px;overflow: auto;margin-right: 30px">
+ <div style="margin-bottom: 10px;">
+ <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 浜у搧鍚嶇О锛�
+ </div>
+ <div class="batchPortCode">
+ <el-button
+ v-for="(i,index) in batchRouteData"
+ :key="i.partcode"
+ :type="i.children.length===0?'warning':'success'"
+ :plain="batchRouteDataSelectedIndex!==index"
+ style="margin-bottom: 10px"
+ @click="partcodeStepSelected(i,index)"
+ >{{ i.partname }}
+ </el-button>
+ </div>
+ </div>
+ <div>
+ <div style="display: flex;align-items: center">
+ <div style="font-weight: bolder">宸ュ簭閫夋嫨锛�</div>
+ <!-- <el-drag-select-->
+ <el-select
+ v-model="batchStepSelectedValue"
+ style="width:570px;"
+ multiple
+ placeholder="璇烽�夋嫨鐩稿搴斿伐搴�"
+ @change="batchStepSelectedValueChange"
+ >
+ <el-option
+ v-for="item in stepSelectArr"
+ :key="item.stepcode"
+ :label="item.stepname"
+ :value="item.stepcode"
+ />
+ </el-select>
+ </div>
+ <el-table
+ ref="stepTableDataRef"
+ :data="stepTableData"
+ border
+ :row-class-name="tableRowClassName"
+ height="300"
+ style="width: 100%;margin-top: 15px;"
+ highlight-current-row
+ :header-cell-style="this.$headerCellStyle"
+ :cell-style="this.$cellStyle"
+ row-key="stepcode"
+ >
+ <el-table-column
+ type="index"
+ label="搴忓彿"
+ width="50"
+ />
+ <el-table-column
+ prop="step_code"
+ show-tooltip-when-overflow
+ label="宸ュ簭缂栫爜"
+ />
+ <el-table-column
+ prop="step_name"
+ label="宸ュ簭鍚嶇О"
+ show-tooltip-when-overflow
+ />
+ <el-table-column
+ label="鎿嶄綔"
+ width="120"
+ >
+ <template slot-scope="{row}">
+ <div class="operationClass">
+ <!-- <i-->
+ <!-- class="el-icon-rank"-->
+ <!-- :style="{color:$store.state.settings.theme}"-->
+ <!-- style="cursor: move"-->
+ <!-- />-->
+ <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
+ <i
+ class="el-icon-delete"
+ :style="{color:$store.state.settings.theme}"
+ style="margin-left: 15px;"
+ @click="batchStepDel(row)"
+ />
+ </el-tooltip>
+ </div>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+ </div>
+ <span slot="footer" class="dialog-footer">
+ <div class="footerButton">
+ <el-button
+ v-waves
+ :size="buttonSize"
+ @click="batchStepDialogVisibleCancel"
+ >鍙� 娑�</el-button>
+ <el-button
+ v-waves
+ :size="buttonSize"
+ type="primary"
+ :loading="$store.state.app.buttonIsDisabled"
+ :disabled="$store.state.app.buttonIsDisabled"
+ @click="batchStepDialogVisibleConfirm"
+ >纭� 瀹�</el-button>
+ </div>
+ </span>
+ </el-dialog>
+
</div>
</template>
@@ -920,12 +1214,12 @@
import { validateCode } from '@/utils/global'
import elDragDialog from '@/directive/el-drag-dialog'
import {
- SaveTMaterielFile,
+ SaveTMaterielFile, SaveTMaterielFileList,
TMaterielAddUpdate,
TMaterielClassTree,
TMaterielClassTreeAddUpdate,
TMaterielClassTreeDelete,
- TMaterielData, TMaterielDelete, TMaterielFileAssociationRoute
+ TMaterielData, TMaterielDelete, TMaterielFileAssociationRoute, TMaterielFileAssociationRouteList
} from '@/api/ProductModel'
import arrayToTree from 'array-to-tree'
import { StepData, UnitSerch, WareHouse } from '@/api/GeneralBasicData'
@@ -946,6 +1240,8 @@
isExpandForm: false,
mainHeight: 0,
tableHeight: 0,
+ buttonSize: '',
+ formItemWidth: 0,
operation: '',
treeLeft: [
@@ -1056,7 +1352,16 @@
stepTableData: [],
sortable: null,
stepSelectArr: [], // 宸ュ簭涓嬫媺鏁版嵁
- stepSelectedValue: [] // 宸ュ簭涓嬫媺閫変腑鍊�
+ stepSelectedValue: [], // 宸ュ簭涓嬫媺閫変腑鍊�
+
+ multipleSelection: [], // 鐢ㄤ簬鎵归噺缁戝畾宸ヨ壓璺嚎
+ dialogVisibleBatchRoute: false,
+ batchRouteData: [], // 鎵归噺宸ヨ壓璺嚎浜у搧鍚嶇О
+ batchRouteDataSelected: [], // 宸︿晶浜у搧閫変腑鍊� 甯﹀嚭鍙充晶宸ヨ壓璺嚎
+ batchRouteDataSelectedIndex: 0, // 宸︿晶浜у搧閫変腑鍊� 甯﹀嚭鍙充晶宸ヨ壓璺嚎
+
+ dialogVisibleBatchStep: false,
+ batchStepSelectedValue: []
}
},
watch: {
@@ -1081,12 +1386,6 @@
}
},
- activated() {
- window.addEventListener('resize', this.getHeight)
- this.getHeight()
- this.getTMaterielClassTree()
- this.getSelectApi()
- },
created() {
},
@@ -1185,6 +1484,199 @@
return 'custom-row'
},
+ // 鎵归噺缁戝畾宸ュ簭
+ handleCloseBatchStep() {
+
+ },
+
+ batchStepSelectedValueChange(val) {
+ console.log(val)
+ this.batchRouteData[this.batchRouteDataSelectedIndex].children = [{ Data: [] }]
+ val.forEach(i => {
+ this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.push(
+ {
+ step_code: i,
+ step_name: this.stepSelectArr.find(j => j.stepcode === i).stepname
+ // stepprice: arrStepcode.includes(i) ? arr.find(j => j.stepcode === i).stepprice : 0
+ }
+ )
+ })
+ this.stepTableData = this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data
+ },
+
+ batchStepDel(row) {
+ const index = this.batchStepSelectedValue.findIndex(i => i === row.step_code)
+ this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.splice(index, 1)
+
+ if (this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.length > 0) {
+ this.batchStepSelectedValue = this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.map(i => i.step_code)
+ } else {
+ this.batchStepSelectedValue = []
+ }
+ },
+
+ batchStepDialogVisibleCancel() {
+ this.dialogVisibleBatchStep = false
+ },
+ async batchStepDialogVisibleConfirm() {
+ let flag = false
+ const data = []
+ this.batchRouteData.forEach(i => {
+ if (i.children.length === 0 || i.children[0].Data.length === 0) {
+ flag = true
+ }
+ const children = []
+ if (i.children.length > 0 && i.children[0].Data.length > 0) {
+ i.children[0].Data.forEach((it, index) => {
+ children.push({
+ 'code': it.step_code,
+ 'name': it.step_name,
+ 'seq': index + 1,
+ 'isbott': index === 0 ? 'Y' : 'N',
+ 'isend': index === i.children[0].Data.length - 1 ? 'Y' : 'N'
+ })
+ })
+ }
+ data.push({
+ partcode: i.partcode,
+ 'defaultroute_code': '',
+ children
+ })
+ })
+ if (flag) {
+ return this.$message('鏈夊瓨璐ф湭缁戝畾宸ヨ壓锛岃鍏堢粦瀹氾紒')
+ }
+ this.$store.state.app.buttonIsDisabled = true
+ const res = await SaveTMaterielFileList(data)
+ if (res.code === '200') {
+ this.$store.state.app.buttonIsDisabled = false
+ this.dialogVisibleBatchStep = false
+ this.$message.success('淇濆瓨鎴愬姛锛�')
+ // await this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode())
+ this.$refs.tableDataRef.clearSelection() // 娓呯┖澶嶉�夋閫夋嫨
+ await this.getTMaterielClassTree()
+ }
+ },
+
+ partcodeStepSelected(val, index) {
+ this.batchRouteDataSelectedIndex = index
+ this.batchStepSelectedValue = this.batchRouteData[this.batchRouteDataSelectedIndex].children.length > 0 ? this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.map(i => i.step_code) : ''
+ this.stepTableData = this.batchRouteData[this.batchRouteDataSelectedIndex].children.length > 0 ? this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data : []
+ },
+
+ // 鎵归噺缁戝畾宸ヨ壓璺嚎
+ async batchRouteClick() {
+ const res = await TMaterielFileAssociationRouteList(this.multipleSelection.map(i => i.partcode))
+ if (res.code === '200') {
+ if (this.mesSetting.route) { // 鎸夊伐鑹鸿矾绾�
+ this.batchRouteData = res.data
+ this.batchRouteDataSelected = this.batchRouteData[0].children
+ this.batchRouteDataSelectedIndex = 0
+ this.batchRouteData[this.batchRouteDataSelectedIndex].children.forEach((item, index) => {
+ item.isSelected1 = false
+ item.isSelected2 = false
+ if (index === 0) {
+ item.isSelected1 = true
+ this.projectTableData = item.Data
+ }
+ // if (item.flag === 'Y' || item.flag) {
+ if (item.flag === 'Y') {
+ item.isSelected2 = true
+ this.$nextTick(() => {
+ $('input:checkbox').eq(index).prop('checked', true)
+ })
+ }
+ })
+ this.defaultroute_codeArr = this.batchRouteData[this.batchRouteDataSelectedIndex].children.filter(item => item.isSelected2)
+ this.defaultroute_code = this.batchRouteData[this.batchRouteDataSelectedIndex].defalutroutecode
+ this.dialogVisibleBatchRoute = true
+ }
+
+ if (!this.mesSetting.route) { // 鎸夊伐搴�
+ this.batchRouteData = res.data
+ this.batchRouteDataSelectedIndex = 0
+ this.batchStepSelectedValue = this.batchRouteData[this.batchRouteDataSelectedIndex].children.length > 0 ? this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.map(i => i.step_code) : ''
+ this.stepTableData = this.batchRouteData[this.batchRouteDataSelectedIndex].children.length > 0 ? this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data : []
+ this.dialogVisibleBatchStep = true
+ }
+ }
+ },
+ batchRouteDialogVisibleCancel() {
+ this.dialogVisibleBatchRoute = false
+ },
+ async batchRouteDialogVisibleConfirm() {
+ const data = []
+ const descr = []
+ this.batchRouteData.forEach(i => {
+ if (!i.defalutroutecode) {
+ descr.push(i.partcode + ' ' + i.partname)
+ }
+ const children = []
+ if (i.children && i.children.length) {
+ i.children.forEach(it => {
+ if (it.flag === 'Y' || it.flag === true) {
+ children.push({
+ code: it.routecode,
+ name: it.routename
+ })
+ }
+ })
+ }
+ data.push({ partcode: i.partcode, defaultroute_code: i.defalutroutecode, children })
+ })
+ if (descr.length > 0) {
+ // return this.$message(descr.toString() + '鏈粦瀹氶粯璁ゅ伐鑹鸿矾绾匡紝璇峰厛缁戝畾锛�')
+ return this.$message('鏈夊瓨璐ф湭缁戝畾榛樿宸ヨ壓璺嚎锛岃鍏堢粦瀹氾紒')
+ }
+ this.$store.state.app.buttonIsDisabled = true
+ const res = await SaveTMaterielFileList(data)
+ if (res.code === '200') {
+ this.$store.state.app.buttonIsDisabled = false
+ this.dialogVisibleBatchRoute = false
+ this.$message.success('鎻愪氦鎴愬姛锛�')
+ this.$refs.tableDataRef.clearSelection() // 娓呯┖澶嶉�夋閫夋嫨
+ await this.getTMaterielClassTree()
+ }
+ },
+ handleCloseBatchRoute() {
+ this.defaultroute_code = ''
+ this.defaultroute_codeArr = []
+ this.batchRouteData = []
+ },
+ partcodeSelected(val, index) {
+ this.batchRouteDataSelected = val.children
+ this.batchRouteDataSelectedIndex = index
+ this.batchRouteData[this.batchRouteDataSelectedIndex].children.forEach((item, index) => {
+ item.isSelected1 = false
+ item.isSelected2 = false
+
+ if (index === 0) {
+ item.isSelected1 = true
+ this.projectTableData = item.Data
+ }
+ if (item.flag === 'Y' || item.flag === true) {
+ item.isSelected2 = true
+ this.$nextTick(() => {
+ $('input:checkbox').eq(index).prop('checked', true)
+ })
+ }
+ })
+ this.defaultroute_codeArr = this.batchRouteData[this.batchRouteDataSelectedIndex].children.filter(item => item.isSelected2)
+ this.defaultroute_code = this.batchRouteData[this.batchRouteDataSelectedIndex].defalutroutecode
+ // this.$forceUpdate()
+ },
+ batchRouteChange(val) {
+ this.batchRouteData[this.batchRouteDataSelectedIndex].defalutroutecode = val
+ },
+ // 杩欓噷鏄仛鍗曢」閫夋嫨涓庡崟椤瑰弽閫夌殑 閫夋嫨锛氭墦鍕炬垨鍙栨秷
+ handleSelectionChange(selected, row) {
+ this.multipleSelection = selected
+ },
+ // 鍏ㄩ�夈�佸彇娑堝叏閫夛紙鍘熺悊鍚屼笂闈㈢殑鍗曢�夛級
+ handleAllChange(selected) {
+ this.multipleSelection = selected
+ },
+
/* 鐐瑰嚮鍏宠仈宸ヨ壓璺嚎妯″潡*/
// 宸ヨ壓璺嚎鐐瑰嚮
routeClick(row) {
@@ -1281,28 +1773,56 @@
}
},
// 澶х洅瀛愮偣鍑讳簨浠�
- myCheckboxClick(val) {
+ myCheckboxClick(val, type) {
console.log(val, 1)
- this.dialogFormRoute.routeOperationArr.forEach(item => {
- item.isSelected1 = val.code === item.code
- })
+
+ if (type === 'single') {
+ this.dialogFormRoute.routeOperationArr.forEach(item => {
+ item.isSelected1 = val.code === item.code
+ })
+ }
+
+ if (type === 'batch') {
+ this.batchRouteData[this.batchRouteDataSelectedIndex].children.forEach(item => {
+ item.isSelected1 = val.routecode === item.routecode
+ })
+ }
this.projectTableData = val.Data
},
// 灏忕洅瀛愮偣鍑讳簨浠�
- myCheckboxInputClick(val) {
- // console.log(val, 2)
+ myCheckboxInputClick(val, type) {
val.isSelected2 = !!val.isSelected2
-
- this.dialogFormRoute.routeOperationArr.forEach((item, index) => {
- if (val.code === item.code) {
- item.flag = !item.flag
+ console.log(val, 2)
+ if (type === 'single') {
+ this.dialogFormRoute.routeOperationArr.forEach((item, index) => {
+ if (val.code === item.code) {
+ item.flag = !item.flag
+ }
+ })
+ if (val.code === this.defaultroute_code) {
+ this.defaultroute_code = ''
}
- })
- if (val.code === this.defaultroute_code) {
- this.defaultroute_code = ''
+ this.defaultroute_codeArr = this.dialogFormRoute.routeOperationArr.filter(item => item.isSelected2)
}
- this.defaultroute_codeArr = this.dialogFormRoute.routeOperationArr.filter(item => item.isSelected2)
+
+ if (type === 'batch') {
+ this.batchRouteData[this.batchRouteDataSelectedIndex].children.forEach(item => {
+ if (val.routecode === item.routecode) {
+ item.flag = val.isSelected2
+ }
+ })
+
+ if (val.routecode === this.defaultroute_code) {
+ this.defaultroute_code = ''
+ this.batchRouteData[this.batchRouteDataSelectedIndex].defalutroutecode = ''
+ }
+
+ this.defaultroute_codeArr = this.batchRouteData[this.batchRouteDataSelectedIndex].children.filter(item => item.isSelected2)
+ }
+ this.$forceUpdate()
+ console.log(JSON.parse(JSON.stringify(this.batchRouteData[this.batchRouteDataSelectedIndex].children)), 999)
+ console.log(JSON.parse(JSON.stringify(this.batchRouteData)), 998)
},
async getSelectApi() {
@@ -1357,6 +1877,13 @@
this.$nextTick(() => {
this.mainHeight = window.innerHeight - 85
this.tableHeight = this.mainHeight - 280
+ this.formItemWidth = window.innerWidth / 10
+ if (window.innerWidth <= 1500 || window.innerHeight <= 900) {
+ this.buttonSize = 'small'
+ } else {
+ this.buttonSize = 'medium'
+ }
+
this.$refs.tableDataRef.doLayout()
})
},
@@ -1771,4 +2298,16 @@
align-items: center !important;
}
+.batchPortCode {
+ display: flex;
+ flex-wrap: wrap;
+ margin-left: -10px;
+}
+
+.batchPortCode {
+ ::v-deep button {
+ margin-left: 10px !important;
+ }
+}
+
</style>
--
Gitblit v1.9.3