From 12bf2514c17843aab17c9e3fa5ce8933cfefd7f6 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 26 十一月 2024 00:56:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/projectEngineering/projectLibrary/index.vue | 588 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/components/VisibilityToolbar/index.vue | 18 +
2 files changed, 605 insertions(+), 1 deletions(-)
diff --git a/src/components/VisibilityToolbar/index.vue b/src/components/VisibilityToolbar/index.vue
index 2773bb6..d58270f 100644
--- a/src/components/VisibilityToolbar/index.vue
+++ b/src/components/VisibilityToolbar/index.vue
@@ -68,6 +68,7 @@
table: false,
currentPage: 1,
columnRef: null,
+ cpList: []
};
},
props: {
@@ -123,7 +124,22 @@
this.currentPage = page;
},
sortChange(row, val) {
- this.$emit('update:sort', { key: row.key, serialNumber: val });
+ // // 鍒涘缓涓�涓柊鐨刢olumns鏁扮粍锛屼互閬垮厤鐩存帴淇敼鍘熷鏁扮粍
+ // this.cpList = this.columns.map(item => ({ ...item })); // 浣跨敤瑙f瀯鏉ュ垱寤哄璞$殑娴呮嫹璐�
+ //
+ // // 鏇存柊鎸囧畾椤圭殑serialNumber
+ // this.cpList.forEach(item => {
+ // if (item.key === row.key) {
+ // item.serialNumber = row.serialNumber;
+ // }
+ // });
+ //
+ // // 鏍规嵁serialNumber瀵筺ewColumns杩涜鎺掑簭
+ // this.cpList = this.cpList.sort((a, b) => a.serialNumber - b.serialNumber);
+ //
+ // // 瑙﹀彂浜嬩欢閫氱煡鐖剁粍浠禼olumns宸叉洿鏂帮紙濡傛灉鐖剁粍浠堕渶瑕佺煡閬撹繖涓彉鍖栵級
+ // this.$emit('update:sort', this.cpList);
+ this.$emit('update:sort', row);
},
resetSort() {
this.$emit('update:resetSort');
diff --git a/src/views/projectEngineering/projectLibrary/index.vue b/src/views/projectEngineering/projectLibrary/index.vue
new file mode 100644
index 0000000..c1ff4cc
--- /dev/null
+++ b/src/views/projectEngineering/projectLibrary/index.vue
@@ -0,0 +1,588 @@
+<template>
+ <div class="app-container">
+ <el-form :model="queryParams" ref="queryParamsRef" size="small" :inline="true" v-show="showSearch"
+ label-width="68px">
+ <div class="slot">
+ <div class="left-section">
+ <el-form-item label="椤圭洰鍚嶇О" prop="projectName">
+ <el-input
+ style="width: 190px;margin-right: 20px"
+ size="small"
+ v-model="queryParams.projectName"
+ placeholder="璇疯緭鍏ラ」鐩悕绉�"
+ clearable
+ @keyup.enter.native="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item label="椤圭洰浠g爜" prop="projectCode">
+ <el-input
+ style="width: 190px;margin-right: 20px"
+ size="small"
+ v-model="queryParams.projectCode"
+ placeholder="璇疯緭鍏ラ」鐩唬鐮�"
+ clearable
+ @keyup.enter.native="handleQuery"
+ />
+ </el-form-item>
+
+ <el-form-item label="椤圭洰骞撮檺" prop="timeRange">
+ <el-date-picker
+ style="width: 270px"
+ size="small"
+ v-model="queryParams[timeRange]"
+ type="daterange"
+ range-separator="-"
+ value-format="yyyy-MM-dd"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ @change="handleQuery"
+ clearable
+ >
+ </el-date-picker>
+ </el-form-item>
+ <el-form-item>
+ <el-button 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-popover :visible="popoverValue" :width="500" placement="bottom">
+ <template #reference>
+ <el-button style="margin-right: 16px; margin-top: 1px; color: #3369ff" @click="handlePopover"
+ size="small">
+ 鏇村绛涙煡鏉′欢
+ <span style="margin-left: 5px">
+ <el-icon v-if="!popoverValue" class="el-icon-arrow-down"></el-icon>
+ <el-icon v-else-if="popoverValue" class="el-icon-arrow-up"></el-icon>
+ </span>
+ </el-button>
+ </template>
+ <span>绛涢�夋潯浠�</span>
+ <el-form ref="moreQueryParamsRef" label-width="68px" label-position="right" :model="queryParams">
+ <el-row>
+ <el-col :span="12">
+ <el-form-item label="椤圭洰绫诲瀷">
+ <el-select v-model="queryParams.projectType" clearable placeholder="璇烽�夋嫨" class="select-option"
+ size="small">
+ <el-option v-for="items in sys_project_type" :key="items.value" :label="items.label"
+ :value="items.value"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="閲嶇偣鍒嗙被">
+ <el-select v-model="queryParams.importanceType" clearable placeholder="璇烽�夋嫨" class="select-option">
+ <el-option v-for="items in sys_key_categories" :key="items.value" :label="items.label"
+ :value="items.value"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="12">
+ <el-form-item label="椤圭洰鏍囩">
+ <el-select v-model="queryParams.tag" clearable placeholder="璇烽�夋嫨" class="select-option">
+ <el-option v-for="items in sys_project_tags" :key="items.value" :label="items.label"
+ :value="items.value"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="椤圭洰鐘舵��">
+ <el-select v-model="queryParams.projectStatus" :disabled="isProjectCategory" clearable
+ placeholder="璇烽�夋嫨" class="select-option">
+ <el-option v-for="items in sys_project_status" :key="items.value" :label="items.label"
+ :value="items.value"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="12">
+ <el-form-item label="椤圭洰鐮�">
+ <el-select v-model="queryParams.projectColorCode" clearable placeholder="璇烽�夋嫨" class="select-option">
+ <el-option v-for="items in sys_project_code" :key="items.value" :label="items.label"
+ :value="items.value"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍏宠仈鐘舵��">
+ <el-select v-model="queryParams.assignmentStatus" clearable placeholder="璇烽�夋嫨" class="select-option">
+ <el-option v-for="items in sys_association_status" :key="items.value" :label="items.label"
+ :value="items.value"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="12">
+ <el-form-item label="璧勯噾绫诲瀷">
+ <el-select v-model="queryParams.investmentType" clearable placeholder="璇烽�夋嫨" class="select-option">
+ <el-option v-for="items in sys_funding_type" :key="items.value" :label="items.label"
+ :value="items.value"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="椤圭洰闃舵">
+ <el-select v-model="queryParams.projectPhase" clearable placeholder="璇烽�夋嫨" class="select-option">
+ <el-option v-for="items in sys_project_phases" :key="items.value" :label="items.label"
+ :value="items.value"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="12">
+ <el-form-item label="鎶曡祫绫诲埆">
+ <el-select v-model="queryParams.investType" clearable placeholder="璇烽�夋嫨" class="select-option">
+ <el-option v-for="items in sys_investment_type" :key="items.value" :label="items.label"
+ :value="items.value"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="琛屾斂鍖哄垝">
+ <el-select v-model="queryParams.area" clearable placeholder="璇烽�夋嫨" class="select-option">
+ <el-option v-for="items in sys_administrative_divisions" :key="items.value" :label="items.label"
+ :value="items.value"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row style="text-align: center">
+ <el-col :span="24">
+ <el-form-item label-width="0">
+ <el-button type="primary" @click="handleQuery">纭� 璁�</el-button>
+ <el-button @click="closePopover">鍙� 娑�</el-button>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ </el-popover>
+ </div>
+ <div class="right-section">
+ <div>
+ <el-button @click="handleExport" size="small">
+ <svg-icon icon-class="exportIcon" style="margin-right: 8px"/>
+ 瀵煎嚭鏁版嵁
+ </el-button>
+ <el-button :disabled="!isReserve" @click="handleImport" size="small">
+ <svg-icon icon-class="importIcon" style="margin-right: 8px"/>
+ 瀵煎叆鏁版嵁
+ </el-button>
+ </div>
+ <div class="add-btn">
+ <el-tooltip content="鏂板" effect="dark" placement="top">
+ <el-button :disabled="!isReserve" circle icon="el-icon-plus" @click="add()" size="small"/>
+ </el-tooltip>
+ </div>
+ <VisibilityToolbar
+ v-model:showSearch="showSearch"
+ :columns="defaultColumns"
+ @queryTable="handleQuery"
+ @update:sort="handleUpdateSort"
+ @update:columns="handleUpdateColumns"
+ @update:resetSort="handleResetSort"
+ ></VisibilityToolbar>
+ </div>
+ </div>
+ </el-form>
+
+ <el-table
+ :key="tableKey"
+ ref="elTable"
+ style="margin-top: 20px"
+ v-loading="loading"
+ :data="projectInfoList"
+ @selection-change="handleSelectionChange"
+ height="60vh"
+ sortable="custom"
+ :show-overflow-tooltip="true">
+ <el-table-column type="selection" width="55" align="center"/>
+ <!-- 鍔ㄦ�佸垪 -->
+ <el-table-column
+ v-for="item in columns"
+ :key="item.id"
+ v-if="item.visible"
+ :prop="item.id"
+ :label="item.label"
+ :min-width="item.minWidth"
+ >
+ <template slot-scope="scope">
+ <!-- 浣跨敤鍏峰悕鎻掓Ы -->
+ <template v-if="item.slotName">
+ <!-- projectStatus鎻掓Ы -->
+ <template v-if="item.slotName === 'projectStatus'">
+ <el-text class="mx-1">{{ '鑷畾涔夋牱寮�' }}</el-text>
+ </template>
+ <!-- projectColorCode鎻掓Ы -->
+ <template v-if="item.slotName === 'projectColorCode'">
+ <el-text class="mx-1 has-dot">{{ '鑷畾涔夋牱寮�' }}<span class="dot" style="margin-left: 5px"></span></el-text>
+ </template>
+ <!-- projectType鎻掓Ы -->
+ <template v-if="item.slotName === 'projectType'">
+ <el-text class="mx-1">{{ '鑷畾涔夋牱寮�' }}</el-text>
+ </template>
+ <!-- investType鎻掓Ы -->
+ <template v-if="item.slotName === 'investType'">
+ <el-text class="mx-1">{{ '鑷畾涔夋牱寮�' }}</el-text>
+ </template>
+ <!-- planStartTime鎻掓Ы -->
+ <template v-if="item.slotName === 'planStartTime'">
+ {{ '鑷畾涔夋牱寮�' }}
+ </template>
+ </template>
+ <!-- 榛樿鏄剧ず -->
+ <span v-else>{{ scope.row[item.id] }}</span>
+ </template>
+ </el-table-column>
+
+ <!-- 鎿嶄綔鍒� -->
+ <el-table-column label="鎿嶄綔" width="140" align="center" >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ icon="el-icon-view"
+ @click="handleDetail(scope.row)"
+ >
+ </el-button>
+ <el-button
+ v-if="isReserve"
+ size="medium"
+ type="text"
+ icon="el-icon-edit"
+ @click="handleUpdate(scope.row)"
+ >
+ </el-button>
+ <el-button
+ v-if="isReserve"
+ size="medium"
+ type="text"
+ icon="el-icon-delete"
+ @click="handleDelete(scope.row)"
+ >
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <pagination
+ v-show="total>0"
+ :total="total"
+ :page.sync="queryParams.pageNum"
+ :limit.sync="queryParams.pageSize"
+ @pagination="getList"
+ />
+
+ <FileDialog
+ :fileDialogVisible.sync="fileDialogVisible"
+ :isImportOrExport="isImportOrExport"
+ @fileDialogCancel="fileDialogCancel"
+ :currentColumns="columns"
+ />
+ </div>
+</template>
+
+<script>
+import {listInfo, getInfo, delInfo, addInfo, updateInfo} from "@/api/projectInfo";
+import {current, currentRest} from './list';
+import FileDialog from '../component/FileDialog';
+
+export default {
+ name: "projectInfo",
+ components: {
+ FileDialog
+ },
+ data() {
+ return {
+ isImportOrExport: false,
+ fileDialogVisible: false,
+ //鏄惁闇�瑕佹柊澧炴寜閽�(鍌ㄨ搫椤圭洰闇�瑕�)
+ isReserve: false,
+ //椤圭洰鐘舵�佺瓫閫夋潯浠�
+ isProjectCategory: false,
+ //琛ㄥご
+ columns: [],
+ defaultColumns: [],
+ //鎺у埗鏇村绛涢�夋樉闅�
+ popoverValue: false,
+ // 閬僵灞�
+ loading: true,
+ // 閫変腑鏁扮粍
+ ids: [],
+ // 闈炲崟涓鐢�
+ single: true,
+ // 闈炲涓鐢�
+ multiple: true,
+ // 鏄剧ず鎼滅储鏉′欢
+ showSearch: true,
+ // 鎬绘潯鏁�
+ total: 0,
+ // 椤圭洰绠$悊鍩虹淇℃伅琛ㄦ牸鏁版嵁
+ projectInfoList: [],
+ // 寮瑰嚭灞傛爣棰�
+ title: "",
+ // 鏄惁鏄剧ず寮瑰嚭灞�
+ tableKey: 0,
+ open: false,
+ timeRange: [],
+ // 鏌ヨ鍙傛暟
+ queryParams: {
+ pageNum: 1,
+ pageSize: 10,
+ projectName: null,
+ projectCode: null,
+ },
+ moreQueryParams: {
+ projectType: '', // 椤圭洰绫诲瀷
+ importanceType: '', // 閲嶇偣鍒嗙被
+ projectStatus: '', // 椤圭洰鐘舵��
+ projectColorCode: '', // 椤圭洰鐮�
+ investmentType: '', // 璧勯噾绫诲瀷
+ projectPhase: '', // 椤圭洰闃舵
+ investType: '', // 鎶曡祫绫诲埆
+ area: '', // 琛屾斂鍖哄垝
+ assignmentStatus: '', //鍏宠仈鐘舵��
+ tag: '' //椤圭洰鏍囩
+ },
+ // 琛ㄥ崟鍙傛暟
+ form: {},
+ // 琛ㄥ崟鏍¢獙
+ rules: {
+ projectName: [
+ {required: true, message: "椤圭洰鍚嶇О涓嶈兘涓虹┖", trigger: "blur"}
+ ],
+ projectStatus: [
+ {required: true, message: "椤圭洰鐘舵�佷笉鑳戒负绌�", trigger: "change"}
+ ],
+ }
+ };
+ },
+ created() {
+ const projectCategory = this.$route.query.projectCategory;
+ if(!projectCategory || projectCategory === '1'){
+ this.isReserve = true;
+ }
+ if(projectCategory){
+ this.isProjectCategory = true;
+ }
+ const columns = current.map((item, index) => {
+ item.index = index + 1;
+ item.key = index;
+ item.serialNumber = index + 1;
+ return item;
+ });
+ this.columns = columns;
+ this.defaultColumns = JSON.parse(JSON.stringify(columns));
+ this.getList();
+ },
+ methods: {
+ // 閲嶇疆鎺掑簭鐨勬柟娉�
+ handleResetSort() {
+ this.defaultColumns = currentRest.map((item, index) => {
+ item.index = index + 1;
+ item.key = index;
+ item.serialNumber = index + 1
+ return item;
+ });
+ this.columns = currentRest.map((item, index) => {
+ item.index = index + 1;
+ item.key = index;
+ item.serialNumber = index + 1
+ return item;
+ });
+ },
+ // 鏇存柊鍒楃殑鏂规硶
+ handleUpdateColumns(row) {
+ // this.currentColumns = row;
+ this.columns = this.columns.map(item => {
+ if (item.key === row.key) {
+ return row;
+ }
+ return item;
+ });
+ },
+ handleUpdateSort(row) {
+ console.log( this.columns, '鎺掑簭鍓嶇殑鍒�');
+ this.columns = this.columns.map(item => {
+ if (item.key === row.key) {
+ return row;
+ }
+ return item;
+ });
+ this.defaultColumns = JSON.parse(JSON.stringify(this.columns)).sort((a, b) => a.index - b.index);
+ this.columns.sort((a, b) => a.serialNumber - b.serialNumber);
+ //寮哄埗table娓叉煋
+ this.tableKey = this.tableKey +1;
+ console.log( this.columns, '鎺掑簭鍚庣殑鍒�');
+ },
+ // 鍏抽棴鏂囦欢澶勭悊寮规鐨勬柟娉�
+ fileDialogCancel() {
+ this.tableLoading = true;
+ this.fileDialogVisible = false;
+ // this.getList();
+ this.tableLoading = false;
+ },
+ handlePopover() {
+ this.popoverValue.value = !this.popoverValue.value;
+ },
+ closePopover() {
+
+ this.popoverValue.value = false;
+ },
+ /** 鏌ヨ椤圭洰绠$悊鍩虹淇℃伅鍒楄〃 */
+ getList() {
+ this.loading = true;
+ listInfo(this.queryParams).then(response => {
+ this.projectInfoList = response.data;
+ this.total = response.total;
+ });
+ this.loading = false;
+ },
+ // 鍙栨秷鎸夐挳
+ cancel() {
+ this.open = false;
+ this.reset();
+ },
+ // 琛ㄥ崟閲嶇疆
+ reset() {
+ this.form = {
+ id: null,
+ projectName: null,
+ projectCode: null,
+ content: null,
+ projectType: null,
+ projectStatus: null,
+ fundType: null,
+ investType: null,
+ projectPhase: null,
+ tag: null,
+ competentDepartment: null,
+ areaCode: null,
+ managementCentralization: null,
+ projectApprovalType: null,
+ investmentCatalogue: null,
+ importanceType: null,
+ year: null,
+ yearInvestAmount: null,
+ createProjectTime: null,
+ planStartTime: null,
+ planCompleteTime: null,
+ winUnit: null,
+ winAmount: null,
+ winTime: null,
+ projectAddress: null,
+ longitude: null,
+ latitude: null,
+ projectOwnerUnit: null,
+ projectContactPerson: null,
+ contact: null,
+ gmtCreateTime: null,
+ gmtUpdateTime: null,
+ updateBy: null,
+ createBy: null,
+ deleted: null
+ };
+ this.resetForm("form");
+ },
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ handleQuery() {
+ this.queryParams.pageNum = 1;
+ this.getList();
+ },
+ /** 閲嶇疆鎸夐挳鎿嶄綔 */
+ resetQuery() {
+ this.resetForm("queryForm");
+ this.handleQuery();
+ },
+ // 澶氶�夋閫変腑鏁版嵁
+ handleSelectionChange(selection) {
+ this.ids = selection.map(item => item.id)
+ this.single = selection.length !== 1
+ this.multiple = !selection.length
+ },
+ /** 鏂板鎸夐挳鎿嶄綔 */
+ handleAdd() {
+ this.reset();
+ this.open = true;
+ this.title = "娣诲姞椤圭洰绠$悊鍩虹淇℃伅";
+ },
+ /** 淇敼鎸夐挳鎿嶄綔 */
+ handleUpdate(row) {
+ this.reset();
+ const id = row.id || this.ids
+ getInfo(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) {
+ updateInfo(this.form).then(response => {
+ this.$modal.msgSuccess("淇敼鎴愬姛");
+ this.open = false;
+ this.getList();
+ });
+ } else {
+ addInfo(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 delInfo(ids);
+ }).then(() => {
+ this.getList();
+ this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ }).catch(() => {
+ });
+ },
+ /** 瀵煎叆鎸夐挳鎿嶄綔 */
+ handleImport() {
+ this.isImportOrExport = false;
+ this.fileDialogVisible = true;
+ },
+ /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+ handleExport() {
+ this.download('code/info/export', {
+ ...this.queryParams
+ }, `info_${new Date().getTime()}.xlsx`)
+ }
+ }
+};
+</script>
+<style lang="scss" scoped>
+.select-option {
+ width: 140px;
+}
+
+.slot {
+ display: flex;
+}
+
+.left-section {
+ flex-grow: 1;
+}
+
+.right-section {
+ display: flex;
+ margin-left: auto;
+
+ .add-btn {
+ margin: 0 10px;
+ }
+}
+
+</style>
--
Gitblit v1.8.0