vue2-client 1.9.90 → 1.9.92

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": "vue2-client",
3
- "version": "1.9.90",
3
+ "version": "1.9.92",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -11,8 +11,11 @@
11
11
  <a-button v-if="buttonState.move && buttonRendering('move')" type="primary" @click="move">
12
12
  <a-icon type="plus"/>添加
13
13
  </a-button>
14
- <a-button v-if="buttonState.choose && buttonRendering('choose')" :disabled="!isChoose" type="primary"
15
- @click="choose">
14
+ <a-button
15
+ v-if="buttonState.choose && buttonRendering('choose')"
16
+ :disabled="!isChoose"
17
+ type="primary"
18
+ @click="choose">
16
19
  <a-icon type="check-square"/>选择
17
20
  </a-button>
18
21
  <a-button
@@ -73,8 +76,10 @@
73
76
  <a-icon type="dashed" :style="iconStyle"/>
74
77
  {{ button.buttonName }}
75
78
  </a-button>
76
- <a-button v-if="allowedCardMode && !simpleMode" @click="changeViewMode"
77
- :type="isTableMode ? '' : 'primary'">
79
+ <a-button
80
+ v-if="allowedCardMode && !simpleMode"
81
+ @click="changeViewMode"
82
+ :type="isTableMode ? '' : 'primary'">
78
83
  看板模式
79
84
  </a-button>
80
85
  <!-- 头部附加栅格 -->
@@ -286,11 +291,11 @@
286
291
  </div>
287
292
  </template>
288
293
  <script>
289
- import {Ellipsis, STable} from '@vue2-client/components'
290
- import util, {formatDate, getChangedData, setDataByRealKey} from '@vue2-client/utils/util'
294
+ import { Ellipsis, STable } from '@vue2-client/components'
295
+ import util, { formatDate, getChangedData, setDataByRealKey } from '@vue2-client/utils/util'
291
296
  import XBadge from '@vue2-client/base-client/components/common/XBadge'
292
297
  import TableSetting from '@vue2-client/components/TableSetting/TableSetting'
293
- import {exportJson} from '@vue2-client/utils/excel/Export2Excel'
298
+ import { exportJson } from '@vue2-client/utils/excel/Export2Excel'
294
299
  import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
