From c887bb7836b82573c0bc7d11b8dd46b4d7e522e1 Mon Sep 17 00:00:00 2001 From: “linengliang” <vanSuperEnergy@163.com> Date: 星期四, 14 九月 2023 18:11:55 +0800 Subject: [PATCH] 预测性维护工单 --- src/views/eam/modules/predictiveWorkOrder/select/ActualMaterialSelect.vue | 404 +++++++++++++++++++++++++++++++++------------------------ 1 files changed, 233 insertions(+), 171 deletions(-) diff --git a/src/views/eam/modules/predictiveWorkOrder/select/ActualMaterialSelect.vue b/src/views/eam/modules/predictiveWorkOrder/select/ActualMaterialSelect.vue index d5815d4..522cf50 100644 --- a/src/views/eam/modules/predictiveWorkOrder/select/ActualMaterialSelect.vue +++ b/src/views/eam/modules/predictiveWorkOrder/select/ActualMaterialSelect.vue @@ -1,230 +1,292 @@ <template> + <!--鏀寔鍏ㄥ睆缂╂斁--> <a-modal - :title="title" - :width="1000" - :visible="visible" - :confirmLoading="confirmLoading" - @ok="handleOk" - @cancel="handleCancel" - cancelText="鍏抽棴" + :visible='visible' + :title='title' + switchFullscreen + @ok='handleSubmit' + @cancel='close' + style='top:50px' + cancelText='鍏抽棴' + :width='1250' > - <a-spin :spinning="confirmLoading"> - <a-form :form="form"> - <!-- 鏌ヨ鍖哄煙 --> - <div class="table-page-search-wrapper"> - <a-form - layout="inline" - @keyup.enter.native="searchQuery" - > - <a-row :gutter="24"> - <a-col - :md="6" - :sm="8" - > - <a-form-item label="鐗╂枡缂栫爜"> - <j-input - placeholder="璇疯緭鍏ョ墿鏂欑紪鐮�" - v-model="queryParam.num" - ></j-input> - </a-form-item> - </a-col> - <a-col - :md="6" - :sm="8" - > - <a-form-item label="鐗╂枡鍚嶇О"> - <j-input - placeholder="璇疯緭鍏ョ墿鏂欏悕绉�" - v-model="queryParam.name" - ></j-input> - </a-form-item> - </a-col> - <a-col - :md="6" - :sm="8" + <a-card :bordered='false'> + <div class='table-page-search-wrapper'> + <a-form + layout='inline' + @keyup.enter.native='searchQuery' + > + <a-row :gutter='24'> + <a-col + :md='8' + :sm='6' + > + <a-form-item label='鍗曟嵁鍙�'> + <a-input + placeholder='璇疯緭鍏ュ崟鎹彿' + v-model='queryParam.num' + /> + </a-form-item> + </a-col> + <a-col :md='3'> + <span + style='float: left;overflow: hidden;' + class='table-page-search-submitButtons' > <a-button - type="primary" - @click="searchQuery" - icon="search" + type='primary' + @click='searchQuery' + icon='search' >鏌ヨ</a-button> <a-button - @click="searchReset" - icon="reload" - style="margin-left:8px;" + @click='searchReset' + icon='reload' + style='margin-left: 10px' >閲嶇疆</a-button> - </a-col> - </a-row> - <a-row :gutter="24"> - <a-col :span="24"> + </span> + </a-col> + </a-row> + </a-form> + </div> + <a-table + ref='table' + size='middle' + rowKey='id' + bordered + :columns='columns' + :dataSource='dataSource' + :pagination='ipagination' + :rowSelection='rowSelection' + :loading='loading' + @change='handleTableChange' + :scroll="{ x: 'calc(980px)', y: 900 }" + > - </a-col> - </a-row> - </a-form> - </div> - <div style="margin-top:8px;"> - <a-table - ref="table" - bordered - size="middle" - rowKey="id" - :columns="columns" - :dataSource="dataSource" - :pagination="ipagination" - :loading="loading" - :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}" - @change="handleTableChange" - :customRow="clickThenCheck" - > - </a-table> - </div> - </a-form> - </a-spin> + </a-table> + </a-card> </a-modal> </template> <script> -import pick from 'lodash.pick' -import { httpAction, getAction } from '@/api/manage' +import { filterObj } from '@/utils/util' +import { getAction } from '@/api/manage' import { JeecgListMixin } from '@/mixins/JeecgListMixin' -import JInput from '@/components/jeecg/JInput' + export default { - name: "MaterialSelectTable", + name: 'JSelectSparePartModal', mixins: [JeecgListMixin], - components: { - JInput - }, + components: {}, + props: {}, data() { return { - title: "鎿嶄綔", - visible: false, - model: {}, - confirmLoading: false, - form: this.$form.createForm(this), + queryParam: {}, columns: [ { title: '#', dataIndex: '', key: 'rowIndex', - width: 50, align: 'center', - customRender: function (t, r, index) { + customRender: function(t, r, index) { return parseInt(index) + 1 - } + }, + width: 50 }, { - title: '鐗╂枡缂栧彿', + title: '鍗曟嵁鍙�', align: 'center', - dataIndex: 'num', - sorter: true, + dataIndex: 'num' }, { - title: '鐗╂枡鍚嶇О', + title: '澶囦欢缂栫爜', align: 'center', - dataIndex: 'name', - sorter: true, + dataIndex: 'spareNum' }, { - title: '鐗╂枡瑙勬牸', + title: '澶囦欢鍚嶇О', align: 'center', - dataIndex: 'specification', - sorter: true, + dataIndex: 'spareName' }, { - title: '鐗╂枡鍨嬪彿', + title: '鍒堕�犲晢', align: 'center', - dataIndex: 'model', - sorter: true, + dataIndex: 'constructorName' }, { - title: '鍗曚綅', + title: '瑙勬牸', align: 'center', - dataIndex: 'unitId_dictText', - sorter: true, + dataIndex: 'specification' }, - + { + title: '鍨嬪彿', + align: 'center', + dataIndex: 'model' + }, + { + title: '涓诲崟浣�', + align: 'center', + dataIndex: 'mainUnitName' + }, + { + title: '涓绘暟閲�', + align: 'center', + dataIndex: 'mainQuantity' + }, + { + title: '鍙敤鏁伴噺', + align: 'center', + dataIndex: 'availableQuantity' + }, ], - url: { - list: "/base/material/list", + selectedRowKeys: [], + oldSelectRows: [], + dataSource: [], + selectionRows: [], + title: '鏍规嵁鏌ヨ缁撴灉閫夋嫨浜哄憳淇℃伅', + ipagination: { + current: 1, + pageSize: 10, + pageSizeOptions: ['5', '10', '30', '50', '100'], + showTotal: (total, range) => { + return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�' + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 }, - index: '', + isorter: { + column: 'num', + order: 'desc' + }, + visible: false, + loading: false, + url: { + list: '/eam/repairOrder/materialSpareList' + // list:'/spare/sparePartOutbound/list', + } } }, - methods: { - - searchQuery() { - this.loadData(1); - }, - - list(index) { - this.visible = true; - this.index = index; - this.loadData(1); - }, - - clickThenCheck(record) { + computed: { + rowSelection() { return { - on: { - click: (e) => { - this.selectedRowRecord = record; - this.onSelectChange(record.id.split(","), [record]); + type: 'checkbox', + onChange: (selectedRowKeys, selectedRows) => { + this.selectedRowKeys = selectedRowKeys + this.onSelectChange(selectedRows) + }, + getCheckboxProps: record => ({ + props: { + disabled: record.distable } - } - }; - }, - - onSelectChange(selectedRowKeys, selectedRows) { - this.selectedRowKeys = selectedRowKeys; - this.selectedRowRecord = selectedRows[0]; - }, - - close() { - this.queryParam = {}; - this.$emit('close'); - this.visible = false; - this.selectedRowKeys = []; - }, - - handleOk() { - const that = this; - // 瑙﹀彂琛ㄥ崟楠岃瘉 - if (that.selectedRowKeys.length > 0) { - if (that.selectedRowRecord.id != null && that.selectedRowRecord.id != "") { - that.$emit('sendMaterialRecord', { index: this.index, record: that.selectedRowRecord }); - that.close(); - } else { - that.$message.error("璇烽�夋嫨鐗╂枡锛�") - } - } else { - that.$message.error("璇烽�夋嫨鐗╂枡锛�") + }), + selectedRowKeys: this.selectedRowKeys } + } + }, + + methods: { + async loadData(arg) { + if (arg === 1) { + this.ipagination.current = 1 + } + const that = this + //this.loading = true + this.queryParam.status = '1' + let params = this.getQueryParams() + + //鏌ヨ鏉′欢 + await getAction(this.url.list, params).then((res) => { + if (res.success) { + for (let i = 0; i < res.result.records.length; i++) { + if (that.oldSelectRows.indexOf(res.result.records[i].id) > -1) { + res.result.records[i].distable = true + } else { + res.result.records[i].distable = false + } + } + this.dataSource = res.result.records + this.ipagination.total = res.result.total + } + if (res.code === 510) { + this.$message.warning(res.message) + } + //this.loading = false + }) }, - handleCancel() { - this.close(); + showModals(oldSelectRows) { + this.selectionRows = [] + this.oldSelectRows = oldSelectRows + this.visible = true + this.loadData(1) }, + getQueryParams() { + let param = Object.assign({}, this.queryParam, this.isorter) + param.field = this.getQueryField() + param.pageNo = this.ipagination.current + param.pageSize = this.ipagination.pageSize + return filterObj(param) + }, + //鏌ヨ鏉′欢澶勭悊 + getQueryField() { + let str = 'id,' + for (let a = 0; a < this.columns.length; a++) { + str += ',' + this.columns[a].dataIndex + } + return str + }, + searchReset(num) { + let that = this + this.queryParam = [] + if (num !== 0) { + that.loadData(1) + } + that.selectborrowIds = [] + }, + close() { + this.selectedRowKeys = [] + this.selectionRows = [] + this.visible = false + }, + handleTableChange(pagination, filters, sorter) { + //TODO 绛涢�� + if (Object.keys(sorter).length > 0) { + this.isorter.column = sorter.field + this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc' + } + this.ipagination = pagination + this.loadData() + }, + handleSubmit() { + if(this.selectionRows.length==0){ + this.$message.warn("璇烽�夋嫨澶囦欢"); + return false; + } + + this.$emit('getSelectRows', this.selectionRows) + this.close() + }, + onSelectChange(selectionRows) { + this.selectionRows = selectionRows + }, + searchQuery() { + this.loadData(1) + }, } } </script> -<style> -@import '~@assets/less/common.less'; -.frozenRowClass { - color: #c9c9c9; + +<style scoped> +.ant-table-tbody .ant-table-row td { + padding-top: 10px; + padding-bottom: 10px; } -.fontweight { - font-weight: bold; -} - -.fontweightfrozen { - font-weight: bold; - color: #c9c9c9; -} -.success { - color: green; -} -.error { - color: red; +#components-layout-demo-custom-trigger .trigger { + font-size: 18px; + line-height: 64px; + padding: 0 24px; + cursor: pointer; + transition: color 0.3s; } </style> \ No newline at end of file -- Gitblit v1.9.3