From 16696b259e984e86d07ae981d031d0c54bdc7089 Mon Sep 17 00:00:00 2001 From: zhuzhuanzhuan Date: 星期五, 08 三月 2024 10:05:39 +0800 Subject: [PATCH] 1、消息确认页面完成所有布局及功能 2、通过调整刷新页面的登出账号方式为路由跳转至登录页面,以试图解决token过期后无法正常跳转的问题(未在现场调试) --- src/utils/request.js | 8 + src/components/tools/UserMenu.vue | 2 src/views/mdc/base/MdcMessageApproval.vue | 177 +++++++++++++++++++++++++++++ src/views/mdc/base/modules/MdcMessageApproval/MdcMessageApprovalModal.vue | 144 ++++++++++++++++++++++++ 4 files changed, 328 insertions(+), 3 deletions(-) diff --git a/src/components/tools/UserMenu.vue b/src/components/tools/UserMenu.vue index 3da3327..54fe97a 100644 --- a/src/components/tools/UserMenu.vue +++ b/src/components/tools/UserMenu.vue @@ -185,7 +185,7 @@ return that.Logout({}).then(() => { // update-begin author:wangshuai date:20200601 for: 閫�鍑虹櫥褰曡烦杞櫥褰曢〉闈� that.$router.push({ path: '/user/login' }); - window.location.reload() + // window.location.reload() // update-end author:wangshuai date:20200601 for: 閫�鍑虹櫥褰曡烦杞櫥褰曢〉闈� }).catch(err => { that.$message.error({ diff --git a/src/utils/request.js b/src/utils/request.js index 4f0c381..26a7423 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -79,7 +79,8 @@ if (token) { store.dispatch('Logout').then(() => { setTimeout(() => { - window.location.reload() + router.push({ path: '/user/login' }); + // window.location.reload() }, 1500) }) } @@ -169,7 +170,10 @@ onOk: () => { store.dispatch('Logout').then(() => { Vue.ls.remove(ACCESS_TOKEN) - window.location.reload() + setTimeout(() => { + router.push({ path: '/user/login' }); + // window.location.reload() + }, 1500) }) } }) diff --git a/src/views/mdc/base/MdcMessageApproval.vue b/src/views/mdc/base/MdcMessageApproval.vue new file mode 100644 index 0000000..82c51fa --- /dev/null +++ b/src/views/mdc/base/MdcMessageApproval.vue @@ -0,0 +1,177 @@ +<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 :span="6"> + <a-form-item label="璁惧缂栧彿"> + <a-input placeholder="璇疯緭鍏ヨ澶囩紪鍙�" v-model="queryParam.equipmentId"></a-input> + </a-form-item> + </a-col> + <a-col :span="6"> + <a-form-item label="娑堟伅鐘舵��"> + <a-select v-model='queryParam.msgStatus' placeholder="璇烽�夋嫨娑堟伅鐘舵��"> + <a-select-option v-for="item in msgStatusOptionList" :value="item.value">{{item.title}} + </a-select-option> + </a-select> + </a-form-item> + </a-col> + + <a-col :span="8"> + <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> + + <a-table + ref="table" + size="default" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + @change="handleTableChange"> + <span slot="action" slot-scope="text, record"> + <a @click="showModal(record,0)">鏌ョ湅</a> + <a-divider type="vertical" v-if="record.hasProcess||record.hasConfirm"></a-divider> + <a @click="showModal(record,1)" v-if="record.hasProcess">涓婃姤</a> + <a-divider type="vertical" v-if="record.hasConfirm&&record.hasProcess"></a-divider> + <a @click="showModal(record,2)" v-if="record.hasConfirm">纭</a> + <!--<a @click="showModal(record,0)">鏌ョ湅</a>--> + <!--<a-divider type="vertical"></a-divider>--> + <!--<a @click="showModal(record,1)">涓婃姤</a>--> + <!--<a-divider type="vertical"></a-divider>--> + <!--<a @click="showModal(record,2)">纭</a>--> + </span> + </a-table> + <mdc-message-approval-modal ref="modalRef" :title="modalTitle" :visible="modalVisible" :buttonId="buttonId" + @closeModal="modalVisible = false" @formHasSubmitted="loadData"/> + </a-card> +</template> + +<script> + import { getAction, putAction } from '@/api/manage' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api' + import MdcMessageApprovalModal from './modules/MdcMessageApproval/MdcMessageApprovalModal' + + export default { + name: 'MdcMessageApproval', + mixins: [JeecgListMixin], + components: { MdcMessageApprovalModal }, + data() { + return { + description: 'mdc娑堟伅纭椤甸潰', + queryParam: {}, + columns: [ + { + title: '璁惧缂栧彿', + align: 'center', + dataIndex: 'equipmentId' + }, + { + title: '鏍囬', + align: 'center', + dataIndex: 'titile' + }, { + title: '鍐呭', + align: 'center', + dataIndex: 'msgContent', + width: 450 + }, { + title: '鍘熷洜', + align: 'center', + dataIndex: 'reportContent', + width: 450 + }, { + title: '澶勭悊浜�', + align: 'center', + dataIndex: 'senderNames' + }, { + title: '纭浜�', + align: 'center', + dataIndex: 'approverNames' + }, { + title: '鐘舵��', + align: 'center', + dataIndex: 'msgStatus', + customRender: function(text) { + if (text == '0') { + return '寰呭鐞�' + } else if (text == '1') { + return '寰呯‘璁�' + } else if (text == '2') { + return '宸茬‘璁�' + } else { + return '宸叉嫆缁�' + } + } + }, { + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + scopedSlots: { customRender: 'action' } + }], + url: { + list: '/mdc/mdcMessageApproval/list' + }, + loading: false, + msgStatusOptionList: [], + modalTitle: '', + modalVisible: false, + buttonId: null + } + }, + created() { + this.initDictData('mdcMsgStatus') + }, + methods: { + /** + * 璋冪敤鎺ュ彛鑾峰彇鏁版嵁瀛楀吀閰嶇疆msgStatus + * @param dictCode 鏁版嵁瀛楀吀缂栧彿 + */ + initDictData(dictCode) { + //鏍规嵁瀛楀吀Code, 鍒濆鍖栧瓧鍏告暟缁� + ajaxGetDictItems(dictCode, null).then((res) => { + if (res.success) { + console.log('res================', res) + this.msgStatusOptionList = res.result + } + }) + }, + + /** + * 鐐瑰嚮鎸夐挳灞曠ず寮圭獥 + * @param record 鐐瑰嚮琛屼俊鎭� + * @param buttonId 鎸夐挳Id锛堟煡鐪嬶細0锛屼笂鎶ワ細1锛岀‘璁わ細2锛� + */ + showModal(record, buttonId) { + this.buttonId = buttonId + switch (buttonId) { + case 0: + this.modalTitle = '娑堟伅鍐呭' + break + case 1: + this.modalTitle = '涓婃姤鍘熷洜' + break + case 2: + this.modalTitle = '纭娑堟伅' + break + default: + this.modalTitle = '娑堟伅鍐呭' + } + this.$refs.modalRef.formParams = Object.assign({}, record) + this.modalVisible = true + } + } + } +</script> diff --git a/src/views/mdc/base/modules/MdcMessageApproval/MdcMessageApprovalModal.vue b/src/views/mdc/base/modules/MdcMessageApproval/MdcMessageApprovalModal.vue new file mode 100644 index 0000000..30d9cbf --- /dev/null +++ b/src/views/mdc/base/modules/MdcMessageApproval/MdcMessageApprovalModal.vue @@ -0,0 +1,144 @@ +<template> + <a-modal :title="title" + :maskClosable="true" + @cancel="closeModal" + :visible="visible" + :footer="null"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :form="form" :model="formParams" :rules="validatorRules"> + <a-form-model-item label="璁惧缂栧彿" :labelCol="{span: 4}" :wrapperCol="{span: 8}"> + <a-input v-model="formParams.equipmentId" disabled></a-input> + </a-form-model-item> + <a-form-model-item label="鏍囬" :labelCol="{span: 4}" :wrapperCol="{span: 20}"> + <a-input v-model="formParams.titile" disabled></a-input> + </a-form-model-item> + <a-form-model-item label="鍐呭" :labelCol="{span: 4}" :wrapperCol="{span: 20}"> + <a-input v-model="formParams.msgContent" disabled></a-input> + </a-form-model-item> + + <a-form-model-item label="鍘熷洜" :labelCol="{span: 4}" :wrapperCol="{span: 20}" prop="reportContent" + v-if="buttonId===1"> + <a-textarea v-model="formParams.reportContent" :disabled="buttonId!==1"></a-textarea> + </a-form-model-item> + <a-form-model-item label="鍘熷洜" :labelCol="{span: 4}" :wrapperCol="{span: 20}" v-else> + <a-textarea v-model="formParams.reportContent" :disabled="buttonId!==1"></a-textarea> + </a-form-model-item> + + <a-form-model-item label="纭" :labelCol="{span: 4}" :wrapperCol="{span: 12}" prop="isConfirm" + v-if="buttonId==2"> + <a-select v-model='formParams.isConfirm' placeholder="璇烽�夋嫨鏄惁纭"> + <a-select-option value="2">纭</a-select-option> + <a-select-option value="3">鎷掔粷</a-select-option> + </a-select> + </a-form-model-item> + </a-form-model> + </a-spin> + + <div class="drawer-bottom-button" v-show="buttonId!==0"> + <a-popconfirm title="纭畾鏀惧純鎿嶄綔锛�" @confirm="closeModal" okText="纭畾" cancelText="鍙栨秷"> + <a-button style="margin-right: .8rem">鍙栨秷</a-button> + </a-popconfirm> + <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">鎻愪氦</a-button> + </div> + </a-modal> +</template> + +<script> + import { postAction } from '@/api/manage' + + export default { + name: 'MdcMessageApprovalModal', + props: { + visible: { + type: Boolean + }, + title: { + type: String + }, + buttonId: { + type: Number + } + }, + data() { + return { + form: this.$form.createForm(this), + formParams: { + equipmentId: '', + titile: '', + msgContent: '', + reportContent: '', + msgStatus: '', + isConfirm: '' + }, + confirmLoading: false, + validatorRules: { + reportContent: [ + { required: true, message: '璇疯緭鍏ヤ笂鎶ュ師鍥�' } + ], + isConfirm: [ + { required: true, message: '璇烽�夋嫨鏄惁纭' } + ] + }, + url: { + reportUrl: '/mdc/mdcMessageApproval/reportReason', + confirmUrl: '/mdc/mdcMessageApproval/handleConfirm' + } + } + }, + methods: { + closeModal() { + this.$refs.form.clearValidate() + this.$emit('closeModal') + }, + handleSubmit() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true + this.formParams.msgStatus = this.formParams.isConfirm + let obj + if (this.buttonId === 1) { + obj = postAction(this.url.reportUrl, this.formParams) + } else { + obj = postAction(this.url.confirmUrl, this.formParams) + } + obj.then((res) => { + if (res.success) { + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + that.$emit('formHasSubmitted') + } else { + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.confirmLoading = false + that.closeModal() + }) + } else { + return false + } + }) + } + } + } +</script> + +<style scoped lang="less"> + .drawer-bottom-button { + position: absolute; + bottom: -25px; + width: 100%; + border-top: 1px solid #e8e8e8; + padding: 10px 16px; + text-align: right; + left: 0; + background: #fff; + border-radius: 0 0 2px 2px; + } +</style> \ No newline at end of file -- Gitblit v1.9.3