vue2-client 1.14.95 → 1.14.99

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.14.95",
3
+ "version": "1.14.99",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -362,6 +362,11 @@ export default {
362
362
  type: Number,
363
363
  default: 80
364
364
  },
365
+ // 是否禁用右侧操作行为
366
+ disableAction: {
367
+ type: Boolean,
368
+ default: false
369
+ },
365
370
  // 额外参数,用于控制组件行为
366
371
  extraParams: {
367
372
  type: Object,
@@ -541,6 +546,7 @@ export default {
541
546
  env: this.env,
542
547
  form: this.$refs.xForm.form,
543
548
  summaryUpdate: true,
549
+ disableAction: this.disableAction,
544
550
  ...res
545
551
  })
546
552
  if (this.realQueryConfig?.funcData?.pageMounted) {
@@ -632,8 +638,8 @@ export default {
632
638
  * @param fun 向上级传递的事件
633
639
  */
634
640
  action (record, id, actionType, fun = 'action', index) {
635
- this.$emit('innerXFormTableEmit', fun, record, id, actionType, index)
636
- this.$emit(fun, record, id, actionType, index)
641
+ this.$emit('innerXFormTableEmit', fun, record, id, actionType, index, this)
642
+ this.$emit(fun, record, id, actionType, index, this)
637
643
  },
638
644
  treeOnChecked (checkedKeys, deepNodes, deepKeys) {
639
645
  this.$emit('treeOnChecked', checkedKeys, deepNodes, deepKeys)
@@ -151,6 +151,7 @@
151
151
  <template v-if="isTableMode">
152
152
  <x-table-wrapper
153
153
  ref="table"
154
+ :disableAction="disableAction"
154
155
  @rowClick="handleRowClick"
155
156
  @beforeDataChange="beforeDataChange"
156
157
  @expand="onExpand">
@@ -458,7 +459,9 @@ export default {
458
459
  selectRowMode: 'default',
459
460
  tableSize: 'default',
460
461
  clearSelectRowAfterQuery: false,
461
- selectedRowModalVisible: false
462
+ selectedRowModalVisible: false,
463
+ // 是否禁用右侧操作行为
464
+ disableAction: false
462
465
  }
463
466
  },
464
467
  props: {
@@ -739,7 +742,8 @@ export default {
739
742
  printTemplate = 'DEFAULT_CRUD_PRINT_TEMPLATE',
740
743
  selectRowMode = 'default',
741
744
  tableSize = 'default',
742
- clearSelectRowAfterQuery = false
745
+ clearSelectRowAfterQuery = false,
746
+ disableAction = false
743
747
  } = params
744
748
  this.showSummary = Object.keys(tableSummaryMap).length > 0
745
749
  if (this.showSummary) {
@@ -792,6 +796,7 @@ export default {
792
796
  this.selectRowMode = selectRowMode
793
797
  this.tableSize = tableSize
794
798
  this.clearSelectRowAfterQuery = clearSelectRowAfterQuery
799
+ this.disableAction = disableAction
795
800
  if (this.chartsConfigArray.length > 0) {
796
801
  // 循环chartsConfigArray,将每个配置的数据请求参数赋值给requestParameters
797
802
  this.chartsConfigArray.forEach(item => {
@@ -5,7 +5,7 @@
5
5
  ref="expandableTable"
6
6
  :id="tableContext.uniqueId"
7
7
  :alert="true"
8
- :columns="tableContext.tableColumns"
8
+ :columns="realTableColumns"
9
9
  :data="loadData()"
10
10
  :rowKey="tableContext.rowKey"
11
11
  :showSummary="tableContext.showSummary"
@@ -24,7 +24,7 @@
24
24
  @rowClick="handleRowClick"
25
25
  >
26
26
  <template
27
- v-for="(item, c_index) in tableContext.tableColumns"
27
+ v-for="(item, c_index) in realTableColumns"
28
28
  :slot="item.dataIndex"
29
29
  slot-scope="text, record, index">
30
30
  <template v-if="tableContext.isEditMode && getFromItem(item.dataIndex,text, record, index)">
@@ -140,7 +140,7 @@
140
140
  ref="simpleTable"
141
141
  :id="tableContext.uniqueId"
142
142
  :alert="true"
143
- :columns="tableContext.tableColumns"
143
+ :columns="realTableColumns"
144
144
  :data="loadData()"
145
145
  :rowKey="tableContext.rowKey"
146
146
  :showSummary="tableContext.showSummary"
@@ -158,7 +158,7 @@
158
158
  @beforeDataChange="beforeDataChange"
159
159
  >
160
160
  <template
161
- v-for="(item, c_index) in tableContext.tableColumns"
161
+ v-for="(item, c_index) in realTableColumns"
162
162
  :slot="item.dataIndex"
163
163
  slot-scope="text, record, index">
164
164
  <template v-if="tableContext.isEditMode && getFromItem(item.dataIndex,text, record, index)">
@@ -287,6 +287,9 @@ export default {
287
287
  // 获取当前活动的表格实例
288
288
  activeTable () {
289
289
  return this.tableContext.expandedGrid ? this.$refs.expandableTable : this.$refs.simpleTable
290
+ },
291
+ realTableColumns () {
292
+ return this.tableContext.tableColumns.filter(item => item.slotType !== 'action' || !this.disableAction)
290
293
  }
291
294
  },
292
295
  props: {
@@ -294,6 +297,10 @@ export default {
294
297
  type: Boolean,
295
298
  required: false,
296
299
  default: false
300
+ },
301
+ disableAction: {
302
+ type: Boolean,
303
+ default: false
297
304
  }
298
305
  },
299
306
  inject: ['tableContext'],
@@ -384,11 +391,11 @@ export default {
384
391
  if (aa) {
385
392
  const tempConfig = JSON.parse(JSON.stringify(aa))
386
393
  // 如果找到了字段
387
- const ColumnIndex = this.tableContext.tableColumns.findIndex(item => item.dataIndex === model)
394
+ const ColumnIndex = this.realTableColumns.findIndex(item => item.dataIndex === model)
388
395
  // 并且表单项是日期框
389
396
  if (ColumnIndex !== -1 && ['yearPicker', 'monthPicker', 'datePicker', 'rangePicker'].includes(tempConfig.type)) {
390
397
  // 修改他的列宽
391
- this.tableContext.tableColumns[ColumnIndex].width = 220
398
+ this.realTableColumns[ColumnIndex].width = 220
392
399
  }
393
400
  // 如果有检验规则检验是数字
394
401
  if (ColumnIndex !== -1 && ['number', 'integer', 'float'].includes(tempConfig?.rule?.type)) {
@@ -1,37 +1,3 @@
1
- {
2
- "config":{
3
- "title":"",
4
- "split":"",
5
- "style":""//TODO 居中方式
6
- },
7
- "content": [
8
- {
9
- "key":"", //单行记录的标识
10
- "style":"",//居中方式
11
- "item": [
12
- {
13
- "type":"",
14
- "key": "",
15
- "value": {},
16
-
17
- "configName":"", // 通过后端获配置单选多选
18
- "button-type":"",
19
-
20
-
21
- }
22
- ]
23
- }
24
- ]
25
- }
26
1
  //常量取值 checkBox多选
27
2
  type [radio,selectionBox,text,input,time,describe,button]
28
3
  style = ['flex-start', 'flex-end', 'center', 'space-between', 'space-around']
29
-
30
- "results": [{
31
- "row_key": "",
32
- "key": "value"
33
- }
34
- ]
35
-
36
-
37
-
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="list-container" style="display: flex;">
3
- <template v-for="(config, index) in configs">
4
- <x-questionnaire-item :fixedQueryForm="conditions[index]" :queryParamsName="config" :ref="el => setItemRef(el, index)" :key="`questionnaire-${index}`"></x-questionnaire-item>
3
+ <template v-for="(config) in configs">
4
+ <x-questionnaire-item :key="config.tmp_key" :fixedQueryForm="conditionsMap[config.tmp_key]" :queryParamsName="config" :ref="el => setItemRef(el, config)" @customizeEvent="customizeEvent"></x-questionnaire-item>
5
5
  </template>
6
6
  </div>
7
7
  </template>
@@ -26,38 +26,60 @@ export default {
26
26
  data () {
27
27
  return {
28
28
  configs: [],
29
- questionnaireItemRefs: [], // 存储子组件实例
30
- conditions: []
29
+ questionnaireItemRefs: new Map(), // 存储子组件实例
30
+ conditionsMap: {}
31
31
  }
32
32
  },
33
33
  methods: {
34
34
  // 获取配置
35
- async getData (queryParamsName, conditions) {
36
- const that = this
37
- getConfigByName(queryParamsName, 'af-his', res => {
38
- if (res.configs) {
39
- that.configs = []
40
- }
41
- for (let i = 0; i < res.configs.length; i++) {
42
- const condition = i < conditions.length ? conditions[i] : {}
43
- that.configs.push(res.configs[i])
44
- that.conditions.push(condition)
45
- }
35
+ async getData (conditionData) {
36
+ getConfigByName(this.queryParamsName, 'af-his', res => {
37
+ // 清空旧数据
38
+ this.configs = []
39
+ this.conditionsMap = { ...this.conditionsMap }
40
+ console.log(res)
41
+ res.configs.forEach(config => {
42
+ this.configs.push(config)
43
+ // 响应式更新条件映射
44
+ this.$set(this.conditionsMap, config.tmp_key,
45
+ conditionData[config.tmp_key] || {}
46
+ )
47
+ })
46
48
  })
47
49
  },
48
- setItemRef (el, index) {
49
- if (el) {
50
- this.questionnaireItemRefs[index] = el // 保存实例
50
+ customizeEvent (customize, callback) {
51
+ console.log(this.$listeners)
52
+ console.log(customize)
53
+ if (customize.clickEventName && this.$listeners[customize.clickEventName]) {
54
+ // 交由父级处理
55
+ this.$emit(customize.clickEventName, customize, callback)
56
+ } else {
57
+ this.defaultAction(customize.clickEventName, customize, callback)
51
58
  }
52
59
  },
53
- init (conditions) {
54
- this.getData(this.queryParamsName, conditions)
60
+ defaultAction (clickEventName, item, callback) {
61
+ setTimeout(() => {
62
+ this.$message.warn(`已触发按钮 [${item.key}],注册事件名 [${clickEventName}],未实现事件函数`)
63
+ callback()
64
+ }, 200)
55
65
  },
56
- refreshList (index, condition) {
57
- if (index < this.conditions.length) {
58
- this.conditions[index] = condition
66
+ setItemRef (el, config) {
67
+ if (el) {
68
+ this.questionnaireItemRefs.set(config.tmp_key, el)
69
+ } else {
70
+ this.questionnaireItemRefs.delete(config.tmp_key) // 组件卸载时清理
59
71
  }
60
- }
72
+ },
73
+ async init () { // 接收完整条件对象
74
+ this.$emit('init')
75
+ },
76
+
77
+ refreshList (tmpKey, condition) {
78
+ // 更新条件映射
79
+ this.$set(this.conditionsMap, tmpKey, condition)
80
+ // 调用子组件刷新
81
+ this.questionnaireItemRefs.get(tmpKey)?.refreshList(condition)
82
+ },
61
83
  },
62
84
  }
63
85
  </script>
@@ -13,7 +13,19 @@ export default {
13
13
  methods: {
14
14
  init () {
15
15
  console.log(this)
16
- this.$refs.questionnaireRef.init([{ id: 10 }, { id: 20 }, { id: 10 }])
16
+ const conditionData = {
17
+ tmp_1: { tmp_id: 1 },
18
+ tmp_2: { tmp_id: 2 },
19
+ tmp_3: { tmp_id: 3 }
20
+ }
21
+ this.$refs.questionnaireRef.init(conditionData)
22
+ },
23
+ save () {
24
+ console.log(this)
25
+ console.log(this.$refs.questionnaireRef.questionnaireItemRefs.get('tmp_1').results)
26
+ },
27
+ refreshList () {
28
+ this.$refs.questionnaireRef.refreshList('tmp_2', { tmp_id: 3 })
17
29
  }
18
30
  }
19
31
  }
@@ -26,9 +38,14 @@ export default {
26
38
  <a-button type="primary" @click="init">
27
39
  初始化
28
40
  </a-button>
41
+ <a-button type="primary" @click="save">
42
+ 保存
43
+ </a-button>
44
+ <a-button type="primary" @click="refreshList">
45
+ 刷新
46
+ </a-button>
29
47
  </div>
30
48
  </template>
31
49
 
32
50
  <style scoped>
33
-
34
51
  </style>
@@ -19,23 +19,23 @@
19
19
  class="row-item"
20
20
  :style="{ justifyContent: getFlexJustify(item.style) }"
21
21
  >
22
- <template v-for="(column, idx) in item.item">
22
+ <template v-for="(column, idx) in item.columns">
23
23
  <template v-if="column.type === 'selectionBox'">
24
- <a-checkbox @change="handleChange($event,column,index)" v-model="column.value" :key="`row-${index}-item-${idx}`" :class="['column-item']"></a-checkbox>
24
+ <a-checkbox @change="handleChange($event,column)" v-model="column.value" :key="`row-${index}-item-${idx}`" :class="['column-item']"></a-checkbox>
25
25
  </template>
26
26
  <template v-else-if="column.type === 'input'">
27
- <a-input @change="handleChange($event,column,index)" :key="`row-${index}-item-${idx}`" :class="['column-item','item-input']" v-model="column.value" />
27
+ <a-input @change="handleChange($event,column)" :key="`row-${index}-item-${idx}`" :class="['column-item','item-input']" v-model="column.value" />
28
28
  </template>
29
29
  <template v-else-if="column.type === 'radio'">
30
30
  <x-radio
31
31
  :class="['column-item']"
32
32
  :key="`row-${index}-item-${idx}`"
33
33
  :queryParamsName="column.configName"
34
- @change="handleChange($event,column,index)">
34
+ @change="handleChange($event,column)">
35
35
  </x-radio>
36
36
  </template>
37
37
  <template v-else-if="column.type === 'time'">
38
- <x-time-select :key="`row-${index}-item-${idx}`" :class="['column-item']" @change="handleChange($event,column,index)" :queryParamsName="column.configName">
38
+ <x-time-select :key="`row-${index}-item-${idx}`" :class="['column-item']" @change="handleChange($event,column)" :queryParamsName="column.configName">
39
39
  </x-time-select>
40
40
  </template>
41
41
  <template v-else-if="column.type === 'text'">
@@ -51,13 +51,13 @@
51
51
  <a-button
52
52
  :class="['column-item']"
53
53
  :key="`row-${index}-item-${idx}`"
54
- :disabled="column.disabled"
55
- :icon="column.icon"
56
- :loading="column.loading"
57
- :type="column.buttonType || 'default'"
54
+ :disabled="column.customize.disabled"
55
+ :icon="column.customize.icon"
56
+ :loading="column.customize.loading"
57
+ :type="column.customize.buttonType || 'default'"
58
58
  @click="handleButtonClick(column)"
59
59
  >
60
- {{ column.label }}
60
+ {{ column.value }}
61
61
  </a-button>
62
62
  </template>
63
63
  <template v-else>
@@ -99,8 +99,8 @@ export default {
99
99
  split: true,
100
100
  header: null
101
101
  },
102
- results: [],
103
- mapping: [] // 行索引 results数据所在的行
102
+ results: {},
103
+ oldFixedQueryForm: null
104
104
  }
105
105
  },
106
106
  created () {
@@ -116,38 +116,33 @@ export default {
116
116
  ...config
117
117
  }
118
118
  runLogic(config.data, param, 'af-his').then(res => {
119
+ console.log('1', res)
119
120
  that.data = res || []
120
121
  // 将又返回值的数据创建到results
121
122
  for (let i = 0; i < res.length; i++) {
122
123
  const fields = res[i]
123
- if (!fields.item) {
124
+ if (!fields.columns) {
124
125
  continue
125
126
  }
126
- const value = {}
127
- let hasValidData = false // 标识是否有有效数据
128
- for (let j = 0; j < fields.item.length; j++) {
129
- const field = fields.item[j]
127
+ console.log('2', fields)
128
+ for (let j = 0; j < fields.columns.length; j++) {
129
+ const field = fields.columns[j]
130
+ console.log('3', field)
131
+ if (this.results[field.config_id]) {
132
+ console.error(`Config_id 冲突: ${field.config_id} 重复,同一个模板中不能有形同的配置项`)
133
+ return
134
+ }
130
135
  if (field.type === 'selectionBox' || field.type === 'input' || field.type === 'radio' || field.type === 'time') {
131
- value[field.key] = field.value
132
- hasValidData = true
136
+ this.results[field.config_id] = { value: field.value, data_id: field.data_id }
133
137
  }
134
- }
135
- if (hasValidData) {
136
- this.mapping.push(this.results.length)
137
- value.row_key = fields.key
138
- this.results.push(value)
139
- } else {
140
- this.mapping.push(undefined)
138
+ console.log(this.results)
141
139
  }
142
140
  }
143
141
  })
144
142
  },
145
143
  refreshList (param) {
146
- // 清空当前数据和映射关系
147
144
  this.data = []
148
- this.results = []
149
- this.mapping = []
150
- this.results = []
145
+ this.results = {}
151
146
  this.getData(this.queryParamsName, param)
152
147
  },
153
148
  // 行数据排量方式
@@ -159,34 +154,21 @@ export default {
159
154
  return validStyles.includes(style) ? style : 'flex-start'
160
155
  },
161
156
  // 数据发生改变--将修改后的值填充到results
162
- handleChange (e, column, rowIndex) {
163
- const resultIndex = this.mapping[rowIndex]
164
- if (resultIndex === undefined) return
157
+ handleChange (e, column) {
165
158
  if (column.type === 'selectionBox') {
166
- this.results[resultIndex][column.key] = e.target.checked
159
+ this.results[column.config_id].value = e.target.checked
167
160
  } else if (column.type === 'input') {
168
- this.results[resultIndex][column.key] = column.value
161
+ this.results[column.config_id].value = column.value
169
162
  } else if (column.type === 'radio' || column.type === 'time') {
170
- this.results[resultIndex][column.key] = e
163
+ this.results[column.config_id].value = e
171
164
  }
172
165
  },
173
166
  handleButtonClick (item) {
174
- item.loading = true
167
+ item.customize.loading = true
175
168
  const callback = () => {
176
- item.loading = false
169
+ item.customize.loading = false
177
170
  }
178
- if (item.clickEventName && this.$listeners[item.clickEventName]) {
179
- // 交由父级处理
180
- this.$emit(item.clickEventName, item, callback)
181
- } else {
182
- this.defaultAction(item.clickEventName, item, callback)
183
- }
184
- },
185
- defaultAction (clickEventName, item, callback) {
186
- setTimeout(() => {
187
- this.$message.warn(`已触发按钮 [${item.key}],注册事件名 [${clickEventName}],未实现事件函数`)
188
- callback()
189
- }, 200)
171
+ this.$emit('customizeEvent', item.customize, callback)
190
172
  }
191
173
  },
192
174
  watch: {
@@ -30,6 +30,23 @@
30
30
  >
31
31
  </WorkflowDetail>
32
32
  <address-select ref="addressSelect" @setAddress="setForm"></address-select>
33
+ <!-- 协议作废功能 -->
34
+ <a-modal
35
+ v-model="formState"
36
+ :dialog-style="{ top: '5rem' }"
37
+ :z-index="1001"
38
+ title="作废"
39
+ :destroyOnClose="true"
40
+ width="55vw">
41
+ <x-add-native-form
42
+ ref="xCancelForm"
43
+ @onSubmit="submit"
44
+ />
45
+ <template #footer>
46
+ <a-button key="back" @click="formState = false">取消</a-button>
47
+ <a-button key="submit" type="primary" :loading="submitLoading" @click="formSubmit">确认</a-button>
48
+ </template>
49
+ </a-modal>
33
50
  </a-card>
34
51
  </template>
35
52
 
@@ -54,7 +71,10 @@ export default {
54
71
  // 查询配置文件名
55
72
  queryParamsName: 'applyCRUD',
56
73
  // 发起报建弹框控制
57
- applyAddFlag: false
74
+ applyAddFlag: false,
75
+ formState: false,
76
+ submitLoading: false,
77
+ cancelRecord: {}
58
78
  }
59
79
  },
60
80
  computed: {
@@ -101,6 +121,55 @@ export default {
101
121
  },
102
122
  setForm (record) {
103
123
  this.$refs.workFlow.setFormValue({ address: record.f_address })
124
+ },
125
+ // 协议作废
126
+ setCancel (record) {
127
+ this.cancelRecord = record
128
+ this.formState = true
129
+ this.$nextTick(() => {
130
+ getConfigByName('setCancelForm', 'af-apply', (config) => {
131
+ if (this.$refs.xCancelForm) {
132
+ this.$refs.xCancelForm.init({
133
+ formItems: config.formJson,
134
+ title: '补充协议作废',
135
+ businessType: '修改',
136
+ showSubmitBtn: false,
137
+ ...config
138
+ })
139
+ if (this.$refs.xCancelForm) {
140
+ console.log(record)
141
+ // this.$refs.xCancelForm.setForm(recordData)
142
+ }
143
+ } else {
144
+ console.error('xCancelForm组件未加载完成')
145
+ // 延迟重试
146
+ setTimeout(() => {
147
+ this.setCancel(record)
148
+ }, 100)
149
+ }
150
+ })
151
+ })
152
+ },
153
+ async formSubmit () {
154
+ this.submitLoading = true
155
+ const formData = await this.$refs.xCancelForm.asyncSubmit()
156
+ try {
157
+ await this.submit(formData)
158
+ } catch (error) {
159
+ this.$message.error('表单验证失败,请检查填写内容')
160
+ } finally {
161
+ this.submitLoading = false
162
+ }
163
+ },
164
+ async submit (formData) {
165
+ const data = {
166
+ ...formData,
167
+ }
168
+ console.log('==formData', data)
169
+ await runLogic('666', data, 'af-apply').then(() => {
170
+ this.$message.success('操作成功')
171
+ this.formState = false
172
+ })
104
173
  }
105
174
  }
106
175
  }
@@ -39,7 +39,7 @@
39
39
  <!-- 当前步骤历史记录 -->
40
40
  <template v-if="showTab">
41
41
  <x-tab
42
- :compProp="{ buttonState: { add: false, edit: false, delete: false, import: false }}"
42
+ :compProp="{ buttonState: { add: false, edit: false, delete: false, import: false }, disableAction: true }"
43
43
  :local-config="tabDesigner"
44
44
  :body-style="{ padding: 0 }"
45
45
  :tabBarGutter="24"