From 74d3009146d83a272286e1d5e60d38a13a3f3c89 Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期一, 26 五月 2025 15:27:16 +0800 Subject: [PATCH] 导出与自定义标签 --- src/views/system/data-manage/data-detail/index.vue | 693 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 546 insertions(+), 147 deletions(-) diff --git a/src/views/system/data-manage/data-detail/index.vue b/src/views/system/data-manage/data-detail/index.vue index 7db03b7..0da78da 100644 --- a/src/views/system/data-manage/data-detail/index.vue +++ b/src/views/system/data-manage/data-detail/index.vue @@ -1,17 +1,37 @@ <template> <div class="app-container"> + <div + style="display: flex;flex-direction: row;min-width: 400px;max-width: 400px;margin-bottom: 5px;border-radius: 1px; user-select: none" + v-show="index !== 'image_resource_security'"> + <div @click="clickTab(0)" class="tab" + :class="{tabActive: 0 === queryParams.dataType, tabInactive: 0 !== queryParams.dataType}">鍏ㄩ儴 + </div> + <div @click="clickTab(1)" class="tab" + :class="{tabActive: 1 === queryParams.dataType, tabInactive: 1 !== queryParams.dataType}">鐪佸巺鑰冩牳 + </div> + <div @click="clickTab(2)" class="tab" + :class="{tabActive: 2 === queryParams.dataType, tabInactive: 2 !== queryParams.dataType}">鍏畨閮ㄨ�冩牳 + </div> + </div> <el-card class="box-card" v-show="index !== 'image_resource_security'"> <el-row style="display: flex; flex-direction: row; align-items: center" justify="space-between"> - <div v-for="card in cardList" style="display: flex;flex-direction: row; margin-right: 50px" :key="card.label"> + <div style="font-size: 18px;min-width: 200px;height: 80px;display: flex;align-items: center">{{ ruleName }} + </div> + <div v-if="cardList && cardList.length > 0" v-for="card in cardList" + style="display: flex;flex-direction: row; margin-right: 50px;margin-left: 20px;align-items: center" + :key="card.label"> <div> <div class="icon-container"> <i :class="card.icon"></i> </div> </div> - <div v-for="data in card.dataList" class="dashboard-item" :key="data.label"> - <div style="color: #5C9BF8;margin-bottom: 20px;font-size: 20px">{{ data.value }}</div> - <div>{{ data.label }}</div> + <div v-if="card.dataList && card.dataList.length > 0" style="display: flex; flex-direction: row"> + <div v-if="data" v-for="(data, index) in card.dataList" class="dashboard-item" :key="data.label"> + <div style="color: #5C9BF8;margin-bottom: 20px;font-size: 20px">{{ tableData.count[index] }}</div> + <div>{{ data.label }}</div> + </div> </div> + </div> <!-- <el-col :span="1">--> <!-- <div class="dashboard-item">--> @@ -21,100 +41,277 @@ <el-col :span="8"></el-col> </el-row> </el-card> - - <!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">--> - <!-- <el-form-item label="鍗″彛缂栧彿" prop="bayonetNumber">--> - <!-- <el-input v-model="queryParams.bayonetNumber" placeholder="璇疯緭鍏ュ崱鍙g紪鍙�" clearable--> - <!-- @keyup.enter.native="handleQuery" />--> - <!-- </el-form-item>--> - <!-- <el-form-item label="鍗″彛鍚嶇О" prop="bayonetName">--> - <!-- <el-input v-model="queryParams.bayonetName" placeholder="璇疯緭鍏ュ崱鍙e悕绉�" clearable @keyup.enter.native="handleQuery" />--> - <!-- </el-form-item>--> - <!-- <el-form-item>--> - <!-- <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">鎼滅储</el-button>--> - <!-- <el-button icon="el-icon-refresh" size="small" @click="resetQuery">閲嶇疆</el-button>--> - <!-- </el-form-item>--> - <!-- </el-form>--> - <el-row :gutter="10" class="mb8" v-show="index === 'image_resource_security'"> - <!-- <el-col :span="1.5">--> - <!-- <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"--> - <!-- v-hasPermi="['platform:platform:add']">鏂板</el-button>--> - <!-- </el-col>--> - <!-- <el-col :span="1.5">--> - <!-- <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"--> - <!-- v-hasPermi="['platform:platform:edit']">淇敼</el-button>--> - <!-- </el-col>--> - <!-- <el-col :span="1.5">--> - <!-- <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"--> - <!-- v-hasPermi="['platform:platform:remove']">鍒犻櫎</el-button>--> - <!-- </el-col>--> - <!-- <el-col :span="1.5">--> - <!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"--> - <!-- v-hasPermi="['platform:platform:export']">瀵煎嚭</el-button>--> - <!-- </el-col>--> - <el-col :span="1.5"> - <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" + <el-container> + <el-main> + <h2>瑙嗛鍥惧儚璧勬簮瀹夊叏绠$悊</h2> + <el-row :gutter="20"> + <el-col :xl="3" :lg="3" :md="6" :sm="6" :xs="12" + v-if="imageResourceSecurity && imageResourceSecurity.length > 0" + v-for="(item, index) in imageResourceSecurity" :key="index" + class="col-margin"> + <el-card style=" + min-width: 150px; + width: 100%; + height: 150px; + text-align: center; + margin-bottom: 20px; + "> + <div style="display: flex; flex-direction: row-reverse"> + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleResourceUpdate(item)">淇敼 + </el-button> + </div> + <div style="font-size: 14px;height: 50px; font-weight: bold;">{{ item.deptName }}</div> + <div style="font-size: 14px;">寰楀垎锛歿{ item.imageResourceSecurity }}</div> + <!-- <div style="font-size: 14px;">瑙嗛浼犺緭缃戣祫浜у噯纭巼锛歿{ item.propertyAccuracy }}</div> + <div style="font-size: 14px;">寮卞彛浠ゅ緱鍒嗭細{{ item.weakPassword }}</div> + <div style="font-size: 14px;">瑙嗛浼犺緭缃戝嵄闄╄祫浜ф瘮渚嬶細{{ item.riskProperty }}</div> + <div style="font-size: 14px;">瑙嗛浼犺緭缃戣竟鐣屽畬鏁存�ф娴嬫墸鍒嗛」锛歿{ item.boundaryIntegrity }}</div> --> + </el-card> + </el-col> + </el-row> + </el-main> + </el-container> + + </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="鍥芥爣鐮�/璁惧鍚�/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 @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> + <el-form-item label="鏃堕棿" prop="date"> + <el-date-picker + v-model="queryParams.date" + type="date" + placeholder="閫夋嫨鏃ユ湡" + value-format="yyyy-MM-dd" + @change="handleQuery"> + </el-date-picker> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">鎼滅储</el-button> + <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> + <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="handleImport" v-hasPermi="['platform:platform:export']">瀵煎叆 </el-button> - </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> + </div> - <el-table v-loading="loading" :data="platformList" @selection-change="handleSelectionChange"> - <el-table-column :prop="item.prop" :label="item.label" v-for="(item, index) in tableHead" :key="index"/> - - <el-table-column label="鎿嶄綔" align="center" 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="['platform:platform:edit']">淇敼 - </el-button> - <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" - v-hasPermi="['platform:platform:remove']">鍒犻櫎 - </el-button> - </template> - </el-table-column> - </el-table> + <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"--> +<!-- :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> + </div> <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/> - <!-- 娣诲姞鎴栦慨鏀瑰崱鍙h繃杞︽暟鎹竴鑷存�у璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> - <el-form-item label="鍗″彛鍚嶇О" prop="bayonetName"> - <el-input v-model="form.bayonetName" placeholder="璇疯緭鍏ュ崱鍙e悕绉�"/> + <!-- 淇敼瑙嗛鍥惧儚璧勬簮瀹夊叏绠$悊瀵硅瘽妗� --> + <el-dialog title="淇敼瑙嗛鍥惧儚璧勬簮瀹夊叏绠$悊" :visible.sync="resourceOpen" width="600px" append-to-body> + <el-form ref="form" :model="resourceForm" :rules="rules" label-width="250px"> + <el-form-item label="閮ㄩ棬鍚嶇О" prop="deptName"> + <el-input v-model="resourceForm.deptName" disabled/> </el-form-item> - <el-form-item label="鍗″彛缂栧彿" prop="bayonetNumber"> - <el-input v-model="form.bayonetNumber" placeholder="璇疯緭鍏ュ崱鍙g紪鍙�"/> + <el-form-item label="骞冲彴杩愯鐜�" prop="platformOnline"> + <el-input-number v-model="resourceForm.platformOnline" :precision="2" :step="0.1" :min="0" :max="1"/> </el-form-item> - <el-form-item label="杩囪溅鏁版嵁閲�" prop="vehicleDataNumber"> - <el-input v-model="form.vehicleDataNumber" placeholder="璇疯緭鍏ヨ繃杞︽暟鎹噺"/> + <el-form-item label="瑙嗛浼犺緭缃戣祫浜у噯纭巼" prop="propertyAccuracy"> + <el-input-number v-model="resourceForm.propertyAccuracy" :precision="2" :step="0.1" :min="0" :max="1"/> </el-form-item> - <el-form-item label="涓嶅敮涓�鏁版嵁 " prop="notUniqueData"> - <el-input v-model="form.notUniqueData" placeholder="璇疯緭鍏ヤ笉鍞竴鏁版嵁 "/> + <el-form-item label="寮卞彛浠ゅ緱鍒�" prop="weakPassword"> + <el-input-number v-model="resourceForm.weakPassword" :precision="2" :step="0.1" :min="0" :max="1"/> </el-form-item> - <el-form-item label="涓嶅敮涓�鏁版嵁閲�" prop="notUniqueDataNumber"> - <el-input v-model="form.notUniqueDataNumber" placeholder="璇疯緭鍏ヤ笉鍞竴鏁版嵁閲�"/> + <el-form-item label="瑙嗛浼犺緭缃戝嵄闄╄祫浜ф瘮渚�" prop="riskProperty"> + <el-input-number v-model="resourceForm.riskProperty" :precision="2" :step="0.1" :min="0" :max="1"/> </el-form-item> + <el-tooltip class="item" effect="dark" content="杩濊杩炴帴浜掕仈缃戞墸鍑�20涓櫨鍒嗙偣/娆★紝杩濊鏃犵嚎AP鎺ュ叆銆侀殢韬玾ifi鎺ュ叆銆佸叡浜綉缁滃悇鎵e噺5涓櫨鍒嗙偣/娆★紝鐩磋嚦姝ら」鎸囨爣鎵e畬涓烘銆�" + placement="top-start"> + <el-form-item label="瑙嗛浼犺緭缃戣竟鐣屽畬鏁存�ф娴嬫墸鍒嗛」" prop="boundaryIntegrity"> + <el-input-number v-model="resourceForm.boundaryIntegrity" :precision="2" :step="0.1" :min="0" :max="1"/> + </el-form-item> + </el-tooltip> + </el-form> <div slot="footer" class="dialog-footer"> - <el-button @click="cancel">鍙� 娑�</el-button> + <el-button @click="cancelR">鍙� 娑�</el-button> <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> </div> </el-dialog> + + <!-- 瀵煎叆瀵硅瘽妗� --> + <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> + <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url" + :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" + :auto-upload="false" drag> + <i class="el-icon-upload"></i> + <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div> + <div class="el-upload__tip text-center" slot="tip"> + <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span> + <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" + @click="importTemplate">涓嬭浇妯℃澘 + </el-link> + </div> + </el-upload> + <div slot="footer" class="dialog-footer"> + <el-button @click="upload.open = false">鍙� 娑�</el-button> + <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button> + </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> import {dataCenter} from "@/api/platform/data-center"; -import {videoData, carData, faceData, equipment} from "./list"; -import store from '@/store'; - +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: { + ruleName() { + return this.$route.query.ruleName + } + }, data() { return { + //瀵煎嚭鍙傛暟 + exportParam: { + id: '', + value: '' + }, + //澶嶅師鐢� + saveDynamicColumnList:[], + dynamicColumnList: [], + showDynamicColumn:false, + showUpdateDynamicColumn:false, + updateDynamicList:[], + upDateDynamicListNew:[], + id: null, + + // 瀵煎叆鍙傛暟 + upload: { + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁绂佺敤涓婁紶 + isUploading: false, + // 璁剧疆涓婁紶鐨勮姹傚ご閮� + headers: {Authorization: "Bearer " + getToken()}, + // 涓婁紶鐨勫湴鍧� + url: process.env.VUE_APP_BASE_API + "/platform/resourceSecurity/importData" + }, + imageResourceSecurity: [], + options: [], + resourceForm: {}, + resourceOpen: false, totalKiosks: 1157, uniqueKiosks: 580, totalCarData: 1477422, @@ -131,8 +328,9 @@ showSearch: true, // 鎬绘潯鏁� total: 0, - // 鍗″彛杩囪溅鏁版嵁涓�鑷存�ц〃鏍兼暟鎹� - platformList: [], + tableData: { + list: [] + }, // 寮瑰嚭灞傛爣棰� title: "", // 鏄惁鏄剧ず寮瑰嚭灞� @@ -141,74 +339,267 @@ queryParams: { pageNum: 1, pageSize: 10, - regionCode: null, - bayonetName: null, - bayonetNumber: null, + keyword: '', + date: '', + dataType: 0, + option: null, + dyId: '', + dyValue:'' + , }, // 琛ㄥ崟鍙傛暟 form: {}, // 琛ㄥ崟鏍¢獙 rules: { - bayonetName: [ - {required: true, message: "鍗″彛鍚嶇О涓嶈兘涓虹┖", trigger: "blur"} + platformOnline: [ + {required: true, message: "璇疯緭鍏ュ钩鍙拌繍琛岀巼", trigger: "blur"}, + {type: "number", message: "骞冲彴杩愯鐜囧繀椤讳负鏁板瓧", trigger: "blur"} ], - bayonetNumber: [ - {required: true, message: "鍗″彛缂栧彿涓嶈兘涓虹┖", trigger: "blur"} + propertyAccuracy: [ + {required: true, message: "璇疯緭鍏ヨ棰戜紶杈撶綉璧勪骇鍑嗙‘鐜�", trigger: "blur"}, + {type: "number", message: "瑙嗛浼犺緭缃戣祫浜у噯纭巼蹇呴』涓烘暟瀛�", trigger: "blur"} ], + riskProperty: [ + {required: true, message: "璇疯緭鍏ュ急鍙d护寰楀垎", trigger: "blur"}, + {type: "number", message: "寮卞彛浠ゅ緱鍒嗗繀椤讳负鏁板瓧", trigger: "blur"} + ], + boundaryIntegrity: [ + {required: true, message: "璇疯緭鍏ヨ棰戜紶杈撶綉鍗遍櫓璧勪骇姣斾緥", trigger: "blur"}, + {type: "number", message: "瑙嗛浼犺緭缃戝嵄闄╄祫浜ф瘮渚嬪繀椤讳负鏁板瓧", trigger: "blur"} + ], + }, + showList: [], tableHead: [], cardList: [], - index: null + index: null, + exportUrl: null, + needDynamicColumn:null, }; }, - beforeRouteEnter(to, from, next) { - console.log(to); - next(); - }, - created() { + + mounted() { + //淇敼椤电鍚� + const obj = Object.assign({},this.$route,{title: this.$route.query.ruleName}) + this.$tab.updatePage(obj); + // 鑾峰彇褰撳墠鏃ユ湡 + const today = new Date(); + + // 鑾峰彇骞淬�佹湀銆佹棩 + const year = today.getFullYear(); + let month = (today.getMonth() + 1).toString().padStart(2, '0'); // 鏈堜唤鏄粠0寮�濮嬬殑锛屾墍浠ュ姞1 + let day = today.getDate().toString().padStart(2, '0'); + + // 鎷兼帴鎴� 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] + 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] 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 === '3') { let data = faceData.table.filter(item => item.index === this.$route.query.index)[0] 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 === '4') { let data = equipment.table.filter(item => item.index === this.$route.query.index)[0] 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; } this.getList(); - if (this.index === 'image_resource_security') { - this.getSecurityCard() - } + this.getDyColumn(); }, methods: { + 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'; + }, + clickTab(active) { + this.queryParams.dataType = active + this.getList() + }, + showListPD(item) { + if (!this.showList) { + return true + } + let arr = this.showList.filter(d => d.label === item.label) + if (item && (!arr || arr.length < 1)) { + return true; + } else { + return item && arr && arr.length > 0 && arr[0].visible + } + + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleResourceUpdate(row) { + this.reset("resourceForm"); + this.resourceForm = JSON.parse(JSON.stringify(row)); + this.resourceOpen = true; + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate((valid) => { + if (valid) { + if (this.resourceForm.id != null) { + updateSecurity(this.resourceForm).then(() => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.resourceOpen = false; + this.getList(); + }); + } + } + }); + }, + // 鍙栨秷鎸夐挳 + cancelR() { + this.resourceOpen = false; + this.reset("resourceForm"); + }, /** 鏌ヨ鍥惧儚璧勬簮瀹夊叏褰撴湀閰嶇疆淇℃伅 */ getSecurityCard() { - + listSecurity().then(response => { + this.imageResourceSecurity = response.rows; + }) }, /** 鏌ヨ鍗″彛杩囪溅鏁版嵁涓�鑷存�у垪琛� */ getList() { let url = this.$route.query.url; this.loading = true; + if (this.index === 'image_resource_security') { + this.getSecurityCard() + } dataCenter(url, this.queryParams).then(response => { - this.platformList = response.data; + response.data.list = response.data.list && response.data.list.length > 0 ? response.data.list : [] + this.tableData = response.data; this.total = response.total; this.loading = false; + }); }, // 鍙栨秷鎸夐挳 - cancel() { + cancelImport() { this.open = false; this.reset(); }, @@ -230,7 +621,6 @@ }, /** 鎼滅储鎸夐挳鎿嶄綔 */ handleQuery() { - this.queryParams.pageNum = 1; this.getList(); }, /** 閲嶇疆鎸夐挳鎿嶄綔 */ @@ -238,69 +628,73 @@ this.resetForm("queryForm"); this.handleQuery(); }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.id); - this.single = selection.length !== 1; - this.multiple = !selection.length; + /** 瀵煎叆鎸夐挳鎿嶄綔 */ + handleImport() { + this.upload.title = "鏁版嵁瀵煎叆"; + this.upload.open = true; }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞鍗″彛杩囪溅鏁版嵁涓�鑷存��"; + 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 + }) }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - const id = row.id || this.ids; - getPlatform(id).then(response => { - this.form = response.data; - this.open = true; - this.title = "淇敼鍗″彛杩囪溅鏁版嵁涓�鑷存��"; - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm() { - this.$refs["form"].validate(valid => { - if (valid) { - if (this.form.id != null) { - updatePlatform(this.form).then(response => { - this.$modal.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - addPlatform(this.form).then(response => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const ids = row.id || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎鍗″彛杩囪溅鏁版嵁涓�鑷存�х紪鍙蜂负"' + ids + '"鐨勬暟鎹」锛�').then(function () { - return delPlatform(ids); - }).then(() => { - this.getList(); - this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => { - }); - }, - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - this.download('platform/platform/export', { + /** 涓嬭浇妯℃澘 */ + importTemplate() { + this.download('platform/resourceSecurity/importTemplate', { ...this.queryParams - }, `platform_${new Date().getTime()}.xlsx`); + }, `瀹夊叏妫�娴嬬粨鏋滃鍏ユā鏉�.xlsx`); + }, + // 鏂囦欢涓婁紶涓鐞� + handleFileUploadProgress(event, file, fileList) { + this.upload.isUploading = true; + }, + // 鏂囦欢涓婁紶鎴愬姛澶勭悊 + handleFileSuccess(response, file, fileList) { + this.upload.open = false; + this.upload.isUploading = false; + this.$refs.upload.clearFiles(); + this.$modal.msgSuccess("瀵煎叆鎴愬姛"); + this.getList(); + }, + // 鎻愪氦涓婁紶鏂囦欢 + submitFileForm() { + this.$refs.upload.submit(); } } }; </script> <style scoped> +.tab { + padding: 5px 15px; +} +.error-text { + color: red; +} +.tab:hover { + cursor: pointer; + user-select: none; +} + +.tabActive { + color: white; + background-color: #409eff; + border: none; + border-radius: 1px; +} + +.tabInactive { + background-color: #edf2f6; + color: #409eff; +} + +.tabInactive:hover { + background-color: #edf2f6; +} + .box-card { background-color: #F5F9FE; width: 100%; @@ -334,5 +728,10 @@ justify-content: center; align-items: center; width: 150px; + margin: 0 30px; +} +.custom-label-form-item .el-form-item__label { + width: 100px ; /* 鍥哄畾瀹藉害涓� 100px */ + text-align: right; /* 鍙�夛細璁╂枃鏈彸瀵归綈 */ } </style> -- Gitblit v1.8.0