|
@@ -1,37 +1,12 @@
|
|
|
<template>
|
|
|
<div class="data-table">
|
|
|
- <div
|
|
|
- :style="{ 'min-height': minHeight + 'vh' }"
|
|
|
- v-loading="loading"
|
|
|
- element-loading-text="拼命加载中"
|
|
|
- element-loading-spinner="el-icon-loading"
|
|
|
- element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
|
- class="data-table-content"
|
|
|
- >
|
|
|
+ <div :style="{ 'min-height': minHeight + 'vh' }" v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" class="data-table-content">
|
|
|
<div v-if="isBtn" class="data-table-btn flex-end">
|
|
|
- <el-button size="small" @click="handleAdd" plain type="primary"
|
|
|
- >新增</el-button
|
|
|
- >
|
|
|
+ <el-button size="small" @click="handleAdd" plain type="primary">新增</el-button>
|
|
|
</div>
|
|
|
<template v-if="tableData.length">
|
|
|
- <el-table
|
|
|
- :data="filteredTableData"
|
|
|
- :span-method="tableSpanMethod"
|
|
|
- stripe
|
|
|
- show-summary
|
|
|
- border
|
|
|
- ref="table"
|
|
|
- :height="minHeight - 8 + 'vh'"
|
|
|
- class="table"
|
|
|
- style="width: 100%; overflow: auto"
|
|
|
- >
|
|
|
- <el-table-column
|
|
|
- v-for="(item, index) in tableColsCopy"
|
|
|
- :sortable="item.needSort ? true : false"
|
|
|
- :key="index"
|
|
|
- :prop="item.columnName"
|
|
|
- :label="item.columnLabel"
|
|
|
- >
|
|
|
+ <el-table :data="filteredTableData" :span-method="tableSpanMethod" stripe show-summary border ref="table" :height="minHeight - 8 + 'vh'" class="table" style="width: 100%; overflow: auto">
|
|
|
+ <el-table-column v-for="(item, index) in tableColsCopy" :sortable="item.needSort ? true : false" :key="index" :prop="item.columnName" :label="item.columnLabel">
|
|
|
<template #header>
|
|
|
<span class="colTips">
|
|
|
<el-tooltip :content="item.columnDescribe" placement="top">
|
|
@@ -39,38 +14,18 @@
|
|
|
</el-tooltip>
|
|
|
</span>
|
|
|
<span v-if="item.needFilters">
|
|
|
- <el-popover
|
|
|
- placement="bottom"
|
|
|
- trigger="click"
|
|
|
- @show="popoverShowHandler(item.columnName)"
|
|
|
- @hide="popoverHideHandler"
|
|
|
- >
|
|
|
- <i
|
|
|
- slot="reference"
|
|
|
- :class="[
|
|
|
+ <el-popover placement="bottom" trigger="click" @show="popoverShowHandler(item.columnName)" @hide="popoverHideHandler">
|
|
|
+ <i slot="reference" :class="[
|
|
|
'filter-arrow',
|
|
|
'el-icon-arrow-down',
|
|
|
arrowClass(item.columnName),
|
|
|
- ]"
|
|
|
- />
|
|
|
+ ]" />
|
|
|
<el-form>
|
|
|
<el-form-item :label="item.columnLabel">
|
|
|
- <el-select
|
|
|
- v-model="filterValues[item.columnName]"
|
|
|
- size="small"
|
|
|
- placeholder="筛选"
|
|
|
- default-first-option
|
|
|
- filterable
|
|
|
- clearable
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="(option, optionIndex) in tableDataFilters[
|
|
|
+ <el-select v-model="filterValues[item.columnName]" size="small" placeholder="筛选" default-first-option filterable clearable>
|
|
|
+ <el-option v-for="(option, optionIndex) in tableDataFilters[
|
|
|
item.columnName
|
|
|
- ]"
|
|
|
- :key="option.value + optionIndex"
|
|
|
- :value="option.value"
|
|
|
- :label="option.text"
|
|
|
- />
|
|
|
+ ]" :key="option.value + optionIndex" :value="option.value" :label="option.text" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -80,20 +35,8 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column fixed="right" label="操作" width="100">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- @click="handleEdit(scope.row)"
|
|
|
- size="small"
|
|
|
- class="rmScs"
|
|
|
- >编辑</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- class="rmSc"
|
|
|
- type="text"
|
|
|
- @click="handleRemove(scope.row)"
|
|
|
- size="small"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
+ <el-button type="text" @click="handleEdit(scope.row)" size="small" class="rmScs">编辑</el-button>
|
|
|
+ <el-button class="rmSc" type="text" @click="handleRemove(scope.row)" size="small">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -108,42 +51,24 @@
|
|
|
<div class="dialog-content">
|
|
|
<div class="title">{{ tableTitle }}</div>
|
|
|
<div class="content">
|
|
|
- <el-form
|
|
|
- ref="ruleForm"
|
|
|
- :model="tableForm"
|
|
|
- :label-width="labelWidth"
|
|
|
- >
|
|
|
+ <el-form ref="ruleForm" :model="tableForm" :label-width="labelWidth">
|
|
|
<el-row :gutter="20">
|
|
|
- <el-col
|
|
|
- v-for="(item, index) in tableColsCopy"
|
|
|
- :key="index"
|
|
|
- :span="rows"
|
|
|
- >
|
|
|
+ <el-col v-for="(item, index) in tableColsCopy" :key="index" :span="rows">
|
|
|
<el-form-item :label="item.columnLabel">
|
|
|
- <template
|
|
|
- v-if="
|
|
|
+ <!-- <template v-if="
|
|
|
item.dataType == 'longtext' ||
|
|
|
item.dataType.includes('int')
|
|
|
- "
|
|
|
- >
|
|
|
- <el-input
|
|
|
- size="small"
|
|
|
- v-model="tableForm[item.columnName]"
|
|
|
- ></el-input>
|
|
|
- </template>
|
|
|
+ ">
|
|
|
+ <el-input size="small" v-model="tableForm[item.columnName]"></el-input>
|
|
|
+ </template> -->
|
|
|
+ <el-input size="small" v-model="tableForm[item.columnName]"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div class="foot right t30">
|
|
|
- <el-button
|
|
|
- size="medium"
|
|
|
- @click="handleOk"
|
|
|
- class="r24"
|
|
|
- type="primary"
|
|
|
- >确定</el-button
|
|
|
- >
|
|
|
+ <el-button size="medium" @click="handleOk" class="r24" type="primary">确定</el-button>
|
|
|
<el-button @click="flag = false" size="medium">取消</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -152,20 +77,11 @@
|
|
|
<div class="airportInfoDialog">
|
|
|
<div class="title del-title">删除</div>
|
|
|
<div class="content del-content">
|
|
|
- <span class="el-icon-error error r10"></span>您是否确认删除<span
|
|
|
- class="error l10"
|
|
|
- >{{ rmTitle }}</span
|
|
|
- >
|
|
|
+ <span class="el-icon-error error r10"></span>您是否确认删除<span class="error l10">{{ rmTitle }}</span>
|
|
|
?
|
|
|
</div>
|
|
|
<div class="foot right Delfoot t30">
|
|
|
- <el-button
|
|
|
- size="medium"
|
|
|
- class="r24"
|
|
|
- @click="tableRemove"
|
|
|
- type="danger"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
+ <el-button size="medium" class="r24" @click="tableRemove" type="danger">删除</el-button>
|
|
|
<el-button size="medium" @click="rmFlag = false">取消</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -213,7 +129,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
components: { Dialog, NoData },
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
loading: false,
|
|
|
flag: false,
|
|
@@ -238,7 +154,7 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
//设置表头-下拉-箭头样式
|
|
|
- arrowClass() {
|
|
|
+ arrowClass () {
|
|
|
return function (prop) {
|
|
|
let classString = "";
|
|
|
if (this.colShowFilter === prop) {
|
|
@@ -255,7 +171,7 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
//设置表头-下拉-选中数据
|
|
|
- filteredTableData() {
|
|
|
+ filteredTableData () {
|
|
|
return this.tableData.filter((item) => {
|
|
|
let flag = true;
|
|
|
Object.entries(this.filterValues).forEach(([key, value]) => {
|
|
@@ -267,12 +183,12 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
- created() {
|
|
|
+ created () {
|
|
|
this.getQuery();
|
|
|
},
|
|
|
methods: {
|
|
|
//获取表格数据
|
|
|
- async getQuery() {
|
|
|
+ async getQuery () {
|
|
|
try {
|
|
|
this.loading = true;
|
|
|
const { code, returnData } = await Query({
|
|
@@ -297,7 +213,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//表格-增/删/改
|
|
|
- async generalDataReception(data) {
|
|
|
+ async generalDataReception (data) {
|
|
|
try {
|
|
|
const { code, message } = await GeneralDataReception({
|
|
|
serviceId: this.serviceId,
|
|
@@ -326,7 +242,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//初始化表格
|
|
|
- initTableData() {
|
|
|
+ initTableData () {
|
|
|
this.tableColsCopy = this.tableCols.filter((item) => item.needShow);
|
|
|
this.tableDataCopy = _.cloneDeep(this.tableData);
|
|
|
const datas = _.cloneDeep(this.tableColsCopy);
|
|
@@ -341,7 +257,7 @@ export default {
|
|
|
this.tableGroup(this.tableData);
|
|
|
},
|
|
|
//分组
|
|
|
- tableGroup(tableData) {
|
|
|
+ tableGroup (tableData) {
|
|
|
const spanArr = [];
|
|
|
let pos = 0;
|
|
|
let ifYj = this.tableGroups[0];
|
|
@@ -361,14 +277,14 @@ export default {
|
|
|
this.spanArr = spanArr;
|
|
|
this.pos = pos;
|
|
|
},
|
|
|
- popoverShowHandler(prop) {
|
|
|
+ popoverShowHandler (prop) {
|
|
|
this.colShowFilter = prop;
|
|
|
},
|
|
|
- popoverHideHandler() {
|
|
|
+ popoverHideHandler () {
|
|
|
this.colShowFilter = "";
|
|
|
},
|
|
|
//分组
|
|
|
- tableSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
+ tableSpanMethod ({ row, column, rowIndex, columnIndex }) {
|
|
|
if (this.tableGroups.includes(column["property"])) {
|
|
|
const _row = this.spanArr[rowIndex];
|
|
|
const _col = _row > 0 ? 1 : 0;
|
|
@@ -379,29 +295,29 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//弹框-确定
|
|
|
- handleOk() {
|
|
|
+ handleOk () {
|
|
|
this.submitClickHandler();
|
|
|
},
|
|
|
//滚动
|
|
|
- tableLoad() {
|
|
|
+ tableLoad () {
|
|
|
console.log("d");
|
|
|
},
|
|
|
//表格-新增
|
|
|
- handleAdd() {
|
|
|
+ handleAdd () {
|
|
|
this.flag = true;
|
|
|
this.tableType = "add";
|
|
|
this.tableTitle = "新增";
|
|
|
this.tableForm = {};
|
|
|
},
|
|
|
//表格-编辑
|
|
|
- handleEdit(row) {
|
|
|
+ handleEdit (row) {
|
|
|
this.flag = true;
|
|
|
this.tableType = "edit";
|
|
|
this.tableTitle = "编辑";
|
|
|
this.tableForm = row;
|
|
|
},
|
|
|
// 新增/编辑-确认
|
|
|
- submitClickHandler() {
|
|
|
+ submitClickHandler () {
|
|
|
this.$refs["ruleForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (this.tableType == "add") {
|
|
@@ -416,13 +332,13 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
//表格-删除
|
|
|
- handleRemove(row) {
|
|
|
+ handleRemove (row) {
|
|
|
this.rmFlag = true;
|
|
|
this.rmTitle = row.className;
|
|
|
this.tableObj = row;
|
|
|
},
|
|
|
//表格-删除-确认
|
|
|
- tableRemove() {
|
|
|
+ tableRemove () {
|
|
|
this.tableObj.event = 3;
|
|
|
this.generalDataReception(this.tableObj);
|
|
|
},
|