From ff2f7d7bad0132c130c305364a863ff446e926b2 Mon Sep 17 00:00:00 2001 From: 小小儁爺 <1694218219@qq.com> Date: 星期一, 30 十二月 2024 13:47:24 +0800 Subject: [PATCH] 1.在缓存模式下 页面切换会请求接口 --- src/views/mouldManager/mouldList.vue | 1971 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 989 insertions(+), 982 deletions(-) diff --git a/src/views/mouldManager/mouldList.vue b/src/views/mouldManager/mouldList.vue index 64670ac..4e6b931 100644 --- a/src/views/mouldManager/mouldList.vue +++ b/src/views/mouldManager/mouldList.vue @@ -1,982 +1,989 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <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 - type="success" - icon="el-icon-download" - @click="$router.push('./../systemSetting/dataImport?fileCode=12')" - >瀵煎叆 - </el-button> - <!-- <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button>--> - - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="宸ュ崟鐘舵��" style=" display: flex;"> - <el-select v-model="form.mouldstaus" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in mouldstausArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="浣跨敤鐘舵��" style=" display: flex;"> - <el-select v-model="form.usestatus" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in onstateArr" - :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.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> - <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.mouldspec" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.createuser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - <el-form-item v-show="isExpandForm" label="鍗曟嵁鏃ユ湡" style="display: flex;align-items: center"> - <el-date-picker - v-model="form.createdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - </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="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"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="status" - label="妯″叿鐘舵��" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="row.status==='N'" size="small" type="danger">鏁呴殰</el-tag> - </template> - </el-table-column> - <el-table-column - prop="usestatus" - label="浣跨敤鐘舵��" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.usestatus?onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name:'/' }} - <!-- {{ onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name }}--> - </template> - </el-table-column> - <el-table-column - prop="code" - label="妯″叿缂栧彿" - sortable="custom" - /> - <el-table-column - prop="name" - label="妯″叿鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="spec" - label="瑙勬牸鍨嬪彿" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.spec ? row.spec : '/' }} - </template> - </el-table-column> - <el-table-column - prop="warehousename" - label="浠撳簱鍚嶇О" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.warehousename ? row.warehousename : '/' }} - </template> - </el-table-column> - <el-table-column - prop="location_name" - label="搴撲綅鍚嶇О" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.location_name ? row.location_name : '/' }} - </template> - </el-table-column> - <el-table-column - prop="is_part" - label="浜у搧鍏宠仈" - sortable="custom" - > - <template slot-scope="{row}"> - <!-- <el-tag v-if="row.is_part==='Y'" size="small" type="success">鏄�</el-tag>--> - <!-- <el-tag v-if="row.is_part==='N'" size="small" type="danger">鍚�</el-tag>--> - <i - v-if="row.is_part==='Y'" - :style="{color:$store.state.settings.theme}" - class="el-icon-share" - style="cursor: pointer" - @click="connectClick(row)" - /> - <i - v-if="row.is_part==='N'" - class="el-icon-share" - style="color: rgb(180 ,181, 185);cursor:pointer;" - @click="connectClick(row)" - /> - </template> - </el-table-column> - <el-table-column - prop="surp_life" - label="棰勮瀵垮懡(娆�)" - width="125" - sortable="custom" - /> - <el-table-column - prop="serlife" - label="浣跨敤瀵垮懡(娆�)" - width="125" - sortable="custom" - /> - <el-table-column - prop="resi_life" - label="鍓╀綑瀵垮懡(娆�)" - width="125" - sortable="custom" - /> - <el-table-column - prop="username" - label="鍒涘缓浜哄憳" - sortable="custom" - /> - - <el-table-column - prop="lm_date" - label="鍒涘缓鏃堕棿" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.lm_date">{{ row.lm_date.substring(0, 11) }}</div> - <div v-else>/</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="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)" /> - </el-tooltip> - <el-tooltip class="item" effect="dark" content="灞ュ巻" placement="top"> - <i class="el-icon-view" :style="{color:$store.state.settings.theme}" style="cursor: pointer" @click="view(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldMangerSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':(operation==='edit'?'缂栬緫':'浜у搧鍏宠仈')" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - :top="operation!=='connect'? '7vh':'15vh'" - class="dialogFormClass" - @closed="handleClose" - @close="handleClose" - > - - <el-form - v-if="operation!=='connect'" - ref="dialogForm" - class="" - inline - :rules="dialogFormRules" - :model="dialogForm" - label-width="110px" - > - <el-divider content-position="left">鍩烘湰淇℃伅</el-divider> - <el-form-item label="妯″叿缂栫爜" prop="mouldcode"> - <el-input v-model="dialogForm.mouldcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="妯″叿鍚嶇О" prop="mouldname"> - <el-input v-model="dialogForm.mouldname" style="width: 200px" /> - </el-form-item> - <el-form-item label="瑙勬牸鍨嬪彿"> - <el-input v-model="dialogForm.mouldspec" style="width: 200px" /> - </el-form-item> - - <el-form-item required label="妯″叿鐘舵��"> - <el-radio-group v-model="dialogForm.status"> - <el-radio label="Y">姝e父</el-radio> - <el-radio label="N">鏁呴殰</el-radio> - </el-radio-group> - </el-form-item> - - <el-form-item v-if="dialogForm.opertype==='Add'" prop="warehousecode" label="鎵�灞炰粨搴�"> - <el-select - v-model="dialogForm.warehousecode" - style="width:200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - @change="warehousecodeChange" - > - <el-option - v-for="item in wareHouseArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item v-if="dialogForm.opertype==='Add'" prop="location_code" label="鎵�灞炲簱浣�"> - <el-select - v-model="dialogForm.location_code" - style="width:200px" - :disabled="dialogForm.warehousecode===''" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - > - <el-option - v-for="item in locationArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item label="棰勮瀵垮懡(娆�)"> - <el-input v-model="dialogForm.surplife" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> - </el-form-item> - <el-form-item label="鍓╀綑瀵垮懡(娆�)"> - <el-input v-model="dialogForm.resilife" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> - </el-form-item> - - </el-form> - <el-divider v-if="operation!=='connect'" content-position="left">鍏宠仈浜у搧</el-divider> - - <el-input - v-model="filterText" - placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" - /> - <div style="height: 300px;overflow:auto;margin-top: 25px;"> - <el-tree - ref="tree" - class="filter-tree" - :data="Inventory" - :props="defaultProps" - show-checkbox - node-key="code" - default-expand-all - :filter-node-method="filterNode" - /> - - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <el-dialog - v-el-drag-dialog - title="灞ュ巻鏌ョ湅" - :visible.sync="dialogVisibleResume" - width="1000px" - :close-on-click-modal="false" - top="7vh" - class="dialogFormClass" - @closed="handleCloseResume" - > - <div style="display: flex;justify-content: center;font-size: 18px;font-weight: bolder">妯″叿鍦ㄧ嚎淇℃伅鏌ヨ</div> - <el-descriptions class="margin-top" title=" " :column="3" size="size" border> - <!-- <template slot="extra">--> - <!-- <el-button type="primary" size="small">鎿嶄綔</el-button>--> - <!-- </template>--> - <el-descriptions-item> - <template slot="label"> - <!-- <i class="el-icon-user" />--> - 妯″叿缂栫爜 - </template> - {{ formResume.mouldcode }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 妯″叿鍚嶇О - </template> - {{ formResume.mouldname }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 瑙勬牸鍨嬪彿 - </template> - {{ formResume.mouldspec||'/' }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 妯″叿鐘舵�� - </template> - <!-- {{ formResume.status ==='Y'?'姝e父':'寮傚父' }}--> - <el-tag v-if="formResume.status==='Y'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="formResume.status==='N'" size="small" type="danger">鏁呴殰</el-tag> - - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 浣跨敤鐘舵�� - </template> - <!-- {{ formResume.usestatus }}--> - {{ formResume.usestatus?onstateArr.find(i => parseFloat(i.code) === parseFloat(formResume.usestatus)).name:'/' }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 棰勮瀵垮懡(娆�) - </template> - {{ formResume.surp_life }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 鍓╀綑瀵垮懡(娆�) - </template> - {{ formResume.serlife }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 鏌ョ湅浜哄憳 - </template> - {{ formResume.username }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 鏌ョ湅鏃堕棿 - </template> - {{ formResume.lm_date }} - </el-descriptions-item> - </el-descriptions> - - <div style="display: flex;justify-content: center;font-size: 18px;font-weight: bolder;margin: 20px 0">妯″叿娴佽浆璁板綍</div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef2" - class="tableFixed" - :data="tableResume" - height="370px" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:'370px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="opertype" - label="鎿嶄綔绫诲瀷" - /> - - <el-table-column - prop="operusername" - label="鎿嶄綔浜哄憳" - /> - - <el-table-column - prop="operdate" - label="鎿嶄綔鏃堕棿" - /> - <el-table-column - prop="opertype" - label="缁撴灉/瀵硅薄" - /> - - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="totalResume" - :page.sync="formResume.page" - :limit.sync="formResume.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMoldResumeSearch" - /> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleResume=false">杩� 鍥�</el-button> - <!-- <el-button--> - <!-- v-waves--> - <!-- type="primary"--> - <!-- :loading="$store.state.app.buttonIsDisabled"--> - <!-- :disabled="$store.state.app.buttonIsDisabled"--> - <!-- @click="dialogVisibleConfirm"--> - <!-- >纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime, handleDatetime2, validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { - ProductionScheduleReportExcelSearch, - ProductionScheduleReportSearch -} from '@/api/ReportManager' -import { AddUpdateMouldManger, DeleteMouldManger, MoldResumeSearch, MouldMangerSearch } from '@/api/MouldManager' -import { InventoryTreePermissions, WareHouse, WareHouseSelectLocation } from '@/api/GeneralBasicData' -import arrayToTree from 'array-to-tree' -import { TCunstomerDelete } from '@/api/basicSettings' - -export default { - name: 'MouldList', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - mouldstaus: '', // 妯″叿鐘舵�� - usestatus: '', // 浣跨敤鐘舵�� - mouldcode: '', // 妯″叿缂栫爜 - mouldname: '', // 妯″叿鍚嶇О - mouldspec: '', // 妯″叿瑙勬牸鍨嬪彿 - - createuser: '', // 鍒涘缓浜哄憳 - createdate: '', // 鍗曟嵁鏃ユ湡 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - - mouldstausArr: [ - { code: 'Y', name: '姝e父' }, - { code: 'N', name: '鏁呴殰' } - ], - onstateArr: [ - { code: 0, name: '鍦ㄥ簱' }, - { code: 1, name: '鍑哄簱' }, - { code: 2, name: '涓婃満' }, - { code: 3, name: '涓嬫満' }, - { code: 4, name: '寰呯淮淇�' }, - { code: 5, name: '宸茬淮淇�' }, - { code: 6, name: '宸查獙璇�' }, - { code: 7, name: '澶栧��' }, - { code: 8, name: '褰掕繕' } - ], - - total: 10, - tableData: [], - - operation: '', - dialogVisible: false, - dialogForm: { - mouldcode: '', - mouldname: '', - mouldspec: '', - warehousecode: '', // 浠撳簱缂栫爜 - location_code: '', // 搴撲綅缂栫爜 - surplife: '', - resilife: '', - status: 'Y', - mouldpart: '', - opertype: '' - }, - dialogFormRules: { - mouldcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - mouldname: [ - { required: true, message: '璇疯緭鍏ユā鍏峰悕绉�', trigger: ['blur', 'change'] } - ], - warehousecode: [ - { required: true, message: '璇疯緭鍏ラ�夋嫨浠撳簱淇℃伅', trigger: ['blur', 'change'] } - ], - location_code: [ - { required: true, message: '璇疯緭鍏ラ�夋嫨搴撲綅淇℃伅', trigger: ['blur', 'change'] } - ] - }, - filterText: '', - defaultProps: { - children: 'children', - label: 'name' - }, - - Inventory: [ - // { code: '-1', - // name: '鍏ㄩ儴' - // } - ], - - wareHouseArr: [], // 浠撳簱鏁扮粍 - locationArr: [], // 搴撲綅鏁扮粍 - - dialogVisibleResume: false, - formResume: { - mouldcode: '', - page: 1, - rows: 20 - }, - tableResume: [], - totalResume: 10 - - } - }, - watch: { - filterText(val) { - this.$refs.tree.filter(val) - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getMouldMangerSearch() - - this.getInventoryTreePermissions() - this.getWareHouse() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getInventoryTreePermissions() { - const res = await InventoryTreePermissions() - res.data.forEach(i => { - i.name = i.code + ' ' + i.name - }) - - this.Inventory = arrayToTree(res.data, { - parentProperty: 'parentid', - customID: 'code', - childrenProperty: 'children' - }) - }, - async getWareHouse() { - const { data: res } = await WareHouse() - this.wareHouseArr = res - }, - async getMouldMangerSearch() { - let tempDate = this.form.createdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - mouldstaus: this.form.mouldstaus, - mouldcode: this.form.mouldcode, - wkshopcode: this.form.wkshopcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - partname: this.form.partname, - partspec: this.form.partspec, - createdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - } - - const res = await MouldMangerSearch(data) - this.tableData = res.data - this.total = res.count - }, - - // 瀵煎嚭 - async download() { - let tempDate = this.form.createdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - mouldstaus: this.form.mouldstaus, - mouldcode: this.form.mouldcode, - wkshopcode: this.form.wkshopcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - partname: this.form.partname, - partspec: this.form.partspec, - createdate: tempDate - } - - const res = await ProductionScheduleReportExcelSearch(data) - // console.log(res) - window.location.href = res.data - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldMangerSearch() - }, - // 鏌ヨ - search() { - this.getMouldMangerSearch() - }, - // 閲嶇疆 - reset() { - this.form.mouldstaus = '' - this.form.usestatus = '' - this.form.mouldcode = '' - this.form.mouldname = '' - - this.form.mouldspec = '' - this.form.createuser = '' - this.form.createdate = '' - this.getMouldMangerSearch() - }, - async warehousecodeChange(val) { - const { data: res } = await WareHouseSelectLocation({ warhousecode: val }) - this.locationArr = res - }, - add() { - this.operation = 'add' - this.dialogForm.opertype = 'Add' - this.dialogVisible = true - }, - edit(row) { - this.operation = 'edit' - this.dialogVisible = true - this.dialogForm.opertype = 'Update' - - this.$nextTick(() => { - this.dialogForm.mouldcode = row.code - this.dialogForm.mouldname = row.name - this.dialogForm.mouldspec = row.spec - this.dialogForm.warehousecode = row.warehousecode - this.dialogForm.location_code = row.location_code - this.dialogForm.surplife = row.surp_life - this.dialogForm.resilife = row.resi_life - this.dialogForm.status = row.status - this.dialogForm.mouldpart = row.partcode ? row.partcode.split(',') : [] - this.$refs.tree.setCheckedKeys(this.dialogForm.mouldpart) - }) - }, - connectClick(row) { - this.operation = 'connect' - this.dialogVisible = true - this.dialogForm.opertype = 'Update' - - this.$nextTick(() => { - this.dialogForm.mouldcode = row.code - this.dialogForm.mouldname = row.name - this.dialogForm.mouldspec = row.spec - // this.dialogForm.warehousecode = row.warehousecode - this.dialogForm.surplife = row.surp_life - this.dialogForm.resilife = row.resi_life - this.dialogForm.status = row.status - this.dialogForm.mouldpart = row.partcode ? row.partcode.split(',') : [] - this.$refs.tree.setCheckedKeys(this.dialogForm.mouldpart) - }) - }, - del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteMouldManger({ mouldcode: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - this.getMouldMangerSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - - // 灞ュ巻 - async view(row) { - this.formResume.mouldcode = row.code - this.formResume.mouldname = row.name - this.formResume.mouldspec = row.spec - this.formResume.username = localStorage.getItem('username') - this.formResume.surp_life = row.surp_life - this.formResume.serlife = row.serlife - this.formResume.lm_date = handleDatetime2(new Date()) - this.formResume.status = row.status - this.formResume.usestatus = row.usestatus - - await this.getMoldResumeSearch() - this.dialogVisibleResume = true - this.$nextTick(() => { - this.$refs.tableDataRef2.doLayout() - }) - }, - async getMoldResumeSearch() { - const data = { - mouldcode: this.formResume.mouldcode, - createdate: '', - page: this.formResume.page, - rows: this.formResume.rows, - prop: 'operdate', - order: 'desc' - } - const res = await MoldResumeSearch(data) - - if (res.code === '200') { - this.tableResume = res.data - this.totalResume = res.count - } - }, - - handleCloseResume() { - this.tableResume = [] - }, - - handleClose() { - this.dialogForm = { - mouldcode: '', - mouldname: '', - mouldspec: '', - warehousecode: '', - location_code: '', - surplife: '', - resilife: '', - status: 'Y', - mouldpart: '', - opertype: '' - } - if (this.operation !== 'connect') { - this.$refs.dialogForm.clearValidate() - } - }, - dialogVisibleCancel() { - this.dialogVisible = false - }, - dialogVisibleConfirm() { - if (this.operation !== 'connect') { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const checkData = this.$refs.tree.getCheckedNodes() - this.dialogForm.mouldpart = [] - checkData.forEach(item => { - if (!Object.keys(item).includes('children')) { - this.dialogForm.mouldpart.push(item.code) - } - }) - // if (this.dialogForm.mouldpart.length === 0) { - // return this.$message.info('鍏宠仈浜у搧涓嶈兘涓虹┖锛�') - // } - this.$store.state.app.buttonIsDisabled = true - AddUpdateMouldManger(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.$refs.tree.setCheckedKeys([]) - - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getMouldMangerSearch() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - } else { - const checkData = this.$refs.tree.getCheckedNodes() - this.dialogForm.mouldpart = [] - checkData.forEach(item => { - if (!Object.keys(item).includes('children')) { - this.dialogForm.mouldpart.push(item.code) - } - }) - this.$store.state.app.buttonIsDisabled = true - AddUpdateMouldManger(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success('鍏宠仈鎴愬姛锛�') - this.$refs.tree.setCheckedKeys([]) - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getMouldMangerSearch() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error('鍏宠仈澶辫触锛�') - } - }) - } - }, - filterNode(value, data) { - if (!value) return true - return data.name.indexOf(value) !== -1 - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } - -} -</script> -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} - -.dialogFormClass ::v-deep .el-form-item { - margin-bottom: 0; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <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 + type="success" + icon="el-icon-download" + @click="$router.push('./../systemSetting/dataImport?fileCode=12')" + >瀵煎叆 + </el-button> + <!-- <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button>--> + + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="宸ュ崟鐘舵��" style=" display: flex;"> + <el-select v-model="form.mouldstaus" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in mouldstausArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="浣跨敤鐘舵��" style=" display: flex;"> + <el-select v-model="form.usestatus" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in onstateArr" + :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.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> + <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.mouldspec" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.createuser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + <el-form-item v-show="isExpandForm" label="鍗曟嵁鏃ユ湡" style="display: flex;align-items: center"> + <el-date-picker + v-model="form.createdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + </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="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"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="status" + label="妯″叿鐘舵��" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="row.status==='N'" size="small" type="danger">鏁呴殰</el-tag> + </template> + </el-table-column> + <el-table-column + prop="usestatus" + label="浣跨敤鐘舵��" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.usestatus?onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name:'/' }} + <!-- {{ onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name }}--> + </template> + </el-table-column> + <el-table-column + prop="code" + label="妯″叿缂栧彿" + sortable="custom" + /> + <el-table-column + prop="name" + label="妯″叿鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="spec" + label="瑙勬牸鍨嬪彿" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.spec ? row.spec : '/' }} + </template> + </el-table-column> + <el-table-column + prop="warehousename" + label="浠撳簱鍚嶇О" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.warehousename ? row.warehousename : '/' }} + </template> + </el-table-column> + <el-table-column + prop="location_name" + label="搴撲綅鍚嶇О" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.location_name ? row.location_name : '/' }} + </template> + </el-table-column> + <el-table-column + prop="is_part" + label="浜у搧鍏宠仈" + sortable="custom" + > + <template slot-scope="{row}"> + <!-- <el-tag v-if="row.is_part==='Y'" size="small" type="success">鏄�</el-tag>--> + <!-- <el-tag v-if="row.is_part==='N'" size="small" type="danger">鍚�</el-tag>--> + <i + v-if="row.is_part==='Y'" + :style="{color:$store.state.settings.theme}" + class="el-icon-share" + style="cursor: pointer" + @click="connectClick(row)" + /> + <i + v-if="row.is_part==='N'" + class="el-icon-share" + style="color: rgb(180 ,181, 185);cursor:pointer;" + @click="connectClick(row)" + /> + </template> + </el-table-column> + <el-table-column + prop="surp_life" + label="棰勮瀵垮懡(娆�)" + width="125" + sortable="custom" + /> + <el-table-column + prop="serlife" + label="浣跨敤瀵垮懡(娆�)" + width="125" + sortable="custom" + /> + <el-table-column + prop="resi_life" + label="鍓╀綑瀵垮懡(娆�)" + width="125" + sortable="custom" + /> + <el-table-column + prop="username" + label="鍒涘缓浜哄憳" + sortable="custom" + /> + + <el-table-column + prop="lm_date" + label="鍒涘缓鏃堕棿" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.lm_date">{{ row.lm_date.substring(0, 11) }}</div> + <div v-else>/</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="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)" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" content="灞ュ巻" placement="top"> + <i class="el-icon-view" :style="{color:$store.state.settings.theme}" style="cursor: pointer" @click="view(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldMangerSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':(operation==='edit'?'缂栬緫':'浜у搧鍏宠仈')" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + :top="operation!=='connect'? '7vh':'15vh'" + class="dialogFormClass" + @closed="handleClose" + @close="handleClose" + > + + <el-form + v-if="operation!=='connect'" + ref="dialogForm" + class="" + inline + :rules="dialogFormRules" + :model="dialogForm" + label-width="110px" + > + <el-divider content-position="left">鍩烘湰淇℃伅</el-divider> + <el-form-item label="妯″叿缂栫爜" prop="mouldcode"> + <el-input v-model="dialogForm.mouldcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="妯″叿鍚嶇О" prop="mouldname"> + <el-input v-model="dialogForm.mouldname" style="width: 200px" /> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿"> + <el-input v-model="dialogForm.mouldspec" style="width: 200px" /> + </el-form-item> + + <el-form-item required label="妯″叿鐘舵��"> + <el-radio-group v-model="dialogForm.status"> + <el-radio label="Y">姝e父</el-radio> + <el-radio label="N">鏁呴殰</el-radio> + </el-radio-group> + </el-form-item> + + <el-form-item v-if="dialogForm.opertype==='Add'" prop="warehousecode" label="鎵�灞炰粨搴�"> + <el-select + v-model="dialogForm.warehousecode" + style="width:200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + @change="warehousecodeChange" + > + <el-option + v-for="item in wareHouseArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item v-if="dialogForm.opertype==='Add'" prop="location_code" label="鎵�灞炲簱浣�"> + <el-select + v-model="dialogForm.location_code" + style="width:200px" + :disabled="dialogForm.warehousecode===''" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + > + <el-option + v-for="item in locationArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item label="棰勮瀵垮懡(娆�)"> + <el-input v-model="dialogForm.surplife" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> + </el-form-item> + <el-form-item label="鍓╀綑瀵垮懡(娆�)"> + <el-input v-model="dialogForm.resilife" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> + </el-form-item> + + </el-form> + <el-divider v-if="operation!=='connect'" content-position="left">鍏宠仈浜у搧</el-divider> + + <el-input + v-model="filterText" + placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" + /> + <div style="height: 300px;overflow:auto;margin-top: 25px;"> + <el-tree + ref="tree" + class="filter-tree" + :data="Inventory" + :props="defaultProps" + show-checkbox + node-key="code" + default-expand-all + :filter-node-method="filterNode" + /> + + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <el-dialog + v-el-drag-dialog + title="灞ュ巻鏌ョ湅" + :visible.sync="dialogVisibleResume" + width="1000px" + :close-on-click-modal="false" + top="7vh" + class="dialogFormClass" + @closed="handleCloseResume" + > + <div style="display: flex;justify-content: center;font-size: 18px;font-weight: bolder">妯″叿鍦ㄧ嚎淇℃伅鏌ヨ</div> + <el-descriptions class="margin-top" title=" " :column="3" size="size" border> + <!-- <template slot="extra">--> + <!-- <el-button type="primary" size="small">鎿嶄綔</el-button>--> + <!-- </template>--> + <el-descriptions-item> + <template slot="label"> + <!-- <i class="el-icon-user" />--> + 妯″叿缂栫爜 + </template> + {{ formResume.mouldcode }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 妯″叿鍚嶇О + </template> + {{ formResume.mouldname }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 瑙勬牸鍨嬪彿 + </template> + {{ formResume.mouldspec||'/' }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 妯″叿鐘舵�� + </template> + <!-- {{ formResume.status ==='Y'?'姝e父':'寮傚父' }}--> + <el-tag v-if="formResume.status==='Y'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="formResume.status==='N'" size="small" type="danger">鏁呴殰</el-tag> + + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 浣跨敤鐘舵�� + </template> + <!-- {{ formResume.usestatus }}--> + {{ formResume.usestatus?onstateArr.find(i => parseFloat(i.code) === parseFloat(formResume.usestatus)).name:'/' }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 棰勮瀵垮懡(娆�) + </template> + {{ formResume.surp_life }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 鍓╀綑瀵垮懡(娆�) + </template> + {{ formResume.serlife }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 鏌ョ湅浜哄憳 + </template> + {{ formResume.username }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 鏌ョ湅鏃堕棿 + </template> + {{ formResume.lm_date }} + </el-descriptions-item> + </el-descriptions> + + <div style="display: flex;justify-content: center;font-size: 18px;font-weight: bolder;margin: 20px 0">妯″叿娴佽浆璁板綍</div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef2" + class="tableFixed" + :data="tableResume" + height="370px" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:'370px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="opertype" + label="鎿嶄綔绫诲瀷" + /> + + <el-table-column + prop="operusername" + label="鎿嶄綔浜哄憳" + /> + + <el-table-column + prop="operdate" + label="鎿嶄綔鏃堕棿" + /> + <el-table-column + prop="opertype" + label="缁撴灉/瀵硅薄" + /> + + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="totalResume" + :page.sync="formResume.page" + :limit.sync="formResume.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMoldResumeSearch" + /> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleResume=false">杩� 鍥�</el-button> + <!-- <el-button--> + <!-- v-waves--> + <!-- type="primary"--> + <!-- :loading="$store.state.app.buttonIsDisabled"--> + <!-- :disabled="$store.state.app.buttonIsDisabled"--> + <!-- @click="dialogVisibleConfirm"--> + <!-- >纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime, handleDatetime2, validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { + ProductionScheduleReportExcelSearch, + ProductionScheduleReportSearch +} from '@/api/ReportManager' +import { AddUpdateMouldManger, DeleteMouldManger, MoldResumeSearch, MouldMangerSearch } from '@/api/MouldManager' +import { InventoryTreePermissions, WareHouse, WareHouseSelectLocation } from '@/api/GeneralBasicData' +import arrayToTree from 'array-to-tree' +import { TCunstomerDelete } from '@/api/basicSettings' + +export default { + name: 'MouldList', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + mouldstaus: '', // 妯″叿鐘舵�� + usestatus: '', // 浣跨敤鐘舵�� + mouldcode: '', // 妯″叿缂栫爜 + mouldname: '', // 妯″叿鍚嶇О + mouldspec: '', // 妯″叿瑙勬牸鍨嬪彿 + + createuser: '', // 鍒涘缓浜哄憳 + createdate: '', // 鍗曟嵁鏃ユ湡 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + + mouldstausArr: [ + { code: 'Y', name: '姝e父' }, + { code: 'N', name: '鏁呴殰' } + ], + onstateArr: [ + { code: 0, name: '鍦ㄥ簱' }, + { code: 1, name: '鍑哄簱' }, + { code: 2, name: '涓婃満' }, + { code: 3, name: '涓嬫満' }, + { code: 4, name: '寰呯淮淇�' }, + { code: 5, name: '宸茬淮淇�' }, + { code: 6, name: '宸查獙璇�' }, + { code: 7, name: '澶栧��' }, + { code: 8, name: '褰掕繕' } + ], + + total: 10, + tableData: [], + + operation: '', + dialogVisible: false, + dialogForm: { + mouldcode: '', + mouldname: '', + mouldspec: '', + warehousecode: '', // 浠撳簱缂栫爜 + location_code: '', // 搴撲綅缂栫爜 + surplife: '', + resilife: '', + status: 'Y', + mouldpart: '', + opertype: '' + }, + dialogFormRules: { + mouldcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + mouldname: [ + { required: true, message: '璇疯緭鍏ユā鍏峰悕绉�', trigger: ['blur', 'change'] } + ], + warehousecode: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨浠撳簱淇℃伅', trigger: ['blur', 'change'] } + ], + location_code: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨搴撲綅淇℃伅', trigger: ['blur', 'change'] } + ] + }, + filterText: '', + defaultProps: { + children: 'children', + label: 'name' + }, + + Inventory: [ + // { code: '-1', + // name: '鍏ㄩ儴' + // } + ], + + wareHouseArr: [], // 浠撳簱鏁扮粍 + locationArr: [], // 搴撲綅鏁扮粍 + + dialogVisibleResume: false, + formResume: { + mouldcode: '', + page: 1, + rows: 20 + }, + tableResume: [], + totalResume: 10 + + } + }, + watch: { + filterText(val) { + this.$refs.tree.filter(val) + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMouldMangerSearch() + this.getInventoryTreePermissions() + this.getWareHouse() + }, + created() { + this.getMouldMangerSearch() + + this.getInventoryTreePermissions() + this.getWareHouse() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getInventoryTreePermissions() { + const res = await InventoryTreePermissions() + res.data.forEach(i => { + i.name = i.code + ' ' + i.name + }) + + this.Inventory = arrayToTree(res.data, { + parentProperty: 'parentid', + customID: 'code', + childrenProperty: 'children' + }) + }, + async getWareHouse() { + const { data: res } = await WareHouse() + this.wareHouseArr = res + }, + async getMouldMangerSearch() { + let tempDate = this.form.createdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + mouldstaus: this.form.mouldstaus, + mouldcode: this.form.mouldcode, + wkshopcode: this.form.wkshopcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + partname: this.form.partname, + partspec: this.form.partspec, + createdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + } + + const res = await MouldMangerSearch(data) + this.tableData = res.data + this.total = res.count + }, + + // 瀵煎嚭 + async download() { + let tempDate = this.form.createdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + mouldstaus: this.form.mouldstaus, + mouldcode: this.form.mouldcode, + wkshopcode: this.form.wkshopcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + partname: this.form.partname, + partspec: this.form.partspec, + createdate: tempDate + } + + const res = await ProductionScheduleReportExcelSearch(data) + // console.log(res) + window.location.href = res.data + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldMangerSearch() + }, + // 鏌ヨ + search() { + this.getMouldMangerSearch() + }, + // 閲嶇疆 + reset() { + this.form.mouldstaus = '' + this.form.usestatus = '' + this.form.mouldcode = '' + this.form.mouldname = '' + + this.form.mouldspec = '' + this.form.createuser = '' + this.form.createdate = '' + this.getMouldMangerSearch() + }, + async warehousecodeChange(val) { + const { data: res } = await WareHouseSelectLocation({ warhousecode: val }) + this.locationArr = res + }, + add() { + this.operation = 'add' + this.dialogForm.opertype = 'Add' + this.dialogVisible = true + }, + edit(row) { + this.operation = 'edit' + this.dialogVisible = true + this.dialogForm.opertype = 'Update' + + this.$nextTick(() => { + this.dialogForm.mouldcode = row.code + this.dialogForm.mouldname = row.name + this.dialogForm.mouldspec = row.spec + this.dialogForm.warehousecode = row.warehousecode + this.dialogForm.location_code = row.location_code + this.dialogForm.surplife = row.surp_life + this.dialogForm.resilife = row.resi_life + this.dialogForm.status = row.status + this.dialogForm.mouldpart = row.partcode ? row.partcode.split(',') : [] + this.$refs.tree.setCheckedKeys(this.dialogForm.mouldpart) + }) + }, + connectClick(row) { + this.operation = 'connect' + this.dialogVisible = true + this.dialogForm.opertype = 'Update' + + this.$nextTick(() => { + this.dialogForm.mouldcode = row.code + this.dialogForm.mouldname = row.name + this.dialogForm.mouldspec = row.spec + // this.dialogForm.warehousecode = row.warehousecode + this.dialogForm.surplife = row.surp_life + this.dialogForm.resilife = row.resi_life + this.dialogForm.status = row.status + this.dialogForm.mouldpart = row.partcode ? row.partcode.split(',') : [] + this.$refs.tree.setCheckedKeys(this.dialogForm.mouldpart) + }) + }, + del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteMouldManger({ mouldcode: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + this.getMouldMangerSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + + // 灞ュ巻 + async view(row) { + this.formResume.mouldcode = row.code + this.formResume.mouldname = row.name + this.formResume.mouldspec = row.spec + this.formResume.username = localStorage.getItem('username') + this.formResume.surp_life = row.surp_life + this.formResume.serlife = row.serlife + this.formResume.lm_date = handleDatetime2(new Date()) + this.formResume.status = row.status + this.formResume.usestatus = row.usestatus + + await this.getMoldResumeSearch() + this.dialogVisibleResume = true + this.$nextTick(() => { + this.$refs.tableDataRef2.doLayout() + }) + }, + async getMoldResumeSearch() { + const data = { + mouldcode: this.formResume.mouldcode, + createdate: '', + page: this.formResume.page, + rows: this.formResume.rows, + prop: 'operdate', + order: 'desc' + } + const res = await MoldResumeSearch(data) + + if (res.code === '200') { + this.tableResume = res.data + this.totalResume = res.count + } + }, + + handleCloseResume() { + this.tableResume = [] + }, + + handleClose() { + this.dialogForm = { + mouldcode: '', + mouldname: '', + mouldspec: '', + warehousecode: '', + location_code: '', + surplife: '', + resilife: '', + status: 'Y', + mouldpart: '', + opertype: '' + } + if (this.operation !== 'connect') { + this.$refs.dialogForm.clearValidate() + } + }, + dialogVisibleCancel() { + this.dialogVisible = false + }, + dialogVisibleConfirm() { + if (this.operation !== 'connect') { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const checkData = this.$refs.tree.getCheckedNodes() + this.dialogForm.mouldpart = [] + checkData.forEach(item => { + if (!Object.keys(item).includes('children')) { + this.dialogForm.mouldpart.push(item.code) + } + }) + // if (this.dialogForm.mouldpart.length === 0) { + // return this.$message.info('鍏宠仈浜у搧涓嶈兘涓虹┖锛�') + // } + this.$store.state.app.buttonIsDisabled = true + AddUpdateMouldManger(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.$refs.tree.setCheckedKeys([]) + + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getMouldMangerSearch() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + } else { + const checkData = this.$refs.tree.getCheckedNodes() + this.dialogForm.mouldpart = [] + checkData.forEach(item => { + if (!Object.keys(item).includes('children')) { + this.dialogForm.mouldpart.push(item.code) + } + }) + this.$store.state.app.buttonIsDisabled = true + AddUpdateMouldManger(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success('鍏宠仈鎴愬姛锛�') + this.$refs.tree.setCheckedKeys([]) + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getMouldMangerSearch() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error('鍏宠仈澶辫触锛�') + } + }) + } + }, + filterNode(value, data) { + if (!value) return true + return data.name.indexOf(value) !== -1 + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } + +} +</script> +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} + +.dialogFormClass ::v-deep .el-form-item { + margin-bottom: 0; +} +</style> -- Gitblit v1.9.3