From 3100a3aaba5c00e2689eebbdb6c580b32285c12f Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期二, 05 三月 2024 11:14:13 +0800 Subject: [PATCH] 点位管理 --- src/views/system/point/index.vue | 316 +++++++++++++++++++++++++++++++++++++++++++++ src/views/system/unit/people/index.vue | 0 src/api/platform/people.js | 10 src/api/platform/point.js | 44 ++++++ 4 files changed, 365 insertions(+), 5 deletions(-) diff --git a/src/api/platform/people.js b/src/api/platform/people.js index 92d797d..efc0d1f 100644 --- a/src/api/platform/people.js +++ b/src/api/platform/people.js @@ -3,7 +3,7 @@ // 鏌ヨ杩愮淮浜哄憳鍒楄〃 export function listPeople(query) { return request({ - url: '/system/yw-people/page', + url: '/yw-people/page', method: 'get', params: query }) @@ -12,7 +12,7 @@ // 鏌ヨ杩愮淮浜哄憳璇︾粏 export function getPeople(id) { return request({ - url: '/system/yw-people/' + id, + url: '/yw-people/' + id, method: 'get' }) } @@ -20,7 +20,7 @@ // 鏂板杩愮淮浜哄憳 export function addPeople(data) { return request({ - url: '/system/yw-people', + url: '/yw-people', method: 'post', data: data }) @@ -29,7 +29,7 @@ // 淇敼杩愮淮浜哄憳 export function updatePeople(data) { return request({ - url: '/system/yw-people', + url: '/yw-people', method: 'put', data: data }) @@ -38,7 +38,7 @@ // 鍒犻櫎杩愮淮浜哄憳 export function delPeople(id) { return request({ - url: '/system/yw-people/' + id, + url: '/yw-people/' + id, method: 'delete' }) } diff --git a/src/api/platform/point.js b/src/api/platform/point.js new file mode 100644 index 0000000..5a2eecf --- /dev/null +++ b/src/api/platform/point.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 鏌ヨ杩愮淮鐐逛綅鍒楄〃 +export function listPoint(query) { + return request({ + url: '/yw-point/page', + method: 'get', + params: query + }) +} + +// 鏌ヨ杩愮淮鐐逛綅璇︾粏 +export function getPoint(id) { + return request({ + url: '/yw-point/' + id, + method: 'get' + }) +} + +// 鏂板杩愮淮鐐逛綅 +export function addPoint(data) { + return request({ + url: '/yw-point', + method: 'post', + data: data + }) +} + +// 淇敼杩愮淮鐐逛綅 +export function updatePoint(data) { + return request({ + url: '/yw-point', + method: 'put', + data: data + }) +} + +// 鍒犻櫎杩愮淮鐐逛綅 +export function delPoint(id) { + return request({ + url: '/yw-point/' + id, + method: 'delete' + }) +} diff --git a/src/views/system/point/index.vue b/src/views/system/point/index.vue new file mode 100644 index 0000000..a0aa54e --- /dev/null +++ b/src/views/system/point/index.vue @@ -0,0 +1,316 @@ +<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="pointName"> + <el-input + v-model="queryParams.pointName" + placeholder="璇疯緭鍏ョ偣浣嶅悕绉�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐐逛綅寮�濮嬫椂闂�" prop="startTime"> + <el-date-picker clearable + v-model="queryParams.startTime" + type="date" + value-format="yyyy-MM-dd" + placeholder="璇烽�夋嫨鐐逛綅寮�濮嬫椂闂�"> + </el-date-picker> + </el-form-item> + <el-form-item label="鐐逛綅缁撴潫鏃堕棿" prop="endTime"> + <el-date-picker clearable + v-model="queryParams.endTime" + type="date" + value-format="yyyy-MM-dd" + placeholder="璇烽�夋嫨鐐逛綅缁撴潫鏃堕棿"> + </el-date-picker> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </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" + v-hasPermi="['x:point: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="['x:point: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="['x:point: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="['x:point:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="pointList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="鐐逛綅鍚嶇О" align="center" prop="pointName" /> + <el-table-column label="鐐逛綅寮�濮嬫椂闂�" align="center" prop="startTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="鐐逛綅缁撴潫鏃堕棿" align="center" prop="endTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="杩愮淮鍗曚綅" align="center" prop="unitId" /> + <el-table-column label="杩愮淮鐘舵��" align="center" prop="status" /> + <el-table-column label="澶囨敞" align="center" prop="remark" /> + <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="['x:point:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['x:point:remove']" + >鍒犻櫎</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="鐐逛綅鍚嶇О" prop="pointName"> + <el-input v-model="form.pointName" placeholder="璇疯緭鍏ョ偣浣嶅悕绉�" /> + </el-form-item> + <el-form-item label="鐐逛綅寮�濮嬫椂闂�" prop="startTime"> + <el-date-picker clearable + v-model="form.startTime" + type="date" + value-format="yyyy-MM-dd" + placeholder="璇烽�夋嫨鐐逛綅寮�濮嬫椂闂�"> + </el-date-picker> + </el-form-item> + <el-form-item label="鐐逛綅缁撴潫鏃堕棿" prop="endTime"> + <el-date-picker clearable + v-model="form.endTime" + type="date" + value-format="yyyy-MM-dd" + placeholder="璇烽�夋嫨鐐逛綅缁撴潫鏃堕棿"> + </el-date-picker> + </el-form-item> + <el-form-item label="澶囨敞" prop="remark"> + <el-input v-model="form.remark" type="textarea" 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 { listPoint, getPoint, delPoint, addPoint, updatePoint } from "@/api/platform/point"; + +export default { + name: "Point", + data() { + return { + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 杩愮淮鐐逛綅琛ㄦ牸鏁版嵁 + pointList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + pointName: null, + startTime: null, + endTime: null, + unitId: null, + status: null, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + pointName: [ + { required: true, message: "鐐逛綅鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + startTime: [ + { required: true, message: "鐐逛綅寮�濮嬫椂闂翠笉鑳戒负绌�", trigger: "blur" } + ], + endTime: [ + { required: true, message: "鐐逛綅缁撴潫鏃堕棿涓嶈兘涓虹┖", trigger: "blur" } + ], + unitId: [ + { required: true, message: "杩愮淮鍗曚綅涓嶈兘涓虹┖", trigger: "change" } + ], + } + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨ杩愮淮鐐逛綅鍒楄〃 */ + getList() { + this.loading = true; + listPoint(this.queryParams).then(response => { + this.pointList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: null, + pointName: null, + startTime: null, + endTime: null, + unitId: null, + status: null, + remark: null, + createTime: null, + updateTime: 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 + getPoint(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) { + updatePoint(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addPoint(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 delPoint(ids); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('x/point/export', { + ...this.queryParams + }, `point_${new Date().getTime()}.xlsx`) + } + } +}; +</script> diff --git a/src/views/system/people/index.vue b/src/views/system/unit/people/index.vue similarity index 100% rename from src/views/system/people/index.vue rename to src/views/system/unit/people/index.vue -- Gitblit v1.8.0