From 92ff846fb659c62037a32b1d8c15eae9df9d9b54 Mon Sep 17 00:00:00 2001 From: zenglf <18502938215@163.com> Date: 星期一, 18 九月 2023 13:24:30 +0800 Subject: [PATCH] Merge branch 'develop' of http://117.34.109.166:18448/r/vue_mdc_430 --- src/views/spare/modules/sparePart/SparePart2List.vue | 514 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 514 insertions(+), 0 deletions(-) diff --git a/src/views/spare/modules/sparePart/SparePart2List.vue b/src/views/spare/modules/sparePart/SparePart2List.vue new file mode 100644 index 0000000..2ac8d81 --- /dev/null +++ b/src/views/spare/modules/sparePart/SparePart2List.vue @@ -0,0 +1,514 @@ +<template> + <a-card + :bordered="false" + class="card-area" + > + <template slot="title"> + <i + class="action-jeecg actionsite2" + style="font-size: 18px;" + /> + 澶囦欢淇℃伅 + </template> + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <!-- 鎼滅储鍖哄煙 --> + <a-form + layout="inline" + @keyup.enter.native="searchQuery" + > + <a-row :gutter="24"> + <a-col + :md="8" + :sm="8" + > + <a-form-item label="澶囦欢缂栧彿"> + <j-input + placeholder="璇疯緭鍏ュ浠剁紪鍙锋煡璇�" + v-model="queryParam.num" + ></j-input> + </a-form-item> + </a-col> + <a-col + :md="8" + :sm="8" + > + <a-form-item label="澶囦欢鍚嶇О"> + <j-input + placeholder="璇疯緭鍏ュ浠跺悕绉版煡璇�" + v-model="queryParam.name" + ></j-input> + </a-form-item> + </a-col> + </a-row> + </a-form> + </div> + + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div + class="table-operator" + style="margin-top: 5px" + > + <a-button + type="primary" + @click="searchQuery" + icon="search" + >鏌ヨ</a-button> + <a-button + @click="searchReset" + icon="reload" + >閲嶇疆</a-button> + <a-button + @click="handleAdd" + type="primary" + v-has="'sparePartList:add'" + icon="plus" + :hidden="disabled" + >鏂板</a-button> + <a-button + type="primary" + icon="download" + @click="handleExportXls('澶囦欢淇℃伅')" + >瀵煎嚭</a-button> + <a-upload + name="file" + :showUploadList="false" + :multiple="false" + :headers="tokenHeader" + :action="importExcelUrl" + @change="handleImportExcel"> + <a-button type="primary" icon="import">瀵煎叆</a-button> + </a-upload> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <a-button style="margin-left: 8px"> + 鎵归噺鎿嶄綔 + <a-icon type="down" /> + </a-button> + <a-menu slot="overlay" > + <a-menu-item @click="batchDel"> + <a-icon type="delete" />鍒犻櫎 + </a-menu-item> + </a-menu> + </a-dropdown> + </div> + + <a-table + ref="table" + bordered + size="middle" + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="rowSelection" + @change="handleTableChange" + :scroll="{ x: 'calc(1500px + 50%)', y: 900 }" + :customRow="clickThenSelect" + > + + <span + slot="action" + slot-scope="text, record" + > + <a + href="javascript:;" + v-has="'sparePartList:edit'" + @click="handleEdit(record)" + >缂栬緫</a> + <a-divider type="vertical" /> + <a-dropdown> + <a class="ant-dropdown-link"> + 鏇村 + <a-icon type="down" /> + </a> + <a-menu slot="overlay" v-has="'sparePartList:delete'"> + <!-- <a-menu-item> + <a @click="handleEdit(record)">缂栬緫</a> + </a-menu-item> --> + <a-menu-item > + <a-popconfirm + title="纭畾鍒犻櫎鍚�?" + @confirm="() => handleDelete(record.id)" + > + <a>鍒犻櫎</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + </a-table> + + <a-tabs + type="card" + defaultActiveKey="1" + > + <a-tab-pane key="1"> + <span slot="tab"> + <a-badge>閫傞厤璁惧 </a-badge> + </span> + <div + class="table-operator" + style="margin-top: 0px" + > + <equipment-list ref="EquipmentList"></equipment-list> + </div> + </a-tab-pane> + + </a-tabs> + <spare-part-model + ref="modalForm" + @ok="modalFormOk" + ></spare-part-model> + + </a-card> +</template> + +<script> +import { requestPut, deleteAction, getFileAccessHttpUrl, getAction } from '@/api/manage' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import SparePartModel from './SparePartModel.vue' +import JInput from '@/components/jeecg/JInput' +import JEllipsis from '@/components/jeecg/JEllipsis' +import Tooltip from 'ant-design-vue/es/tooltip' +import Vue from 'vue' +import EquipmentList from './EquipmentList' + +export default { + name: 'SparePart2List.', + mixins: [JeecgListMixin], + components: { + SparePartModel, + JInput, + JEllipsis, + EquipmentList, + Tooltip + }, + props: { + nodeSelected: { + type: Object, + default: {} + } + }, + data() { + return { + disabled: true, + ipagination: { + current: 1, + pageSize: 5, + pageSizeOptions: ['5', '10', '20'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + selectedRowKeys: [], + selectionRows: [], + //榛樿鎺掑簭 + isorter: { + column: 'num', + order: 'asc', + }, + + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + align: 'center', + customRender: function (t, r, index) { + return parseInt(index) + 1 + }, + width: 50, + }, + { + title: '澶囦欢缂栫爜', + align: "center", + dataIndex: 'num', + }, + { + title: '澶囦欢鍚嶇О', + align: "center", + dataIndex: 'name', + }, + { + title: '鍨嬪彿', + align: "center", + dataIndex: 'model', + }, + { + title: '瑙勬牸', + align: "center", + dataIndex: 'specification', + }, + { + title: '鍒堕�犲晢', + align: "center", + dataIndex: 'constructorId_dictText', + }, + { + title: '鍗曚綅', + align: "center", + dataIndex: 'mainUnitId_dictText', + }, + /* { + title: '杈呭崟浣�', + align: "center", + dataIndex: 'auxiliaryUnitId_dictText', + }, */ + // { + // title: '涓绘暟閲�', + // align: "center", + // dataIndex: 'mainQuantity', + // }, + // { + // title: '杈呮暟閲�', + // align: "center", + // dataIndex: 'auxiliaryQuantity', + // }, + { + title: '鏈夋晥鏈�', + align: "center", + dataIndex: 'validityPeriod', + }, + { + title: '鏈夋晥鍗曚綅', + align: "center", + dataIndex: 'validityPeriodUnitId_dictText', + }, + { + title: '搴撳瓨涓婇檺鍊�', + align: "center", + dataIndex: 'inventoryUpperLimit', + }, + { + title: '搴撳瓨涓嬮檺鍊�', + align: "center", + dataIndex: 'inventoryLowerLimit', + }, + { + title: '缁忔祹璁㈣揣閲�', + align: "center", + dataIndex: 'economicOrderQuantity', + }, + { + title: '閲囪喘鎻愬墠鏈�', + align: "center", + dataIndex: 'purchaseLeadTime', + }, + { + title: '鎿嶄綔', + align: "center", + dataIndex: 'action', + scopedSlots: { + customRender: 'action', + }, + width: 200, + fixed: 'right', + }, + ], + url: { + list: "/spare/sparePart/list", + delete: "/spare/sparePart/delete", + deleteBatch: "/spare/sparePart/deleteBatch", + exportXlsUrl: '/spare/sparePart/exportXls', + importExcelUrl: '/spare/sparePart/importExcel', + }, + //鏂板銆佺紪杈戙�佸垹闄ゃ�佹壒閲忓垹闄ゆ搷浣滄敼鍙樻暟鎹悗鍒锋柊鍏宠仈鐨勭粍浠剁殑鐩戝惉灞炴�� + alterFlag: "", + equipmentRecord: {}, + // parentNum: "-1", + // parentName: "璁惧鍒嗙被", + }; + }, + + computed: { + rowSelection() { + return { + type: 'checkbox', + onChange: (selectedRowKeys, selectedRows) => { + this.selectedRowKeys = selectedRowKeys; + this.onSelectChange(selectedRowKeys, selectedRows); + }, + getCheckboxProps(record) { + return ({ + props: { + // disabled: !(record.equipmentCategoryDtlList.length == 0), + } + }) + }, + selectedRowKeys: this.selectedRowKeys, + }; + }, + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + } + }, + methods: { + + clickThenSelect(record) { + return { + on: { + click: () => { + this.onSelectChange(record.id.split(","), [record]); + } + } + } + }, + + onSelectChange(selectedRowKeys, selectionRows) { + if (selectedRowKeys.length == 1) { + this.$refs.EquipmentList.sparePartId = selectedRowKeys[0] + } else { + this.$refs.EquipmentList.sparePartId = '-1' + } + this.selectedRowKeys = selectedRowKeys; + this.selectionRows = selectionRows; + }, + + //绂佺敤鐘舵�佹牱寮� + tableRowClass(record, index) { + if (record.status != "1") { + return "frozenRowClass"; + } + return ""; + }, + handleAdd: function () { + this.$refs.modalForm.add(); + this.$refs.modalForm.title = "鏂板"; + this.$refs.modalForm.disableSubmit = false; + this.$refs.modalForm.sparePartCategoryId = this.nodeSelected.key; + }, + handleDelete: function (id) { + if (!this.url.delete) { + this.$message.error("璇疯缃畊rl.delete灞炴��!") + return + } + var that = this; + deleteAction(that.url.delete, { id: id }).then((res) => { + if (res.success) { + //閲嶆柊璁$畻鍒嗛〉闂 + that.reCalculatePage(1) + that.$message.success(res.message); + that.loadData(); + that.alterFlag = new Date(); + } else { + that.$message.warning(res.message); + } + }); + }, + + batchDel: function () { + if (!this.url.deleteBatch) { + this.$message.error("璇疯缃畊rl.deleteBatch灞炴��!") + return + } + if (this.selectedRowKeys.length <= 0) { + this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒'); + return; + } else { + var ids = ""; + for (var a = 0; a < this.selectedRowKeys.length; a++) { + ids += this.selectedRowKeys[a] + ","; + } + var that = this; + this.$confirm({ + title: "纭鍒犻櫎", + content: "鏄惁鍒犻櫎閫変腑鏁版嵁?", + onOk: function () { + that.loading = true; + deleteAction(that.url.deleteBatch, { ids: ids }).then((res) => { + if (res.success) { + //閲嶆柊璁$畻鍒嗛〉闂 + that.reCalculatePage(that.selectedRowKeys.length) + that.$message.success(res.message); + that.loadData(); + that.onClearSelected(); + that.alterFlag = new Date(); + } else { + that.$message.warning(res.message); + } + }).finally(() => { + that.loading = false; + }); + } + }); + } + }, + + searchReset() { + this.queryParam = {}; + if (this.nodeSelected.key != -1) { + this.disabled = false; + this.queryParam.sparePartCategoryId = this.nodeSelected.key; + } else { + this.disabled = true; + } + this.selectedRowKeys = [] + this.selectionRows = [] + this.$refs.EquipmentList.sparePartId = '-1' + this.loadData(1); + }, + + searchQuery() { + this.selectedRowKeys = [] + this.selectionRows = [] + this.$refs.EquipmentList.sparePartId = '-1' + this.loadData(1); + }, + + modalFormOk() { + // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃 + this.loadData() + //娓呯┖鍒楄〃閫変腑 + this.onClearSelected() + this.$refs.EquipmentList.sparePartId = '-1' + }, + }, + watch: { + alterFlag() { + this.$bus.$emit('queryTreeData'); + }, + nodeSelected() { + this.queryParam = {}; + if (this.nodeSelected.key != -1) { + this.disabled = false; + this.queryParam.sparePartCategoryId = this.nodeSelected.key; + } else { + this.disabled = true; + } + this.selectedRowKeys = [] + this.selectionRows = [] + this.$refs.EquipmentList.sparePartId = '-1' + this.loadData(1); + }, + }, + created() { + this.queryParam = {}; + this.queryParam.sparePartCategoryId = this.nodeSelected.key; + this.selectedRowKeys = [] + this.selectionRows = [] + this.loadData(1); + } + + +} +</script> +<style> +@import '~@assets/less/common.less'; + +.frozenRowClass { + color: #c9c9c9; +} +.success { + color: green; +} +.error { + color: red; +} +.fontweight { + font-weight: bold; +} +</style> \ No newline at end of file -- Gitblit v1.9.3