@nstc-business/imes 1.0.30 → 1.0.32

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": "@nstc-business/imes",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -2,6 +2,7 @@
2
2
  <div class="measure-eval-flat">
3
3
  <vxe-table
4
4
  border
5
+ class="v3-n20-table-pro"
5
6
  :data="rows"
6
7
  :row-config="{ keyField: '_rowKey' }"
7
8
  :scroll-y="{ enabled: false }"
@@ -173,7 +174,8 @@
173
174
  <vxe-column
174
175
  v-if="showModifyReasonCol"
175
176
  min-width="260"
176
- align="center"
177
+ align="left"
178
+ header-align="center"
177
179
  >
178
180
  <template #header>
179
181
  <div>
@@ -187,6 +189,7 @@
187
189
  <template #default="{ row }">
188
190
  <el-input
189
191
  v-if="showManualReason(row)"
192
+ class="reason-input"
190
193
  type="textarea"
191
194
  v-title
192
195
  :class="{ reasonRequireRed: manualReasonRed(row) }"
@@ -199,6 +202,7 @@
199
202
  />
200
203
  <el-input
201
204
  v-if="isQualFn(row)"
205
+ class="reason-input"
202
206
  type="textarea"
203
207
  v-title
204
208
  :show-overflow-tooltip="true"
@@ -211,6 +215,7 @@
211
215
  />
212
216
  <el-input
213
217
  v-else-if="showAdjustReason(row)"
218
+ class="reason-input"
214
219
  type="textarea"
215
220
  v-title
216
221
  :class="{ reasonRequireRed: adjustReasonRed(row) }"
