Bladeren bron

新增表格设计器 标题

余思翰 1 jaar geleden
bovenliggende
commit
b1d5cdf300

+ 2
- 2
oa-ui/package.json Bestand weergeven

@@ -39,15 +39,15 @@
39 39
     "@riophae/vue-treeselect": "0.4.0",
40 40
     "axios": "0.24.0",
41 41
     "bpmn-js": "^11.1.0",
42
-    "bpmnlint": "^6.4.0",
43 42
     "bpmn-js-bpmnlint": "^0.15.0",
43
+    "bpmnlint": "^6.4.0",
44 44
     "bpmnlint-loader": "^0.1.4",
45
-    "file-drops": "^0.4.0",
46 45
     "clipboard": "2.0.8",
47 46
     "core-js": "3.25.3",
48 47
     "diagram-js": "^11.4.1",
49 48
     "echarts": "5.4.0",
50 49
     "element-ui": "2.15.14",
50
+    "file-drops": "^0.4.0",
51 51
     "file-saver": "2.0.5",
52 52
     "fuse.js": "6.4.3",
53 53
     "highlight.js": "9.18.5",

+ 7
- 1
oa-ui/src/assets/styles/element-ui.scss Bestand weergeven

@@ -89,4 +89,10 @@
89 89
   > .el-submenu__title
90 90
   .el-submenu__icon-arrow {
91 91
   display: none;
92
-}
92
+}
93
+// .el-form-item{
94
+//   margin-bottom: 10px;
95
+// }
96
+// .el-form-item--small.el-form-item{
97
+//   margin-bottom: 10px;
98
+// }

+ 44
- 0
oa-ui/src/components/RowTitle/index.vue Bestand weergeven

@@ -0,0 +1,44 @@
1
+<!--
2
+ * @Author: ysh
3
+ * @Date: 2024-01-10 17:10:54
4
+ * @LastEditors: 
5
+ * @LastEditTime: 2024-01-10 17:11:15
6
+-->
7
+<template>
8
+  <div ref="rowTitle" v-text="rowTitleText" :style="setStyle()"></div>
9
+</template>
10
+
11
+<script>
12
+export default {
13
+  name: "",
14
+  data() {
15
+    return {};
16
+  },
17
+  computed: {
18
+    rowTitleText() {
19
+      return this.$attrs.titleText
20
+    },
21
+  },
22
+  watch: {
23
+    $attrs: {
24
+      deep: true,
25
+      handler(val) {
26
+        this.setStyle()
27
+      }
28
+    },
29
+  },
30
+  methods: {
31
+    setStyle() {
32
+      let obj = {
33
+        color: this.$attrs.fontColor,
34
+        fontSize: this.$attrs.fontSize + 'px',
35
+        fontWeight: this.$attrs.fontWeight ? 600 : 400,
36
+        textAlign: this.$attrs.textAlign,
37
+      }
38
+      return obj
39
+    }
40
+  },
41
+};
42
+</script>
43
+
44
+<style lang="scss" scoped></style>

+ 32
- 4
oa-ui/src/components/parser/Parser.vue Bestand weergeven

@@ -34,9 +34,10 @@ const layouts = {
34 34
     let child = renderChildren.apply(this, arguments)
35 35
     if (scheme.type === 'flex') {
36 36
       child = <el-row type={scheme.type} justify={scheme.justify} align={scheme.align}>
37
-              {child}
38
-            </el-row>
37
+        {child}
38
+      </el-row>
39 39
     }
40
+    console.log(child);
40 41
     return (
41 42
       <el-col span={scheme.span}>
42 43
         <el-row gutter={scheme.gutter}>
@@ -44,6 +45,23 @@ const layouts = {
44 45
         </el-row>
45 46
       </el-col>
46 47
     )
48
+  },
49
+  showFormItem(h, scheme) {
50
+    const { activeItem } = this.$listeners
51
+    const config = scheme.__config__
52
+    const className = this.activeId === config.formId
53
+      ? 'drawing-row-item active-from-item'
54
+      : 'drawing-row-item'
55
+    const spanText = 'row' + config.formId
56
+    return (
57
+      <el-col span={config.span}>
58
+        <el-row>
59
+          <h1>
60
+            <render key={config.renderKey} conf={scheme} onInput={event => { this.$set(config, 'defaultValue', event) }}></render>
61
+          </h1>
62
+        </el-row>
63
+      </el-col>
64
+    )
47 65
   }
48 66
 }
