n20-common-lib 2.22.25 → 2.22.27

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.25",
3
+ "version": "2.22.27",
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;
@@ -5,9 +5,9 @@
5
5
  <ExpandablePane
6
6
  v-if="taskId && showBtn && authList.includes('isShowOtherAtt')"
7
7
  title="自定义项"
8
- :default-expand="false"
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="right" label-width="12em">
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
@@ -454,6 +454,10 @@ export default {
454
454
  beforeDiscard: {
455
455
  type: Function,
456
456
  default: undefined
457
+ },
458
+ otherExpand: {
459
+ type: Boolean,
460
+ default: true
457
461
  }
458
462
  },
459
463
  data() {
@@ -595,24 +599,24 @@ export default {
595
599
  }
596
600
  }
597
601
  // addTaskTip 是否给出加签提示
598
- if (res.code === 200 && res.data && res.data.addTaskTip) {
599
- this.$confirm('请确定是否向后加签', $lc('提示'), {
602
+ if (res.code === 200 && res.data && res.data.addTaskTip && !this.addTaskList.length) {
603
+ this.$confirm('请检查是否向后加签', $lc('提示'), {
600
604
  confirmButtonText: $lc('确定'),
601
605
  cancelButtonText: $lc('取消'),
602
606
  type: 'warning'
603
- }).then(handleResult)
607
+ })
608
+ .then(handleResult)
609
+ .catch(() => {})
604
610
  } else {
605
611
  handleResult()
606
612
  }
607
613
  } catch (error) {
608
- console.log(error)
609
614
  this.checkFlowFn()
610
615
  }
611
616
  })
612
617
  },
613
618
  // 选择审批人
614
619
  selectSprListFn(data) {
615
- console.log(data)
616
620
  this.nextEgwOutgoingNodeId = data.nextEgwOutgoingNodeId
617
621
  this.nextNodeApproveUnos = data.nextNodeApproveUnos
618
622
  this.setSpr = false
@@ -636,7 +640,6 @@ export default {
636
640
  this.IsShowUploadWidget = data
637
641
  }
638
642
  }
639
- console.log(code, data)
640
643
  },
641
644
  // 意见是否必填
