ap-dev 1.2.11 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,210 @@
1
+ <template>
2
+ <ap-container>
3
+ <ap-header margin="1111">
4
+ <el-form ref="tDevCptBaseSearchForm" :model="tDevCptBaseSearchForm" :rules="tDevCptBaseSearchFormRules"
5
+ :inline="true" class="layout-header-form">
6
+ <el-form-item label="搜索:" class="layout-header-form-item" prop="likeStr">
7
+ <el-input v-model="tDevCptBaseSearchForm.likeStr" placeholder="名称"></el-input>
8
+ </el-form-item>
9
+ </el-form>
10
+ <el-button type="primary" @click="searchEvent">查询</el-button>
11
+ </ap-header>
12
+ <ap-main margin="0111">
13
+ <ap-table ref="tDevCptBaseRef" :options.sync="tDevCptBaseOpt"></ap-table>
14
+ </ap-main>
15
+
16
+ <el-dialog :title="dialogInfo.title" :visible.sync="dialogInfo.isVisible" @close="resetTDevCptBaseForm"
17
+ width="700px">
18
+ <el-form ref="tDevCptBaseFormRef" :model="tDevCptBaseForm" v-loading="dialogInfo.formIsLoading"
19
+ label-width="80px" :inline="true">
20
+
21
+ <el-form-item label='名称' prop='fdName'>
22
+ <el-input v-model='tDevCptBaseForm.fdName'></el-input>
23
+ </el-form-item>
24
+ <br>
25
+ <el-form-item label='左侧空间' prop='fdLeftSpace'>
26
+ <el-input v-model='tDevCptBaseForm.fdLeftSpace'></el-input>
27
+ </el-form-item>
28
+ <el-form-item label='排序' prop='fdSort'>
29
+ <el-input v-model='tDevCptBaseForm.fdSort'></el-input>
30
+ </el-form-item>
31
+ <el-form-item label='模板' prop='fdTemplate'>
32
+ <el-input type="textarea" v-model='tDevCptBaseForm.fdTemplate' style="width: 500px" :rows="10"></el-input>
33
+ </el-form-item>
34
+ </el-form>
35
+
36
+ <span slot="footer">
37
+ <el-button @click="dialogInfo.isVisible = false">取 消</el-button>
38
+ <el-button type="primary" @click="saveTDevCptBaseForm"
39
+ :loading="dialogInfo.saveBtnIsLoading">确 定</el-button>
40
+ </span>
41
+ </el-dialog>
42
+ </ap-container>
43
+ </template>
44
+
45
+ <script>
46
+ export default {
47
+ name: 'TDevCptBase',
48
+ data() {
49
+ let columns = [
50
+ {
51
+ prop: 'fdName',
52
+ label: '名称',
53
+ type: 'input',
54
+ width: '120'
55
+ }, {
56
+ prop: 'fdLeftSpace',
57
+ label: '向右偏移',
58
+ type: 'input',
59
+ help: '模板整体向右偏移空格数',
60
+ width: '100'
61
+ }, {
62
+ prop: 'fdSort',
63
+ label: '排序',
64
+ type: 'input',
65
+ width: '100'
66
+ }, {
67
+ prop: 'fdTemplate',
68
+ label: '模板',
69
+ type: 'input',
70
+ html: (value, row) =>{
71
+ console.log(value);
72
+ value = value.replaceAll("<", "&lt;")
73
+ let html = `<div class="api-code" style="line-height: 14px;">${value}</div>`;
74
+ return html;
75
+ },
76
+ help: `1、参数格式:\${xxxx}<br> xxx只能是字母,默认空格连接<br>
77
+ 2、数组参数格式:\${xxxx#abc}<br>使用#连接,abc为自定义连接符。使用\\n表示换行<br>
78
+ 3、行以参数开头,则前缀空格会被自动清空。可使用组件模板控制前置空格。`
79
+ }
80
+ ];
81
+ let toolbarBtn = [
82
+ {type: "add", onClick: this.openAddDialog},
83
+ {type: "edit", onClick: this.openEditDialog},
84
+ "del", "refresh", "save"
85
+ ];
86
+ let tableOpt = {
87
+ title: "组件基础模板",
88
+ columns: columns,
89
+ dataUrl: "/apd/TDevCptBase/getTDevCptBaseGridList",
90
+ deletePk: "fdId", // 默认fdId
91
+ deleteUrl: "/apd/TDevCptBase/deleteTDevCptBaseGridData",
92
+ toolbarBtn: toolbarBtn,
93
+ initData: true, // 默认false
94
+ params: () => {
95
+ return {
96
+ likeStr: this.tDevCptBaseSearchForm.likeStr
97
+ }
98
+ }
99
+ };
100
+
101
+ let tDevCptBaseForm = {
102
+ fdName: '',
103
+ fdLeftSpace: '',
104
+ fdTemplate: '',
105
+ fdSort: '',
106
+ };;
107
+ return {
108
+ tDevCptBaseOpt: tableOpt,
109
+ tDevCptBaseForm: tDevCptBaseForm,
110
+ tDevCptBaseFormRules: {
111
+ },
112
+ dialogInfo: {
113
+ title: "",
114
+ isAdd: false,
115
+ isVisible: false,
116
+ saveBtnIsLoading: false,
117
+ formIsLoading: false
118
+ },
119
+ tDevCptBaseSearchForm: {
120
+ likeStr: ""
121
+ },
122
+ tDevCptBaseSearchFormRules: {
123
+ // TODO 自定义rules
124
+ likeStr: [{min: 1, max: 10, message: '长度在 1 到 10 个字符', trigger: 'blur'}]
125
+ }
126
+ }
127
+ },
128
+ methods: {
129
+ // 打开添加dialog
130
+ openAddDialog() {
131
+ this.dialogInfo.isAdd = true;
132
+ this.dialogInfo.title = "添加数据";
133
+ this.dialogInfo.isVisible = true;
134
+ },
135
+ // 打开编辑dialog
136
+ openEditDialog() {
137
+ let selectedRows = this.$refs.tDevCptBaseRef.getSelection();
138
+ if (selectedRows.length < 1) {
139
+ this.$message.error("请选择需要编辑的行!");
140
+ return;
141
+ }
142
+ if (selectedRows.length > 1) {
143
+ this.$message.error("只能选择单行数据进行编辑!");
144
+ return;
145
+ }
146
+
147
+ this.dialogInfo.isAdd = false;
148
+ this.dialogInfo.title = "编辑数据";
149
+ this.dialogInfo.isVisible = true;
150
+ this.dialogInfo.formIsLoading = true;
151
+ // 获取单条数据
152
+ this.$request({
153
+ url: '/apd/TDevCptBase/getTDevCptBaseByFdId',
154
+ method: 'post',
155
+ data: {
156
+ fdId: selectedRows[0].fdId
157
+ }
158
+ }).then(response => {
159
+ this.tDevCptBaseForm = response.data;
160
+ }).finally(() => {
161
+ this.dialogInfo.formIsLoading = false;
162
+ })
163
+ },
164
+ // 重置表单
165
+ resetTDevCptBaseForm() {
166
+ this.$refs.tDevCptBaseFormRef.resetFields();
167
+ },
168
+ // dialog表单保存
169
+ saveTDevCptBaseForm() {
170
+ // 表单rules认证
171
+ this.$refs.tDevCptBaseFormRef.validate((valid) => {
172
+ if (!valid) {
173
+ this.$message.error('数据校验错误!');
174
+ return false;
175
+ }
176
+ this.dialogInfo.saveBtnIsLoading = true;
177
+
178
+ let fnName = this.dialogInfo.isAdd ? "insertTDevCptBase" : "updateTDevCptBase";
179
+ // 添加数据
180
+ this.$request({
181
+ url: '/apd/TDevCptBase/' + fnName,
182
+ method: 'post',
183
+ data: this.tDevCptBaseForm
184
+ }).then(response => {
185
+ this.$message.success(`保存成功!`)
186
+ this.dialogInfo.isVisible = false;
187
+ // 刷新表格
188
+ this.$refs.tDevCptBaseRef.refresh();
189
+ }).finally(() => {
190
+ this.dialogInfo.saveBtnIsLoading = false;
191
+ })
192
+ });
193
+ },
194
+ // 查询
195
+ searchEvent() {
196
+ // 表单rules认证
197
+ this.$refs.tDevCptBaseSearchForm.validate((valid) => {
198
+ if (!valid) {
199
+ this.$message.error('搜索条件格式不正确!');
200
+ return false;
201
+ }
202
+ this.$refs.tDevCptBaseRef.refresh();
203
+ });
204
+ }
205
+ }
206
+ }
207
+ </script>
208
+
209
+ <style scoped>
210
+ </style>
@@ -1,16 +1,22 @@
1
1
  <template>