@@ -411,6 +416,17 @@ export default {
411
416
  .full-w {
412
417
  width: 100%;
413
418
  }
419
+ .reason-input {
420
+ display: block;
421
+ width: 100%;
422
+ box-sizing: border-box;
423
+
424
+ ::v-deep .el-textarea__inner {
425
+ width: 100%;
426
+ box-sizing: border-box;
427
+ resize: vertical;
428
+ }
429
+ }
414
430
  .select-top {
415
431
  margin-top: 2px;
416
432
  height: 14px;
@@ -29,7 +29,7 @@
29
29
  <vxe-table
30
30
  v-show="isExpanded(index)"
31
31
  border
32
- class="qual-table"
32
+ class="qual-table v3-n20-table-pro"
33
33
  :data="group.children"
34
34
  :row-config="{ keyField: '_rowKey' }"
35
35
  :scroll-y="{ enabled: false }"
@@ -4,6 +4,7 @@
4
4
  <vxe-table
5
5
  v-else
6
6
  border
7
+ class="v3-n20-table-pro"
7
8
  :data="rows"
8
9
  :merge-cells="mergeCells"
9
10
  :row-config="{ keyField: '_rowKey' }"
@@ -2,7 +2,7 @@
2
2
  <vxe-table
3
3
  border
4
4
  ref="xTable"
5
- :class="['measure-tree-table', 'level-' + level]"
5
+ :class="['measure-tree-table', 'v3-n20-table-pro', 'level-' + level]"
6
6
  :row-config="{ keyField: '_rowKey' }"
7
7
  :data="nodes"
8
8
  :expand-config="{ lazy: false, visibleMethod: canExpand }"
@@ -202,7 +202,8 @@
202
202
  <vxe-column
203
203
  v-if="showModifyReasonCol"
204
204
  min-width="260"
205
- align="center"
205
+ align="left"
206
+ header-align="center"
206
207
  >
207
208
  <template #header>
208
209
  <div>
@@ -216,6 +217,7 @@
216
217
  <template #default="{ row }">
217
218
  <el-input
218
219
  v-if="showManualModifiedReasonFn(row)"
220
+ class="reason-input"
219
221
  type="textarea"
220
222
  v-title
221
223
  :class="{ reasonRequireRed: manualReasonRequireRedFn(row) }"
@@ -228,6 +230,7 @@
228
230
  />
229
231
  <el-input
230
232
  v-if="showAdjustModifiedReasonFn(row)"
233
+ class="reason-input"
231
234
  type="textarea"
232
235
  v-title
233
236
  :class="{ reasonRequireRed: adjustReasonRequireRedFn(row) }"
@@ -376,7 +379,8 @@
376
379
  <vxe-column
377
380
  v-if="showModifyReasonCol"
378
381
  min-width="260"
379
- align="center"
382
+ align="left"
383
+ header-align="center"
380
384
  >
381
385
  <template #header>
382
386
  <div>
@@ -390,6 +394,7 @@
390
394
  <template #default="{ row }">
391
395
  <el-input
392
396
  v-if="showManualModifiedReasonFn(row)"
397
+ class="reason-input"
393
398
  type="textarea"
394
399
  v-title
395
400
  :class="{ reasonRequireRed: manualReasonRequireRedFn(row) }"
@@ -402,6 +407,7 @@
402
407
  />
403
408
  <el-input
404
409
  v-if="showAdjustModifiedReasonFn(row)"
410
+ class="reason-input"
405
411
  type="textarea"
406
412
  v-title
407
413
  :class="{ reasonRequireRed: adjustReasonRequireRedFn(row) }"
@@ -750,6 +756,17 @@ export default {
750
756
  .full-w {
751
757
  width: 100%;
752
758
  }
759
+ .reason-input {
760
+ display: block;
761
+ width: 100%;
762
+ box-sizing: border-box;
763
+
764
+ ::v-deep .el-textarea__inner {
765
+ width: 100%;
766
+ box-sizing: border-box;
767
+ resize: vertical;
768
+ }
769
+ }
753
770
  .row-serial {
754
771
  color: #606266;
755
772
  font-variant-numeric: tabular-nums;
@@ -191,6 +191,42 @@
191
191
  </div>
192
192
  </div>
193
193
  <calculate-detail-dialog ref="calculateDetailDialog" />
194
+ <el-dialog
195
+ title="选择打印"
196
+ :visible.sync="printDialogVisible"
197
+ width="480px"
198
+ append-to-body
199
+ @closed="onPrintDialogClosed"
200
+ >
201
+ <el-form label-width="90px">
202
+ <el-form-item label="打印选项" required>
203
+ <el-select
204
+ v-model="selectedTemplateName"
205
+ placeholder="请选择"
206
+ clearable
207
+ filterable
208
+ :loading="printTemplateLoading"
209
+ style="width: 100%"
210
+ >
211
+ <el-option
212
+ v-for="item in printTemplateList"
213
+ :key="item.ptId || item.ptNo || item.ptName"
214
+ :label="item.ptName"
215
+ :value="item.ptName"
216
+ />
217
+ </el-select>
218
+ </el-form-item>
219
+ </el-form>
220
+ <div slot="footer" class="dialog-footer">
221
+ <el-button type="primary" size="small" :loading="printLoading" @click="confirmPrintDownload('download')">
222
+ 下载
223
+ </el-button>
224
+ <el-button type="primary" size="small" :loading="printLoading" @click="confirmPrintDownload('print')">
225
+ 打印
226
+ </el-button>
227
+ <el-button size="small" @click="printDialogVisible = false">取消</el-button>
228
+ </div>
229
+ </el-dialog>
194
230
  </div>
195
231
  </template>
196
232
 
@@ -341,6 +377,10 @@ export default {
341
377
  loading: false,
342
378
  calcLoading: false,
343
379
  printLoading: false,
380
+ printDialogVisible: false,
381
+ printTemplateList: [],
382
+ selectedTemplateName: '',
383
+ printTemplateLoading: false,
344
384
  model: { type: 1, name: '', code: '', digits: 2, modelTreeVO: {} },
345
385
  sections: [],
346
386
  anchorTabs: [],
@@ -1082,6 +1122,42 @@ export default {
1082
1122
  }
1083
1123
  },
1084
1124
  async printFn() {
1125
+ const logId = this.currentLogId()
1126
+ const modelId = this.currentModelId()
1127
+ if (!logId || !modelId) {
1128
+ this.$message.warning('请先完成测算后再打印')
1129
+ return
1130
+ }
1131
+ this.selectedTemplateName = ''
1132
+ this.printDialogVisible = true
1133
+ await this.loadPrintTemplates()
1134
+ },
1135
+ onPrintDialogClosed() {
1136
+ this.selectedTemplateName = ''
1137
+ },
1138
+ async loadPrintTemplates() {
1139
+ this.printTemplateLoading = true
1140
+ try {
1141
+ const ptType =
1142
+ this.model && this.model.type != null && this.model.type !== '' ? String(this.model.type) : undefined
1143
+ const res = await this.$axios.get(
1144
+ '/imes/print-template/list',
1145
+ ptType ? { ptType } : {},
1146
+ { loading: false }
1147
+ )
1148
+ const list = Array.isArray(res) ? res : (res && res.data) || []
1149
+ this.printTemplateList = Array.isArray(list) ? list : []
1150
+ } catch (e) {
1151
+ this.printTemplateList = []
1152
+ } finally {
1153
+ this.printTemplateLoading = false
1154
+ }
1155
+ },
1156
+ async confirmPrintDownload(action) {
1157
+ if (!this.selectedTemplateName) {
1158
+ this.$message.warning('请选择打印选项')
1159
+ return
1160
+ }
1085
1161
  const logId = this.currentLogId()
1086
1162
  const modelId = this.currentModelId()
1087
1163
  if (!logId || !modelId) {
@@ -1095,24 +1171,47 @@ export default {
1095
1171
  {
1096
1172
  ...extra,
1097
1173
  logId,
1098
- modelId
1174
+ modelId,
1175
+ templateName: this.selectedTemplateName
1099
1176
  }
1100
1177
  ])
1101
1178
  if (res.code !== 0) {
1102
- // this.$message.error(res.msg || '打印失败')
1103
1179
  return
1104
1180
  }
1105
- printJS({
1106
- printable: res.data,
1107
- type: 'pdf',
1108
- base64: true
1109
- })
1181
+ if (action === 'print') {
1182
+ printJS({
1183
+ printable: res.data,
1184
+ type: 'pdf',
1185
+ base64: true
1186
+ })
1187
+ } else {
1188
+ this.downloadPdfBase64(res.data)
1189
+ }
1190
+ this.printDialogVisible = false
1110
1191
  } catch (e) {
1111
- // this.$message.error('打印异常')
1192
+ // keep quiet consistent with previous print catch
1112
1193
  } finally {
1113
1194
  this.printLoading = false
1114
1195
  }
1115
1196
  },
1197
+ downloadPdfBase64(base64) {
1198
+ const pure = String(base64 || '').replace(/^data:application\/pdf;base64,/, '')
1199
+ const binary = atob(pure)
1200
+ const len = binary.length
1201
+ const bytes = new Uint8Array(len)
1202
+ for (let i = 0; i < len; i++) {
1203
+ bytes[i] = binary.charCodeAt(i)
1204
+ }
1205
+ const blob = new Blob([bytes], { type: 'application/pdf' })
1206
+ const url = URL.createObjectURL(blob)
1207
+ const a = document.createElement('a')
1208
+ a.href = url
1209
+ a.download = `${(this.model && this.model.code) || '测算结果'}.pdf`
1210
+ document.body.appendChild(a)
1211
+ a.click()
1212
+ document.body.removeChild(a)
1213
+ URL.revokeObjectURL(url)
1214
+ },
1116
1215
  hasPrintObj(val) {
1117
1216
  return val && typeof val === 'object' && Object.keys(val).length > 0
1118
1217
  },