From 7599243f9f7bb9a1622eda1a504e507067fbb815 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期四, 21 十一月 2024 18:17:27 +0800
Subject: [PATCH] 首页配置
---
Source/plt-web/plt-web-ui/src/views/wel/homeConfig.vue | 293 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 293 insertions(+), 0 deletions(-)
diff --git a/Source/plt-web/plt-web-ui/src/views/wel/homeConfig.vue b/Source/plt-web/plt-web-ui/src/views/wel/homeConfig.vue
new file mode 100644
index 0000000..d7efc03
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/src/views/wel/homeConfig.vue
@@ -0,0 +1,293 @@
+<template>
+ <basic-container>
+ <avue-crud
+ ref="useCrud"
+ :data="data"
+ :option="option"
+ :page.sync="page"
+ :table-loading="loading"
+ @selection-change="selectChange"
+ @row-click="rowClickHandler"
+ @refresh-change="handleRefresh"
+ @size-change="sizeChange"
+ @current-change="currentChange"
+ >
+ <template slot="menuLeft">
+ <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓
+ </el-button>
+ <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎
+ </el-button>
+ </template>
+
+ <template slot="menu" slot-scope="{row,index}">
+ <el-button icon="el-icon-edit" plain size="small" type="text" @click="editClickHandler(row)">淇敼
+ </el-button>
+ <el-button icon="el-icon-delete" plain size="small" type="text" @click="delRowClickHandler(row)">鍒犻櫎
+ </el-button>
+ </template>
+ </avue-crud>
+
+ <!-- 鏂板 淇敼 -->
+ <el-dialog
+ v-dialogDrag
+ :title="dialogTitle === 'add' ? '鍒涘缓' : '淇敼'"
+ :visible.sync="visible"
+ append-to-body="true"
+ class="avue-dialog"
+ width="500px"
+ @close="visibleCloseHandler"
+ >
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px" size="small">
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="鍚嶇О锛�" prop="id">
+ <el-input v-model="form.id"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="鏍囩锛�" prop="name">
+ <el-input v-model="form.name"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="鍥炬爣锛�" prop="icon">
+ <avue-input-icon v-model="form.icon" :icon-list="iconList" placeholder="璇烽�夋嫨鍥炬爣">
+ </avue-input-icon>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="鎻忚堪锛�" prop="description">
+ <el-input v-model="form.description" :rows="2" type="textarea"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <span slot="footer" class="dialog-footer">
+ <el-button type="primary" @click="addSaveHandler">纭� 瀹�</el-button>
+ <el-button @click="visibleCloseHandler">鍙� 娑�</el-button>
+ </span>
+ </el-dialog>
+ </basic-container>
+</template>
+
+<script>
+import iconList from "@/config/iconList";
+import basicOption from "@/util/basic-option";
+import {addSave, deleteStatus, editSave, gridStatus} from "@/api/modeling/statusPool/api";
+import func from "@/util/func";
+
+export default {
+ name: "homeConfig",
+ data() {
+ return {
+ iconList: iconList,
+ loading: false,
+ data: [],
+ option: {
+ ...basicOption,
+ addBtn: false,
+ editBtn: false,
+ delBtn: false,
+ calcHeight: -60,
+ column: [
+ {
+ label: '鍚嶇О',
+ prop: 'id',
+ sortable: true,
+ },
+ {
+ label: '鍥炬爣',
+ prop: 'icon'
+ },
+ {
+ label: '鏍囩',
+ prop: 'name',
+ sortable: true,
+ },
+ {
+ label: '鎻忚堪',
+ prop: 'description',
+ },
+ ]
+ },
+ dialogTitle: '',
+ form: {
+ id: "",
+ name: "",
+ description: ""
+ },
+ rules: {
+ id: [
+ {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'},
+ ]
+ },
+ visible: false,
+ selectList: [],
+ lastIndex: null,
+ page: {
+ currentPage: 1,
+ pageSize: 15,
+ total: 0,
+ pageSizes: [15, 30, 50, 100],
+ },
+ }
+ },
+ created() {
+ this.getList();
+ },
+ methods: {
+ getList() {
+ gridStatus(this.page.currentPage, this.page.pageSize).then(res => {
+ const data = res.data.data;
+ this.data = data;
+ this.page.total = res.data.total;
+ this.loading = false;
+ }).catch(err => {
+ this.$message.error(err);
+ });
+ },
+
+ // 琛ㄦ牸鍒锋柊
+ handleRefresh() {
+ this.getList();
+ },
+
+ // 琛ㄦ牸澶氶��
+ selectChange(row) {
+ this.selectList = row;
+ },
+
+ // 鏉℃暟
+ sizeChange(val) {
+ this.page.pageSize = val;
+ this.getList();
+ },
+
+ // 椤电爜
+ currentChange(val) {
+ this.page.currentPage = val;
+ this.getList();
+ },
+
+ // 琛屽崟閫�
+ rowClickHandler(row) {
+ func.rowClickHandler(
+ row,
+ this.$refs.useCrud,
+ this.lastIndex,
+ (newIndex) => {
+ this.lastIndex = newIndex;
+ },
+ () => {
+ this.selectList = [];
+ }
+ );
+ },
+
+ // 鍒涘缓鎸夐挳
+ addClickHandler() {
+ this.visible = true;
+ this.dialogTitle = 'add';
+ },
+
+ // 缂栬緫鎸夐挳
+ editClickHandler(row) {
+ this.visible = true;
+ this.dialogTitle = 'edit';
+ this.form = {...row};
+ },
+
+ // 鍒犻櫎
+ delClickHandler() {
+ if (this.selectList.length <= 0) {
+ this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
+ return;
+ }
+ this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ this.loading = true;
+ deleteStatus(this.selectList).then(res => {
+ if (res.data.code === 200) {
+ this.$message.success(res.data.obj);
+ this.getList();
+ }
+ })
+ }).catch(() => {
+ this.$message({
+ type: 'info',
+ message: '宸插彇娑堝垹闄�'
+ });
+ });
+ },
+
+ // 琛屽崟涓垹闄�
+ delRowClickHandler(row) {
+ this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ const list = [row];
+ this.loading = true;
+ deleteStatus(list).then(res => {
+ if (res.data.code === 200) {
+ this.$message.success(res.data.obj);
+ this.getList();
+ }
+ })
+ }).catch(() => {
+ this.$message({
+ type: 'info',
+ message: '宸插彇娑堝垹闄�'
+ });
+ });
+ },
+
+ // 鍏抽棴瀵硅瘽妗�
+ visibleCloseHandler() {
+ const form = {
+ id: "",
+ name: "",
+ imagePath: "",
+ description: ""
+ }
+ this.form = form;
+ this.visible = false;
+ this.$refs.form.clearValidate();
+ },
+
+ // 鍒涘缓鎴栫紪杈戜繚瀛�
+ addSaveHandler() {
+ const saveFunction = this.dialogTitle === 'add' ? addSave : editSave;
+ this.$refs.form.validate((valid) => {
+ if (valid) {
+ saveFunction(this.form).then(res => {
+ if (res.data.code === 200) {
+ this.$message.success(res.data.obj);
+ this.loading = true;
+ this.getList();
+ this.visible = false;
+ } else {
+ this.$message.error(res.data.obj);
+ }
+ })
+ } else {
+ return false;
+ }
+ });
+ },
+ }
+}
+</script>
+
+<style lang="scss" scoped>
+::v-deep {
+ .el-scrollbar__wrap {
+ overflow: auto !important;
+ }
+
+}
+</style>
--
Gitblit v1.9.3