vue2-client 1.9.45 → 1.9.46
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 +1 -1
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +52 -13
- package/src/base-client/components/common/XFormTable/demo.vue +0 -1
- package/src/base-client/components/common/XTable/XTable.vue +17 -0
- package/src/pages/DynamicStatistics/FavoriteList.vue +0 -1
- package/src/pages/NewDynamicStatistics/FavoriteList.vue +0 -1
- package/src/router/guards.js +0 -1
- package/src/utils/request.js +1 -1
- package/vue.config.js +4 -1
package/package.json
CHANGED
|
@@ -76,6 +76,19 @@
|
|
|
76
76
|
/>
|
|
77
77
|
</a-card>
|
|
78
78
|
</a-row>
|
|
79
|
+
<a-row :gutter="16" v-for="(item, key) in childTableData" :key="'childTableRow' + key">
|
|
80
|
+
<a-card :title="item.name" :bordered="false" size="small">
|
|
81
|
+
<x-form-table
|
|
82
|
+
:key="'childTable_' + item.model"
|
|
83
|
+
:title="item.name"
|
|
84
|
+
:queryParamsName="item.childTableConfigName"
|
|
85
|
+
:localEditMode="true"
|
|
86
|
+
:fixed-query-form="childTableFixedQueryForm(item)"
|
|
87
|
+
:service-name="serviceName"
|
|
88
|
+
:ref="'childXFormTable_' + item.model">
|
|
89
|
+
</x-form-table>
|
|
90
|
+
</a-card>
|
|
91
|
+
</a-row>
|
|
79
92
|
<a-row type="flex" justify="end">
|
|
80
93
|
<a-button v-if="showSubmitBtn" :loading="loading" type="primary" @click="onSubmit()">提交</a-button>
|
|
81
94
|
</a-row>
|
|
@@ -94,7 +107,8 @@ import { executeStrFunction } from '@vue2-client/utils/runEvalFunction'
|
|
|
94
107
|
export default {
|
|
95
108
|
name: 'XAddNativeForm',
|
|
96
109
|
components: {
|
|
97
|
-
XFormItem
|
|
110
|
+
XFormItem,
|
|
111
|
+
XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable/XFormTable.vue')
|
|
98
112
|
},
|
|
99
113
|
props: {},
|
|
100
114
|
data () {
|
|
@@ -130,8 +144,6 @@ export default {
|
|
|
130
144
|
rules: {},
|
|
131
145
|
// 调用logic获取数据源的追加参数
|
|
132
146
|
getDataParams: {},
|
|
133
|
-
// 是否处理表单key
|
|
134
|
-
isKeyHandle: true,
|
|
135
147
|
// 动态简易表单集合
|
|
136
148
|
simpleFormJsonData: {},
|
|
137
149
|
// 待修改的数据集
|
|
@@ -167,6 +179,12 @@ export default {
|
|
|
167
179
|
}
|
|
168
180
|
)
|
|
169
181
|
},
|
|
182
|
+
// 过滤出用于子表数据新增/修改场景的表单项
|
|
183
|
+
childTableData: function () {
|
|
184
|
+
return this.formItems.filter((item) => {
|
|
185
|
+
return item.type === 'childTable'
|
|
186
|
+
})
|
|
187
|
+
},
|
|
170
188
|
// 过滤出用于静默新增场景的表单项
|
|
171
189
|
silenceAddJsonData: function () {
|
|
172
190
|
return this.formItems.filter(function (item) {
|
|
@@ -203,7 +221,7 @@ export default {
|
|
|
203
221
|
init (params) {
|
|
204
222
|
const {
|
|
205
223
|
configName, configContent, formItems, formJson, viewMode, isHandleFormKey = true,
|
|
206
|
-
showSubmitBtn = true, serviceName,
|
|
224
|
+
showSubmitBtn = true, serviceName,
|
|
207
225
|
modifyModelData = {}, businessType, title, fixedAddForm = {}, getDataParams = {},
|
|
208
226
|
simpleFormJsonData = {}, env = 'prod', layout, xAddFormLayout = 'horizontal'
|
|
209
227
|
} = params
|
|
@@ -226,9 +244,8 @@ export default {
|
|
|
226
244
|
this.getDataParams = getDataParams
|
|
227
245
|
this.simpleFormJsonData = simpleFormJsonData
|
|
228
246
|
this.env = env
|
|
229
|
-
this.isKeyHandle = isKeyHandle
|
|
230
247
|
// 如果 fixedAddForm 有 selected_id 值,并且设置了处理表单key值,则多给 selected_id 加前缀 避免处理错误
|
|
231
|
-
if (fixedAddForm.selected_id && this.
|
|
248
|
+
if (fixedAddForm.selected_id && this.isHandleFormKey) {
|
|
232
249
|
fixedAddForm._selected_id = fixedAddForm.selected_id
|
|
233
250
|
delete fixedAddForm.selected_id
|
|
234
251
|
}
|
|
@@ -553,16 +570,29 @@ export default {
|
|
|
553
570
|
async onSubmit () {
|
|
554
571
|
const valid = await this.validateForm()
|
|
555
572
|
if (!valid) return false
|
|
573
|
+
if (this.viewMode) {
|
|
574
|
+
this.$message.info('预览模式禁止新增和修改')
|
|
575
|
+
return false
|
|
576
|
+
}
|
|
556
577
|
this.loading = true
|
|
557
578
|
const requestForm = this.prepareForm()
|
|
558
579
|
await this.appendSilenceAddFields(requestForm)
|
|
559
|
-
|
|
560
580
|
const realForm = this.handleFormKeys(requestForm)
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
581
|
+
// 增加子表数据
|
|
582
|
+
if (this.childTableData.length > 0) {
|
|
583
|
+
for (const item of this.childTableData) {
|
|
584
|
+
const childModel = item.model
|
|
585
|
+
const childData = this.$refs['childXFormTable_' + item.model][0].getTableData()
|
|
586
|
+
for (let i = 0; i < childData.length; i++) {
|
|
587
|
+
childData[i] = this.handleFormKeys(childData[i])
|
|
588
|
+
// 外键不需要带表别名,所以此处放到表单处理后赋值
|
|
589
|
+
if (realForm.id) {
|
|
590
|
+
childData[i][item.childTableForeignKeyName] = realForm.id
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
realForm[childModel] = childData
|
|
594
|
+
}
|
|
564
595
|
}
|
|
565
|
-
|
|
566
596
|
if (this.$listeners.onSubmit) {
|
|
567
597
|
// 交由父级处理
|
|
568
598
|
this.$emit('onSubmit', {
|
|
@@ -610,6 +640,15 @@ export default {
|
|
|
610
640
|
})
|
|
611
641
|
},
|
|
612
642
|
|
|
643
|
+
childTableFixedQueryForm (item) {
|
|
644
|
+
if (this.modifyModelData?.primaryKeyData) {
|
|
645
|
+
const fixedForm = {}
|
|
646
|
+
fixedForm[item.childTableForeignKeyName] = Object.values(this.modifyModelData.primaryKeyData)[0]
|
|
647
|
+
return fixedForm
|
|
648
|
+
}
|
|
649
|
+
return null
|
|
650
|
+
},
|
|
651
|
+
|
|
613
652
|
prepareForm () {
|
|
614
653
|
const form = { ...this.form }
|
|
615
654
|
for (const key of Object.keys(form)) {
|
|
@@ -667,7 +706,7 @@ export default {
|
|
|
667
706
|
}
|
|
668
707
|
realForm[extraFormKey][realKey] = value
|
|
669
708
|
} else {
|
|
670
|
-
const realKey = this.
|
|
709
|
+
const realKey = this.isHandleFormKey ? this.getRealKey(key) : key
|
|
671
710
|
// 如果发生重名,不覆盖,把key的别名带上
|
|
672
711
|
if (realForm[realKey]) {
|
|
673
712
|
realForm[key] = value
|
|
@@ -722,7 +761,7 @@ export default {
|
|
|
722
761
|
}
|
|
723
762
|
// 对动态简易表单项特殊处理
|
|
724
763
|
for (const key in modifyModelData.data) {
|
|
725
|
-
const realKey = this.
|
|
764
|
+
const realKey = this.isHandleFormKey ? this.getRealKey(key) : key
|
|
726
765
|
if (this.simpleFormJsonData[realKey]) {
|
|
727
766
|
const extraForm = JSON.parse(modifyModelData.data[key])
|
|
728
767
|
for (const key in extraForm) {
|
|
@@ -304,6 +304,8 @@ export default {
|
|
|
304
304
|
localEditMode: false,
|
|
305
305
|
// 本地编辑模式所用数据源
|
|
306
306
|
localEditModeDataSource: [],
|
|
307
|
+
// 本地编辑模式数据源是否已由外部加载
|
|
308
|
+
isLocalDataSourceLoadedExternally: false,
|
|
307
309
|
// 是否展示右侧工具栏
|
|
308
310
|
showRightTools: true,
|
|
309
311
|
// 加载数据方法 必须为 Promise 对象
|
|
@@ -609,6 +611,8 @@ export default {
|
|
|
609
611
|
this.primaryKey = primaryKey
|
|
610
612
|
this.buttonState = buttonState
|
|
611
613
|
if (this.localEditMode) {
|
|
614
|
+
this.localEditModeDataSource = []
|
|
615
|
+
this.isLocalDataSourceLoadedExternally = false
|
|
612
616
|
this.buttonState.import = false
|
|
613
617
|
this.buttonState.export = false
|
|
614
618
|
this.showRightTools = false
|
|
@@ -670,6 +674,19 @@ export default {
|
|
|
670
674
|
async loadTableData (requestParameters) {
|
|
671
675
|
let result
|
|
672
676
|
if (this.localEditMode) {
|
|
677
|
+
if (!this.isLocalDataSourceLoadedExternally && requestParameters?.conditionParams && Object.keys(requestParameters?.conditionParams).length > 0) {
|
|
678
|
+
const result = await query(Object.assign(requestParameters, { userId: this.currUser?.id }),
|
|
679
|
+
this.serviceName, this.env === 'dev')
|
|
680
|
+
if (result.data) {
|
|
681
|
+
let no = 0
|
|
682
|
+
this.localEditModeDataSource = result.data.map(item => {
|
|
683
|
+
item['序号'] = no
|
|
684
|
+
no++
|
|
685
|
+
return item
|
|
686
|
+
})
|
|
687
|
+
}
|
|
688
|
+
this.isLocalDataSourceLoadedExternally = true
|
|
689
|
+
}
|
|
673
690
|
result = new Promise((resolve) => {
|
|
674
691
|
resolve({
|
|
675
692
|
data: this.localEditModeDataSource
|
package/src/router/guards.js
CHANGED
|
@@ -169,7 +169,6 @@ const loginGuard = (to, from, next, options) => {
|
|
|
169
169
|
r: v4LoginData.r
|
|
170
170
|
}
|
|
171
171
|
Vue.$store.commit('account/setLogin', login)
|
|
172
|
-
console.log('Vue.$store.state?.setting?.menuData', JSON.stringify(Vue.$store.state?.setting?.menuData))
|
|
173
172
|
if (!Vue.$store.state?.setting?.menuData || Vue.$store.state?.setting?.menuData?.length === 0) {
|
|
174
173
|
loadRoutes(funcToRouter(v4LoginData.functions))
|
|
175
174
|
}
|
package/src/utils/request.js
CHANGED
package/vue.config.js
CHANGED
|
@@ -15,7 +15,8 @@ const v3Server = 'http://aote-office.8866.org:31567'
|
|
|
15
15
|
const gateway = 'http://192.168.50.67:31467'
|
|
16
16
|
const testUpload = 'http://123.60.214.109:8406'
|
|
17
17
|
const OSSServerDev = 'http://192.168.50.67:30351'
|
|
18
|
-
const revenue = 'http://aote-office.8866.org:31567'
|
|
18
|
+
// const revenue = 'http://aote-office.8866.org:31567'
|
|
19
|
+
const revenue = 'http://127.0.0.1:8080'
|
|
19
20
|
// const OSSServerProd = 'http://192.168.50.67:31351'
|
|
20
21
|
// const testUploadLocal = 'http://127.0.0.1:9001'
|
|
21
22
|
// v3 铜川
|
|
@@ -65,12 +66,14 @@ module.exports = {
|
|
|
65
66
|
'/api': {
|
|
66
67
|
// v3用
|
|
67
68
|
// pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
|
|
69
|
+
pathRewrite: { '^/api/': '/' },
|
|
68
70
|
target: revenue,
|
|
69
71
|
changeOrigin: true
|
|
70
72
|
},
|
|
71
73
|
'/devApi': {
|
|
72
74
|
// v3用
|
|
73
75
|
// pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
|
|
76
|
+
pathRewrite: { '^/api/': '/' },
|
|
74
77
|
target: revenue,
|
|
75
78
|
changeOrigin: true
|
|
76
79
|
},
|