n20-common-lib 2.22.23 → 2.22.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.22.23",
3
+ "version": "2.22.24",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -192,8 +192,13 @@
192
192
  >{{ '审查意见:' | $lc }} <i class="n20-icon-shouqizhedie f-s-m"></i
193
193
  ></span>
194
194
  <div v-show="showFlowHistoryChild" class="n20-description-bgc p-a-s">
195
- <div v-for="(s, i) in row.flowHistoryCfgs" :key="i">
196
- {{ s.cfgName }}:{{ s.cfgText ? s.cfgText : s.cfgVal }}
195
+ <div
196
+ v-for="(s, i) in row.flowHistoryCfgs"
197
+ :key="i"
198
+ :class="{ 'flex-box': align === 'left-right' }"
199
+ :style="align === 'left-right' ? 'justify-content: space-between' : ''"
200
+ >
201
+ <span>{{ s.cfgName }}:</span><span>{{ s.cfgText ? s.cfgText : s.cfgVal }}</span>
197
202
  </div>
198
203
  </div>
199
204
  </div>
@@ -266,8 +271,16 @@
266
271
  >{{ '审查意见:' | $lc }}<i class="n20-icon-shouqizhedie f-s-m"></i
267
272
  ></span>
268
273
  <div v-show="showFlowHistory" class="n20-description-bgc p-a-s">
269
- <div v-for="(s, i) in item.flowHistoryCfgs" :key="i" class="p-b-s">
270
- <div>{{ s.cfgName }}:{{ s.cfgText ? s.cfgText : s.cfgVal }}</div>
274
+ <div
275
+ v-for="(s, i) in item.flowHistoryCfgs"
276
+ :key="i"
277
+ class="p-b-s"
278
+ :class="{ 'flex-box': align === 'left-right' }"
279
+ :style="align === 'left-right' ? 'justify-content: space-between' : ''"
280
+ >
281
+ <div>
282
+ <span>{{ s.cfgName }}:</span><span>{{ s.cfgText ? s.cfgText : s.cfgVal }}</span>
283
+ </div>
271
284
  <div>{{ s.cfgRemark }}</div>
272
285
  </div>
273
286
  </div>
@@ -412,6 +425,10 @@ export default {
412
425
  hideLoading: {
413
426
  type: Boolean,
414
427
  default: false
428
+ },
429
+ align: {
430
+ type: String,
431
+ default: 'left-right'
415
432
  }
416
433
  },
