cnhis-design-vue 0.3.4-beta → 0.3.7-beta
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/es/big-table/index.css +3 -3
- package/es/big-table/index.js +299 -1340
- package/es/button-print/index.css +3 -3
- package/es/drag-layout/index.css +3 -3
- package/es/grid/index.css +3 -3
- package/es/index.css +3 -3
- package/es/index.js +280 -1321
- package/package.json +2 -1
- package/packages/big-table/src/BigTable.vue +102 -42
- package/packages/big-table/src/assets/style/table-base.less +6 -0
- package/packages/big-table/src/assets/style/table-global.less +9 -1
- package/packages/big-table/src/bigTableProps.ts +5 -0
- package/packages/big-table/src/bigTableState.ts +1 -0
- package/packages/big-table/src/components/edit-form/edit-input.vue +19 -0
- package/packages/big-table/src/components/edit-form/edit-select-table.vue +127 -0
- package/packages/big-table/src/components/edit-form/edit-select.vue +36 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/EditForm.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-date-picker/edit-date-picker.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-digital/edit-digital.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-input/edit-input.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-input-password/edit-input-password.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-month-picker/edit-month-picker.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-search/edit-search.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-search-more/edit-search-more.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-select/edit-select.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-select-multiple/edit-select-multiple.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-textarea/edit-textarea.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/edit-time-picker/edit-time-picker.vue +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/editFormProps.ts +0 -0
- package/packages/big-table/src/components/edit-form3/edit-component/register-com.ts +18 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/hooks/useConfigData.ts +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/hooks/useDateType.ts +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/hooks/useFormCommon.ts +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/hooks/useItemDefault.ts +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/hooks/useSearch.ts +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/hooks/useValidateRules.ts +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/interface.ts +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/types.ts +0 -0
- package/packages/big-table/src/components/{edit-form → edit-form3}/utils.ts +0 -0
- package/packages/big-table/src/components/edit-form/edit-component/register-com.ts +0 -18
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.7-beta",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite --host --port 3200",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
37
37
|
"@vitejs/plugin-vue": "^2.2.0",
|
|
38
38
|
"@vitejs/plugin-vue-jsx": "^1.3.8",
|
|
39
|
+
"@vue/compiler-sfc": "^3.2.33",
|
|
39
40
|
"autoprefixer": "^10.4.4",
|
|
40
41
|
"cssnano": "^5.1.7",
|
|
41
42
|
"eslint": "^8.10.0",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
:scroll-x="{ enabled: false }"
|
|
88
88
|
:scroll-y="{ gt: 50 }"
|
|
89
89
|
:row-style="getRowStyle"
|
|
90
|
-
:edit-config="
|
|
90
|
+
:edit-config="state.editConfig"
|
|
91
91
|
:expand-config="{
|
|
92
92
|
lazy: true,
|
|
93
93
|
accordion: columnConfig && columnConfig.accordion,
|
|
@@ -162,7 +162,7 @@ export default create({
|
|
|
162
162
|
</script>
|
|
163
163
|
|
|
164
164
|
<script lang="tsx" setup>
|
|
165
|
-
import { computed, nextTick, onMounted, reactive, ref, useAttrs, watch,
|
|
165
|
+
import { computed, nextTick, onMounted, reactive, ref, useAttrs, watch, isReactive, shallowReactive, onActivated, onUnmounted } from "vue";
|
|
166
166
|
import { useRoute } from 'vue-router';
|
|
167
167
|
import bigTableState from "./bigTableState";
|
|
168
168
|
import bigTableProps from "./bigTableProps";
|
|
@@ -176,7 +176,10 @@ import NoData from "./components/NoData.vue";
|
|
|
176
176
|
import TextOverTooltip from "./components/TextOverTooltip.vue";
|
|
177
177
|
// import SvgIcon from '@/component/svg/index.vue';
|
|
178
178
|
import SvgIcon from "./components/SvgIcon.vue";
|
|
179
|
-
import EditForm from './components/edit-form/EditForm.vue';
|
|
179
|
+
// import EditForm from './components/edit-form/EditForm.vue';
|
|
180
|
+
import EditSelectTable from './components/edit-form/edit-select-table.vue'
|
|
181
|
+
import EditInput from './components/edit-form/edit-input.vue'
|
|
182
|
+
import EditSelect from './components/edit-form/edit-select.vue'
|
|
180
183
|
import {
|
|
181
184
|
NButton,
|
|
182
185
|
NCheckbox,
|
|
@@ -191,7 +194,10 @@ import {
|
|
|
191
194
|
NSwitch,
|
|
192
195
|
NPopover,
|
|
193
196
|
NDropdown,
|
|
194
|
-
NPopconfirm
|
|
197
|
+
NPopconfirm,
|
|
198
|
+
NSelect,
|
|
199
|
+
NPagination,
|
|
200
|
+
NEmpty
|
|
195
201
|
} from "naive-ui";
|
|
196
202
|
import { useMessage } from 'naive-ui'
|
|
197
203
|
import CGrid from '~/grid';
|
|
@@ -351,6 +357,7 @@ const treeConfig = computed(() => {
|
|
|
351
357
|
}
|
|
352
358
|
return result;
|
|
353
359
|
});
|
|
360
|
+
|
|
354
361
|
const hideAllWrap = (e: any) => {
|
|
355
362
|
const path = e.path || (e.composedPath && e.composedPath());
|
|
356
363
|
const noWrap = (className: string) => {
|
|
@@ -373,7 +380,8 @@ const unBindDocumentClick = () => {
|
|
|
373
380
|
}
|
|
374
381
|
onMounted(() => {
|
|
375
382
|
bindDocumentClick();
|
|
376
|
-
state.tableHeight = handleTableHeight(state, props);
|
|
383
|
+
// state.tableHeight = handleTableHeight(state, props);
|
|
384
|
+
state.tableHeight = '520px'
|
|
377
385
|
|
|
378
386
|
// // 子列表在mounted后初始化 直接watch无法触发
|
|
379
387
|
if (!props.isNestTable) return;
|
|
@@ -411,7 +419,6 @@ const loadColumn = (config: any) => {
|
|
|
411
419
|
// this.hasOnlyIcon = config.hasOnlyIcon;
|
|
412
420
|
let columns = formatColumns(config);
|
|
413
421
|
columns = handleGroupColums(columns, props);
|
|
414
|
-
console.log("columns--------------", columns);
|
|
415
422
|
xGrid.value && xGrid.value.reloadColumn(columns);
|
|
416
423
|
|
|
417
424
|
setGroupTreeExpand();
|
|
@@ -422,7 +429,7 @@ const loadData = async (data: any) => {
|
|
|
422
429
|
state.isShowEmpty = !data?.length;
|
|
423
430
|
|
|
424
431
|
const list = JSON.parse(JSON.stringify(data));
|
|
425
|
-
console.log("list--------------", list);
|
|
432
|
+
// console.log("list--------------", list);
|
|
426
433
|
let table = xGrid.value;
|
|
427
434
|
if (!table) return;
|
|
428
435
|
let formatList = setChecklist(list);
|
|
@@ -437,6 +444,14 @@ const loadData = async (data: any) => {
|
|
|
437
444
|
await handleFormTheUniqueKey();
|
|
438
445
|
}
|
|
439
446
|
|
|
447
|
+
formatList = formatList.map((v: any) => {
|
|
448
|
+
return {
|
|
449
|
+
...v,
|
|
450
|
+
selectTableShow: false,
|
|
451
|
+
selectTableDisable: false
|
|
452
|
+
}
|
|
453
|
+
})
|
|
454
|
+
|
|
440
455
|
// reloadData 替换 loadData 保存setting之后需要表格重新reload
|
|
441
456
|
// loadData 加载数据
|
|
442
457
|
// reloadData 加载数据并清除所有状态
|
|
@@ -504,7 +519,13 @@ const formatColumns = (map: any) => {
|
|
|
504
519
|
*/
|
|
505
520
|
// 配置列表
|
|
506
521
|
let { selectType } = getOtherConfigInit() || {};
|
|
507
|
-
let { isBatchSelect, fieldList, showButtonTop, isScanMultiTable } = map;
|
|
522
|
+
let { isBatchSelect, fieldList, showButtonTop, isScanMultiTable, isEdit = false, editConfig = {} } = map;
|
|
523
|
+
if (isEdit) {
|
|
524
|
+
state.editConfig = Object.assign(state.editConfig, editConfig, {
|
|
525
|
+
mode: 'cell',
|
|
526
|
+
autoClear: true
|
|
527
|
+
})
|
|
528
|
+
}
|
|
508
529
|
if (selectType) {
|
|
509
530
|
// 有设置 selectType 强制可选。
|
|
510
531
|
isBatchSelect = 1;
|
|
@@ -537,11 +558,9 @@ const formatColumns = (map: any) => {
|
|
|
537
558
|
fixed: "left",
|
|
538
559
|
align: "center",
|
|
539
560
|
visible: isScanMultiTable || false,
|
|
540
|
-
width: "
|
|
561
|
+
width: "60",
|
|
541
562
|
slots: {
|
|
542
|
-
header: () =>
|
|
543
|
-
return "操作";
|
|
544
|
-
},
|
|
563
|
+
header: () => "操作",
|
|
545
564
|
default: scanMultiOperate,
|
|
546
565
|
},
|
|
547
566
|
},
|
|
@@ -567,14 +586,14 @@ const formatColumns = (map: any) => {
|
|
|
567
586
|
visible: checkVisible,
|
|
568
587
|
resizable: false,
|
|
569
588
|
width: checkMinWidth,
|
|
570
|
-
|
|
589
|
+
slots: selectType === 'checkbox' ? checkboxSlot : null,
|
|
571
590
|
// 修复 vxe-table升级3.x版本 原自定义checkbox样式失效
|
|
572
|
-
slots:
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
591
|
+
// slots:
|
|
592
|
+
// selectType === "checkbox"
|
|
593
|
+
// ? {
|
|
594
|
+
// checkbox: "tooltip_checkbox",
|
|
595
|
+
// }
|
|
596
|
+
// : null,
|
|
578
597
|
showOverflow: true,
|
|
579
598
|
},
|
|
580
599
|
];
|
|
@@ -625,12 +644,17 @@ const formatColumns = (map: any) => {
|
|
|
625
644
|
showOverflow: "title",
|
|
626
645
|
treeNode: treeNode,
|
|
627
646
|
type: type,
|
|
628
|
-
slots: {
|
|
629
|
-
|
|
630
|
-
|
|
647
|
+
// slots: {
|
|
648
|
+
// default: (params: any) => {
|
|
649
|
+
// return formatter(params, item);
|
|
650
|
+
// },
|
|
651
|
+
// },
|
|
652
|
+
slots: isEdit ? {
|
|
653
|
+
edit: (params: any) => formatterEdit(params, item)
|
|
654
|
+
} : {
|
|
655
|
+
default: (params: any) => formatter(params, item)
|
|
631
656
|
},
|
|
632
|
-
}
|
|
633
|
-
editRender: generateEditRender(item),
|
|
657
|
+
editRender: isEdit ? {} : generateEditRender(item)
|
|
634
658
|
});
|
|
635
659
|
|
|
636
660
|
if (filterField && !props.isNestTable && !isScanMultiTable) {
|
|
@@ -671,6 +695,27 @@ const formatColumns = (map: any) => {
|
|
|
671
695
|
state.columnLen = currentColumns.filter((item: any) => item.visible).length;
|
|
672
696
|
return columns;
|
|
673
697
|
};
|
|
698
|
+
const formatterEdit = (params: any, col: any) => {
|
|
699
|
+
let { row, column, $rowIndex, rowIndex } = params
|
|
700
|
+
let formType = column.formType || col.formType
|
|
701
|
+
if (formType === 'selectTable') {
|
|
702
|
+
const propsData = {
|
|
703
|
+
row,
|
|
704
|
+
col
|
|
705
|
+
}
|
|
706
|
+
return <EditSelectTable {...propsData} v-model={[row[col.columnName], 'value']} />
|
|
707
|
+
}
|
|
708
|
+
if (formType === 'input') {
|
|
709
|
+
return <EditInput v-model={[row[col.columnName], 'value']} />
|
|
710
|
+
}
|
|
711
|
+
if (formType === 'select') {
|
|
712
|
+
const propsData = {
|
|
713
|
+
col
|
|
714
|
+
}
|
|
715
|
+
return <EditSelect {...propsData} v-model={[row[col.columnName], 'value']} />
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
674
719
|
// 表格渲染逻辑
|
|
675
720
|
const formatter = (params: any, col: any) => {
|
|
676
721
|
let { row, column, $rowIndex } = params;
|
|
@@ -685,9 +730,10 @@ const formatter = (params: any, col: any) => {
|
|
|
685
730
|
// console.log(dynamicProps);
|
|
686
731
|
// loading 使用
|
|
687
732
|
emit("setWaitEditKeys", column.property);
|
|
688
|
-
return
|
|
689
|
-
|
|
690
|
-
]
|
|
733
|
+
return null
|
|
734
|
+
// return [
|
|
735
|
+
// <EditForm class={`js-inlineEditForm`} key={row[props.primaryKey] + $rowIndex + column.property} data-key={row[props.primaryKey] + $rowIndex + column.property} {...dynamicProps}></EditForm>
|
|
736
|
+
// ];
|
|
691
737
|
}
|
|
692
738
|
}
|
|
693
739
|
|
|
@@ -762,7 +808,7 @@ const formatter = (params: any, col: any) => {
|
|
|
762
808
|
{tileBtnList}
|
|
763
809
|
{foldBtnList}
|
|
764
810
|
{inlineBtnList}
|
|
765
|
-
</span
|
|
811
|
+
</span>
|
|
766
812
|
];
|
|
767
813
|
}
|
|
768
814
|
|
|
@@ -1409,13 +1455,27 @@ const setCheckedMehod = (setChecked: any, row: any) => {
|
|
|
1409
1455
|
}
|
|
1410
1456
|
updateAddCheckedRows(row);
|
|
1411
1457
|
}
|
|
1458
|
+
//
|
|
1459
|
+
const getFormType = (field: string) => {
|
|
1460
|
+
const obj = props.columnConfig.fieldList.find((v: any) => v.columnName === field)
|
|
1461
|
+
return obj ? obj.formType || '' : ''
|
|
1462
|
+
}
|
|
1412
1463
|
//行点击
|
|
1413
1464
|
const handlerClickRow = (data: any) => {
|
|
1414
|
-
console.log("data");
|
|
1465
|
+
console.log("data.", data);
|
|
1415
1466
|
if (isScanMultiTable.value || props.isInlineOperating) return false;
|
|
1416
1467
|
if (vexutils.has(data?.row, GROUP_TITLE_KEY)) return false;
|
|
1417
1468
|
if (state.isTriggerSelectionChange && state.isTree == 0) return false;
|
|
1418
1469
|
let table = xGrid.value;
|
|
1470
|
+
|
|
1471
|
+
const formType = getFormType(data.column.field)
|
|
1472
|
+
console.log('formType---', formType)
|
|
1473
|
+
if (formType === 'selectTable') {
|
|
1474
|
+
// table.clearActived().then(() => {
|
|
1475
|
+
table.setActiveCell(data.row, data.column.field)
|
|
1476
|
+
// })
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1419
1479
|
// 嵌套表与主表click切换时需要清除上次的选中
|
|
1420
1480
|
isAboutNestTable.value && emit('resetNestLastClickTable', table);
|
|
1421
1481
|
|
|
@@ -1956,7 +2016,7 @@ const generateInlineBtnList = (row: any, index: any) => {
|
|
|
1956
2016
|
size="small"
|
|
1957
2017
|
text
|
|
1958
2018
|
>
|
|
1959
|
-
保存
|
|
2019
|
+
{{default: () => '保存'}}
|
|
1960
2020
|
</NButton>
|
|
1961
2021
|
<NButton
|
|
1962
2022
|
style={{ display: row.__isInlineEditing ? "inline-block" : "none" }}
|
|
@@ -1969,13 +2029,13 @@ const generateInlineBtnList = (row: any, index: any) => {
|
|
|
1969
2029
|
size="small"
|
|
1970
2030
|
text
|
|
1971
2031
|
>
|
|
1972
|
-
取消
|
|
2032
|
+
{{default: () => '取消'}}
|
|
1973
2033
|
</NButton>
|
|
1974
2034
|
</span>,
|
|
1975
2035
|
];
|
|
1976
2036
|
};
|
|
1977
2037
|
// 按钮 jsx
|
|
1978
|
-
const getTileBtnList = (row: any, index:
|
|
2038
|
+
const getTileBtnList = (row: any, index: number) => {
|
|
1979
2039
|
return [
|
|
1980
2040
|
(row.tileBtnList?.length &&
|
|
1981
2041
|
row.tileBtnList.map((btn: any, j: any) => {
|
|
@@ -2002,8 +2062,7 @@ const getTileBtnList = (row: any, index: any) => {
|
|
|
2002
2062
|
// {getBtnIcon(btn)}
|
|
2003
2063
|
// {btn.showStyle === "only_icon" ? "" : handleName(btn)}
|
|
2004
2064
|
>
|
|
2005
|
-
{getBtnIcon(btn)}
|
|
2006
|
-
{btn.showStyle === 'only_icon' ? '' : handleName(btn)}
|
|
2065
|
+
{{default: () => [getBtnIcon(btn), btn.showStyle === 'only_icon' ? '' : handleName(btn)]}}
|
|
2007
2066
|
</NButton>
|
|
2008
2067
|
)
|
|
2009
2068
|
);
|
|
@@ -2012,7 +2071,7 @@ const getTileBtnList = (row: any, index: any) => {
|
|
|
2012
2071
|
];
|
|
2013
2072
|
};
|
|
2014
2073
|
// 按钮事件
|
|
2015
|
-
const clickBtn = (row: any, btn: any, index:
|
|
2074
|
+
const clickBtn = (row: any, btn: any, index: number, e: any, j: any) => {
|
|
2016
2075
|
e.preventDefault();
|
|
2017
2076
|
e.stopPropagation();
|
|
2018
2077
|
recordClickBtnInfo(row, index);
|
|
@@ -2051,7 +2110,7 @@ const getBtnIcon = (btn: any, mr = "8px") => {
|
|
|
2051
2110
|
return [icon];
|
|
2052
2111
|
};
|
|
2053
2112
|
// 按钮 jsx
|
|
2054
|
-
const getFoldBtnList = (row: any, index:
|
|
2113
|
+
const getFoldBtnList = (row: any, index: number) => {
|
|
2055
2114
|
const getOptions = () => {
|
|
2056
2115
|
return row.foldBtnList.map((b: any, j: any) => {
|
|
2057
2116
|
return {
|
|
@@ -2073,7 +2132,7 @@ const getFoldBtnList = (row: any, index: any) => {
|
|
|
2073
2132
|
options={getOptions()}
|
|
2074
2133
|
>
|
|
2075
2134
|
<NButton size="small" style="margin-left: 8px">
|
|
2076
|
-
更多 ...
|
|
2135
|
+
{{default: () => '更多 ...'}}
|
|
2077
2136
|
</NButton>
|
|
2078
2137
|
</NDropdown>
|
|
2079
2138
|
)) ||
|
|
@@ -2500,14 +2559,15 @@ defineExpose({
|
|
|
2500
2559
|
clearChecked,
|
|
2501
2560
|
setCurrentRow,
|
|
2502
2561
|
loadColumn,
|
|
2503
|
-
removeInsert
|
|
2562
|
+
removeInsert,
|
|
2563
|
+
xGrid
|
|
2504
2564
|
})
|
|
2505
2565
|
|
|
2506
2566
|
</script>
|
|
2507
|
-
<style lang="less" scoped>
|
|
2508
|
-
@import "./assets/style/table-base.less";
|
|
2567
|
+
<style lang="less" scoped src="./assets/style/table-base.less">
|
|
2568
|
+
// @import "./assets/style/table-base.less";
|
|
2509
2569
|
</style>
|
|
2510
2570
|
|
|
2511
|
-
<style lang="less">
|
|
2512
|
-
@import "./assets/style/table-global.less";
|
|
2571
|
+
<style lang="less" src="./assets/style/table-global.less">
|
|
2572
|
+
// @import "./assets/style/table-global.less";
|
|
2513
2573
|
</style>
|
|
@@ -120,6 +120,11 @@ const bigTableProps = {
|
|
|
120
120
|
// 曾经的mapActions
|
|
121
121
|
resetInlineBatchEdit: Function,
|
|
122
122
|
resetBatchEditRowStatus: Function,
|
|
123
|
+
|
|
124
|
+
querySelectTableList: {
|
|
125
|
+
type: Function,
|
|
126
|
+
default: () => Promise.resolve({ rows: [], pageCount: 0 })
|
|
127
|
+
}
|
|
123
128
|
};
|
|
124
129
|
|
|
125
130
|
export default bigTableProps;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, ref, reactive } from 'vue'
|
|
3
|
+
import { NInput } from 'naive-ui'
|
|
4
|
+
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
name: 'EditInput',
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
components: {
|
|
9
|
+
NInput
|
|
10
|
+
},
|
|
11
|
+
setup (props, { attrs, slots, emit }) {
|
|
12
|
+
|
|
13
|
+
return () => [
|
|
14
|
+
<NInput {...attrs} />
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
</script>
|
|
19
|
+
<style lang="less" scoped></style>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, ref, reactive } from 'vue'
|
|
3
|
+
import { NSelect, NPagination, NEmpty, NSpin, NSpace } from 'naive-ui'
|
|
4
|
+
import CGrid from '~/grid'
|
|
5
|
+
import vexutils from '@/utils/vexutils'
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: 'EditSelectTable',
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
components: {
|
|
11
|
+
NSelect,
|
|
12
|
+
CGrid,
|
|
13
|
+
NPagination,
|
|
14
|
+
NEmpty,
|
|
15
|
+
NSpin,
|
|
16
|
+
NSpace
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
row: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: {}
|
|
22
|
+
},
|
|
23
|
+
col: {
|
|
24
|
+
type: Object,
|
|
25
|
+
default: {}
|
|
26
|
+
},
|
|
27
|
+
value: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ''
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
emits: ['update:value'],
|
|
33
|
+
setup (props, { attrs, slots, emit }) {
|
|
34
|
+
const state = reactive({
|
|
35
|
+
value: props.value,
|
|
36
|
+
row: JSON.parse(JSON.stringify(props.row)),
|
|
37
|
+
page: 1,
|
|
38
|
+
pageCount: 0,
|
|
39
|
+
keyword: '',
|
|
40
|
+
data: [],
|
|
41
|
+
columns: JSON.parse(JSON.stringify(props.col.tableColumn)),
|
|
42
|
+
loading: false,
|
|
43
|
+
show: true
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const selectTableFocus = () => {
|
|
47
|
+
state.show = true
|
|
48
|
+
state.page = 1
|
|
49
|
+
state.keyword = ''
|
|
50
|
+
state.pageCount = 0
|
|
51
|
+
querySelectTableList()
|
|
52
|
+
}
|
|
53
|
+
const querySelectTableList = async () => {
|
|
54
|
+
state.loading = true
|
|
55
|
+
const obj = {
|
|
56
|
+
page: state.page,
|
|
57
|
+
keyword: state.keyword
|
|
58
|
+
}
|
|
59
|
+
const { data, pageCount } = await props.col.querySelectTableList(obj)
|
|
60
|
+
state.data = data
|
|
61
|
+
state.pageCount = pageCount
|
|
62
|
+
state.loading = false
|
|
63
|
+
}
|
|
64
|
+
let selectTableSearch = (value: string) => {
|
|
65
|
+
console.log('keyword', value)
|
|
66
|
+
state.keyword = value
|
|
67
|
+
querySelectTableList()
|
|
68
|
+
}
|
|
69
|
+
selectTableSearch = vexutils.debounce(selectTableSearch, 800)
|
|
70
|
+
const getSelectTableGrid = () => {
|
|
71
|
+
const config = {
|
|
72
|
+
border: 'outer',
|
|
73
|
+
resizable: true,
|
|
74
|
+
autoResize: true,
|
|
75
|
+
showOverflow: true,
|
|
76
|
+
showHeaderOverflow: true,
|
|
77
|
+
highlightHoverRow: true,
|
|
78
|
+
highlightCurrentRow: true,
|
|
79
|
+
maxHeight: '500',
|
|
80
|
+
align: 'center',
|
|
81
|
+
columns: state.columns,
|
|
82
|
+
data: state.data
|
|
83
|
+
}
|
|
84
|
+
return <CGrid {...config} onCellClick={(data: any) => onCellClick(data)}>{{
|
|
85
|
+
empty: () => <NEmpty description="无数据" />
|
|
86
|
+
}}</CGrid>
|
|
87
|
+
}
|
|
88
|
+
const onCellClick = (data: any) => {
|
|
89
|
+
emit('update:value', data.row?.[props.col.columnName]);
|
|
90
|
+
state.show = false
|
|
91
|
+
}
|
|
92
|
+
const getPagination = () => {
|
|
93
|
+
const pagination = () => {
|
|
94
|
+
return <NPagination
|
|
95
|
+
v-model={[state.page, 'page']}
|
|
96
|
+
pageCount={state.pageCount}
|
|
97
|
+
onUpdatePage={(page: number) => querySelectTableList()}
|
|
98
|
+
/>
|
|
99
|
+
}
|
|
100
|
+
return <NSpace justify="space-between" align="center" style="margin-top: 5px">{[`共${state.pageCount}条`, pagination()]}</NSpace>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return () => [
|
|
104
|
+
<NSelect
|
|
105
|
+
class="form-select-table"
|
|
106
|
+
options={[]}
|
|
107
|
+
consistentMenuWidth={false}
|
|
108
|
+
clearable
|
|
109
|
+
filterable
|
|
110
|
+
to={false}
|
|
111
|
+
show={state.show}
|
|
112
|
+
loading={state.loading}
|
|
113
|
+
onFocus={selectTableFocus}
|
|
114
|
+
onBlur={() => state.show = false}
|
|
115
|
+
onSearch={selectTableSearch}
|
|
116
|
+
>{{
|
|
117
|
+
action: () => state.loading ? <NSpace justify="center"><NSpin class="spin" size="small" /></NSpace> : [getSelectTableGrid(), state.pageCount ? getPagination() : null]
|
|
118
|
+
}}</NSelect>
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
</script>
|
|
123
|
+
<style lang="less" scoped>
|
|
124
|
+
.spin {
|
|
125
|
+
margin: 80px auto;
|
|
126
|
+
}
|
|
127
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, ref, reactive } from 'vue'
|
|
3
|
+
import { NSelect } from 'naive-ui'
|
|
4
|
+
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
name: 'EditSelect',
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
components: {
|
|
9
|
+
NSelect
|
|
10
|
+
},
|
|
11
|
+
props: {
|
|
12
|
+
col: {
|
|
13
|
+
type: Object,
|
|
14
|
+
default: {}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
setup (props, { attrs, slots, emit }) {
|
|
18
|
+
const state = reactive({
|
|
19
|
+
options: JSON.parse(JSON.stringify(props.col.options || []))
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
return () => [
|
|
23
|
+
<NSelect
|
|
24
|
+
{...attrs}
|
|
25
|
+
options={state.options}
|
|
26
|
+
consistentMenuWidth={false}
|
|
27
|
+
clearable
|
|
28
|
+
filterable
|
|
29
|
+
to={false}
|
|
30
|
+
placeholder="请选择"
|
|
31
|
+
/>
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
</script>
|
|
36
|
+
<style lang="less" scoped></style>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/editFormProps.ts
RENAMED
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// const requireComponent = import.meta.globEager("./edit.*?\.(vue|ts)$/");
|
|
2
|
+
|
|
3
|
+
// let cmps: any= {};
|
|
4
|
+
// Object.values(requireComponent).forEach(cmp => {
|
|
5
|
+
// cmps[cmp.name] = cmp;
|
|
6
|
+
// })
|
|
7
|
+
|
|
8
|
+
// console.log(cmps, "cmps");
|
|
9
|
+
export default {
|
|
10
|
+
data() {
|
|
11
|
+
return {};
|
|
12
|
+
},
|
|
13
|
+
computed: {},
|
|
14
|
+
methods: {
|
|
15
|
+
},
|
|
16
|
+
// components: cmps
|
|
17
|
+
};
|
|
18
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/packages/big-table/src/components/{edit-form → edit-form3}/hooks/useValidateRules.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const requireComponent = import.meta.globEager("./edit.*?\.(vue|ts)$/");
|
|
2
|
-
|
|
3
|
-
let cmps: any= {};
|
|
4
|
-
Object.values(requireComponent).forEach(cmp => {
|
|
5
|
-
cmps[cmp.name] = cmp;
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
console.log(cmps, "cmps");
|
|
9
|
-
export default {
|
|
10
|
-
data() {
|
|
11
|
-
return {};
|
|
12
|
-
},
|
|
13
|
-
computed: {},
|
|
14
|
-
methods: {
|
|
15
|
-
},
|
|
16
|
-
components: cmps
|
|
17
|
-
};
|
|
18
|
-
|