From 09f0861e61e69e2d818eafc7b9edbd17cf0822d4 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 06 十一月 2025 17:20:02 +0800
Subject: [PATCH] 页面优化以及扣分详情导出
---
src/views/system/data-manage/data-detail/index.vue | 248 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 233 insertions(+), 15 deletions(-)
diff --git a/src/views/system/data-manage/data-detail/index.vue b/src/views/system/data-manage/data-detail/index.vue
index 00c2aff..0da78da 100644
--- a/src/views/system/data-manage/data-detail/index.vue
+++ b/src/views/system/data-manage/data-detail/index.vue
@@ -76,11 +76,11 @@
</el-row>
<div style="display: flex;position: relative">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
- <el-form-item label="鍏抽敭璇�" prop="bayonetNumber">
- <el-input v-model="queryParams.keyword" placeholder="鍏抽敭璇嶆悳绱�" clearable @input="handleQuery"/>
+ <el-form-item label="鍏抽敭瀛�" prop="bayonetNumber">
+ <el-input v-model="queryParams.keyword" placeholder="鍥芥爣鐮�/璁惧鍚�/ip鎼滅储" clearable @keyup.enter.native="handleQuery" @clear="handleQuery"/>
</el-form-item>
<el-form-item :label="this.optionsName" prop="option" v-show = "this.optionsStatus">
- <el-select v-model="queryParams.option" size="small" clearable>
+ <el-select v-model="queryParams.option" size="small" clearable @change="handleQuery">
<el-option v-for="option in options" :key="option.value" :label="option.label" :value="option.value"></el-option>
</el-select>
</el-form-item>
@@ -89,7 +89,8 @@
v-model="queryParams.date"
type="date"
placeholder="閫夋嫨鏃ユ湡"
- value-format="yyyy-MM-dd">
+ value-format="yyyy-MM-dd"
+ @change="handleQuery">
</el-date-picker>
</el-form-item>
<el-form-item>
@@ -97,12 +98,37 @@
<el-button icon="el-icon-refresh" size="small" @click="resetQuery">閲嶇疆</el-button>
</el-form-item>
</el-form>
- <right-toolbar style="position: absolute;right: 0px" v-show="index !== 'image_resource_security'" :showSearch.sync="showSearch" @queryTable="handleQuery"
- :columns="showList"></right-toolbar>
+
+
+ <right-toolbar style="position: absolute;right: 0px" v-show="index !== 'image_resource_security'" :showSearch.sync="showSearch" @queryTable="handleQuery"
+ :columns="showList"></right-toolbar>
+ <div>
+ <el-tooltip v-show="needDynamicColumn" style="position: absolute" class="item" effect="dark" content="鑷畾涔夊垪" placement="top">
+ <el-button size="mini" circle icon="el-icon-collection-tag" @click="addDynamicColumn()" />
+ </el-tooltip>
+ </div>
+
+ </div>
+
+ <div v-show="exportUrl" style="margin-bottom: 5px" >
+ <el-form :model="exportParam" :inline="true">
+ <el-form-item label="鍒楅�夋嫨">
+ <el-select v-model="exportParam.id" size="small" clearable>
+ <el-option v-for="option in dynamicColumnList" :key="option.id" :label="option.labelValue" :value="option.id"></el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鍒楀��">
+ <el-input v-model="exportParam.value" size="small" placeholder="鑷畾涔夊垪鍊�"/>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" size="mini" @click="handleExport(exportUrl)" plain v-hasPermi="['platform:platform:export']">瀵煎嚭
+ </el-button>
+ </el-form-item>
+ </el-form>
</div>
<div v-show="index === 'image_resource_security'" style="margin-bottom: 5px">
- <el-button type="primary" plain icon="el-icon-upload" size="mini" @click="handleExport"
+ <el-button type="primary" plain icon="el-icon-upload" size="mini" @click="handleImport"
v-hasPermi="['platform:platform:export']">瀵煎叆
</el-button>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@@ -110,10 +136,23 @@
<div>
<el-table v-loading="loading" :data="tableData.list">
- <el-table-column :prop="item.prop" :label="item.label" :width="item.width" v-for="(item, index) in tableHead"
+<!-- <el-table-column :prop="item.prop" :label="item.label" :width="item.width" v-for="(item, index) in tableHead"-->
+<!-- :key="index" v-if="showListPD(item)">-->
+ <el-table-column :prop="item.prop" :label="item.label" v-for="(item, index) in tableHead"
:key="index" v-if="showListPD(item)">
<template slot-scope="scope">
<span :class="{'error-text': scope.row[item.error]}"> {{ scope.row[item.prop] }} </span>
+ </template>
+ </el-table-column>
+ <el-table-column v-for="(column, index) in dynamicColumnList" :key="index" :label="column.labelValue" :prop="column.propName" align="center">
+ <template slot-scope="scope">
+ {{ getDynamicValue(scope.row, column.propName) }}
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width">
+ <template slot-scope="scope">
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+ v-hasPermi="['point:edit']">淇敼</el-button>
</template>
</el-table-column>
</el-table>
@@ -174,7 +213,57 @@
</div>
</el-dialog>
+ <el-dialog
+ title="娣诲姞鍔ㄦ�佸垪"
+ :visible.sync="showDynamicColumn"
+ width="500px"
+ :before-close="dynamicColumnClose">
+ <div>
+ <div style="margin-bottom: 8px">
+ <el-button style="float: right" type="primary" @click="addColumn" size="small">鏂板涓�鏉�</el-button>
+ </div>
+ <div v-for="(dynamicColumn, index) in dynamicColumnList" :key="index">
+ <el-form :inline="true" size="small">
+ <el-form-item label="鍒楀悕" prop="labelValue">
+ <div style="display: flex; flex-direction: row">
+ <el-input v-model="dynamicColumn.labelValue"></el-input>
+ <el-button style="margin-left: 8px" type="danger" @click="delColumn(dynamicColumn.id, index)">鍒犻櫎</el-button>
+ </div>
+ </el-form-item>
+ </el-form>
+ </div>
+ </div>
+
+ <span slot="footer" class="dialog-footer">
+ <el-button size="small" @click="closeAdd">鍙� 娑�</el-button>
+ <el-button type="primary" size="small" :disabled="!dynamicColumnList || dynamicColumnList.length < 1" @click="saveColumns">淇� 瀛�</el-button>
+ </span>
+ </el-dialog>
+
+ <el-dialog
+ title="淇敼"
+ :visible.sync="showUpdateDynamicColumn"
+ width="500px"
+ :before-close="updateValueDynamicColumnClose">
+ <div v-for="(dynamicColumn, index) in updateDynamicList" :key="index">
+ <el-form :inline="true" size="small">
+ <el-form-item :label="dynamicColumn.labelValue" :prop="dynamicColumn.propName" label-width="100px">
+ <div style="display: flex; flex-direction: row">
+ <el-input v-model="dynamicColumn.columnValue"></el-input>
+ </div>
+ </el-form-item>
+ </el-form>
+ </div>
+ <span slot="footer" class="dialog-footer">
+ <el-button size="small" @click="closeEdit">鍙� 娑�</el-button>
+ <el-button type="primary" size="small" @click="updateValue">纭</el-button>
+ </span>
+ </el-dialog>
+
</div>
+
+
+
</template>
<script>
@@ -182,7 +271,7 @@
import {carData, equipment, faceData, videoData} from "./list";
import {listSecurity, updateSecurity} from '@/api/platform/resource-security';
import {getToken} from "@/utils/auth";
-
+import {deleteDynamicColumnById,editDynamicColumnByPath,getDynamicColumnListByTableName,updateDynamicValue} from '@/api/platform/dynamicColumn';
export default {
name: "Platform",
computed: {
@@ -192,6 +281,20 @@
},
data() {
return {
+ //瀵煎嚭鍙傛暟
+ exportParam: {
+ id: '',
+ value: ''
+ },
+ //澶嶅師鐢�
+ saveDynamicColumnList:[],
+ dynamicColumnList: [],
+ showDynamicColumn:false,
+ showUpdateDynamicColumn:false,
+ updateDynamicList:[],
+ upDateDynamicListNew:[],
+ id: null,
+
// 瀵煎叆鍙傛暟
upload: {
// 鏄惁鏄剧ず寮瑰嚭灞�
@@ -240,6 +343,9 @@
date: '',
dataType: 0,
option: null,
+ dyId: '',
+ dyValue:''
+ ,
},
// 琛ㄥ崟鍙傛暟
form: {},
@@ -266,7 +372,9 @@
showList: [],
tableHead: [],
cardList: [],
- index: null
+ index: null,
+ exportUrl: null,
+ needDynamicColumn:null,
};
},
@@ -285,17 +393,18 @@
// 鎷兼帴鎴� yyyy-MM-dd 鏍煎紡
this.queryParams.date = `${year}-${month}-${day}`;
this.index = this.$route.query.index;
+
if (this.$route.query.type === '1') {
let data = videoData.table.filter(item => item.index === this.$route.query.index)[0]
- // if(this.index = 'monitor_qualification'){
- //
- // }
+ console.log(data)
this.tableHead = data.columns;
this.cardList = data.card;
this.showList = data.showList;
this.optionsStatus = data.optionsStatus;
this.options = data.options;
this.optionsName = data.optionsName;
+ this.exportUrl = data.exportUrl;
+ this.needDynamicColumn = data.needDynamicColumn;
}
if (this.$route.query.type === '2') {
let data = carData.table.filter(item => item.index === this.$route.query.index)[0]
@@ -305,6 +414,8 @@
this.optionsStatus = data.optionsStatus;
this.options = data.options;
this.optionsName = data.optionsName;
+ this.exportUrl = data.exportUrl
+ this.needDynamicColumn = data.needDynamicColumn;
}
if (this.$route.query.type === '3') {
let data = faceData.table.filter(item => item.index === this.$route.query.index)[0]
@@ -314,6 +425,8 @@
this.optionsStatus = data.optionsStatus;
this.options = data.options;
this.optionsName = data.optionsName;
+ this.exportUrl = data.exportUrl
+ this.needDynamicColumn = data.needDynamicColumn;
}
if (this.$route.query.type === '4') {
let data = equipment.table.filter(item => item.index === this.$route.query.index)[0]
@@ -323,12 +436,103 @@
this.optionsStatus = data.optionsStatus;
this.options = data.options;
this.optionsName = data.optionsName;
+ this.exportUrl = data.exportUrl
+ this.needDynamicColumn = data.needDynamicColumn;
}
this.getList();
+ this.getDyColumn();
},
methods: {
- getColor(value, prop) {
+ closeAdd(){
+ this.dynamicColumnList = JSON.parse(JSON.stringify(this.saveDynamicColumnList));
+ this.showDynamicColumn = false;
+ },
+ closeEdit(){
+ this.showUpdateDynamicColumn = false;
+ },
+ addDynamicColumn() {
+ this.showDynamicColumn = true
+ },
+ saveColumns() {
+ let params = {
+ pathName: this.$route.query.ruleName,
+ }
+ console.log(params.pathName)
+ editDynamicColumnByPath(params,this.dynamicColumnList).then(res => {
+ this.$message.success("淇濆瓨鎴愬姛")
+ this.$emit('refreshHeader');
+ this.showDynamicColumn = false
+ //閲嶆柊鍒锋柊椤甸潰
+ this.getDyColumn()
+ this.getList()
+ })
+ },
+ addColumn() {
+ this.dynamicColumnList.push({
+ id: null,
+ labelValue: '',
+ })
+ },
+ handleUpdate(row){
+ this.showUpdateDynamicColumn = true;
+ //row 璧嬪�肩粰鍏冪礌
+ console.log(row)
+ if("褰曞儚鍙敤鐜�" === this.$route.query.ruleName){
+ this.id = row.id;
+ }else {
+ this.id = row.no;
+ }
+ //娣辨嫹璐�
+ this.updateDynamicList = JSON.parse(JSON.stringify(row.dynamicColumnList));
+ console.log(updateDynamicList)
+ },
+ updateValue(){
+ let data = {
+ id:this.id,
+ dynamicColumnVOList:this.updateDynamicList,
+ }
+ updateDynamicValue(data).then(res =>{
+ this.$message.success("淇敼鎴愬姛")
+ this.getList();
+ this.showUpdateDynamicColumn = false;
+ })
+ },
+ delColumn(id, index) {
+ if(id) {
+ deleteDynamicColumnById(id).then(res => {
+ this.$message.success("鍒犻櫎鎴愬姛")
+ this.getDyColumn();
+ this.$emit('refreshHeader');
+ })
+ }else {
+ this.dynamicColumnList.splice(index,1)
+ }
+ },
+ getDyColumn() {
+ // 鏌ヨ鍔ㄦ�佸垪
+ let params = {
+ pathName: this.$route.query.ruleName,
+ }
+
+ getDynamicColumnListByTableName(params).then(res => {
+ this.dynamicColumnList = res.data
+ //澶嶅師鐢�
+ this.saveDynamicColumnList = JSON.parse(JSON.stringify(this.dynamicColumnList));
+ this.refreshkey+=1
+ })
+ },
+ getDynamicValue(row, propName) {
+ let target = row.dynamicColumnList.filter(item => item.propName === propName)
+ return target && target.length > 0 ? target[0].columnValue : ''
+ },
+ dynamicColumnClose() {
+ this.showDynamicColumn = false
+ },
+ updateValueDynamicColumnClose() {
+ this.showUpdateDynamicColumn = false
+ },
+ getColor(value, prop) {
// 榛樿棰滆壊
return 'red';
},
@@ -391,6 +595,7 @@
this.tableData = response.data;
this.total = response.total;
this.loading = false;
+
});
},
// 鍙栨秷鎸夐挳
@@ -424,9 +629,18 @@
this.handleQuery();
},
/** 瀵煎叆鎸夐挳鎿嶄綔 */
- handleExport() {
+ handleImport() {
this.upload.title = "鏁版嵁瀵煎叆";
this.upload.open = true;
+ },
+ handleExport(url) {
+ this.queryParams.dyId = this.exportParam.id
+ this.queryParams.dyValue = this.exportParam.value
+ this.download(url, {
+ ...this.queryParams,
+ }, this.$route.query.ruleName+`_${new Date().getTime()}.xlsx`, {
+ timeout: 60000
+ })
},
/** 涓嬭浇妯℃澘 */
importTemplate() {
@@ -516,4 +730,8 @@
width: 150px;
margin: 0 30px;
}
+.custom-label-form-item .el-form-item__label {
+ width: 100px ; /* 鍥哄畾瀹藉害涓� 100px */
+ text-align: right; /* 鍙�夛細璁╂枃鏈彸瀵归綈 */
+}
</style>
--
Gitblit v1.8.0