From d3b947df2d7193ff59be8e60cbb63b73a4535c5b Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期二, 17 六月 2025 16:21:03 +0800 Subject: [PATCH] 设备管理-油液基础数据维护页面、设备台账增加油液信息页签 --- src/views/eam/base/modules/EamFluidModal.vue | 60 +++++ src/views/eam/base/modules/EamFluidForm.vue | 118 +++++++++ src/views/eam/equipment/modules/EamEquipmentFluidList.vue | 285 +++++++++++++++++++++++ src/views/eam/base/EamFluidList.vue | 199 ++++++++++++++++ src/views/eam/equipment/EamEquipmentList.vue | 7 5 files changed, 668 insertions(+), 1 deletions(-) diff --git a/src/views/eam/base/EamFluidList.vue b/src/views/eam/base/EamFluidList.vue new file mode 100644 index 0000000..068dfbf --- /dev/null +++ b/src/views/eam/base/EamFluidList.vue @@ -0,0 +1,199 @@ +<template> + <a-card :bordered="false"> + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="娌规恫缂栫爜"> + <j-input placeholder="璇疯緭鍏ユ补娑茬紪鐮�" v-model="queryParam.fluidCode"></j-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="娌规恫鍚嶇О"> + <j-input placeholder="璇疯緭鍏ユ补娑插悕绉�" v-model="queryParam.fluidName"></j-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 鏌ヨ鍖哄煙-END --> + + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator"> + <a-button @click="handleAdd" type="primary" icon="plus">鏂板</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> + <!-- 楂樼骇鏌ヨ鍖哄煙 --> +<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>--> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <a-menu slot="overlay"> + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>鍒犻櫎</a-menu-item> + </a-menu> + <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 <a-icon type="down" /></a-button> + </a-dropdown> + </div> + + <!-- table鍖哄煙-begin --> + <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤� + <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a> + </div> + + <a-table + ref="table" + size="middle" + :scroll="{x:true}" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + class="j-table-force-nowrap" + @change="handleTableChange"> + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + <template slot="imgSlot" slot-scope="text,record"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span> + <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> + </template> + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span> + <a-button + v-else + :ghost="true" + type="primary" + icon="download" + size="small" + @click="downloadFile(text)"> + 涓嬭浇 + </a-button> + </template> + + <span slot="action" slot-scope="text, record"> + <a @click="handleEdit(record)">缂栬緫</a> + + <a-divider type="vertical" /> + <a-dropdown> + <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a> + <a-menu slot="overlay"> + <a-menu-item> + <a @click="handleDetail(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> + </div> + + <eam-fluid-modal ref="modalForm" @ok="modalFormOk"></eam-fluid-modal> + </a-card> +</template> + +<script> + + import '@/assets/less/TableExpand.less' + import { mixinDevice } from '@/utils/mixin' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import EamFluidModal from './modules/EamFluidModal' + + export default { + name: 'EamFluidList', + mixins:[JeecgListMixin, mixinDevice], + components: { + EamFluidModal + }, + data () { + return { + description: '娌规恫淇℃伅绠$悊椤甸潰', + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key:'rowIndex', + width:60, + align:"center", + customRender:function (t,r,index) { + return parseInt(index)+1; + } + }, + { + title:'娌规恫缂栫爜', + align:"center", + dataIndex: 'fluidCode' + }, + { + title:'娌规恫鍚嶇О', + align:"center", + dataIndex: 'fluidName' + }, + { + title:'澶囨敞', + align:"center", + dataIndex: 'remark' + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' } + } + ], + url: { + list: "/eam/eamFluid/list", + delete: "/eam/eamFluid/delete", + deleteBatch: "/eam/eamFluid/deleteBatch", + exportXlsUrl: "/eam/eamFluid/exportXls", + importExcelUrl: "eam/eamFluid/importExcel", + + }, + dictOptions:{}, + superFieldList:[], + } + }, + created() { + this.getSuperFieldList(); + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + }, + }, + methods: { + initDictConfig(){ + }, + getSuperFieldList(){ + let fieldList=[]; + fieldList.push({type:'string',value:'fluidName',text:'娌规恫鍚嶇О',dictCode:''}) + fieldList.push({type:'string',value:'fluidCode',text:'娌规恫缂栫爜',dictCode:''}) + fieldList.push({type:'string',value:'remark',text:'澶囨敞',dictCode:''}) + this.superFieldList = fieldList + } + } + } +</script> +<style scoped> + @import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/src/views/eam/base/modules/EamFluidForm.vue b/src/views/eam/base/modules/EamFluidForm.vue new file mode 100644 index 0000000..3d54a1d --- /dev/null +++ b/src/views/eam/base/modules/EamFluidForm.vue @@ -0,0 +1,118 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="娌规恫缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fluidCode"> + <a-input v-model="model.fluidCode" placeholder="绯荤粺鑷姩鐢熸垚" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="娌规恫鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fluidName"> + <a-input v-model="model.fluidName" placeholder="璇疯緭鍏ユ补娑插悕绉�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> + <a-textarea v-model="model.remark" placeholder="璇疯緭鍏ュ娉�" ></a-textarea> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + + import { httpAction, getAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: 'EamFluidForm', + components: { + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + fluidName: [ + { required: true, message: '璇疯緭鍏ユ补娑插悕绉�!'}, + { validator: (rule, value, callback) => validateDuplicateValue('eam_fluid', 'fluid_name', value, this.model.id, callback) } + ], + }, + url: { + add: "/eam/eamFluid/add", + edit: "/eam/eamFluid/edit", + queryById: "/eam/eamFluid/queryById" + } + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + submitForm () { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + } + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + }) + } + + }) + }, + } + } +</script> \ No newline at end of file diff --git a/src/views/eam/base/modules/EamFluidModal.vue b/src/views/eam/base/modules/EamFluidModal.vue new file mode 100644 index 0000000..cebe597 --- /dev/null +++ b/src/views/eam/base/modules/EamFluidModal.vue @@ -0,0 +1,60 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + switchFullscreen + @ok="handleOk" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" + @cancel="handleCancel" + cancelText="鍏抽棴"> + <eam-fluid-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></eam-fluid-form> + </j-modal> +</template> + +<script> + + import EamFluidForm from './EamFluidForm' + export default { + name: 'EamFluidModal', + components: { + EamFluidForm + }, + data () { + return { + title:'', + width:800, + visible: false, + disableSubmit: false + } + }, + methods: { + add () { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.add(); + }) + }, + edit (record) { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.edit(record); + }) + }, + close () { + this.$emit('close'); + this.visible = false; + }, + handleOk () { + this.$refs.realForm.submitForm(); + }, + submitCallback(){ + this.$emit('ok'); + this.visible = false; + }, + handleCancel () { + this.close() + } + } + } +</script> \ No newline at end of file diff --git a/src/views/eam/equipment/EamEquipmentList.vue b/src/views/eam/equipment/EamEquipmentList.vue index 517d4c7..ade580a 100644 --- a/src/views/eam/equipment/EamEquipmentList.vue +++ b/src/views/eam/equipment/EamEquipmentList.vue @@ -174,6 +174,9 @@ <a-tab-pane tab="璁惧绮惧害" :key="8" v-if="isOpenPrecision"> <eam-equipment-precision-list ref="tabPaneTableListRef8" :isDisplayOperation="false"/> </a-tab-pane> + <a-tab-pane tab="璁惧娌规恫" :key="9"> + <eam-equipment-fluid-list ref="tabPaneTableListRef9" :isDisplayOperation="false"/> + </a-tab-pane> </a-tabs> <!-- 琛ㄥ崟鍖哄煙 --> @@ -202,6 +205,7 @@ import EamEquipmentPrecisionList from '@views/eam/equipment/modules/EamEquipmentPrecisionList.vue' import EamSecondMaintenanceOrderList from '@views/eam/maintenance/EamSecondMaintenanceOrderList.vue' import EamThirdMaintenanceOrderList from '@views/eam/maintenance/EamThirdMaintenanceOrderList.vue' + import EamEquipmentFluidList from '@views/eam/equipment/modules/EamEquipmentFluidList.vue' export default { name: 'EamEquipmentList', @@ -218,7 +222,8 @@ EamEquipmentProcessList, EamEquipmentPrecisionList, EamSecondMaintenanceOrderList, - EamThirdMaintenanceOrderList + EamThirdMaintenanceOrderList, + EamEquipmentFluidList }, data() { return { diff --git a/src/views/eam/equipment/modules/EamEquipmentFluidList.vue b/src/views/eam/equipment/modules/EamEquipmentFluidList.vue new file mode 100644 index 0000000..9ec6631 --- /dev/null +++ b/src/views/eam/equipment/modules/EamEquipmentFluidList.vue @@ -0,0 +1,285 @@ +<template> + <a-spin :spinning="confirmLoading"> + <vxe-toolbar> + <template v-slot:buttons> + <vxe-button status="primary" @click="insertEvent()">鏂板</vxe-button> + <vxe-button status="danger" @click="handleBatchRemove()">鎵归噺鍒犻櫎</vxe-button> + </template> + </vxe-toolbar> + <vxe-table + ref="editableDetailTable" + border + resizable + show-overflow + keep-source + :height="300" + :loading="confirmLoading" + :data="dataSource" + :edit-rules="validRules" + :edit-config="{trigger: 'manual', mode: 'row', showStatus: true}" + style="margin-top: 8px;"> + <vxe-table-column type="checkbox" width="60"></vxe-table-column> + <vxe-table-column type="seq" width="60"></vxe-table-column> + <vxe-table-column title="ID" field="id" :visible="false"></vxe-table-column> + <vxe-table-column title="equipmentId" field="equipmentId" :visible="false"></vxe-table-column> + <vxe-table-column title="娌规恫鍚嶇О" field="fluidId" align="center" + :edit-render="{name : '$select', options: fluidList, optionProps: {label:'fluidName', value:'id'}, props: {clearable:true}, events: {change:handleParamSelectChange}}"></vxe-table-column> + <vxe-table-column title="鍙傛暟缂栫爜" field="fluidCode" align="center"></vxe-table-column> + <vxe-table-column title="鎿嶄綔" width="160"> + <template v-slot="{row}"> + <template v-if="hasEditStatus(row)"> + <vxe-button @click="saveRowEvent(row)">淇濆瓨</vxe-button> + <vxe-button @click="cancelRowEvent(row)">鍙栨秷</vxe-button> + </template> + <template v-else> + <vxe-button @click="editRowEvent(row)">缂栬緫</vxe-button> + <vxe-button @click="handleRemove(row)">鍒犻櫎</vxe-button> + </template> + + </template> + </vxe-table-column> + </vxe-table> + <a-pagination + v-bind="ipagination" + @change="handlePageChange" + @showSizeChange="handleShowSizeChange" + /> + </a-spin> +</template> + +<script> +import { deleteAction, getAction, httpAction } from '@/api/manage' + +export default { + name: 'EamEquipmentFluidList', + data() { + return { + title: '鎿嶄綔', + confirmLoading: false, + url: { + add: '/eam/eamEquipmentFluid/add', + edit: '/eam/eamEquipmentFluid/edit', + list: '/eam/eamEquipmentFluid/list', + delete: '/eam/eamEquipmentFluid/delete', + deleteBatch: '/eam/eamEquipmentFluid/deleteBatch', + fluidList: '/eam/eamFluid/listAll' + }, + /* 鍒嗛〉鍙傛暟 */ + ipagination: { + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '20', '30'], + showTotal: (total, range) => { + return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�' + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0, + size: 'small' + }, + dataSource: [], + fluidList: [], + queryParam: { + equipmentId: '-1' + }, + validRules: { + fluidId: [ + { required: true, message: '璇烽�夋嫨娌规恫锛�' } + ] + } + } + }, + created() { + this.loadFluidList() + }, + methods: { + handleParamSelectChange($event, value) { + console.log(value) + let parameter = this.fluidList.find(item => item.id === value.value) + if (parameter) { + $event.row.fluidCode = parameter.fluidCode + } else { + $event.row.fluidCode = undefined + } + }, + loadFluidList() { + getAction(this.url.fluidList).then(res => { + if (res.success) { + this.fluidList = [...res.result] + } + }) + }, + onClearSelected() { + this.dataSource = [] + this.queryParam.equipmentId = '-1' + this.ipagination.current = 1 + this.ipagination.total = 0 + }, + loadData(args) { + if (!this.url.list) { + this.$message.error('璇疯缃畊rl.list灞炴��!') + return + } + if (args === 1) { + this.ipagination.current = 1 + } + // 灏佽鏌ヨ鏉′欢 + let formData = { + pageNo: args, + pageSize: this.ipagination.pageSize, + equipmentId: this.queryParam.equipmentId + } + // 璋冪敤鏌ヨ鏁版嵁鎺ュ彛 + this.confirmLoading = true + getAction(this.url.list, formData).then(res => { + if (res.success) { + // 鍚庡彴鏌ヨ鍥炴潵鐨� total锛屾暟鎹�绘暟閲� + this.dataSource = res.result.records || res.result + if (res.result.total) { + this.ipagination.total = res.result.total + } else { + this.ipagination.total = 0 + } + } else { + this.$message.warning(res.message) + } + }).finally(() => { + // 杩欓噷鏄棤璁烘垚鍔熸垨澶辫触閮戒細鎵ц鐨勬柟娉曪紝鍦ㄨ繖閲屽叧闂璴oading + this.confirmLoading = false + }) + }, + async insertEvent() { + let record = { equipmentId: this.queryParam.equipmentId } + let { row: newRow } = await this.$refs.editableDetailTable.insert(record) + await this.$refs.editableDetailTable.setActiveCell(newRow, 'fluidId') + }, + async saveRowEvent(row) { + let that = this + const errMap = await that.$refs.editableDetailTable.validate().catch(errMap => errMap) + if (errMap) { + that.$message.warning('鏍¢獙涓嶉�氳繃,璇疯ˉ鍏呭繀濉」锛�') + return + } + that.confirmLoading = true + let httpurl = '' + let method = '' + if (!row.id) { + httpurl += that.url.add + method = 'post' + } else { + httpurl += that.url.edit + method = 'put' + } + let res = await httpAction(httpurl, row, method) + if (res.success) { + that.$message.success(res.message) + that.loadData(that.ipagination.current) + await that.$refs.editableDetailTable.clearActived() + } else { + that.$message.warning(res.message) + } + that.confirmLoading = false + }, + handleRemove(row) { + let xTable = this.$refs.editableDetailTable + let that = this + this.$confirm({ + content: `纭瑕佸垹闄ゅ悧锛焋, + onOk: () => { + if (row.id) { + //鍚庣鍒犻櫎 + deleteAction(that.url.delete, { id: row.id }).then((res) => { + if (res.success) { + that.reCalculatePage(1) + that.$message.success(res.message) + that.loadData(that.ipagination.current) + } else { + that.$message.warning(res.message) + } + }) + } else { + //鍓嶇鍒犻櫎 + xTable.remove(row) + } + }, + onCancel: () => { + xTable.setActiveCell(row, 'fluidId') + } + }) + }, + handleBatchRemove(){ + let xTable = this.$refs.editableDetailTable + let that = this + let checkboxRecords = xTable.getCheckboxRecords(); + if(checkboxRecords && checkboxRecords.length > 0) { + let ids = checkboxRecords.map(record => record.id); + this.$confirm({ + title: "纭鍒犻櫎", + content: "鏄惁鍒犻櫎閫変腑鏁版嵁?", + onOk: function () { + that.confirmLoading = true; + deleteAction(that.url.deleteBatch, {ids: ids.join(',')}).then((res) => { + if (res.success) { + //閲嶆柊璁$畻鍒嗛〉闂 + that.reCalculatePage(checkboxRecords.length) + that.$message.success(res.message); + that.loadData(that.ipagination.current); + } else { + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + }); + } + }); + } else { + that.$message.warning('璇峰厛閫変腑鏁版嵁琛岋紒'); + } + }, + editRowEvent(row) { + this.$refs.editableDetailTable.setActiveRow(row) + }, + cancelRowEvent(row) { + let xTable = this.$refs.editableDetailTable + this.$confirm({ + content: `纭瑕佹斁寮冪紪杈戝悧锛焋, + onOk: () => { + xTable.revertData() + }, + onCancel: () => { + xTable.setActiveCell(row, 'fluidId') + } + }) + }, + hasEditStatus(row) { + const $table = this.$refs.editableDetailTable + if ($table) { + return $table.isActiveByRow(row) + } + return false + }, + reCalculatePage(count) { + //鎬绘暟閲�-count + let total = this.ipagination.total - count + //鑾峰彇鍒犻櫎鍚庣殑鍒嗛〉鏁� + let currentIndex = Math.ceil(total / this.ipagination.pageSize) + //鍒犻櫎鍚庣殑鍒嗛〉鏁�<鎵�鍦ㄥ綋鍓嶉〉 + if (currentIndex < this.ipagination.current) { + this.ipagination.current = currentIndex + } + }, + handlePageChange(current, pageSize){ + this.$set(this.ipagination, 'current', current) + this.$emit('change', {current, pageSize}) + }, + handleShowSizeChange(current, pageSize){ + this.$set(this.ipagination, 'pageSize', pageSize) + this.$emit('change', {current, pageSize}) + }, + } +} +</script> + +<style lang="less" scoped> + +</style> \ No newline at end of file -- Gitblit v1.9.3