295
300
  import {
296
301
  exportData,
@@ -304,12 +309,12 @@ import {
304
309
  runLogic
305
310
  } from '@vue2-client/services/api/common'
306
311
  import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
307
- import {Modal} from 'ant-design-vue'
308
- import {mapState} from 'vuex'
309
- import {executeStrFunction, executeStrFunctionByContext} from '@vue2-client/utils/runEvalFunction'
312
+ import { Modal } from 'ant-design-vue'
313
+ import { mapState } from 'vuex'
314
+ import { executeStrFunction, executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
310
315
  import debounce from 'lodash.debounce'
311
316
  import XDataCard from '@vue2-client/base-client/components/common/XDataCard/XDataCard.vue'
312
- import {getRealKeyData} from '@vue2-client/utils/formatter'
317
+ import { getRealKeyData } from '@vue2-client/utils/formatter'
313
318
  import ReportTableHome from '../../../../pages/report/ReportTableHome.vue'
314
319
 
315
320
  export default {
@@ -326,7 +331,7 @@ export default {
326
331
  ReportTableHome
327
332
  },
328
333
  inject: ['getSelf'],
329
- data() {
334
+ data () {
330
335
  return {
331
336
  uniqueId: `x-table-${this._uid}`, // 使用 _uid 生成唯一 ID
332
337
  // 筛选列加载状态
@@ -491,7 +496,7 @@ export default {
491
496
  }
492
497
  },
493
498
  computed: {
494
- rowSelection() {
499
+ rowSelection () {
495
500
  return {
496
501
  selectedRowKeys: this.selectedRowKeys,
497
502
  onChange: this.onSelectChange,
@@ -503,38 +508,40 @@ export default {
503
508
  }),
504
509
  }
505
510
  },
506
- ...mapState('account', {currUser: 'user'}),
511
+ ...mapState('account', { currUser: 'user' }),
507
512
  ...mapState('setting', ['compatible'])
508
513
  },
509
- mounted() {
514
+ mounted () {
510
515
  window.addEventListener('resize', this.handleResize)
511
516
  },
512
- beforeDestroy() {
517
+ beforeDestroy () {
513
518
  window.removeEventListener('resize', this.handleResize)
514
519
  },
515
520
  methods: {
516
- columnClick(key, value, record) {
521
+ columnClick (key, value, record) {
517
522
  this.$emit('columnClick', key, value, record)
518
523
  },
519
- getFromItem(model, text, record, index) {
524
+ getFromItem (model, text, record, index) {
520
525
  const aa = this.formItems.find(item => item.model === model && item.editRow)
521
526
  if (aa) {
522
527
  const tempConfig = JSON.parse(JSON.stringify(aa))
523
528
  if (tempConfig.editRowShowFunc) {
524
- if (executeStrFunctionByContext(this, tempConfig.editRowShowFunc, [text, record, index, tempConfig]) {
529
+ if (executeStrFunctionByContext(this, tempConfig.editRowShowFunc, [text, record, index, tempConfig])) {
525
530
  return tempConfig
526
531
  }
532
+ } else {
533
+ return tempConfig
527
534
  }
528
535
  }
529
536
  return false
530
537
  },
531
538
  // 打开行编辑
532
- openEditMode() {
539
+ openEditMode () {
533
540
  this.isEditMode = true
534
541
  this.editRowBeforeData = JSON.parse(JSON.stringify(this.getTableData()))
535
542
  },
536
543
  // 标记行保存
537
- editRowSave() {
544
+ editRowSave () {
538
545
  // 获取最新数据
539
546
  const editRowAfterData = this.getTableData()
540
547
  const changeData = getChangedData(this.editRowBeforeData, editRowAfterData)
@@ -563,12 +570,12 @@ export default {
563
570
  })
564
571
  })
565
572
  },
566
- onCancel() {
573
+ onCancel () {
567
574
  }
568
575
  })
569
576
  }
570
577
  },
571
- importExcelOk() {
578
+ importExcelOk () {
572
579
  this.refresh(true)
573
580
  this.$emit('importExcelOk')
574
581
  },
@@ -577,7 +584,7 @@ export default {
577
584
  * @param row 选中行集合
578
585
  * @param attr 表单项属性
579
586
  */
580
- async rowChoose(row, attr, callback, record) {
587
+ async rowChoose (row, attr, callback, record) {
581
588
  // 如果配置了自定义函数
582
589
  if (attr.dataChangeFunc) {
583
590
  await executeStrFunction(attr.dataChangeFunc, [record, this.setForm, {
@@ -592,15 +599,15 @@ export default {
592
599
  callback()
593
600
  }
594
601
  },
595
- setForm(record, obj) {
602
+ setForm (record, obj) {
596
603
  Object.assign(record, obj)
597
604
  },
598
- handleResize() {
605
+ handleResize () {
599
606
  debounce(() => {
600
607
  this.setScrollYHeight({})
601
608
  }, 100)()
602
609
  },
603
- isInAModal() {
610
+ isInAModal () {
604
611
  let parent = this.$parent
605
612
  while (parent) {
606
613
  // 检查组件名称,这里假设a-modal组件的名称为AModal,根据实际情况可能需要调整
@@ -613,7 +620,7 @@ export default {
613
620
  },
614
621
  executeStrFunction,
615
622
  // 切换看板模式和表格模式
616
- changeViewMode() {
623
+ changeViewMode () {
617
624
  this.isTableMode = !this.isTableMode
618
625
  // 看板切换回表格模式 刷新列表
619
626
  if (this.isTableMode) {
@@ -623,7 +630,7 @@ export default {
623
630
  /**
624
631
  * 初始化表格参数
625
632
  */
626
- init(params) {
633
+ init (params) {
627
634
  const {
628
635
  // 查询参数对象, 用于没有对应查询配置文件名时
629
636
  queryParams,
@@ -740,7 +747,7 @@ export default {
740
747
  }
741
748
  },
742
749
  // 操作面板按钮渲染
743
- buttonRendering(button) {
750
+ buttonRendering (button) {
744
751
  if (!this.buttonPermissions) {
745
752
  return true
746
753
  }
@@ -762,11 +769,11 @@ export default {
762
769
  * 加载表格数据
763
770
  * @param requestParameters 请求参数
764
771
  */
765
- async loadTableData(requestParameters) {
772
+ async loadTableData (requestParameters) {
766
773
  let result
767
774
  if (this.localEditMode) {
768
775
  if (!this.isLocalDataSourceLoadedExternally && requestParameters?.conditionParams && Object.keys(requestParameters?.conditionParams).length > 0) {
769
- const result = await query(Object.assign(requestParameters, {userId: this.currUser?.id}),
776
+ const result = await query(Object.assign(requestParameters, { userId: this.currUser?.id }),
770
777
  this.serviceName, this.env === 'dev')
771
778
  if (result.data) {
772
779
  let no = 0
@@ -784,7 +791,7 @@ export default {
784
791
  })
785
792
  })
786
793
  } else {
787
- result = query(Object.assign(requestParameters, {userId: this.currUser?.id}), this.serviceName, this.env === 'dev')
794
+ result = query(Object.assign(requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
788
795
  }
789
796
  if (this.isTableMode && !this.simpleMode) {
790
797
  this.clearRowKeys()
@@ -798,11 +805,11 @@ export default {
798
805
  * @param actionType 操作类型
799
806
  * @param func 事件默认 action
800
807
  */
801
- action(record, actionType, func = 'action') {
808
+ action (record, actionType, func = 'action') {
802
809
  this.$emit('action', record, record[this.getPrimaryKeyName()], actionType, func)
803
810
  },
804
811
  // 看板点击事件
805
- handleCardEmit(data, eventName) {
812
+ handleCardEmit (data, eventName) {
806
813
  this.action(data, undefined, eventName)
807
814
  },
808
815
  /**
@@ -810,7 +817,7 @@ export default {
810
817
  * @param selectedRowKeys 被选择的列Key集合
811
818
  * @param selectedRows 被选择的列集合
812
819
  */
813
- onSelectChange(selectedRowKeys, selectedRows) {
820
+ onSelectChange (selectedRowKeys, selectedRows) {
814
821
  this.selectedRowKeys = selectedRowKeys
815
822
  this.selectedRows = selectedRows
816
823
  this.isModify = this.selectedRowKeys.length === 1
@@ -821,13 +828,13 @@ export default {
821
828
  /**
822
829
  * 清除表格选中项
823
830
  */
824
- clearRowKeys() {
831
+ clearRowKeys () {
825
832
  this.$refs.table.clearSelected()
826
833
  },
827
834
  /**
828
835
  * 为表格附加查询条件
829
836
  */
830
- setQueryForm(form = {}) {
837
+ setQueryForm (form = {}) {
831
838
  this.form = form
832
839
  if (this.createdQuery) {
833
840
  this.refresh(true)
@@ -839,12 +846,12 @@ export default {
839
846
  * 表格重新加载方法
840
847
  * 如果参数为 true, 则强制刷新到第一页
841
848
  */
842
- refresh(bool) {
849
+ refresh (bool) {
843
850
  this.$nextTick(() => {
844
851
  this.$refs.table.refresh(bool)
845
852
  })
846
853
  },
847
- setScrollYHeight({extraHeight = this.extraHeight, id = this.uniqueId, type = ''}) {
854
+ setScrollYHeight ({ extraHeight = this.extraHeight, id = this.uniqueId, type = '' }) {
848
855
  this.$nextTick(() => {
849
856
  setTimeout(() => {
850
857
  const curDocument = window?.rawDocument || document
@@ -901,7 +908,7 @@ export default {
901
908
  * @param date 日期字符串
902
909
  * @param format 格式化方式
903
910
  */
904
- format(date, format) {
911
+ format (date, format) {
905
912
  return formatDate(date, format)
906
913
  },
907
914
  /**
@@ -909,7 +916,7 @@ export default {
909
916
  * @param number string 或者 number
910
917
  * @param decimalPlaces 小数位数
911
918
  */
912
- numberFormat(number, decimalPlaces = 2) {
919
+ numberFormat (number, decimalPlaces = 2) {
913
920
  const value = parseFloat(number)
914
921
  if (!isNaN(value)) {
915
922
  return value.toFixed(decimalPlaces)
@@ -920,7 +927,7 @@ export default {
920
927
  /**
921
928
  * 获取主键列名称
922
929
  */
923
- getPrimaryKeyName() {
930
+ getPrimaryKeyName () {
924
931
  if (this.primaryKey) {
925
932
  return this.primaryKey
926
933
  }
@@ -928,7 +935,7 @@ export default {
928
935
  return indexColumn ? indexColumn.dataIndex : this.tableColumns[0].dataIndex
929
936
  },
930
937
  // 导出选中或本页数据
931
- handleExport(isSelected) {
938
+ handleExport (isSelected) {
932
939
  const tHeader = this.tableColumns.filter(res => res.slotType !== 'action').map(res => res.title)
933
940
  const filterVal = this.tableColumns.map(res => res.dataIndex)
934
941
  let exportData
@@ -940,13 +947,13 @@ export default {
940
947
  exportJson(tHeader, exportData.map(v => filterVal.map(j => v[j])), this.title + `数据_${new Date().toLocaleString()}`)
941
948
  },
942
949
  // 导出符合条件的数据
943
- handleExportByQuery() {
950
+ handleExportByQuery () {
944
951
  const that = this
945
952
  const conditionParams = Object.assign(that.form, that.fixedQueryForm)
946
953
  this.$confirm({
947
954
  title: '是否确认导出?',
948
955
  content: '此操作将导出当前条件下所有数据而非选中数据',
949
- onOk() {
956
+ onOk () {
950
957
  exportData({
951
958
  queryParamsName: that.queryParamsName,
952
959
  queryParams: that.queryParams,
@@ -961,11 +968,11 @@ export default {
961
968
  window.open(value)
962
969
  })
963
970
  },
964
- onCancel() {
971
+ onCancel () {
965
972
  }
966
973
  })
967
974
  },
968
- handleAsyncExportByQuery() {
975
+ handleAsyncExportByQuery () {
969
976
  const that = this
970
977
  const conditionParams = Object.assign(that.form, that.fixedQueryForm)
971
978
  this.$confirm({
@@ -1011,20 +1018,20 @@ export default {
1011
1018
  console.log('失败:', error)
1012
1019
  })
1013
1020
  },
1014
- onCancel() {
1021
+ onCancel () {
1015
1022
  }
1016
1023
  })
1017
1024
  },
1018
1025
  // 新增业务
1019
- add() {
1026
+ add () {
1020
1027
  this.$emit('add')
1021
1028
  },
1022
1029
  // 添加业务
1023
- move() {
1030
+ move () {
1024
1031
  this.$emit('move')
1025
1032
  },
1026
1033
  // 编辑业务
1027
- edit(id) {
1034
+ edit (id) {
1028
1035
  this.editLoading = true
1029
1036
  this.getEditData(id).then(modifyModelData => {
1030
1037
  this.$emit('edit', modifyModelData)
@@ -1032,7 +1039,7 @@ export default {
1032
1039
  })
1033
1040
  },
1034
1041
  // 行选择业务
1035
- choose() {
1042
+ choose () {
1036
1043
  if (this.isChoose) {
1037
1044
  // 如果配置了自定义函数
1038
1045
  this.$emit('rowChoose', this.selectedRows)
@@ -1041,11 +1048,11 @@ export default {
1041
1048
  }
1042
1049
  },
1043
1050
  // 自定义按钮点击
1044
- editButtonStateDataClick(index) {
1051
+ editButtonStateDataClick (index) {
1045
1052
  this.$emit('editButtonStateDataClick', this.editButtonStateData[index].functionName, this.selectedRows)
1046
1053
  },
1047
1054
  // 获取被编辑的数据
1048
- getEditData(id) {
1055
+ getEditData (id) {
1049
1056
  if (!id) {
1050
1057
  this.selectId = this.selectedRowKeys[0]
1051
1058
  } else {
@@ -1077,11 +1084,11 @@ export default {
1077
1084
  requestParameters.conditionParams[primaryKeyName] = this.selectId
1078
1085
  requestParameters.f_businessid = this.selectId
1079
1086
  return queryWithResource(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1080
- return {data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files}
1087
+ return { data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files }
1081
1088
  })
1082
1089
  },
1083
1090
  // 删除业务
1084
- deleteItem() {
1091
+ deleteItem () {
1085
1092
  if (this.viewMode) {
1086
1093
  this.$message.info('预览模式禁止删除')
1087
1094
  return
@@ -1119,20 +1126,20 @@ export default {
1119
1126
  }
1120
1127
  })
1121
1128
  },
1122
- onCancel() {
1129
+ onCancel () {
1123
1130
  }
1124
1131
  })
1125
1132
  },
1126
1133
  // 导入业务
1127
- importData() {
1134
+ importData () {
1128
1135
  this.$refs.importExcel.importExcelHandleOpen()
1129
1136
  },
1130
- afterVisibleChange() {
1137
+ afterVisibleChange () {
1131
1138
  this.retrieveSummaryData()
1132
1139
  },
1133
- async retrieveSummaryData() {
1140
+ async retrieveSummaryData () {
1134
1141
  if (this.requestParameters.querySummary) {
1135
- querySummary(Object.assign(this.requestParameters, {userId: this.currUser?.id}), this.serviceName, this.env === 'dev').then(res => {
1142
+ querySummary(Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev').then(res => {
1136
1143
  if (res.length > 0) {
1137
1144
  this.summaryData.forEach(item => {
1138
1145
  res.forEach(summary => {
@@ -1148,7 +1155,7 @@ export default {
1148
1155
  }
1149
1156
  if (this.showCustomSummary) {
1150
1157
  this.customSummaryArray.forEach(item => {
1151
- runLogic(item.source, Object.assign(this.requestParameters, {userId: this.currUser?.id}), this.serviceName, this.env === 'dev').then((res) => {
1158
+ runLogic(item.source, Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev').then((res) => {
1152
1159
  this.summaryData.forEach(summary => {
1153
1160
  if (item.key === summary.key) {
1154
1161
  summary.value = res.value
@@ -1168,7 +1175,7 @@ export default {
1168
1175
  })
1169
1176
  }
1170
1177
  },
1171
- showDrawer() {
1178
+ showDrawer () {
1172
1179
  if (this.summaryUpdate) {
1173
1180
  this.summaryData.forEach(item => {
1174
1181
  item.loading = true
@@ -1180,36 +1187,36 @@ export default {
1180
1187
  this.$message.warning('请查询后再来查看')
1181
1188
  }
1182
1189
  },
1183
- onClose() {
1190
+ onClose () {
1184
1191
  this.summaryDrawerVisible = false
1185
1192
  },
1186
1193
  // 获取表格内所有数据
1187
- getTableData() {
1194
+ getTableData () {
1188
1195
  return this.$refs.table.localDataSource
1189
1196
  },
1190
1197
  // 设置表格内数据
1191
- setTableData(data) {
1192
- Object.assign(this.$refs.table, {localDataSource: data})
1198
+ setTableData (data) {
1199
+ Object.assign(this.$refs.table, { localDataSource: data })
1193
1200
  },
1194
1201
  // 获取所有本地数据
1195
- getLocalData() {
1202
+ getLocalData () {
1196
1203
  return this.localEditModeDataSource
1197
1204
  },
1198
1205
  // 获取指定rowKey的value的本地数据
1199
- getDataByRowKeyValue(rowKeyValue) {
1206
+ getDataByRowKeyValue (rowKeyValue) {
1200
1207
  return this.getLocalData().find(item => {
1201
1208
  return item[this.rowKey] === rowKeyValue
1202
1209
  })
1203
1210
  },
1204
1211
  // 修改本地数据
1205
- modifyLocalData(rowKeyValue, data) {
1212
+ modifyLocalData (rowKeyValue, data) {
1206
1213
  const modifyItem = this.getDataByRowKeyValue(rowKeyValue)
1207
1214
  if (modifyItem) {
1208
1215
  Object.assign(modifyItem, data)
1209
1216
  }
1210
1217
  },
1211
1218
  // 追加本地数据
1212
- appendLocalData(item) {
1219
+ appendLocalData (item) {
1213
1220
  item['序号'] = this.localEditModeDataSource.length
1214
1221
  this.localEditModeDataSource.push(item)
1215
1222
  }