1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
| <template>
| <basic-container>
| <avue-crud :data="tableData"
| :option="option"
| @on-load="onLoad"
| @row-save="rowSave"
| @row-update="rowUpdate">
| <template slot="groupMapAttrContent" slot-scope="scope">
| <avue-text-ellipsis :height="50" :text="scope.row.groupMapAttrContent">
| <small slot="more">...</small>
| </avue-text-ellipsis>
| </template>
| </avue-crud>
| </basic-container>
| </template>
|
| <script>
| import {getGroupMapXML, addGroupMapXML, updateGroupMapXML} from "@/api/integration/groupMapAttrXML.js";
|
| export default {
| data() {
| return {
| xmlContent: "", // 从后端获取的XML内容
| tableData: [],
| option: {
| height: 'auto',
| border: true,
| index: true,
| viewBtn: true,
| delBtn: false,
| columnBtn: false,
| refreshBtn: false,
| highlightCurrentRow: true,
| dialogClickModal: true,
| column: [
| {
| label: "文件名称",
| prop: "groupMapAttrName",
| },
| {
| label: "文件保存路径",
| prop: "attrMapPath",
| display: false,
| labelWidth: 120,
| },
| {
| type: "textarea",
| label: "文件内容",
| prop: "groupMapAttrContent",
| slot: true,
| minRows: 15,
| span: 24
| },
| {
| label: '映射文件状态',
| prop: "isEnable",
| dicData: [{key: true, value: '启用'}, {key: false, value: '未启用'}],
| html: true,
| align: 'center',
| width: 125,
| display: false,
| formatter: function (row) {
| return row.isEnable ? '<i class="el-icon-check" style="color: #32cd32;font-size: 20px;font-weight: 800"></i>' : '<i class="el-icon-close" style="color: #ff0000;font-size: 20px;font-weight: 800"></i>'
| }
| }
| ]
| }
| };
| },
| mounted() {
|
| },
| created() {
|
| },
| methods: {
| onLoad() {
| getGroupMapXML().then((res) => {
| this.tableData = res.data.data;
| });
| },
| rowSave(row, done) {
| row.groupMapAttrName = row.groupMapAttrName + '.xml';
| addGroupMapXML(row).then(res => {
| this.$message({
| type: "success",
| message: res.data.msg
| });
| done(row)
| this.onLoad()
| })
| },
| rowUpdate(row, index, done) {
| // updateXMLName 修改文件名
| // groupMapAttrName 原文件名
|
| row.updateXMLName = row.groupMapAttrName.includes('.xml') ? row.groupMapAttrName : row.groupMapAttrName + '.xml';
| row.groupMapAttrName = this.tableData[index].groupMapAttrName;
|
| updateGroupMapXML(row).then(res => {
| this.$message({
| type: "success",
| message: res.data.msg
| });
| done();
| this.onLoad();
| });
| }
| }
| };
| </script>
| <style>
| .editor-total {
| width: 100%;
| height: 100%;
| }
| </style>
|
|