49 67
 
@@ -64,6 +82,7 @@ function renderFrom(h) {
64 82
       >
65 83
         {renderFormItem.call(this, h, formConfCopy.fields)}
66 84
         {formConfCopy.formBtns && formBtns.call(this, h)}
85
+
67 86
       </el-form>
68 87
     </el-row>
69 88
   )
@@ -83,7 +102,7 @@ function renderFormItem(h, elementList) {
83 102
     return elementList.map(scheme => {
84 103
       const config = scheme.__config__
85 104
       const layout = layouts[config.layout]
86
-
105
+      debugger
87 106
       if (layout) {
88 107
         return layout.call(this, h, scheme)
89 108
       }
@@ -245,7 +264,7 @@ export default {
245 264
       })
246 265
     },
247 266
     // 传值给父组件
248
-    getData(){
267
+    getData() {
249 268
       this.$emit('getData', this[this.formConf.formModel])
250 269
       // this.$emit('getData',this.formConfCopy)
251 270
     }
@@ -255,3 +274,12 @@ export default {
255 274
   }
256 275
 }
257 276
 </script>
277
+<style scoped>
278
+::v-deep.el-form-item {
279
+  margin-bottom: 10px;
280
+}
281
+
282
+::v-deep.el-form-item--small.el-form-item {
283
+  margin-bottom: 10px;
284
+}
285
+</style>

+ 2
- 2
oa-ui/src/components/parser/example/Index.vue Bestand weergeven

@@ -318,7 +318,7 @@ export default {
318 318
 <style lang="scss" scoped>
319 319
 .test-form {
320 320
   margin: 15px auto;
321
-  width: 800px;
322
-  padding: 15px;
321
+  // width: 800px;
322
+  padding: 20px;
323 323
 }
324 324
 </style>

+ 10
- 1
oa-ui/src/main.js Bestand weergeven

@@ -1,3 +1,9 @@
1
+/*
2
+ * @Author: ysh
3
+ * @Date: 2024-01-03 09:23:11
4
+ * @LastEditors: Please set LastEditors
5
+ * @LastEditTime: 2024-01-10 17:11:57
6
+ */
1 7
 import Vue from 'vue'
2 8
 
3 9
 import Cookies from 'js-cookie'
@@ -19,6 +25,9 @@ import './permission' // permission control
19 25
 import { getDicts } from "@/api/system/dict/data";
20 26
 import { getConfigKey } from "@/api/system/config";
21 27
 import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
28
+// 标题组件
29
+import RowTitle from '@/components/RowTitle'
30
+
22 31
 // 分页组件
23 32
 import Pagination from "@/components/Pagination";
24 33
 // 自定义表格工具组件
@@ -63,6 +72,7 @@ Vue.component('FileUpload', FileUpload)
63 72
 Vue.component('ImageUpload', ImageUpload)
64 73
 Vue.component('ImagePreview', ImagePreview)
65 74
 Vue.component('tinymce', Tinymce)
75
+Vue.component('RowTitle', RowTitle)
66 76
 
67 77
 Vue.use(directive)
68 78
 Vue.use(plugins)
@@ -81,7 +91,6 @@ DictData.install()
81 91
 Vue.use(Element, {
82 92
   size: Cookies.get('size') || 'medium' // set element-ui default size
83 93
 })
84
-
85 94
 Vue.config.productionTip = false
86 95
 
87 96
 new Vue({

+ 100
- 80
oa-ui/src/utils/generator/config.js Bestand weergeven

@@ -546,84 +546,104 @@ export const layoutComponents = [
546 546
     circle: false,
547 547
     disabled: false
548 548
   },
549
-  // {
550
-  //   __config__: {
551
-  //     layout: 'colFormItem',
552
-  //     tagIcon: 'table',
553
-  //     tag: 'el-table',
554
-  //     document: 'https://element.eleme.cn/#/zh-CN/component/table',
555
-  //     span: 24,
556
-  //     formId: 101,
557
-  //     renderKey: 1595761764203,
558
-  //     componentName: 'row101',
559
-  //     showLabel: true,
560
-  //     changeTag: true,
561
-  //     labelWidth: null,
562
-  //     label: '表格[开发中]',
563
-  //     dataType: 'dynamic',
564
-  //     method: 'get',
565
-  //     dataPath: 'list',
566
-  //     dataConsumer: 'data',
567
-  //     url: 'https://www.fastmock.site/mock/f8d7a54fb1e60561e2f720d5a810009d/fg/tableData',
568
-  //     children: [{
569
-  //       __config__: {
570
-  //         layout: 'raw',
571
-  //         tag: 'el-table-column',
572
-  //         renderKey: 15957617660153
573
-  //       },
574
-  //       prop: 'date',
575
-  //       label: '日期'
576
-  //     }, {
577
-  //       __config__: {
578
-  //         layout: 'raw',
579
-  //         tag: 'el-table-column',
580
-  //         renderKey: 15957617660152
581
-  //       },
582
-  //       prop: 'address',
583
-  //       label: '地址'
584
-  //     }, {
585
-  //       __config__: {
586
-  //         layout: 'raw',
587
-  //         tag: 'el-table-column',
588
-  //         renderKey: 15957617660151
589
-  //       },
590
-  //       prop: 'name',
591
-  //       label: '名称'
592
-  //     }, {
593
-  //       __config__: {
594
-  //         layout: 'raw',
595
-  //         tag: 'el-table-column',
596
-  //         renderKey: 1595774496335,
597
-  //         children: [
598
-  //           {
599
-  //             __config__: {
600
-  //               label: '按钮',
601
-  //               tag: 'el-button',
602
-  //               tagIcon: 'button',
603
-  //               layout: 'raw',
604
-  //               renderKey: 1595779809901
605
-  //             },
606
-  //             __slot__: {
607
-  //               default: '主要按钮'
608
-  //             },
609
-  //             type: 'primary',
610
-  //             icon: 'el-icon-search',
611
-  //             round: false,
612
-  //             size: 'medium'
613
-  //           }
614
-  //         ]
615
-  //       },
616
-  //       label: '操作'
617
-  //     }]
618
-  //   },
619
-  //   data: [],
620
-  //   directives: [{
621
-  //     name: 'loading',
622
-  //     value: true
623
-  //   }],
624
-  //   border: true,
625
-  //   type: 'default',
626
-  //   justify: 'start',
627
-  //   align: 'top'
628
-  // }
549
+  {
550
+    __config__: {
551
+      layout: 'colFormItem',
552
+      tagIcon: 'table',
553
+      tag: 'el-table',
554
+      document: 'https://element.eleme.cn/#/zh-CN/component/table',
555
+      span: 24,
556
+      formId: 101,
557
+      renderKey: 1595761764203,
558
+      componentName: 'row101',
559
+      showLabel: true,
560
+      changeTag: true,
561
+      labelWidth: null,
562
+      label: '表格[开发中]',
563
+      dataType: 'dynamic',
564
+      method: 'get',
565
+      dataPath: 'list',
566
+      dataConsumer: 'data',
567
+      // url: 'https://www.fastmock.site/mock/f8d7a54fb1e60561e2f720d5a810009d/fg/tableData',
568
+      children: [{
569
+        __config__: {
570
+          layout: 'raw',
571
+          tag: 'el-table-column',
572
+          renderKey: 15957617660153
573
+        },
574
+        prop: 'date',
575
+        label: '日期'
576
+      }, {
577
+        __config__: {
578
+          layout: 'raw',
579
+          tag: 'el-table-column',
580
+          renderKey: 15957617660152
581
+        },
582
+        prop: 'address',
583
+        label: '地址'
584
+      }, {
585
+        __config__: {
586
+          layout: 'raw',
587
+          tag: 'el-table-column',
588
+          renderKey: 15957617660151
589
+        },
590
+        prop: 'name',
591
+        label: '名称'
592
+      }, 
593
+      // {
594
+      //   __config__: {
595
+      //     layout: 'raw',
596
+      //     tag: 'el-table-column',
597
+      //     renderKey: 1595774496335,
598
+      //     children: [
599
+      //       {
600
+      //         __config__: {
601
+      //           label: '按钮',
602
+      //           tag: 'el-button',
603
+      //           tagIcon: 'button',
604
+      //           layout: 'raw',
605
+      //           renderKey: 1595779809901
606
+      //         },
607
+      //         __slot__: {
608
+      //           default: '主要按钮'
609
+      //         },
610
+      //         type: 'primary',
611
+      //         icon: 'el-icon-search',
612
+      //         round: false,
613
+      //         size: 'medium'
614
+      //       }
615
+      //     ]
616
+      //   },
617
+      //   label: '操作'
618
+      // }
619
+    ]
620
+    },
621
+    data: [],
622
+    directives: [{
623
+      name: 'loading',
624
+      value: false
625
+    }],
626
+    border: true,
627
+    type: 'default',
628
+    justify: 'start',
629
+    align: 'top'
630
+  }
629 631
 ]
632
+
633
+// 展示组件
634
+export const showComponents = [
635
+  {
636
+    __config__: {
637
+      layout: 'showFormItem',
638
+      tag: 'row-title',
639
+      tagIcon: 'row',
640
+      label: '标题容器',
641
+      document: 'https://element.eleme.cn/#/zh-CN/component/layout#row-attributes'
642
+    },
643
+    titleText: '标题',
644
+    fontSize: 20,
645
+    fontColor: '#606266',
646
+    fontWeight: false,
647
+    textAlign: 'left',
648
+  },
649
+]

+ 12
- 0
oa-ui/src/utils/generator/html.js Bestand weergeven

@@ -110,6 +110,15 @@ const layouts = {
110 110
     </el-row>`
111 111
     str = colWrapper(scheme, str)
112 112
     return str
113
+  },
114
+  showFormItem(scheme) {
115
+    const config = scheme.__config__
116
+    const tagDom = tags[config.tag] ? tags[config.tag](scheme) : null
117
+    let str = `<el-row>
118
+      ${tagDom}
119
+    </el-row>`
120
+    str = colWrapper(scheme, str)
121
+    return str
113 122
   }
114 123
 }
115 124
 
@@ -290,6 +299,9 @@ const tags = {
290 299
     const height = el.height ? `:height="${el.height}"` : ''
291 300
     const branding = el.branding ? `:branding="${el.branding}"` : ''
292 301
     return `<${tag} ${vModel} ${placeholder} ${height} ${branding}></${tag}>`
302
+  },
303
+  'row-title': el => {
304
+    return `<h1 style="font-size: ${el.fontSize}px;color: ${el.fontColor};font-weight: ${el.fontWeight ? 600 : 400};text-align: ${el.textAlign};">${el.titleText}</h1>`
293 305
   }
294 306
 }
295 307
 

+ 2
- 2
oa-ui/src/views/flowable/task/finished/detail/index.vue Bestand weergeven

@@ -183,8 +183,8 @@ export default {
183 183
 <style lang="scss" scoped>
184 184
 .test-form {
185 185
   margin: 15px auto;
186
-  width: 800px;
187
-  padding: 15px;
186
+  // width: 800px;
187
+  padding: 20px;
188 188
 }
189 189
 
190 190
 .clearfix:before,

+ 3
- 2
oa-ui/src/views/flowable/task/form/index.vue Bestand weergeven

@@ -227,6 +227,7 @@ export default {
227 227
     /** 表单配置信息 */
228 228
     handleDetail(row){
229 229
       this.formConfOpen = true;
230
+      console.log(JSON.parse(row.formContent));
230 231
       this.formTitle = "流程表单配置详细";
231 232
       this.formConf = JSON.parse(row.formContent)
232 233
     },
@@ -302,7 +303,7 @@ export default {
302 303
 <style lang="scss" scoped>
303 304
 .test-form {
304 305
   margin: 15px auto;
305
-  width: 800px;
306
-  padding: 15px;
306
+  // width: 800px;
307
+  padding: 20px;
307 308
 }
308 309
 </style>

+ 2
- 2
oa-ui/src/views/flowable/task/myProcess/detail/index.vue Bestand weergeven

@@ -193,8 +193,8 @@ export default {
193 193
 <style lang="scss" scoped>
194 194
 .test-form {
195 195
   margin: 15px auto;
196
-  width: 800px;
197
-  padding: 15px;
196
+  // width: 800px;
197
+  padding: 20px;
198 198
 }
199 199
 
200 200
 .clearfix:before,

+ 2
- 2
oa-ui/src/views/flowable/task/myProcess/send/index.vue Bestand weergeven

@@ -261,8 +261,8 @@ export default {
261 261
 <style lang="scss" scoped>
262 262
 .test-form {
263 263
   margin: 15px auto;
264
-  width: 800px;
265
-  padding: 15px;
264
+  // width: 800px;
265
+  padding: 20px;
266 266
 }
267 267
 
268 268
 .clearfix:before,

+ 2
- 2
oa-ui/src/views/flowable/task/record/index.vue Bestand weergeven

@@ -579,8 +579,8 @@ export default {
579 579
 <style lang="scss" scoped>
580 580
 .test-form {
581 581
   margin: 15px auto;
582
-  width: 800px;
583
-  padding: 15px;
582
+  // width: 800px;
583
+  padding: 20px;
584 584
 }
585 585
 
586 586
 .clearfix:before,

+ 6
- 2
oa-ui/src/views/flowable/task/todo/detail/index.vue Bestand weergeven

@@ -87,6 +87,9 @@
87 87
             <flow-user v-if="checkSendUser" :checkType="checkType" @handleUserSelect="handleUserSelect"></flow-user>
88 88
             <flow-role v-if="checkSendRole" @handleRoleSelect="handleRoleSelect"></flow-role>
89 89
           </el-form-item>
90
+          <el-form-item label="熟练程度" label-width="80px" prop="comment">
91
+            <el-checkbox v-model="taskForm.check">备选项</el-checkbox>
92
+          </el-form-item>
90 93
           <el-form-item label="处理意见" label-width="80px" prop="comment"
91 94
                         :rules="[{ required: true, message: '请输入处理意见', trigger: 'blur' }]">
92 95
             <el-input type="textarea" v-model="taskForm.comment" placeholder="请输入处理意见"/>
@@ -205,6 +208,7 @@ export default {
205 208
         variables: {
206 209
           variables: {}
207 210
         },
211
+        check:true
208 212
       },
209 213
       assignee: null,
210 214
       formConf: {}, // 默认表单数据
@@ -477,8 +481,8 @@ export default {
477 481
 <style lang="scss" scoped>
478 482
 .test-form {
479 483
   margin: 15px auto;
480
-  width: 800px;
481
-  padding: 15px;
484
+  // width: 800px;
485
+  padding: 20px;
482 486
 }
483 487
 
484 488
 .clearfix:before,

+ 3
- 3
oa-ui/src/views/login.vue Bestand weergeven

@@ -23,7 +23,7 @@
23 23
           <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
24 24
         </el-input>
25 25
       </el-form-item>
26
-      <el-form-item prop="code" v-if="captchaEnabled">
26
+      <!-- <el-form-item prop="code" v-if="captchaEnabled">
27 27
         <el-input
28 28
           v-model="loginForm.code"
29 29
           auto-complete="off"
@@ -36,7 +36,7 @@
36 36
         <div class="login-code">
37 37
           <img :src="codeUrl" @click="getCode" class="login-code-img"/>
38 38
         </div>
39
-      </el-form-item>
39
+      </el-form-item> -->
40 40
       <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
41 41
       <el-form-item style="width:100%;">
42 42
         <el-button
@@ -104,7 +104,7 @@ export default {
104 104
     }
105 105
   },
106 106
   created() {
107
-    this.getCode();
107
+    // this.getCode();
108 108
     this.getCookie();
109 109
   },
110 110
   methods: {

+ 20
- 0
oa-ui/src/views/tool/build/DraggableItem.vue Bestand weergeven

@@ -69,6 +69,26 @@ const layouts = {
69 69
       </el-col>
70 70
     )
71 71
   },
72
+  showFormItem(h, currentItem, index, list) {
73
+    const { activeItem } = this.$listeners
74
+    const config = currentItem.__config__
75
+    const className = this.activeId === config.formId
76
+      ? 'drawing-row-item active-from-item'
77
+      : 'drawing-row-item'
78
+    const spanText = 'row'+config.formId
79
+    return (
80
+      <el-col span={config.span}>
81
+        <el-row gutter={config.gutter} class={className}
82
+          nativeOnClick={event => { activeItem(currentItem); event.stopPropagation() }}>
83
+          <span class="component-name">{spanText}</span>
84
+          <h1>
85
+            <render key={config.renderKey} conf={currentItem} onInput={ event => { this.$set(config, 'defaultValue', event) }}></render>
86
+          </h1>
87
+          {components.itemBtns.apply(this, arguments)}
88
+        </el-row>
89
+      </el-col>
90
+    )
91
+  },
72 92
   raw(h, currentItem, index, list) {
73 93
     const config = currentItem.__config__
74 94
     const child = renderChildren.apply(this, arguments)

+ 27
- 0
oa-ui/src/views/tool/build/RightPanel.vue Bestand weergeven

@@ -302,6 +302,33 @@
302 302
               @input="setTimeValue($event)"
303 303
             />
304 304
           </el-form-item>
305
+          <!-- 标题文字 -->
306
+          <el-form-item v-if="activeData.__config__.tag === 'row-title'" label="标题文字">
307
+            <el-input v-model="activeData.titleText" placeholder="请输入标题文字" />
308
+          </el-form-item>
309
+          <el-form-item v-if="activeData.__config__.tag === 'row-title'" label="标题大小">
310
+            <el-input v-model.number="activeData.fontSize" type="number" placeholder="请输入标题文字大小" />
311
+          </el-form-item>
312
+          <el-form-item v-if="activeData.__config__.tag === 'row-title'" label="标题颜色">
313
+            <el-color-picker v-model="activeData.fontColor" />
314
+          </el-form-item>
315
+          <el-form-item v-if="activeData.__config__.tag === 'row-title'" label="是否加粗">
316
+            <el-switch v-model="activeData.fontWeight" />
317
+          </el-form-item>
318
+          <el-form-item v-if="activeData.__config__.tag === 'row-title'" label="对齐方式">
319
+            <el-radio-group v-model="activeData.textAlign">
320
+              <el-radio-button label="left">
321
+                居左
322
+              </el-radio-button>
323
+              <el-radio-button label="center">
324
+                居中
325
+              </el-radio-button>
326
+              <el-radio-button label="right">
327
+                居右
328
+              </el-radio-button>
329
+            </el-radio-group>
330
+          </el-form-item>
331
+
305 332
           <template v-if="['el-checkbox-group', 'el-radio-group', 'el-select'].indexOf(activeData.__config__.tag) > -1">
306 333
             <el-divider>选项</el-divider>
307 334
             <draggable

+ 7
- 2
oa-ui/src/views/tool/build/index.vue Bestand weergeven

@@ -145,7 +145,7 @@ import FormDrawer from './FormDrawer'
145 145
 import JsonDrawer from './JsonDrawer'
146 146
 import RightPanel from './RightPanel'
147 147
 import {
148
-  inputComponents, selectComponents, layoutComponents, formConf
148
+  inputComponents, selectComponents, layoutComponents, formConf, showComponents
149 149
 } from '@/utils/generator/config'
150 150
 import {
151 151
   exportDefault, beautifierConf, isNumberStr, titleCase, deepClone, isObjectObject
@@ -191,6 +191,7 @@ export default {
191 191
       inputComponents,
192 192
       selectComponents,
193 193
       layoutComponents,
194
+      showComponents, 
194 195
       labelWidth: 100,
195 196
       drawingList: drawingDefault,
196 197
       drawingData: {},
@@ -216,7 +217,10 @@ export default {
216 217
         {
217 218
           title: '布局型组件',
218 219
           list: layoutComponents
219
-        }
220
+        },{
221
+          title: "展示型组件",						// 这里也要新增
222
+          list: showComponents,
223
+        },
220 224
       ],
221 225
       formOpen: false,
222 226
       formTitle: "",
@@ -333,6 +337,7 @@ export default {
333 337
       if (i > -1) this.$set(this.drawingList, i, component)
334 338
     },
335 339
     fetchData(component) {
340
+      debugger
336 341
       const { dataType, method, url } = component.__config__
337 342
       if (dataType === 'dynamic' && method && url) {
338 343
         this.setLoading(component, true)

Laden…
Annuleren
Opslaan