417
434
  data() {
@@ -21,6 +21,7 @@
21
21
  class="p-a"
22
22
  :proc-inst-id="procInstIdC"
23
23
  style="height: 70vh; overflow: auto"
24
+ :align="align"
24
25
  />
25
26
  </el-dialog>
26
27
  <el-dialog
@@ -40,7 +41,7 @@
40
41
  <template slot="tips">
41
42
  <el-button size="mini" plain @click="imgV = true">{{ '流程图查看' | $lc }}</el-button>
42
43
  </template>
43
- <approvalCard :api-prefix="apiPrefix" :proc-inst-id="procInstIdC" />
44
+ <approvalCard :api-prefix="apiPrefix" :proc-inst-id="procInstIdC" :align="align" />
44
45
  <el-dialog
45
46
  v-drag
46
47
  :title="'查看流程' | $lc"
@@ -80,6 +81,10 @@ export default {
80
81
  buttonMode: {
81
82
  type: Boolean,
82
83
  default: true
84
+ },
85
+ align: {
86
+ type: String,
87
+ default: 'left-right'
83
88
  }
84
89
  },
85
90
  data() {
@@ -117,77 +117,108 @@ export default {
117
117
  },
118
118
  methods: {
119
119
  /**
120
- *
121
- * @param typeCode {String} 业务类型编码
120
+ * 获取办理意见配置
121
+ * @param {String} typeCode - 业务类型编码
122
+ * @param {String} procInstId - 流程实例ID,用于回显历史数据
122
123
  */
123
124
  async getHandlingAdvice(typeCode, procInstId) {
124
125
  try {
125
- const { code, data } = await axios.post(
126
- `/bems/activiti/admin/todo/isFlowStartWithOptions`,
127
- { typeCode },
128
- {
129
- noMsg: true
130
- }
131
- )
132
- // data.whether = true
133
- // data.optionsRequired = true
134
-
135
- if (code === 200) {
136
- this.otherAttDataA = data.customizationList || []
137
- this.whether = data.whether
138
- this.optionsRequired = data.optionsRequired
139
- if (data.optionsRequired) {
140
- this.placeholder = '请选择或输入意见(必填)'
141
- } else {
142
- this.placeholder = '请选择或输入意见(选填)'
143
- }
144
- this.visible = data.whether === true || this.otherAttDataA.length > 0
145
- this.flowOptions = data?.opinions?.map((d) => {
146
- return {
147
- label: d,
148
- value: d
149
- }
150
- })
151
- if (!data.whether && this.afterGetConf && this.otherAttDataA.length === 0) {
152
- this.afterGetConf()
153
- }
154
- }
155
- // 回显操作
126
+ // 1. 获取办理意见配置
127
+ await this.fetchHandlingAdviceConfig(typeCode)
128
+
129
+ // 2. 回显历史数据(编辑场景)
156
130
  if (procInstId) {
157
- const { data: data1 } = await axios.get(
158
- `/bems/activiti/sample/getStartEventFlowHistory/${procInstId}`,
159
- {},
160
- {
161
- noMsg: true
162
- }
163
- )
164
- this.reason = data1?.suggestion || ''
165
- this.reasonSelect = data1?.suggestion || ''
166
- if (data1 && data1.flowHistoryCfgs && data1.flowHistoryCfgs.length > 0) {
167
- this.otherAttDataA = this.otherAttDataA.map((item) => {
168
- const bcData = data1.flowHistoryCfgs.find((item2) => {
169
- return item2.cfgKey === item.cfgKey
170
- })
171
- return {
172
- ...item,
173
- cfgVal: ['31'].includes(item.cfgType) ? bcData.cfgVal.split(',') : bcData.cfgVal,
174
- cfgText: ['31'].includes(item.cfgType) ? bcData.cfgText && bcData.cfgText.split(',') : bcData.cfgText,
175
- selectList: ['31'].includes(item.cfgType) ? bcData.cfgVal.split(',') : undefined,
176
- checkList: ['32'].includes(item.cfgType) ? bcData.cfgVal.split(',') : undefined,
177
- cfgHasRemark: bcData.cfgHasRemark,
178
- cfgRemark: bcData.cfgRemark
179
- }
180
- })
181
- }
131
+ await this.loadFlowHistory(procInstId)
182
132
  }
183
- // 重新执行一次 使数据更新
184
- this.$refs.showOtherAttNew && this.$refs.showOtherAttNew.getData(this.otherAttDataA)
133
+
134
+ // 3. 更新子组件数据
135
+ this.updateOtherAttData()
185
136
  } catch (error) {
186
- if (this.afterGetConf) {
187
- this.afterGetConf()
188
- }
137
+ // 异常时执行回调
138
+ this.afterGetConf?.()
189
139
  }
190
140
  },
141
+
142
+ /** 获取办理意见配置接口 */
143
+ async fetchHandlingAdviceConfig(typeCode) {
144
+ const { code, data } = await axios.post(
145
+ `/bems/activiti/admin/todo/isFlowStartWithOptions`,
146
+ { typeCode },
147
+ { noMsg: true }
148
+ )
149
+
150
+ if (code !== 200) return
151
+
152
+ // 设置自定义项列表
153
+ this.otherAttDataA = data.customizationList || []
154
+ // 是否显示意见输入
155
+ this.whether = data.whether
156
+ // 意见是否必填
157
+ this.optionsRequired = data.optionsRequired
158
+
159
+ // 设置占位提示
160
+ this.placeholder = data.optionsRequired ? '请选择或输入意见(必填)' : '请选择或输入意见(选填)'
161
+ // 显示弹窗条件:需要输入意见 或 存在自定义项
162
+ this.visible = data.whether === true || this.otherAttDataA.length > 0
163
+ // 转换意见选项为下拉格式
164
+ this.flowOptions = data?.opinions?.map((d) => ({ label: d, value: d })) || []
165
+
166
+ // 无需弹窗时直接执行回调
167
+ if (!data.whether && this.afterGetConf && this.otherAttDataA.length === 0) {
168
+ this.afterGetConf()
169
+ }
170
+ },
171
+
172
+ /** 加载流程历史数据用于回显 */
173
+ async loadFlowHistory(procInstId) {
174
+ const { data: historyData } = await axios.get(
175
+ `/bems/activiti/sample/getStartEventFlowHistory/${procInstId}`,
176
+ {},
177
+ { noMsg: true }
178
+ )
179
+
180
+ // 回显意见内容
181
+ this.reason = historyData?.suggestion || ''
182
+ this.reasonSelect = historyData?.suggestion || ''
183
+
184
+ // 回显自定义项数据
185
+ if (historyData?.flowHistoryCfgs?.length > 0) {
186
+ this.otherAttDataA = this.mergeHistoryToCustomization(historyData.flowHistoryCfgs)
187
+ }
188
+ },
189
+
190
+ /** 将历史数据合并到自定义项配置 */
191
+ mergeHistoryToCustomization(flowHistoryCfgs) {
192
+ const CFG_TYPE = {
193
+ MULTI_SELECT: '31', // 多选下拉
194
+ CHECKBOX: '32' // 复选框
195
+ }
196
+
197
+ return this.otherAttDataA.map((item) => {
198
+ const historyItem = flowHistoryCfgs.find((h) => h.cfgKey === item.cfgKey)
199
+ if (!historyItem) return item
200
+
201
+ const isMultiSelect = item.cfgType === CFG_TYPE.MULTI_SELECT
202
+ const isCheckbox = item.cfgType === CFG_TYPE.CHECKBOX
203
+ const cfgValArray = historyItem.cfgVal?.split(',') || []
204
+ const cfgTextArray = historyItem.cfgText?.split(',') || []
205
+
206
+ return {
207
+ ...item,
208
+ cfgVal: isMultiSelect ? cfgValArray : historyItem.cfgVal,
209
+ cfgText: isMultiSelect ? cfgTextArray : historyItem.cfgText,
210
+ selectList: isMultiSelect ? cfgValArray : undefined,
211
+ checkList: isCheckbox ? cfgValArray : undefined,
212
+ cfgHasRemark: historyItem.cfgHasRemark,
213
+ cfgRemark: historyItem.cfgRemark
214
+ }
215
+ })
216
+ },
217
+
218
+ /** 更新子组件数据 */
219
+ updateOtherAttData() {
220
+ this.$refs.showOtherAttNew?.getData(this.otherAttDataA)
221
+ },
191
222
  changeReasonSelect(val) {
192
223
  this.reason = val
193
224
  },