vue2-client 1.2.116 → 1.3.1

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.
@@ -83,6 +83,8 @@ export default {
83
83
  isFormShow: true,
84
84
  // 当使用logic获取到表单表格配置时, 将配置对象直接传入到x-table用于查询
85
85
  queryParams: null,
86
+ // 服务名称
87
+ serviceName: 'af-system',
86
88
  // 表格列集合
87
89
  tableColumns: [],
88
90
  // 操作按钮集合
@@ -187,32 +189,13 @@ export default {
187
189
  watch: {
188
190
  logicParam: {
189
191
  handler () {
190
- this.mainLoading = true
191
- this.form = {}
192
- indexedDB.getByWeb(`${this.logicName}_${JSON.stringify(this.logicParam)}`, commonApi.getColumnsJson, { logic: this.logicName, logicParam: this.logicParam }, (ret) => {
193
- this.queryParams = ret
194
- this.tableColumns = ret.columnJson
195
- this.formItems = ret.formJson
196
- this.buttonState = ret.buttonState
197
- this.customAoM = ret.customAoM
198
- this.customQuery = ret.customQuery
199
- this.mainLoading = false
200
- this.loaded = true
201
- })
192
+ this.getColumnJsonByLogic()
202
193
  },
203
194
  deep: true
204
195
  },
205
196
  fixedQueryForm: {
206
197
  handler () {
207
- this.form = {}
208
- indexedDB.getByWeb(this.queryParamsName, commonApi.getColumnsJson, { str: this.queryParamsName }, (ret) => {
209
- this.tableColumns = ret.columnJson
210
- this.formItems = ret.formJson
211
- this.buttonState = ret.buttonState
212
- this.customAoM = ret.customAoM
213
- this.customQuery = ret.customQuery
214
- this.loaded = true
215
- })
198
+ this.getColumnsJson()
216
199
  },
217
200
  deep: true
218
201
  },
@@ -237,29 +220,35 @@ export default {
237
220
  clearRowKeys () {
238
221
  this.$refs.xTable.clearRowKeys()
239
222
  },
223
+ setParams (res) {
224
+ this.tableColumns = res.columnJson
225
+ this.formItems = res.formJson
226
+ this.buttonState = res.buttonState
227
+ this.serviceName = res.serviceName
228
+ this.customAoM = res.customAoM
229
+ this.customQuery = res.customQuery
230
+ this.mainLoading = false
231
+ this.loaded = true
232
+ },
233
+ getColumnsJson () {
234
+ this.mainLoading = true
235
+ indexedDB.getByWeb(this.queryParamsName, commonApi.getColumnsJson, { str: this.queryParamsName }, (ret) => {
236
+ this.setParams(ret)
237
+ })
238
+ },
240
239
  getColumnsJsonBySource () {
241
240
  this.mainLoading = true
242
241
  post(commonApi.getColumnsJson, { queryObject: this.queryParamsJson }).then(res => {
243
242
  this.queryParams = res
244
- this.tableColumns = this.queryParams.columnJson
245
- this.formItems = this.queryParams.formJson
246
- this.buttonState = this.queryParams.buttonState
247
- this.customAoM = this.queryParams.customAoM
248
- this.customQuery = this.queryParams.customQuery
249
- this.mainLoading = false
250
- this.loaded = true
243
+ this.setParams(res)
251
244
  })
252
245
  },
253
- getColumnsJson () {
246
+ getColumnJsonByLogic () {
247
+ this.form = {}
254
248
  this.mainLoading = true
255
- indexedDB.getByWeb(this.queryParamsName, commonApi.getColumnsJson, { str: this.queryParamsName }, (ret) => {
256
- this.tableColumns = ret.columnJson
257
- this.formItems = ret.formJson
258
- this.buttonState = ret.buttonState
259
- this.customAoM = ret.customAoM
260
- this.customQuery = ret.customQuery
261
- this.mainLoading = false
262
- this.loaded = true
249
+ indexedDB.getByWeb(`${this.logicName}_${JSON.stringify(this.logicParam)}`, commonApi.getColumnsJson, { logic: this.logicName, logicParam: this.logicParam }, (ret) => {
250
+ this.queryParams = ret
251
+ this.setParams(ret)
263
252
  })
264
253
  },
265
254
  // 查询表单提交
@@ -273,7 +262,7 @@ export default {
273
262
  return false
274
263
  }
275
264
  },
276
- // TODO 新增/修改数据表单提交
265
+ // 新增/修改数据表单提交
277
266
  onAddOrModify (res) {
278
267
  if (this.viewMode) {
279
268
  this.$message.info('预览模式禁止新增')
@@ -300,10 +289,10 @@ export default {
300
289
  const realKey = key.substring(key.indexOf('_') + 1)
301
290
  requestParameters.form[realKey] = res.form[key]
302
291
  }
303
- if (!this.customAoM || this.customAoM?.length === 0) {
292
+ if (!this.customAoM || this.customAoM?.length === 0) {
304
293
  this.customAoM = undefined
305
294
  }
306
- addOrModify(requestParameters, this.customAoM).then(res => {
295
+ addOrModify(requestParameters, this.customAoM, this.serviceName).then(res => {
307
296
  this.$message.success(this.businessType + '成功!')
308
297
  this.loading = false
309
298
  this.modelVisible = false
@@ -329,7 +318,7 @@ export default {
329
318
  }
330
319
  }
331
320
  if (!this.isTableTemp) {
332
- result = query(requestParameters)
321
+ result = query(requestParameters, undefined, this.serviceName)
333
322
  }
334
323
  this.$emit('afterQuery', result)
335
324
  callback(result)
@@ -364,7 +353,7 @@ export default {
364
353
  if (!this.customQuery || this.customQuery?.length === 0) {
365
354
  this.customQuery = undefined
366
355
  }
367
- queryWithResource(requestParameters, this.customQuery).then(res => {
356
+ queryWithResource(requestParameters, this.customQuery, this.serviceName).then(res => {
368
357
  this.modifyModelData = { data: res.data[0], images: res.images, files: res.files }
369
358
  this.modelVisible = true
370
359
  this.editDataLoading = false
@@ -391,7 +380,7 @@ export default {
391
380
  queryParamsName: this.queryParamsName,
392
381
  idList: this.selectedRowKeys
393
382
  }
394
- remove(requestParameters).then(res => {
383
+ remove(requestParameters, undefined, this.serviceName).then(res => {
395
384
  this.loading = false
396
385
  this.$message.success('删除成功!')
397
386
  this.$refs.xTable.clearRowKeys()