mooho-base-admin-plus 2.10.9 → 2.10.11

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mooho-base-admin-plus",
3
3
  "description": "MOOHO basic framework for admin by Vue3",
4
- "version": "2.10.9",
4
+ "version": "2.10.11",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -171,7 +171,7 @@
171
171
  </FormItem>
172
172
  </Col>
173
173
  <Col v-bind="grid8" v-if="data.controlType == 'DialogSelect' || data.controlType == 'MultiDialogSelect' || data.controlType == 'Table' || data.controlType == 'List'">
174
- <FormItem label="视图" key="dataViewSource" prop="dataViewSource">
174
+ <FormItem label="表格视图" key="dataViewSource" prop="dataViewSource">
175
175
  <dialog-select
176
176
  ref="dataViewSource"
177
177
  v-model="data.source"
@@ -227,8 +227,8 @@
227
227
  />
228
228
  </FormItem>
229
229
  </Col>
230
- <Col v-bind="grid8" v-if="data.controlType == 'Hyperlink'">
231
- <FormItem label="链接地址" key="hyperlink" prop="hyperlink">
230
+ <Col v-bind="grid16" v-if="data.controlType == 'Hyperlink'">
231
+ <FormItem label="链接地址模板(可插入属性)" key="hyperlink" prop="hyperlink">
232
232
  <Input type="text" v-model="data.hyperlink" maxlength="200" />
233
233
  </FormItem>
234
234
  </Col>
@@ -245,6 +245,23 @@
245
245
  />
246
246
  </FormItem>
247
247
  </Col>
248
+ <Col v-bind="grid8" v-if="data.controlType == 'ModalForm'">
249
+ <FormItem label="表单视图" key="dataViewSource" prop="dataViewSource">
250
+ <dialog-select
251
+ ref="dataViewSource"
252
+ v-model="data.source"
253
+ source="DataViewSelect"
254
+ source-data-code="code"
255
+ source-display-code="code"
256
+ :param="{ viewType: 'FormView' }"
257
+ ></dialog-select>
258
+ </FormItem>
259
+ </Col>
260
+ <Col v-bind="grid8" v-if="data.controlType == 'ModalForm'">
261
+ <FormItem label="链接文字模板(可插入属性)" key="description" prop="description">
262
+ <Input type="text" v-model="data.description" maxlength="200" />
263
+ </FormItem>
264
+ </Col>
248
265
  <Col v-bind="grid8">
249
266
  <FormItem label="是否显示" key="isShow" prop="isShow">
250
267
  <Switch
@@ -392,7 +409,7 @@
392
409
  </Dropdown>
393
410
  </FormItem>
394
411
  </Col>
395
- <Col v-bind="grid8" v-if="data.controlType != 'Description'">
412
+ <Col v-bind="grid8" v-if="data.controlType != 'Description' && data.controlType != 'ModalForm'">
396
413
  <FormItem label="描述" key="description" prop="description">
397
414
  <Input type="text" v-model="data.description" maxlength="200" />
398
415
  </FormItem>
@@ -179,6 +179,7 @@
179
179
  item.id == 'MultiDialogSelect' ||
180
180
  item.id == 'TreeSelect' ||
181
181
  item.id == 'MultiTreeSelect' ||
182
+ item.id == 'ModalForm' ||
182
183
  item.id == 'Radio' ||
183
184
  item.id == 'CheckGroup'
