From 161edfd2a50595021d9bfe303ed7f1b26893b862 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期五, 29 十一月 2024 12:12:15 +0800
Subject: [PATCH] 数据授权
---
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue | 338 +++++++++++++++++++++++++-------------------------------
1 files changed, 152 insertions(+), 186 deletions(-)
diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue
index 14234ef..cdd91cf 100644
--- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue
@@ -1,122 +1,43 @@
<template>
- <el-container>
- <el-aside>
- <basic-container>
- <div ref="TreeBox" style="height: calc(100vh - 144px);!important;">
- <div class="headerCon">
- <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓
- </el-button>
- <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editClickHandler">淇敼
- </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 class="smallBtn" plain size="small" type="primary"
- @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿
- </el-button>
- </div>
- <!-- 宸︿晶鏍� -->
- <div style="height: calc(100vh - 300px);">
- <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick">
- <span slot-scope="{ node, data }" class="el-tree-node__label">
- <span style="font-size: 15px">
- <i class="el-icon-s-promotion"></i>
- {{ (node || {}).label }}
- </span>
- </span>
- </avue-tree>
- </div>
- </div>
- </basic-container>
- </el-aside>
-
- <el-main>
- <basic-container>
- <el-descriptions :column="1" border class="margin-top" size="medium" title="灞炴�т俊鎭�">
- <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
- :labelStyle="descriptionOption.labelStyle">
- <template slot="label">
- <i :class="icons.id"></i>
- 鍚嶇О
- </template>
- <el-tag v-if="nodeRow.id">{{ nodeRow.id }}</el-tag>
- </el-descriptions-item>
- <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
- :labelStyle="descriptionOption.labelStyle">
- <template slot="label">
- <i :class="icons.name"></i>
- 鏍囩
- </template>
- <el-tag v-if="nodeRow.name">{{ nodeRow.name }}</el-tag>
- </el-descriptions-item>
- <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
- :labelStyle="descriptionOption.labelStyle">
- <template slot="label">
- <i :class="icons.jump"></i>
- 璺宠穬瀛楃
- </template>
- <el-tag v-if="nodeRow.jumpCharacter">{{ nodeRow.jumpCharacter }}</el-tag>
- </el-descriptions-item>
- <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
- :labelStyle="descriptionOption.labelStyle">
- <template slot="label">
- <i :class="icons.init"></i>
- 鍒濆鍊�
- </template>
- <el-tag v-if="nodeRow.initialValue">{{ nodeRow.initialValue }}</el-tag>
- </el-descriptions-item>
- <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
- :labelStyle="descriptionOption.labelStyle">
- <template slot="label">
- <i :class="icons.length"></i>
- 姝ラ暱
- </template>
- <el-tag v-if="nodeRow.stepLength">{{ nodeRow.stepLength }}</el-tag>
- </el-descriptions-item>
- <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
- :labelStyle="descriptionOption.labelStyle">
- <template slot="label">
- <i :class="icons.left"></i>
- 鍓嶇紑
- </template>
- <el-tag v-if="nodeRow.prefixion">{{ nodeRow.prefixion }}</el-tag>
- </el-descriptions-item>
- <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
- :labelStyle="descriptionOption.labelStyle">
- <template slot="label">
- <i :class="icons.right"></i>
- 鍚庣紑
- </template>
- <el-tag v-if="nodeRow.suffix">{{ nodeRow.suffix }}</el-tag>
- </el-descriptions-item>
- <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
- :labelStyle="descriptionOption.labelStyle">
- <template slot="label">
- <i :class="icons.desc"></i>
- 鎻忚堪
- </template>
- <el-tag v-if="nodeRow.description">{{ nodeRow.description }}</el-tag>
- </el-descriptions-item>
- </el-descriptions>
- </basic-container>
- </el-main>
-
- <!-- 鏂板 淇敼 -->
+ <basic-container>
+ <avue-crud
+ ref="crud"
+ :data="data"
+ :option="option"
+ :table-loading="loading"
+ @refresh-change="getTableList"
+ @selection-change="selectChange"
+ @row-click="rowClickHandler">
+ <template slot="menuLeft" slot-scope="scope">
+ <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓</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-view" plain size="small" type="primary"
+ @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿
+ </el-button>
+ </template>
+ <template slot="menu" slot-scope="scope">
+ <el-button icon="el-icon-edit" size="small" type="text" @click="editClickHandler(scope.row)">缂栬緫
+ </el-button>
+ <el-button icon="el-icon-delete" size="small" type="text" @click="delClickHandler(scope.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%"
+ width="800px"
@close="visibleCloseHandler"
>
- <el-form ref="form" :model="form" :rules="rules" label-width="95px">
+ <el-form ref="form" size="small" :model="form" :rules="rules" label-width="95px">
<el-row>
- <el-col :span="12">
+ <el-col :span="24">
<el-form-item label="鍚嶇О锛�" prop="id">
<el-input v-model="form.id"></el-input>
</el-form-item>
@@ -159,16 +80,16 @@
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
- <el-button @click="visibleCloseHandler">鍙� 娑�</el-button>
<el-button type="primary" @click="addSaveHandler">纭� 瀹�</el-button>
+ <el-button @click="visibleCloseHandler">鍙� 娑�</el-button>
</span>
</el-dialog>
- <!-- 瀵煎叆 -->
+ <!-- 瀵煎叆 -->
<upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆"
- @updata="getTreeList"></upload-file>
+ @updata="getTableList"></upload-file>
- <!-- 鏌ョ湅浣跨敤鑼冨洿 -->
+ <!-- 鏌ョ湅浣跨敤鑼冨洿 -->
<el-dialog
v-dialogDrag
:visible.sync="checkViewVisible"
@@ -187,7 +108,7 @@
>
</avue-crud>
</el-dialog>
- </el-container>
+ </basic-container>
</template>
<script>
@@ -206,6 +127,57 @@
name: "index",
data() {
return {
+ loading: false,
+ data: [],
+ option: {
+ ...basicOption,
+ addBtn: false,
+ editBtn: false,
+ delBtn: false,
+ calcHeight: -30,
+ column: [
+ {
+ label: '鍚嶇О',
+ prop: 'id',
+ sortable: true,
+ },
+ {
+ label: '鏍囩',
+ prop: 'name',
+ sortable: true,
+ },
+ {
+ label: '璺宠穬瀛楃',
+ prop: 'jumpCharacter',
+ sortable: true,
+ },
+ {
+ label: '鍒濆鍊�',
+ prop: 'initialValue',
+ sortable: true,
+ },
+ {
+ label: '姝ラ暱',
+ prop: 'stepLength',
+ sortable: true,
+ },
+ {
+ label: '鍓嶇紑',
+ prop: 'prefixion',
+ sortable: true,
+ },
+ {
+ label: '鍚庣紑',
+ prop: 'suffix',
+ sortable: true,
+ },
+ {
+ label: '鎻忚堪',
+ prop: 'description',
+ sortable: true,
+ },
+ ]
+ },
checkViewVisible: false,
checkViewData: [],
checkViewDataSearch: [],
@@ -217,6 +189,7 @@
searchMenuSpan: 8,
refreshBtn: false,
selection: false,
+ header:false,
column: [
{
label: '鍚嶇О',
@@ -296,25 +269,24 @@
right: 'el-icon-caret-right',
desc: 'el-icon-chat-line-square'
},
+ selectList: [],
+ lastIndex: null,
}
},
created() {
- this.getTreeList();
+ this.getTableList();
},
methods: {
- //宸︿晶鏍戞煡璇�
- getTreeList() {
+ // 宸︿晶鏍戞煡璇�
+ getTableList() {
+ this.loading = true;
getVersionRuleAllList().then(res => {
const data = res.data.data;
- this.treeData = data;
+ this.data = data;
+ this.loading = false;
}).catch(err => {
this.$message.error(err)
});
- },
-
- // 宸︿晶鏍戣鐐瑰嚮
- nodeClick(row) {
- this.nodeRow = row;
},
// 鍒涘缓鎸夐挳
@@ -324,14 +296,10 @@
},
// 淇敼鎸夐挳
- editClickHandler() {
- if (func.isEmptyObject(this.nodeRow)) {
- this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
- return;
- }
+ editClickHandler(row) {
+ this.form = {...row};
this.visible = true;
this.dialogTitle = 'edit';
- this.form = this.nodeRow;
},
// 鏂板淇敼瀵硅瘽妗嗗叧闂�
@@ -354,37 +322,37 @@
// 鏂板 缂栬緫 淇濆瓨
addSaveHandler() {
const saveFunction = this.dialogTitle === 'add' ? addVersionRule : updateVersionRule;
-
- saveFunction(this.form).then(res => {
- if (res.data.code === 200) {
- this.$message.success(res.data.obj);
- this.getTreeList();
- this.visible = false;
+ this.$refs.form.validate((valid) => {
+ if (valid) {
+ saveFunction(this.form).then(res => {
+ if (res.data.code === 200) {
+ this.$message.success(res.data.obj);
+ this.getTableList();
+ this.visible = false;
+ } else {
+ this.$message.error(res.data.obj);
+ }
+ }).catch(error => {
+ this.$message.error(error);
+ });
} else {
- this.$message.error(res.data.obj);
+ return false;
}
- }).catch(error => {
- this.$message.error(error);
});
},
// 鍒犻櫎鎸夐挳
- delClickHandler() {
- if (func.isEmptyObject(this.nodeRow)) {
- this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
- return;
- }
+ delClickHandler(row) {
this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
- const list = [this.nodeRow];
+ const list = [row];
deleteVersionRule(list).then(res => {
if (res.data.code === 200) {
this.$message.success(res.data.obj);
- this.getTreeList();
- this.nodeRow = {};
+ this.getTableList();
}
})
}).catch(() => {
@@ -397,12 +365,17 @@
// 瀵煎嚭
exportClickHandler() {
- if (func.isEmptyObject(this.nodeRow)) {
+ if (this.selectList.length <= 0) {
this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
return;
}
- exportVersionRule({vrNames: this.nodeRow.id}).then(res => {
+ if (this.selectList.length > 1) {
+ this.$message.error('鍙兘閫夋嫨涓�鏉℃暟鎹紒');
+ return;
+ }
+
+ exportVersionRule({vrNames: this.selectList[0].id}).then(res => {
func.downloadFileByBlobHandler(res);
this.$message.success('瀵煎嚭鎴愬姛');
}).catch(err => {
@@ -417,11 +390,16 @@
// 鏌ョ湅浣跨敤鑼冨洿
checkViewClickHandler() {
- if (func.isEmptyObject(this.nodeRow)) {
+ if (this.selectList.length <= 0) {
this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
return;
}
- getUsedVersionRuleList({vrName: this.nodeRow.id}).then(res => {
+
+ if (this.selectList.length > 1) {
+ this.$message.error('鍙兘閫夋嫨涓�鏉℃暟鎹紒');
+ return;
+ }
+ getUsedVersionRuleList({vrName: this.selectList[0].id}).then(res => {
if (res.data.code === 200) {
this.checkViewVisible = true;
const data = res.data.data;
@@ -441,7 +419,7 @@
}
;
- this.checkViewData = this.checkViewData.filter(item => {
+ this.checkViewData = this.checkViewDataSearch.filter(item => {
return item.source && item.source.includes(source);
});
@@ -453,6 +431,27 @@
checkHandleReset() {
this.checkViewData = this.checkViewDataSearch;
},
+
+ // 閫夋嫨妗�
+ selectChange(row) {
+ this.selectList = row;
+ },
+
+ // 鐐瑰嚮琛�
+ rowClickHandler(row) {
+ func.rowClickHandler(
+ row,
+ this.$refs.crud,
+ this.lastIndex,
+ (newIndex) => {
+ this.lastIndex = newIndex;
+ },
+ () => {
+ this.selectList = [];
+ }
+ );
+ },
+
}
}
</script>
@@ -462,41 +461,8 @@
.el-scrollbar__wrap {
overflow: auto !important;
}
-
- .headerCon {
- .el-button {
- width: 82px;
- }
- }
-
-}
-
-.headerCon {
- display: flex;
- flex-wrap: wrap;
- margin-bottom: 5px;
-
- .el-button + .el-button {
- margin-left: 5px;
- }
-
- .el-button {
- margin-top: 5px;
+ .el-input-number--small {
+ width: 100%;
}
}
-
-.headerCon > .el-button:nth-child(4) {
- margin-left: 0;
-}
-
-.headerCon > .el-button:nth-child(7) {
- margin-left: 0;
-}
-
-.smallBtn {
- width: 82px;
- text-align: center;
- padding-left: 4.5px;
-}
-
</style>
--
Gitblit v1.9.3