cnhis-design-vue 3.0.5 → 3.0.8
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/CHANGELOG.md +34 -0
- package/es/big-table/index.js +220 -142
- package/es/button-print/index.css +32 -32
- package/es/button-print/index.js +3 -2
- package/es/drag-layout/index.css +32 -32
- package/es/field-set/index.css +74 -74
- package/es/grid/index.css +89 -89
- package/es/index.css +275 -0
- package/es/index.js +1480 -256
- package/es/select-person/index.css +1319 -0
- package/es/select-person/index.js +13191 -0
- package/package.json +3 -3
- package/packages/big-table/src/BigTable.vue +39 -30
- package/packages/big-table/src/bigTableEmits.ts +2 -2
- package/packages/big-table/src/bigTableProps.ts +1 -1
- package/packages/big-table/src/components/edit-form/edit-date.vue +41 -0
- package/packages/big-table/src/components/edit-form/edit-input.vue +2 -2
- package/packages/big-table/src/components/edit-form/edit-select.vue +12 -3
- package/packages/big-table/src/hooks/useEdit.ts +17 -5
- package/packages/button-print/src/ButtonPrint.vue +2 -1
- package/packages/index.ts +5 -2
- package/packages/select-person/index.ts +11 -0
- package/packages/select-person/src/SelectPerson.vue +1104 -0
- package/packages/select-person/src/search-tree.vue +326 -0
- package/packages/select-person/src/utils/index.js +66 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.8",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"scripts": {
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@vicons/ionicons5": "^0.12.0",
|
|
18
|
-
"naive-ui": "^2.
|
|
18
|
+
"naive-ui": "^2.29.0"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@vicons/ionicons5": "^0.12.0",
|
|
22
22
|
"crypto-js": "^4.1.1",
|
|
23
23
|
"moment": "^2.29.1",
|
|
24
|
-
"naive-ui": "^2.
|
|
24
|
+
"naive-ui": "^2.29.0",
|
|
25
25
|
"vue": "^3.2.25",
|
|
26
26
|
"vue-router": "^4.0.13",
|
|
27
27
|
"vuedraggable": "^4.1.0",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
</p>
|
|
27
27
|
<template v-if="state.visibleCheckAllWrapMore && !props.asyncCount">
|
|
28
28
|
<p v-if="!visibleCancelCheckAllBtn" class="check-wrap-btn" @click="handleCheckAll">
|
|
29
|
-
<span v-if="pageVO.total >
|
|
30
|
-
<!-- {{ `最大勾选“${tableName}” ${
|
|
31
|
-
{{ `勾选全部页 ${
|
|
29
|
+
<span v-if="pageVO.total > maxCheckSize">
|
|
30
|
+
<!-- {{ `最大勾选“${tableName}” ${maxCheckSize}条数据` }} -->
|
|
31
|
+
{{ `勾选全部页 ${maxCheckSize}条数据` }}
|
|
32
32
|
</span>
|
|
33
33
|
<span v-else>
|
|
34
34
|
<!-- {{ $t("1.9.598", { name: tableName, total }) }} -->
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
iconOpen: 'iconfont icon-a-xitongtubiaozhediejian',
|
|
97
97
|
iconClose: 'iconfont icon-a-xitongtubiaotianjia',
|
|
98
98
|
}"
|
|
99
|
+
:keyboard-config="columnConfig.keyboardConfig || {}"
|
|
99
100
|
@cell-dblclick="rowdblclick"
|
|
100
101
|
@cell-click="handlerClickRow"
|
|
101
102
|
@checkbox-change="selectionChange"
|
|
@@ -171,14 +172,11 @@ import { useFormat } from "./hooks/useFormat";
|
|
|
171
172
|
import { useTableParse } from "./hooks/useTableParse";
|
|
172
173
|
import { useBatchEditing } from "./hooks/useBatchEditing";
|
|
173
174
|
import { useNestTable } from "./hooks/useNestTable";
|
|
174
|
-
import { useEdit } from './hooks/useEdit';
|
|
175
|
+
import { useEdit, comps } from './hooks/useEdit';
|
|
175
176
|
import { SettingsSharp, SyncOutline, CopyOutline, CaretDown, CaretForward } from "@vicons/ionicons5";
|
|
176
177
|
import NoData from "./components/NoData.vue";
|
|
177
178
|
import TextOverTooltip from "./components/TextOverTooltip.vue";
|
|
178
179
|
import SvgIcon from '@/component/svg/index.vue';
|
|
179
|
-
import EditSelectTable from './components/edit-form/edit-select-table.vue'
|
|
180
|
-
import EditInput from './components/edit-form/edit-input.vue'
|
|
181
|
-
import EditSelect from './components/edit-form/edit-select.vue'
|
|
182
180
|
import {
|
|
183
181
|
NButton,
|
|
184
182
|
NCheckbox,
|
|
@@ -271,7 +269,7 @@ const {
|
|
|
271
269
|
recordClickBtnInfo,
|
|
272
270
|
getInlineOpreateRow
|
|
273
271
|
}: any = useBatchEditing(props, state, emit, xGrid);
|
|
274
|
-
const { initEditTable, activeMethod, deleteRow, onClickSelectTable,
|
|
272
|
+
const { initEditTable, activeMethod, deleteRow, onClickSelectTable, onFormChange, getDefaultValue } = useEdit(props, state, emit, xGrid)
|
|
275
273
|
|
|
276
274
|
const {
|
|
277
275
|
isAboutNestTable,
|
|
@@ -292,7 +290,7 @@ const currentCheckedKeys = computed(() => {
|
|
|
292
290
|
});
|
|
293
291
|
const visibleCancelCheckAllBtn = computed(() => {
|
|
294
292
|
let isCurrentPageAllCheck = state.currentPageSelectedLength === state.curAbleCheckedLen;
|
|
295
|
-
let isMaxChecked = currentCheckedKeys.value.length === props.
|
|
293
|
+
let isMaxChecked = currentCheckedKeys.value.length === props.maxCheckSize;
|
|
296
294
|
let isCheckedTotal = currentCheckedKeys.value.length === props.pageVO.total;
|
|
297
295
|
|
|
298
296
|
return isMaxChecked || !isCurrentPageAllCheck || isCheckedTotal;
|
|
@@ -377,7 +375,7 @@ const unBindDocumentClick = () => {
|
|
|
377
375
|
}
|
|
378
376
|
onMounted(() => {
|
|
379
377
|
bindDocumentClick();
|
|
380
|
-
state.tableHeight = handleTableHeight(state, props);
|
|
378
|
+
state.tableHeight = handleTableHeight(state, props) || 'auto';
|
|
381
379
|
|
|
382
380
|
// // 子列表在mounted后初始化 直接watch无法触发
|
|
383
381
|
if (!props.isNestTable) return;
|
|
@@ -706,27 +704,29 @@ const formatColumns = (map: any) => {
|
|
|
706
704
|
const formatterEdit = (params: any, col: any) => {
|
|
707
705
|
let { row, column, $rowIndex, rowIndex } = params
|
|
708
706
|
let formType = column.formType || col.formType || ''
|
|
709
|
-
|
|
710
|
-
// const propsData = {
|
|
711
|
-
// row,
|
|
712
|
-
// col
|
|
713
|
-
// }
|
|
714
|
-
// return <EditSelectTable {...propsData} v-model={[row[col.columnName], 'value']} onClickSelectTable={onClickSelectTable} />
|
|
715
|
-
// }
|
|
707
|
+
if (!formType) return null
|
|
716
708
|
if (formType === 'custom') {
|
|
717
709
|
return col.slotFn(params)
|
|
718
710
|
}
|
|
719
|
-
const
|
|
711
|
+
const Comp = comps[formType] || ''
|
|
712
|
+
if (!Comp) return null
|
|
713
|
+
const propsData: any = {
|
|
720
714
|
col,
|
|
721
715
|
row,
|
|
722
|
-
index: $rowIndex
|
|
716
|
+
index: $rowIndex,
|
|
717
|
+
// vModel: [row[col.columnName], formType === 'date' ? 'formattedValue' :'value'],
|
|
718
|
+
type: formType,
|
|
719
|
+
onFormChange
|
|
723
720
|
}
|
|
724
|
-
if (formType === '
|
|
725
|
-
|
|
721
|
+
if (formType === 'date') {
|
|
722
|
+
propsData.defaultFormattedValue = row[col.columnName]
|
|
723
|
+
} else {
|
|
724
|
+
propsData.defaultValue = row[col.columnName]
|
|
726
725
|
}
|
|
727
726
|
if (formType === 'select') {
|
|
728
|
-
|
|
727
|
+
propsData.onSetOptions = (options: any[]) => (row[`${col.columnName}_options`] = options)
|
|
729
728
|
}
|
|
729
|
+
return <Comp {...propsData} />
|
|
730
730
|
}
|
|
731
731
|
const getEditBtn = (row: any, col: any, index: number) => {
|
|
732
732
|
return col.tileBtnList?.map((btn: any) => {
|
|
@@ -826,8 +826,7 @@ const formatter = (params: any, col: any) => {
|
|
|
826
826
|
return getOrCode(row, own, attrType);
|
|
827
827
|
}
|
|
828
828
|
if (column.property === "operatorColumn") {
|
|
829
|
-
|
|
830
|
-
if (props.columnConfig.isEdit) {
|
|
829
|
+
if (props.columnConfig.isEdit && !row.initRow) {
|
|
831
830
|
return getEditBtn(row, col, $rowIndex)
|
|
832
831
|
}
|
|
833
832
|
|
|
@@ -1220,8 +1219,8 @@ const refreshTable = () => {
|
|
|
1220
1219
|
};
|
|
1221
1220
|
/* 全选相关 */
|
|
1222
1221
|
const handleCheckAll = () => {
|
|
1223
|
-
if (props.pageVO.total > props.
|
|
1224
|
-
let text = `当前列表共${props.pageVO.total}条数据,为了确保系统安全,只能单次操作${props.
|
|
1222
|
+
if (props.pageVO.total > props.maxCheckSize) {
|
|
1223
|
+
let text = `当前列表共${props.pageVO.total}条数据,为了确保系统安全,只能单次操作${props.maxCheckSize}条,你可以通过高级筛选过滤再次尝试`;
|
|
1225
1224
|
(window as any).$message.warning(text);
|
|
1226
1225
|
// return false;
|
|
1227
1226
|
}
|
|
@@ -1327,8 +1326,7 @@ const getAsyncTableData = (params: any) => {
|
|
|
1327
1326
|
};
|
|
1328
1327
|
const setChecklist = (list: any) => {
|
|
1329
1328
|
return list.map((i: any) => {
|
|
1330
|
-
|
|
1331
|
-
i["checked"] = false;
|
|
1329
|
+
i["checked"] = i.checked || false;
|
|
1332
1330
|
if (state.isTree == 2) {
|
|
1333
1331
|
const treeNodeKey = state.levelLazyLoadSetting.childCountKey;
|
|
1334
1332
|
const { isTreeOrList = "" } = props.tableParams;
|
|
@@ -1613,8 +1611,8 @@ const addCheckedRows = (rows: any) => {
|
|
|
1613
1611
|
removeCheckedDisabledRows(state);
|
|
1614
1612
|
let checkedRows = state.checkedRows;
|
|
1615
1613
|
|
|
1616
|
-
if (currentCheckedKeys.value.length + rows.length > props.
|
|
1617
|
-
(window as any).$message.warning(`为了保证系统安全,单次操作数据量限额为${props.
|
|
1614
|
+
if (currentCheckedKeys.value.length + rows.length > props.maxCheckSize) {
|
|
1615
|
+
(window as any).$message.warning(`为了保证系统安全,单次操作数据量限额为${props.maxCheckSize}条,你可以通过高级筛选过滤后再次尝试`);
|
|
1618
1616
|
return false;
|
|
1619
1617
|
}
|
|
1620
1618
|
|
|
@@ -1687,10 +1685,21 @@ const showDrawer = () => {
|
|
|
1687
1685
|
emit("setNestTableClickSetting", props.isNestTable);
|
|
1688
1686
|
emit("showDrawer", theads);
|
|
1689
1687
|
};
|
|
1688
|
+
let scrollEvent = (params: any) => {
|
|
1689
|
+
emit('scroll', params)
|
|
1690
|
+
}
|
|
1691
|
+
const initScroll = () => {
|
|
1692
|
+
const { throttle = false, throttleTime = 800, throttleOptions = {} } = props.columnConfig?.scrollConfig
|
|
1693
|
+
if (throttle) {
|
|
1694
|
+
scrollEvent = vexutils.throttle(scrollEvent, throttleTime, throttleOptions)
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
initScroll()
|
|
1690
1698
|
const handlerScroll = (params: any) => {
|
|
1691
1699
|
if (params.isX) {
|
|
1692
1700
|
hideFilterWrap(state, props);
|
|
1693
1701
|
}
|
|
1702
|
+
scrollEvent(params)
|
|
1694
1703
|
};
|
|
1695
1704
|
const handleCellMouseenter = ({ column, $event }: any) => {
|
|
1696
1705
|
// vxe-table@2.10+ 触发tooltip给vxe-cell父节点设置了title 导致显示有误
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const bigTableProps = {
|
|
2
2
|
data: { type: Array, default: () => [] },
|
|
3
|
-
|
|
3
|
+
maxCheckSize: { type: Number, default: 0 },
|
|
4
4
|
showFooter: Boolean,
|
|
5
5
|
sumData: { type: Object, default: () => ({}) },
|
|
6
6
|
avgData: { type: Object, default: () => ({}) },
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, ref, reactive, resolveComponent } from 'vue'
|
|
3
|
+
import { NDatePicker } from 'naive-ui'
|
|
4
|
+
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
name: 'EditDate',
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
components: {
|
|
9
|
+
NDatePicker
|
|
10
|
+
},
|
|
11
|
+
props: {
|
|
12
|
+
col: {
|
|
13
|
+
type: Object,
|
|
14
|
+
default: () => ({})
|
|
15
|
+
},
|
|
16
|
+
row: {
|
|
17
|
+
type: Object,
|
|
18
|
+
default: () => ({})
|
|
19
|
+
},
|
|
20
|
+
index: {
|
|
21
|
+
type: [Number, Object],
|
|
22
|
+
default: 0
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
emits: ['formChange'],
|
|
26
|
+
setup (props, { attrs, slots, emit }) {
|
|
27
|
+
const onConfirm = (value: any) => {
|
|
28
|
+
emit('formChange', { value, row: props.row, column: props.col, index: props.index })
|
|
29
|
+
}
|
|
30
|
+
const config = {
|
|
31
|
+
type: props.col.type || 'datetime',
|
|
32
|
+
clearable: props.col.clearable || true,
|
|
33
|
+
disabled: props.col.disabled || false,
|
|
34
|
+
valueFormat: props.col.valueFormat || 'yyyy-MM-dd HH:mm:ss',
|
|
35
|
+
to: false
|
|
36
|
+
}
|
|
37
|
+
return () => <NDatePicker {...attrs} {...config} onUpdateFormattedValue={onConfirm} />
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
</script>
|
|
41
|
+
<style lang="less" scoped></style>
|
|
@@ -27,10 +27,10 @@ export default defineComponent({
|
|
|
27
27
|
default: 0
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
emits: ['
|
|
30
|
+
emits: ['formChange'],
|
|
31
31
|
setup (props, { attrs, slots, emit }) {
|
|
32
32
|
const onUpdateValue = (value: number | string | null) => {
|
|
33
|
-
emit('
|
|
33
|
+
emit('formChange', { value, row: props.row, column: props.col, index: props.index })
|
|
34
34
|
}
|
|
35
35
|
return () => props.type === 'input' ? <NInput {...attrs} onUpdateValue={onUpdateValue } /> : <NInputNumber {...attrs} onUpdateValue={onUpdateValue} />
|
|
36
36
|
}
|
|
@@ -11,14 +11,18 @@ export default defineComponent({
|
|
|
11
11
|
props: {
|
|
12
12
|
col: {
|
|
13
13
|
type: Object,
|
|
14
|
-
default: () => {}
|
|
14
|
+
default: () => ({})
|
|
15
15
|
},
|
|
16
16
|
row: {
|
|
17
17
|
type: Object,
|
|
18
|
-
default: () => {}
|
|
18
|
+
default: () => ({})
|
|
19
|
+
},
|
|
20
|
+
index: {
|
|
21
|
+
type: [Number, Object],
|
|
22
|
+
default: 0
|
|
19
23
|
}
|
|
20
24
|
},
|
|
21
|
-
emits: ['setOptions'],
|
|
25
|
+
emits: ['setOptions', 'formChange'],
|
|
22
26
|
setup (props, { attrs, slots, emit }) {
|
|
23
27
|
|
|
24
28
|
const state = reactive({
|
|
@@ -40,6 +44,10 @@ export default defineComponent({
|
|
|
40
44
|
|
|
41
45
|
setOptions()
|
|
42
46
|
|
|
47
|
+
const onUpdateValue = (value: any[] | string | number | null) => {
|
|
48
|
+
emit('formChange', { value, row: props.row, column: props.col, index: props.index })
|
|
49
|
+
}
|
|
50
|
+
|
|
43
51
|
return () => [
|
|
44
52
|
<NSelect
|
|
45
53
|
{...attrs}
|
|
@@ -49,6 +57,7 @@ export default defineComponent({
|
|
|
49
57
|
filterable
|
|
50
58
|
to={false}
|
|
51
59
|
placeholder="请选择"
|
|
60
|
+
onUpdateValue={onUpdateValue}
|
|
52
61
|
/>
|
|
53
62
|
]
|
|
54
63
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { computed, ref, reactive, watch, onMounted } from 'vue'
|
|
2
|
+
import EditInput from '../components/edit-form/edit-input.vue'
|
|
3
|
+
import EditSelect from '../components/edit-form/edit-select.vue'
|
|
4
|
+
import EditDate from '../components/edit-form/edit-date.vue'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export const comps = {
|
|
8
|
+
'input': EditInput,
|
|
9
|
+
'number': EditInput,
|
|
10
|
+
'select': EditSelect,
|
|
11
|
+
'date': EditDate
|
|
12
|
+
}
|
|
2
13
|
|
|
3
14
|
export const useEdit = (props: any, state: any, emit: any, xGrid: any) => {
|
|
4
15
|
|
|
@@ -71,15 +82,16 @@ export const useEdit = (props: any, state: any, emit: any, xGrid: any) => {
|
|
|
71
82
|
xGrid.value.clearActived()
|
|
72
83
|
}
|
|
73
84
|
|
|
74
|
-
const
|
|
75
|
-
|
|
85
|
+
const onFormChange = ({ value, row, column, index }: {value: number | string | null, row: any, column: any, index: number}) => {
|
|
86
|
+
row[column.columnName] = value
|
|
87
|
+
emit('formChange', { value, row, column, index })
|
|
76
88
|
}
|
|
77
89
|
|
|
78
90
|
const getDefaultValue = (params: any, item: any) => {
|
|
79
91
|
const value = params.row[item.columnName]
|
|
80
92
|
if (item.formType === 'select') {
|
|
81
93
|
if (item.options) {
|
|
82
|
-
return item.options.find((v: any) => v.value
|
|
94
|
+
return item.options.find((v: any) => v.value == value)?.label || ''
|
|
83
95
|
}
|
|
84
96
|
if (item.queryOptions) {
|
|
85
97
|
return (params.row[`${item.columnName}_options`]?.find((v: any) => v.value === value)?.label) || ''
|
|
@@ -94,7 +106,7 @@ export const useEdit = (props: any, state: any, emit: any, xGrid: any) => {
|
|
|
94
106
|
activeMethod,
|
|
95
107
|
deleteRow,
|
|
96
108
|
onClickSelectTable,
|
|
97
|
-
|
|
109
|
+
onFormChange,
|
|
98
110
|
getDefaultValue
|
|
99
111
|
}
|
|
100
|
-
}
|
|
112
|
+
}
|
|
@@ -64,6 +64,7 @@ interface Props {
|
|
|
64
64
|
queryPrintFormatByNumber: Function
|
|
65
65
|
queryTemplateParams?: Function
|
|
66
66
|
strategy?: string
|
|
67
|
+
printParams?: any[]
|
|
67
68
|
}
|
|
68
69
|
const props = withDefaults(defineProps<Props>(), {
|
|
69
70
|
params: () => ([]),
|
|
@@ -138,7 +139,7 @@ const prevFnError = () => {
|
|
|
138
139
|
emit('error', error);
|
|
139
140
|
}
|
|
140
141
|
const getPrintParams = (index: number = 0) => {
|
|
141
|
-
const params = state.printParams[index];
|
|
142
|
+
const params = props.printParams?.length ? props.printParams[index] : state.printParams[index];
|
|
142
143
|
return JSON.stringify(params);
|
|
143
144
|
}
|
|
144
145
|
const getOnceParams = () => {
|
package/packages/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { default as CBigTable } from './big-table';
|
|
|
5
5
|
import { default as CFieldSet } from './field-set';
|
|
6
6
|
import { default as CDragLayout } from './drag-layout';
|
|
7
7
|
import { default as CButtonPrint } from './button-print';
|
|
8
|
+
import { default as CSelectPerson } from './select-person';
|
|
8
9
|
|
|
9
10
|
// 存储组件列表
|
|
10
11
|
const components: any[] = [
|
|
@@ -12,7 +13,8 @@ const components: any[] = [
|
|
|
12
13
|
CBigTable,
|
|
13
14
|
CFieldSet,
|
|
14
15
|
CDragLayout,
|
|
15
|
-
CButtonPrint
|
|
16
|
+
CButtonPrint,
|
|
17
|
+
CSelectPerson
|
|
16
18
|
];
|
|
17
19
|
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
|
|
18
20
|
const install = function(app: App) {
|
|
@@ -27,7 +29,8 @@ export {
|
|
|
27
29
|
CBigTable,
|
|
28
30
|
CFieldSet,
|
|
29
31
|
CDragLayout,
|
|
30
|
-
CButtonPrint
|
|
32
|
+
CButtonPrint,
|
|
33
|
+
CSelectPerson
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
export default {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { App } from "vue";
|
|
2
|
+
// 导入组件
|
|
3
|
+
import SelectPerson from './src/SelectPerson.vue'
|
|
4
|
+
|
|
5
|
+
// 为组件提供 install 安装方法,供按需引入
|
|
6
|
+
SelectPerson.install = function(app: App) {
|
|
7
|
+
app.component(SelectPerson.name, SelectPerson);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// 默认导出组件
|
|
11
|
+
export default SelectPerson;
|