184
185
  ) {
@@ -156,17 +156,17 @@
156
156
  this.$refs.table.data.forEach(item => {
157
157
  let key = item.column;
158
158
 
159
- if ((item.operatorType = '大于')) {
159
+ if ((item.operatorType == '大于')) {
160
160
  key += '_g';
161
- } else if ((item.operatorType = '小于')) {
161
+ } else if ((item.operatorType == '小于')) {
162
162
  key += '_l';
163
- } else if ((item.operatorType = '大于等于')) {
163
+ } else if ((item.operatorType == '大于等于')) {
164
164
  key += '_ge';
165
- } else if ((item.operatorType = '小于等于')) {
165
+ } else if ((item.operatorType == '小于等于')) {
166
166
  key += '_le';
167
- } else if ((item.operatorType = '不等于')) {
167
+ } else if ((item.operatorType == '不等于')) {
168
168
  key += '_n';
169
- } else if ((item.operatorType = '文字包含')) {
169
+ } else if ((item.operatorType == '文字包含')) {
170
170
  key += '_c';
171
171
  }
172
172
 
@@ -64,6 +64,11 @@
64
64
  <span v-html="showData(data, column)"></span>
65
65
  </a>
66
66
  </template>
67
+ <template v-if="column.controlType === 'ModalForm'">
68
+ <a href="#">
69
+ <span v-html="getTemplateReplace(data, column.description)"></span>
70
+ </a>
71
+ </template>
67
72
  <template v-else-if="column.controlType === 'TextInput'">
68
73
  <Input
69
74
  type="text"
@@ -102,10 +102,16 @@
102
102
  <div v-html="showMultiLine(column.description)"></div>
103
103
  </template>
104
104
  <template v-if="column.controlType === 'Hyperlink'">
105
- <a :href="getHyperlink(data, column.hyperlink)" :target="column.isNewWindow ? '_blank' : ''">
105
+ <a :href="getTemplateReplace(data, column.hyperlink)" :target="column.isNewWindow ? '_blank' : ''">
106
106
  <span v-html="showData(data, column)"></span>
107
107
  </a>
108
108
  </template>
109
+ <template v-if="column.controlType === 'ModalForm'">
110
+ <a href="#" @click="openModalForm($refs['modalForm_' + column.code][0], parseData(data, column.code))">
111
+ <span v-html="getTemplateReplace(data, column.description)"></span>
112
+ </a>
113
+ <modal-form :ref="'modalForm_' + column.code" :view-code="column.source" :readonly="true"></modal-form>
114
+ </template>
109
115
  <template v-else-if="column.controlType === 'TextInput'">
110
116
  <Input
111
117
  type="text"
@@ -1723,6 +1729,17 @@
1723
1729
  item.needClear = true;
1724
1730
  });
1725
1731
  }
1732
+ },
1733
+ // 打开弹出表单
1734
+ async openModalForm(control, id) {
1735
+ let data;
1736
+ if (control.formView.isCustom) {
1737
+ data = await customModelApi.get(control.formView.model, id);
1738
+ } else {
1739
+ data = await modelApi.get(control.formView.model, id);
1740
+ }
1741
+
1742
+ control.open(data);
1726
1743
  }
1727
1744
  // // 打印
1728
1745
  // print() {
@@ -143,10 +143,15 @@
143
143
  </Tag>
144
144
  </template>
145
145
  <template v-else-if="column.controlType === 'Hyperlink'">
146
- <a :href="getHyperlink(rowData(row, index), column.hyperlink)" :target="column.isNewWindow ? '_blank' : ''">
146
+ <a :href="getTemplateReplace(rowData(row, index), column.hyperlink)" :target="column.isNewWindow ? '_blank' : ''">
147
147
  <span v-html="showData(rowData(row, index), column)"></span>
148
148
  </a>
149
149
  </template>
150
+ <template v-else-if="column.controlType === 'ModalForm'">
151
+ <a href="#" @click="openModalForm($refs['modalForm_' + column.code][0], parseData(rowData(row, index), column.code))">
152
+ <span v-html="getTemplateReplace(rowData(row, index), column.description)"></span>
153
+ </a>
154
+ </template>
150
155
  <template v-else-if="column.controlType === 'TextInput'">
151
156
  <Input
152
157
  type="text"
@@ -610,6 +615,12 @@
610
615
  <Button type="default" custom-icon="fa fa-times" @click="$refs.batchEditTable.close()">{{ $t('Front_Btn_Close') }}</Button>
611
616
  </template>
612
617
  </modal-table>
618
+ <modal-form
619
+ v-for="column in columns.filter(item => item.controlType == 'ModalForm')"
620
+ :ref="'modalForm_' + column.code"
621
+ :view-code="column.source"
622
+ :readonly="true"
623
+ ></modal-form>
613
624
  <Modal
614
625
  :title="$t('Front_Label_Preview')"
615
626
  v-model="preview"
@@ -2916,6 +2927,19 @@
2916
2927
  * 点击单元格时触发
2917
2928
  */
2918
2929
  this.$emit('on-cell-click', row, column, data, event);
