cnhis-design-vue 0.3.6-beta → 0.3.9-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 +785 -6
- package/es/big-table/index.js +782 -136
- package/es/button-print/index.css +811 -8
- package/es/button-print/index.js +2 -3
- package/es/drag-layout/index.css +1044 -11
- package/es/drag-layout/index.js +2 -3
- package/es/grid/index.css +1045 -11
- package/es/grid/index.js +2 -3
- package/es/index.css +1044 -11
- package/es/index.js +787 -144
- package/package.json +4 -1
- package/packages/big-table/index.ts +8 -3
- package/packages/big-table/src/BigTable.vue +105 -32
- package/packages/big-table/src/FieldSet.vue +477 -0
- package/packages/big-table/src/assets/style/table-base.less +77 -75
- package/packages/big-table/src/assets/style/table-global.less +1 -1
- package/packages/big-table/src/bigTableProps.ts +1 -1
- 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 +131 -0
- package/packages/big-table/src/components/edit-form/edit-select.vue +57 -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-form → edit-form3}/edit-component/register-com.ts +0 -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/hooks/useEdit.ts +73 -0
- package/packages/big-table/src/hooks/useTableParse.ts +2 -2
- package/packages/button-print/index.ts +3 -3
- package/packages/drag-layout/index.ts +3 -3
- package/packages/grid/index.ts +3 -3
|
@@ -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,131 @@
|
|
|
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', 'clickSelectTable'],
|
|
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
|
+
state.keyword = value
|
|
66
|
+
querySelectTableList()
|
|
67
|
+
}
|
|
68
|
+
selectTableSearch = vexutils.debounce(selectTableSearch, 800)
|
|
69
|
+
// 初始化搜索
|
|
70
|
+
selectTableSearch('')
|
|
71
|
+
const getSelectTableGrid = () => {
|
|
72
|
+
const config = {
|
|
73
|
+
border: 'outer',
|
|
74
|
+
resizable: true,
|
|
75
|
+
autoResize: true,
|
|
76
|
+
showOverflow: true,
|
|
77
|
+
showHeaderOverflow: true,
|
|
78
|
+
highlightHoverRow: true,
|
|
79
|
+
highlightCurrentRow: true,
|
|
80
|
+
maxHeight: '500',
|
|
81
|
+
align: 'center',
|
|
82
|
+
columns: state.columns,
|
|
83
|
+
data: state.data
|
|
84
|
+
}
|
|
85
|
+
return <CGrid {...config} onCellClick={(data: any) => onCellClick(data)}>{{
|
|
86
|
+
empty: () => <NEmpty description="无数据" />
|
|
87
|
+
}}</CGrid>
|
|
88
|
+
}
|
|
89
|
+
const onCellClick = (data: any) => {
|
|
90
|
+
const { row } = data
|
|
91
|
+
// emit('update:value', data.row?.[props.col.columnName])
|
|
92
|
+
emit('clickSelectTable', row)
|
|
93
|
+
state.show = false
|
|
94
|
+
}
|
|
95
|
+
const getPagination = () => {
|
|
96
|
+
const pagination = () => {
|
|
97
|
+
return <NPagination
|
|
98
|
+
v-model={[state.page, 'page']}
|
|
99
|
+
pageCount={state.pageCount}
|
|
100
|
+
onUpdatePage={(page: number) => querySelectTableList()}
|
|
101
|
+
/>
|
|
102
|
+
}
|
|
103
|
+
return <NSpace justify="space-between" align="center" style="margin-top: 5px">{[`共${state.pageCount}条`, pagination()]}</NSpace>
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return () => [
|
|
107
|
+
<NSelect
|
|
108
|
+
class="form-select-table"
|
|
109
|
+
placeholder='请选择'
|
|
110
|
+
options={[]}
|
|
111
|
+
consistentMenuWidth={false}
|
|
112
|
+
clearable
|
|
113
|
+
filterable
|
|
114
|
+
to={false}
|
|
115
|
+
show={state.show}
|
|
116
|
+
loading={state.loading}
|
|
117
|
+
onFocus={selectTableFocus}
|
|
118
|
+
onBlur={() => state.show = false}
|
|
119
|
+
onSearch={selectTableSearch}
|
|
120
|
+
>{{
|
|
121
|
+
action: () => state.loading ? <NSpace justify="center"><NSpin class="spin" size="small" /></NSpace> : [getSelectTableGrid(), state.pageCount ? getPagination() : null]
|
|
122
|
+
}}</NSelect>
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
</script>
|
|
127
|
+
<style lang="less" scoped>
|
|
128
|
+
.spin {
|
|
129
|
+
margin: 80px auto;
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
row: {
|
|
17
|
+
type: Object,
|
|
18
|
+
default: () => {}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
emits: ['setOptions'],
|
|
22
|
+
setup (props, { attrs, slots, emit }) {
|
|
23
|
+
|
|
24
|
+
const state = reactive({
|
|
25
|
+
options: [] as any
|
|
26
|
+
})
|
|
27
|
+
const setOptions = async () => {
|
|
28
|
+
if (props.col.options) {
|
|
29
|
+
state.options = JSON.parse(JSON.stringify(props.col.options))
|
|
30
|
+
} else {
|
|
31
|
+
// 此处需要缓存第一次请求到的options,不需要每次都请求,
|
|
32
|
+
// 此处的row参数应当是selectTable的row
|
|
33
|
+
const optionsName = `${props.col.columnName}_options`
|
|
34
|
+
state.options = props.row[optionsName] || await props.col.queryOptions(props.row.row)
|
|
35
|
+
if (!props.row[optionsName]) {
|
|
36
|
+
emit('setOptions', state.options)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
setOptions()
|
|
42
|
+
|
|
43
|
+
return () => [
|
|
44
|
+
<NSelect
|
|
45
|
+
{...attrs}
|
|
46
|
+
options={state.options}
|
|
47
|
+
consistentMenuWidth={false}
|
|
48
|
+
clearable
|
|
49
|
+
filterable
|
|
50
|
+
to={false}
|
|
51
|
+
placeholder="请选择"
|
|
52
|
+
/>
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
</script>
|
|
57
|
+
<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
|
package/packages/big-table/src/components/{edit-form → edit-form3}/edit-component/register-com.ts
RENAMED
|
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}/hooks/useValidateRules.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { computed, ref, reactive, watch, onMounted } from 'vue'
|
|
2
|
+
|
|
3
|
+
export const useEdit = (props: any, state: any, emit: any, xGrid: any) => {
|
|
4
|
+
const initEditTable = async () => {
|
|
5
|
+
const { isEdit, fieldList } = props.columnConfig
|
|
6
|
+
if (!isEdit) return
|
|
7
|
+
const hasSelectTable = fieldList.find((v: any) => v.formType === 'selectTable')
|
|
8
|
+
if (!hasSelectTable) return
|
|
9
|
+
const record: any = {
|
|
10
|
+
initRow: true
|
|
11
|
+
}
|
|
12
|
+
props.columnConfig.fieldList.forEach((col: any) => {
|
|
13
|
+
if (col.columnName !== 'operatorColumn') {
|
|
14
|
+
record[col.columnName] = undefined
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
await xGrid.value.insertAt(record, -1)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const deleteRow = (row: any) => {
|
|
21
|
+
xGrid.value.remove(row)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const activeMethod = ({ row, rowIndex, column, columnIndex }: { row: any, rowIndex: number, column: any, columnIndex: number }) => {
|
|
25
|
+
const { isEdit, fieldList } = props.columnConfig
|
|
26
|
+
// console.log('activeMethod->', row, column)
|
|
27
|
+
if (isEdit) {
|
|
28
|
+
const selectTableObj = fieldList.find((v: any) => v.formType === 'selectTable')
|
|
29
|
+
const isEditCol = fieldList.find((v: any) => v.columnName === column.field)?.isEdit || false
|
|
30
|
+
if (selectTableObj) {
|
|
31
|
+
// const isOtherEditCol = Object.keys(row).some(v => v !== selectTableObj.columnName && v !== 'checked' && !!row[v])
|
|
32
|
+
if (isEditCol && ((column.field === selectTableObj.columnName && !row[column.field]) || (column.field !== selectTableObj.columnName && !row.initRow))) {
|
|
33
|
+
return true
|
|
34
|
+
} else {
|
|
35
|
+
return false
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
if (isEditCol) {
|
|
39
|
+
return true
|
|
40
|
+
} else {
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
return false
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const onClickSelectTable = async (row: any) => {
|
|
50
|
+
const record: any = {
|
|
51
|
+
initRow: false,
|
|
52
|
+
row: JSON.parse(JSON.stringify(row))
|
|
53
|
+
}
|
|
54
|
+
props.columnConfig.fieldList.forEach((col: any) => {
|
|
55
|
+
if (col.columnName !== 'operatorColumn') {
|
|
56
|
+
record[col.columnName] = undefined
|
|
57
|
+
if (Object.keys(row).includes(col.columnName)) {
|
|
58
|
+
record[col.columnName] = row[col.columnName]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
const getInsertRecords = xGrid.value.getInsertRecords()
|
|
63
|
+
await xGrid.value.insertAt(record, getInsertRecords.at(-1))
|
|
64
|
+
xGrid.value.clearActived()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
initEditTable,
|
|
69
|
+
activeMethod,
|
|
70
|
+
deleteRow,
|
|
71
|
+
onClickSelectTable
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -90,8 +90,8 @@ export const useTableParse = (formatData: Function) => {
|
|
|
90
90
|
return "";
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
if (field.settingObj?.mergedFeildExpression) {
|
|
94
|
+
const { mergedFeildExpression } = field.settingObj
|
|
95
95
|
const passList: any = [];
|
|
96
96
|
|
|
97
97
|
// 合并字段
|
|
@@ -2,14 +2,14 @@ import type { App } from "vue";
|
|
|
2
2
|
// 导入组件
|
|
3
3
|
import ButtonPrint from "./src/ButtonPrint.vue"
|
|
4
4
|
|
|
5
|
-
type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
|
|
5
|
+
// type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
|
|
6
6
|
|
|
7
7
|
// 为组件提供 install 安装方法,供按需引入
|
|
8
8
|
ButtonPrint.install = function(app: App) {
|
|
9
9
|
app.component(ButtonPrint.name, ButtonPrint);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const CButtonPrint: SFCWithInstall<typeof ButtonPrint> = ButtonPrint; // 增加类型
|
|
12
|
+
// const CButtonPrint: SFCWithInstall<typeof ButtonPrint> = ButtonPrint; // 增加类型
|
|
13
13
|
|
|
14
14
|
// 默认导出组件
|
|
15
|
-
export default
|
|
15
|
+
export default ButtonPrint;
|
|
@@ -2,14 +2,14 @@ import type { App } from "vue";
|
|
|
2
2
|
// 导入组件
|
|
3
3
|
import DragLayout from "./src/DragLayout.vue"
|
|
4
4
|
|
|
5
|
-
type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
|
|
5
|
+
// type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
|
|
6
6
|
|
|
7
7
|
// 为组件提供 install 安装方法,供按需引入
|
|
8
8
|
DragLayout.install = function(app: App) {
|
|
9
9
|
app.component(DragLayout.name, DragLayout);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const CDragLayout: SFCWithInstall<typeof DragLayout> = DragLayout; // 增加类型
|
|
12
|
+
// const CDragLayout: SFCWithInstall<typeof DragLayout> = DragLayout; // 增加类型
|
|
13
13
|
|
|
14
14
|
// 默认导出组件
|
|
15
|
-
export default
|
|
15
|
+
export default DragLayout;
|
package/packages/grid/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { App } from "vue";
|
|
|
3
3
|
// 导入组件
|
|
4
4
|
import Grid, { VXETable } from "./src/Grid"
|
|
5
5
|
|
|
6
|
-
type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
|
|
6
|
+
// type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
|
|
7
7
|
|
|
8
8
|
// 为组件提供 install 安装方法,供按需引入
|
|
9
9
|
Grid.install = function(app: App) {
|
|
@@ -11,7 +11,7 @@ Grid.install = function(app: App) {
|
|
|
11
11
|
app.use(VXETable);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const CGrid: SFCWithInstall<typeof Grid> = Grid; // 增加类型
|
|
14
|
+
// const CGrid: SFCWithInstall<typeof Grid> = Grid; // 增加类型
|
|
15
15
|
|
|
16
16
|
// 默认导出组件
|
|
17
|
-
export default
|
|
17
|
+
export default Grid;
|