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/processRoute.vue | 443 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 420 insertions(+), 23 deletions(-)
diff --git a/src/views/makeModel/processRoute.vue b/src/views/makeModel/processRoute.vue
index 572ae4c..7d37dd8 100644
--- a/src/views/makeModel/processRoute.vue
+++ b/src/views/makeModel/processRoute.vue
@@ -16,6 +16,22 @@
style="display: flex;"
>
<div class="elForm">
+ <el-form-item label="鎵�灞炶溅闂�" style=" display: flex;">
+ <el-select
+ v-model="form.WorkShop"
+ :popper-append-to-body="false"
+ style="width: 200px"
+ placeholder="璇烽�夋嫨"
+ >
+ <!-- @focus="getWareHouseSelect"-->
+ <el-option
+ v-for="item in WorkShopArr"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
+ </el-form-item>
<el-form-item label="宸ヨ壓璺嚎缂栫爜" style=" display: flex;">
<el-input v-model="form.routecode" placeholder="璇疯緭鍏�" style="width: 200px" />
</el-form-item>
@@ -25,18 +41,35 @@
<el-form-item label="宸ヨ壓鎻忚堪" style=" display: flex;">
<el-input v-model="form.description" placeholder="璇疯緭鍏�" style="width: 200px" />
</el-form-item>
- <el-form-item label="鍒涘缓浜哄憳" style=" display: flex;">
+ <el-form-item v-if="isExpandForm" label="鍒涘缓浜哄憳" style=" display: flex;">
<el-input v-model="form.createuser" style="width: 200px" placeholder="璇疯緭鍏�" />
</el-form-item>
</div>
- <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}">
+ <div
+ class="bodySearchReset"
+ :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
+ >
<el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button>
<el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
</div>
</el-form>
<div
class="bodyTopFormExpand"
- />
+ >
+ <svg-icon
+ v-show="mouseHoverType==='mouseout'"
+ style="cursor: pointer"
+ :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"
+ @mouseenter="mouseHoverType=$event.type"
+ />
+ <svg-icon
+ v-show="mouseHoverType==='mouseenter'"
+ style="cursor: pointer"
+ :icon-class="!isExpandForm?'doubleDown':'doubleUp'"
+ @click="isExpandForm=!isExpandForm"
+ @mouseout="mouseHoverType=$event.type"
+ />
+ </div>
</div>
<div class="elTableDiv">
@@ -49,10 +82,10 @@
:key="tableTimeStampKey"
class="tableFixed"
:data="tableData"
- :height="tableHeight"
+ :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
border
:row-class-name="tableRowClassName"
- :style="{width: 100+'%',height:tableHeight+'px',}"
+ :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
highlight-current-row
:header-cell-style="this.$headerCellStyle"
:cell-style="this.$cellStyle"
@@ -72,7 +105,21 @@
:fixed="item.fixed?(item.fixed==='left'?'left':'right'):false"
>
<template slot-scope="{row}">
- <div v-if="!row[item.prop]">/</div>
+
+ <div v-if="item.prop==='isrolepart'">
+ <i
+ v-if="row[item.prop]!==''"
+ :style="{color:$store.state.settings.theme}"
+ class="el-icon-share"
+ @click="routeClick(row)"
+ />
+ <i
+ v-if="row[item.prop]===''"
+ style="color:rgb(180 ,181, 185)"
+ class="el-icon-share"
+ @click="routeClick(row)"
+ />
+ </div>
<div v-else-if="item.prop==='enable'">
<div v-if="row[item.prop]==='Y'">
<i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
@@ -83,7 +130,9 @@
鍚�
</div>
</div>
+ <div v-else-if="!row[item.prop]">/</div>
<div v-else>{{ row[item.prop] }}</div>
+
</template>
</el-table-column>
@@ -166,10 +215,20 @@
/>
</el-tooltip>
<el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
- <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" style="margin-right:15px;" @click="del(row)" />
+ <i
+ :style="{color:$store.state.settings.theme}"
+ class="el-icon-delete"
+ style="margin-right:15px;"
+ @click="del(row)"
+ />
</el-tooltip>
<el-tooltip v-del-tab-index class="item" effect="dark" content="澶嶅埗" placement="top">
- <i :style="{color:$store.state.settings.theme}" class="el-icon-document-copy" style="cursor: pointer;color:#42b983" @click="copy('copy',row)" />
+ <i
+ :style="{color:$store.state.settings.theme}"
+ class="el-icon-document-copy"
+ style="cursor: pointer;color:#42b983"
+ @click="copy('copy',row)"
+ />
</el-tooltip>
</div>
</template>
@@ -182,7 +241,7 @@
:page.sync="form.page"
:limit.sync="form.rows"
align="right"
- layout="total,prev, pager, next,sizes"
+ layout="total,prev, pager, next,sizes,jumper"
popper-class="select_bottom"
@pagination="getRouteSearch"
/>
@@ -234,10 +293,37 @@
/>
</el-form-item>
</div>
+ <div style="display: flex">
+ <el-form-item prop="wkshopcode" label="鎵�灞炶溅闂�" style="margin-right: 20px">
+ <el-select
+ v-model="dialogForm.wkshopcode"
+ filterable
+ :disabled="operation==='edit'"
+ :popper-append-to-body="false"
+ style="width: 220px"
+ placeholder="璇烽�夋嫨"
+ @change="getStepSelectArr"
+ >
+ <el-option
+ v-for="item in WorkShopArr"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
+ </el-form-item>
+
+ </div>
+
<el-form-item label="宸ヨ壓璁剧疆" prop="Data" style="margin-top: 30px">
<div class="settingDiv">
<!-- 瀹炵幇宸ヨ壓璁剧疆鍔ㄦ�佹坊鍔�-->
- <div v-for="(tag,index) in dynamicTags" :key="tag.seq" style="display: flex;align-items: center">
+ <!-- v-if="false"-->
+ <div
+ v-for="(tag,index) in dynamicTags"
+ :key="tag.seq"
+ style="display: flex;align-items: center"
+ >
<div style="display: flex;align-items: center;position: relative;">
<div
class="orderNumber"
@@ -339,19 +425,158 @@
</div>
</span>
</el-dialog>
+
+ <el-dialog
+ v-el-drag-dialog
+ title="宸ヨ壓璺嚎缁戝畾浜у搧"
+ :visible.sync="routerDialogVisible"
+ width="1200px"
+ :close-on-click-modal="false"
+ top="12vh"
+ class="userDialogVisible"
+ @closed="handleCloseRouter"
+ @close="handleCloseRouter"
+ >
+ <div class="bodyTopFormGroup" style="margin-bottom: 10px">
+ <el-form
+ ref="routerForm"
+ :model="routerForm"
+ label-width="100px"
+ inline
+ style="display: flex;"
+ >
+ <div class="elForm">
+ <el-form-item label="鐗╂枡缂栫爜" style=" display: flex;">
+ <el-input v-model="routerForm.partcode" placeholder="璇疯緭鍏�" style="width: 200px" />
+ </el-form-item>
+ <el-form-item label="鐗╂枡鍚嶇О" style=" display: flex;">
+ <el-input v-model="routerForm.partname" placeholder="璇疯緭鍏�" style="width: 200px" />
+ </el-form-item>
+ <el-form-item label="鐗╂枡瑙勬牸" style=" display: flex;">
+ <el-input v-model="routerForm.partspec" placeholder="璇疯緭鍏�" style="width: 200px" />
+ </el-form-item>
+ <el-form-item label="瀛樿揣绫诲瀷" style=" display: flex;">
+ <el-cascader
+ ref="cascader"
+ :options="stocktypeArr"
+ filterable
+ :props="defaultProps"
+ @change="val=>cascaderChange(val)"
+ />
+ </el-form-item>
+ </div>
+ <div
+ class="bodySearchReset"
+ :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
+ >
+ <el-button v-waves type="primary" icon="el-icon-search" @click="getInventoryFileSelect">鏌ヨ</el-button>
+ <el-button v-waves type="info" icon="el-icon-refresh" @click="resetRouter">閲嶇疆</el-button>
+ </div>
+ </el-form>
+ </div>
+
+ <el-table
+ ref="multipleTableRef"
+ :data="routerTableData"
+ border
+ :row-class-name="tableRowClassName"
+ highlight-current-row
+ height="450"
+ :header-cell-style="this.$headerCellStyle"
+ :cell-style="this.$cellStyle"
+ :row-key="getRowKey"
+ @selection-change="handleSelectionChange"
+ >
+
+ <el-table-column
+ type="selection"
+ width="50"
+ :reserve-selection="true"
+ fixed
+ />
+ <!-- <el-table-column-->
+ <!-- prop="RowNum"-->
+ <!-- width="50"-->
+ <!-- label="搴忓彿"-->
+ <!-- />-->
+ <el-table-column
+ prop="partcode"
+ label="浜у搧缂栫爜"
+ />
+ <el-table-column
+ prop="partname"
+ label="浜у搧鍚嶇О"
+ />
+ <el-table-column
+ prop="partspec"
+ label="瑙勬牸鍨嬪彿"
+ >
+ <template slot-scope="{row}">
+ {{ row.partspec?row.partspec:'/' }}
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="stocktypename"
+ label="瀛樿揣绫诲瀷"
+ >
+ <template slot-scope="{row}">
+ {{ row.stocktypename?row.stocktypename:'/' }}
+ </template>
+ </el-table-column>
+
+ </el-table>
+
+ <!--鍒嗛〉-->
+ <!-- <pagination-->
+ <!-- :total="routerTotal"-->
+ <!-- :page.sync="routerForm.page"-->
+ <!-- :limit.sync="routerForm.rows"-->
+ <!-- align="right"-->
+ <!-- style="margin-top: 10px"-->
+ <!-- layout="total ,prev, pager, next,sizes"-->
+ <!-- popper-class="select_bottom"-->
+ <!-- @pagination="getInventoryFileSelect"-->
+ <!-- />-->
+
+ <span slot="footer" class="dialog-footer">
+ <div class="footerButton">
+ <el-button v-waves @click="routerDialogVisibleCancel">鍙� 娑�</el-button>
+ <el-button
+ v-waves
+ type="primary"
+ :loading="$store.state.app.buttonIsDisabled"
+ :disabled="$store.state.app.buttonIsDisabled"
+ @click="routerDialogVisibleConfirm"
+ >纭� 瀹�</el-button>
+ </div>
+ </span>
+
+ </el-dialog>
+
</div>
</template>
<script>
import Pagination from '@/components/Pagination'
-import { AddUpdateRoute, DeleteRoute, RouteSearch, StepSelect, ViewRoute } from '@/api/makeModel'
+import {
+ AddUpdateRoute,
+ DeleteRoute,
+ InventoryFileSelect, RouteBatchPartSave,
+ RouteSearch, RputeInventorySearch,
+ StepSelect,
+ StockTypeSelect,
+ ViewRoute
+} from '@/api/makeModel'
import { validateCode } from '@/utils/global'
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import TableColumnSettings from '@/components/TableColumnSettings'
+import { WorkShopSelect } from '@/api/deviceManager'
+import { getCookie } from '@/utils/auth'
+import arrayToTree from 'array-to-tree'
export default {
- name: 'GYLX',
+ name: 'ProcessRoute',
components: {
Pagination, TableColumnSettings
},
@@ -359,12 +584,15 @@
data() {
return {
isIpad: false,
+ mouseHoverType: 'mouseout',
+ isExpandForm: false,
mainHeight: 0,
tableHeight: 0,
form: {
routecode: '', // 宸ヨ壓璺嚎缂栫爜
routename: '', // 宸ヨ壓璺嚎鍚嶇О
description: '', // 宸ヨ壓璺嚎鎻忚堪
+ WorkShop: this.$store.state.settings.orgType !== 'W' ? '' : getCookie('stu_torgcode'), // 鎵�灞炶溅闂�
createuser: '', // 鍒涘缓浜哄憳
prop: 'lm_date', // 鎺掑簭瀛楁
order: 'desc', // 鎺掑簭瀛楁
@@ -375,6 +603,7 @@
{ label: '鏄�', value: 'Y' },
{ label: '鍚�', value: 'N' }
],
+ WorkShopArr: [], // 鎵�灞炶溅闂存暟缁�
total: 10,
tableData: [],
tableColumnSettingsArray: [
@@ -423,9 +652,39 @@
{
minWidth: 110,
width: false,
+ prop: 'org_code',
+ label: '鎵�灞炶溅闂寸紪鐮�',
+ id: 7,
+ show: false,
+ fixed: false,
+ sortable: true
+ },
+ {
+ minWidth: 110,
+ width: false,
+ prop: 'org_name',
+ label: '鎵�灞炶溅闂�',
+ id: 8,
+ show: true,
+ fixed: false,
+ sortable: true
+ },
+ {
+ minWidth: 110,
+ width: false,
+ prop: 'isrolepart',
+ label: '鍏宠仈浜у搧',
+ id: 9,
+ show: true,
+ fixed: false,
+ sortable: true
+ },
+ {
+ minWidth: 110,
+ width: false,
prop: 'lm_user',
label: '鍒涘缓浜哄憳',
- id: 7,
+ id: 10,
show: true,
fixed: false,
sortable: true
@@ -435,7 +694,7 @@
width: false,
prop: 'lm_date',
label: '鍒涘缓鏃堕棿',
- id: 8,
+ id: 11,
show: true,
fixed: false,
sortable: true
@@ -449,6 +708,7 @@
name: '',
enable: 'Y',
description: '',
+ wkshopcode: this.$store.state.settings.orgType !== 'W' ? '' : getCookie('stu_torgcode'), // 鎵�灞炶溅闂�
Data: []
},
dynamicTags: [// 宸ヨ壓璁剧疆鏁扮粍
@@ -474,22 +734,130 @@
],
enable: [
{ required: true, message: '璇烽�夋嫨浣跨敤鐘舵��', trigger: ['blur', 'change'] }
+ ],
+ wkshopcode: [
+ { required: true, message: '璇烽�夋嫨鎵�灞炶溅闂�', trigger: ['blur', 'change'] }
]
// Data: [
// { required: true, message: '璇疯缃伐鑹�', trigger: ['blur', 'change'] }
// ]
- }
+ },
+ routerDialogVisible: false,
+ routerForm: {
+ partcode: '', // 鐗╂枡缂栫爜
+ partname: '', // 鐗╂枡鍚嶇О
+ partspec: '', // 鐗╂枡瑙勬牸
+ stocktypecode: '', // 瀛樿揣绫诲瀷缂栫爜
+ materialtypecode: '', // 鐗╂枡绫诲瀷缂栫爜
+ storehousecode: '' // 鎵�灞炰粨搴撶紪鐮�
+ // prop: 'lm_date', // 鎺掑簭瀛楁
+ // order: 'desc', // 鎺掑簭瀛楁
+ // page: 1, // 绗嚑椤�
+ // rows: 20 // 姣忛〉澶氬皯鏉�
+ },
+ routerTableData: [],
+ routerTotal: 10,
+ stocktypeArr: [],
+ defaultProps: {
+ checkStrictly: true,
+ expandTrigger: 'hover',
+ value: 'code',
+ label: 'name'
+ },
+ multipleSelection: [],
+ selectedRouterCode: '',
+ selectedisrolepart: ''
}
},
created() {
this.getRouteSearch()
+ this.getWorkShopSelect()
+
+ // this.getInventoryFileSelect()
+ this.getStockTypeSelect()
},
mounted() {
window.addEventListener('resize', this.getHeight)
this.getHeight()
},
methods: {
+ handleCloseRouter() {
+ this.$refs.multipleTableRef.clearSelection()
+ },
+ async getInventoryFileSelect() {
+ const res = await RputeInventorySearch(this.routerForm)
+ this.routerTableData = res.data
+ this.routerTotal = res.count
+
+ this.$nextTick(() => {
+ this.routerTableData.forEach((item, index) => {
+ if (this.selectedisrolepart.split(',').includes(item.partcode)) {
+ this.$refs.multipleTableRef.toggleRowSelection(this.routerTableData[index], true)
+ }
+ })
+ })
+ },
+ async getStockTypeSelect() {
+ const { data: res } = await StockTypeSelect()
+ this.stocktypeArr = arrayToTree(res, {
+ parentProperty: 'iparent_id',
+ customID: 'code',
+ childrenProperty: 'children'
+ })
+ },
+ resetRouter() {
+ this.routerForm.partcode = ''
+ this.routerForm.partname = ''
+ this.routerForm.partspec = ''
+ this.routerForm.stocktypecode = ''
+ this.routerForm.materialtypecode = ''
+ this.routerForm.storehousecode = ''
+ this.$refs.cascader.checkedValue = ''
+ this.getInventoryFileSelect()
+ },
+ cascaderChange(val) {
+ this.routerForm.stocktypecode = val[val.length - 1]
+ },
+ routeClick(row) {
+ this.selectedRouterCode = row.code
+ this.selectedisrolepart = row.isrolepart
+ this.routerDialogVisible = true
+
+ this.getInventoryFileSelect()
+ },
+ getRowKey(row) {
+ return row.partcode
+ },
+ handleSelectionChange(val) {
+ this.multipleSelection = val
+ },
+ routerDialogVisibleCancel() {
+ this.routerDialogVisible = false
+ },
+ async routerDialogVisibleConfirm() {
+ const data = {
+ 'routecode': this.selectedRouterCode,
+ 'routepart': this.multipleSelection.length > 0 ? this.multipleSelection.map(i => i.partcode).join(',') : ''
+ }
+
+ this.$store.state.app.buttonIsDisabled = true
+ const res = await RouteBatchPartSave(data)
+ if (res.code === '200') {
+ this.routerDialogVisible = false
+ this.$message.success('缁戝畾鎴愬姛锛�')
+ await this.getRouteSearch()
+ this.$store.state.app.buttonIsDisabled = false
+ } else {
+ this.$message.error('缁戝畾澶辫触锛�')
+ }
+ },
+
+ // 鑾峰彇鎵�灞炶溅闂翠笅鎷�
+ async getWorkShopSelect() {
+ const { data: res } = await WorkShopSelect()
+ this.WorkShopArr = res
+ },
tableColumnUpdate(val, isCopyTrue) {
if (isCopyTrue) {
this.tableColumnSettingsArray = val
@@ -515,8 +883,9 @@
},
// 宸ヨ壓璁剧疆 涓嬫媺鑾峰彇鎵�鏈�
async getStepSelectArr() {
- const { data: res } = await StepSelect()
+ const { data: res } = await StepSelect({ WorkShop: this.dialogForm.wkshopcode })
this.routeArr = res
+ console.log('鎵ц浜嗭紒')
},
// 澶勭悊涓嬫媺閫夋嫨
handleSelect(item, tag) {
@@ -585,6 +954,13 @@
},
// tag鐐瑰嚮淇敼鎸夐挳
tagEdit(tag) {
+ if (!this.dialogForm.wkshopcode) {
+ return this.$message.info('璇峰厛閫夋嫨鎵�灞炶溅闂达紒')
+ }
+ if (this.routeArr.length === 0) {
+ return this.$message.info('璇ヨ溅闂存湭璁剧疆宸ュ簭锛�')
+ }
+
this.autocompleteValue = ''
this.dynamicTags.forEach(item => {
item.stepname = item.stepname.trim()
@@ -731,6 +1107,7 @@
this.form.routename = ''
this.form.description = ''
this.form.createuser = ''
+ this.form.WorkShop = this.$store.state.settings.orgType !== 'W' ? '' : getCookie('stu_torgcode') // 鎵�灞炶溅闂�
this.getRouteSearch()
},
@@ -738,7 +1115,10 @@
add(operation) {
this.operation = operation
this.dialogVisible = true
+
+ // if (this.$store.state.settings.orgType === 'W') {
this.getStepSelectArr()
+ // }
},
// 宸ヨ壓璺嚎棰勮
async edit(operation, row) {
@@ -753,6 +1133,8 @@
this.dialogForm.name = res[0].name
this.dialogForm.enable = res[0].enable
this.dialogForm.description = res[0].description
+ this.dialogForm.wkshopcode = res[0].wkshopcode
+
// this.dialogForm.Data = row.description
res[0].Data.forEach(item => {
this.dynamicTags.push(
@@ -786,19 +1168,32 @@
this.operation = operation
this.dialogVisible = true
- await this.getStepSelectArr()
+ // if (this.$store.state.settings.orgType === 'W') {
+
+ // }
+
const { data: res } = await ViewRoute({ routecode: row.code })
// 寰呮敼
this.dynamicTags = []
this.routeSelectedArr = []
+
+ this.dialogForm.code = res[0].code
+ this.dialogForm.name = res[0].name
+ this.dialogForm.enable = res[0].enable
+ this.dialogForm.description = res[0].description
+ this.dialogForm.wkshopcode = res[0].wkshopcode
+ await this.getStepSelectArr()
+
this.$nextTick(() => {
- this.dialogForm.code = res[0].code
- this.dialogForm.name = res[0].name
- this.dialogForm.enable = res[0].enable
- this.dialogForm.description = res[0].description
res[0].Data.forEach((item, index) => {
this.dynamicTags.push(
- { seq: item.seq, stepname: item.stepname, stepcode: item.stepcode, editDisabled: true, effect: index === res[0].Data.length - 1 ? 'dark' : 'light' }
+ {
+ seq: item.seq,
+ stepname: item.stepname,
+ stepcode: item.stepcode,
+ editDisabled: true,
+ effect: index === res[0].Data.length - 1 ? 'dark' : 'light'
+ }
)
this.routeSelectedArr.push({
stepcode: item.stepcode,
@@ -818,6 +1213,7 @@
this.dialogForm.name = ''
this.dialogForm.enable = 'Y'
this.dialogForm.description = ''
+ this.dialogForm.wkshopcode = this.$store.state.settings.orgType !== 'W' ? '' : getCookie('stu_torgcode') // 鎵�灞炶溅闂�
this.dialogForm.Data = []
this.dynamicTags = [
@@ -859,6 +1255,7 @@
name: this.dialogForm.name,
enable: this.dialogForm.enable,
description: this.dialogForm.description,
+ wkshopcode: this.dialogForm.wkshopcode,
Data: Data
}
@@ -879,7 +1276,7 @@
getHeight() {
this.$nextTick(() => {
this.mainHeight = window.innerHeight - 85
- this.tableHeight = this.mainHeight - 195
+ this.tableHeight = this.mainHeight - 255
if (window.innerHeight < 769) {
this.tableHeight = this.tableHeight - 40
}
--
Gitblit v1.9.3