n20-common-lib 2.22.26 → 2.22.28

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": "n20-common-lib",
3
- "version": "2.22.26",
3
+ "version": "2.22.28",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -136,11 +136,11 @@
136
136
  line-height: 16px !important;
137
137
  vertical-align: middle !important;
138
138
  cursor: pointer;
139
-
139
+ padding-right: 4px !important;
140
140
  .vxe-sort--asc-btn,
141
141
  .vxe-sort--desc-btn {
142
142
  width: 6px;
143
- height: 10px;
143
+ height: 12px !important;
144
144
  color: #333;
145
145
  border: none;
146
146
  font-style: normal;
@@ -7,7 +7,7 @@
7
7
  title="自定义项"
8
8
  :default-expand="otherExpand"
9
9
  >
10
- <el-form ref="approveBtnGroup" label-position="right" :label-width="_lang === 'zh' ? '12em' : '12em'">
10
+ <el-form ref="approveBtnGroup" label-position="top">
11
11
  <div
12
12
  class="p-b-lg p-t-lg p-r-lg"
13
13
  style="max-height: 150px; overflow-y: auto; border: 1px dashed var(--border-color-base); border-radius: 5px"
@@ -27,7 +27,7 @@
27
27
  </div>
28
28
  </div>
29
29
  <!-- 抄送加签 -->
30
- <el-form ref="approveBtnGroup" label-position="right" :label-width="_lang === 'zh' ? '6em' : '12em'">
30
+ <el-form ref="addEndorseForm" label-position="right" :label-width="_lang === 'zh' ? '6em' : '12em'">
31
31
  <div v-if="taskId && showBtn" class="flex-box">
32
32
  <el-form-item v-if="authList.includes('isCarboncopy')" :label="'抄送' | $lc" class="flex-1 m-b-s">
33
33
  <el-input
@@ -221,7 +221,7 @@
221
221
  <carboncopy-prop
222
222
  type="addtask"
223
223
  :carbon-copy-list="addTaskList"
224
- @close="setAddtaskClose"
224
+ @close="setAddtaskV = false"
225
225
  @confirm="setAddtaskOk"
226
226
  />
227
227
  </cl-dialog>
@@ -598,22 +598,25 @@ export default {
598
598
  this.checkFlowFn()
599
599
  }
600
600
  }
601
- // addTaskTip 需要加签时,直接弹出加签弹窗选择被加签人
602
- if (res.code === 200 && res.data && res.data.addTaskTip) {
603
- this._pendingAddTaskTip = handleResult
604
- this.setAddtaskV = true
601
+ // addTaskTip 是否给出加签提示
602
+ if (res.code === 200 && res.data && res.data.addTaskTip && !this.addTaskList.length) {
603
+ this.$confirm('请检查是否向后加签', $lc('提示'), {
604
+ confirmButtonText: $lc('确定'),
605
+ cancelButtonText: $lc('取消'),
606
+ type: 'warning'
607
+ })
608
+ .then(handleResult)
609
+ .catch(() => {})
605
610
  } else {
606
611
  handleResult()
607
612
  }
608
613
  } catch (error) {
609
- console.log(error)
610
614
  this.checkFlowFn()
611
615
  }
612
616
  })
613
617
  },
614
618
  // 选择审批人
615
619
  selectSprListFn(data) {
616
- console.log(data)
617
620
  this.nextEgwOutgoingNodeId = data.nextEgwOutgoingNodeId
618
621
  this.nextNodeApproveUnos = data.nextNodeApproveUnos
619
622
  this.setSpr = false
@@ -637,7 +640,6 @@ export default {
637
640
  this.IsShowUploadWidget = data
638
641
  }
639
642
  }
640
- console.log(code, data)
641
643
  },
642
644
  // 意见是否必填
