From d20654ba067e5c0621d4d7d95915cbe47a10fe87 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期四, 08 八月 2024 17:23:48 +0800
Subject: [PATCH] 1.正清和 增加页面缓存处理
---
src/views/makeModel/InventoryList.vue | 286 +++++++++++++++++++++++++++++++++++---------------------
1 files changed, 178 insertions(+), 108 deletions(-)
diff --git a/src/views/makeModel/InventoryList.vue b/src/views/makeModel/InventoryList.vue
index 6affcad..908d680 100644
--- a/src/views/makeModel/InventoryList.vue
+++ b/src/views/makeModel/InventoryList.vue
@@ -48,21 +48,28 @@
<el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" />
</el-form-item>
<el-form-item label="瀛樿揣绫诲瀷" style=" display: flex;">
- <el-select
- v-model="form.stocktypecode"
+ <el-cascader
+ ref="cascader"
+ :options="stocktypeArr"
filterable
- :popper-append-to-body="false"
- style="width: 200px"
- placeholder="璇烽�夋嫨"
- >
- <!-- @change="val=>stocktypecodeChange(val,'form')"-->
- <el-option
- v-for="item in stocktypeArr"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- />
- </el-select>
+ :props="defaultProps"
+ @change="val=>cascaderChange(val,'form')"
+ />
+ <!-- <el-select-->
+ <!-- v-model="form.stocktypecode"-->
+ <!-- filterable-->
+ <!-- :popper-append-to-body="false"-->
+ <!-- style="width: 200px"-->
+ <!-- placeholder="璇烽�夋嫨"-->
+ <!-- >-->
+ <!-- <!– @change="val=>stocktypecodeChange(val,'form')"–>-->
+ <!-- <el-option-->
+ <!-- v-for="item in stocktypeArr"-->
+ <!-- :key="item.code"-->
+ <!-- :label="item.name"-->
+ <!-- :value="item.code"-->
+ <!-- />-->
+ <!-- </el-select>-->
</el-form-item>
<el-form-item v-if="false" label="鐗╂枡绫诲瀷" style=" display: flex;">
<el-select
@@ -272,22 +279,31 @@
</el-select>
</el-form-item>
<el-form-item label="瀛樿揣绫诲瀷" prop="stocktypecode">
- <el-select
- v-model="dialogForm.stocktypecode"
- filterable
- :popper-append-to-body="false"
- style="width: 200px"
- placeholder="璇烽�夋嫨"
- >
- <!-- @change="val=>stocktypecodeChange(val,'dialogForm')"-->
- <el-option
- v-for="item in stocktypeArr"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- />
- </el-select>
+ <el-cascader
+ ref="cascaderDialog"
+ :options="stocktypeArr"
+ filterable
+ :props="defaultPropsDialog"
+ @change="val=>cascaderChange(val,'dialogForm')"
+ />
+
+ <!-- <el-select-->
+ <!-- v-model="dialogForm.stocktypecode"-->
+ <!-- filterable-->
+ <!-- :popper-append-to-body="false"-->
+ <!-- style="width: 200px"-->
+ <!-- placeholder="璇烽�夋嫨"-->
+ <!-- >-->
+ <!-- <!– @change="val=>stocktypecodeChange(val,'dialogForm')"–>-->
+
+ <!-- <el-option-->
+ <!-- v-for="item in stocktypeArr"-->
+ <!-- :key="item.code"-->
+ <!-- :label="item.name"-->
+ <!-- :value="item.code"-->
+ <!-- />-->
+ <!-- </el-select>-->
</el-form-item>
<el-form-item label="鎵�灞炰粨搴�" prop="warehousecode">
<el-select
@@ -336,85 +352,85 @@
</el-form-item>
</el-form>
- <el-collapse>
- <el-collapse-item title="涓�鑷存�� Consistency" name="1">
- <template slot="title">
- <div>
- <i
- class="el-icon-s-operation"
- :style="{color:$store.state.settings.theme}"
- style="margin: -20px 10px 20px 20px"
- />楂樼骇璁剧疆锛�
- </div>
- </template>
- <div
- style="display: flex;flex-direction: column;height: 140px; align-content: center;justify-content: space-between"
- >
- <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">
- <div>
- <el-tooltip
- class="item"
- effect="dark"
- content=""
- placement="top"
- >
- <div slot="content" style="width: 300px">
- 鍚敤绠$悊鍚庡簱瀛樻暟閲忎細鎸夋爣绛惧垎寮�鏄剧ず锛岄渶瑕佸仛閲囪喘鍒拌揣鎵嶈兘鍏ュ簱锛屼笖鐢熶骇鍙戞枡闇�瑕佹壂鐮佹爣绛捐繘琛屽彂鏂欙紝涓嶅惎鐢ㄦ壒娆$鐞嗙殑涓嶉渶瑕侀噰璐埌璐э紝鍙互鐩存帴閫夋嫨鐗╂枡閲囪喘鍏ュ簱锛屼笖鍏ュ簱鍚庝細鍚堝苟鏄剧ず璇ョ墿鏂欑殑搴撳瓨锛岀敓浜у彂鏂欏垯鎸夊簱浣嶈繘琛屽嚭搴撱��
- </div>
- <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />
- </el-tooltip>
- </div>
+ <!-- <el-collapse>-->
+ <!-- <el-collapse-item title="涓�鑷存�� Consistency" name="1">-->
+ <!-- <template slot="title">-->
+ <!-- <div>-->
+ <!-- <i-->
+ <!-- class="el-icon-s-operation"-->
+ <!-- :style="{color:$store.state.settings.theme}"-->
+ <!-- style="margin: -20px 10px 20px 20px"-->
+ <!-- />楂樼骇璁剧疆锛�-->
+ <!-- </div>-->
+ <!-- </template>-->
+ <!-- <div-->
+ <!-- style="display: flex;flex-direction: column;height: 140px; align-content: center;justify-content: space-between"-->
+ <!-- >-->
+ <!-- <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">-->
+ <!-- <div>-->
+ <!-- <el-tooltip-->
+ <!-- class="item"-->
+ <!-- effect="dark"-->
+ <!-- content=""-->
+ <!-- placement="top"-->
+ <!-- >-->
+ <!-- <div slot="content" style="width: 300px">-->
+ <!-- 鍚敤绠$悊鍚庡簱瀛樻暟閲忎細鎸夋爣绛惧垎寮�鏄剧ず锛岄渶瑕佸仛閲囪喘鍒拌揣鎵嶈兘鍏ュ簱锛屼笖鐢熶骇鍙戞枡闇�瑕佹壂鐮佹爣绛捐繘琛屽彂鏂欙紝涓嶅惎鐢ㄦ壒娆$鐞嗙殑涓嶉渶瑕侀噰璐埌璐э紝鍙互鐩存帴閫夋嫨鐗╂枡閲囪喘鍏ュ簱锛屼笖鍏ュ簱鍚庝細鍚堝苟鏄剧ず璇ョ墿鏂欑殑搴撳瓨锛岀敓浜у彂鏂欏垯鎸夊簱浣嶈繘琛屽嚭搴撱��-->
+ <!-- </div>-->
+ <!-- <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />-->
+ <!-- </el-tooltip>-->
+ <!-- </div>-->
- <div style="margin: 0 3px">鎵规绠$悊锛�</div>
- <el-switch
- v-model="isBatchNo"
- />
- </div>
- <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">
- <div style="margin: 0 3px">鍏堣繘鍏堝嚭锛�</div>
- <el-switch
- v-model="isFifo"
- />
- </div>
- <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">
- <div>
- <el-tooltip
- class="item"
- effect="dark"
- content=""
- placement="top"
- >
- <div slot="content" style="width: 300px">寮�鍚悗璇ョ墿鏂欏繀椤诲仛鍏ュ巶妫�楠屾垨璐ㄩ噺鍒ゆ柇鍚堟牸鍚庢墠鑳藉仛鍏ュ巶鍙嶅垯璇ョ墿鏂欒川閲忕姸鎬佷负寰呮鐘舵�佹槸涓嶅厑璁稿叆鍘傜殑銆�</div>
- <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />
- </el-tooltip>
- </div>
+ <!-- <div style="margin: 0 3px">鎵规绠$悊锛�</div>-->
+ <!-- <el-switch-->
+ <!-- v-model="isBatchNo"-->
+ <!-- />-->
+ <!-- </div>-->
+ <!-- <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">-->
+ <!-- <div style="margin: 0 3px">鍏堣繘鍏堝嚭锛�</div>-->
+ <!-- <el-switch-->
+ <!-- v-model="isFifo"-->
+ <!-- />-->
+ <!-- </div>-->
+ <!-- <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">-->
+ <!-- <div>-->
+ <!-- <el-tooltip-->
+ <!-- class="item"-->
+ <!-- effect="dark"-->
+ <!-- content=""-->
+ <!-- placement="top"-->
+ <!-- >-->
+ <!-- <div slot="content" style="width: 300px">寮�鍚悗璇ョ墿鏂欏繀椤诲仛鍏ュ巶妫�楠屾垨璐ㄩ噺鍒ゆ柇鍚堟牸鍚庢墠鑳藉仛鍏ュ巶鍙嶅垯璇ョ墿鏂欒川閲忕姸鎬佷负寰呮鐘舵�佹槸涓嶅厑璁稿叆鍘傜殑銆�</div>-->
+ <!-- <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />-->
+ <!-- </el-tooltip>-->
+ <!-- </div>-->
- <div style="margin: 0 3px">鍏ュ巶妫�楠岋細</div>
- <el-switch
- v-model="isInCheck"
- />
- </div>
- <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">
- <div>
- <el-tooltip
- class="item"
- effect="dark"
- content=""
- placement="top"
- >
- <div slot="content" style="width: 300px">寮�鍚悗璇ョ墿鏂欏繀椤诲仛鍑哄巶妫�楠屾垨璐ㄩ噺鍒ゆ柇鍚堟牸鍚庢墠鑳藉仛鍑哄巶锛屽弽鍒欒鐗╂枡璐ㄩ噺鐘舵�佷负寰呮鐘舵�佹槸涓嶅厑璁稿嚭鍘傜殑銆�</div>
- <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />
- </el-tooltip>
- </div>
+ <!-- <div style="margin: 0 3px">鍏ュ巶妫�楠岋細</div>-->
+ <!-- <el-switch-->
+ <!-- v-model="isInCheck"-->
+ <!-- />-->
+ <!-- </div>-->
+ <!-- <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">-->
+ <!-- <div>-->
+ <!-- <el-tooltip-->
+ <!-- class="item"-->
+ <!-- effect="dark"-->
+ <!-- content=""-->
+ <!-- placement="top"-->
+ <!-- >-->
+ <!-- <div slot="content" style="width: 300px">寮�鍚悗璇ョ墿鏂欏繀椤诲仛鍑哄巶妫�楠屾垨璐ㄩ噺鍒ゆ柇鍚堟牸鍚庢墠鑳藉仛鍑哄巶锛屽弽鍒欒鐗╂枡璐ㄩ噺鐘舵�佷负寰呮鐘舵�佹槸涓嶅厑璁稿嚭鍘傜殑銆�</div>-->
+ <!-- <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />-->
+ <!-- </el-tooltip>-->
+ <!-- </div>-->
- <div style="margin: 0 3px">鍑哄巶妫�楠岋細</div>
- <el-switch
- v-model="isOutCheck"
- />
- </div>
- </div>
- </el-collapse-item>
- </el-collapse>
+ <!-- <div style="margin: 0 3px">鍑哄巶妫�楠岋細</div>-->
+ <!-- <el-switch-->
+ <!-- v-model="isOutCheck"-->
+ <!-- />-->
+ <!-- </div>-->
+ <!-- </div>-->
+ <!-- </el-collapse-item>-->
+ <!-- </el-collapse>-->
<!-- </div>-->
<span slot="footer" class="dialog-footer">
<div class="footerButton">
@@ -720,9 +736,10 @@
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import TableColumnSettings from '@/components/TableColumnSettings'
+import arrayToTree from 'array-to-tree'
export default {
- name: 'CHDA',
+ name: 'InventoryList',
components: {
Pagination, TableColumnSettings
},
@@ -981,7 +998,20 @@
isBatchNo: false, // 鏄惁鎵规绠$悊
isFifo: false, // 鏄惁鍏堣繘鍏堝嚭
isInCheck: false, // 鏄惁鍏ュ簱妫�楠�
- isOutCheck: false// 鏄惁鍑哄巶妫�楠�
+ isOutCheck: false, // 鏄惁鍑哄巶妫�楠�
+
+ defaultProps: {
+ checkStrictly: true,
+ expandTrigger: 'hover',
+ value: 'code',
+ label: 'name'
+ },
+ defaultPropsDialog: {
+ // checkStrictly: true,
+ expandTrigger: 'hover',
+ value: 'code',
+ label: 'name'
+ }
}
},
created() {
@@ -1079,6 +1109,34 @@
}, 10000)
}
},
+ cascaderChange(val, type) {
+ if (type === 'form') {
+ this.form.stocktypecode = val[val.length - 1]
+ }
+ if (type === 'dialogForm') {
+ this.dialogForm.stocktypecode = val[val.length - 1]
+ }
+ },
+ // parents:鐢ㄤ簬杩斿洖鐨勬暟缁勶紝childNode:瑕佹煡璇㈢殑鑺傜偣锛宼reeData锛歫son鏍戝舰鏁版嵁
+ findParent(parents, childNode, treeData) {
+ for (let i = 0; i < treeData.length; i++) {
+ // 鐖惰妭鐐规煡璇㈡潯浠�
+ if (treeData[i].code === childNode) {
+ // 濡傛灉鎵惧埌缁撴灉,淇濆瓨褰撳墠鑺傜偣
+ parents.push(treeData[i].code)
+ // 鐢ㄥ綋鍓嶈妭鐐瑰啀鍘诲師鏁版嵁鏌ユ壘褰撳墠鑺傜偣鐨勭埗鑺傜偣
+ this.findParent(parents, treeData[i].iparent_id, this.stocktypeArr)
+ break
+ } else {
+ if (treeData[i].children instanceof Array) {
+ // 娌℃壘鍒帮紝閬嶅巻璇ヨ妭鐐圭殑瀛愯妭鐐�
+ this.findParent(parents, childNode, treeData[i].children)
+ }
+ }
+ }
+ return parents
+ },
+
async getInventoryFileSelect() {
const res = await InventoryFileSelect(this.form)
this.tableData = res.data
@@ -1087,7 +1145,13 @@
},
async getStockTypeSelect() {
const { data: res } = await StockTypeSelect()
- this.stocktypeArr = res
+ this.stocktypeArr = arrayToTree(res, {
+ parentProperty: 'iparent_id',
+ customID: 'code',
+ childrenProperty: 'children'
+ })
+
+ console.log(this.stocktypeArr, 2)
},
async getWareHouseSelect() {
const { data: res } = await WareHouseSelect()
@@ -1139,6 +1203,7 @@
this.form.stocktypecode = ''
this.form.materialtypecode = ''
this.form.storehousecode = ''
+ this.$refs.cascader.checkedValue = ''
this.getInventoryFileSelect()
},
// 鏂板鎸夐挳
@@ -1149,10 +1214,14 @@
},
// 淇敼鎸夐挳
async edit(operation, row) {
+ const cascaderCheckedValue = this.findParent([], row.stocktypecode, this.stocktypeArr)
+
this.operation = operation
this.dialogVisible = true
// await this.stocktypecodeChange(row.stocktypecode, 'dialogForm')
this.$nextTick(() => {
+ this.$refs.cascaderDialog.checkedValue = cascaderCheckedValue.reverse()
+
this.dialogForm.id = row.id
this.dialogForm.materialcode = row.partcode
this.dialogForm.materialname = row.partname
@@ -1205,6 +1274,7 @@
this.isFifo = false
this.isInCheck = false
this.isOutCheck = false
+ this.$refs.cascaderDialog.checkedValue = ''
this.$refs.dialogForm.clearValidate()
},
// 瀵硅瘽妗嗗彇娑�
--
Gitblit v1.9.3