vue2-client 1.9.90 → 1.9.91

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.91",
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,25 +508,25 @@ 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
  }
527
532
  }
@@ -529,12 +534,12 @@ export default {
529
534
  return false
530
535
  },
531
536
  // 打开行编辑
532
- openEditMode() {
537
+ openEditMode () {
533
538
  this.isEditMode = true
534
539
  this.editRowBeforeData = JSON.parse(JSON.stringify(this.getTableData()))
535
540
  },
536
541
  // 标记行保存
537
- editRowSave() {
542
+ editRowSave () {
538
543
  // 获取最新数据
539
544
  const editRowAfterData = this.getTableData()
540
545
  const changeData = getChangedData(this.editRowBeforeData, editRowAfterData)
@@ -563,12 +568,12 @@ export default {
563
568
  })
564
569
  })
565
570
  },
566
- onCancel() {
571
+ onCancel () {
567
572
  }
568
573
  })
569
574
  }
570
575
  },
571
- importExcelOk() {
576
+ importExcelOk () {
572
577
  this.refresh(true)
573
578
  this.$emit('importExcelOk')
574
579
  },
@@ -577,7 +582,7 @@ export default {
577
582
  * @param row 选中行集合
578
583
  * @param attr 表单项属性
579
584
  */
580
- async rowChoose(row, attr, callback, record) {
585
+ async rowChoose (row, attr, callback, record) {
581
586
  // 如果配置了自定义函数
582
587
  if (attr.dataChangeFunc) {
583
588
  await executeStrFunction(attr.dataChangeFunc, [record, this.setForm, {
@@ -592,15 +597,15 @@ export default {
592
597
  callback()
593
598
  }
594
599
  },
595
- setForm(record, obj) {
600
+ setForm (record, obj) {
596
601
  Object.assign(record, obj)
597
602
  },
598
- handleResize() {
603
+ handleResize () {
599
604
  debounce(() => {
600
605
  this.setScrollYHeight({})
601
606
  }, 100)()
602
607
  },
603
- isInAModal() {
608
+ isInAModal () {
604
609
  let parent = this.$parent
605
610
  while (parent) {
606
611
  // 检查组件名称,这里假设a-modal组件的名称为AModal,根据实际情况可能需要调整
@@ -613,7 +618,7 @@ export default {
613
618
  },
614
619
  executeStrFunction,
615
620
  // 切换看板模式和表格模式
616
- changeViewMode() {
621
+ changeViewMode () {
617
622
  this.isTableMode = !this.isTableMode
618
623
  // 看板切换回表格模式 刷新列表
619
624
  if (this.isTableMode) {
@@ -623,7 +628,7 @@ export default {
623
628
  /**
624
629
  * 初始化表格参数
625
630
  */
626
- init(params) {
631
+ init (params) {
627
632
  const {
628
633
  // 查询参数对象, 用于没有对应查询配置文件名时
629
634
  queryParams,
@@ -740,7 +745,7 @@ export default {
740
745
  }
741
746
  },
742
747
  // 操作面板按钮渲染
743
- buttonRendering(button) {
748
+ buttonRendering (button) {
744
749
  if (!this.buttonPermissions) {
745
750
  return true
746
751
  }
@@ -762,11 +767,11 @@ export default {
762
767
  * 加载表格数据
763
768
  * @param requestParameters 请求参数
764
769
  */
765
- async loadTableData(requestParameters) {
770
+ async loadTableData (requestParameters) {
766
771
  let result
767
772
  if (this.localEditMode) {
768
773
  if (!this.isLocalDataSourceLoadedExternally && requestParameters?.conditionParams && Object.keys(requestParameters?.conditionParams).length > 0) {
769
- const result = await query(Object.assign(requestParameters, {userId: this.currUser?.id}),
774
+ const result = await query(Object.assign(requestParameters, { userId: this.currUser?.id }),
770
775
  this.serviceName, this.env === 'dev')
771
776
  if (result.data) {
772
777
  let no = 0
@@ -784,7 +789,7 @@ export default {
784
789
  })
785
790
  })
786
791
  } else {
787
- result = query(Object.assign(requestParameters, {userId: this.currUser?.id}), this.serviceName, this.env === 'dev')
792
+ result = query(Object.assign(requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
788
793
  }
789
794
  if (this.isTableMode && !this.simpleMode) {
790
795
  this.clearRowKeys()
@@ -798,11 +803,11 @@ export default {
798
803
  * @param actionType 操作类型
799
804
  * @param func 事件默认 action
800
805
  */
801
- action(record, actionType, func = 'action') {
806
+ action (record, actionType, func = 'action') {
802
807
  this.$emit('action', record, record[this.getPrimaryKeyName()], actionType, func)
803
808
  },
804
809
  // 看板点击事件
805
- handleCardEmit(data, eventName) {
810
+ handleCardEmit (data, eventName) {
806
811
  this.action(data, undefined, eventName)
807
812
  },
808
813
  /**
@@ -810,7 +815,7 @@ export default {
810
815
  * @param selectedRowKeys 被选择的列Key集合
811
816
  * @param selectedRows 被选择的列集合
812
817
  */
813
- onSelectChange(selectedRowKeys, selectedRows) {
818
+ onSelectChange (selectedRowKeys, selectedRows) {
814
819
  this.selectedRowKeys = selectedRowKeys
815
820
  this.selectedRows = selectedRows
816
821
  this.isModify = this.selectedRowKeys.length === 1
@@ -821,13 +826,13 @@ export default {
821
826
  /**
822
827
  * 清除表格选中项
823
828
  */
824
- clearRowKeys() {
829
+ clearRowKeys () {
825
830
  this.$refs.table.clearSelected()
826
831
  },
827
832
  /**
828
833
  * 为表格附加查询条件
829
834
  */
830
- setQueryForm(form = {}) {
835
+ setQueryForm (form = {}) {
831
836
  this.form = form
832
837
  if (this.createdQuery) {
833
838
  this.refresh(true)
@@ -839,12 +844,12 @@ export default {
839
844
  * 表格重新加载方法
840
845
  * 如果参数为 true, 则强制刷新到第一页
841
846
  */
842
- refresh(bool) {
847
+ refresh (bool) {
843
848
  this.$nextTick(() => {
844
849
  this.$refs.table.refresh(bool)
845
850
  })
846
851
  },
847
- setScrollYHeight({extraHeight = this.extraHeight, id = this.uniqueId, type = ''}) {
852
+ setScrollYHeight ({ extraHeight = this.extraHeight, id = this.uniqueId, type = '' }) {
848
853
  this.$nextTick(() => {
849
854
  setTimeout(() => {
850
855
  const curDocument = window?.rawDocument || document
@@ -901,7 +906,7 @@ export default {
901
906
  * @param date 日期字符串
902
907
  * @param format 格式化方式
903
908
  */
904
- format(date, format) {
909
+ format (date, format) {
905
910
  return formatDate(date, format)
906
911
  },
907
912
  /**
@@ -909,7 +914,7 @@ export default {
909
914
  * @param number string 或者 number
910
915
  * @param decimalPlaces 小数位数
911
916
  */
912
- numberFormat(number, decimalPlaces = 2) {
917
+ numberFormat (number, decimalPlaces = 2) {
913
918
  const value = parseFloat(number)
914
919
  if (!isNaN(value)) {
915
920
  return value.toFixed(decimalPlaces)
@@ -920,7 +925,7 @@ export default {
920
925
  /**
921
926
  * 获取主键列名称
922
927
  */
923
- getPrimaryKeyName() {
928
+ getPrimaryKeyName () {
924
929
  if (this.primaryKey) {
925
930
  return this.primaryKey
926
931
  }
@@ -928,7 +933,7 @@ export default {
928
933
  return indexColumn ? indexColumn.dataIndex : this.tableColumns[0].dataIndex
929
934
  },
930
935
  // 导出选中或本页数据
931
- handleExport(isSelected) {
936
+ handleExport (isSelected) {
932
937
  const tHeader = this.tableColumns.filter(res => res.slotType !== 'action').map(res => res.title)
933
938
  const filterVal = this.tableColumns.map(res => res.dataIndex)
934
939
  let exportData
@@ -940,13 +945,13 @@ export default {
940
945
  exportJson(tHeader, exportData.map(v => filterVal.map(j => v[j])), this.title + `数据_${new Date().toLocaleString()}`)
941
946
  },
942
947
  // 导出符合条件的数据
943
- handleExportByQuery() {
948
+ handleExportByQuery () {
944
949
  const that = this
945
950
  const conditionParams = Object.assign(that.form, that.fixedQueryForm)
946
951
  this.$confirm({
947
952
  title: '是否确认导出?',
948
953
  content: '此操作将导出当前条件下所有数据而非选中数据',
949
- onOk() {
954
+ onOk () {
950
955
  exportData({
951
956
  queryParamsName: that.queryParamsName,
952
957
  queryParams: that.queryParams,
@@ -961,11 +966,11 @@ export default {
961
966
  window.open(value)
962
967
  })
963
968
  },
964
- onCancel() {
969
+ onCancel () {
965
970
  }
966
971
  })
967
972
  },
968
- handleAsyncExportByQuery() {
973
+ handleAsyncExportByQuery () {
969
974
  const that = this
970
975
  const conditionParams = Object.assign(that.form, that.fixedQueryForm)
971
976
  this.$confirm({
@@ -1011,20 +1016,20 @@ export default {
1011
1016
  console.log('失败:', error)
1012
1017
  })
1013
1018
  },
1014
- onCancel() {
1019
+ onCancel () {
1015
1020
  }
1016
1021
  })
1017
1022
  },
1018
1023
  // 新增业务
1019
- add() {
1024
+ add () {
1020
1025
  this.$emit('add')
1021
1026
  },
1022
1027
  // 添加业务
1023
- move() {
1028
+ move () {
1024
1029
  this.$emit('move')
1025
1030
  },
1026
1031
  // 编辑业务
1027
- edit(id) {
1032
+ edit (id) {
1028
1033
  this.editLoading = true
1029
1034
  this.getEditData(id).then(modifyModelData => {
1030
1035
  this.$emit('edit', modifyModelData)
@@ -1032,7 +1037,7 @@ export default {
1032
1037
  })
1033
1038
  },
1034
1039
  // 行选择业务
1035
- choose() {
1040
+ choose () {
1036
1041
  if (this.isChoose) {
1037
1042
  // 如果配置了自定义函数
1038
1043
  this.$emit('rowChoose', this.selectedRows)
@@ -1041,11 +1046,11 @@ export default {
1041
1046
  }
1042
1047
  },
1043
1048
  // 自定义按钮点击
1044
- editButtonStateDataClick(index) {
1049
+ editButtonStateDataClick (index) {
1045
1050
  this.$emit('editButtonStateDataClick', this.editButtonStateData[index].functionName, this.selectedRows)
1046
1051
  },
1047
1052
  // 获取被编辑的数据
1048
- getEditData(id) {
1053
+ getEditData (id) {
1049
1054
  if (!id) {
1050
1055
  this.selectId = this.selectedRowKeys[0]
1051
1056
  } else {
@@ -1077,11 +1082,11 @@ export default {
1077
1082
  requestParameters.conditionParams[primaryKeyName] = this.selectId
1078
1083
  requestParameters.f_businessid = this.selectId
1079
1084
  return queryWithResource(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1080
- return {data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files}
1085
+ return { data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files }
1081
1086
  })
1082
1087
  },
1083
1088
  // 删除业务
1084
- deleteItem() {
1089
+ deleteItem () {
1085
1090
  if (this.viewMode) {
1086
1091
  this.$message.info('预览模式禁止删除')
1087
1092
  return
@@ -1119,20 +1124,20 @@ export default {
1119
1124
  }
1120
1125
  })
1121
1126
  },
1122
- onCancel() {
1127
+ onCancel () {
1123
1128
  }
1124
1129
  })
1125
1130
  },
1126
1131
  // 导入业务
1127
- importData() {
1132
+ importData () {
1128
1133
  this.$refs.importExcel.importExcelHandleOpen()
1129
1134
  },
1130
- afterVisibleChange() {
1135
+ afterVisibleChange () {
1131
1136
  this.retrieveSummaryData()
1132
1137
  },
1133
- async retrieveSummaryData() {
1138
+ async retrieveSummaryData () {
1134
1139
  if (this.requestParameters.querySummary) {
1135
- querySummary(Object.assign(this.requestParameters, {userId: this.currUser?.id}), this.serviceName, this.env === 'dev').then(res => {
1140
+ querySummary(Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev').then(res => {
1136
1141
  if (res.length > 0) {
1137
1142
  this.summaryData.forEach(item => {
1138
1143
  res.forEach(summary => {
@@ -1148,7 +1153,7 @@ export default {
1148
1153
  }
1149
1154
  if (this.showCustomSummary) {
1150
1155
  this.customSummaryArray.forEach(item => {
1151
- runLogic(item.source, Object.assign(this.requestParameters, {userId: this.currUser?.id}), this.serviceName, this.env === 'dev').then((res) => {
1156
+ runLogic(item.source, Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev').then((res) => {
1152
1157
  this.summaryData.forEach(summary => {
1153
1158
  if (item.key === summary.key) {
1154
1159
  summary.value = res.value
@@ -1168,7 +1173,7 @@ export default {
1168
1173
  })
1169
1174
  }
1170
1175
  },
1171
- showDrawer() {
1176
+ showDrawer () {
1172
1177
  if (this.summaryUpdate) {
1173
1178
  this.summaryData.forEach(item => {
1174
1179
  item.loading = true
@@ -1180,36 +1185,36 @@ export default {
1180
1185
  this.$message.warning('请查询后再来查看')
1181
1186
  }
1182
1187
  },
1183
- onClose() {
1188
+ onClose () {
1184
1189
  this.summaryDrawerVisible = false
1185
1190
  },
1186
1191
  // 获取表格内所有数据
1187
- getTableData() {
1192
+ getTableData () {
1188
1193
  return this.$refs.table.localDataSource
1189
1194
  },
1190
1195
  // 设置表格内数据
1191
- setTableData(data) {
1192
- Object.assign(this.$refs.table, {localDataSource: data})
1196
+ setTableData (data) {
1197
+ Object.assign(this.$refs.table, { localDataSource: data })
1193
1198
  },
1194
1199
  // 获取所有本地数据
1195
- getLocalData() {
1200
+ getLocalData () {
1196
1201
  return this.localEditModeDataSource
1197
1202
  },
1198
1203
  // 获取指定rowKey的value的本地数据
1199
- getDataByRowKeyValue(rowKeyValue) {
1204
+ getDataByRowKeyValue (rowKeyValue) {
1200
1205
  return this.getLocalData().find(item => {
1201
1206
  return item[this.rowKey] === rowKeyValue
1202
1207
  })
1203
1208
  },
1204
1209
  // 修改本地数据
1205
- modifyLocalData(rowKeyValue, data) {
1210
+ modifyLocalData (rowKeyValue, data) {
1206
1211
  const modifyItem = this.getDataByRowKeyValue(rowKeyValue)
1207
1212
  if (modifyItem) {
1208
1213
  Object.assign(modifyItem, data)
1209
1214
  }
1210
1215
  },
1211
1216
  // 追加本地数据
1212
- appendLocalData(item) {
1217
+ appendLocalData (item) {
1213
1218
  item['序号'] = this.localEditModeDataSource.length
1214
1219
  this.localEditModeDataSource.push(item)
1215
1220
  }