@lambo-design-mobile/workflow-approve 1.0.0-beta.22 → 1.0.0-beta.24

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.
@@ -2,7 +2,7 @@
2
2
  <van-cell center>
3
3
  <template v-slot:icon>
4
4
  <div
5
- v-if="['通过','流程发起','跳转指定节点'].includes(getAuditStatus(item.auditResult).text)"
5
+ v-if="['通过','流程发起','跳转指定节点'].includes(getAuditStatus(item.auditResult, item.handleName, item.rejectName).text)"
6
6
  class="completed-icon">
7
7
  <van-icon class="iconfont" class-prefix='icon' :name=getAuditStatus(item.auditResult).icon
8
8
  size="28px" color="#fff"/>
@@ -36,7 +36,7 @@
36
36
  </template>
37
37
  <template v-slot:default>
38
38
  <span :style="{ color: getAuditStatus(item.auditResult).color }">{{
39
- getAuditStatus(item.auditResult).text
39
+ getAuditStatus(item.auditResult, item.handleName, item.rejectName).text
40
40
  }}</span>
41
41
  </template>
42
42
  </van-cell>
@@ -16,7 +16,7 @@
16
16
  <template #right-icon>
17
17
  <div @click="onSearch" class="todo-search">搜索</div>
18
18
  </template>
19
- <template #action>
19
+ <template v-if="!useUserTransferRange" #action>
20
20
  <van-badge :dot="searchFilterBadge">
21
21
  <van-icon @click="searchFilterShow = !searchFilterShow;" name="filter-o" color="#666666" size="25px"/>
22
22
  </van-badge>
@@ -51,9 +51,10 @@
51
51
  <van-list v-model="loading" style="padding-top: 15px"
52
52
  :finished="finished"
53
53
  finished-text="没有更多了"
54
+ :immediate-check="false"
54
55
  @load="handleLoad()">
55
56
  <select-handle-card ref="selectHandleCard" :multi-select="multiSelect" :person-list="personList.rows"
56
- :result.sync="checkResult">
57
+ :result.sync="checkResult" :show-status="!useUserTransferRange">
57
58
  </select-handle-card>
58
59
  </van-list>
59
60
  </div>
@@ -63,14 +64,14 @@
63
64
  </div>
64
65
 
65
66
  <van-popup v-model="searchOrganShow" closeable round position="bottom" :style="{ height: '80%' }">
66
- <select-organize :all-organize="true" :show-check-box="false" @handleSelect="onSelect" ></select-organize>
67
+ <select-organize :all-organize="true" :treetype-id="orgTreeType" :organize-id-list="organizeIdList" :show-check-box="false" @handleSelect="onSelect" ></select-organize>
67
68
  </van-popup>
68
69
  </div>
69
70
  </template>
70
71
 
71
72
  <script>
72
73
  import SelectHandleCard from "./SelectHandleCard.vue";
73
- import {getOrgRootTree, getProcessType, getUserList} from "../api";
74
+ import {getOrgRootTree, getProcessType, getUserList, getTransferRange} from "../api";
74
75
  import Tree from "./tree/Tree.vue";
75
76
  import SelectOrganize from "./SelectOrganize.vue";
76
77
 
@@ -89,6 +90,18 @@ export default {
89
90
  multiSelect: { // 新增一个 prop 来控制是否开启多选模式
90
91
  type: Boolean,
91
92
  default: false
93
+ },
94
+ organTreeType: {
95
+ type: String,
96
+ required: false
97
+ },
98
+ userList: { // 用户选择范围
99
+ type: Array,
100
+ default: () => ([])
101
+ },
102
+ orgList: { // 组织选择范围
103
+ type: Array,
104
+ default: () => ([])
92
105
  }
93
106
  },
