| | |
| | | import http from "@/http"; |
| | | |
| | | export function deleteMessage(params) { |
| | | return http.post('/sccg/message/delete', params); |
| | | return http.delete('/sccg/message/delete', params); |
| | | } |
| | | |
| | | export function getMessageById(id) { |
| | |
| | | import http from "@/http"; |
| | | export default { |
| | | getBayonetList: (params) => { return http.get('/sccg/equipment_bayonet/query', params); }, |
| | | exportBayonetList: (params) => { return http.get('/sccg/equipment_bayonet/export', params); }, |
| | | exportBayonetList: (params) => { return http.downloadFile('/sccg/equipment_bayonet/export', params); }, |
| | | addBayonet: (params) => { return http.post('/sccg/equipment_bayonet/addition', params); }, |
| | | updateBayonet: (params) => { return http.put('/sccg/equipment_bayonet/modification', params) } |
| | | } |
| | |
| | | } |
| | | |
| | | export function exportTeamInfo(params) { |
| | | return http.post('/sccg/team_construction/export', {}, params); |
| | | return http.downloadFile('/sccg/team_construction/export', params); |
| | | } |
| | | |
| | | export function importTeamInfo(data) { |
| | |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import E from 'wangeditor' |
| | | import wangEditor from 'wangeditor' |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | editor: null |
| | | } |
| | | }, |
| | | props:['getMyBody'], |
| | | mounted() { |
| | | this.editor = new E('#edit'); |
| | | this.editor.config.height = 450; |
| | | this.editor.config.colors = [ |
| | | '#4b9bb7', |
| | | '#09152f' |
| | | ] |
| | | |
| | | this.editor.config.onchange = (html)=>{ |
| | | // 第二步,监控变化,同步更新到 textarea |
| | | this.$emit('getMyBody', html); |
| | | } |
| | | this.editor.create(); |
| | | this.editor = new wangEditor('#edit'); |
| | | this.editor.customConfig = this.editor.config; |
| | | this.editor.customConfig.height = 450; |
| | | this.editor.customConfig.colors = ['#4b9bb7', '#09152f']; |
| | | this.editor.customConfig.placeholder = '请输入'; |
| | | this.editor.customConfig.onchangeTimeout = 500; |
| | | this.editor.create(); |
| | | }, |
| | | beforeDestroy() { |
| | | this.editor.destroy(); |
| | |
| | | import axios from 'axios' |
| | | import { |
| | | handleResponseSuccess, |
| | | handleResponseFail, |
| | | handleRequest |
| | | } from './interceptor-handler' |
| | | import { |
| | | showFullScreenLoading |
| | | } from '@/utils/loading' |
| | | import {handleRequest, handleResponseFail, handleResponseSuccess} from './interceptor-handler' |
| | | import {showFullScreenLoading} from '@/utils/loading' |
| | | |
| | | // URL 记录器 |
| | | import urlRecorder from './url-recorder' |
| | |
| | | return axiosInstance(config) |
| | | }, |
| | | // DELETE更新数据 |
| | | delete(url, data = {}, throwError) { |
| | | delete(url, params = {}, data = {}, throwError) { |
| | | const config = { |
| | | method: 'delete', |
| | | params, |
| | | url, |
| | | data: JSON.stringify(data), |
| | | errorHandler: (!throwError && this.defaultErrorHandler) || null, |
| | |
| | | return axiosInstance(config) |
| | | }, |
| | | /** |
| | | * 通过表单get下载文件。并统一处理常见的错误 |
| | | * 通过表单下载文件。并统一处理常见的错误 |
| | | * @param {string} url |
| | | * @param {String} fileName 文件名 |
| | | * @param params 传参 |
| | | * @param {Object?} data 上传进度回调,参数为event |
| | | * @param {Function?} throwError 是否不使用默认的异常处理方法,而把异常抛出来 |
| | | * @return {Promise} 返回一个promise对象 |
| | | */ |
| | | downloadFile(url, params, data = {}, throwError) { |
| | | const { |
| | | fileName, |
| | | type |
| | | } = params |
| | | return axiosInstance({ |
| | | method: 'GET', |
| | | downloadFile(url, params= {}, data = {}, throwError) { |
| | | const config = { |
| | | method: 'POST', |
| | | url, |
| | | responseType: 'arraybuffer', |
| | | params, |
| | | data: JSON.stringify(data), |
| | | responseType: 'arraybuffer', |
| | | errorHandler: (!throwError && this.defaultErrorHandler) || null, |
| | | timeout: 50000, |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(response => { |
| | | const blob = new Blob([response], { |
| | | type |
| | | }) // 不兼容type |
| | | // 利用a标签实现下载 |
| | | const link = document.createElement('a') |
| | | link.style.display = 'none' |
| | | link.setAttribute('type', MimeType) // 并不支持 |
| | | const downUrl = window.URL.createObjectURL(blob) |
| | | link.href = downUrl |
| | | // 添加到浏览器为了兼容 firefox |
| | | document.body.appendChild(link) |
| | | // 为了兼容qq浏览器,fileName中必须加上文件后缀 |
| | | link.download = fileName |
| | | link.click() |
| | | document.body.removeChild(link) |
| | | }) |
| | | }, |
| | | /** |
| | | * 通过a标签打开文件 |
| | | * @param {string} url |
| | | */ |
| | | downloadFileByA(url) { |
| | | // const {fileName} = params |
| | | // 利用a标签实现下载 |
| | | const link = document.createElement('a') |
| | | link.style.display = 'none' |
| | | link.href = `${process.env.VUE_APP_DOWN_FILE}${url}` |
| | | // 添加到浏览器为了兼容 firefox |
| | | document.body.appendChild(link) |
| | | // 为了兼容qq浏览器,fileName中必须加上文件后缀 |
| | | // link.download = fileName |
| | | link.click() |
| | | document.body.removeChild(link) |
| | | return Promise.resolve() |
| | | }, |
| | | /** |
| | | * 通过a标签下载文件 |
| | | * @param {string} url |
| | | */ |
| | | downloadFileByAtag(url) { |
| | | // 利用a标签实现下载 |
| | | const link = document.createElement('a') |
| | | link.download = url |
| | | link.target = '_blank' |
| | | link.style.display = 'none' |
| | | link.href = url |
| | | document.body.appendChild(link) |
| | | link.click() |
| | | document.body.removeChild(link) |
| | | return Promise.resolve() |
| | | }, |
| | | withCredentials: this.withCredentials |
| | | } |
| | | urlRecorder.add(config) |
| | | if (data.showLoading === undefined) { |
| | | showFullScreenLoading() |
| | | } |
| | | return axiosInstance(config) |
| | | }, |
| | | /** |
| | | * 通过表单post上传文件并接收json格式的数据。并统一处理常见的错误 |
| | |
| | | // 深拷贝 |
| | | export function deepClone(obj) { |
| | | let objClone = Array.isArray(obj) ? [] : {}; |
| | | if (obj && typeof obj === 'object' && obj != null) { |
| | | if (obj && typeof obj === 'object') { |
| | | for (let key in obj) { |
| | | if (obj.hasOwnProperty(key)) { |
| | | if (obj[key] && typeof obj[key] === 'object') { |
| | |
| | | // data: 文件, contentDisposition:请求头中文件的名字 |
| | | // 默认不用修改,直接将返回的res传入即可 |
| | | export function downloadFile(res) { |
| | | const blob = new Blob([res.data], { type: '.xlsx' }); |
| | | const blob = new Blob([res.data], { type: 'application/octet-stream' }); |
| | | const fileName = res.contentDisposition.split(`''`)[1]; |
| | | if (window.navigator && window.navigator.msSaveBlob) { |
| | | navigator.msSaveBlob(blob, fileName); |
| | | window.navigator.msSaveBlob(blob, fileName); |
| | | } else { |
| | | const link = document.createElement('a'); |
| | | link.style.display = 'none'; |
| | | link.href = URL.createObjectURL(blob); |
| | | link.setAttribute('download', decodeURI(fileName)); |
| | | link.href = window.URL.createObjectURL(blob); |
| | | link.download = decodeURI(fileName); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | URL.revokeObjectURL(link.href); |
| | | window.URL.revokeObjectURL(link.href); |
| | | document.body.removeChild(link); |
| | | } |
| | | } |
| | |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | <!-- 设置 --> |
| | | <!-- <div class="menu-right__item btn"> |
| | | <el-tooltip effect="dark" content="账户设置" placement="bottom-end" :hide-after="1000"> |
| | | <i class="el-icon-s-tools"></i> |
| | | </el-tooltip> |
| | | </div> --> |
| | | <!-- 退出登录 --> |
| | | <div class="menu-right__item btn" @click="loginout"> |
| | | <el-tooltip effect="dark" content="退出登录" placement="bottom-end" :hide-after="1000"> |
| | |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { getNowDate } from "@/utils/helper"; |
| | | import {downloadFile, getNowDate} from "@/utils/helper"; |
| | | import helper from "@/utils/mydate"; |
| | | import { parseTime } from "@/utils/index"; |
| | | import { createNamespacedHelpers } from "vuex"; |
| | |
| | | <div class="mainContent"> |
| | | <div class="main-nav"> |
| | | <span>数据列表</span> |
| | | <el-button type="primary" icon="el-icon-plus" @click="dialogCreate = true">添加</el-button> |
| | | <el-button type="primary" icon="el-icon-plus" @click="handleOpera(null, 'create')">添加</el-button> |
| | | </div> |
| | | <!-- 数据展示 --> |
| | | <el-table ref="multipleTable" |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="head" label="标题" min-width="10"> |
| | | </el-table-column> |
| | | <el-table-column prop="updateTime" label="修改时间" min-width="10"> |
| | | <template slot-scope="scope"> |
| | | <span>{{changeTime(scope.row)}}</span> |
| | | </template> |
| | | <el-table-column prop="createTime" label="修改时间" min-width="10"> |
| | | </el-table-column> |
| | | <el-table-column prop="targetFrom" label="发布人员" min-width="15"> |
| | | <el-table-column prop="createUser" label="发布人员" min-width="15"> |
| | | </el-table-column> |
| | | <el-table-column prop="channelCode" label="消息分类" min-width="10"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ getMessageType(scope.row.channelCode) }}</span> |
| | | </template> |
| | | <el-table-column prop="messageTypeName" label="消息分类" min-width="10"> |
| | | </el-table-column> |
| | | <el-table-column prop="status" label="发布状态" min-width="5"> |
| | | <template slot-scope="scope"> |
| | |
| | | <el-table-column prop="operation" label="操作" min-width="15"> |
| | | <template slot-scope="scope"> |
| | | <div class="operation"> |
| | | <el-link icon="el-icon-view" :underline="false" @click="handleView(scope.row)">查看</el-link> |
| | | <el-link icon="el-icon-edit" class="leftPx" :underline="false" @click="handleEdit(scope.row)">编辑</el-link> |
| | | <el-link icon="el-icon-view" :underline="false" @click="handleOpera(scope.row, 'view')">查看</el-link> |
| | | <el-link icon="el-icon-edit" class="leftPx" :underline="false" @click="handleOpera(scope.row, 'update')">编辑</el-link> |
| | | <el-link class="leftPx" icon="el-icon-delete-solid" :underline="false" |
| | | @click="handleDelete([scope.row.id])">删除</el-link> |
| | | </div> |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- 新建消息 --> |
| | | <el-dialog title="新建消息" :visible.sync="dialogCreate" width="80%" |
| | | :before-close="handleConfirmClose"> |
| | | <MyEdit @closeMyDialog="closeDialog" :type="'create'" :myDataRow="null"></MyEdit> |
| | | </el-dialog> |
| | | <!-- 消息详情 --> |
| | | <el-dialog title="消息详情" :visible.sync="dialogView" v-if="dialogView" width="45%" |
| | | :before-close="handleClose"> |
| | | <MyView @closeDialog="closeDialog" :myDataRow="tableRowData">></MyView> |
| | | </el-dialog> |
| | | <!-- 编辑页面 --> |
| | | <el-dialog title="编辑消息" :visible.sync="dialogEdit" width="80%" |
| | | :before-close="handleClose"> |
| | | <MyEdit @closeDialog="closeDialog" :myDataRow="tableRowData" :type="'update'"></MyEdit> |
| | | <el-dialog :destroy-on-close="true" :key="dialogType" :title="getDialogTitle" :visible.sync="isShowDialog" width="80%"> |
| | | <my-edit @closeMyDialog="closeDialog" :type="dialogType" :myDataRow="tableRowData"></my-edit> |
| | | </el-dialog> |
| | | <!-- tools --> |
| | | <div class="tools"> |
| | |
| | | <el-dialog |
| | | title="高级参数" |
| | | :visible.sync="isShowMoreParams" |
| | | width="30%" |
| | | :before-close="handleClose"> |
| | | width="30%"> |
| | | </el-dialog> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import helper from '@/utils/mydate' |
| | | import MyView from './myview' |
| | | import MyEdit from './update' |
| | | import { deleteMessage, getMessageById, getMessageList } from "@/api/operate/messageManagement"; |
| | | import {SUCCESS_CODE} from "@/utils"; |
| | | |
| | | export default { |
| | | components: { MyView, MyEdit }, |
| | | computed: { |
| | | getDialogTitle() { |
| | | if (this.dialogType === 'create') { |
| | | return '创建'; |
| | | } |
| | | |
| | | if (this.dialogType === 'update') { |
| | | return '更新'; |
| | | } |
| | | |
| | | if (this.dialogType === 'view') { |
| | | return '查看'; |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | tableData: [], |
| | | tableRowData: null, |
| | | isShowMoreParams: false, |
| | | context: '', |
| | | dialogEdit: false, |
| | | dialogCreate: false, |
| | | dialogView: false, |
| | | context: null, |
| | | isShowDialog: false, |
| | | dialogType: false, |
| | | totalNum: null, |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | |
| | | this.messageStatus = 2; |
| | | this.messageType = '00'; |
| | | this.context = ''; |
| | | this.getMessageList(); |
| | | }, |
| | | |
| | | // 查看 |
| | | handleView(data){ |
| | | handleOpera(data, type){ |
| | | this.tableRowData = data; |
| | | this.dialogView = true; |
| | | }, |
| | | |
| | | // 编辑 |
| | | handleEdit(data){ |
| | | this.tableRowData = data; |
| | | this.dialogEdit = true; |
| | | this.dialogType = type; |
| | | this.isShowDialog = true; |
| | | }, |
| | | |
| | | // 删除信息 |
| | | handleDelete(idarr) { |
| | | this.$confirm('确认删除?') |
| | | .then(() => { |
| | | deleteMessage(idarr) |
| | | .then(({ code, message }) => { |
| | | if (code === SUCCESS_CODE) { |
| | | this.getMessageList(); |
| | | this.$message({ type: 'success', message }); |
| | | } else { |
| | | this.$message({ type: 'error', message }); |
| | | } |
| | | deleteMessage({ ids: idarr.join(',') }) |
| | | .then(() => { |
| | | this.getMessageList(); |
| | | this.$message.success('操作成功'); |
| | | }) |
| | | .catch(err => { this.$message({ type: 'error', message: err }) }); |
| | | }) |
| | |
| | | head: this.context |
| | | } |
| | | getMessageList(messageParam) |
| | | .then(({ data }) => { |
| | | this.tableData = []; |
| | | .then(({ records, total }) => { |
| | | this.tableData = records; |
| | | this.totalNum = total; |
| | | }) |
| | | .catch(err => { |
| | | this.$message({ type: 'error', message: err }); |
| | |
| | | }) |
| | | this.all = list.length === this.tableData.length; |
| | | }, |
| | | |
| | | // 修改时间格式 |
| | | changeTime({ updateTime }) { |
| | | return helper(updateTime); |
| | | }, |
| | | |
| | | // 全选 |
| | | selectAll() { |
| | | this.$refs.multipleTable.toggleAllSelection(); |
| | |
| | | this.isShowMoreParams = true; |
| | | }, |
| | | |
| | | // 关闭弹窗 |
| | | handleClose(done) { |
| | | done(); |
| | | }, |
| | | |
| | | // 确认关闭弹窗 |
| | | handleConfirmClose(done) { |
| | | this.$confirm('确认关闭?') |
| | | .then(_ => { |
| | | done(); |
| | | }) |
| | | .catch(err => { |
| | | }) |
| | | }, |
| | | |
| | | // 自定义关闭弹窗 |
| | | closeDialog({ flag, index }) { |
| | | this.dialogCreate = flag; |
| | | this.dialogView = flag; |
| | | if (index === 1) { |
| | | this.getMessageList(); |
| | | } |
| | | }, |
| | | |
| | | getMessageType(id) { |
| | | const result = this.typeList.find(item => item.id === id); |
| | | return result.columnName; |
| | | closeDialog() { |
| | | this.isShowDialog = false; |
| | | this.getMessageList(); |
| | | } |
| | | } |
| | | } |
| | |
| | | <!-- 提醒方式 --> |
| | | <el-form-item class="optionItem" label="提醒方式:" prop="channelCode"> |
| | | <el-radio-group v-model="role.channelCode"> |
| | | <el-radio label="01">站内信</el-radio> |
| | | <el-radio label="02">邮件</el-radio> |
| | | <el-radio label="01" value="01">站内信</el-radio> |
| | | <el-radio label="02" value="02">邮件</el-radio> |
| | | </el-radio-group> |
| | | <span class="message-tip">(短信可用数: 1000条)</span> |
| | | </el-form-item> |
| | |
| | | </el-form-item> |
| | | <!-- 消息内容 --> |
| | | <el-form-item class="optionItem" label="消息内容:" prop="body"> |
| | | <MyEditor ref="edit" @getMyBody="getMyBody"></MyEditor> |
| | | <MyEditor ref="edit"></MyEditor> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <div class="optionBtn"> |
| | |
| | | import MyEditor from "@/components/edit"; |
| | | import MyColumnAdd from "@/views/operate/message/mycontrol/createUser"; |
| | | import MyColView from "../messageView"; |
| | | import { sendMessage, updateMessage } from "@/api/operate/messageManagement"; |
| | | import { sendMessage, updateMessage, getMessageById } from "@/api/operate/messageManagement"; |
| | | |
| | | export default { |
| | | components: { MyEditor, MyColumnAdd, MyColView }, |
| | | props: ["type", "myDataRow"], |
| | | data() { |
| | | const validateEditor = (rule, value, callback) => { |
| | | if (value) { |
| | | callback(); |
| | | } else { |
| | | callback(new Error('请输入')); |
| | | } |
| | | }; |
| | | return { |
| | | role: { |
| | | messageType: "", |
| | | head: "", |
| | | targetTo: "", |
| | | targetFrom: null, |
| | | body: "", |
| | | channelCode: "01", |
| | | }, |
| | |
| | | body: [ |
| | | { |
| | | required: true, |
| | | trigger: ["blue", "change"], |
| | | message: "请输入消息内容", |
| | | validator: validateEditor |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | this.getColumnList(); |
| | | this.getDepartList(); |
| | | this.getLoginUserInfo(); |
| | | if (this.type === "update" && this.myDataRow) { |
| | | this.role = this.myDataRow; |
| | | if (this.type !== "create" && this.myDataRow) { |
| | | getMessageById(this.myDataRow.id) |
| | | .then(res => { |
| | | this.role = res; |
| | | this.role.targetTo = `${this.role.targetTo.split(',').length}人`; |
| | | }) |
| | | .catch(err => this.$message.error(`${err}`)) |
| | | } |
| | | }, |
| | | mounted() { |
| | | if (this.type !== 'create') { |
| | | this.$refs.edit.editor.txt.append(this.myDataRow.body); |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | |
| | | // 新建/保存消息(1:新建,0保存消息) |
| | | handleSubmit(mystatus) { |
| | | this.role.body = this.$refs.edit.editor.txt.html(); |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { body, head, messageType, targetFrom, channelCode } = |
| | | this.role; |
| | | const { body, head, messageType, channelCode } = this.role; |
| | | const params = { |
| | | body, |
| | | head, |
| | |
| | | channelCode: `${channelCode}`, |
| | | sendTime: new Date(), |
| | | targetTo: this.checkedList.join(","), |
| | | targetFrom: `${targetFrom}`, |
| | | status: mystatus, |
| | | }; |
| | | if (this.type === "create") { |
| | |
| | | }); |
| | | }, |
| | | |
| | | // 获得消息体 |
| | | getMyBody(obj) { |
| | | this.role.body = obj; |
| | | }, |
| | | |
| | | // 重置表单 |
| | | handleReset() { |
| | | this.$refs.edit.editor.txt.clear(); |
| | | this.setDepartList(); |
| | | this.$refs.user.resetFields(); |
| | | }, |
| | | |
| | |
| | | : channelCode === "02" |
| | | ? "邮件" |
| | | : "短信", |
| | | messageType: this.getColText(this.role.messageType), |
| | | messageType: this.role.messageType, |
| | | targetTo: this.tempNameArr, |
| | | targetFrom: this.sendUser, |
| | | targetFrom: this.sendUser |
| | | }; |
| | | } else { |
| | | this.$message({ type: "warning", message: "请检查必填项" }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 获得栏目消息 |
| | | getColText(id) { |
| | | let str = ""; |
| | | this.colList.forEach((item) => { |
| | | item.id === id ? (str = item.columnName) : ""; |
| | | }); |
| | | return str; |
| | | }, |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | if (valid) { |
| | | const params = Object.assign({}, this.role); |
| | | params.targetTo = this.checkedList.join(','); |
| | | params.targetFrom = this.sendUser; |
| | | params.status = mystatus; |
| | | sendMessage(params) |
| | | .then(() => { |
| | |
| | | </main> |
| | | <footer> |
| | | <!-- 添加卡口 --> |
| | | <el-dialog :title="getDialogTitle" :visible.sync="isShowDialog" width="60%" :before-close="handleClose"> |
| | | <el-dialog :destroy-on-close="true" :key="dialogType" :title="getDialogTitle" :visible.sync="isShowDialog" width="60%" :before-close="handleClose"> |
| | | <MyCreate @closeDialog="closeDialog" :originalBayonet="originalBayonet" :isEdit="isEdit"></MyCreate> |
| | | </el-dialog> |
| | | </footer> |
| | |
| | | import MyCreate from './create' |
| | | import MyTable from '@/components/Table' |
| | | import bayonet from "@/api/system/bayonet"; |
| | | import {downloadFile} from "@/utils/helper"; |
| | | import { downloadFile } from "@/utils/helper"; |
| | | |
| | | export default { |
| | | components: { |