|
|
@@ -43,20 +43,21 @@
|
|
|
min-width="50"
|
|
|
align="center">
|
|
|
</el-table-column>
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- v-if="isColumnShow('stationId')"
|
|
|
- prop="stationId"
|
|
|
- label="营业厅ID"
|
|
|
- min-width="100">
|
|
|
- </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ v-if="isColumnShow('stationId')"
|
|
|
+ prop="stationId"
|
|
|
+ label="营业厅"
|
|
|
+ :formatter="stationFormatter"
|
|
|
+ min-width="100">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ v-if="isColumnShow('exhibitionId')"
|
|
|
+ prop="exhibitionId"
|
|
|
+ label="展项"
|
|
|
+ :formatter="exhibitionFormatter"
|
|
|
+ min-width="100">
|
|
|
+ </el-table-column>
|
|
|
|
|
|
- <el-table-column
|
|
|
- v-if="isColumnShow('exhibitionId')"
|
|
|
- prop="exhibitionId"
|
|
|
- label="展项ID"
|
|
|
- min-width="100">
|
|
|
- </el-table-column>
|
|
|
|
|
|
<el-table-column
|
|
|
v-if="isColumnShow('clickedId')"
|
|
|
@@ -188,252 +189,293 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import {mapState} from 'vuex'
|
|
|
- import {format} from 'date-fns'
|
|
|
- import zh from 'date-fns/locale/zh_cn'
|
|
|
-
|
|
|
- export default {
|
|
|
- created() {
|
|
|
- this.getData();
|
|
|
+import { mapState } from "vuex";
|
|
|
+import { format } from "date-fns";
|
|
|
+import zh from "date-fns/locale/zh_cn";
|
|
|
+
|
|
|
+export default {
|
|
|
+ created() {
|
|
|
+ this.getData();
|
|
|
+
|
|
|
+ this.$http.get({
|
|
|
+ url: '/stationInfo/all'
|
|
|
+ }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.stations = res.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ totalNumber: 0,
|
|
|
+ totalPage: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ tableData: [],
|
|
|
+ stations: [],
|
|
|
+ exhibitions:[],
|
|
|
+ filter1: "",
|
|
|
+ filter2: "",
|
|
|
+ tableColumns: [
|
|
|
+ {
|
|
|
+ label: "营业厅ID",
|
|
|
+ value: "stationId",
|
|
|
+ show: true
|
|
|
},
|
|
|
- data() {
|
|
|
- return {
|
|
|
- totalNumber: 0,
|
|
|
- totalPage: 10,
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 20,
|
|
|
- tableData: [],
|
|
|
- filter1: '',
|
|
|
- filter2: '',
|
|
|
- tableColumns: [
|
|
|
- {
|
|
|
- label: '营业厅ID',
|
|
|
- value: 'stationId',
|
|
|
- show: true
|
|
|
- },
|
|
|
- {
|
|
|
- label: '展项ID',
|
|
|
- value: 'exhibitionId',
|
|
|
- show: true
|
|
|
- },
|
|
|
- {
|
|
|
- label: '被点击栏目的ID',
|
|
|
- value: 'clickedId',
|
|
|
- show: true
|
|
|
- },
|
|
|
- ],
|
|
|
- multipleMode: false,
|
|
|
- showAdvancedQueryDialog: false,
|
|
|
- advancedQueryFields: [],
|
|
|
- showTableSortDialog: false,
|
|
|
- tableSortFields: [],
|
|
|
- searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'like'],
|
|
|
- advancedQueryColumns: [
|
|
|
- {
|
|
|
- label: '营业厅ID',
|
|
|
- value: 'station_id'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '展项ID',
|
|
|
- value: 'exhibition_id'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '被点击栏目的ID',
|
|
|
- value: 'clicked_id'
|
|
|
- },
|
|
|
- ],
|
|
|
- advancedQuerySearchKey: '',
|
|
|
- orderByStr: '',
|
|
|
- imgSrc: '',
|
|
|
- imageDialogVisible: false,
|
|
|
- }
|
|
|
+ {
|
|
|
+ label: "展项ID",
|
|
|
+ value: "exhibitionId",
|
|
|
+ show: true
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapState(['tableHeight']),
|
|
|
- selection() {
|
|
|
- return this.$refs.table.selection.map(i => i.id);
|
|
|
- }
|
|
|
+ {
|
|
|
+ label: "被点击栏目的ID",
|
|
|
+ value: "clickedId",
|
|
|
+ show: true
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ multipleMode: false,
|
|
|
+ showAdvancedQueryDialog: false,
|
|
|
+ advancedQueryFields: [],
|
|
|
+ showTableSortDialog: false,
|
|
|
+ tableSortFields: [],
|
|
|
+ searchMethods: ["=", "!=", ">", ">=", "<", "<=", "like"],
|
|
|
+ advancedQueryColumns: [
|
|
|
+ {
|
|
|
+ label: "营业厅ID",
|
|
|
+ value: "station_id"
|
|
|
},
|
|
|
- methods: {
|
|
|
- pageSizeChange(size) {
|
|
|
- this.currentPage = 1;
|
|
|
- this.pageSize = size;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- currentPageChange(page) {
|
|
|
- this.currentPage = page;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- getData() {
|
|
|
-
|
|
|
- var data = {
|
|
|
- currentPage: this.currentPage,
|
|
|
- pageNumber: this.pageSize,
|
|
|
- searchKey: this.filter1,
|
|
|
- advancedQuery: this.advancedQuerySearchKey,
|
|
|
- orderByStr: this.orderByStr,
|
|
|
- }
|
|
|
-
|
|
|
- if (this.$route.query.column) {
|
|
|
- var tempColumn = this.$route.query.column;
|
|
|
- data[tempColumn.split(',')[1]] = tempColumn.split(',')[0];
|
|
|
- }
|
|
|
-
|
|
|
- this.$http.get({
|
|
|
- url: '/clickHistory/page',
|
|
|
- data: data
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.totalNumber = res.data.page.totalNumber;
|
|
|
- this.tableData = res.data.pp;
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- isColumnShow(column) {
|
|
|
- var row = this.tableColumns.find(i => i.value === column);
|
|
|
- return row ? row.show : false;
|
|
|
- },
|
|
|
- toggleMultipleMode(multipleMode) {
|
|
|
- this.multipleMode = multipleMode;
|
|
|
- if (!multipleMode) {
|
|
|
- this.$refs.table.clearSelection();
|
|
|
- }
|
|
|
- },
|
|
|
- editRow(row) {
|
|
|
- this.$router.push({
|
|
|
- path: '/clickHistory',
|
|
|
- query: {
|
|
|
- id: row.id,
|
|
|
- column: this.$route.query.column,
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- operation1() {
|
|
|
- this.$notify({
|
|
|
- title: '提示',
|
|
|
- message: this.selection
|
|
|
- });
|
|
|
- },
|
|
|
- operation2() {
|
|
|
- this.$message('操作2');
|
|
|
- },
|
|
|
- addField() {
|
|
|
- this.advancedQueryFields.push({
|
|
|
- link: 'AND',
|
|
|
- name: '',
|
|
|
- searchMethod: '=',
|
|
|
- value: '',
|
|
|
- });
|
|
|
- },
|
|
|
- removeField(i) {
|
|
|
- if (this.advancedQueryFields.length > 0) {
|
|
|
- this.advancedQueryFields.splice(i, 1);
|
|
|
- }
|
|
|
- },
|
|
|
- advancedQuery() {
|
|
|
-
|
|
|
- this.advancedQuerySearchKey = '';
|
|
|
-
|
|
|
- if (this.advancedQueryFields.length > 0) {
|
|
|
-
|
|
|
- var templist = [];
|
|
|
-
|
|
|
- this.advancedQueryFields.forEach(item => {
|
|
|
- if (item.link && item.name && item.searchMethod && item.value) {
|
|
|
- var tempItem = item.link + '_,' + item.name + '_,' + item.searchMethod + '_,' + item.value;
|
|
|
- templist.push(tempItem);
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- if (templist.length > 0) {
|
|
|
-
|
|
|
- this.advancedQuerySearchKey = templist.join('_;');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.getData();
|
|
|
- this.showAdvancedQueryDialog = false;
|
|
|
- },
|
|
|
- addSortField() {
|
|
|
- this.tableSortFields.push({
|
|
|
- name: '',
|
|
|
- order: 'asc',
|
|
|
- });
|
|
|
- },
|
|
|
- removeSortField(i) {
|
|
|
- if (this.tableSortFields.length > 0) {
|
|
|
- this.tableSortFields.splice(i, 1);
|
|
|
- }
|
|
|
- },
|
|
|
- tableSortQuery() {
|
|
|
-
|
|
|
- this.orderByStr = '';
|
|
|
-
|
|
|
- if (this.tableSortFields.length > 0) {
|
|
|
-
|
|
|
- var templist = [];
|
|
|
-
|
|
|
- this.tableSortFields.forEach(item => {
|
|
|
- if (item.name && item.order) {
|
|
|
- var tempItem = item.name + '_,' + item.order;
|
|
|
- templist.push(tempItem);
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- if (templist.length > 0) {
|
|
|
-
|
|
|
- this.orderByStr = templist.join('_;');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.getData();
|
|
|
- this.showTableSortDialog = false;
|
|
|
- },
|
|
|
- exportExcel() {
|
|
|
- window.location.href = this.$baseUrl + "/clickHistory/exportExcel?searchKey="
|
|
|
- + this.filter1 + "&advancedQuery=" + this.advancedQuerySearchKey+"&orderByStr=" + this.orderByStr;
|
|
|
- },
|
|
|
- searchData() {
|
|
|
- this.currentPage = 1;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- deleteRow(row) {
|
|
|
- this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
|
|
|
- return this.$http.post({
|
|
|
- url: '/clickHistory/del',
|
|
|
- data: {id: row.id}
|
|
|
- })
|
|
|
- }).then(() => {
|
|
|
- this.$message.success('删除成功');
|
|
|
- this.getData();
|
|
|
- }).catch(action => {
|
|
|
- if (action === 'cancel') {
|
|
|
- this.$message.info('删除取消');
|
|
|
- } else {
|
|
|
- this.$message.error('删除失败');
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- DateTimeFormatter(row, column, cellValue) {
|
|
|
- if (cellValue) {
|
|
|
- return format(cellValue, 'YYYY/MM/DD HH:mm', {locale: zh})
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- DateFormatter(row, column, cellValue) {
|
|
|
- if (cellValue) {
|
|
|
- return format(cellValue, 'YYYY/MM/DD', {locale: zh})
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- showImg(img) {
|
|
|
- this.imgSrc = img;
|
|
|
- this.imageDialogVisible = true;
|
|
|
- },
|
|
|
-
|
|
|
+ {
|
|
|
+ label: "展项ID",
|
|
|
+ value: "exhibition_id"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "被点击栏目的ID",
|
|
|
+ value: "clicked_id"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ advancedQuerySearchKey: "",
|
|
|
+ orderByStr: "",
|
|
|
+ imgSrc: "",
|
|
|
+ imageDialogVisible: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(["tableHeight"]),
|
|
|
+ selection() {
|
|
|
+ return this.$refs.table.selection.map(i => i.id);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ pageSizeChange(size) {
|
|
|
+ this.currentPage = 1;
|
|
|
+ this.pageSize = size;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ currentPageChange(page) {
|
|
|
+ this.currentPage = page;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ getData() {
|
|
|
+ var data = {
|
|
|
+ currentPage: this.currentPage,
|
|
|
+ pageNumber: this.pageSize,
|
|
|
+ searchKey: this.filter1,
|
|
|
+ advancedQuery: this.advancedQuerySearchKey,
|
|
|
+ orderByStr: this.orderByStr
|
|
|
+ };
|
|
|
+
|
|
|
+ if (this.$route.query.column) {
|
|
|
+ var tempColumn = this.$route.query.column;
|
|
|
+ data[tempColumn.split(",")[1]] = tempColumn.split(",")[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$http
|
|
|
+ .get({
|
|
|
+ url: "/clickHistory/page",
|
|
|
+ data: data
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.totalNumber = res.data.page.totalNumber;
|
|
|
+ this.tableData = res.data.pp;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ isColumnShow(column) {
|
|
|
+ var row = this.tableColumns.find(i => i.value === column);
|
|
|
+ return row ? row.show : false;
|
|
|
+ },
|
|
|
+ toggleMultipleMode(multipleMode) {
|
|
|
+ this.multipleMode = multipleMode;
|
|
|
+ if (!multipleMode) {
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ editRow(row) {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/clickHistory",
|
|
|
+ query: {
|
|
|
+ id: row.id,
|
|
|
+ column: this.$route.query.column
|
|
|
}
|
|
|
+ });
|
|
|
+ },
|
|
|
+ operation1() {
|
|
|
+ this.$notify({
|
|
|
+ title: "提示",
|
|
|
+ message: this.selection
|
|
|
+ });
|
|
|
+ },
|
|
|
+ operation2() {
|
|
|
+ this.$message("操作2");
|
|
|
+ },
|
|
|
+ addField() {
|
|
|
+ this.advancedQueryFields.push({
|
|
|
+ link: "AND",
|
|
|
+ name: "",
|
|
|
+ searchMethod: "=",
|
|
|
+ value: ""
|
|
|
+ });
|
|
|
+ },
|
|
|
+ removeField(i) {
|
|
|
+ if (this.advancedQueryFields.length > 0) {
|
|
|
+ this.advancedQueryFields.splice(i, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ advancedQuery() {
|
|
|
+ this.advancedQuerySearchKey = "";
|
|
|
+
|
|
|
+ if (this.advancedQueryFields.length > 0) {
|
|
|
+ var templist = [];
|
|
|
+
|
|
|
+ this.advancedQueryFields.forEach(item => {
|
|
|
+ if (item.link && item.name && item.searchMethod && item.value) {
|
|
|
+ var tempItem =
|
|
|
+ item.link +
|
|
|
+ "_," +
|
|
|
+ item.name +
|
|
|
+ "_," +
|
|
|
+ item.searchMethod +
|
|
|
+ "_," +
|
|
|
+ item.value;
|
|
|
+ templist.push(tempItem);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (templist.length > 0) {
|
|
|
+ this.advancedQuerySearchKey = templist.join("_;");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getData();
|
|
|
+ this.showAdvancedQueryDialog = false;
|
|
|
+ },
|
|
|
+ addSortField() {
|
|
|
+ this.tableSortFields.push({
|
|
|
+ name: "",
|
|
|
+ order: "asc"
|
|
|
+ });
|
|
|
+ },
|
|
|
+ removeSortField(i) {
|
|
|
+ if (this.tableSortFields.length > 0) {
|
|
|
+ this.tableSortFields.splice(i, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ tableSortQuery() {
|
|
|
+ this.orderByStr = "";
|
|
|
+
|
|
|
+ if (this.tableSortFields.length > 0) {
|
|
|
+ var templist = [];
|
|
|
+
|
|
|
+ this.tableSortFields.forEach(item => {
|
|
|
+ if (item.name && item.order) {
|
|
|
+ var tempItem = item.name + "_," + item.order;
|
|
|
+ templist.push(tempItem);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (templist.length > 0) {
|
|
|
+ this.orderByStr = templist.join("_;");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getData();
|
|
|
+ this.showTableSortDialog = false;
|
|
|
+ },
|
|
|
+ exportExcel() {
|
|
|
+ window.location.href =
|
|
|
+ this.$baseUrl +
|
|
|
+ "/clickHistory/exportExcel?searchKey=" +
|
|
|
+ this.filter1 +
|
|
|
+ "&advancedQuery=" +
|
|
|
+ this.advancedQuerySearchKey +
|
|
|
+ "&orderByStr=" +
|
|
|
+ this.orderByStr;
|
|
|
+ },
|
|
|
+ searchData() {
|
|
|
+ this.currentPage = 1;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ deleteRow(row) {
|
|
|
+ this.$alert("删除将无法恢复,确认要删除么?", "警告", { type: "error" })
|
|
|
+ .then(() => {
|
|
|
+ return this.$http.post({
|
|
|
+ url: "/clickHistory/del",
|
|
|
+ data: { id: row.id }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ this.getData();
|
|
|
+ })
|
|
|
+ .catch(action => {
|
|
|
+ if (action === "cancel") {
|
|
|
+ this.$message.info("删除取消");
|
|
|
+ } else {
|
|
|
+ this.$message.error("删除失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ DateTimeFormatter(row, column, cellValue) {
|
|
|
+ if (cellValue) {
|
|
|
+ return format(cellValue, "YYYY/MM/DD HH:mm", { locale: zh });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ DateFormatter(row, column, cellValue) {
|
|
|
+ if (cellValue) {
|
|
|
+ return format(cellValue, "YYYY/MM/DD", { locale: zh });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ stationFormatter(row, column, cellValue) {
|
|
|
+ if (cellValue) {
|
|
|
+ var stationId = "";
|
|
|
+ this.stations.forEach(item => {
|
|
|
+ if (item.id == Number(cellValue)) {
|
|
|
+ stationId = item.stationName;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return stationId;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ exhibitionFormatter(row, column, cellValue) {
|
|
|
+ if (cellValue) {
|
|
|
+ var exhibitionId = "";
|
|
|
+ this.exhibitons.forEach(item => {
|
|
|
+ if (item.id == Number(cellValue)) {
|
|
|
+ exhibitionId = item.name;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return exhibitionId;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ showImg(img) {
|
|
|
+ this.imgSrc = img;
|
|
|
+ this.imageDialogVisible = true;
|
|
|
}
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
-
|
|
|
</style>
|