642
645
  getConfiguration() {
@@ -644,13 +647,11 @@ export default {
644
647
  .then(({ opinionRequired, showApproveTo }) => {
645
648
  this.requiredC = opinionRequired ?? this.required
646
649
  this.showApproveTo = showApproveTo ?? true
647
- // 读取该工作流是否意见必填
648
- if (this.$route.query.remarkIsMust !== undefined) {
649
- this.requiredC = this.$route.query.remarkIsMust === '1'
650
- }
651
650
  })
652
651
  .catch(() => {
653
652
  this.requiredC = this.required
653
+ })
654
+ .finally(() => {
654
655
  // 读取该工作流是否意见必填
655
656
  if (this.$route.query.remarkIsMust !== undefined) {
656
657
  this.requiredC = this.$route.query.remarkIsMust === '1'
@@ -658,15 +659,20 @@ export default {
658
659
  })
659
660
  },
660
661
  getTodoList() {
661
- return new Promise((resolve, reject) => {
662
+ return new Promise((resolve) => {
662
663
  const dto = JSON.parse(sessionStorage.getItem(`approvalDto`))
663
- axios.post('/bems/activiti/admin/todo/todo', dto).then(({ data, code }) => {
664
- if (code === 200) {
665
- const { list } = data
666
- 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
+ }
667
671
  resolve({ data, code })
668
- }
669
- })
672
+ })
673
+ .catch(() => {
674
+ resolve({ data: {}, code: -1 })
675
+ })
670
676
  })
671
677
  },
672
678
  // 获取加签方式的模式
@@ -828,8 +834,24 @@ export default {
828
834
  setParam(obj) {
829
835
  Object.assign(this.otherAtt, obj)
830
836
  },
831
- // 提交后的提示
832
- 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('操作')) {
833
855
  let { failCount, failList = {} } = data
834
856
  if (failCount > 0) {
835
857
  if (Array.isArray(failList)) {
@@ -845,7 +867,13 @@ export default {
845
867
  } else {
846
868
  this.$message.error(str + $lc('失败'))
847
869
  }
848
- } else {
870
+ return true
871
+ }
872
+ return false
873
+ },
874
+ // 提交后的提示
875
+ thenMsg(data = {}, str = $lc('操作')) {
876
+ if (!this._handleFailMsg(data, str)) {
849
877
  this.$emit('afterFn', str)
850
878
  this.$message.success(str + $lc('成功'))
851
879
  setTimeout(this.goFrom, 300)
@@ -869,8 +897,17 @@ export default {
869
897
  if (!bFn) {
870
898
  callFn()
871
899
  } else {
872
- let F = bFn(callFn)
873
- 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
+ }
874
911
  }
875
912
  },
876
913
  // 查询是否配置 允许不重走流程
@@ -887,7 +924,6 @@ export default {
887
924
  )
888
925
  return code === 200 && data
889
926
  } catch (error) {
890
- console.error('查询是否配置允许不重走流程接口错误:', error)
891
927
  return false
892
928
  }
893
929
  },
@@ -962,14 +998,7 @@ export default {
962
998
  },
963
999
 
964
1000
  async checkFlowFn() {
965
- if (this.requiredC && !this.messageC) {
966
- return this.errMsgFn(
967
- this.authList.includes('byAddTask') && this.addTaskList.length > 0 ? $lc('加签') : $lc('批准')
968
- )
969
- }
970
- if (this.addTaskList.length > 0 && !this.addTaskType) {
971
- return this.addErrFn()
972
- }
1001
+ if (!this.validateBeforeSubmit()) return
973
1002
  let { isCheck, taskId, appNo, groupNo, typeCode, orderId, isAgentcy } = this.$route.query
974
1003
  this.isWyfk = ['PUBLIC_PAYMENT', 'BATCH_PERSON_PAYMENT'].includes(typeCode)
975
1004
  if (isCheck === '1' && this.isCheck) {
@@ -1025,14 +1054,7 @@ export default {
1025
1054
  },
1026
1055
  // 审批
1027
1056
  approvalFn() {
1028
- if (this.requiredC && !this.messageC) {
1029
- return this.errMsgFn(
1030
- this.authList.includes('byAddTask') && this.addTaskList.length > 0 ? $lc('加签') : $lc('批准')
1031
- )
1032
- }
1033
- if (this.addTaskList.length > 0 && !this.addTaskType) {
1034
- return this.addErrFn()
1035
- }
1057
+ if (!this.validateBeforeSubmit()) return
1036
1058
  axios.post('/bems/activiti/admin/todo/advance', this.getParam()).then(({ data }) => {
1037
1059
  this.thenMsg(
1038
1060
  data,
@@ -1041,33 +1063,11 @@ export default {
1041
1063
  })
1042
1064
  },
1043
1065
  approvalNext() {
1044
- if (this.requiredC && !this.messageC) {
1045
- return this.errMsgFn(
1046
- this.authList.includes('byAddTask') && this.addTaskList.length > 0 ? $lc('加签') : $lc('批准')
1047
- )
1048
- }
1049
- if (this.addTaskList.length > 0 && !this.addTaskType) {
1050
- return this.addErrFn()
1051
- }
1066
+ if (!this.validateBeforeSubmit()) return
1052
1067
 
1053
1068
  this.beforeFn(this.beforeRatify, () => {
1054
1069
  axios.post('/bems/activiti/admin/todo/advance', this.getParam()).then(({ data }) => {
1055
- let { failCount, failList = {} } = data
1056
- if (failCount > 0) {
1057
- if (Array.isArray(failList)) {
1058
- let _failList = {}
1059
- failList.forEach((f = {}) => {
1060
- Object.assign(_failList, f)
1061
- })
1062
- failList = _failList
1063
- }
1064
- let errArr = Object.values(failList)
1065
- if (errArr.length > 0) {
1066
- this.$message.error(errArr.join('、'))
1067
- } else {
1068
- this.$message.error($lc('审批失败'))
1069
- }
1070
- } else {
1070
+ if (!this._handleFailMsg(data, $lc('审批'))) {
1071
1071
  this.$message.success($lc('审批成功'))
1072
1072
  closeTagsForBackPage()
1073
1073
  this.getTodoList().finally(() => {
@@ -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,14 @@
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
+ class="input-w"
30
+ clearable
31
+ />
24
32
  <el-select
25
33
  v-if="['21'].includes(item.cfgType)"
26
34
  v-model="item.cfgVal"
@@ -58,20 +66,17 @@
58
66
  placeholder="选择日期"
59
67
  />
60
68
  </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
69
+ <el-form-item
70
70
  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
- />
71
+ class="m-r-ss m-b-s flex-1"
72
+ label="备注"
73
+ >
74
+ <el-input
75
+ v-model="item.cfgRemark"
76
+ class="input-w"
77
+ placeholder="请输入备注"
78
+ />
79
+ </el-form-item>
75
80
  </div>
76
81
  </div>
77
82
  </template>
@@ -79,6 +84,7 @@
79
84
  <script>
80
85
  import axios from '../../utils/axios'
81
86
  export default {
87
+ name: 'ShowOtherAttrNew',
82
88
  props: {
83
89
  taskId: {
84
90
  type: [String, Number],
@@ -109,19 +115,45 @@ export default {
109
115
  mounted() {
110
116
  this.getData(this.otherAttDataA)
111
117
  },
118
+ watch: {
119
+ otherAttDataA: {
120
+ handler(val) {
121
+ this.getData(val)
122
+ },
123
+ deep: true
124
+ }
125
+ },
112
126
  methods: {
127
+ initItem(item) {
128
+ if (['32'].includes(item.cfgType)) {
129
+ this.$set(item, 'checkList', item.checkList || [])
130
+ }
131
+ if (['31'].includes(item.cfgType)) {
132
+ this.$set(item, 'selectList', item.selectList || [])
133
+ }
134
+ if (item.cfgHasRemark === '1' && item.cfgRemark === undefined) {
135
+ this.$set(item, 'cfgRemark', '')
136
+ }
137
+ if (item.cfgVal === undefined) {
138
+ this.$set(item, 'cfgVal', '')
139
+ }
140
+ this.setDefaultValue(item)
141
+ return item
142
+ },
113
143
  setDefaultValue(item) {
114
144
  const defaultTypes = ['22', '21', '31', '32']
115
145
  // 不满足条件的直接返回
116
- if (!defaultTypes.includes(item.cfgType) || item.cfgVal) return
117
-
146
+ if (!defaultTypes.includes(item.cfgType) || item.cfgVal) {
147
+ item.cfgVal = item.cfgVal || ''
148
+ return
149
+ }
118
150
  try {
119
151
  // 解析cfgJson,获取默认选项
120
152
  const cfgJson = JSON.parse(item.cfgJson || '[]')
121
153
  const defaultItems = cfgJson.filter((row) => row.isDefault === '1')
122
- if (!defaultItems.length) return
154
+ if (!defaultItems?.length) return
123
155
  // 获取默认选项的code值
124
- const defaultCodes = defaultItems.map((row) => row.code)
156
+ const defaultCodes = defaultItems?.map((row) => row.code)
125
157
  if (['22', '21'].includes(item.cfgType)) {
126
158
  item.cfgVal = defaultCodes[0]
127
159
  item.cfgText = defaultItems[0]?.value
@@ -135,27 +167,17 @@ export default {
135
167
  }
136
168
  }
137
169
  } catch (e) {
138
- // JSON解析失败时忽略
170
+ console.error('解析cfgJson失败', e)
139
171
  }
140
172
  },
141
173
  getData(data) {
142
- if (data.length) {
143
- this.otherAttData = data
174
+ if (data?.length) {
175
+ this.otherAttData = data.map((item) => this.initItem(item))
144
176
  }
145
177
  if (this.taskId) {
146
178
  axios.post(`/bems/admin/customization/${this.taskId}`, null, { loading: false }).then(({ data }) => {
147
179
  if (data && data.length) {
148
- this.otherAttData =
149
- data?.map((item) => {
150
- if (['32'].includes(item.cfgType)) {
151
- item.checkList = item.checkList ? item.checkList : []
152
- }
153
- if (['31'].includes(item.cfgType)) {
154
- item.selectList = item.selectList ? item.selectList : []
155
- }
156
- this.setDefaultValue(item)
157
- return item
158
- }) || []
180
+ this.otherAttData = data?.map((item) => this.initItem(item)) || []
159
181
  }
160
182
  })
161
183
  }
@@ -186,6 +208,33 @@ export default {
186
208
  cfgRemark: item.cfgRemark
187
209
  }
188
210
  })
211
+ },
212
+ validate() {
213
+ if (!this.required) return true
214
+ for (const item of this.otherAttData) {
215
+ let isEmpty = false
216
+ if (['11', '12', '21', '22', '33'].includes(item.cfgType)) {
217
+ isEmpty = !item.cfgVal && item.cfgVal !== 0
218
+ } else if (item.cfgType === '31') {
219
+ isEmpty = !item.selectList || item.selectList?.length === 0
220
+ } else if (item.cfgType === '32') {
221
+ isEmpty = !item.checkList || item.checkList?.length === 0
222
+ }
223
+ if (isEmpty) {
224
+ this.$message.warning(`请填写${item.cfgName}`)
225
+ return false
226
+ }
227
+ if (
228
+ item.cfgHasRemark === '1' &&
229
+ !['11', '12'].includes(item.cfgType) &&
230
+ !item.cfgRemark &&
231
+ item.cfgRemark !== 0
232
+ ) {
233
+ this.$message.warning(`请填写${item.cfgName}备注`)
234
+ return false
235
+ }
236
+ }
237
+ return true
189
238
  }
190
239
  }
191
240
  }
@@ -198,7 +198,8 @@
198
198
  :class="{ 'flex-box': align === 'left-right' }"
199
199
  :style="align === 'left-right' ? 'justify-content: space-between' : ''"
200
200
  >
201
- <span>{{ s.cfgName }}:</span><span>{{ s.cfgText ? s.cfgText : s.cfgVal }}</span>
201
+ <span>{{ s.cfgName }}:</span
202
+ ><span>{{ s.cfgText ? s.cfgText : s.cfgVal }}{{ s.cfgRemark }}</span>
202
203
  </div>
203
204
  </div>
204
205
  </div>
@@ -278,10 +279,8 @@
278
279
  :class="{ 'flex-box': align === 'left-right' }"
279
280
  :style="align === 'left-right' ? 'justify-content: space-between' : ''"
280
281
  >
281
- <div>
282
- <span>{{ s.cfgName }}:</span><span>{{ s.cfgText ? s.cfgText : s.cfgVal }}</span>
283
- </div>
284
- <div>{{ s.cfgRemark }}</div>
282
+ <span>{{ s.cfgName }}:{{ s.cfgName }}:</span>
283
+ <span>{{ s.cfgText ? s.cfgText : s.cfgVal }}{{ s.cfgRemark }}</span>
285
284
  </div>
286
285
  </div>
287
286
  </div>
@@ -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) {