From 1972d1666c866762831919506fb959ca20206ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E7=8F=AE=E5=AE=87?= Date: Sat, 28 Oct 2023 18:01:55 +0800 Subject: [PATCH] =?UTF-8?q?dbaearch=20=E5=A2=9E=E5=8A=A0=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6=EF=BC=8C=E5=8F=8A=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=A2=9E=E5=8A=A0=E7=8A=B6=E6=80=81=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=8C=20col=E5=AD=97=E6=AE=B5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=8E=92=E5=BA=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/JeecgListMixin.js | 137 +++++++++--------- .../components/Modals/LoadFromDBModal.vue | 44 +++++- 2 files changed, 109 insertions(+), 72 deletions(-) diff --git a/src/mixins/JeecgListMixin.js b/src/mixins/JeecgListMixin.js index 69beb27..70792d5 100644 --- a/src/mixins/JeecgListMixin.js +++ b/src/mixins/JeecgListMixin.js @@ -4,20 +4,20 @@ * data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除 */ import { filterObj } from '@/utils/util'; -import { deleteAction, getAction,downFile,getFileAccessHttpUrl } from '@/api/manage' +import { deleteAction, getAction, downFile, getFileAccessHttpUrl } from '@/api/manage' import Vue from 'vue' import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types" import store from '@/store' export const JeecgListMixin = { - data(){ + data() { return { /* 查询条件-请不要在queryParam中声明非字符串值的属性 */ queryParam: {}, /* 数据源 */ - dataSource:[], + dataSource: [], /* 分页参数 */ - ipagination:{ + ipagination: { current: 1, pageSize: 10, pageSizeOptions: ['10', '20', '30'], @@ -30,22 +30,22 @@ export const JeecgListMixin = { total: 0 }, /* 排序参数 */ - isorter:{ + isorter: { column: 'createTime', order: 'desc', }, /* 筛选参数 */ filters: {}, /* table加载状态 */ - loading:false, + loading: false, /* table选中keys*/ selectedRowKeys: [], /* table选中records*/ selectionRows: [], /* 查询折叠 */ - toggleSearchStatus:false, + toggleSearchStatus: false, /* 高级查询条件生效状态 */ - superQueryFlag:false, + superQueryFlag: false, /* 高级查询条件 */ superQueryParams: '', /** 高级查询拼接方式 */ @@ -53,27 +53,27 @@ export const JeecgListMixin = { } }, created() { - if(!this.disableMixinCreated){ - console.log(' -- mixin created -- ') - this.loadData(); - //初始化字典配置 在自己页面定义 - this.initDictConfig(); - } + if (!this.disableMixinCreated) { + console.log(' -- mixin created -- ') + this.loadData(); + //初始化字典配置 在自己页面定义 + this.initDictConfig(); + } }, computed: { //token header - tokenHeader(){ - let head = {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)} + tokenHeader() { + let head = { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) } let tenantid = Vue.ls.get(TENANT_ID) - if(tenantid){ + if (tenantid) { head['tenant-id'] = tenantid } return head; } }, - methods:{ + methods: { loadData(arg) { - if(!this.url.list){ + if (!this.url.list) { this.$message.error("请设置url.list属性!") return } @@ -88,32 +88,31 @@ export const JeecgListMixin = { getAction(this.url.list, params).then((res) => { if (res.success) { //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ - this.dataSource = res.result.records||res.result; - if(res.result.total) - { + this.dataSource = res.result.records || res.result; + if (res.result.total) { this.ipagination.total = res.result.total; - }else{ + } else { this.ipagination.total = 0; } //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ - }else{ + } else { this.$message.warning(res.message) } }).finally(() => { this.loading = false }) }, - initDictConfig(){ + initDictConfig() { console.log("--这是一个假的方法!") }, handleSuperQuery(params, matchType) { //高级查询方法 - if(!params){ - this.superQueryParams='' + if (!params) { + this.superQueryParams = '' this.superQueryFlag = false - }else{ + } else { this.superQueryFlag = true - this.superQueryParams=JSON.stringify(params) + this.superQueryParams = JSON.stringify(params) this.superQueryMatchType = matchType } this.loadData(1) @@ -121,12 +120,13 @@ export const JeecgListMixin = { getQueryParams() { //获取查询条件 let sqp = {} - if(this.superQueryParams){ - sqp['superQueryParams']=encodeURI(this.superQueryParams) + if (this.superQueryParams) { + sqp['superQueryParams'] = encodeURI(this.superQueryParams) sqp['superQueryMatchType'] = this.superQueryMatchType } - var param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters); - param.field = this.getQueryField(); + var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters); + // param.field = this.getQueryField(); + param.field = this.isorter.column; param.pageNo = this.ipagination.current; param.pageSize = this.ipagination.pageSize; return filterObj(param); @@ -163,7 +163,7 @@ export const JeecgListMixin = { this.loadData(1); }, batchDel: function () { - if(!this.url.deleteBatch){ + if (!this.url.deleteBatch) { this.$message.error("请设置url.deleteBatch属性!") return } @@ -181,7 +181,7 @@ export const JeecgListMixin = { content: "Do You Want To Delete This Item?", onOk: function () { that.loading = true; - deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => { + deleteAction(that.url.deleteBatch, { ids: ids }).then((res) => { if (res.success) { //重新计算分页问题 that.reCalculatePage(that.selectedRowKeys.length) @@ -199,12 +199,12 @@ export const JeecgListMixin = { } }, handleDelete: function (id, propertyName) { - if(!this.url.delete){ + if (!this.url.delete) { this.$message.error("请设置url.delete属性!") return } var that = this; - deleteAction(that.url.delete, {[propertyName || 'id']: id}).then((res) => { + deleteAction(that.url.delete, { [propertyName || 'id']: id }).then((res) => { if (res.success) { //重新计算分页问题 that.reCalculatePage(1) @@ -215,16 +215,16 @@ export const JeecgListMixin = { } }); }, - reCalculatePage(count){ + reCalculatePage(count) { //总数量-count - let total=this.ipagination.total-count; + let total = this.ipagination.total - count; //获取删除后的分页数 - let currentIndex=Math.ceil(total/this.ipagination.pageSize); + let currentIndex = Math.ceil(total / this.ipagination.pageSize); //删除后的分页数<所在当前页 - if(currentIndex0){ + if (this.selectedRowKeys && this.selectedRowKeys.length > 0) { param['selections'] = this.selectedRowKeys.join(",") } - console.log("导出参数",param) - downFile(this.url.exportXlsUrl,param).then((data)=>{ + console.log("导出参数", param) + downFile(this.url.exportXlsUrl, param).then((data) => { if (!data) { this.$message.warning("文件下载失败") return } if (typeof window.navigator.msSaveBlob !== 'undefined') { - window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls') - }else{ - let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'})) + window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls') + } else { + let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' })) let link = document.createElement('a') link.style.display = 'none' link.href = url - link.setAttribute('download', fileName+'.xls') + link.setAttribute('download', fileName + '.xls') document.body.appendChild(link) link.click() document.body.removeChild(link); //下载完成移除元素 @@ -301,7 +302,7 @@ export const JeecgListMixin = { }) }, /* 导入 */ - handleImportExcel(info){ + handleImportExcel(info) { this.loading = true; if (info.file.status !== 'uploading') { console.log(info.file, info.fileList); @@ -316,9 +317,9 @@ export const JeecgListMixin = { this.$warning({ title: message, content: (
- {msg}
- 具体详情请 点击下载 -
+ {msg}
+ 具体详情请 点击下载 + ) }) } else { @@ -353,21 +354,21 @@ export const JeecgListMixin = { } }, /* 图片预览 */ - getImgView(text){ - if(text && text.indexOf(",")>0){ - text = text.substring(0,text.indexOf(",")) + getImgView(text) { + if (text && text.indexOf(",") > 0) { + text = text.substring(0, text.indexOf(",")) } return getFileAccessHttpUrl(text) }, /* 文件下载 */ // update--autor:lvdandan-----date:20200630------for:修改下载文件方法名uploadFile改为downloadFile------ - downloadFile(text){ - if(!text){ + downloadFile(text) { + if (!text) { this.$message.warning("未知的文件") return; } - if(text.indexOf(",")>0){ - text = text.substring(0,text.indexOf(",")) + if (text.indexOf(",") > 0) { + text = text.substring(0, text.indexOf(",")) } let url = getFileAccessHttpUrl(text) window.open(url); diff --git a/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue index b126a86..857fa62 100644 --- a/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue @@ -75,6 +75,7 @@ const columns = [ title: 'Col.Stop', align: 'left', dataIndex: 'collectStop', + sorter: true, width: 170, }, { @@ -434,7 +435,7 @@ export default { allowClear: true, }, style: { - width: '264px', + width: '207px', }, }, { @@ -465,7 +466,7 @@ export default { }, }, style: { - width: '19%', + width: '16%', }, }, { @@ -481,8 +482,43 @@ export default { }, style: { paddingRight: 0, - marginRight: '22px', - width: '19%', + marginRight: '8px', + width: '13%', + }, + }, + { + label: 'Status', + type: 'custom-select', + name: 'status', + props: { + options: [ + { + label: 'U', + value: 'U', + }, + { + label: 'A', + value: 'A', + }, + { + label: 'P', + value: 'P', + }, + { + label: 'R', + value: 'R', + }, + { + label: 'F', + value: 'F', + }, + ], + allowClear: true, + }, + style: { + width: '14%', + + marginRight: '10px', }, }, ]