94
107
  data() {
@@ -96,6 +109,9 @@ export default {
96
109
  searchOrganShow: false,
97
110
  searchFilterShow: false,
98
111
  searchFilterBadge: false,
112
+ useUserTransferRange: false,
113
+ userRangeList: [],
114
+ orgTreeType: '',
99
115
  searchForm: {
100
116
  userId: '',
101
117
  orgTreeType: '',
@@ -114,6 +130,7 @@ export default {
114
130
  rows: []
115
131
  },
116
132
  checkResult: [], // 需要传递到子组件的 checkResult
133
+ organizeIdList: [], // 需要传递到子组件的组织选择范围
117
134
  };
118
135
  },
119
136
  mounted() {
@@ -121,47 +138,75 @@ export default {
121
138
  },
122
139
  methods: {
123
140
  initSearch() {
124
- getOrgRootTree().then(res => {
125
- const result = res.data;
126
- if (result.code === 1) {
127
- this.searchForm.organId = result.data[0].organId;
128
- this.searchForm.organTitle = result.data[0].organName;
129
- this.searchForm.userId = '';
141
+ if (this.userList && this.userList.length > 0) {
142
+ this.useUserTransferRange = true
143
+ this.userRangeList = this.userList.map(item => { return{...item, organName: item.organName || item.deptName} })
144
+ this.personList.rows = this.userRangeList
145
+ this.personList.total = this.userRangeList.length
146
+ return
147
+ }
148
+ this.useUserTransferRange = false
149
+ if (this.orgList && this.orgList.length > 0){
150
+ this.organizeIdList = this.orgList.map(item => item.orgId)
151
+ this.orgTreeType = this.organTreeType;
152
+ this.searchForm = {
153
+ ...this.searchForm,
154
+ orgTreeType: this.organTreeType,
155
+ organId: this.orgList[0].orgId,
156
+ organTitle: this.orgList[0].orgName,
157
+ userId: ''
130
158
  }
131
159
  this.handleLoad()
132
- })
160
+ } else {
161
+ getProcessType(this.procType).then(res => {
162
+ this.orgTreeType = res.data.data.rows[0].organTreeType;
163
+ const permScope = res.data.data.rows[0].permScope || 'all'
164
+ getOrgRootTree(this.orgTreeType).then(res => {
165
+ const orgResult = res.data;
166
+ if (orgResult.code === 200) {
167
+ this.searchForm = {
168
+ ...this.searchForm,
169
+ orgTreeType: this.orgTreeType,
170
+ permScopeList: permScope,
171
+ organId: orgResult.data[0].organId,
172
+ organTitle: orgResult.data[0].organName,
173
+ userId: ''
174
+ }
175
+ }
176
+ this.handleLoad()
177
+ })
178
+ }).catch(error => {
179
+ console.error(error)
180
+ })
181
+ }
133
182
  },
134
183
  handleLoad() {
135
184
  console.log("触发加载")
185
+ this.loading = true;
186
+ if (this.useUserTransferRange){
187
+ this.personList.rows = this.searchForm.userName ? this.userRangeList.map(item => item.userName === this.searchForm.userName) : this.userRangeList
188
+ this.personList.total = this.personList.rows.length;
189
+ this.loading = false;
190
+ return
191
+ }
136
192
  const offset = this.personList.rows.length;
137
193
  const limit = 10;
138
194
 
139
- getProcessType(this.procType).then(res => {
140
-
141
- this.searchForm.orgTreeType = res.data.data.rows[0].organTreeType;
142
- const userArray = this.extractUsers(res.data.data.rows[0].permScope);
143
- if (userArray.length > 0) {
144
- this.searchForm.permScopeList = userArray.join(',')
195
+ getUserList(offset, limit, this.searchForm).then(res => {
196
+ const result = res.data;
197
+ if (result.code === "1") {
198
+ //返回的数据添加到 personList
199
+ this.personList.rows = this.personList.rows.concat(result.data.rows);
200
+ this.personList.total = result.data.total;
145
201
  }
146
- getUserList(offset, limit, this.searchForm).then(res => {
147
-
148
- const result = res.data;
149
- if (result.code === "1") {
150
- //返回的数据添加到 personList 中
151
- this.personList.rows = this.personList.rows.concat(result.data.rows);
152
- this.personList.total = result.data.total;
153
- }
154
202
 
155
- this.loading = false;
156
- this.finished = this.personList.rows.length >= this.personList.total;
203
+ this.loading = false;
204
+ this.finished = this.personList.rows.length >= this.personList.total;
157
205
 
158
- }).catch(error => {
159
- console.error('Error fetching data:', error);
160
- this.loading = false;
161
- });
162
206
  }).catch(error => {
163
- console.error(error)
164
- })
207
+ console.error('Error fetching data:', error);
208
+ this.loading = false;
209
+ });
165
210
  },
166
211
 
167
212
  extractUsers(permScope) {
@@ -220,10 +265,10 @@ export default {
220
265
  },
221
266
  watch: {
222
267
  // 监听 searchForm 的每一个字段的变化
223
- searchForm: {
224
- handler: 'checkSearchForm',
225
- deep: true // 深度监听
226
- }
268
+ // searchForm: {
269
+ // handler: 'checkSearchForm',
270
+ // deep: true // 深度监听
271
+ // }
227
272
  }
228
273
  }
229
274
  </script>
@@ -349,4 +394,4 @@ export default {
349
394
  .submitForm:active {
350
395
  background: linear-gradient(90deg, rgba(0, 150, 255, 0.8), rgba(22, 119, 255, 0.79));
351
396
  }
352
- </style>
397
+ </style>
@@ -17,7 +17,7 @@
17
17
  :border="false" title="部门名称"
18
18
  :value="item.organName"></van-cell>
19
19
  <van-cell title-class="list-title" value-class="list-value" class="custom-cell"
20
- :border="false" title="人员状态">
20
+ :border="false" title="人员状态" v-if="showStatus">
21
21
  <template v-slot:default>
22
22
  <span :style="getStatusStyle(item.status)"></span>
23
23
  <span :style="{ color: getStatusStyle(item.status)['background-color'] }">
@@ -46,6 +46,10 @@ export default {
46
46
  multiSelect: { // 新增一个 prop 来控制是否开启多选模式
47
47
  type: Boolean,
48
48
  default: false
49
+ },
50
+ showStatus: {
51
+ type: Boolean,
52
+ default: false
49
53
  }
50
54
  },
51
55
  data() {
@@ -46,6 +46,10 @@ export default {
46
46
  organizeIdList: {
47
47
  type: Array,
48
48
  default: () => []
49
+ },
50
+ treetypeId: {
51
+ type: String,
52
+ default: ''
49
53
  }
50
54
  },
51
55
  data() {
@@ -102,7 +106,7 @@ export default {
102
106
  handleLoadData(node, callback) {
103
107
  getOrgSubNodes(node.id).then((res) => {
104
108
  const result = res.data;
105
- if (result.code === 1) {
109
+ if (result.code === 200) {
106
110
  callback(
107
111
  result.data.map((item) => {
108
112
  return {
@@ -141,7 +145,7 @@ export default {
141
145
  this.organizeIdList.forEach((item) => {
142
146
  getOrgan(item).then((res) => {
143
147
  const result = res.data;
144
- if (result.code === 1) {
148
+ if (result.code === 200) {
145
149
  // 确保 result.data 是一个对象
146
150
  const newItem = {
147
151
  children: [],
@@ -159,9 +163,9 @@ export default {
159
163
  });
160
164
  });
161
165
  } else {
162
- getOrgRootTree().then((res) => {
166
+ getOrgRootTree(this.treetypeId).then((res) => {
163
167
  const result = res.data;
164
- if (result.code === 1) {
168
+ if (result.code === 200) {
165
169
  this.organizeData = result.data.map((item) => {
166
170
  return {
167
171
  children: [],