1
1
import type { Ref } from 'vue'
2
- import { toRaw } from 'vue'
3
2
import locales from '../locales'
4
3
5
4
import type { DataGroupResp , DataQuerySliceReq , DataResp , DictItemsResp , EditableDataResp , LayoutModifyProps , SimpleLayoutProps , TableStyleModifyProps } from '../props'
@@ -45,7 +44,7 @@ export async function watch() {
45
44
export async function loadData ( byGroupValue ?: any , returnOnlyAgg ?: boolean , layoutId ?: string ) {
46
45
const layout = layoutId ? layoutsConf . find ( layout => layout . id === layoutId ) ! : layoutsConf . find ( layout => layout . id === currentLayoutId . value ) !
47
46
48
- const rawLayout = toRaw ( layout )
47
+ const rawLayout = deepToRaw ( layout )
49
48
50
49
const showColumns = rawLayout . columns . filter ( column => ! column . hide ) . map ( column => column . name ) . slice ( )
51
50
if ( tableConf . parentPkColumnName && rawLayout . columns . findIndex ( column => column . name === tableConf . parentPkColumnName ) === - 1 ) {
@@ -153,7 +152,7 @@ export async function loadData(byGroupValue?: any, returnOnlyAgg?: boolean, layo
153
152
* @param newRecords 要新建的数据 / Records to be created
154
153
*/
155
154
export async function newData ( newRecords : { [ columnName : string ] : any } [ ] ) {
156
- newRecords = toRaw ( newRecords )
155
+ newRecords = deepToRaw ( newRecords )
157
156
const layout = layoutsConf . find ( layout => layout . id === currentLayoutId . value ) !
158
157
159
158
if ( ! events . newData ) {
@@ -182,7 +181,7 @@ export async function newData(newRecords: { [columnName: string]: any }[]) {
182
181
* @param targetRecordPks 要复制的数据主键 / Data primary keys to be copied
183
182
*/
184
183
export async function copyData ( targetRecordPks : any [ ] ) {
185
- targetRecordPks = toRaw ( targetRecordPks )
184
+ targetRecordPks = deepToRaw ( targetRecordPks )
186
185
const layout = layoutsConf . find ( layout => layout . id === currentLayoutId . value ) !
187
186
188
187
if ( ! events . copyData ) {
@@ -211,7 +210,7 @@ export async function copyData(targetRecordPks: any[]) {
211
210
* @param changedRecords 要修改的数据 / Data to be modified
212
211
*/
213
212
export async function modifyData ( changedRecords : { [ columnName : string ] : any } [ ] ) {
214
- changedRecords = toRaw ( changedRecords )
213
+ changedRecords = deepToRaw ( changedRecords )
215
214
216
215
const layout = layoutsConf . find ( layout => layout . id === currentLayoutId . value ) !
217
216
@@ -243,7 +242,7 @@ export async function modifyData(changedRecords: { [columnName: string]: any }[]
243
242
* @param deletedRecordPks 要删除的数据主键 / Data primary keys to be deleted
244
243
*/
245
244
export async function deleteData ( deletedRecordPks : any [ ] ) {
246
- deletedRecordPks = toRaw ( deletedRecordPks )
245
+ deletedRecordPks = deepToRaw ( deletedRecordPks )
247
246
248
247
const layout = layoutsConf . find ( layout => layout . id === currentLayoutId . value ) !
249
248
@@ -273,7 +272,7 @@ export async function deleteData(deletedRecordPks: any[]) {
273
272
* @param checkRecordPks 要检查的数据主键 / Data primary keys to be checked
274
273
*/
275
274
export async function loadEditableData ( checkRecordPks : any [ ] ) : Promise < EditableDataResp > {
276
- checkRecordPks = toRaw ( checkRecordPks )
275
+ checkRecordPks = deepToRaw ( checkRecordPks )
277
276
278
277
const layout = layoutsConf . find ( layout => layout . id === currentLayoutId . value ) !
279
278
@@ -299,7 +298,7 @@ export async function loadEditableData(checkRecordPks: any[]): Promise<EditableD
299
298
* @param selectedRecordPks 选择的数据主键 / Selected data primary keys
300
299
*/
301
300
export async function selectData ( selectedRecordPks : any [ ] ) {
302
- selectedRecordPks = toRaw ( selectedRecordPks )
301
+ selectedRecordPks = deepToRaw ( selectedRecordPks )
303
302
304
303
const layout = layoutsConf . find ( layout => layout . id === currentLayoutId . value ) !
305
304
@@ -354,7 +353,7 @@ export async function clickCell(clickedRecordPk: any, clickedColumnName: string)
354
353
* @returns 字典项列表 / Dictionary item list
355
354
*/
356
355
export async function loadCellDictItems ( dictName : string , filterValue ?: any , slice ?: DataQuerySliceReq ) : Promise < DictItemsResp > {
357
- slice = toRaw ( slice )
356
+ slice = deepToRaw ( slice )
358
357
359
358
const layout = layoutsConf . find ( layout => layout . id === currentLayoutId . value ) !
360
359
@@ -381,8 +380,8 @@ export async function loadCellDictItems(dictName: string, filterValue?: any, sli
381
380
* @returns 字典项列表 / Dictionary item list
382
381
*/
383
382
export async function loadCellDictItemsWithMultiConds ( conds : { [ columnName : string ] : any [ ] } , slice ?: DataQuerySliceReq ) : Promise < { [ columnName : string ] : DictItemsResp } > {
384
- conds = toRaw ( conds )
385
- slice = toRaw ( slice )
383
+ conds = deepToRaw ( conds )
384
+ slice = deepToRaw ( slice )
386
385
387
386
const layout = layoutsConf . find ( layout => layout . id === currentLayoutId . value ) !
388
387
@@ -407,7 +406,7 @@ export async function loadCellDictItemsWithMultiConds(conds: { [columnName: stri
407
406
* @param changedStyleProps 修改的样式属性 / Modified style properties
408
407
*/
409
408
export async function modifyStyles ( changedStyleProps : TableStyleModifyProps ) {
410
- changedStyleProps = toRaw ( changedStyleProps )
409
+ changedStyleProps = deepToRaw ( changedStyleProps )
411
410
412
411
const layout = layoutsConf . find ( layout => layout . id === currentLayoutId . value ) !
413
412
@@ -525,9 +524,10 @@ export async function modifyLayout(changedLayoutProps: LayoutModifyProps, byGrou
525
524
526
525
changedLayoutProps . slice !== undefined && ( layout . slice = changedLayoutProps . slice )
527
526
changedLayoutProps . showSelectColumn !== undefined && ( layout . showSelectColumn = changedLayoutProps . showSelectColumn )
527
+ changedLayoutProps . actionColumn !== undefined && ( layout . actionColumn = changedLayoutProps . actionColumn )
528
+
528
529
changedLayoutProps . subDataShowKind !== undefined && ( layout . subDataShowKind = changedLayoutProps . subDataShowKind )
529
530
530
- changedLayoutProps . actionColumn !== undefined && ( layout . actionColumn = changedLayoutProps . actionColumn )
531
531
changedLayoutProps . gantt !== undefined && ( layout . gantt = changedLayoutProps . gantt )
532
532
changedLayoutProps . filter !== undefined && ( layout . filter = changedLayoutProps . filter )
533
533
changedLayoutProps . group !== undefined && ( layout . group = changedLayoutProps . group )
0 commit comments