643
645
  getConfiguration() {
@@ -645,13 +647,11 @@ export default {
645
647
  .then(({ opinionRequired, showApproveTo }) => {
646
648
  this.requiredC = opinionRequired ?? this.required
647
649
  this.showApproveTo = showApproveTo ?? true
648
- // 读取该工作流是否意见必填
649
- if (this.$route.query.remarkIsMust !== undefined) {
650
- this.requiredC = this.$route.query.remarkIsMust === '1'
651
- }
652
650
  })
653
651
  .catch(() => {
654
652
  this.requiredC = this.required
653
+ })
654
+ .finally(() => {
655
655
  // 读取该工作流是否意见必填
656
656
  if (this.$route.query.remarkIsMust !== undefined) {
657
657
  this.requiredC = this.$route.query.remarkIsMust === '1'
@@ -659,15 +659,20 @@ export default {
659
659
  })
660
660
  },
661
661
  getTodoList() {
662
- return new Promise((resolve, reject) => {
662
+ return new Promise((resolve) => {
663
663
  const dto = JSON.parse(sessionStorage.getItem(`approvalDto`))
664
- axios.post('/bems/activiti/admin/todo/todo', dto).then(({ data, code }) => {
665
- if (code === 200) {
666
- const { list } = data
667
- this.todoList = list || []
664
+ axios
665
+ .post('/bems/activiti/admin/todo/todo', dto)
666
+ .then(({ data, code }) => {
667
+ if (code === 200) {
668
+ const { list } = data
669
+ this.todoList = list || []
670
+ }
668
671
  resolve({ data, code })
669
- }
670
- })
672
+ })
673
+ .catch(() => {
674
+ resolve({ data: {}, code: -1 })
675
+ })
671
676
  })
672
677
  },
673
678
  // 获取加签方式的模式
@@ -829,8 +834,24 @@ export default {
829
834
  setParam(obj) {
830
835
  Object.assign(this.otherAtt, obj)
831
836
  },
832
- // 提交后的提示
833
- thenMsg(data = {}, str = $lc('操作')) {
837
+ // 提交前统一校验:意见是否必填、加签审批方式是否选择
838
+ validateBeforeSubmit() {
839
+ if (this.authList.includes('isShowOtherAtt')) {
840
+ const valid = this.$refs['showOtherAttNew']?.validate()
841
+ if (!valid) return false
842
+ }
843
+ if (this.requiredC && !this.messageC) {
844
+ this.errMsgFn(this.authList.includes('byAddTask') && this.addTaskList.length > 0 ? $lc('加签') : $lc('批准'))
845
+ return false
846
+ }
847
+ if (this.addTaskList.length > 0 && !this.addTaskType) {
848
+ this.addErrFn()
849
+ return false
850
+ }
851
+ return true
852
+ },
853
+ // 处理提交响应中的失败信息,返回 true 表示有失败
854
+ _handleFailMsg(data = {}, str = $lc('操作')) {
834
855
  let { failCount, failList = {} } = data
835
856
  if (failCount > 0) {
836
857
  if (Array.isArray(failList)) {
@@ -846,7 +867,13 @@ export default {
846
867
  } else {
847
868
  this.$message.error(str + $lc('失败'))
848
869
  }
849
- } else {
870
+ return true
871
+ }
872
+ return false
873
+ },
874
+ // 提交后的提示
875
+ thenMsg(data = {}, str = $lc('操作')) {
876
+ if (!this._handleFailMsg(data, str)) {
850
877
  this.$emit('afterFn', str)
851
878
  this.$message.success(str + $lc('成功'))
852
879
  setTimeout(this.goFrom, 300)
@@ -870,8 +897,17 @@ export default {
870
897
  if (!bFn) {
871
898
  callFn()
872
899
  } else {
873
- let F = bFn(callFn)
874
- F.then && F.then(callFn)
900
+ let called = false
901
+ let wrappedCallFn = () => {
902
+ if (!called) {
903
+ called = true
904
+ callFn()
905
+ }
906
+ }
907
+ let F = bFn(wrappedCallFn)
908
+ if (F && F.then && typeof F.then === 'function') {
909
+ F.then(wrappedCallFn)
910
+ }
875
911
  }
876
912
  },
877
913
  // 查询是否配置 允许不重走流程
@@ -888,7 +924,6 @@ export default {
888
924
  )
889
925
  return code === 200 && data
890
926
  } catch (error) {
891
- console.error('查询是否配置允许不重走流程接口错误:', error)
892
927
  return false
893
928
  }
894
929
  },
@@ -963,14 +998,7 @@ export default {
963
998
  },
964
999
 
965
1000
  async checkFlowFn() {
966
- if (this.requiredC && !this.messageC) {
967
- return this.errMsgFn(
968
- this.authList.includes('byAddTask') && this.addTaskList.length > 0 ? $lc('加签') : $lc('批准')
969
- )
970
- }
971
- if (this.addTaskList.length > 0 && !this.addTaskType) {
972
- return this.addErrFn()
973
- }
1001
+ if (!this.validateBeforeSubmit()) return
974
1002
  let { isCheck, taskId, appNo, groupNo, typeCode, orderId, isAgentcy } = this.$route.query
975
1003
  this.isWyfk = ['PUBLIC_PAYMENT', 'BATCH_PERSON_PAYMENT'].includes(typeCode)
976
1004
  if (isCheck === '1' && this.isCheck) {
@@ -1026,14 +1054,7 @@ export default {
1026
1054
  },
1027
1055
  // 审批
1028
1056
  approvalFn() {
1029
- if (this.requiredC && !this.messageC) {
1030
- return this.errMsgFn(
1031
- this.authList.includes('byAddTask') && this.addTaskList.length > 0 ? $lc('加签') : $lc('批准')
1032
- )
1033
- }
1034
- if (this.addTaskList.length > 0 && !this.addTaskType) {
1035
- return this.addErrFn()
1036
- }
1057
+ if (!this.validateBeforeSubmit()) return
1037
1058
  axios.post('/bems/activiti/admin/todo/advance', this.getParam()).then(({ data }) => {
1038
1059
  this.thenMsg(
1039
1060
  data,
@@ -1042,33 +1063,11 @@ export default {
1042
1063
  })
1043
1064
  },
1044
1065
  approvalNext() {
1045
- if (this.requiredC && !this.messageC) {
1046
- return this.errMsgFn(
1047
- this.authList.includes('byAddTask') && this.addTaskList.length > 0 ? $lc('加签') : $lc('批准')
1048
- )
1049
- }
1050
- if (this.addTaskList.length > 0 && !this.addTaskType) {
1051
- return this.addErrFn()
1052
- }
1066
+ if (!this.validateBeforeSubmit()) return
1053
1067
 
1054
1068
  this.beforeFn(this.beforeRatify, () => {
1055
1069
  axios.post('/bems/activiti/admin/todo/advance', this.getParam()).then(({ data }) => {
1056
- let { failCount, failList = {} } = data
1057
- if (failCount > 0) {
1058
- if (Array.isArray(failList)) {
1059
- let _failList = {}
1060
- failList.forEach((f = {}) => {
1061
- Object.assign(_failList, f)
1062
- })
1063
- failList = _failList
1064
- }
1065
- let errArr = Object.values(failList)
1066
- if (errArr.length > 0) {
1067
- this.$message.error(errArr.join('、'))
1068
- } else {
1069
- this.$message.error($lc('审批失败'))
1070
- }
1071
- } else {
1070
+ if (!this._handleFailMsg(data, $lc('审批'))) {
1072
1071
  this.$message.success($lc('审批成功'))
1073
1072
  closeTagsForBackPage()
1074
1073
  this.getTodoList().finally(() => {
@@ -1137,14 +1136,6 @@ export default {
1137
1136
 
1138
1137
  this.setCarboncopyV = false
1139
1138
  },
1140
- setAddtaskClose() {
1141
- this.setAddtaskV = false
1142
- if (this._pendingAddTaskTip) {
1143
- const callback = this._pendingAddTaskTip
1144
- this._pendingAddTaskTip = null
1145
- callback()
1146
- }
1147
- },
1148
1139
  setAddtaskOk(list) {
1149
1140
  this.addTaskList = list
1150
1141
  if (this.addTaskList.length > 0 && !this.addTaskType) {
@@ -1156,23 +1147,6 @@ export default {
1156
1147
  }
1157
1148
 
1158
1149
  this.setAddtaskV = false
1159
-
1160
- // 加签提示场景:未选择被加签人时,弹窗确认是否向后加签
1161
- if (this._pendingAddTaskTip) {
1162
- const callback = this._pendingAddTaskTip
1163
- this._pendingAddTaskTip = null
1164
- if (this.addTaskList.length === 0) {
1165
- this.$confirm('请检查是否向后加签', $lc('提示'), {
1166
- confirmButtonText: $lc('确定'),
1167
- cancelButtonText: $lc('取消'),
1168
- type: 'warning'
1169
- }).then(() => {
1170
- callback()
1171
- }).catch(() => {})
1172
- } else {
1173
- callback()
1174
- }
1175
- }
1176
1150
  },
1177
1151
  getFileDtos(fileList) {
1178
1152
  return fileList.map((file) => {
@@ -893,6 +893,10 @@ export default {
893
893
  },
894
894
 
895
895
  async checkFlowFn() {
896
+ if (this.authList.includes('isShowOtherAtt')) {
897
+ const valid = this.$refs['showOtherAttNew']?.validate()
898
+ if (!valid) return
899
+ }
896
900
  if (this.requiredC && !this.messageC) {
897
901
  return this.errMsgFn(
898
902
  this.authList.includes('byAddTask') && this.addTaskList.length > 0 ? $lc('加签') : $lc('批准')
@@ -956,6 +960,10 @@ export default {
956
960
  },
957
961
  // 审批
958
962
  approvalFn() {
963
+ if (this.authList.includes('isShowOtherAtt')) {
964
+ const valid = this.$refs['showOtherAttNew']?.validate()
965
+ if (!valid) return
966
+ }
959
967
  if (this.requiredC && !this.messageC) {
960
968
  return this.errMsgFn(
961
969
  this.authList.includes('byAddTask') && this.addTaskList.length > 0 ? $lc('加签') : $lc('批准')
@@ -972,6 +980,10 @@ export default {
972
980
  })
973
981
  },
974
982
  approvalNext() {
983
+ if (this.authList.includes('isShowOtherAtt')) {
984
+ const valid = this.$refs['showOtherAttNew']?.validate()
985
+ if (!valid) return
986
+ }
975
987
  if (this.requiredC && !this.messageC) {
976
988
  return this.errMsgFn(
977
989
  this.authList.includes('byAddTask') && this.addTaskList.length > 0 ? $lc('加签') : $lc('批准')
@@ -21,6 +21,13 @@
21
21
  class="input-w"
22
22
  clearable
23
23
  />
24
+ <el-input
25
+ v-if="['12'].includes(item.cfgType)"
26
+ v-model="item.cfgVal"
27
+ :type="'textarea'"
28
+ placeholder="请输入"
29
+ clearable
30
+ />
24
31
  <el-select
25
32
  v-if="['21'].includes(item.cfgType)"
26
33
  v-model="item.cfgVal"
@@ -58,20 +65,13 @@
58
65
  placeholder="选择日期"
59
66
  />
60
67
  </el-form-item>
61
- <el-input
62
- v-if="['12'].includes(item.cfgType)"
63
- v-model="item.cfgVal"
64
- :type="'textarea'"
65
- placeholder="请输入"
66
- class="w-100p m-r-s m-b-s flex-1"
67
- clearable
68
- />
69
- <el-input
68
+ <el-form-item
70
69
  v-if="item.cfgHasRemark === '1' && !['11', '12'].includes(item.cfgType)"
71
- v-model="item.cfgRemark"
72
- class="w-100p m-r-lg m-b-s flex-1"
73
- placeholder="请输入备注"
74
- />
70
+ class="m-r-ss m-b-s flex-1"
71
+ label="备注"
72
+ >
73
+ <el-input v-model="item.cfgRemark" class="input-w" placeholder="请输入备注" />
74
+ </el-form-item>
75
75
  </div>
76
76
  </div>
77
77
  </template>
@@ -110,19 +110,45 @@ export default {
110
110
  mounted() {
111
111
  this.getData(this.otherAttDataA)
112
112
  },
113
+ watch: {
114
+ otherAttDataA: {
115
+ handler(val) {
116
+ this.getData(val)
117
+ },
118
+ deep: true
119
+ }
120
+ },
113
121
  methods: {
122
+ initItem(item) {
123
+ if (['32'].includes(item.cfgType)) {
124
+ this.$set(item, 'checkList', item.checkList || [])
125
+ }
126
+ if (['31'].includes(item.cfgType)) {
127
+ this.$set(item, 'selectList', item.selectList || [])
128
+ }
129
+ if (item.cfgHasRemark === '1' && item.cfgRemark === undefined) {
130
+ this.$set(item, 'cfgRemark', '')
131
+ }
132
+ if (item.cfgVal === undefined) {
133
+ this.$set(item, 'cfgVal', '')
134
+ }
135
+ this.setDefaultValue(item)
136
+ return item
137
+ },
114
138
  setDefaultValue(item) {
115
139
  const defaultTypes = ['22', '21', '31', '32']
116
140
  // 不满足条件的直接返回
117
- if (!defaultTypes.includes(item.cfgType) || item.cfgVal) return
118
-
141
+ if (!defaultTypes.includes(item.cfgType) || item.cfgVal) {
142
+ item.cfgVal = item.cfgVal || ''
143
+ return
144
+ }
119
145
  try {
120
146
  // 解析cfgJson,获取默认选项
121
147
  const cfgJson = JSON.parse(item.cfgJson || '[]')
122
148
  const defaultItems = cfgJson.filter((row) => row.isDefault === '1')
123
- if (!defaultItems.length) return
149
+ if (!defaultItems?.length) return
124
150
  // 获取默认选项的code值
125
- const defaultCodes = defaultItems.map((row) => row.code)
151
+ const defaultCodes = defaultItems?.map((row) => row.code)
126
152
  if (['22', '21'].includes(item.cfgType)) {
127
153
  item.cfgVal = defaultCodes[0]
128
154
  item.cfgText = defaultItems[0]?.value
@@ -136,27 +162,17 @@ export default {
136
162
  }
137
163
  }
138
164
  } catch (e) {
139
- // JSON解析失败时忽略
165
+ console.error('解析cfgJson失败', e)
140
166
  }
141
167
  },
142
168
  getData(data) {
143
- if (data.length) {
144
- this.otherAttData = data
169
+ if (data?.length) {
170
+ this.otherAttData = data.map((item) => this.initItem(item))
145
171
  }
146
172
  if (this.taskId) {
147
173
  axios.post(`/bems/admin/customization/${this.taskId}`, null, { loading: false }).then(({ data }) => {
148
174
  if (data && data.length) {
149
- this.otherAttData =
150
- data?.map((item) => {
151
- if (['32'].includes(item.cfgType)) {
152
- item.checkList = item.checkList ? item.checkList : []
153
- }
154
- if (['31'].includes(item.cfgType)) {
155
- item.selectList = item.selectList ? item.selectList : []
156
- }
157
- this.setDefaultValue(item)
158
- return item
159
- }) || []
175
+ this.otherAttData = data?.map((item) => this.initItem(item)) || []
160
176
  }
161
177
  })
162
178
  }
@@ -187,6 +203,33 @@ export default {
187
203
  cfgRemark: item.cfgRemark
188
204
  }
189
205
  })
206
+ },
207
+ validate() {
208
+ if (!this.required) return true
209
+ for (const item of this.otherAttData) {
210
+ let isEmpty = false
211
+ if (['11', '12', '21', '22', '33'].includes(item.cfgType)) {
212
+ isEmpty = !item.cfgVal && item.cfgVal !== 0
213
+ } else if (item.cfgType === '31') {
214
+ isEmpty = !item.selectList || item.selectList?.length === 0
215
+ } else if (item.cfgType === '32') {
216
+ isEmpty = !item.checkList || item.checkList?.length === 0
217
+ }
218
+ if (isEmpty) {
219
+ this.$message.warning(`请填写${item.cfgName}`)
220
+ return false
221
+ }
222
+ if (
223
+ item.cfgHasRemark === '1' &&
224
+ !['11', '12'].includes(item.cfgType) &&
225
+ !item.cfgRemark &&
226
+ item.cfgRemark !== 0
227
+ ) {
228
+ this.$message.warning(`请填写${item.cfgName}备注`)
229
+ return false
230
+ }
231
+ }
232
+ return true
190
233
  }
191
234
  }
192
235
  }
@@ -121,33 +121,7 @@ vxeTable.formats.mixin({
121
121
  }
122
122
  }
123
123
  })
124
- // 创建一个简单的输入框筛选
125
- /* vxeTable.renderer.add('FilterInput', {
126
- // 筛选模板
127
- renderFilter(h, renderOpts, params) {
128
- const { data } = params
129
- return <el-input v-model='data' placeholder='' size='mini'></el-input>
130
- },
131
- // 重置数据方法
132
- filterResetMethod({ options }) {
133
- options.forEach((option) => {
134
- option.data = ''
135
- })
136
- },
137
- // 重置筛选复原方法(当未点击确认时,该选项将被恢复为默认值)
138
- filterRecoverMethod({ option }) {
139
- option.data = ''
140
- },
141
- // 筛选方法
142
- filterMethod({ option, row, column }) {
143
- const { data } = option
144
- const cellValue = row[column.property]
145
- if (cellValue) {
146
- return cellValue.indexOf(data) > -1
147
- }
148
- return false
149
- }
150
- }) */
124
+
151
125
  function install(Vue) {
152
126
  Vue.use(vxeTable)
153
127
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div style="height: 100%; position: relative">
2
+ <div class="v2-table-pro-wrapper" style="height: 100%; position: relative">
3
3
  <vxe-table
4
4
  ref="vxeTable"
5
5
  :key="colsKey"
@@ -472,8 +472,8 @@ export default {
472
472
  let canCheck = true
473
473
  if (typeof this.forbidSelect === 'function') {
474
474
  const forbidResult = this.forbidSelect({ row })
475
- // 只有当 forbidSelect 明确返回 true 时,才禁止勾选
476
- canCheck = forbidResult !== true
475
+ // 只有当 forbidSelect 明确返回 true 时才允许勾选
476
+ canCheck = forbidResult !== false
477
477
  }
478
478
 
479
479
  if (canCheck) {