vue2-client 1.9.141 → 1.9.142

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,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.9.141",
3
+ "version": "1.9.142",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -1,3 +1,3 @@
1
- import XReport from './XReport'
2
-
3
- export default XReport
1
+ import XReport from './XReport'
2
+
3
+ export default XReport
@@ -4,7 +4,7 @@
4
4
  <XReport
5
5
  ref="main"
6
6
  :use-oss-for-img="false"
7
- config-name="templateManageView2"
7
+ config-name="medicalRecordView"
8
8
  server-name="af-his"
9
9
  :show-img-in-cell="true"
10
10
  :display-only="true"
@@ -3,20 +3,39 @@
3
3
  <div v-show="ready">
4
4
  <a-row class="editor-action-container" type="flex" justify="space-between">
5
5
  <a-col class="editor-tools">
6
- <a-radio-group
7
- v-show="showModeChoose"
8
- button-style="solid"
9
- @change="changeMode"
10
- v-model="modeType">
11
- <a-radio-button v-for="item of modeList" :key="item.value" :value="item.value">
12
- {{ item.label }}
13
- </a-radio-button>
14
- </a-radio-group>
6
+ <a-space>
7
+ <template v-if="resList.length > 0">
8
+ <a-select
9
+ style="width: 200px"
10
+ v-model="toggleResId"
11
+ placeholder="请选择文档"
12
+ show-search
13
+ @change="changeRes"
14
+ >
15
+ <a-select-option v-for="item of resListCp" :key="item.value" :value="item.value">{{ item.label }}</a-select-option>
16
+ </a-select>
17
+ <template v-if="this.modeType !== 'readonly' && this.resId !== -1">
18
+ <a-button icon="plus" @click="addRes"/>
19
+ </template>
20
+ </template>
21
+ <a-radio-group
22
+ v-show="showModeChoose"
23
+ button-style="solid"
24
+ @change="changeMode"
25
+ v-model="modeType">
26
+ <a-radio-button v-for="item of modeList" :key="item.value" :value="item.value">
27
+ {{ item.label }}
28
+ </a-radio-button>
29
+ </a-radio-group>
30
+ </a-space>
15
31
  </a-col>
16
32
  <a-col class="editor-action">
17
33
  <a-space>
18
34
  <template v-if="this.modeType !== 'readonly'">
19
- <a-button type="primary" @click="save">
35
+ <a-button type="primary" @click="openRenameModal" v-if="this.resId !== -1">
36
+ 重命名
37
+ </a-button>
38
+ <a-button type="primary" @click="() => this.resId !== -1 ? save() : openAddResModal()">
20
39
  保存
21
40
  </a-button>
22
41
  </template>
@@ -51,19 +70,46 @@
51
70
  <div v-show="!ready">
52
71
  <a-empty description="请选择文书" />
53
72
  </div>
54
- </div>
73
+ <a-modal
74
+ :destroyOnClose="true"
75
+ :title="this.resDataModalMode === 'modify' ? '修改文档' : '新建文档'"
76
+ :visible="resDataModalVisible"
77
+ okText="提交"
78
+ @cancel="resDataModalVisible = false"
79
+ @ok="onSubmit">
80
+ <a-form-model ref="resModifyForm" :model="modifyResModel" :rules="resRules">
81
+ <a-form-model-item prop="f_file_name" label="文档名">
82
+ <a-input v-model="modifyResModel.f_file_name" placeholder="请输入文档名"/>
83
+ </a-form-model-item>
84
+ </a-form-model>
85
+ </a-modal></div>
55
86
  </template>
56
87
 
57
88
  <script>
58
89
 
59
90
  import { runLogic } from '@vue2-client/services/api/common'
91
+ import XAddNativeForm from '@/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'
60
92
 
