widget.qw 1.0.83 → 1.0.85

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.
Files changed (108) hide show
  1. package/.env.development +10 -10
  2. package/.env.production +8 -8
  3. package/README.md +75 -75
  4. package/build/style.css +521 -471
  5. package/build/widget.qw.es.js +253 -84
  6. package/build/widget.qw.umd.js +252 -83
  7. package/index.html +17 -17
  8. package/package.json +47 -47
  9. package/src/App.vue +26 -26
  10. package/src/api/index.js +173 -165
  11. package/src/components/AuditBar.vue +396 -396
  12. package/src/components/BillCard.vue +164 -164
  13. package/src/components/CascaderPicker.vue +132 -132
  14. package/src/components/CascaderPop.vue +375 -371
  15. package/src/components/CheckGroup.vue +113 -113
  16. package/src/components/DatetimeDropdown.vue +62 -0
  17. package/src/components/{DatetimePicker/index.vue → DatetimePicker.vue} +124 -124
  18. package/src/components/DayDropdown.vue +56 -56
  19. package/src/components/FilePicker.vue +169 -169
  20. package/src/components/HeadBar.vue +130 -0
  21. package/src/components/Input.vue +80 -80
  22. package/src/components/MonthDropdown.vue +51 -51
  23. package/src/components/MultiPicker.vue +123 -123
  24. package/src/components/ObjsEditor.vue +334 -334
  25. package/src/components/SecretNotify.js +5 -5
  26. package/src/components/Sheet.vue +92 -92
  27. package/src/components/SingleApiPicker.vue +108 -108
  28. package/src/components/SinglePicker.vue +102 -102
  29. package/src/components/SingleUserSelector.vue +425 -425
  30. package/src/components/Switch.vue +64 -64
  31. package/src/components/TreePicker.vue +113 -113
  32. package/src/components/UserPicker.vue +106 -106
  33. package/src/components/UserProfile.vue +129 -129
  34. package/src/components/UsersPicker.vue +118 -118
  35. package/src/components/YearDropdown.vue +59 -59
  36. package/src/components/data_selector.vue +303 -303
  37. package/src/components/image_picker.vue +123 -123
  38. package/src/components/images_picker.vue +195 -195
  39. package/src/components/index.js +172 -162
  40. package/src/components/mult_list_selector.vue +155 -155
  41. package/src/components/subdepartment_selector.vue +481 -481
  42. package/src/components/user_selector.vue +639 -639
  43. package/src/components/widget/DataPop.vue +95 -95
  44. package/src/components/{DatetimePicker → widget}/DatetimePop.vue +342 -342
  45. package/src/components/widget/TreePop.vue +88 -88
  46. package/src/components/widget/UserPop.vue +347 -347
  47. package/src/main.js +117 -117
  48. package/src/router/index.ts +183 -173
  49. package/src/util/array_util.js +32 -32
  50. package/src/util/auth_util.js +72 -72
  51. package/src/util/bool_util.js +5 -5
  52. package/src/util/bus.js +1 -1
  53. package/src/util/cache_util.js +18 -18
  54. package/src/util/errer_code.js +6 -6
  55. package/src/util/eval_util.js +19 -19
  56. package/src/util/icon_util.js +36 -36
  57. package/src/util/image_util.js +27 -27
  58. package/src/util/index.js +57 -57
  59. package/src/util/num_util.js +70 -70
  60. package/src/util/obj_util.js +28 -28
  61. package/src/util/request.js +73 -73
  62. package/src/util/request_json.js +71 -71
  63. package/src/util/request_json_mute.js +65 -65
  64. package/src/util/request_upload.js +79 -79
  65. package/src/util/route_util.js +31 -31
  66. package/src/util/str_util.js +143 -143
  67. package/src/util/time_util.js +406 -406
  68. package/src/util/toast_util.js +24 -24
  69. package/src/util/tree_util.js +153 -153
  70. package/src/util/uuid_util.js +9 -9
  71. package/src/util/validate.js +182 -182
  72. package/src/util/vue_filter.js +223 -223
  73. package/src/views/auditbar/index.vue +78 -78
  74. package/src/views/billcard/index.vue +48 -48
  75. package/src/views/cascaderpicker/index.vue +0 -0
  76. package/src/views/cascaderpicker/userpicker.vue +183 -0
  77. package/src/views/cascaderpop/index.vue +90 -90
  78. package/src/views/checkgroup/index.vue +35 -35
  79. package/src/views/dataSelector/index.vue +48 -48
  80. package/src/views/datetimedropdown/index.vue +34 -0
  81. package/src/views/datetimepicker/index.vue +34 -34
  82. package/src/views/daydropdown/index.vue +31 -31
  83. package/src/views/filepicker/index.vue +32 -32
  84. package/src/views/headbar/index.vue +28 -0
  85. package/src/views/home/index.vue +0 -0
  86. package/src/views/imagepicker/index.vue +31 -31
  87. package/src/views/imagespicker/index.vue +37 -37
  88. package/src/views/input/index.vue +35 -35
  89. package/src/views/monthdropdown/index.vue +31 -31
  90. package/src/views/multListSelector/index.vue +61 -61
  91. package/src/views/multipicker/index.vue +36 -36
  92. package/src/views/objseditor/index.vue +277 -277
  93. package/src/views/productSelector/index.vue +35 -35
  94. package/src/views/projectpicker/index.vue +41 -41
  95. package/src/views/secretnotify/index.vue +27 -27
  96. package/src/views/sheet/index.vue +45 -45
  97. package/src/views/singlepicker/index.vue +35 -35
  98. package/src/views/subdepartmentSelector/index.vue +40 -40
  99. package/src/views/switch/index.vue +34 -34
  100. package/src/views/treepicker/index.vue +41 -41
  101. package/src/views/userSelector/index.vue +54 -54
  102. package/src/views/userSelectorNew/index.vue +45 -45
  103. package/src/views/userpicker/index.vue +43 -43
  104. package/src/views/userprofile/index.vue +30 -30
  105. package/src/views/userspicker/index.vue +43 -43
  106. package/src/views/yeardropdown/index.vue +32 -32
  107. package/src/vm/index.js +1 -1
  108. package/vite.config.ts +122 -122
