mali-applet-ui 1.0.41 → 1.0.42

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.
@@ -144,14 +144,17 @@ export default {
144
144
  const numVal = XEUtils.toNumber(this.inpVal)
145
145
  if (this.minNum !== null && (numVal < this.minNum)) {
146
146
  this.$emit('input', this.minNum)
147
+ this.updateModel = true
147
148
  return { status: false, value: this.minNum }
148
149
  }
149
150
  if (this.maxNum !== null && (numVal > this.maxNum)) {
150
151
  this.$emit('input', this.maxNum)
152
+ this.updateModel = true
151
153
  return { status: false, value: this.maxNum }
152
154
  }
153
155
  const val = XEUtils.floor(numVal, 2)
154
156
  if (`${val}` !== `${this.value}`) {
157
+ this.updateModel = true
155
158
  this.$emit('input', val)
156
159
  return { status: false, value: val }
157
160
  }
@@ -159,7 +162,6 @@ export default {
159
162
  },
160
163
  blurEvent () {
161
164
  const rest = this.checkValue()
162
- this.updateModel = rest.status
163
165
  if (rest.status) {
164
166
  this.$nextTick(() => {
165
167
  this.updateValue(rest.value)
@@ -4,21 +4,22 @@
4
4
  <view class="ml-approval-record-header-title">审批记录</view>
5
5
  </view>
6
6
  <view class="ml-approval-record-body">
7
- <view class="ml-approval-record-list" v-for="(group, gIndex) in flowItems" :key="gIndex">
7
+ <view class="ml-approval-record-list" v-for="(group, gIndex) in flowConfigItems" :key="gIndex">
8
8
  <view class="ml-approval-record-flow-line"></view>
9
9
  <view class="ml-approval-record-item">
10
- <view class="ml-approval-record-item-title">{{ group.name }}</view>
10
+ <view class="ml-approval-record-item-title">{{ group.nodeName }}</view>
11
11
  </view>
12
12
  <view class="ml-approval-record-users">
13
13
  <view class="ml-approval-record-user-item" v-for="(item, uIndex) in group.userList" :key="uIndex">
14
14
  <view class="ml-approval-record-user-item-info">
15
15
  <view class="ml-approval-record-user-item-left">
16
- <image class="ml-approval-record-user-picture" src="https://csgc.saas.ddqrcode.com/applet/business/image/portrait2.png" mode="scaleToFill"></image>
16
+ <image class="ml-approval-record-user-picture" :src="item.faceImgUrl || 'https://csgc.saas.ddqrcode.com/applet/business/image/portrait2.png'" ></image>
17
17
  </view>
18
18
  <view class="ml-approval-record-user-item-content">
19
19
  <view class="ml-approval-record-user-item-top">
20
- <view class="ml-approval-record-user-name">{{ item.name }}</view>
21
- <ml-approval-type :value="item.status"></ml-approval-type>
20
+ <view class="ml-approval-record-user-name">{{ item.nickname }}</view>
21
+ <ml-approval-type :value="item.doneStatus !== 3 ? item.doneStatus : group.approveStatus"></ml-approval-type>
22
+ <view class="ml-approval-record-time">{{ (item.approveFlag || group.approveStatus === 3) ? (item.createTime || '') : '' }}</view>
22
23
  </view>
23
24
  <view class="ml-approval-record-user-role">{{ item.role }}</view>
24
25
  </view>
@@ -26,13 +27,29 @@
26
27
  <view class="ml-approval-record-user-date">{{ item.date }}</view>
27
28
  </view>
28
29
  </view>
29
- <view class="ml-approval-record-user-item-comment">
30
- <text>{{ item.comment }}</text>
30
+ <view class="ml-approval-record-user-item-comment" v-if="item.doneFlag">
31
+ <text>{{ item.remark }}</text>
31
32
  </view>
32
33
  </view>
33
34
  </view>
34
35
  </view>
35
36
  </view>
37
+
38
+ <FixedBottom v-if="showApproveBtn">
39
+ <ml-button @click="openApproval(false)">驳回</ml-button>
40
+ <ml-button status="primary" @click="openApproval(true)" >通过</ml-button>
41
+ </FixedBottom>
42
+
43
+ <ml-drawer v-model="showPopup" height="210rpx" :title="`审批状态:${isPass ? '通过' : '驳回'}`" showFooter>
44
+ <ml-textarea v-model="approveContent" border fontColor="#000" showVoice></ml-textarea>
45
+ <template #footer>
46
+ <ml-row>
47
+ <ml-button @click="() => this.showPopup = false">取消</ml-button>
48
+ <ml-button status="primary" @click="confirmEvent">确认</ml-button>
49
+ </ml-row>
50
+ </template>
51
+ </ml-drawer>
52
+
36
53
  </view>
37
54
  </template>
38
55
 
@@ -42,59 +59,147 @@ import globalStore from '../../../config/store'
42
59
  export default {
43
60
  name: 'MlApprovalRecord',
44
61
  props: {
45
- value: Array,
46
- code: String,
47
- options: Array
62
+ sysApproveJobId: {
63
+ type: [Number, String],
64
+ default: 0
65
+ }
48
66
  },
49
67
  data () {
50
68
  return {
51
- flowItems: [],
52
- approvalData: {
53
- flowHandlers: [],
54
- module: null,
55
- flowSettingCode: null,
56
- enableFlag: false
57
- },
58
- flowOptions: []
69
+ flowConfigItems: [], // 审批节点数据
70
+ specialAllFlowItems: [], // 已审批的记录
71
+ approveContent: '', // 审批描述
72
+ showPopup: false, // 审批弹出框
73
+ isPass: true // 通过, 驳回
74
+ }
75
+ },
76
+ computed: {
77
+ // 获取当前用户信息
78
+ userInfo () {
79
+ return globalStore.approval?.record?.getCurrentUserInfo() || {}
80
+ },
81
+ // 当前正在审批节点, 从头找到第一个没有审批过的节点, 或审批状态为 “审批中”的节点(approveStatus补后端approveFlag错误bug)
82
+ currFlowItem () {
83
+ return this.flowConfigItems.find(item => (item.approveFlag === false || item.approveStatus === 1))
84
+ },
85
+ showApproveBtn () {
86
+ // approveStatus: 3, 驳回状态
87
+ if (this.currFlowItem && this.currFlowItem.approveStatus !== 3) {
88
+ // 多人审批方式(0依次审批 1会签(需所有人同意) 2或签)
89
+ if (this.currFlowItem.approveMode === 0) {
90
+ // 依次审批: 找到第一个没有审批的节点,只有此节点的用户可审批, 其它排队
91
+ const currentApproveUser = this.currFlowItem.userList?.find(item => item.approveFlag === false)
92
+ currentApproveUser.doneStatus = 1
93
+ if (currentApproveUser.id === this.userInfo.userId) {
94
+ return true
95
+ }
96
+ } else {
97
+ // 会签、或签 当前用户在此节点审批人中并还未完成审批,可视为有审批按钮
98
+ return !!this.currFlowItem.userList?.find(item => item.approveFlag === false && item.id === this.userInfo.userId)
99
+ }
100
+ }
101
+ return false
59
102
  }
60
103
  },
61
104
  watch: {
62
- code () {
63
- this.loadFlow()
105
+ sysApproveJobId: {
106
+ immediate: true,
107
+ handler () {
108
+ this.loadFlow()
109
+ }
64
110
  }
65
111
  },
66
112
  created () {
67
- this.approvalData.module = this.code
68
- this.approvalData.flowSettingCode = this.code
69
- this.updateFlowItems(this.options)
70
113
  this.loadFlow()
71
114
  },
72
115
  methods: {
73
- updateModel () {
74
- this.$emit('input', this.approvalData)
75
- },
76
- updateFlowItems (list) {
77
- this.flowItems = (list || []).map(item => {
78
- item.f = []
79
- return item
80
- })
116
+ openApproval (isPass) {
117
+ this.isPass = isPass
118
+ this.approveContent = isPass ? '同意' : '不同意'
119
+ this.showPopup = true
81
120
  },
82
121
  async loadFlow () {
83
122
  await this.$nextTick()
84
- if (!this.code) {
123
+ if (!this.sysApproveJobId) {
85
124
  return
86
125
  }
87
- if (globalStore.approval && globalStore.approval.select) {
88
- const loadFlowMethod = globalStore.approval.select.loadFlow
126
+
127
+ if (globalStore.approval && globalStore.approval.record) {
128
+ const loadFlowMethod = globalStore.approval.record.loadFlow
89
129
  if (loadFlowMethod) {
90
130
  Promise.resolve(loadFlowMethod({
91
- code: this.code
131
+ sysApproveJobId: this.sysApproveJobId
132
+ })).then(res => {
133
+ this.flowConfigItems = res.flowConfigItems.map(item => {
134
+ item.specialItem = null
135
+ item.doneFlag = false
136
+ item.doneStatus = ''
137
+ return item
138
+ })
139
+ this.specialAllFlowItems = res.specialAllFlowItems.map(item => {
140
+ item.doneFlag = false
141
+ item.doneStatus = ''
142
+ return item
143
+ })
144
+ this.mergeFlowItemsData()
145
+ })
146
+ }
147
+ }
148
+ },
149
+ mergeFlowItemsData () {
150
+ // 已审批记录匹配到审批节点信息人员
151
+ this.flowConfigItems.forEach(configItem => {
152
+ // 匹配到当前节点
153
+ const specialItem = this.specialAllFlowItems.find(item => item.nodeIdCurrent === configItem.flowItemSettingId)
154
+ configItem.doneFlag = configItem.approveFlag
155
+ configItem.userList = configItem.userList.map(userItem => {
156
+ let doneFlag = false
157
+ let doneStatus = null
158
+ let remark = ''
159
+ let otherStatus = null
160
+ let createTime = null
161
+ if (specialItem) {
162
+ // 匹配到当前审批人--可能已有多次审批,选最后一次展示
163
+ const specialUserItems = specialItem.memberList.filter(item => item.createUser === userItem.id)
164
+ const specialUserItem = specialUserItems.length > 0 ? specialUserItems[specialUserItems.length - 1] : null
165
+ // userItem.approveFlag = false 当前节点未通过 或者 当前整个节点在驳回状态
166
+ if (specialUserItem && (userItem.approveFlag || configItem.approveStatus === 3)) {
167
+ doneFlag = true
168
+ // 审批过的状态, 1为通过, 2为驳回
169
+ doneStatus = specialUserItem.status === 1 ? 2 : 3
170
+ remark = specialUserItem.remark
171
+ otherStatus = specialUserItem.otherStatus
172
+ createTime = specialUserItem.createTime
173
+ }
174
+ }
175
+ return {
176
+ ...userItem,
177
+ doneFlag,
178
+ doneStatus,
179
+ remark,
180
+ otherStatus,
181
+ createTime
182
+ }
183
+ })
184
+ })
185
+ },
186
+ confirmEvent () {
187
+ if (globalStore.approval && globalStore.approval.record) {
188
+ const submitApprove = globalStore.approval.record.submitApprove
189
+ if (submitApprove) {
190
+ Promise.resolve(submitApprove({
191
+ applyUserId: this.userInfo.userId,
192
+ approveJobId: this.sysApproveJobId,
193
+ isPass: this.isPass,
194
+ otherStatus: this.isPass ? 1 : 2, // 1:同意, 2:不同意
195
+ remark: this.approveContent
92
196
  })).then(res => {
93
- this.approvalData.enableFlag = res.enableFlag
94
- this.approvalData.flowSettingCode = res.flowSettingCode
95
- this.approvalData.module = res.module
96
- this.updateFlowItems(res.flowItems)
97
- this.updateModel()
197
+ if (res.code === 200) {
198
+ this.$toast.success()
199
+ this.loadFlow()
200
+ this.$emit('back')
201
+ this.showPopup = false
202
+ }
98
203
  })
99
204
  }
100
205
  }
@@ -116,6 +221,7 @@ export default {
116
221
  }
117
222
  .ml-approval-record-list {
118
223
  position: relative;
224
+ padding-top: 20rpx;
119
225
  padding-bottom: $ml-border-radius;
120
226
  .ml-approval-record-flow-line {
121
227
  position: absolute;
@@ -127,7 +233,7 @@ export default {
127
233
  &::before {
128
234
  content: "";
129
235
  position: absolute;
130
- top: 12rpx;
236
+ top: 32rpx;
131
237
  left: -10rpx;
132
238
  width: 24rpx;
133
239
  height: 24rpx;
@@ -145,7 +251,7 @@ export default {
145
251
  }
146
252
  &:last-child {
147
253
  .ml-approval-record-flow-line {
148
- height: 30rpx;
254
+ height: 50rpx;
149
255
  }
150
256
  }
151
257
  }
@@ -172,12 +278,17 @@ export default {
172
278
  .ml-approval-record-user-item-content {
173
279
  flex-grow: 1;
174
280
  padding: 0 10rpx;
281
+ align-items: center;
282
+ display: flex;
175
283
  }
176
284
  .ml-approval-record-user-item-right {
177
285
  flex-shrink: 0;
178
286
  }
179
287
  .ml-approval-record-user-item-top {
180
288
  line-height: 40rpx;
289
+ display: flex;
290
+ align-items: center;
291
+ width: 100%;
181
292
  }
182
293
  .ml-approval-record-user-picture {
183
294
  width: 100rpx;
@@ -194,6 +305,10 @@ export default {
194
305
  margin-right: 10rpx;
195
306
  color: rgba(0, 0, 0, 0.85);
196
307
  }
308
+ .ml-approval-record-time {
309
+ flex: 1;
310
+ text-align: right;
311
+ }
197
312
  .ml-approval-record-user-role {
198
313
  font-size: 24rpx;
199
314
  color: rgba(0, 0, 0, 0.86);
@@ -204,7 +319,6 @@ export default {
204
319
  .ml-approval-record-user-item-comment{
205
320
  padding: 20rpx;
206
321
  background: #F0F2F5;
207
- height: 160rpx;
208
322
  border-radius: $ml-border-radius;
209
323
  overflow: auto;
210
324
  }
@@ -11,23 +11,40 @@
11
11
  </view>
12
12
  <view class="ml-approval-select-users">
13
13
  <view class="ml-approval-select-user-item" v-for="(item, uIndex) in group.users" :key="uIndex">
14
- <ml-checkbox>
15
- <image class="ml-approval-select-user-picture" src="https://csgc.saas.ddqrcode.com/applet/business/image/portrait2.png" mode="scaleToFill"></image>
16
- <view class="ml-approval-select-user-name">{{ item.name }}</view>
17
- </ml-checkbox>
14
+ <image class="ml-approval-select-user-picture" v-if="item.faceImgUrl" :src="item.faceImgUrl" mode="scaleToFill"></image>
15
+ <image class="ml-approval-select-user-picture" v-else src="https://csgc.saas.ddqrcode.com/applet/business/image/portrait2.png" mode="scaleToFill"></image>
16
+ <view class="ml-approval-select-user-name">{{ item.name }}</view>
18
17
  </view>
19
- <view class="ml-approval-select-user-add" @click="openAddUser(group)">
18
+ <view v-if="!rejectApproveJob" class="ml-approval-select-user-add" @click="openAddUser(group)">
20
19
  <view class="ml-approval-select-user-add-icon">
21
20
  <ml-icon name="add"></ml-icon>
22
21
  </view>
23
22
  </view>
24
23
  </view>
24
+ <view v-if="group.copyRoles && group.copyRoles.length">
25
+ <view class="ml-approval-select-item-title" v-if="!rejectApproveJob || (group.copyUsers)">抄送</view>
26
+ <view class="ml-approval-select-users">
27
+ <view class="ml-approval-select-user-item" v-for="(item, uIndex) in group.copyUsers" :key="uIndex">
28
+ <image class="ml-approval-select-user-picture" src="https://csgc.saas.ddqrcode.com/applet/business/image/portrait2.png" mode="scaleToFill"></image>
29
+ <view class="ml-approval-select-user-name">{{ item.name }}</view>
30
+ </view>
31
+ <view v-if="!rejectApproveJob" class="ml-approval-select-user-add" @click="openAddUser(group, true)">
32
+ <view class="ml-approval-select-user-add-icon">
33
+ <ml-icon name="add"></ml-icon>
34
+ </view>
35
+ </view>
36
+ </view>
37
+ </view>
25
38
  </view>
26
39
  </view>
27
40
 
28
41
  <ml-picker-drawer v-model="showPopup" height="600rpx" showFooter @confirm="confirmEvent">
29
- <ml-list-menu-group v-for="(group, gIndex) in selectRoleGroups" :key="gIndex" :title="group.name">
30
- <ml-list-menu-item v-for="(item, cIndex) in group.userList" :key="cIndex" :padding="false" disabled suffixIcon="none">
42
+ <ml-list-menu-group type="checkbox" :checked.sync="selectedUserIds">
43
+ <view v-for="(group, gIndex) in selectRoleGroups" :key="gIndex" :title="group.name">
44
+ <view>{{ group.name }}</view>
45
+ <ml-list-menu-item v-for="item in group.userList" :padding="false" :disabled="false" suffixIcon="none"
46
+ :key="item.id"
47
+ :value="item.id">
31
48
  <ml-row>
32
49
  <ml-col width="80rpx" shrink>
33
50
  <image class="ml-approval-picker-drawer-user-picture" src="https://csgc.saas.ddqrcode.com/applet/business/image/portrait2.png" mode="scaleToFill"></image>
@@ -35,6 +52,7 @@
35
52
  <ml-col verticalAlign="center">{{ item.name }}</ml-col>
36
53
  </ml-row>
37
54
  </ml-list-menu-item>
55
+ </view>
38
56
  </ml-list-menu-group>
39
57
  </ml-picker-drawer>
40
58
  </view>
@@ -48,7 +66,7 @@ export default {
48
66
  props: {
49
67
  value: Array,
50
68
  code: String,
51
- options: Array
69
+ rejectApproveJob: String
52
70
  },
53
71
  data () {
54
72
  return {
@@ -64,15 +82,32 @@ export default {
64
82
  isAllIndeterminate: false,
65
83
  checkList: [],
66
84
  dataList: [],
67
- selectFlowItem: null
85
+ selectFlowItem: null,
86
+ selectedUserIds: [],
87
+ isCopyUser: false
68
88
  }
69
89
  },
70
90
  computed: {
71
91
  selectRoleGroups () {
72
92
  if (this.selectFlowItem) {
73
- return this.selectFlowItem.roleList || []
93
+ return (this.selectFlowItem.roleList || []).filter(item => item.id).map(item => {
94
+ const userList = (item.userList || []).map(user => ({ ...user, id: `${user.id}_${item.id}` }))
95
+ return {
96
+ ...item,
97
+ userList
98
+ }
99
+ })
74
100
  }
75
101
  return []
102
+ },
103
+ selectedUserList () {
104
+ const allUser = []
105
+ this.selectRoleGroups.forEach(element => {
106
+ (element?.userList || []).forEach(ele => {
107
+ allUser.push(ele)
108
+ })
109
+ })
110
+ return allUser.filter(item => this.selectedUserIds.indexOf(item.id) > -1)
76
111
  }
77
112
  },
78
113
  watch: {
@@ -83,18 +118,29 @@ export default {
83
118
  created () {
84
119
  this.approvalData.module = this.code
85
120
  this.approvalData.flowSettingCode = this.code
86
- this.updateFlowItems(this.options)
87
121
  this.loadFlow()
88
122
  },
89
123
  methods: {
90
124
  updateModel () {
91
125
  this.$emit('input', this.approvalData)
92
126
  },
93
- updateFlowItems (list) {
94
- this.flowItems = (list || []).map(item => {
95
- item.f = []
96
- return item
97
- })
127
+ async updateFlowItems () {
128
+ await this.$nextTick()
129
+ if (!this.rejectApproveJob) {
130
+ return
131
+ }
132
+ if (globalStore.approval && globalStore.approval.select) {
133
+ const updateMethod = globalStore.approval.select.updateFlowItems
134
+ if (updateMethod) {
135
+ Promise.resolve(updateMethod({
136
+ sysApproveJobId: this.rejectApproveJob,
137
+ flowItems: [...this.flowItems]
138
+ })).then(res => {
139
+ this.flowItems = res
140
+ console.log('updateMethod====', res)
141
+ })
142
+ }
143
+ }
98
144
  },
99
145
  async loadFlow () {
100
146
  await this.$nextTick()
@@ -110,18 +156,50 @@ export default {
110
156
  this.approvalData.enableFlag = res.enableFlag
111
157
  this.approvalData.flowSettingCode = res.flowSettingCode
112
158
  this.approvalData.module = res.module
113
- this.updateFlowItems(res.flowItems)
159
+ this.flowItems = res.flowItems
160
+ this.updateFlowItems()
114
161
  this.updateModel()
115
162
  })
116
163
  }
117
164
  }
118
165
  },
119
- openAddUser (group) {
166
+ openAddUser (group, isCopy = false) {
167
+ this.isCopyUser = isCopy
120
168
  this.selectFlowItem = group
169
+ // 返选已选中项
170
+ this.selectedUserIds = ((isCopy ? this.selectFlowItem?.copyUsers : this.selectFlowItem?.users) || []).map(item => item.id)
121
171
  this.showPopup = true
122
172
  },
173
+ updateFlowHandlers () {
174
+ const flowHandlers = this.flowItems.map(item => {
175
+ return {
176
+ copierList: (item.copyUsers || []).map(user => ({
177
+ memberIds: user.id?.split('_')[0],
178
+ memberNames: user.name,
179
+ roleId: user.id?.split('_')[1]
180
+ })),
181
+ flowItemSettingId: item.id,
182
+ userList: (item.users || []).map(user => ({
183
+ // approveFlag: false,
184
+ memberIds: user.id?.split('_')[0],
185
+ memberNames: user.name,
186
+ roleId: user.id?.split('_')[1]
187
+ }))
188
+ }
189
+ })
190
+ this.approvalData.flowHandlers = flowHandlers
191
+ },
123
192
  confirmEvent () {
124
-
193
+ if (this.isCopyUser) {
194
+ this.selectFlowItem.copyUsers = this.selectedUserList
195
+ } else {
196
+ this.selectFlowItem.users = this.selectedUserList
197
+ }
198
+ console.log(this.flowItems)
199
+ this.showPopup = false
200
+ this.selectedUserIds = []
201
+ this.updateFlowHandlers()
202
+ this.updateModel()
125
203
  }
126
204
  }
127
205
  }
@@ -132,23 +132,28 @@ export default {
132
132
  }
133
133
  const numVal = XEUtils.toNumber(XEUtils.toValueString(this.inpVal).slice(0, this.maxLength))
134
134
  if (this.minNum !== null && (numVal < this.minNum)) {
135
+ this.updateModel = true
135
136
  this.$emit('input', this.minNum)
136
137
  return { status: false, value: this.minNum }
137
138
  }
138
139
  if (this.maxNum !== null && (numVal > this.maxNum)) {
140
+ this.updateModel = true
139
141
  this.$emit('input', this.maxNum)
140
142
  return { status: false, value: this.maxNum }
141
143
  }
142
144
  if (this.type === 'integer' && !/^-?[0-9]+$/.test(numVal)) {
143
145
  const value = XEUtils.toInteger(numVal)
146
+ this.updateModel = true
144
147
  this.$emit('input', value)
145
148
  return { status: false, value: value }
146
149
  }
147
150
  if (`${numVal}` !== this.inpVal) {
151
+ this.updateModel = true
148
152
  this.$emit('input', numVal)
149
153
  return { status: false, value: numVal }
150
154
  }
151
155
  if (`${numVal}` !== `${this.value}`) {
156
+ this.updateModel = true
152
157
  this.$emit('input', numVal)
153
158
  return { status: false, value: numVal }
154
159
  }
@@ -171,8 +176,7 @@ export default {
171
176
  }
172
177
  },
173
178
  blurEvent () {
174
- const rest = this.checkValue()
175
- this.updateModel = rest.status
179
+ this.checkValue()
176
180
  this.$emit('blur', { value: this.inpVal })
177
181
  },
178
182
  inputEvent () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "lib",