2930
+ },
2931
+ // 打开弹出表单
2932
+ async openModalForm(control, id) {
2933
+ console.log('control', control);
2934
+
2935
+ let data;
2936
+ if (control.formView.isCustom) {
2937
+ data = await customModelApi.get(control.formView.model, id);
2938
+ } else {
2939
+ data = await modelApi.get(control.formView.model, id);
2940
+ }
2941
+
2942
+ control.open(data);
2919
2943
  }
2920
2944
  }
2921
2945
  };
@@ -1 +1 @@
1
- import{s as e}from"./lang.js";const t={i:{locale:"en-US",select:{placeholder:"Select",noMatch:"No matching data",loading:"Loading"},table:{noDataText:"No Data",noFilteredDataText:"No filter data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},datepicker:{selectDate:"Select date",selectTime:"Select time",startTime:"Start Time",endTime:"End Time",clear:"Clear",ok:"OK",datePanelLabel:"[mmmm] [yyyy]",month:"Month",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",year:"Year",weekStartDay:"0",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},months:{m1:"Jan",m2:"Feb",m3:"Mar",m4:"Apr",m5:"May",m6:"Jun",m7:"Jul",m8:"Aug",m9:"Sep",m10:"Oct",m11:"Nov",m12:"Dec"}},transfer:{titles:{source:"Source",target:"Target"},filterPlaceholder:"Search here",notFoundText:"Not Found"},modal:{okText:"OK",cancelText:"Cancel"},poptip:{okText:"OK",cancelText:"Cancel"},page:{prev:"Previous Page",next:"Next Page",total:"Total",item:"item",items:"items",prev5:"Previous 5 Pages",next5:"Next 5 Pages",page:"/page",goto:"Goto",p:""},rate:{star:"Star",stars:"Stars"},time:{before:" ago",after:" after",just:"just now",seconds:" seconds",minutes:" minutes",hours:" hours",days:" days"},tree:{emptyText:"No Data"}}};e(t);export{t as default};
1
+ import{s as e}from"./lang.js";const t={i:{locale:"en-US",select:{placeholder:"Select",noMatch:"No matching data",loading:"Loading"},table:{noDataText:"No Data",noFilteredDataText:"No filter data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},datepicker:{selectDate:"Select date",selectTime:"Select time",startTime:"Start Time",endTime:"End Time",clear:"Clear",ok:"OK",datePanelLabel:"[mmmm] [yyyy]",month:"Month",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",year:"Year",weekStartDay:"0",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},months:{m1:"Jan",m2:"Feb",m3:"Mar",m4:"Apr",m5:"May",m6:"Jun",m7:"Jul",m8:"Aug",m9:"Sep",m10:"Oct",m11:"Nov",m12:"Dec"}},transfer:{titles:{source:"Source",target:"Target"},filterPlaceholder:"Search here",notFoundText:"Not Found"},modal:{okText:"OK",cancelText:"Cancel"},poptip:{okText:"OK",cancelText:"Cancel"},page:{prev:"Previous Page",next:"Next Page",total:"Total",item:"item",items:"items",prev5:"Previous 5 Pages",next5:"Next 5 Pages",page:"/page",goto:"Goto",p:""},rate:{star:"Star",stars:"Stars"},time:{before:" ago",after:" after",just:"just now",seconds:" seconds",minutes:" minutes",hours:" hours",days:" days"},tree:{emptyText:"No Data"}}};e(t);export{t as default};
@@ -1 +1 @@
1
- const e=typeof window!="undefined";function n(i){e&&typeof window.viewuiplus!="undefined"&&("langs"in viewuiplus||(viewuiplus.langs={}),viewuiplus.langs[i.i.locale]=i)}export{n as s};
1
+ const e=typeof window!="undefined";function n(i){e&&typeof window.viewuiplus!="undefined"&&("langs"in viewuiplus||(viewuiplus.langs={}),viewuiplus.langs[i.i.locale]=i)}export{n as s};
@@ -1 +1 @@
1
- import{s as e}from"./lang.js";const t={i:{locale:"zh-CN",select:{placeholder:"\u8BF7\u9009\u62E9",noMatch:"\u65E0\u5339\u914D\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D"},table:{noDataText:"\u6682\u65E0\u6570\u636E",noFilteredDataText:"\u6682\u65E0\u7B5B\u9009\u7ED3\u679C",confirmFilter:"\u7B5B\u9009",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8BA1"},datepicker:{selectDate:"\u9009\u62E9\u65E5\u671F",selectTime:"\u9009\u62E9\u65F6\u95F4",startTime:"\u5F00\u59CB\u65F6\u95F4",endTime:"\u7ED3\u675F\u65F6\u95F4",clear:"\u6E05\u7A7A",ok:"\u786E\u5B9A",datePanelLabel:"[yyyy\u5E74] [m\u6708]",month:"\u6708",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",year:"\u5E74",weekStartDay:"0",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{m1:"1\u6708",m2:"2\u6708",m3:"3\u6708",m4:"4\u6708",m5:"5\u6708",m6:"6\u6708",m7:"7\u6708",m8:"8\u6708",m9:"9\u6708",m10:"10\u6708",m11:"11\u6708",m12:"12\u6708"}},transfer:{titles:{source:"\u6E90\u5217\u8868",target:"\u76EE\u7684\u5217\u8868"},filterPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",notFoundText:"\u5217\u8868\u4E3A\u7A7A"},modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},poptip:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},page:{prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875",total:"\u5171",item:"\u6761",items:"\u6761",prev5:"\u5411\u524D 5 \u9875",next5:"\u5411\u540E 5 \u9875",page:"\u6761/\u9875",goto:"\u8DF3\u81F3",p:"\u9875"},rate:{star:"\u661F",stars:"\u661F"},time:{before:"\u524D",after:"\u540E",just:"\u521A\u521A",seconds:"\u79D2",minutes:"\u5206\u949F",hours:"\u5C0F\u65F6",days:"\u5929"},tree:{emptyText:"\u6682\u65E0\u6570\u636E"}}};e(t);export{t as default};
1
+ import{s as e}from"./lang.js";const t={i:{locale:"zh-CN",select:{placeholder:"\u8BF7\u9009\u62E9",noMatch:"\u65E0\u5339\u914D\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D"},table:{noDataText:"\u6682\u65E0\u6570\u636E",noFilteredDataText:"\u6682\u65E0\u7B5B\u9009\u7ED3\u679C",confirmFilter:"\u7B5B\u9009",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8BA1"},datepicker:{selectDate:"\u9009\u62E9\u65E5\u671F",selectTime:"\u9009\u62E9\u65F6\u95F4",startTime:"\u5F00\u59CB\u65F6\u95F4",endTime:"\u7ED3\u675F\u65F6\u95F4",clear:"\u6E05\u7A7A",ok:"\u786E\u5B9A",datePanelLabel:"[yyyy\u5E74] [m\u6708]",month:"\u6708",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",year:"\u5E74",weekStartDay:"0",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{m1:"1\u6708",m2:"2\u6708",m3:"3\u6708",m4:"4\u6708",m5:"5\u6708",m6:"6\u6708",m7:"7\u6708",m8:"8\u6708",m9:"9\u6708",m10:"10\u6708",m11:"11\u6708",m12:"12\u6708"}},transfer:{titles:{source:"\u6E90\u5217\u8868",target:"\u76EE\u7684\u5217\u8868"},filterPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",notFoundText:"\u5217\u8868\u4E3A\u7A7A"},modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},poptip:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},page:{prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875",total:"\u5171",item:"\u6761",items:"\u6761",prev5:"\u5411\u524D 5 \u9875",next5:"\u5411\u540E 5 \u9875",page:"\u6761/\u9875",goto:"\u8DF3\u81F3",p:"\u9875"},rate:{star:"\u661F",stars:"\u661F"},time:{before:"\u524D",after:"\u540E",just:"\u521A\u521A",seconds:"\u79D2",minutes:"\u5206\u949F",hours:"\u5C0F\u65F6",days:"\u5929"},tree:{emptyText:"\u6682\u65E0\u6570\u636E"}}};e(t);export{t as default};
@@ -1,21 +1,21 @@
1
- import { findComponentUpward } from 'view-ui-plus/src/utils/assist';
2
- import { mapState } from 'vuex';
3
-
4
- export default {
5
- computed: {
6
- ...mapState('admin/layout', ['menuSiderReload', 'menuHeaderReload'])
7
- },
8
- methods: {
9
- handleClick(path, type = 'sider') {
10
- const current = this.$route.path;
11
- if (current === path) {
12
- if (type === 'sider' && this.menuSiderReload) this.handleReload();
13
- else if (type === 'header' && this.menuHeaderReload) this.handleReload();
14
- }
15
- },
16
- handleReload() {
17
- const $layout = findComponentUpward(this, 'BasicLayout');
18
- if ($layout) $layout.handleReload();
19
- }
20
- }
21
- };
1
+ import { findComponentUpward } from 'view-ui-plus/src/utils/assist';
2
+ import { mapState } from 'vuex';
3
+
4
+ export default {
5
+ computed: {
6
+ ...mapState('admin/layout', ['menuSiderReload', 'menuHeaderReload'])
7
+ },
8
+ methods: {
9
+ handleClick(path, type = 'sider') {
10
+ const current = this.$route.path;
11
+ if (current === path) {
12
+ if (type === 'sider' && this.menuSiderReload) this.handleReload();
13
+ else if (type === 'header' && this.menuHeaderReload) this.handleReload();
14
+ }
15
+ },
16
+ handleReload() {
17
+ const $layout = findComponentUpward(this, 'BasicLayout');
18
+ if ($layout) $layout.handleReload();
19
+ }
20
+ }
21
+ };
@@ -1,13 +1,13 @@
1
- import { mapState } from 'vuex';
2
-
3
- export default {
4
- computed: {
5
- ...mapState('admin/menu', ['siderMenuBadge']),
6
- badgeData() {
7
- let data = null;
8
- const siderMenuBadge = this.siderMenuBadge.find(item => item.path === this.menu.path);
9
- if (siderMenuBadge) data = siderMenuBadge;
10
- return data;
11
- }
12
- }
13
- };
1
+ import { mapState } from 'vuex';
2
+
3
+ export default {
4
+ computed: {
5
+ ...mapState('admin/menu', ['siderMenuBadge']),
6
+ badgeData() {
7
+ let data = null;
8
+ const siderMenuBadge = this.siderMenuBadge.find(item => item.path === this.menu.path);
9
+ if (siderMenuBadge) data = siderMenuBadge;
10
+ return data;
11
+ }
12
+ }
13
+ };
@@ -1,29 +1,29 @@
1
- <template>
2
- <div :style="styles" v-if="waterMark.show"></div>
3
- </template>
4
- <script>
5
- import { mapState } from 'vuex';
6
- import getWaterMarkCanvas from '../../../libs/water-mark';
7
-
8
- export default {
9
- name: 'i-water-mark',
10
- computed: {
11
- ...mapState('admin/layout', ['waterMark']),
12
- styles() {
13
- const url = getWaterMarkCanvas(this.waterMark.text, this.waterMark.options);
14
- return {
15
- width: '100%',
16
- height: '100%',
17
- position: 'absolute',
18
- top: '0',
19
- left: '0',
20
- 'z-index': '2000',
21
- 'background-size': '320px',
22
- 'background-repeat': 'repeat',
23
- 'background-image': `url(${url})`,
24
- 'pointer-events': 'none'
25
- };
26
- }
27
- }
28
- };
29
- </script>
1
+ <template>
2
+ <div :style="styles" v-if="waterMark.show"></div>
3
+ </template>
4
+ <script>
5
+ import { mapState } from 'vuex';
6
+ import getWaterMarkCanvas from '../../../libs/water-mark';
7
+
8
+ export default {
9
+ name: 'i-water-mark',
10
+ computed: {
11
+ ...mapState('admin/layout', ['waterMark']),
12
+ styles() {
13
+ const url = getWaterMarkCanvas(this.waterMark.text, this.waterMark.options);
14
+ return {
15
+ width: '100%',
16
+ height: '100%',
17
+ position: 'absolute',
18
+ top: '0',
19
+ left: '0',
20
+ 'z-index': '2000',
21
+ 'background-size': '320px',
22
+ 'background-repeat': 'repeat',
23
+ 'background-image': `url(${url})`,
24
+ 'pointer-events': 'none'
25
+ };
26
+ }
27
+ }
28
+ };
29
+ </script>
@@ -1,10 +1,10 @@
1
- // 生成随机字符串
2
- export default function (len = 32) {
3
- const $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
4
- const maxPos = $chars.length;
5
- let str = '';
6
- for (let i = 0; i < len; i++) {
7
- str += $chars.charAt(Math.floor(Math.random() * maxPos));
8
- }
9
- return str;
10
- }
1
+ // 生成随机字符串
2
+ export default function (len = 32) {
3
+ const $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
4
+ const maxPos = $chars.length;
5
+ let str = '';
6
+ for (let i = 0; i < len; i++) {
7
+ str += $chars.charAt(Math.floor(Math.random() * maxPos));
8
+ }
9
+ return str;
10
+ }
@@ -1,44 +1,44 @@
1
- /**
2
- * @description 生成水印
3
- * */
4
- export default function getWaterMarkCanvas(text, options) {
5
- const canvas = document.createElement('canvas');
6
- const ctx = canvas.getContext('2d');
7
- const canvasWidth = 400;
8
- const canvasHeight = 400;
9
- canvas.width = canvasWidth;
10
- canvas.height = canvasHeight;
11
- ctx.textAlign = 'center';
12
- ctx.textBaseline = 'bottom';
13
- ctx.globalAlpha = options.globalAlpha || 0.1;
14
- ctx.font = options.font || '20px Microsoft Yahei';
15
-
16
- ctx.translate(canvasWidth / 2, canvasHeight / 2);
17
- ctx.rotate(options.rotateAngle || -0.4);
18
-
19
- ctx.translate((-canvasWidth / 2) * 1.2, (-canvasHeight / 2) * 1.2);
20
-
21
- const waterMarkText = [];
22
- const chunkWidth = options.chunkWidth || 400;
23
- const chunkHeight = options.chunkHeight || 120;
24
- const horizontalChunkCount = 0;
25
- const verticalChunkCount = 1;
26
-
27
- for (let j = 0, initY = chunkHeight / 2, indent = 0; j <= verticalChunkCount; j += 1) {
28
- indent = parseInt(j % 2);
29
-
30
- for (let i = 0, initX = chunkWidth / 2; i <= horizontalChunkCount; i += 1) {
31
- waterMarkText.push({
32
- text,
33
- x: i * chunkWidth + indent * initX,
34
- y: j * chunkHeight + initY
35
- });
36
- }
37
- }
38
-
39
- waterMarkText.forEach(item => {
40
- ctx.fillText(item.text, item.x, item.y);
41
- });
42
-
43
- return ctx.canvas.toDataURL();
44
- }
1
+ /**
2
+ * @description 生成水印
3
+ * */
4
+ export default function getWaterMarkCanvas(text, options) {
5
+ const canvas = document.createElement('canvas');
6
+ const ctx = canvas.getContext('2d');
7
+ const canvasWidth = 400;
8
+ const canvasHeight = 400;
9
+ canvas.width = canvasWidth;
10
+ canvas.height = canvasHeight;
11
+ ctx.textAlign = 'center';
12
+ ctx.textBaseline = 'bottom';
13
+ ctx.globalAlpha = options.globalAlpha || 0.1;
14
+ ctx.font = options.font || '20px Microsoft Yahei';
15
+
16
+ ctx.translate(canvasWidth / 2, canvasHeight / 2);
17
+ ctx.rotate(options.rotateAngle || -0.4);
18
+
19
+ ctx.translate((-canvasWidth / 2) * 1.2, (-canvasHeight / 2) * 1.2);
20
+
21
+ const waterMarkText = [];
22
+ const chunkWidth = options.chunkWidth || 400;
23
+ const chunkHeight = options.chunkHeight || 120;
24
+ const horizontalChunkCount = 0;
25
+ const verticalChunkCount = 1;
26
+
27
+ for (let j = 0, initY = chunkHeight / 2, indent = 0; j <= verticalChunkCount; j += 1) {
28
+ indent = parseInt(j % 2);
29
+
30
+ for (let i = 0, initX = chunkWidth / 2; i <= horizontalChunkCount; i += 1) {
31
+ waterMarkText.push({
32
+ text,
33
+ x: i * chunkWidth + indent * initX,
34
+ y: j * chunkHeight + initY
35
+ });
36
+ }
37
+ }
38
+
39
+ waterMarkText.forEach(item => {
40
+ ctx.fillText(item.text, item.x, item.y);
41
+ });
42
+
43
+ return ctx.canvas.toDataURL();
44
+ }
@@ -771,17 +771,24 @@ export default {
771
771
  return swal;
772
772
  }