61
93
  export default {
62
94
  name: 'XHisEditor',
95
+ components: { XAddNativeForm },
96
+ computed: {
97
+ resListCp () {
98
+ const list = this.resList
99
+ if (this.resId === -1) {
100
+ list.push({
101
+ label: '未保存文档*', value: -1
102
+ })
103
+ }
104
+ return list
105
+ }
106
+ },
63
107
  data () {
64
108
  return {
65
109
  ready: false,
66
110
  loading: false,
111
+ resDataModalMode: 'modify',
112
+ resDataModalVisible: false,
67
113
  objectOfAttrs: {
68
114
  width: '100%',
69
115
  height: '650vh',
@@ -79,6 +125,10 @@ export default {
79
125
  label: '预览',
80
126
  value: 'readonly'
81
127
  },
128
+ {
129
+ label: '表单',
130
+ value: 'form'
131
+ },
82
132
  {
83
133
  label: '设计',
84
134
  value: 'design'
@@ -86,6 +136,8 @@ export default {
86
136
  ],
87
137
  // 编辑器实例
88
138
  editorRef: null,
139
+ // 文档资源列表
140
+ resList: [],
89
141
  // 文档资源ID
90
142
  resId: undefined,
91
143
  // 文档链接
@@ -99,7 +151,16 @@ export default {
99
151
  // 保存数据调用Logic传入的额外参数
100
152
  logicExtraParams: undefined,
101
153
  // 服务名
102
- serviceName: undefined
154
+ serviceName: undefined,
155
+ // 当前文档信息
156
+ currResData: {},
157
+ // 切换的文档id
158
+ toggleResId: undefined,
159
+ // 待提交的修改信息
160
+ modifyResModel: {},
161
+ resRules: {
162
+ f_file_name: [{ required: true, message: '请输入文档名', trigger: 'blur' }],
163
+ }
103
164
  }
104
165
  },
105
166
  methods: {
@@ -113,6 +174,7 @@ export default {
113
174
  const {
114
175
  fileUrl,
115
176
  resId,
177
+ currResData,
116
178
  bindObject,
117
179
  saveDataLogicName,
118
180
  logicExtraParams,
@@ -133,10 +195,11 @@ export default {
133
195
  this.showModeChoose = showModeChoose
134
196
  this.modeType = modeType
135
197
  this.ready = true
136
- this.loadFile(fileUrl, bindObject)
198
+ this.loadFile(fileUrl, bindObject, currResData)
199
+ this.loadResList()
137
200
  },
138
201
  // 加载文档
139
- loadFile (fileUrl, bindObject) {
202
+ loadFile (fileUrl, bindObject, currResData) {
140
203
  this.loading = true
141
204
  this.editorRef.loadUrl(fileUrl).then(() => {
142
205
  if (bindObject) {
@@ -149,14 +212,101 @@ export default {
149
212
  }
150
213
  this.changeMode()
151
214
  this.fileUrl = fileUrl
215
+ if (!currResData.f_file_name) {
216
+ currResData.f_file_name = '未命名'
217
+ }
218
+ this.currResData = currResData
152
219
  this.loading = false
153
220
  this.$emit('afterLoadFile', {})
154
221
  })
155
222
  },
223
+ // 加载文档列表
224
+ loadResList () {
225
+ runLogic('getMedicalList', this.logicExtraParams, this.serviceName).then(res => {
226
+ this.resList = res
227
+ this.toggleResId = this.resId
228
+ })
229
+ },
156
230
  // 修改模式
157
231
  changeMode (e) {
158
232
  this.editorRef.execCommand(this.modeType)
159
233
  },
234
+ // 打开文档信息修改面板
235
+ openRenameModal () {
236
+ this.resDataModalMode = 'modify'
237
+ this.modifyResModel = {
238
+ f_file_name: this.currResData.f_file_name
239
+ }
240
+ this.resDataModalVisible = true
241
+ },
242
+ // 提交文档信息修改
243
+ onSubmit () {
244
+ this.$refs.resModifyForm.validate(valid => {
245
+ if (valid) {
246
+ if (this.resDataModalMode === 'modify' && this.modifyResModel.f_file_name === this.currResData.f_file_name) {
247
+ this.$message.warn('新文档名不能与原文档名一致!')
248
+ return false
249
+ }
250
+ this.save()
251
+ return true
252
+ } else {
253
+ return false
254
+ }
255
+ })
256
+ },
257
+ // 打开文档新建面板
258
+ openAddResModal () {
259
+ this.resDataModalMode = 'add'
260
+ this.modifyResModel = {
261
+ f_file_name: undefined
262
+ }
263
+ this.resDataModalVisible = true
264
+ },
265
+ // 新建文档
266
+ addRes () {
267
+ const params = Object.assign({
268
+ isAddForce: true
269
+ }, this.logicExtraParams)
270
+ this.reload(params)
271
+ },
272
+ // 重新加载
273
+ reload (params) {
274
+ runLogic('getMedicalRecord', params, this.serviceName).then(res => {
275
+ this.resDataModalVisible = false
276
+ this.init({
277
+ modeType: this.modeType,
278
+ fileUrl: res.url,
279
+ resId: res.id,
280
+ currResData: res.currResData,
281
+ bindObject: res.bindObject,
282
+ saveDataLogicName: this.saveDataLogicName,
283
+ serviceName: this.serviceName,
284
+ logicExtraParams: this.logicExtraParams
285
+ })
286
+ })
287
+ },
288
+ // 切换文档
289
+ changeRes (value) {
290
+ if (this.resId === -1) {
291
+ const that = this
292
+ this.$confirm({
293
+ title: '确认切换文档吗?',
294
+ content: '您有尚未保存的文档,切换文档将丢失所有的修改',
295
+ onOk () {
296
+ that.reload({
297
+ resId: value
298
+ })
299
+ },
300
+ onCancel () {
301
+ that.toggleResId = that.resId
302
+ },
303
+ })
304
+ } else {
305
+ this.reload({
306
+ resId: value
307
+ })
308
+ }
309
+ },
160
310
  // 保存文档
161
311
  save () {
162
312
  // 验证必须输入项
@@ -167,12 +317,15 @@ export default {
167
317
  dataObject: this.editorRef.getBindObject(),
168
318
  dataMode: this.dataMode,
169
319
  resId: this.resId,
320
+ modifyResModel: this.modifyResModel,
170
321
  logicExtraParams: this.logicExtraParams
171
322
  }
172
323
  // 保存HTML文档和结构化数据到后端服务
173
324
  runLogic(this.saveDataLogicName, data, this.serviceName).then(res => {
174
- this.loadFile(res.url, res.bindObject)
175
325
  this.$message.success('保存成功')
326
+ this.changeRes(res.currResData.id)
327
+ }).finally(() => {
328
+ this.resDataModalVisible = false
176
329
  })
177
330
  } else {
178
331
  this.$message.error('请检查未填写的项目')
@@ -188,7 +341,7 @@ export default {
188
341
  },
189
342
  // 刷新文档
190
343
  refresh () {
191
- this.loadFile(this.fileUrl, this.bindObject)
344
+ this.loadFile(this.fileUrl, this.bindObject, this.currResData)
192
345
  },
193
346
  // 导出下拉菜单
194
347
  handleExportMenuClick (e) {
@@ -1,50 +1,50 @@
1
- <template>
2
- <div>
3
- <a-list v-show="!loading" size="small" :data-source="data">
4
- <a-list-item slot="renderItem" slot-scope="item">
5
- <div>
6
- <p><a @click="$emit('openFavorites', item.uuid)">{{ item.question }} </a></p>
7
- <p>{{ item.date }}</p>
8
- </div>
9
- <a class="delete_item">
10
- <a-icon type="close" @click="$emit('saveToFavorites', item.uuid)"/>
11
- </a>
12
- </a-list-item>
13
- </a-list>
14
- </div>
15
- </template>
16
-
17
- <script>
18
- import { indexedDB } from '@vue2-client/utils/indexedDB'
19
-
20
- export default {
21
- name: 'FavoriteList',
22
- data () {
23
- return {
24
- data: [],
25
- loading: false
26
- }
27
- },
28
- mounted () {
29
- this.loadData()
30
- },
31
- methods: {
32
- loadData () {
33
- indexedDB.getAll((data) => {
34
- const realData = data.filter(item => item.data && item.data.uuid)
35
- .map(item => item.data)
36
- this.data = realData
37
- })
38
- }
39
- }
40
- }
41
- </script>
42
- <style lang="less" scoped>
43
- .delete_item {
44
- margin-left: 8px;
45
- color: #333;
46
- }
47
- p {
48
- margin: 0
49
- }
50
- </style>
1
+ <template>
2
+ <div>
3
+ <a-list v-show="!loading" size="small" :data-source="data">
4
+ <a-list-item slot="renderItem" slot-scope="item">
5
+ <div>
6
+ <p><a @click="$emit('openFavorites', item.uuid)">{{ item.question }} </a></p>
7
+ <p>{{ item.date }}</p>
8
+ </div>
9
+ <a class="delete_item">
10
+ <a-icon type="close" @click="$emit('saveToFavorites', item.uuid)"/>
11
+ </a>
12
+ </a-list-item>
13
+ </a-list>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ import { indexedDB } from '@vue2-client/utils/indexedDB'
19
+
20
+ export default {
21
+ name: 'FavoriteList',
22
+ data () {
23
+ return {
24
+ data: [],
25
+ loading: false
26
+ }
27
+ },
28
+ mounted () {
29
+ this.loadData()
30
+ },
31
+ methods: {
32
+ loadData () {
33
+ indexedDB.getAll((data) => {
34
+ const realData = data.filter(item => item.data && item.data.uuid)
35
+ .map(item => item.data)
36
+ this.data = realData
37
+ })
38
+ }
39
+ }
40
+ }
41
+ </script>
42
+ <style lang="less" scoped>
43
+ .delete_item {
44
+ margin-left: 8px;
45
+ color: #333;
46
+ }
47
+ p {
48
+ margin: 0
49
+ }
50
+ </style>
@@ -87,9 +87,9 @@ routerResource.example = {
87
87
  // component: () => import('@vue2-client/base-client/components/common/XFormGroup/demo.vue'),
88
88
  // component: () => import('@vue2-client/base-client/components/common/XFormGroup/demo.vue'),
89
89
  // component: () => import('@vue2-client/base-client/components/common/XReport/XReportDemo.vue'),
90
- component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
90
+ // component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
91
91
  // component: () => import('@vue2-client/base-client/components/common/XTab/XTabDemo.vue'),
92
- // component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
92
+ component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
93
93
  // component: () => import('@vue2-client/pages/WorkflowDetail/WorkFlowDemo.vue'),
94
94
  // component: () => import('@vue2-client/base-client/components/common/XConversation/XConversationDemo.vue'),
95
95
  // component: () => import('@vue2-client/base-client/components/common/XButtons/XButtonDemo.vue'),
@@ -1,18 +1,18 @@
1
- import { post } from '@vue2-client/services/api/restTools'
2
-
3
- const entityApi = {
4
- // 根据ID查询数据
5
- getById: (entityName, id, data = {}, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
6
- return post(`/api/${serviceName}/entity/query/${entityName}/${id}`, data)
7
- },
8
- // 根据ID集合查询所有数据
9
- findAllByIds: (entityName, data, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
10
- return post(`/api/${serviceName}/entity/query/${entityName}`, data)
11
- },
12
- // 查询实体的总数量
13
- getCount: (entityName, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
14
- return post(`/api/${serviceName}/entity/queryCount/${entityName}`, {})
15
- }
16
- }
17
-
18
- export { entityApi }
1
+ import { post } from '@vue2-client/services/api/restTools'
2
+
3
+ const entityApi = {
4
+ // 根据ID查询数据
5
+ getById: (entityName, id, data = {}, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
6
+ return post(`/api/${serviceName}/entity/query/${entityName}/${id}`, data)
7
+ },
8
+ // 根据ID集合查询所有数据
9
+ findAllByIds: (entityName, data, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
10
+ return post(`/api/${serviceName}/entity/query/${entityName}`, data)
11
+ },
12
+ // 查询实体的总数量
13
+ getCount: (entityName, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
14
+ return post(`/api/${serviceName}/entity/queryCount/${entityName}`, {})
15
+ }
16
+ }
17
+
18
+ export { entityApi }
@@ -1,63 +1,63 @@
1
- // 工单专用api
2
- const workFlowViewApi = {
3
- // 查询:获取工作流基本数据
4
- getWorkFlowBasicInfo: '/logic/getWorkFlowBasicInfo',
5
- // 保存工作流流程定义
6
- saveWorkFlowWorkflowDefine: '/logic/saveWorkFlowWorkflowDefine',
7
- // 获取工作流流程定义
8
- getWorkFlowDefine: '/logic/getWorkFlowDefine',
9
- // 获取工作流当前步骤
10
- getWorkFlowCurrentSubState: '/logic/getWorkFlowCurrentSubState',
11
- // 保存用户每一步输入的表单内容
12
- saveWorkFlowStepFormData: '/logic/saveWorkFlowStepFormData',
13
- // 获取已经完成步骤的用户填写数据
14
- getWorkFlowCompletedStepData: '/logic/getWorkFlowCompletedStepData',
15
- // 改变工作流进度
16
- updateWorkFlowState: '/logic/updateWorkFlowState',
17
- // 完工确认后更改工作流状态
18
- afterWorkFlowFinalStepSubmit: '/logic/afterWorkFlowFinalStepSubmit',
19
- // 获取步骤留言和表单填写人姓名
20
- getStepNoteAndHandler: '/logic/getStepNoteAndHandler',
21
- // 更新步骤信息
22
- updateWorkFlowStepData: '/logic/updateWorkFlowStepData',
23
- // 保存工作流日志
24
- saveWorkFlowLog: '/logic/saveWorkFlowLog',
25
- // 获取工作流日志
26
- getWorkFlowLog: '/logic/getWorkFlowLog',
27
- // 获取员工任务详情信息
28
- getEmployeeTaskDetail: '/logic/getEmployeeTaskDetail',
29
- // 根据条件查询任务
30
- getWorkFlowListByCondition: '/logic/getWorkFlowListByCondition',
31
- // 根据流程名称获取所有步骤名称
32
- getWorkFlowStepNames: '/logic/getWorkFlowStepNames',
33
- // 获取工作流任务留言
34
- getWorkFlowLeaveMessage: '/logic/getWorkFlowLeaveMessage',
35
- // 更新任务完成时间
36
- updateWorkFlowCompleteTime: '/logic/updateWorkFlowCompleteTime',
37
- // 获取任务完成时间更改记录
38
- getWorkFlowCompleteTimeChange: '/logic/getWorkFlowCompleteTimeChange',
39
- // 修改工单
40
- updateWorkFlow: '/logic/updateWorkFlow',
41
- // 获取工作流流程图设计
42
- getWorkFlowPaintWorkFlowDefine: '/logic/getWorkFlowPaintWorkFlowDefine',
43
- // 简单添加字典项
44
- simpleInsertIntoDictionary: '/logic/simpleInsertIntoDictionary',
45
- // 删除工作流项目
46
- deleteWorkFlow: '/logic/deleteWorkFlow',
47
- // 获取流程分类数据
48
- getWorkFlowCategoryTree: '/logic/getWorkFlowCategoryTree',
49
- // 创建任务
50
- createWorkflowTask: '/logic/createWorkflowTask',
51
- // 获取部门选择框数据
52
- getDepartmentList: '/logic/getDepartmentList',
53
- // 获取人员任务汇总数据
54
- getEmployeeSummary: '/logic/getEmployeeSummary',
55
- // 获取逾期任务排行榜
56
- getOverdueRanking: '/logic/getOverdueRanking',
57
- // 根据人查询对应的t_workflow_step中字段f_workflow_id的数据组
58
- getWorkFlowStepWorkFlowId: '/logic/getWorkFlowStepWorkFlowId',
59
- // 表单提交到下一步
60
- submitToNextStep: '/logic/submitToNextStep'
61
- }
62
-
63
- export { workFlowViewApi }
1
+ // 工单专用api
2
+ const workFlowViewApi = {
3
+ // 查询:获取工作流基本数据
4
+ getWorkFlowBasicInfo: '/logic/getWorkFlowBasicInfo',
5
+ // 保存工作流流程定义
6
+ saveWorkFlowWorkflowDefine: '/logic/saveWorkFlowWorkflowDefine',
7
+ // 获取工作流流程定义
8
+ getWorkFlowDefine: '/logic/getWorkFlowDefine',
9
+ // 获取工作流当前步骤
10
+ getWorkFlowCurrentSubState: '/logic/getWorkFlowCurrentSubState',
11
+ // 保存用户每一步输入的表单内容
12
+ saveWorkFlowStepFormData: '/logic/saveWorkFlowStepFormData',
13
+ // 获取已经完成步骤的用户填写数据
14
+ getWorkFlowCompletedStepData: '/logic/getWorkFlowCompletedStepData',
15
+ // 改变工作流进度
16
+ updateWorkFlowState: '/logic/updateWorkFlowState',
17
+ // 完工确认后更改工作流状态
18
+ afterWorkFlowFinalStepSubmit: '/logic/afterWorkFlowFinalStepSubmit',
19
+ // 获取步骤留言和表单填写人姓名
20
+ getStepNoteAndHandler: '/logic/getStepNoteAndHandler',
21
+ // 更新步骤信息
22
+ updateWorkFlowStepData: '/logic/updateWorkFlowStepData',
23
+ // 保存工作流日志
24
+ saveWorkFlowLog: '/logic/saveWorkFlowLog',
25
+ // 获取工作流日志
26
+ getWorkFlowLog: '/logic/getWorkFlowLog',
27
+ // 获取员工任务详情信息
28
+ getEmployeeTaskDetail: '/logic/getEmployeeTaskDetail',
29
+ // 根据条件查询任务
30
+ getWorkFlowListByCondition: '/logic/getWorkFlowListByCondition',
31
+ // 根据流程名称获取所有步骤名称
32
+ getWorkFlowStepNames: '/logic/getWorkFlowStepNames',
33
+ // 获取工作流任务留言
34
+ getWorkFlowLeaveMessage: '/logic/getWorkFlowLeaveMessage',
35
+ // 更新任务完成时间
36
+ updateWorkFlowCompleteTime: '/logic/updateWorkFlowCompleteTime',
37
+ // 获取任务完成时间更改记录
38
+ getWorkFlowCompleteTimeChange: '/logic/getWorkFlowCompleteTimeChange',
39
+ // 修改工单
40
+ updateWorkFlow: '/logic/updateWorkFlow',
41
+ // 获取工作流流程图设计
42
+ getWorkFlowPaintWorkFlowDefine: '/logic/getWorkFlowPaintWorkFlowDefine',
43
+ // 简单添加字典项
44
+ simpleInsertIntoDictionary: '/logic/simpleInsertIntoDictionary',
45
+ // 删除工作流项目
46
+ deleteWorkFlow: '/logic/deleteWorkFlow',
47
+ // 获取流程分类数据
48
+ getWorkFlowCategoryTree: '/logic/getWorkFlowCategoryTree',
49
+ // 创建任务
50
+ createWorkflowTask: '/logic/createWorkflowTask',
51
+ // 获取部门选择框数据
52
+ getDepartmentList: '/logic/getDepartmentList',
53
+ // 获取人员任务汇总数据
54
+ getEmployeeSummary: '/logic/getEmployeeSummary',
55
+ // 获取逾期任务排行榜
56
+ getOverdueRanking: '/logic/getOverdueRanking',
57
+ // 根据人查询对应的t_workflow_step中字段f_workflow_id的数据组
58
+ getWorkFlowStepWorkFlowId: '/logic/getWorkFlowStepWorkFlowId',
59
+ // 表单提交到下一步
60
+ submitToNextStep: '/logic/submitToNextStep'
61
+ }
62
+
63
+ export { workFlowViewApi }
@@ -1,31 +1,31 @@
1
- /**
2
- * @description: createWaterMark.js 加水印功能
3
- */
4
- let waterMarkDOM
5
-
6
- const clearWaterMark = () => {
7
- if (waterMarkDOM) waterMarkDOM.remove()
8
- }
9
- /**
10
- * @description: 创建水印
11
- * @param waterMarkName 水印内容
12
- */
13
- export default function createWaterMark (waterMarkName) {
14
- clearWaterMark()
15
- if (!waterMarkName) {
16
- return
17
- }
18
- const width = window.parseInt(document.body.clientWidth)
19
- const canvasWidth = width / window.parseInt(width / 320)
20
- const fontFamily = window.getComputedStyle(document.body)['font-family']
21
- const fragment = document.createDocumentFragment()
22
- waterMarkDOM = document.createElement('div')
23
- waterMarkDOM.className = 'water-mark-wrap'
24
- let spanStr = ''
25
- for (let i = 0; i < 100; i++) {
26
- spanStr += `<span class="water-word" style=width:${canvasWidth}px;height:200px;font: ${fontFamily}>${waterMarkName}</span>`
27
- }
28
- waterMarkDOM.innerHTML = spanStr
29
- fragment.appendChild(waterMarkDOM)
30
- document.body.appendChild(fragment)
31
- }
1
+ /**
2
+ * @description: createWaterMark.js 加水印功能
3
+ */
4
+ let waterMarkDOM
5
+
6
+ const clearWaterMark = () => {
7
+ if (waterMarkDOM) waterMarkDOM.remove()
8
+ }
9
+ /**
10
+ * @description: 创建水印
11
+ * @param waterMarkName 水印内容
12
+ */
13
+ export default function createWaterMark (waterMarkName) {
14
+ clearWaterMark()
15
+ if (!waterMarkName) {
16
+ return
17
+ }
18
+ const width = window.parseInt(document.body.clientWidth)
19
+ const canvasWidth = width / window.parseInt(width / 320)
20
+ const fontFamily = window.getComputedStyle(document.body)['font-family']
21
+ const fragment = document.createDocumentFragment()
22
+ waterMarkDOM = document.createElement('div')
23
+ waterMarkDOM.className = 'water-mark-wrap'
24
+ let spanStr = ''
25
+ for (let i = 0; i < 100; i++) {
26
+ spanStr += `<span class="water-word" style=width:${canvasWidth}px;height:200px;font: ${fontFamily}>${waterMarkName}</span>`
27
+ }
28
+ waterMarkDOM.innerHTML = spanStr
29
+ fragment.appendChild(waterMarkDOM)
30
+ document.body.appendChild(fragment)
31
+ }