From deb9457cbf67185699de2cd6dbc1ec5690584da0 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期五, 06 九月 2024 12:30:41 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue | 418 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 415 insertions(+), 3 deletions(-)
diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue
index a894f7f..ec3de1a 100644
--- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue
@@ -1,13 +1,425 @@
<template>
- <p>鐘舵�佹睜</p>
+ <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>
+ <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭
+ </el-button>
+ <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆
+ </el-button>
+ <el-button icon="el-icon-check" plain size="small" type="primary"
+ @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿
+ </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="40%"
+ @close="visibleCloseHandler"
+ >
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+ <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="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 @click="visibleCloseHandler">鍙� 娑�</el-button>
+ <el-button type="primary" @click="addSaveHandler">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+
+ <!-- 瀵煎叆 -->
+ <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆"
+ @updata="getTreeList"></upload-file>
+
+ <!-- 鏌ョ湅浣跨敤鑼冨洿 -->
+ <el-dialog
+ v-dialogDrag
+ :visible.sync="checkViewVisible"
+ append-to-body="true"
+ class="avue-dialog"
+ title="鏌ョ湅浣跨敤鑼冨洿"
+ width="60%"
+ >
+ <avue-crud
+ ref="checkViewCrud"
+ :data="checkViewData"
+ :option="checkViewOption"
+ :table-loading="checkViewLoading"
+ @search-change="checkHandleSearch"
+ @search-reset="checkHandleReset"
+ >
+ </avue-crud>
+ </el-dialog>
+ </basic-container>
+
</template>
<script>
+import {gridStatus, addSave, editSave, deleteStatus, exportStatus, listUsed} from "@/api/modeling/statusPool/api";
+import func from "@/util/func";
+import basicOption from "@/util/basic-option";
+
export default {
- name: "index"
+ name: "index",
+ data() {
+ return {
+ loading: false,
+ data: [],
+ option: {
+ ...basicOption,
+ addBtn: false,
+ editBtn: false,
+ delBtn: false,
+ calcHeight: -60,
+ column: [
+ {
+ label: '鍚嶇О',
+ prop: 'id',
+ sortable: true,
+ },
+ {
+ label: '鏍囩',
+ prop: 'name',
+ sortable: true,
+ },
+ {
+ label: '鎻忚堪',
+ prop: 'description',
+ },
+ ]
+ },
+ checkViewVisible: false,
+ checkViewData: [],
+ checkViewDataSearch: [],
+ checkViewLoading: false,
+ checkViewOption: {
+ ...basicOption,
+ addBtn: false,
+ menu: false,
+ searchMenuSpan: 8,
+ refreshBtn: false,
+ selection: false,
+ column: [
+ {
+ label: '鍚嶇О',
+ prop: 'TreeId',
+ sortable: true,
+ },
+ {
+ label: '鏉ユ簮',
+ prop: 'name',
+ sortable: true,
+ search: true
+ },
+ {
+ label: '璇存槑',
+ prop: 'description',
+ }
+ ]
+ },
+ tipList: [
+ "璇锋敞鎰忓悕绉颁笉鑳戒负绌�",
+ ],
+ upFileType: ['xls', 'xlsx'],
+ fileUrl: 'api/statusController/importStatus',
+ 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.getTreeList();
+ },
+ methods: {
+ // 宸︿晶鏍戣姹�
+ getTreeList() {
+ 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.getTreeList();
+ },
+
+ // 琛ㄦ牸澶氶��
+ selectChange(row) {
+ this.selectList = row;
+ },
+
+ // 鏉℃暟
+ sizeChange(val) {
+ this.page.pageSize = val;
+ this.getTreeList();
+ },
+
+ // 椤电爜
+ currentChange(val) {
+ this.page.currentPage = val;
+ this.getTreeList();
+ },
+
+ // 琛屽崟閫�
+ 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.getTreeList();
+ }
+ })
+ }).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.getTreeList();
+ }
+ })
+ }).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.getTreeList();
+ this.visible = false;
+ } else {
+ this.$message.error(res.data.obj);
+ }
+ }).catch(error => {
+ this.$message.error(error);
+ });
+ } else {
+ return false;
+ }
+ });
+ },
+
+ // 瀵煎嚭
+ exportClickHandler() {
+ if (this.selectList.length <= 0) {
+ this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
+ return;
+ }
+
+ exportStatus({statusOids: this.selectList.map(item => item.oid).join(',')}).then(res => {
+ func.downloadFileByBlobHandler(res);
+ this.$message.success('瀵煎嚭鎴愬姛');
+ }).catch(err => {
+ this.$message.error(err);
+ })
+ },
+
+ // 瀵煎叆
+ uploadClickHandler() {
+ this.$refs.upload.visible = true;
+ },
+
+ // 鏌ョ湅浣跨敤鑼冨洿
+ checkViewClickHandler() {
+ if (this.selectList.length <= 0) {
+ this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
+ return;
+ }
+
+ if (this.selectList.length > 1) {
+ this.$message.error('鍙兘閫夋嫨涓�鏉℃暟鎹紒');
+ return;
+ }
+ listUsed({oid: this.selectList[0].oid}).then(res => {
+ if (res.data.code === 200) {
+ this.checkViewVisible = true;
+ const data = res.data.data;
+ data.forEach(item => {
+ item.name = item.id + `( ${item.name} )`;
+ item.TreeId = this.selectList[0].oid;
+ })
+ this.checkViewData = res.data.data;
+ this.checkViewDataSearch = res.data.data;
+ }
+ })
+ },
+ // 鏌ョ湅浣跨敤鑼冨洿鏌ヨ
+ checkHandleSearch(params, done) {
+ const {name} = params;
+
+ if (!params.name) {
+ this.checkViewData = this.checkViewDataSearch;
+ return done();
+ }
+ ;
+
+ this.checkViewData = this.checkViewData.filter(item => {
+ return item.name && item.name.includes(name);
+ });
+
+ done();
+
+ },
+
+ // 鏌ョ湅浣跨敤鑼冨洿閲嶇疆
+ checkHandleReset() {
+ this.checkViewData = this.checkViewDataSearch;
+ },
+
+ }
}
</script>
-<style scoped>
+<style lang="scss" scoped>
+::v-deep {
+ .el-scrollbar__wrap {
+ overflow: auto !important;
+ }
+
+}
+
+.upload-demo {
+ margin-left: 20px;
+}
</style>
--
Gitblit v1.9.3