@lambo-design-mobile/workflow-approve 1.0.0-beta.3 → 1.0.0-beta.30

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.
@@ -27,7 +27,7 @@
27
27
 
28
28
  <script>
29
29
  import Tree from "./tree/Tree.vue";
30
- import {getOrgan, getOrgRootTree, getOrgSubNodes} from "../api";
30
+ import {getOrgan, getOrgRootTree, getOrgSubNodes, getBizOrgRootTree} from "../api";
31
31
 
32
32
  export default {
33
33
  name: "CustomTree",
@@ -46,6 +46,15 @@ export default {
46
46
  organizeIdList: {
47
47
  type: Array,
48
48
  default: () => []
49
+ },
50
+ // 根组织获取规则,为true表示用登录人权限范围
51
+ orgRootWithPermit: {
52
+ type: Boolean,
53
+ default: true
54
+ },
55
+ treetypeId: {
56
+ type: String,
57
+ default: ''
49
58
  }
50
59
  },
51
60
  data() {
@@ -102,7 +111,7 @@ export default {
102
111
  handleLoadData(node, callback) {
103
112
  getOrgSubNodes(node.id).then((res) => {
104
113
  const result = res.data;
105
- if (result.code === 1) {
114
+ if (result.code === 200) {
106
115
  callback(
107
116
  result.data.map((item) => {
108
117
  return {
@@ -141,7 +150,7 @@ export default {
141
150
  this.organizeIdList.forEach((item) => {
142
151
  getOrgan(item).then((res) => {
143
152
  const result = res.data;
144
- if (result.code === 1) {
153
+ if (result.code === 200) {
145
154
  // 确保 result.data 是一个对象
146
155
  const newItem = {
147
156
  children: [],
@@ -159,21 +168,40 @@ export default {
159
168
  });
160
169
  });
161
170
  } else {
162
- getOrgRootTree().then((res) => {
163
- const result = res.data;
164
- if (result.code === 1) {
165
- this.organizeData = result.data.map((item) => {
166
- return {
167
- children: [],
168
- title: item.organName,
169
- id: item.organCode,
170
- parentId: item.parentId,
171
- checked: false,
172
- expand: false
173
- };
174
- });
175
- }
176
- });
171
+ if (this.orgRootWithPermit){
172
+ getOrgRootTree(this.treetypeId).then((res) => {
173
+ const result = res.data;
174
+ if (result.code === 200) {
175
+ this.organizeData = result.data.map((item) => {
176
+ return {
177
+ children: [],
178
+ title: item.organName,
179
+ id: item.organCode,
180
+ parentId: item.parentId,
181
+ checked: false,
182
+ expand: false
183
+ };
184
+ });
185
+ }
186
+ });
187
+ } else {
188
+ getBizOrgRootTree(this.treetypeId).then((res) => {
189
+ const result = res.data;
190
+ if (result.code === 200) {
191
+ this.organizeData = result.data.map((item) => {
192
+ return {
193
+ children: [],
194
+ title: item.bizOrganName,
195
+ id: item.bizOrganCode,
196
+ parentId: item.parentId,
197
+ checked: false,
198
+ expand: false
199
+ };
200
+ });
201
+ }
202
+ });
203
+ }
204
+
177
205
  }
178
206
  }
179
207
  };
@@ -16,42 +16,53 @@
16
16
  </template>
17
17
  </van-cell>
18
18
  <van-cell title-class="list-title" value-class="list-value" class="custom-cell" :border="false"
19
- title="样品单号"
19
+ title="申请编号"
20
20
  :value="item.applyId"></van-cell>
21
21
  <van-cell title-class="list-title" value-class="list-value" class="custom-cell" :border="false"
22
22
  title="流程名称" @click="toggleDetails(index)" :is-link="true"
23
23
  :arrow-direction="detailsVisible[index] ? 'down' : ''"
24
24
  :value="item.procName"></van-cell>
25
25
  <div v-if="detailsVisible[index]">
26
- <van-cell title-class="list-title" value-class="list-value" class="custom-cell" :border="false"
27
- title="当前环节"
28
- :value="item.taskName"></van-cell>
29
26
  <van-cell title-class="list-title" value-class="list-value" class="custom-cell" :border="false" title="申请人"
30
27
  :value="item.applyUser ? item.applyUser.split(':')[1] : '未定义'"></van-cell>
28
+ <van-cell title-class="list-title" value-class="list-value" class="custom-cell" :border="false"
29
+ :title="selectedTask === 'pending' ? '发起时间':'审批时间' "
30
+ :value="selectedTask === 'pending' ? formatDate(item.startDate) :formatDate(item.auditDate)">
31
+ </van-cell>
31
32
  </div>
32
- <van-cell title-class="list-title" value-class="list-value" class="custom-cell"
33
- :title="selectedTask === 'pending' ? '发起时间':'审批时间' "
34
- :value="selectedTask === 'pending' ? formatDate(item.startDate) :formatDate(item.auditDate)">
35
- </van-cell>
33
+ <van-cell title-class="list-title" value-class="list-value" class="custom-cell" :border="false"
34
+ title="当前环节"
35
+ :value="item.taskName"></van-cell>
36
36
  <van-cell v-if="selectedTask === 'pending'" :key="selectedTask" title=" ">
37
37
  <template #right-icon>
38
38
  <div class="button-group">
39
+ <van-button class="button" size="small" plain type="info" @click="derive(item)">
40
+ 转办
41
+ </van-button>
39
42
  <van-button class="button" size="small" plain type="info" @click="handleItem(item)">
40
- {{ item.handleType === '20' ? '审批' : '办理' }}
43
+ {{ item.handleName || (item.handleType === '20' ? '审批' : '办理') }}
41
44
  </van-button>
42
45
  </div>
43
46
  </template>
44
47
  </van-cell>
45
48
  </van-cell-group>
46
49
  </van-checkbox-group>
50
+ <van-popup v-if="selectUserPopupShow" v-model="selectUserPopupShow" closeable round position="bottom" :style="{ height: '80%' }">
51
+ <div class="select-user-popup-body">
52
+ <select-handle title="指定办理人" :procType="selectUserPopupParams.procType" :organ-tree-type="selectUserPopupParams.organTreeType" :org-root-with-permit="false"
53
+ :org-list="selectUserPopupParams.orgList" :user-list="selectUserPopupParams.userList" @selectHandle="handleSelectResult"></select-handle>
54
+ </div>
55
+ </van-popup>
47
56
  </div>
48
57
  </template>
49
58
  <script>
50
- import {getNodeData} from "../api";
51
- import {Notify} from "vant";
59
+ import {getNodeData, audit, getTransferRange} from "../api";
60
+ import {Notify, Toast} from "vant";
61
+ import SelectHandle from "./SelectHandle.vue";
52
62
 
53
63
  export default {
54
64
  name: 'TodoListCard',
65
+ components: {SelectHandle},
55
66
  props: {
56
67
  todoList: {},
57
68
  selectedTask: {
@@ -85,6 +96,19 @@ export default {
85
96
  localTodoList: this.todoList,
86
97
  detailsVisible: {}, // 用于跟踪每个项目的详细内容是否可见
87
98
  localResult: this.result, // 使用 localResult 来绑定 van-checkbox-group
99
+ selectUserPopupShow: false, // 转办弹框
100
+ selectUserPopupParams: {
101
+ procType: '',
102
+ class: '',
103
+ userList: [],
104
+ orgList: [],
105
+ organTreeType: '',
106
+ procId: '',
107
+ taskNode: '',
108
+ applyId: '',
109
+ taskId: '',
110
+ instanceId: '',
111
+ },
88
112
  }
89
113
  },
90
114
  watch: {
@@ -182,10 +206,124 @@ export default {
182
206
  toggleDetails(index) {
183
207
  this.$set(this.detailsVisible, index, !this.detailsVisible[index]);
184
208
  },
209
+ // 转办
210
+ async derive(item) {
211
+ this.resetTransferPopupData();
212
+ this.selectUserPopupParams.procType = item.procType
213
+ this.selectUserPopupParams.procId = item.procId
214
+ this.selectUserPopupParams.taskNode = item.taskNode
215
+ this.selectUserPopupParams.applyId = item.applyId
216
+ this.selectUserPopupParams.taskId = item.taskId
217
+ this.selectUserPopupParams.instanceId = item.procInstanceId || item.instanceId
218
+ const success = await this.fetchTransferRange();
219
+ if (success) {
220
+ this.selectUserPopupShow = true;
221
+ }
222
+ },
223
+ resetTransferPopupData() {
224
+ this.selectUserPopupParams = {
225
+ procType: '',
226
+ class: '',
227
+ userList: [],
228
+ orgList: [],
229
+ organTreeType: '',
230
+ procId: '',
231
+ taskNode: '',
232
+ applyId: '',
233
+ taskId: '',
234
+ instanceId: '',
235
+ };
236
+ },
237
+ async fetchTransferRange() {
238
+ try {
239
+ const params = {
240
+ procType: this.selectUserPopupParams.procType,
241
+ procId: this.selectUserPopupParams.procId,
242
+ taskNode: this.selectUserPopupParams.taskNode,
243
+ applyId: this.selectUserPopupParams.applyId,
244
+ taskId: this.selectUserPopupParams.taskId,
245
+ instanceId: this.selectUserPopupParams.instanceId,
246
+ actionType: 'auditTo82',
247
+ };
248
+ const res = await getTransferRange(params);
249
+ const result = res.data;
250
+ if (result.code == 200) {
251
+ this.selectUserPopupParams.organTreeType = result.data.organTreeType;
252
+ this.selectUserPopupParams.userList = result.data.userList;
253
+ this.selectUserPopupParams.orgList = result.data.orgList;
254
+ return true;
255
+ } else {
256
+ console.warn('获取选择人员范围失败,返回码:', result.code);
257
+ return false;
258
+ }
259
+ } catch (err) {
260
+ console.error('获取选择人员范围异常', err);
261
+ return false;
262
+ }
263
+ },
264
+ handleSelectResult(checkResult) {
265
+ const self = this
266
+ console.log('Selected result:', checkResult);
267
+ let auditParams = {
268
+ procId: self.selectUserPopupParams.procId,
269
+ applyId: self.selectUserPopupParams.applyId,
270
+ taskId: self.selectUserPopupParams.taskId,
271
+ auditResult: '82',
272
+ selectedUserId: checkResult[0].userId,
273
+ }
274
+ self.auditRequest(auditParams);
275
+ self.selectUserPopupShow = false;
276
+ },
277
+ auditRequest(auditParams) {
278
+ let self = this
279
+ Toast.loading({
280
+ duration: 0, // 持续展示 toast
281
+ forbidClick: true,
282
+ message: '处理中',
283
+ })
284
+ //确认执行审批逻辑
285
+ audit(auditParams).then((resp) => { // 使用箭头函数
286
+ let result = resp.data
287
+ if (result.code === '200') {
288
+ Toast.success(result.message);
289
+ } else {
290
+ Toast.fail(result.message);
291
+ }
292
+ this.selectUserPopupShow = false;
293
+ this.$emit('refresh');
294
+ })
295
+ },
185
296
  }
186
297
  }
187
298
  </script>
188
299
  <style scoped>
300
+ .select-user-popup-body {
301
+ height: 100%;
302
+ overflow: visible;
303
+ }
304
+
305
+ ::v-deep .select-user-popup-body > * {
306
+ height: 100%;
307
+ display: flex;
308
+ flex-direction: column;
309
+ overflow: visible;
310
+ min-height: 0;
311
+ }
312
+
313
+ ::v-deep .select-user-popup-body #headTitle {
314
+ flex: 0 0 auto;
315
+ }
316
+
317
+ ::v-deep .select-user-popup-body #listContent {
318
+ flex: 1;
319
+ min-height: 0;
320
+ overflow-y: auto;
321
+ }
322
+
323
+ ::v-deep .select-user-popup-body .custom-bottom-bar {
324
+ position: relative;
325
+ flex-shrink: 0;
326
+ }
189
327
 
190
328
  .button-group {
191
329
  display: flex;
@@ -234,4 +372,4 @@ export default {
234
372
  flex: 0 0 auto;
235
373
  }
236
374
 
237
- </style>
375
+ </style>