2
- <el-tabs tab-position="left" class="db-design" style="height: 100%;">
3
- <el-tab-pane label="我的配置" style="height: 100%;">
4
- <dev-my-config/>
2
+ <el-tabs v-model="activeTab" @tab-click="handleClick" tab-position="left" class="config-tab" style="height: 100%;">
3
+ <el-tab-pane label="我的配置" name="status1" style="height: 100%;">
4
+ <dev-my-config v-if="status1"/>
5
5
  </el-tab-pane>
6
- <el-tab-pane label="数据源管理" style="height: 100%;">
7
- <dev-db-source/>
6
+ <el-tab-pane label="数据源管理" name="status2" style="height: 100%;">
7
+ <dev-db-source v-if="status2"/>
8
8
  </el-tab-pane>
9
- <el-tab-pane label="数据源授权" style="height: 100%;">
10
- <dev-db-user-source/>
9
+ <el-tab-pane label="数据源授权" name="status3" style="height: 100%;">
10
+ <dev-db-user-source v-if="status3"/>
11
11
  </el-tab-pane>
12
- <el-tab-pane label="文档历史表" style="height: 100%;">
13
- <dev-doc-history/>
12
+ <el-tab-pane label="文档历史表" name="status4" style="height: 100%;">
13
+ <dev-doc-history v-if="status4"/>
14
+ </el-tab-pane>
15
+ <el-tab-pane label="组件基础模板" name="status5" style="height: 100%;">
16
+ <dev-cpt-base v-if="status5"/>
17
+ </el-tab-pane>
18
+ <el-tab-pane label="组件配置" name="status6" style="height: 100%;">
19
+ <dev-cpt v-if="status6"/>
14
20
  </el-tab-pane>