773
773
  },
774
- // 获取超链接
775
- getHyperlink(data, hyperlink) {
776
- while (hyperlink.indexOf('{') >= 0) {
777
- let start = hyperlink.indexOf('{');
778
- let end = hyperlink.indexOf('}');
779
- let expression = hyperlink.substring(start + 1, end);
774
+ // 文本模板替换
775
+ getTemplateReplace(data, template) {
776
+ let text = template;
777
+ while (text.indexOf('{') >= 0) {
778
+ let start = text.indexOf('{');
779
+ let end = text.indexOf('}');
780
+ let expression = text.substring(start + 1, end);
781
+
782
+ let value = this.parseData(data, expression);
783
+
784
+ if (value == null) {
785
+ value = '';
786
+ }
780
787
 
781
- hyperlink = hyperlink.substring(0, start) + this.parseData(data, expression) + hyperlink.substring(end + 1);
788
+ text = text.substring(0, start) + value + text.substring(end + 1);
782
789
  }
783
790
 
784
- return hyperlink;
791
+ return text;
785
792
  },
786
793
  // 保留小数
787
794
  keepDecimal(num, digit, fixedDigit) {
@@ -1,47 +1,47 @@
1
- #app, body, html{
2
- height: 100%;
3
- }
4
- body{
5
- background-color: @background-color-base;
6
- font-size: 14px;
7
- }
8
-
9
- // 隐藏滚动条样式
10
- .i-scrollbar-hide{
11
- &::-webkit-scrollbar{
12
- width: 0;
13
- }
14
- &::-webkit-scrollbar-track{
15
- background-color: transparent;
16
- }
17
- &::-webkit-scrollbar-thumb{
18
- background: #e8eaec;
19
- }
20
- }
21
-
22
- // 极简滚动条样式
23
- .i-scrollbar{
24
- &::-webkit-scrollbar{
25
- width: 6px;
26
- }
27
- &::-webkit-scrollbar-track{
28
- background-color: transparent;
29
- }
30
- &::-webkit-scrollbar-thumb{
31
- background: #808695;
32
- border-radius: 4px;
33
- }
34
- }
35
-
36
- // 去除 Table 的左右边框,更精简
37
- .i-table-no-border{
38
- .ivu-table th{
39
- background-color: #fff;
40
- }
41
- .ivu-table-wrapper, .ivu-table tr:last-child td{
42
- border: none;
43
- }
44
- .ivu-table:before, .ivu-table:after{
45
- display: none;
46
- }
47
- }
1
+ #app, body, html{
2
+ height: 100%;
3
+ }
4
+ body{
5
+ background-color: @background-color-base;
6
+ font-size: 14px;
7
+ }
8
+
9
+ // 隐藏滚动条样式
10
+ .i-scrollbar-hide{
11
+ &::-webkit-scrollbar{
12
+ width: 0;
13
+ }
14
+ &::-webkit-scrollbar-track{
15
+ background-color: transparent;
16
+ }
17
+ &::-webkit-scrollbar-thumb{
18
+ background: #e8eaec;
19
+ }
20
+ }
21
+
22
+ // 极简滚动条样式
23
+ .i-scrollbar{
24
+ &::-webkit-scrollbar{
25
+ width: 6px;
26
+ }
27
+ &::-webkit-scrollbar-track{
28
+ background-color: transparent;
29
+ }
30
+ &::-webkit-scrollbar-thumb{
31
+ background: #808695;
32
+ border-radius: 4px;
33
+ }
34
+ }
35
+
36
+ // 去除 Table 的左右边框,更精简
37
+ .i-table-no-border{
38
+ .ivu-table th{
39
+ background-color: #fff;
40
+ }
41
+ .ivu-table-wrapper, .ivu-table tr:last-child td{
42
+ border: none;
43
+ }
44
+ .ivu-table:before, .ivu-table:after{
45
+ display: none;
46
+ }
47
+ }
@@ -1,6 +1,6 @@
1
- // 自定义主题
2
- // 详见 https://www.iviewui.com/docs/guide/theme
3
- @import 'view-ui-plus/src/styles/index.less';
4
-
5
- @menu-dark-title: #191a23;
6
- @menu-dark-active-bg: #101117;
1
+ // 自定义主题
2
+ // 详见 https://www.iviewui.com/docs/guide/theme
3
+ @import 'view-ui-plus/src/styles/index.less';
4
+
5
+ @menu-dark-title: #191a23;
6
+ @menu-dark-active-bg: #101117;