dbaearch 增加状态筛选条件,及接口增加状态筛选字段,
col字段增加排序功能
This commit is contained in:
parent
56918f36c1
commit
1972d1666c
|
@ -4,20 +4,20 @@
|
||||||
* data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除
|
* data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除
|
||||||
*/
|
*/
|
||||||
import { filterObj } from '@/utils/util';
|
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 Vue from 'vue'
|
||||||
import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types"
|
import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types"
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
|
||||||
export const JeecgListMixin = {
|
export const JeecgListMixin = {
|
||||||
data(){
|
data() {
|
||||||
return {
|
return {
|
||||||
/* 查询条件-请不要在queryParam中声明非字符串值的属性 */
|
/* 查询条件-请不要在queryParam中声明非字符串值的属性 */
|
||||||
queryParam: {},
|
queryParam: {},
|
||||||
/* 数据源 */
|
/* 数据源 */
|
||||||
dataSource:[],
|
dataSource: [],
|
||||||
/* 分页参数 */
|
/* 分页参数 */
|
||||||
ipagination:{
|
ipagination: {
|
||||||
current: 1,
|
current: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
pageSizeOptions: ['10', '20', '30'],
|
pageSizeOptions: ['10', '20', '30'],
|
||||||
|
@ -30,22 +30,22 @@ export const JeecgListMixin = {
|
||||||
total: 0
|
total: 0
|
||||||
},
|
},
|
||||||
/* 排序参数 */
|
/* 排序参数 */
|
||||||
isorter:{
|
isorter: {
|
||||||
column: 'createTime',
|
column: 'createTime',
|
||||||
order: 'desc',
|
order: 'desc',
|
||||||
},
|
},
|
||||||
/* 筛选参数 */
|
/* 筛选参数 */
|
||||||
filters: {},
|
filters: {},
|
||||||
/* table加载状态 */
|
/* table加载状态 */
|
||||||
loading:false,
|
loading: false,
|
||||||
/* table选中keys*/
|
/* table选中keys*/
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
/* table选中records*/
|
/* table选中records*/
|
||||||
selectionRows: [],
|
selectionRows: [],
|
||||||
/* 查询折叠 */
|
/* 查询折叠 */
|
||||||
toggleSearchStatus:false,
|
toggleSearchStatus: false,
|
||||||
/* 高级查询条件生效状态 */
|
/* 高级查询条件生效状态 */
|
||||||
superQueryFlag:false,
|
superQueryFlag: false,
|
||||||
/* 高级查询条件 */
|
/* 高级查询条件 */
|
||||||
superQueryParams: '',
|
superQueryParams: '',
|
||||||
/** 高级查询拼接方式 */
|
/** 高级查询拼接方式 */
|
||||||
|
@ -53,27 +53,27 @@ export const JeecgListMixin = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if(!this.disableMixinCreated){
|
if (!this.disableMixinCreated) {
|
||||||
console.log(' -- mixin created -- ')
|
console.log(' -- mixin created -- ')
|
||||||
this.loadData();
|
this.loadData();
|
||||||
//初始化字典配置 在自己页面定义
|
//初始化字典配置 在自己页面定义
|
||||||
this.initDictConfig();
|
this.initDictConfig();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
//token header
|
//token header
|
||||||
tokenHeader(){
|
tokenHeader() {
|
||||||
let head = {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)}
|
let head = { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) }
|
||||||
let tenantid = Vue.ls.get(TENANT_ID)
|
let tenantid = Vue.ls.get(TENANT_ID)
|
||||||
if(tenantid){
|
if (tenantid) {
|
||||||
head['tenant-id'] = tenantid
|
head['tenant-id'] = tenantid
|
||||||
}
|
}
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods: {
|
||||||
loadData(arg) {
|
loadData(arg) {
|
||||||
if(!this.url.list){
|
if (!this.url.list) {
|
||||||
this.$message.error("请设置url.list属性!")
|
this.$message.error("请设置url.list属性!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -88,32 +88,31 @@ export const JeecgListMixin = {
|
||||||
getAction(this.url.list, params).then((res) => {
|
getAction(this.url.list, params).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
||||||
this.dataSource = res.result.records||res.result;
|
this.dataSource = res.result.records || res.result;
|
||||||
if(res.result.total)
|
if (res.result.total) {
|
||||||
{
|
|
||||||
this.ipagination.total = res.result.total;
|
this.ipagination.total = res.result.total;
|
||||||
}else{
|
} else {
|
||||||
this.ipagination.total = 0;
|
this.ipagination.total = 0;
|
||||||
}
|
}
|
||||||
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
||||||
}else{
|
} else {
|
||||||
this.$message.warning(res.message)
|
this.$message.warning(res.message)
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
initDictConfig(){
|
initDictConfig() {
|
||||||
console.log("--这是一个假的方法!")
|
console.log("--这是一个假的方法!")
|
||||||
},
|
},
|
||||||
handleSuperQuery(params, matchType) {
|
handleSuperQuery(params, matchType) {
|
||||||
//高级查询方法
|
//高级查询方法
|
||||||
if(!params){
|
if (!params) {
|
||||||
this.superQueryParams=''
|
this.superQueryParams = ''
|
||||||
this.superQueryFlag = false
|
this.superQueryFlag = false
|
||||||
}else{
|
} else {
|
||||||
this.superQueryFlag = true
|
this.superQueryFlag = true
|
||||||
this.superQueryParams=JSON.stringify(params)
|
this.superQueryParams = JSON.stringify(params)
|
||||||
this.superQueryMatchType = matchType
|
this.superQueryMatchType = matchType
|
||||||
}
|
}
|
||||||
this.loadData(1)
|
this.loadData(1)
|
||||||
|
@ -121,12 +120,13 @@ export const JeecgListMixin = {
|
||||||
getQueryParams() {
|
getQueryParams() {
|
||||||
//获取查询条件
|
//获取查询条件
|
||||||
let sqp = {}
|
let sqp = {}
|
||||||
if(this.superQueryParams){
|
if (this.superQueryParams) {
|
||||||
sqp['superQueryParams']=encodeURI(this.superQueryParams)
|
sqp['superQueryParams'] = encodeURI(this.superQueryParams)
|
||||||
sqp['superQueryMatchType'] = this.superQueryMatchType
|
sqp['superQueryMatchType'] = this.superQueryMatchType
|
||||||
}
|
}
|
||||||
var param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters);
|
var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters);
|
||||||
param.field = this.getQueryField();
|
// param.field = this.getQueryField();
|
||||||
|
param.field = this.isorter.column;
|
||||||
param.pageNo = this.ipagination.current;
|
param.pageNo = this.ipagination.current;
|
||||||
param.pageSize = this.ipagination.pageSize;
|
param.pageSize = this.ipagination.pageSize;
|
||||||
return filterObj(param);
|
return filterObj(param);
|
||||||
|
@ -163,7 +163,7 @@ export const JeecgListMixin = {
|
||||||
this.loadData(1);
|
this.loadData(1);
|
||||||
},
|
},
|
||||||
batchDel: function () {
|
batchDel: function () {
|
||||||
if(!this.url.deleteBatch){
|
if (!this.url.deleteBatch) {
|
||||||
this.$message.error("请设置url.deleteBatch属性!")
|
this.$message.error("请设置url.deleteBatch属性!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ export const JeecgListMixin = {
|
||||||
content: "Do You Want To Delete This Item?",
|
content: "Do You Want To Delete This Item?",
|
||||||
onOk: function () {
|
onOk: function () {
|
||||||
that.loading = true;
|
that.loading = true;
|
||||||
deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
|
deleteAction(that.url.deleteBatch, { ids: ids }).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
//重新计算分页问题
|
//重新计算分页问题
|
||||||
that.reCalculatePage(that.selectedRowKeys.length)
|
that.reCalculatePage(that.selectedRowKeys.length)
|
||||||
|
@ -199,12 +199,12 @@ export const JeecgListMixin = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleDelete: function (id, propertyName) {
|
handleDelete: function (id, propertyName) {
|
||||||
if(!this.url.delete){
|
if (!this.url.delete) {
|
||||||
this.$message.error("请设置url.delete属性!")
|
this.$message.error("请设置url.delete属性!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var that = this;
|
var that = this;
|
||||||
deleteAction(that.url.delete, {[propertyName || 'id']: id}).then((res) => {
|
deleteAction(that.url.delete, { [propertyName || 'id']: id }).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
//重新计算分页问题
|
//重新计算分页问题
|
||||||
that.reCalculatePage(1)
|
that.reCalculatePage(1)
|
||||||
|
@ -215,16 +215,16 @@ export const JeecgListMixin = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
reCalculatePage(count){
|
reCalculatePage(count) {
|
||||||
//总数量-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(currentIndex<this.ipagination.current){
|
if (currentIndex < this.ipagination.current) {
|
||||||
this.ipagination.current=currentIndex;
|
this.ipagination.current = currentIndex;
|
||||||
}
|
}
|
||||||
console.log('currentIndex',currentIndex)
|
console.log('currentIndex', currentIndex)
|
||||||
},
|
},
|
||||||
handleEdit: function (record) {
|
handleEdit: function (record) {
|
||||||
this.$refs.modalForm.edit(record);
|
this.$refs.modalForm.edit(record);
|
||||||
|
@ -237,6 +237,7 @@ export const JeecgListMixin = {
|
||||||
this.$refs.modalForm.disableSubmit = false;
|
this.$refs.modalForm.disableSubmit = false;
|
||||||
},
|
},
|
||||||
handleTableChange(pagination, filters, sorter) {
|
handleTableChange(pagination, filters, sorter) {
|
||||||
|
console.log("sortersorter", sorter);
|
||||||
//分页、排序、筛选变化时触发
|
//分页、排序、筛选变化时触发
|
||||||
//TODO 筛选
|
//TODO 筛选
|
||||||
console.log(pagination)
|
console.log(pagination)
|
||||||
|
@ -247,11 +248,11 @@ export const JeecgListMixin = {
|
||||||
this.ipagination = pagination;
|
this.ipagination = pagination;
|
||||||
this.loadData();
|
this.loadData();
|
||||||
},
|
},
|
||||||
handleToggleSearch(){
|
handleToggleSearch() {
|
||||||
this.toggleSearchStatus = !this.toggleSearchStatus;
|
this.toggleSearchStatus = !this.toggleSearchStatus;
|
||||||
},
|
},
|
||||||
// 给popup查询使用(查询区域不支持回填多个字段,限制只返回一个字段)
|
// 给popup查询使用(查询区域不支持回填多个字段,限制只返回一个字段)
|
||||||
getPopupField(fields){
|
getPopupField(fields) {
|
||||||
return fields.split(',')[0]
|
return fields.split(',')[0]
|
||||||
},
|
},
|
||||||
modalFormOk() {
|
modalFormOk() {
|
||||||
|
@ -260,39 +261,39 @@ export const JeecgListMixin = {
|
||||||
//清空列表选中
|
//清空列表选中
|
||||||
this.onClearSelected()
|
this.onClearSelected()
|
||||||
},
|
},
|
||||||
handleDetail:function(record){
|
handleDetail: function (record) {
|
||||||
this.$refs.modalForm.edit(record);
|
this.$refs.modalForm.edit(record);
|
||||||
this.$refs.modalForm.title="Detail";
|
this.$refs.modalForm.title = "Detail";
|
||||||
this.$refs.modalForm.disableSubmit = true;
|
this.$refs.modalForm.disableSubmit = true;
|
||||||
},
|
},
|
||||||
/* 导出 */
|
/* 导出 */
|
||||||
handleExportXls2(){
|
handleExportXls2() {
|
||||||
let paramsStr = encodeURI(JSON.stringify(this.getQueryParams()));
|
let paramsStr = encodeURI(JSON.stringify(this.getQueryParams()));
|
||||||
let url = `${window._CONFIG['domianURL']}/${this.url.exportXlsUrl}?paramsStr=${paramsStr}`;
|
let url = `${window._CONFIG['domianURL']}/${this.url.exportXlsUrl}?paramsStr=${paramsStr}`;
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
},
|
},
|
||||||
handleExportXls(fileName){
|
handleExportXls(fileName) {
|
||||||
if(!fileName || typeof fileName != "string"){
|
if (!fileName || typeof fileName != "string") {
|
||||||
fileName = "导出文件"
|
fileName = "导出文件"
|
||||||
}
|
}
|
||||||
let param = this.getQueryParams();
|
let param = this.getQueryParams();
|
||||||
if(this.selectedRowKeys && this.selectedRowKeys.length>0){
|
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
|
||||||
param['selections'] = this.selectedRowKeys.join(",")
|
param['selections'] = this.selectedRowKeys.join(",")
|
||||||
}
|
}
|
||||||
console.log("导出参数",param)
|
console.log("导出参数", param)
|
||||||
downFile(this.url.exportXlsUrl,param).then((data)=>{
|
downFile(this.url.exportXlsUrl, param).then((data) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
this.$message.warning("文件下载失败")
|
this.$message.warning("文件下载失败")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||||
window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
|
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
|
||||||
}else{
|
} else {
|
||||||
let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
|
let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
|
||||||
let link = document.createElement('a')
|
let link = document.createElement('a')
|
||||||
link.style.display = 'none'
|
link.style.display = 'none'
|
||||||
link.href = url
|
link.href = url
|
||||||
link.setAttribute('download', fileName+'.xls')
|
link.setAttribute('download', fileName + '.xls')
|
||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
document.body.removeChild(link); //下载完成移除元素
|
document.body.removeChild(link); //下载完成移除元素
|
||||||
|
@ -301,7 +302,7 @@ export const JeecgListMixin = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/* 导入 */
|
/* 导入 */
|
||||||
handleImportExcel(info){
|
handleImportExcel(info) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
if (info.file.status !== 'uploading') {
|
if (info.file.status !== 'uploading') {
|
||||||
console.log(info.file, info.fileList);
|
console.log(info.file, info.fileList);
|
||||||
|
@ -316,9 +317,9 @@ export const JeecgListMixin = {
|
||||||
this.$warning({
|
this.$warning({
|
||||||
title: message,
|
title: message,
|
||||||
content: (<div>
|
content: (<div>
|
||||||
<span>{msg}</span><br/>
|
<span>{msg}</span><br />
|
||||||
<span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
|
<span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -353,21 +354,21 @@ export const JeecgListMixin = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 图片预览 */
|
/* 图片预览 */
|
||||||
getImgView(text){
|
getImgView(text) {
|
||||||
if(text && text.indexOf(",")>0){
|
if (text && text.indexOf(",") > 0) {
|
||||||
text = text.substring(0,text.indexOf(","))
|
text = text.substring(0, text.indexOf(","))
|
||||||
}
|
}
|
||||||
return getFileAccessHttpUrl(text)
|
return getFileAccessHttpUrl(text)
|
||||||
},
|
},
|
||||||
/* 文件下载 */
|
/* 文件下载 */
|
||||||
// update--autor:lvdandan-----date:20200630------for:修改下载文件方法名uploadFile改为downloadFile------
|
// update--autor:lvdandan-----date:20200630------for:修改下载文件方法名uploadFile改为downloadFile------
|
||||||
downloadFile(text){
|
downloadFile(text) {
|
||||||
if(!text){
|
if (!text) {
|
||||||
this.$message.warning("未知的文件")
|
this.$message.warning("未知的文件")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(text.indexOf(",")>0){
|
if (text.indexOf(",") > 0) {
|
||||||
text = text.substring(0,text.indexOf(","))
|
text = text.substring(0, text.indexOf(","))
|
||||||
}
|
}
|
||||||
let url = getFileAccessHttpUrl(text)
|
let url = getFileAccessHttpUrl(text)
|
||||||
window.open(url);
|
window.open(url);
|
||||||
|
|
|
@ -75,6 +75,7 @@ const columns = [
|
||||||
title: 'Col.Stop',
|
title: 'Col.Stop',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
dataIndex: 'collectStop',
|
dataIndex: 'collectStop',
|
||||||
|
sorter: true,
|
||||||
width: 170,
|
width: 170,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -434,7 +435,7 @@ export default {
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
width: '264px',
|
width: '207px',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -465,7 +466,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
width: '19%',
|
width: '16%',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -481,8 +482,43 @@ export default {
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
paddingRight: 0,
|
paddingRight: 0,
|
||||||
marginRight: '22px',
|
marginRight: '8px',
|
||||||
width: '19%',
|
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',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user