@@ -1,397 +1,397 @@
1
- <template>
2
- <div class="widget">
3
- <van-field v-if="canPass || canRefuse" v-model="data.memo" class="memo" label="审批意见" placeholder="请输入审批意见" />
4
-
5
- <van-popover v-if="canRefuse" placement="top-start" v-model:show="data.isShowPop" :actions="formatPrevSteps"
6
- actions-direction="vertical" @select="onSelectRefuse">
7
- <template #reference>
8
- <van-button class="refuse-btn" type="danger" @click="onRefuse">驳回</van-button>
9
- </template>
10
- </van-popover>
11
-
12
- <van-button v-if="canPass" class="pass-btn" type="primary" native-type="submit" @click="onPass">提交</van-button>
13
-
14
- <van-button class="apply-btn" v-if="canApply" type="primary" native-type="submit"
15
- @click="onApply">申请</van-button>
16
-
17
- <div class="audit-title" v-if="data.process && data.process.id">{{ formatProcessTitle }}</div>
18
-
19
- <van-steps class="task-list" direction="vertical" :active="data.process.startedTaskIndex"
20
- v-if="data.process && data.process.id">
21
- <van-step v-for="(task, i) in data.process.tasks" :key="i">
22
- <div class="task-title">{{ formatTitle(task) }}</div>
23
- <div class="task-user" v-if="task.executors" v-for="(executor, j) in task.executors" :key="j">
24
- {{ formatExecutor(executor, task) }}
25
- </div>
26
- </van-step>
27
- </van-steps>
28
- </div>
29
- </template>
30
-
31
- <script setup>
32
- import { ref, reactive, computed, onMounted, defineProps, defineEmits, watch } from "vue"
33
- import util from '../util'
34
- import lodash from 'lodash'
35
-
36
- const props = defineProps({
37
- processId: {
38
- type: Number,
39
- default: 0
40
- },
41
- mouldId: {
42
- type: Number,
43
- default: 0
44
- },
45
- userId: {
46
- type: String,
47
- default: ''
48
- },
49
- form: {
50
- type: Object,
51
- default: null
52
- },
53
- process_detail: {
54
- type: Function,
55
- default: null
56
- }
57
- })
58
- const emit = defineEmits(['pass', 'refuse', 'apply', 'auth'])
59
- const data = reactive({
60
- isShowPop: false,
61
- process: {},
62
- memo: '',
63
- stepAuth: {},
64
- canApply: false
65
- })
66
- const formatPrevSteps = computed(() => {
67
- if (!data.process || !data.process.prevSteps || data.process.prevSteps.length < 1) {
68
- return []
69
- }
70
-
71
- return data.process.prevSteps.map((item) => {
72
- return {
73
- stepId: item.id,
74
- text: item.title
75
- }
76
- })
77
- })
78
-
79
- const canApply = computed(()=>{
80
- return !data.process.id && data.canApply
81
- })
82
-
83
- const canPass = computed(() => {
84
- return data.process && data.process.id && data.process.canPass
85
- })
86
- const canRefuse = computed(() => {
87
- return data.process && data.process.id && data.process.canRefuse
88
- })
89
-
90
- onMounted(() => {
91
-
92
- })
93
-
94
- const onPass = () => {
95
- // 1秒节流
96
- lodash.throttle(() => {
97
- emit('pass', {
98
- memo: data.memo
99
- })
100
- }, 5000)()
101
- }
102
- const onRefuse = () => {
103
-
104
- }
105
- const onSelectRefuse = (action) => {
106
- emit('refuse',
107
- {
108
- memo: data.memo,
109
- action: action
110
- }
111
- )
112
- }
113
-
114
- const onApply = () => {
115
- // 1秒节流
116
- lodash.throttle(() => {
117
- emit('apply', {
118
- memo: data.memo
119
- })
120
- }, 5000)()
121
- }
122
-
123
- const queryDetail = async () => {
124
- if (!props.processId)
125
- return
126
- const params = {
127
- id: props.processId
128
- }
129
-
130
- if (!util.process_detail)
131
- return
132
-
133
- const res = await util.process_detail(params)
134
- if (res.code != 200)
135
- return
136
-
137
- //防止网络请求先发后返回
138
- //参数变化时,扔掉返回
139
- if (params.id != props.processId && props.processId && !params.id)
140
- return
141
-
142
- data.process = res.data
143
- }
144
-
145
- const queryStepAuth = async () => {
146
- if (!props.processId && !props.mouldId)
147
- return
148
-
149
- const params = {
150
- processId: props.processId,
151
- mouldId: props.mouldId,
152
- userId: props.userId,
153
- form: props.form
154
- }
155
- const res = await util.process_step_auth(params)
156
- if (res.code != 200)
157
- return
158
-
159
- //防止网络请求先发后返回
160
- //参数变化时,扔掉返回
161
- if (params.processId != props.processId && props.processId && !params.processId)
162
- return
163
-
164
- if (params.mouldId != props.mouldId && props.mouldId && !params.mouldId)
165
- return
166
-
167
- if (params.userId != props.userId && props.user && !params.userId)
168
- return
169
-
170
- data.stepAuth = res.data
171
-
172
- updateAuth()
173
- }
174
-
175
- const updateAuth = () => {
176
- let res = {}
177
- for (const key in data.stepAuth) {
178
- const fieldAuth = data.stepAuth[key]
179
- let authValue = getAuth(fieldAuth)
180
- res[key] = authValue
181
- }
182
-
183
- emit('auth', res)
184
- }
185
-
186
- // 根据条件列表获取权限
187
- const getAuth = (fieldAuth) => {
188
- console.log('+++ getAuth +++++++++++++', fieldAuth)
189
- // 默认权限: 只读
190
- let defaultCondition = 'readonly'
191
-
192
- if (!fieldAuth) {
193
- return defaultCondition
194
- }
195
-
196
- const conditions = fieldAuth.conditions
197
- if (!conditions || conditions.length < 1) {
198
- return defaultCondition
199
- }
200
-
201
- for (const i in conditions) {
202
- const condition = conditions[i]
203
- // 有条件的权限,根据条件表达式计算匹配的权限
204
- if (condition.condition) {
205
- const result = util.executeExpress(condition.condition, props.form)
206
- if (result === true) {
207
- return condition.value
208
- }
209
- } else {
210
- // 无条件的权限
211
- defaultCondition = condition.value
212
- }
213
- }
214
-
215
- return defaultCondition
216
- }
217
-
218
- const updateCanApply = async () => {
219
- if (props.processId) {
220
- data.canApply = false
221
- return
222
- }
223
-
224
- let params = {
225
- mouldId: props.mouldId,
226
- userId: props.userId,
227
- form: props.form
228
- }
229
- let res = await util.process_can_apply(params)
230
- if (res.code != 200)
231
- return
232
-
233
- //防止网络请求先发后返回
234
- //参数变化时,扔掉返回
235
- if (params.mouldId != props.mouldId && props.mouldId && !params.mouldId)
236
- return
237
-
238
- if (params.userId != props.userId && props.userId && !params.userId)
239
- return
240
-
241
- data.canApply = res.data
242
- }
243
-
244
- const formatTitle = (task) => {
245
- let title = task.title
246
- if (task.category == 'start') {
247
- if (task.state == 'pass') {
248
- title = title + ' / ' + '已申请'
249
- } else if (task.state == 'refuse') {
250
- title = title + ' / ' + '已驳回'
251
- } else {
252
- title = title + ' / ' + '申请中'
253
- }
254
- } else if (task.category == 'audit') {
255
- if (task.auditMethod == 'or') {
256
- title = title + '(或签)'
257
- } else {
258
- title = title + '(会签)'
259
- }
260
- if (task.state == 'pass') {
261
- title = title + ' / ' + '已审核'
262
- } else if (task.state == 'refuse') {
263
- title = title + ' / ' + '已驳回'
264
- } else if (task.state == 'started') {
265
- title = title + ' / ' + '审核中'
266
- } else {
267
- title = title + ''
268
- }
269
- } else if (task.category == 'notify') {
270
- if (task.state == 'pass') {
271
- title = title + ' / ' + '已抄送'
272
- } else {
273
- title = title + ''
274
- }
275
- }
276
- return title
277
- }
278
-
279
- const formatExecutor = (executor, task) => {
280
- let action = ''
281
- let username = ''
282
- let memo = executor.memo
283
- if (executor.state == 'pass') {
284
- if (task.category == 'notify')
285
- action = `已抄送 ${executor.updatedAt}`
286
- else
287
- action = `已审核 ${executor.updatedAt}`
288
- } else if (executor.state == 'refuse') {
289
- action = `已驳回 ${executor.updatedAt}`
290
- }
291
-
292
- if (executor.user.name != executor.submiterName && executor.submiterName)
293
- username = `${executor.user.name}/${executor.submiterName}`
294
- else
295
- username = `${executor.user.name}`
296
-
297
- return `${username} ${action} ${memo}`
298
- }
299
-
300
- const formatProcessTitle = computed(() => {
301
- if (data.process.state == 'started') {
302
- return '审批流程: 审核中'
303
- } else if (data.process.state == 'finish_pass') {
304
- return '审批流程: 审批通过'
305
- } else if (data.process.state == 'finish_refuse') {
306
- return '审批流程: 已撤销'
307
- } else {
308
- return '审批流程:'
309
- }
310
- })
311
-
312
- const refresh = async() => {
313
- await queryDetail()
314
- queryStepAuth()
315
- updateCanApply()
316
- }
317
-
318
- watch(() => props.userId, async () => {
319
- if (!props.userId)
320
- return
321
-
322
- await refresh()
323
- }, { immediate: true })
324
-
325
- watch(() => props.processId, async () => {
326
- await refresh()
327
- }, { immediate: true })
328
-
329
- watch(() => props.mouldId, async () => {
330
- if (!props.processId && !props.mouldId)
331
- return
332
- await refresh()
333
- }, { immediate: true })
334
-
335
- watch(() => JSON.stringify(props.form), async () => {
336
- if (!data.stepAuth)
337
- return
338
-
339
- await refresh()
340
- }, { immediate: true })
341
- </script>
342
-
343
- <style lang="scss" scoped>
344
- .widget {
345
- text-align: center;
346
- padding: 15px 15px;
347
- }
348
-
349
- .memo {
350
- margin-bottom: 15px;
351
- }
352
-
353
- .refuse-btn {
354
- width: 120px;
355
- margin-right: 15px;
356
- }
357
-
358
- .pass-btn {
359
- width: 120px;
360
- }
361
-
362
- .apply-btn {
363
- width: 60vw;
364
- }
365
-
366
- .task-list {
367
- margin-top: 15px;
368
- }
369
-
370
- .task-title {
371
- font-size: 14px;
372
- font-weight: bold;
373
- color: #333;
374
- text-align: left;
375
- }
376
-
377
- .task-user {
378
- font-size: 13px;
379
- color: #666;
380
- text-align: left;
381
- margin-top: 5px;
382
- }
383
-
384
- .audit-title {
385
- padding: 25px 15px 0 15px;
386
- font-size: 16px;
387
- font-weight: bold;
388
- color: #666;
389
- text-align: left;
390
- }
391
- </style>
392
-
393
- <style>
394
- :root:root {
395
- --van-popover-action-width: 70vw;
396
- }
1
+ <template>
2
+ <div class="widget">
3
+ <van-field v-if="canPass || canRefuse" v-model="data.memo" class="memo" label="审批意见" placeholder="请输入审批意见" />
4
+
5
+ <van-popover v-if="canRefuse" placement="top-start" v-model:show="data.isShowPop" :actions="formatPrevSteps"
6
+ actions-direction="vertical" @select="onSelectRefuse">
7
+ <template #reference>
8
+ <van-button class="refuse-btn" type="danger" @click="onRefuse">驳回</van-button>
9
+ </template>
10
+ </van-popover>
11
+
12
+ <van-button v-if="canPass" class="pass-btn" type="primary" native-type="submit" @click="onPass">提交</van-button>
13
+
14
+ <van-button class="apply-btn" v-if="canApply" type="primary" native-type="submit"
15
+ @click="onApply">申请</van-button>
16
+
17
+ <div class="audit-title" v-if="data.process && data.process.id">{{ formatProcessTitle }}</div>
18
+
19
+ <van-steps class="task-list" direction="vertical" :active="data.process.startedTaskIndex"
20
+ v-if="data.process && data.process.id">
21
+ <van-step v-for="(task, i) in data.process.tasks" :key="i">
22
+ <div class="task-title">{{ formatTitle(task) }}</div>
23
+ <div class="task-user" v-if="task.executors" v-for="(executor, j) in task.executors" :key="j">
24
+ {{ formatExecutor(executor, task) }}
25
+ </div>
26
+ </van-step>
27
+ </van-steps>
28
+ </div>
29
+ </template>
30
+
31
+ <script setup>
32
+ import { ref, reactive, computed, onMounted, defineProps, defineEmits, watch } from "vue"
33
+ import util from '../util'
34
+ import lodash from 'lodash'
35
+
36
+ const props = defineProps({
37
+ processId: {
38
+ type: Number,
39
+ default: 0
40
+ },
41
+ mouldId: {
42
+ type: Number,
43
+ default: 0
44
+ },
45
+ userId: {
46
+ type: String,
47
+ default: ''
48
+ },
49
+ form: {
50
+ type: Object,
51
+ default: null
52
+ },
53
+ process_detail: {
54
+ type: Function,
55
+ default: null
56
+ }
57
+ })
58
+ const emit = defineEmits(['pass', 'refuse', 'apply', 'auth'])
59
+ const data = reactive({
60
+ isShowPop: false,
61
+ process: {},
62
+ memo: '',
63
+ stepAuth: {},
64
+ canApply: false
65
+ })
66
+ const formatPrevSteps = computed(() => {
67
+ if (!data.process || !data.process.prevSteps || data.process.prevSteps.length < 1) {
68
+ return []
69
+ }
70
+
71
+ return data.process.prevSteps.map((item) => {
72
+ return {
73
+ stepId: item.id,
74
+ text: item.title
75
+ }
76
+ })
77
+ })
78
+
79
+ const canApply = computed(()=>{
80
+ return !data.process.id && data.canApply
81
+ })
82
+
83
+ const canPass = computed(() => {
84
+ return data.process && data.process.id && data.process.canPass
85
+ })
86
+ const canRefuse = computed(() => {
87
+ return data.process && data.process.id && data.process.canRefuse
88
+ })
89
+
90
+ onMounted(() => {
91
+
92
+ })
93
+
94
+ const onPass = () => {
95
+ // 1秒节流
96
+ lodash.throttle(() => {
97
+ emit('pass', {
98
+ memo: data.memo
99
+ })
100
+ }, 5000)()
101
+ }
102
+ const onRefuse = () => {
103
+
104
+ }
105
+ const onSelectRefuse = (action) => {
106
+ emit('refuse',
107
+ {
108
+ memo: data.memo,
109
+ action: action
110
+ }
111
+ )
112
+ }
113
+
114
+ const onApply = () => {
115
+ // 1秒节流
116
+ lodash.throttle(() => {
117
+ emit('apply', {
118
+ memo: data.memo
119
+ })
120
+ }, 5000)()
121
+ }
122
+
123
+ const queryDetail = async () => {
124
+ if (!props.processId)
125
+ return
126
+ const params = {
127
+ id: props.processId
128
+ }
129
+
130
+ if (!util.process_detail)
131
+ return
132
+
133
+ const res = await util.process_detail(params)
134
+ if (res.code != 200)
135
+ return
136
+
137
+ //防止网络请求先发后返回
138
+ //参数变化时,扔掉返回
139
+ if (params.id != props.processId && props.processId && !params.id)
140
+ return
141
+
142
+ data.process = res.data
143
+ }
144
+
145
+ const queryStepAuth = async () => {
146
+ if (!props.processId && !props.mouldId)
147
+ return
148
+
149
+ const params = {
150
+ processId: props.processId,
151
+ mouldId: props.mouldId,
152
+ userId: props.userId,
153
+ form: props.form
154
+ }
155
+ const res = await util.process_step_auth(params)
156
+ if (res.code != 200)
157
+ return
158
+
159
+ //防止网络请求先发后返回
160
+ //参数变化时,扔掉返回
161
+ if (params.processId != props.processId && props.processId && !params.processId)
162
+ return
163
+
164
+ if (params.mouldId != props.mouldId && props.mouldId && !params.mouldId)
165
+ return
166
+
167
+ if (params.userId != props.userId && props.user && !params.userId)
168
+ return
169
+
170
+ data.stepAuth = res.data
171
+
172
+ updateAuth()
173
+ }
174
+
175
+ const updateAuth = () => {
176
+ let res = {}
177
+ for (const key in data.stepAuth) {
178
+ const fieldAuth = data.stepAuth[key]
179
+ let authValue = getAuth(fieldAuth)
180
+ res[key] = authValue
181
+ }
182
+
183
+ emit('auth', res)
184
+ }
185
+
186
+ // 根据条件列表获取权限
187
+ const getAuth = (fieldAuth) => {
188
+ console.log('+++ getAuth +++++++++++++', fieldAuth)
189
+ // 默认权限: 只读
190
+ let defaultCondition = 'readonly'
191
+
192
+ if (!fieldAuth) {
193
+ return defaultCondition
194
+ }
195
+
196
+ const conditions = fieldAuth.conditions
197
+ if (!conditions || conditions.length < 1) {
198
+ return defaultCondition
199
+ }
200
+
201
+ for (const i in conditions) {
202
+ const condition = conditions[i]
203
+ // 有条件的权限,根据条件表达式计算匹配的权限
204
+ if (condition.condition) {
205
+ const result = util.executeExpress(condition.condition, props.form)
206
+ if (result === true) {
207
+ return condition.value
208
+ }
209
+ } else {
210
+ // 无条件的权限
211
+ defaultCondition = condition.value
212
+ }
213
+ }
214
+
215
+ return defaultCondition
216
+ }
217
+
218
+ const updateCanApply = async () => {
219
+ if (props.processId) {
220
+ data.canApply = false
221
+ return
222
+ }
223
+
224
+ let params = {
225
+ mouldId: props.mouldId,
226
+ userId: props.userId,
227
+ form: props.form
228
+ }
229
+ let res = await util.process_can_apply(params)
230
+ if (res.code != 200)
231
+ return
232
+
233
+ //防止网络请求先发后返回
234
+ //参数变化时,扔掉返回
235
+ if (params.mouldId != props.mouldId && props.mouldId && !params.mouldId)
236
+ return
237
+
238
+ if (params.userId != props.userId && props.userId && !params.userId)
239
+ return
240
+
241
+ data.canApply = res.data
242
+ }
243
+
244
+ const formatTitle = (task) => {
245
+ let title = task.title
246
+ if (task.category == 'start') {
247
+ if (task.state == 'pass') {
248
+ title = title + ' / ' + '已申请'
249
+ } else if (task.state == 'refuse') {
250
+ title = title + ' / ' + '已驳回'
251
+ } else {
252
+ title = title + ' / ' + '申请中'
253
+ }
254
+ } else if (task.category == 'audit') {
255
+ if (task.auditMethod == 'or') {
256
+ title = title + '(或签)'
257
+ } else {
258
+ title = title + '(会签)'
259
+ }
260
+ if (task.state == 'pass') {
261
+ title = title + ' / ' + '已审核'
262
+ } else if (task.state == 'refuse') {
263
+ title = title + ' / ' + '已驳回'
264
+ } else if (task.state == 'started') {
265
+ title = title + ' / ' + '审核中'
266
+ } else {
267
+ title = title + ''
268
+ }
269
+ } else if (task.category == 'notify') {
270
+ if (task.state == 'pass') {
271
+ title = title + ' / ' + '已抄送'
272
+ } else {
273
+ title = title + ''
274
+ }
275
+ }
276
+ return title
277
+ }
278
+
279
+ const formatExecutor = (executor, task) => {
280
+ let action = ''
281
+ let username = ''
282
+ let memo = executor.memo
283
+ if (executor.state == 'pass') {
284
+ if (task.category == 'notify')
285
+ action = `已抄送 ${executor.updatedAt}`
286
+ else
287
+ action = `已审核 ${executor.updatedAt}`
288
+ } else if (executor.state == 'refuse') {
289
+ action = `已驳回 ${executor.updatedAt}`
290
+ }
291
+
292
+ if (executor.user.name != executor.submiterName && executor.submiterName)
293
+ username = `${executor.user.name}/${executor.submiterName}`
294
+ else
295
+ username = `${executor.user.name}`
296
+
297
+ return `${username} ${action} ${memo}`
298
+ }
299
+
300
+ const formatProcessTitle = computed(() => {
301
+ if (data.process.state == 'started') {
302
+ return '审批流程: 审核中'
303
+ } else if (data.process.state == 'finish_pass') {
304
+ return '审批流程: 审批通过'
305
+ } else if (data.process.state == 'finish_refuse') {
306
+ return '审批流程: 已撤销'
307
+ } else {
308
+ return '审批流程:'
309
+ }
310
+ })
311
+
312
+ const refresh = async() => {
313
+ await queryDetail()
314
+ queryStepAuth()
315
+ updateCanApply()
316
+ }
317
+
318
+ watch(() => props.userId, async () => {
319
+ if (!props.userId)
320
+ return
321
+
322
+ await refresh()
323
+ }, { immediate: true })
324
+
325
+ watch(() => props.processId, async () => {
326
+ await refresh()
327
+ }, { immediate: true })
328
+
329
+ watch(() => props.mouldId, async () => {
330
+ if (!props.processId && !props.mouldId)
331
+ return
332
+ await refresh()
333
+ }, { immediate: true })
334
+
335
+ watch(() => JSON.stringify(props.form), async () => {
336
+ if (!data.stepAuth)
337
+ return
338
+
339
+ await refresh()
340
+ }, { immediate: true })
341
+ </script>
342
+
343
+ <style lang="scss" scoped>
344
+ .widget {
345
+ text-align: center;
346
+ padding: 15px 15px;
347
+ }
348
+
349
+ .memo {
350
+ margin-bottom: 15px;
351
+ }
352
+
353
+ .refuse-btn {
354
+ width: 120px;
355
+ margin-right: 15px;
356
+ }
357
+
358
+ .pass-btn {
359
+ width: 120px;
360
+ }
361
+
362
+ .apply-btn {
363
+ width: 60vw;
364
+ }
365
+
366
+ .task-list {
367
+ margin-top: 15px;
368
+ }
369
+
370
+ .task-title {
371
+ font-size: 14px;
372
+ font-weight: bold;
373
+ color: #333;
374
+ text-align: left;
375
+ }
376
+
377
+ .task-user {
378
+ font-size: 13px;
379
+ color: #666;
380
+ text-align: left;
381
+ margin-top: 5px;
382
+ }
383
+
384
+ .audit-title {
385
+ padding: 25px 15px 0 15px;
386
+ font-size: 16px;
387
+ font-weight: bold;
388
+ color: #666;
389
+ text-align: left;
390
+ }
391
+ </style>
392
+
393
+ <style>
394
+ :root:root {
395
+ --van-popover-action-width: 70vw;
396
+ }
397
397
  </style>