no message
This commit is contained in:
parent
e41099397d
commit
05d0cf00b9
@ -1,6 +1,17 @@
|
||||
<template>
|
||||
<sc-table-select v-model="value" :api="item.api" :data="item.data" :table-width="600" :multiple="item.options.multiple" :props="item.options.props" style="width: 100%;">
|
||||
<el-table-column v-for="(_item, _index) in item.options.column" :key="_index" :prop="_item.prop" :label="_item.label" :width="_item.width"></el-table-column>
|
||||
<sc-table-select v-model="value" v-bind="item.options" style="width: 100%;">
|
||||
<template #header="{data, form, submit}">
|
||||
<el-form :inline="true" :model="data" v-if="form && form.length>0">
|
||||
<el-form-item style="margin-bottom:0px;" v-for="(i,index) in form" :key="index">
|
||||
<el-input v-model="data[i.name]" :placeholder="i.placeholder"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-bottom:0px;">
|
||||
<el-button type="primary" @click="submit">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<el-table-column v-for="(_item, _index) in item.options.column" :key="_index" v-bind="_item"></el-table-column>
|
||||
</sc-table-select>
|
||||
</template>
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
<!--
|
||||
* @Descripttion: 表格选择器组件
|
||||
-->
|
||||
|
||||
<template>
|
||||
<el-select ref="select" v-model="defaultValue" :size="size" :clearable="clearable" :multiple="multiple" :collapse-tags="collapseTags" :collapse-tags-tooltip="collapseTagsTooltip" :filterable="filterable" :placeholder="placeholder" :disabled="disabled" :filter-method="filterMethod" @remove-tag="removeTag" @visible-change="visibleChange" @clear="clear">
|
||||
<template #empty>
|
||||
<div class="sc-table-select__table" :style="{width: tableWidth+'px'}" v-loading="loading">
|
||||
<div class="sc-table-select__table" v-loading="loading">
|
||||
<div class="sc-table-select__header">
|
||||
<slot name="header" :form="formData" :submit="formSubmit"></slot>
|
||||
<slot name="header" :data="formData" :form="form" :submit="formSubmit"></slot>
|
||||
</div>
|
||||
<el-table ref="table" :data="tableData" :height="245" :highlight-current-row="!multiple" @row-click="click" @select="select" @select-all="selectAll">
|
||||
<el-table-column v-if="multiple" type="selection" width="45"></el-table-column>
|
||||
<el-table-column v-else type="index" width="45">
|
||||
<el-table-column v-if="multiple" type="selection" width="55"></el-table-column>
|
||||
<el-table-column v-else type="index" width="55">
|
||||
<template #default="scope"><span>{{scope.$index+(currentPage - 1) * limit + 1}}</span></template>
|
||||
</el-table-column>
|
||||
<slot></slot>
|
||||
@ -32,6 +31,7 @@
|
||||
modelValue: null,
|
||||
api: { type: String, default: '' },
|
||||
params: { type: Object, default: () => {} },
|
||||
form: { type: Array, default: () => [] },
|
||||
placeholder: { type: String, default: "请选择" },
|
||||
size: { type: String, default: "default" },
|
||||
clearable: { type: Boolean, default: false },
|
||||
@ -40,7 +40,6 @@
|
||||
collapseTags: { type: Boolean, default: false },
|
||||
collapseTagsTooltip: { type: Boolean, default: false },
|
||||
disabled: { type: Boolean, default: false },
|
||||
tableWidth: {type: Number, default: 400},
|
||||
mode: { type: String, default: "popover" },
|
||||
props: { type: Object, default: () => {} }
|
||||
},
|
||||
@ -101,13 +100,19 @@
|
||||
[this.defaultProps.keyword]: this.keyword
|
||||
}
|
||||
Object.assign(reqData, this.params, this.formData)
|
||||
var res = await this.$http.get(this.api, reqData);
|
||||
var res = await this.$http.get(this.api, reqData, {cacheparameters:1});
|
||||
var parseData = config.parseData(res)
|
||||
this.tableData = parseData.rows;
|
||||
this.total = parseData.total;
|
||||
this.loading = false;
|
||||
//表格默认赋值
|
||||
this.$nextTick(() => {
|
||||
|
||||
if(typeof this.defaultValue === 'undefined'){
|
||||
this.defaultValue = {};
|
||||
}
|
||||
|
||||
|
||||
if(this.multiple){
|
||||
this.defaultValue.forEach(row => {
|
||||
var setrow = this.tableData.filter(item => item[this.defaultProps.value]===row[this.defaultProps.value] )
|
||||
@ -139,9 +144,10 @@
|
||||
this.$refs.select.selected.forEach(item => {
|
||||
item.currentLabel = item.value[this.defaultProps.label]
|
||||
})
|
||||
}else{
|
||||
this.$refs.select.selectedLabel = this.defaultValue[this.defaultProps.label]
|
||||
return ;
|
||||
}
|
||||
|
||||
this.$refs.select.selectedLabel = typeof this.defaultValue === 'object' ? this.defaultValue[this.defaultProps.label]: this.defaultValue
|
||||
})
|
||||
},
|
||||
//表格勾选事件
|
||||
|
@ -16,7 +16,7 @@ export default {
|
||||
keyword: 'keyword' //规定搜索字段
|
||||
},
|
||||
props: {
|
||||
label: 'label', //映射label显示字段
|
||||
value: 'value', //映射value值字段
|
||||
label: 'label', // 映射label显示字段
|
||||
value: 'value', // 映射value值字段
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@
|
||||
.adminui-main > .el-container > .el-container {border-top: 1px solid var(--el-border-color-light);border-bottom: 1px solid var(--el-border-color-light);margin-top: 15px;}
|
||||
.adminui-main > .el-container > .el-container + .el-aside {border-top: 1px solid var(--el-border-color-light);margin-top: 15px;}
|
||||
.adminui-main > .el-container > .el-header {@extend .headerPublic;}
|
||||
.adminui-main > .el-container > .el-main.nopadding {border-top: 1px solid var(--el-border-color-light);border-bottom: 1px solid var(--el-border-color-light);margin-top: 15px;}
|
||||
.adminui-main > .el-container > .el-main.nopadding {}
|
||||
.adminui-main > .el-container > .el-main + .el-aside {border-left: 0!important;border-top: 1px solid var(--el-border-color-light);margin-top: 15px;}
|
||||
.adminui-main > .el-container > .el-footer {margin-top: 15px;border-bottom: 1px solid var(--el-border-color-light);}
|
||||
.adminui-main > .el-container > .el-container > .el-header {@extend .headerPublic}
|
||||
|
@ -17,7 +17,10 @@ axios.interceptors.request.use(
|
||||
}
|
||||
if (!sysConfig.REQUEST_CACHE && config.method == 'get') {
|
||||
config.params = config.params || {};
|
||||
config.params['_'] = new Date().getTime();
|
||||
|
||||
if (!config.cacheparameters) {
|
||||
config.params['_'] = new Date().getTime();
|
||||
}
|
||||
}
|
||||
Object.assign(config.headers, sysConfig.HEADERS)
|
||||
return config;
|
||||
|
@ -29,7 +29,7 @@
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-row>
|
||||
<el-col :span="3"><span>1</span></el-col>
|
||||
<el-col :span="3"></el-col>
|
||||
<el-col :span="20">
|
||||
<el-button type="primary" @click="submit" style="max-width: 500px; width: 100%;" :loading="submitloading">保存</el-button>
|
||||
</el-col>
|
||||
|
@ -42,6 +42,9 @@
|
||||
scEcharts,
|
||||
scStatistic,
|
||||
},
|
||||
props: {
|
||||
name: { type: String, default: "" },
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
dateGroup: [
|
||||
@ -61,11 +64,13 @@
|
||||
},
|
||||
dateType: '',
|
||||
date: null,
|
||||
statName: this.$route.meta.tablename,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
//监听从props里拿到值了
|
||||
date(){
|
||||
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
@ -73,6 +78,10 @@
|
||||
const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0);
|
||||
lastDay.setHours(23, 59, 0, 0);
|
||||
this.date = [new Date(now.getFullYear(), now.getMonth(), 1, 0, 0), lastDay];
|
||||
|
||||
if (this.name) {
|
||||
this.statName = this.name || this.$route.meta.tablename;
|
||||
}
|
||||
this.loaddata();
|
||||
},
|
||||
methods: {
|
||||
@ -90,11 +99,10 @@
|
||||
},
|
||||
loaddata(){
|
||||
//判断是否开启自定义列
|
||||
if(this.$route.meta.tablename) {
|
||||
this.$http.get('system/stat/get', { name: this.$route.meta.tablename,date:this.date }, { cache:this.$route.meta.tablecache || 0 }).then((res) => {
|
||||
if(this.statName) {
|
||||
this.$http.get('system/stat/get', { name: this.statName,date:this.date }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
Object.assign(this.$data, res.data);
|
||||
|
||||
this.dateType = '';
|
||||
this.dateGroup.forEach((item) => {
|
||||
if (new Date(item.value[0]).getTime()==new Date(this.date[0]).getTime() && new Date(item.value[1]).getTime()==new Date(this.date[1]).getTime()) {
|
||||
@ -105,11 +113,9 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-card {margin-bottom: 15px;}
|
||||
.number-data {display: flex;}
|
||||
|
68
src/views/system/table/dialog.vue
Normal file
68
src/views/system/table/dialog.vue
Normal file
@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<el-dialog :title="titleMap[mode]" v-model="visible" :size="960" destroy-on-close @closed="$emit('closed')">
|
||||
<el-container v-loading="loading">
|
||||
<el-main style="padding:0 20px 20px 20px">
|
||||
<sc-form ref="formref" :config="config" v-model="info" :loading="loading"> </sc-form>
|
||||
</el-main>
|
||||
<el-footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
|
||||
<el-button @click="visible=false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
emits: ['success', 'closed'],
|
||||
props: {
|
||||
column: { type: Object, default: () => {} },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
mode: "plus",
|
||||
titleMap: {
|
||||
plus: '新增',
|
||||
edit: '编辑'
|
||||
},
|
||||
info: {},
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
column(){
|
||||
this.config.column = this.column;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.config = {
|
||||
formItems : this.column,
|
||||
labelPosition : "right",
|
||||
labelWidth : "120px",
|
||||
size : "medium",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//显示
|
||||
open(mode='add'){
|
||||
this.mode = mode;
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
//表单提交方法
|
||||
submit(){
|
||||
this.$refs.formref.validate(async (valid) => {
|
||||
if (valid) {
|
||||
// this.isSaveing = true;
|
||||
this.$emit('success', this.info, this.mode);
|
||||
}
|
||||
})
|
||||
},
|
||||
//表单注入数据
|
||||
setData(info){
|
||||
this.info = info;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
@ -11,6 +11,7 @@
|
||||
<el-button v-if="operation.batchdeletion" type="danger" @click="batchdeletion" plain icon="el-icon-delete"></el-button>
|
||||
</div>
|
||||
<div class="right-panel" v-if="operation.search || filter.length>0">
|
||||
<el-button v-for="(s,index) in statList" :key="index" :type="s.type" @click="openStat(s)" plain :icon="s.icon">{{ s.title }}</el-button>
|
||||
<scFilterBar v-if="filter.length>0" :filterName="$route.meta.tablename" :options="filter" @filterChange="filterChange">
|
||||
<template #default="{filterLength, openFilter}">
|
||||
<el-badge :value="filterLength" type="danger" :hidden="filterLength<=0">
|
||||
@ -24,6 +25,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-header>
|
||||
|
||||
<el-header style="height:120px;" v-if="typeof chartoption === 'object' && Object.keys(chartoption).length > 0">
|
||||
<scEcharts height="100%" :option="chartoption"></scEcharts>
|
||||
</el-header>
|
||||
|
||||
<el-main class="nopadding">
|
||||
<scTable ref="table" :tableColumn="column" :params="search" :columnSetting="columnSetting" :api="api" :row-key="key" @selection-change="selectionChange" :remoteSort="true" :remoteFilter="true" stripe>
|
||||
<el-table-column v-if="isselection" type="selection" width="50"></el-table-column>
|
||||
@ -42,24 +48,36 @@
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
||||
<save-dialog v-if="dialog.save" :column="column" ref="saveDialog" @success="handleSuccess" @closed="dialog.save=false"></save-dialog>
|
||||
<edit-dialog v-if="dialog.edit" :column="column" ref="editDialog" @success="handleSuccess" @closed="dialog.edit=false"></edit-dialog>
|
||||
<stat-dialog v-if="dialog.stat" ref="statDialog" @closed="dialog.stat=false"></stat-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import saveDialog from './save'
|
||||
import statDialog from './stat'
|
||||
import editDialog from './dialog'
|
||||
import scFilterBar from '@/components/scFilterBar';
|
||||
import scEcharts from '@/components/scEcharts'
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
name: 'propertyAuth',
|
||||
components: {
|
||||
saveDialog,
|
||||
statDialog,
|
||||
scEcharts,
|
||||
editDialog,
|
||||
scFilterBar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialog: {
|
||||
save: false,
|
||||
stat: false,
|
||||
edit: false,
|
||||
},
|
||||
columnSetting:false,
|
||||
isselection:true,
|
||||
@ -76,6 +94,8 @@
|
||||
tabs: [
|
||||
// {label:'所有', value:0},
|
||||
],
|
||||
statList:[],
|
||||
chartoption: {},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -123,22 +143,29 @@
|
||||
this.$refs.saveDialog.open();
|
||||
})
|
||||
},
|
||||
//打开统计
|
||||
openStat(o){
|
||||
this.dialog.stat = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.statDialog.open().setData(o);
|
||||
})
|
||||
},
|
||||
//编辑
|
||||
operationEdit(row,index){
|
||||
this.dialog.save = true
|
||||
this.dialog.edit = true
|
||||
this.$nextTick(() => {
|
||||
if (this.operation.edit.remoteurl) {
|
||||
setTimeout(async ()=>{
|
||||
var res = await this.$http.get(this.operation.edit.remoteurl, {[this.key]: row[this.key], index: index})
|
||||
if (res.code == 200 ) {
|
||||
this.$refs.saveDialog.open('edit').setData(res.data);
|
||||
this.$refs.editDialog.open('edit').setData(res.data);
|
||||
return;
|
||||
}
|
||||
this.$alert(res.message, "提示", {type: 'error'});
|
||||
}, 100)
|
||||
return false;
|
||||
}
|
||||
this.$refs.saveDialog.open('edit').setData(row)
|
||||
this.$refs.editDialog.open('edit').setData(row)
|
||||
})
|
||||
},
|
||||
//删除
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-drawer :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
|
||||
<el-drawer :title="titleMap[mode]" v-model="visible" :size="960" destroy-on-close @closed="$emit('closed')">
|
||||
<el-container v-loading="loading">
|
||||
<el-main style="padding:0 20px 20px 20px">
|
||||
<sc-form ref="formref" :config="config" v-model="info" :loading="loading"> </sc-form>
|
||||
@ -11,11 +11,6 @@
|
||||
</el-container>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
emits: ['success', 'closed'],
|
||||
@ -70,7 +65,4 @@
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
</script>
|
32
src/views/system/table/stat.vue
Normal file
32
src/views/system/table/stat.vue
Normal file
@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<el-drawer :title="info.title" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
|
||||
<stat :name="info.value || info.name"></stat>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import stat from '@/views/system/stat';
|
||||
export default {
|
||||
emits: ['success', 'closed'],
|
||||
props: {},
|
||||
components: {
|
||||
stat,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
info: {},
|
||||
visible: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//显示
|
||||
open(){
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
//表单注入数据
|
||||
setData(info){
|
||||
this.info = info;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user