From be48a542dc300113e4bbae60a8eff9964aee2cdf Mon Sep 17 00:00:00 2001 From: luohairen <3399054449@qq.com> Date: 星期一, 25 十一月 2024 10:36:08 +0800 Subject: [PATCH] 项目计划展示 --- src/views/project/plan/index.vue | 391 ++++++++++++++++++++++++++++++++++++++++++++++++ vue.config.js | 2 src/api/project/plan/index.js | 44 +++++ src/router/index.js | 14 + 4 files changed, 449 insertions(+), 2 deletions(-) diff --git a/src/api/project/plan/index.js b/src/api/project/plan/index.js new file mode 100644 index 0000000..fc3bb10 --- /dev/null +++ b/src/api/project/plan/index.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 鏌ヨ椤圭洰璁″垝璁板綍鍒楄〃 +export function getList(query) { + return request({ + url: '/api/plan/page', + method: 'get', + params: query + }) +} + +// 鏌ヨ椤圭洰璁″垝璁板綍璇︾粏 +export function getRecord(id) { + return request({ + url: '/plan/record/' + id, + method: 'get' + }) +} + +// 鏂板椤圭洰璁″垝璁板綍 +export function addRecord(data) { + return request({ + url: '/plan/record', + method: 'post', + data: data + }) +} + +// 淇敼椤圭洰璁″垝璁板綍 +export function updateRecord(data) { + return request({ + url: '/plan/record', + method: 'put', + data: data + }) +} + +// 鍒犻櫎椤圭洰璁″垝璁板綍 +export function delRecord(id) { + return request({ + url: '/plan/record/' + id, + method: 'delete' + }) +} diff --git a/src/router/index.js b/src/router/index.js index caf7b3c..e0917a0 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -100,7 +100,19 @@ meta: { title: '澶勭悊寰呭姙' } } ] - } + }, + { + path: '/project', + component: Layout, + children: [ + { + path: '/plan/index', + component: () => import('@/views/project/plan/index'), + name: 'Index', + meta: { title: '椤圭洰璁″垝' } + } + ] + }, ] // 鍔ㄦ�佽矾鐢憋紝鍩轰簬鐢ㄦ埛鏉冮檺鍔ㄦ�佸幓鍔犺浇 diff --git a/src/views/project/plan/index.vue b/src/views/project/plan/index.vue new file mode 100644 index 0000000..4093878 --- /dev/null +++ b/src/views/project/plan/index.vue @@ -0,0 +1,391 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="椤圭洰鍚嶇О" prop="projectName"> + <el-input + v-model="queryParams.projectName" + placeholder="鏀寔妯$硦鏌ヨ" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="椤圭洰浠g爜" prop="projectCode"> + <el-input + v-model="queryParams.projectCode" + placeholder="鏀寔妯$硦鏌ヨ" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="涓婃姤鐘舵��" prop="reportStatus"> + <el-select v-model="queryParams.reportStatus" @change="handleQuery" placeholder="璇烽�夋嫨鐘舵��" clearable> + <el-option label="宸蹭笂鎶�" value="0"></el-option> + <el-option label="鏈笂鎶�" value="1"></el-option> + </el-select> + </el-form-item> + <el-form-item label="瀹℃壒鐘舵��" prop="reportStatus"> + <el-select placeholder="璇烽�夋嫨鐘舵��" clearable> + <el-option label="宸插鎵�" value="0"></el-option> + <el-option label="鏈鎵�" value="1"></el-option> + </el-select> + </el-form-item> + <el-form-item label="椤圭洰骞撮檺" prop="reportStatus"> + <el-select placeholder="涓嬫媺閫夋嫨" clearable> + <el-option label="2024" value="2024"></el-option> + <el-option label="2025" value="2025"></el-option> + </el-select> + </el-form-item> + <el-form-item label="椤圭洰鏈堝害" prop="reportStatus"> + <el-select placeholder="涓嬫媺閫夋嫨" clearable> + <el-option label="1鏈堝害" value="1"></el-option> + <el-option label="2鏈堝害" value="2"></el-option> + </el-select> + </el-form-item> + <el-form-item label="椤圭洰瀛e害" prop="reportStatus"> + <el-select placeholder="涓嬫媺閫夋嫨" clearable> + <el-option label="1瀛e害" value="1"></el-option> + <el-option label="2瀛e害" value="2"></el-option> + <el-option label="3瀛e害" value="3"></el-option> + <el-option label="4瀛e害" value="4"></el-option> + </el-select> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleQuery" + >鏌ヨ</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleReset" + >閲嶇疆</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="['plan:record: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="['plan:record: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="['plan:record:export']"--> +<!-- >瀵煎嚭</el-button>--> +<!-- </el-col>--> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="ID" align="center" prop="id" /> + <el-table-column label="椤圭洰鍚嶇О" align="center" prop="projectName" /> + <el-table-column label="涓婃姤鐘舵��" align="center" prop="reportStatus" > + <template slot-scope="scope"> + {{ scope.row.reportStatus === 0 ? '宸蹭笂鎶�' : '鏈笂鎶�' }} + </template> + </el-table-column> + <el-table-column label="椤圭洰鐮�" align="center" prop="" /> + <el-table-column label="椤圭洰浠g爜" align="center" prop="projectCode" /> + <el-table-column label="椤圭洰绫诲瀷" align="center" prop="projectType" > + <template slot-scope="scope"> + {{ + scope.row.projectType === 0 ? '鎴垮眿寤虹瓚' : + scope.row.projectType === 1 ? '鍩庡競鍩虹璁炬柦' : + scope.row.projectType === 2 ? '浜ら�氳繍杈�' : + scope.row.projectType === 3 ? '姘村埄' : + scope.row.projectType === 4 ? '鑳芥簮' : + scope.row.projectType === 5 ? '闈炵叅鐭垮北' : + scope.row.projectType === 6 ? '鍏朵粬' : '鏈煡' + }} + </template> + </el-table-column> + <el-table-column label="椤圭洰闃舵" align="center" prop="projectPhase" > + <template slot-scope="scope"> + {{ + scope.row.projectPhase === 0 ? '鍌ㄥ瑙勫垝闃舵' : + scope.row.projectPhase === 1 ? '椤圭洰鍓嶆湡闃舵' : + scope.row.projectPhase === 2 ? '瀹炴柦闃舵' : + scope.row.projectPhase === 3 ? '绔e伐鎶曠敤闃舵' : + '鏈煡' + }} + </template> + </el-table-column> + <el-table-column label="鏈堝害" align="center" prop="monthStatus" > + <template slot-scope="scope"> + {{ scope.row.monthStatus === 0 ? '宸蹭笂鎶�' : '鏈笂鎶�' }} + </template> + </el-table-column> + <el-table-column label="瀛e害" align="center" prop="seasonStatus" > + <template slot-scope="scope"> + {{ scope.row.seasonStatus === 0 ? '宸蹭笂鎶�' : '鏈笂鎶�' }} + </template> + </el-table-column> + <el-table-column label="骞村害" align="center" prop="yearStatus" > + <template slot-scope="scope"> + {{ scope.row.yearStatus === 0 ? '宸蹭笂鎶�' : '鏈笂鎶�' }} + </template> + </el-table-column> + <el-table-column label="椤圭洰鐘舵��" align="center" prop="projectStatus" > + <template slot-scope="scope"> + {{ + scope.row.projectStatus === 0 ? '鏈紑宸�' : + scope.row.projectStatus === 1 ? '宸插紑宸�' : + scope.row.projectStatus === 2 ? '宸茬宸�' : + scope.row.projectStatus === 3 ? '鏆傚仠' : + '鏈煡鐘舵��' + }} + </template> + </el-table-column> + <el-table-column label="鎶曡祫绫诲埆" align="center" prop="investType" > + <template slot-scope="scope"> + {{ + scope.row.investType === 0 ? '浼佷笟鎶曡祫' : + scope.row.investType === 1 ? '鏀垮簻鎶曡祫' : + scope.row.investType === 2 ? '澶栧晢鎶曡祫' : + scope.row.investType === 3 ? '澧冨鎶曡祫' : + '鏈煡绫诲瀷' + }} + </template> + </el-table-column> + <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)" + >鏌ョ湅</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + >淇敼</el-button> + <el-button + size="mini" + 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" + /> + +<!-- <!– 娣诲姞鎴栦慨鏀归」鐩鍒掕褰曞璇濇 –>--> +<!-- <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="椤圭洰淇℃伅id" prop="projectInfoId">--> +<!-- <el-input v-model="form.projectInfoId" placeholder="璇疯緭鍏ラ」鐩俊鎭痠d" />--> +<!-- </el-form-item>--> +<!-- <el-form-item label="椤圭洰璁″垝id" prop="planId">--> +<!-- <el-input v-model="form.planId" placeholder="璇疯緭鍏ラ」鐩鍒抜d" />--> +<!-- </el-form-item>--> +<!-- <el-form-item label="宸ョ▼id" prop="engineeringInfoId">--> +<!-- <el-input v-model="form.engineeringInfoId" placeholder="璇疯緭鍏ュ伐绋媔d" />--> +<!-- </el-form-item>--> +<!-- <el-form-item label="璁″垝鏈�" prop="planTime">--> +<!-- <el-input v-model="form.planTime" placeholder="璇疯緭鍏ヨ鍒掓湡" />--> +<!-- </el-form-item>--> +<!-- <el-form-item label="鏈堝害/瀛e害/骞村害 0/1/2" prop="planTimeFlag">--> +<!-- <el-input v-model="form.planTimeFlag" placeholder="璇疯緭鍏ユ湀搴�/瀛e害/骞村害 0/1/2" />--> +<!-- </el-form-item>--> +<!-- <el-form-item label="鎶曡祫" prop="actualInvest">--> +<!-- <el-input v-model="form.actualInvest" placeholder="璇疯緭鍏ユ姇璧�" />--> +<!-- </el-form-item>--> +<!-- </el-form>--> +<!-- <div slot="footer" class="dialog-footer">--> +<!-- <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>--> +<!-- <el-button @click="cancel">鍙� 娑�</el-button>--> +<!-- </div>--> +<!-- </el-dialog>--> + </div> +</template> + +<script> +import { getList, getRecord, delRecord, addRecord, updateRecord } from "@/api/project/plan/index"; + +export default { + name: "Record", + data() { + return { + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 椤圭洰璁″垝璁板綍琛ㄦ牸鏁版嵁 + recordList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + } + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨ椤圭洰璁″垝璁板綍鍒楄〃 */ + getList() { + this.loading = true; + getList(this.queryParams).then(response => { + this.recordList = response.data; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: null, + projectInfoId: null, + planId: null, + engineeringInfoId: null, + planTime: null, + planTimeFlag: null, + createTime: null, + reportStatus: null, + actualInvest: 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 + getRecord(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) { + updateRecord(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addRecord(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 delRecord(ids); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('plan/record/export', { + ...this.queryParams + }, `record_${new Date().getTime()}.xlsx`) + } + } +}; +</script> diff --git a/vue.config.js b/vue.config.js index 05a393b..76eafd1 100644 --- a/vue.config.js +++ b/vue.config.js @@ -36,7 +36,7 @@ proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://localhost:8080`, + target: `http://localhost:10076`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' -- Gitblit v1.8.0