15
21
  </el-tabs>
16
22
  </template>
@@ -20,6 +26,8 @@
20
26
  import DevDbSource from './DevDbSource'
21
27
  import DevDbUserSource from './DevDbUserSource'
22
28
  import DevDocHistory from './DevDocHistory'
29
+ import DevCpt from './DevCpt'
30
+ import DevCptBase from './DevCptBase'
23
31
 
24
32
  export default {
25
33
  name: 'ConfigPanel',
@@ -27,17 +35,38 @@
27
35
  DevMyConfig,
28
36
  DevDbSource,
29
37
  DevDbUserSource,
30
- DevDocHistory
38
+ DevDocHistory,
39
+ DevCpt,
40
+ DevCptBase,
41
+ },
42
+ data() {
43
+ return {
44
+ activeTab: 'status1',
45
+ status1: true,
46
+ status2: false,
47
+ status3: false,
48
+ status4: false,
49
+ status5: false,
50
+ status6: false,
51
+ status7: false,
52
+ status8: false,
53
+ }
54
+ },
55
+ methods: {
56
+ handleClick(tab, event) {
57
+ this[tab.name] = true;
58
+ console.log(tab.name);
59
+ },
31
60
  }
32
61
  }
33
62
  </script>
34
63
 
35
64
  <style scoped>
36
- .db-design /deep/ .el-tabs__header.is-left {
65
+ .config-tab /deep/ .el-tabs__header.is-left {
37
66
  margin-right: 0px !important;
38
67
  }
39
68
 
40
- .db-design /deep/ .el-tabs__content {
69
+ .config-tab /deep/ .el-tabs__content {
41
70
  height: 100% !important;
42
71
  }
43
72
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div id="renderCtn" ref="renderCtn" class="render-ctn">
2
+ <div :id="ctnId" :ref="ctnId" class="render-ctn">
3
3
  <span style="color: #9e9e9e;">暂无内容</span>
4
4
  </div>
5
5
  </template>
@@ -16,8 +16,12 @@ export default {
16
16
  }
17
17
  },
18
18
  data() {
19
-
19
+ let id = parseInt(Math.random() * 10000000);
20
+ let ctnId = "renderCtn" + id;
21
+ let appId = "appId" + id;
20
22
  return {
23
+ appId: appId,
24
+ ctnId: ctnId,
21
25
  component: null,
22
26
  html: '',
23
27
  js: '',
@@ -34,11 +38,15 @@ export default {
34
38
  deep: true
35
39
  }
36
40
  },
41
+ mounted() {
42
+ this.removeRender();
43
+ this.renderCode();
44
+ },
37
45
  methods: {
38
46
  // 移除渲染内容
39
47
  removeRender() {
40
48
  // 移除元素
41
- let children = document.getElementById("renderCtn").children;
49
+ let children = document.getElementById(this.ctnId).children;
42
50
  if (children == null) {
43
51
  return;
44
52
  }
@@ -59,7 +67,7 @@ export default {
59
67
  parseStrToFunc.template = this.html;
60
68
  const Component = Vue.extend(parseStrToFunc);
61
69
  this.component = new Component().$mount();
62
- this.$refs.renderCtn.appendChild(this.component.$el);
70
+ this.$refs[this.ctnId].appendChild(this.component.$el);
63
71
  }
64
72
  },
65
73
  // 解析代码
@@ -77,8 +85,7 @@ export default {
77
85
  let code = this.options;
78
86
  const script = this.getSource(code, 'script').replace(/export default/, 'return ');
79
87
  const style = this.getSource(code, 'style');
80
- const template = '<div id="app">' + this.getSource(code, 'template') + '</div>';
81
-
88
+ const template = `<div id="${this.appId}">${this.getSource(code, 'template')}</div>`;
82
89
  this.js = script;
83
90
  this.css = style;
84
91
  this.html = template;
package/dev/dev/index.vue CHANGED
@@ -11,7 +11,8 @@
11
11
  </template>
12
12
 
13
13
  <script>
14
- import ComponentsPanel from './../ComponentsPanel'
14
+ // import ComponentsPanel from './../ComponentsPanel'
15
+ import ComponentsPanel from '@/components/ComponentsPanel'
15
16
  import CustomPanel from './../CustomPanel'
16
17
  import BackgroundPanel from './../BackgroundPanel'
17
18
  import OperatePanel from './../OperatePanel'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ap-dev",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
4
4
  "description": "===== ap-dev =====",
5
5
  "author": "xiexinbin",
6
6
  "email": "876818817@qq.com",