vue2-client 1.7.0 → 1.7.2
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/.env +15 -15
- package/CHANGELOG.md +661 -628
- package/Components.md +60 -0
- package/index.js +31 -30
- package/package.json +83 -81
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
- package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -667
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +735 -733
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +466 -468
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +510 -508
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +144 -146
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
- package/src/base-client/components/common/Upload/Upload.vue +168 -168
- package/src/base-client/components/common/XAddForm/XAddForm.vue +72 -325
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +369 -279
- package/src/base-client/components/common/XAddNativeForm/index.md +107 -17
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -0
- package/src/base-client/components/common/XDataDrawer/index.js +3 -0
- package/src/base-client/components/common/XDataDrawer/index.md +41 -0
- package/src/base-client/components/common/XForm/XForm.vue +178 -180
- package/src/base-client/components/common/XForm/XFormItem.vue +521 -513
- package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
- package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
- package/src/base-client/components/common/XFormTable/XFormTable.vue +356 -344
- package/src/base-client/components/common/XFormTable/index.md +97 -97
- package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
- package/src/base-client/components/common/XTable/XTable.vue +519 -506
- package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
- package/src/base-client/components/index.js +41 -0
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
- package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
- package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
- package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
- package/src/base-client/plugins/AppData.js +76 -76
- package/src/base-client/plugins/GetLoginInfoService.js +179 -179
- package/src/base-client/plugins/PagedList.js +177 -177
- package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
- package/src/base-client/plugins/i18n-extend.js +32 -32
- package/src/components/Ellipsis/Ellipsis.vue +65 -65
- package/src/components/Ellipsis/index.md +38 -38
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/STable/README.md +341 -341
- package/src/components/STable/index.js +318 -318
- package/src/components/Trend/index.md +45 -45
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/checkbox/ImgCheckbox.vue +163 -163
- package/src/components/exception/ExceptionPage.vue +70 -70
- package/src/components/form/FormRow.vue +52 -52
- package/src/components/index.js +36 -36
- package/src/components/menu/SideMenu.vue +75 -62
- package/src/components/menu/menu.js +273 -273
- package/src/components/page/header/index.less +40 -40
- package/src/components/setting/Setting.vue +235 -235
- package/src/components/table/StandardTable.vue +141 -141
- package/src/components/table/advance/ActionColumns.vue +158 -158
- package/src/components/table/advance/SearchArea.vue +355 -355
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/components/tool/AvatarList.vue +68 -68
- package/src/components/tool/Drawer.vue +142 -142
- package/src/components/tool/TagSelect.vue +83 -83
- package/src/components/transition/PageToggleTransition.vue +97 -97
- package/src/config/CreateQueryConfig.js +307 -307
- package/src/config/default/admin.config.js +18 -18
- package/src/config/default/setting.config.js +4 -2
- package/src/config/replacer/resolve.config.js +67 -67
- package/src/layouts/CommonLayout.vue +42 -42
- package/src/layouts/ComponentLayoutOne.vue +47 -47
- package/src/layouts/PageLayout.vue +151 -151
- package/src/layouts/SinglePageView.vue +116 -116
- package/src/layouts/footer/PageFooter.vue +49 -49
- package/src/layouts/header/AdminHeader.vue +134 -134
- package/src/layouts/header/HeaderAvatar.vue +64 -64
- package/src/layouts/header/HeaderNotice.vue +176 -176
- package/src/layouts/header/HeaderSearch.vue +67 -67
- package/src/layouts/header/InstitutionDetail.vue +181 -181
- package/src/layouts/header/index.less +92 -92
- package/src/layouts/tabs/TabsHead.vue +190 -190
- package/src/layouts/tabs/TabsView.vue +379 -379
- package/src/lib.js +1 -0
- package/src/mock/goods/index.js +108 -108
- package/src/pages/CreateQueryPage.vue +84 -84
- package/src/pages/login/Login.vue +369 -369
- package/src/pages/report/ReportTable.js +124 -124
- package/src/pages/report/ReportTableHome.vue +28 -28
- package/src/pages/resourceManage/orgListManage.vue +98 -98
- package/src/pages/system/dictionary/index.vue +43 -43
- package/src/pages/system/file/index.vue +317 -317
- package/src/pages/system/monitor/loginInfor/index.vue +36 -36
- package/src/pages/system/monitor/operLog/index.vue +36 -36
- package/src/pages/system/settings/index.vue +126 -126
- package/src/pages/system/settings/modifyPassword.vue +109 -109
- package/src/router/async/config.async.js +28 -28
- package/src/router/async/router.map.js +66 -66
- package/src/router/guards.js +52 -12
- package/src/router/index.js +27 -27
- package/src/services/api/DictionaryDetailsViewApi.js +6 -6
- package/src/services/api/LogDetailsViewApi.js +10 -10
- package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
- package/src/services/api/TicketDetailsViewApi.js +34 -34
- package/src/services/api/cas.js +79 -79
- package/src/services/api/common.js +137 -137
- package/src/services/api/commonTempTable.js +10 -10
- package/src/services/api/index.js +17 -17
- package/src/services/api/logininfor/index.js +6 -6
- package/src/services/api/manage.js +8 -8
- package/src/services/apiService.js +14 -14
- package/src/services/user.js +67 -67
- package/src/store/modules/index.js +4 -4
- package/src/theme/default/nprogress.less +76 -76
- package/src/theme/default/style.less +58 -58
- package/src/utils/EncryptUtil.js +53 -53
- package/src/utils/colors.js +107 -107
- package/src/utils/excel/Blob.js +180 -180
- package/src/utils/excel/Export2Excel.js +141 -141
- package/src/utils/formatter.js +68 -68
- package/src/utils/i18n.js +80 -80
- package/src/utils/login.js +138 -0
- package/src/utils/map-utils.js +37 -37
- package/src/utils/theme-color-replacer-extend.js +91 -91
- package/src/utils/themeUtil.js +100 -100
- package/src/utils/util.js +230 -230
- package/vue.config.js +106 -106
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="standard-table">
|
|
3
|
-
<div class="alert">
|
|
4
|
-
<a-alert v-if="selectedRows" :show-icon="true" type="info">
|
|
5
|
-
<div slot="message" class="message">
|
|
6
|
-
已选择 <a>{{ selectedRows.length }}</a> 项 <a class="clear" @click="onClear">清空</a>
|
|
7
|
-
<template v-for="(item, index) in needTotalList" >
|
|
8
|
-
<div v-if="item.needTotal" :key="index">
|
|
9
|
-
{{ item.title }}总计
|
|
10
|
-
<a>{{ item.customRender ? item.customRender(item.total) : item.total }}</a>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
</div>
|
|
14
|
-
</a-alert>
|
|
15
|
-
</div>
|
|
16
|
-
<a-table
|
|
17
|
-
:bordered="bordered"
|
|
18
|
-
:columns="columns"
|
|
19
|
-
:dataSource="dataSource"
|
|
20
|
-
:expandedRowKeys="expandedRowKeys"
|
|
21
|
-
:expandedRowRender="expandedRowRender"
|
|
22
|
-
:loading="loading"
|
|
23
|
-
:pagination="pagination"
|
|
24
|
-
:rowKey="rowKey"
|
|
25
|
-
:rowSelection="selectedRows ? {selectedRowKeys: selectedRowKeys, onChange: updateSelect} : undefined"
|
|
26
|
-
@change="onChange"
|
|
27
|
-
>
|
|
28
|
-
<template v-for="slot in Object.keys($scopedSlots).filter(key => key !== 'expandedRowRender') " :slot="slot" slot-scope="text, record, index">
|
|
29
|
-
<slot :name="slot" v-bind="{text, record, index}"></slot>
|
|
30
|
-
</template>
|
|
31
|
-
<template v-for="slot in Object.keys($slots)" :slot="slot">
|
|
32
|
-
<slot :name="slot"></slot>
|
|
33
|
-
</template>
|
|
34
|
-
<template :slot="$scopedSlots.expandedRowRender ? 'expandedRowRender' : ''" slot-scope="record, index, indent, expanded">
|
|
35
|
-
<slot :name="$scopedSlots.expandedRowRender ? 'expandedRowRender' : ''" v-bind="{record, index, indent, expanded}"></slot>
|
|
36
|
-
</template>
|
|
37
|
-
</a-table>
|
|
38
|
-
</div>
|
|
39
|
-
</template>
|
|
40
|
-
|
|
41
|
-
<script>
|
|
42
|
-
export default {
|
|
43
|
-
name: 'StandardTable',
|
|
44
|
-
props: {
|
|
45
|
-
bordered: Boolean,
|
|
46
|
-
// eslint-disable-next-line vue/require-default-prop
|
|
47
|
-
loading: [Boolean, Object],
|
|
48
|
-
// eslint-disable-next-line vue/require-default-prop
|
|
49
|
-
columns: Array,
|
|
50
|
-
// eslint-disable-next-line vue/require-default-prop
|
|
51
|
-
dataSource: Array,
|
|
52
|
-
rowKey: {
|
|
53
|
-
type: [String, Function],
|
|
54
|
-
default: 'key'
|
|
55
|
-
},
|
|
56
|
-
pagination: {
|
|
57
|
-
type: [Object, Boolean],
|
|
58
|
-
default: true
|
|
59
|
-
},
|
|
60
|
-
// eslint-disable-next-line vue/require-default-prop
|
|
61
|
-
selectedRows: Array,
|
|
62
|
-
// eslint-disable-next-line vue/require-default-prop
|
|
63
|
-
expandedRowKeys: Array,
|
|
64
|
-
// eslint-disable-next-line vue/require-default-prop
|
|
65
|
-
expandedRowRender: Function
|
|
66
|
-
},
|
|
67
|
-
data () {
|
|
68
|
-
return {
|
|
69
|
-
needTotalList: []
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
methods: {
|
|
73
|
-
updateSelect (selectedRowKeys, selectedRows) {
|
|
74
|
-
this.$emit('update:selectedRows', selectedRows)
|
|
75
|
-
this.$emit('selectedRowChange', selectedRowKeys, selectedRows)
|
|
76
|
-
},
|
|
77
|
-
initTotalList (columns) {
|
|
78
|
-
return columns.filter(item => item.needTotal)
|
|
79
|
-
.map(item => {
|
|
80
|
-
return {
|
|
81
|
-
...item,
|
|
82
|
-
total: 0
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
},
|
|
86
|
-
onClear () {
|
|
87
|
-
this.updateSelect([], [])
|
|
88
|
-
this.$emit('clear')
|
|
89
|
-
},
|
|
90
|
-
onChange (pagination, filters, sorter, { currentDataSource }) {
|
|
91
|
-
this.$emit('change', pagination, filters, sorter, { currentDataSource })
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
created () {
|
|
95
|
-
this.needTotalList = this.initTotalList(this.columns)
|
|
96
|
-
},
|
|
97
|
-
watch: {
|
|
98
|
-
selectedRows (selectedRows) {
|
|
99
|
-
this.needTotalList = this.needTotalList.map(item => {
|
|
100
|
-
return {
|
|
101
|
-
...item,
|
|
102
|
-
total: selectedRows.reduce((sum, val) => {
|
|
103
|
-
let v
|
|
104
|
-
try {
|
|
105
|
-
// eslint-disable-next-line no-eval
|
|
106
|
-
v = val[item.dataIndex] ? val[item.dataIndex] : eval(`val.${item.dataIndex}`)
|
|
107
|
-
} catch (_) {
|
|
108
|
-
v = val[item.dataIndex]
|
|
109
|
-
}
|
|
110
|
-
v = !isNaN(parseFloat(v)) ? parseFloat(v) : 0
|
|
111
|
-
return sum + v
|
|
112
|
-
}, 0)
|
|
113
|
-
}
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
computed: {
|
|
118
|
-
selectedRowKeys () {
|
|
119
|
-
return this.selectedRows.map(record => {
|
|
120
|
-
return (typeof this.rowKey === 'function') ? this.rowKey(record) : record[this.rowKey]
|
|
121
|
-
})
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
</script>
|
|
126
|
-
|
|
127
|
-
<style lang="less" scoped>
|
|
128
|
-
.standard-table{
|
|
129
|
-
.alert{
|
|
130
|
-
margin-bottom: 16px;
|
|
131
|
-
.message{
|
|
132
|
-
a{
|
|
133
|
-
font-weight: 600;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
.clear{
|
|
137
|
-
float: right;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="standard-table">
|
|
3
|
+
<div class="alert">
|
|
4
|
+
<a-alert v-if="selectedRows" :show-icon="true" type="info">
|
|
5
|
+
<div slot="message" class="message">
|
|
6
|
+
已选择 <a>{{ selectedRows.length }}</a> 项 <a class="clear" @click="onClear">清空</a>
|
|
7
|
+
<template v-for="(item, index) in needTotalList" >
|
|
8
|
+
<div v-if="item.needTotal" :key="index">
|
|
9
|
+
{{ item.title }}总计
|
|
10
|
+
<a>{{ item.customRender ? item.customRender(item.total) : item.total }}</a>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
</div>
|
|
14
|
+
</a-alert>
|
|
15
|
+
</div>
|
|
16
|
+
<a-table
|
|
17
|
+
:bordered="bordered"
|
|
18
|
+
:columns="columns"
|
|
19
|
+
:dataSource="dataSource"
|
|
20
|
+
:expandedRowKeys="expandedRowKeys"
|
|
21
|
+
:expandedRowRender="expandedRowRender"
|
|
22
|
+
:loading="loading"
|
|
23
|
+
:pagination="pagination"
|
|
24
|
+
:rowKey="rowKey"
|
|
25
|
+
:rowSelection="selectedRows ? {selectedRowKeys: selectedRowKeys, onChange: updateSelect} : undefined"
|
|
26
|
+
@change="onChange"
|
|
27
|
+
>
|
|
28
|
+
<template v-for="slot in Object.keys($scopedSlots).filter(key => key !== 'expandedRowRender') " :slot="slot" slot-scope="text, record, index">
|
|
29
|
+
<slot :name="slot" v-bind="{text, record, index}"></slot>
|
|
30
|
+
</template>
|
|
31
|
+
<template v-for="slot in Object.keys($slots)" :slot="slot">
|
|
32
|
+
<slot :name="slot"></slot>
|
|
33
|
+
</template>
|
|
34
|
+
<template :slot="$scopedSlots.expandedRowRender ? 'expandedRowRender' : ''" slot-scope="record, index, indent, expanded">
|
|
35
|
+
<slot :name="$scopedSlots.expandedRowRender ? 'expandedRowRender' : ''" v-bind="{record, index, indent, expanded}"></slot>
|
|
36
|
+
</template>
|
|
37
|
+
</a-table>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
export default {
|
|
43
|
+
name: 'StandardTable',
|
|
44
|
+
props: {
|
|
45
|
+
bordered: Boolean,
|
|
46
|
+
// eslint-disable-next-line vue/require-default-prop
|
|
47
|
+
loading: [Boolean, Object],
|
|
48
|
+
// eslint-disable-next-line vue/require-default-prop
|
|
49
|
+
columns: Array,
|
|
50
|
+
// eslint-disable-next-line vue/require-default-prop
|
|
51
|
+
dataSource: Array,
|
|
52
|
+
rowKey: {
|
|
53
|
+
type: [String, Function],
|
|
54
|
+
default: 'key'
|
|
55
|
+
},
|
|
56
|
+
pagination: {
|
|
57
|
+
type: [Object, Boolean],
|
|
58
|
+
default: true
|
|
59
|
+
},
|
|
60
|
+
// eslint-disable-next-line vue/require-default-prop
|
|
61
|
+
selectedRows: Array,
|
|
62
|
+
// eslint-disable-next-line vue/require-default-prop
|
|
63
|
+
expandedRowKeys: Array,
|
|
64
|
+
// eslint-disable-next-line vue/require-default-prop
|
|
65
|
+
expandedRowRender: Function
|
|
66
|
+
},
|
|
67
|
+
data () {
|
|
68
|
+
return {
|
|
69
|
+
needTotalList: []
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
methods: {
|
|
73
|
+
updateSelect (selectedRowKeys, selectedRows) {
|
|
74
|
+
this.$emit('update:selectedRows', selectedRows)
|
|
75
|
+
this.$emit('selectedRowChange', selectedRowKeys, selectedRows)
|
|
76
|
+
},
|
|
77
|
+
initTotalList (columns) {
|
|
78
|
+
return columns.filter(item => item.needTotal)
|
|
79
|
+
.map(item => {
|
|
80
|
+
return {
|
|
81
|
+
...item,
|
|
82
|
+
total: 0
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
},
|
|
86
|
+
onClear () {
|
|
87
|
+
this.updateSelect([], [])
|
|
88
|
+
this.$emit('clear')
|
|
89
|
+
},
|
|
90
|
+
onChange (pagination, filters, sorter, { currentDataSource }) {
|
|
91
|
+
this.$emit('change', pagination, filters, sorter, { currentDataSource })
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
created () {
|
|
95
|
+
this.needTotalList = this.initTotalList(this.columns)
|
|
96
|
+
},
|
|
97
|
+
watch: {
|
|
98
|
+
selectedRows (selectedRows) {
|
|
99
|
+
this.needTotalList = this.needTotalList.map(item => {
|
|
100
|
+
return {
|
|
101
|
+
...item,
|
|
102
|
+
total: selectedRows.reduce((sum, val) => {
|
|
103
|
+
let v
|
|
104
|
+
try {
|
|
105
|
+
// eslint-disable-next-line no-eval
|
|
106
|
+
v = val[item.dataIndex] ? val[item.dataIndex] : eval(`val.${item.dataIndex}`)
|
|
107
|
+
} catch (_) {
|
|
108
|
+
v = val[item.dataIndex]
|
|
109
|
+
}
|
|
110
|
+
v = !isNaN(parseFloat(v)) ? parseFloat(v) : 0
|
|
111
|
+
return sum + v
|
|
112
|
+
}, 0)
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
computed: {
|
|
118
|
+
selectedRowKeys () {
|
|
119
|
+
return this.selectedRows.map(record => {
|
|
120
|
+
return (typeof this.rowKey === 'function') ? this.rowKey(record) : record[this.rowKey]
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<style lang="less" scoped>
|
|
128
|
+
.standard-table{
|
|
129
|
+
.alert{
|
|
130
|
+
margin-bottom: 16px;
|
|
131
|
+
.message{
|
|
132
|
+
a{
|
|
133
|
+
font-weight: 600;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
.clear{
|
|
137
|
+
float: right;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
</style>
|
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="action-columns" ref="root">
|
|
3
|
-
<a-popover v-model="visible" placement="bottomRight" trigger="click" :get-popup-container="() => $refs.root">
|
|
4
|
-
<div slot="title">
|
|
5
|
-
<a-checkbox :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange" class="check-all" />列展示
|
|
6
|
-
<a-button @click="resetColumns" style="float: right" type="link" size="small">重置</a-button>
|
|
7
|
-
</div>
|
|
8
|
-
<a-list style="width: 100%" size="small" :key="i" v-for="(col, i) in columns" slot="content">
|
|
9
|
-
<a-list-item>
|
|
10
|
-
<a-checkbox v-model="col.visible" @change="e => onCheckChange(e, col)"/>
|
|
11
|
-
<template v-if="col.title">
|
|
12
|
-
{{ col.title }}:
|
|
13
|
-
</template>
|
|
14
|
-
<slot v-else-if="col.slots && col.slots.title" :name="col.slots.title"></slot>
|
|
15
|
-
<template slot="actions">
|
|
16
|
-
<a-tooltip title="固定在列头" :mouseEnterDelay="0.5" :get-popup-container="() => $refs.root">
|
|
17
|
-
<a-icon :class="['left', {active: col.fixed === 'left'}]" @click="fixColumn('left', col)" type="vertical-align-top" />
|
|
18
|
-
</a-tooltip>
|
|
19
|
-
<a-tooltip title="固定在列尾" :mouseEnterDelay="0.5" :get-popup-container="() => $refs.root">
|
|
20
|
-
<a-icon :class="['right', {active: col.fixed === 'right'}]" @click="fixColumn('right', col)" type="vertical-align-bottom" />
|
|
21
|
-
</a-tooltip>
|
|
22
|
-
<a-tooltip title="添加搜索" :mouseEnterDelay="0.5" :get-popup-container="() => $refs.root">
|
|
23
|
-
<a-icon :class="{active: col.searchAble}" @click="setSearch(col)" type="search" />
|
|
24
|
-
</a-tooltip>
|
|
25
|
-
</template>
|
|
26
|
-
</a-list-item>
|
|
27
|
-
</a-list>
|
|
28
|
-
<a-icon class="action" type="setting" />
|
|
29
|
-
</a-popover>
|
|
30
|
-
</div>
|
|
31
|
-
</template>
|
|
32
|
-
|
|
33
|
-
<script>
|
|
34
|
-
import cloneDeep from 'lodash.clonedeep'
|
|
35
|
-
|
|
36
|
-
export default {
|
|
37
|
-
name: 'ActionColumns',
|
|
38
|
-
// eslint-disable-next-line vue/require-prop-types
|
|
39
|
-
props: ['columns', 'visibleColumns'],
|
|
40
|
-
data () {
|
|
41
|
-
return {
|
|
42
|
-
visible: false,
|
|
43
|
-
indeterminate: false,
|
|
44
|
-
checkAll: true,
|
|
45
|
-
checkedCounts: this.columns.length,
|
|
46
|
-
backColumns: cloneDeep(this.columns)
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
watch: {
|
|
50
|
-
checkedCounts (val) {
|
|
51
|
-
this.checkAll = val === this.columns.length
|
|
52
|
-
this.indeterminate = val > 0 && val < this.columns.length
|
|
53
|
-
},
|
|
54
|
-
columns (newVal, oldVal) {
|
|
55
|
-
if (newVal !== oldVal) {
|
|
56
|
-
this.checkedCounts = newVal.length
|
|
57
|
-
this.formatColumns(newVal)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
created () {
|
|
62
|
-
this.formatColumns(this.columns)
|
|
63
|
-
},
|
|
64
|
-
methods: {
|
|
65
|
-
onCheckChange (e, col) {
|
|
66
|
-
if (!col.visible) {
|
|
67
|
-
this.checkedCounts -= 1
|
|
68
|
-
} else {
|
|
69
|
-
this.checkedCounts += 1
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
fixColumn (fixed, col) {
|
|
73
|
-
if (fixed !== col.fixed) {
|
|
74
|
-
this.$set(col, 'fixed', fixed)
|
|
75
|
-
} else {
|
|
76
|
-
this.$set(col, 'fixed', undefined)
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
setSearch (col) {
|
|
80
|
-
this.$set(col, 'searchAble', !col.searchAble)
|
|
81
|
-
if (!col.searchAble && col.search) {
|
|
82
|
-
this.resetSearch(col)
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
resetSearch (col) {
|
|
86
|
-
// col.search.value = col.dataType === 'boolean' ? false : undefined
|
|
87
|
-
col.search.value = undefined
|
|
88
|
-
col.search.backup = undefined
|
|
89
|
-
},
|
|
90
|
-
resetColumns () {
|
|
91
|
-
const { columns, backColumns } = this
|
|
92
|
-
let counts = columns.length
|
|
93
|
-
backColumns.forEach((back, index) => {
|
|
94
|
-
const column = columns[index]
|
|
95
|
-
column.visible = back.visible === undefined || back.visible
|
|
96
|
-
if (!column.visible) {
|
|
97
|
-
counts -= 1
|
|
98
|
-
}
|
|
99
|
-
if (back.fixed !== undefined) {
|
|
100
|
-
column.fixed = back.fixed
|
|
101
|
-
} else {
|
|
102
|
-
this.$set(column, 'fixed', undefined)
|
|
103
|
-
}
|
|
104
|
-
this.$set(column, 'searchAble', back.searchAble)
|
|
105
|
-
// column.searchAble = back.searchAble
|
|
106
|
-
this.resetSearch(column)
|
|
107
|
-
})
|
|
108
|
-
this.checkedCounts = counts
|
|
109
|
-
this.visible = false
|
|
110
|
-
this.$emit('reset', this.getConditions(columns))
|
|
111
|
-
},
|
|
112
|
-
onCheckAllChange (e) {
|
|
113
|
-
if (e.target.checked) {
|
|
114
|
-
this.checkedCounts = this.columns.length
|
|
115
|
-
// eslint-disable-next-line no-return-assign
|
|
116
|
-
this.columns.forEach(col => col.visible = true)
|
|
117
|
-
} else {
|
|
118
|
-
this.checkedCounts = 0
|
|
119
|
-
// eslint-disable-next-line no-return-assign
|
|
120
|
-
this.columns.forEach(col => col.visible = false)
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
getConditions (columns) {
|
|
124
|
-
const conditions = {}
|
|
125
|
-
columns.filter(item => item.search.value !== undefined && item.search.value !== '' && item.search.value !== null)
|
|
126
|
-
.forEach(col => {
|
|
127
|
-
conditions[col.dataIndex] = col.search.value
|
|
128
|
-
})
|
|
129
|
-
return conditions
|
|
130
|
-
},
|
|
131
|
-
formatColumns (columns) {
|
|
132
|
-
for (const col of columns) {
|
|
133
|
-
if (col.visible === undefined) {
|
|
134
|
-
this.$set(col, 'visible', true)
|
|
135
|
-
}
|
|
136
|
-
if (!col.visible) {
|
|
137
|
-
this.checkedCounts -= 1
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
</script>
|
|
144
|
-
|
|
145
|
-
<style scoped lang="less">
|
|
146
|
-
.action-columns{
|
|
147
|
-
display: inline-block;
|
|
148
|
-
.check-all{
|
|
149
|
-
margin-right: 8px;
|
|
150
|
-
}
|
|
151
|
-
.left,.right{
|
|
152
|
-
transform: rotate(-90deg);
|
|
153
|
-
}
|
|
154
|
-
.active{
|
|
155
|
-
color: @primary-color;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="action-columns" ref="root">
|
|
3
|
+
<a-popover v-model="visible" placement="bottomRight" trigger="click" :get-popup-container="() => $refs.root">
|
|
4
|
+
<div slot="title">
|
|
5
|
+
<a-checkbox :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange" class="check-all" />列展示
|
|
6
|
+
<a-button @click="resetColumns" style="float: right" type="link" size="small">重置</a-button>
|
|
7
|
+
</div>
|
|
8
|
+
<a-list style="width: 100%" size="small" :key="i" v-for="(col, i) in columns" slot="content">
|
|
9
|
+
<a-list-item>
|
|
10
|
+
<a-checkbox v-model="col.visible" @change="e => onCheckChange(e, col)"/>
|
|
11
|
+
<template v-if="col.title">
|
|
12
|
+
{{ col.title }}:
|
|
13
|
+
</template>
|
|
14
|
+
<slot v-else-if="col.slots && col.slots.title" :name="col.slots.title"></slot>
|
|
15
|
+
<template slot="actions">
|
|
16
|
+
<a-tooltip title="固定在列头" :mouseEnterDelay="0.5" :get-popup-container="() => $refs.root">
|
|
17
|
+
<a-icon :class="['left', {active: col.fixed === 'left'}]" @click="fixColumn('left', col)" type="vertical-align-top" />
|
|
18
|
+
</a-tooltip>
|
|
19
|
+
<a-tooltip title="固定在列尾" :mouseEnterDelay="0.5" :get-popup-container="() => $refs.root">
|
|
20
|
+
<a-icon :class="['right', {active: col.fixed === 'right'}]" @click="fixColumn('right', col)" type="vertical-align-bottom" />
|
|
21
|
+
</a-tooltip>
|
|
22
|
+
<a-tooltip title="添加搜索" :mouseEnterDelay="0.5" :get-popup-container="() => $refs.root">
|
|
23
|
+
<a-icon :class="{active: col.searchAble}" @click="setSearch(col)" type="search" />
|
|
24
|
+
</a-tooltip>
|
|
25
|
+
</template>
|
|
26
|
+
</a-list-item>
|
|
27
|
+
</a-list>
|
|
28
|
+
<a-icon class="action" type="setting" />
|
|
29
|
+
</a-popover>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script>
|
|
34
|
+
import cloneDeep from 'lodash.clonedeep'
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
name: 'ActionColumns',
|
|
38
|
+
// eslint-disable-next-line vue/require-prop-types
|
|
39
|
+
props: ['columns', 'visibleColumns'],
|
|
40
|
+
data () {
|
|
41
|
+
return {
|
|
42
|
+
visible: false,
|
|
43
|
+
indeterminate: false,
|
|
44
|
+
checkAll: true,
|
|
45
|
+
checkedCounts: this.columns.length,
|
|
46
|
+
backColumns: cloneDeep(this.columns)
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
watch: {
|
|
50
|
+
checkedCounts (val) {
|
|
51
|
+
this.checkAll = val === this.columns.length
|
|
52
|
+
this.indeterminate = val > 0 && val < this.columns.length
|
|
53
|
+
},
|
|
54
|
+
columns (newVal, oldVal) {
|
|
55
|
+
if (newVal !== oldVal) {
|
|
56
|
+
this.checkedCounts = newVal.length
|
|
57
|
+
this.formatColumns(newVal)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
created () {
|
|
62
|
+
this.formatColumns(this.columns)
|
|
63
|
+
},
|
|
64
|
+
methods: {
|
|
65
|
+
onCheckChange (e, col) {
|
|
66
|
+
if (!col.visible) {
|
|
67
|
+
this.checkedCounts -= 1
|
|
68
|
+
} else {
|
|
69
|
+
this.checkedCounts += 1
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
fixColumn (fixed, col) {
|
|
73
|
+
if (fixed !== col.fixed) {
|
|
74
|
+
this.$set(col, 'fixed', fixed)
|
|
75
|
+
} else {
|
|
76
|
+
this.$set(col, 'fixed', undefined)
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
setSearch (col) {
|
|
80
|
+
this.$set(col, 'searchAble', !col.searchAble)
|
|
81
|
+
if (!col.searchAble && col.search) {
|
|
82
|
+
this.resetSearch(col)
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
resetSearch (col) {
|
|
86
|
+
// col.search.value = col.dataType === 'boolean' ? false : undefined
|
|
87
|
+
col.search.value = undefined
|
|
88
|
+
col.search.backup = undefined
|
|
89
|
+
},
|
|
90
|
+
resetColumns () {
|
|
91
|
+
const { columns, backColumns } = this
|
|
92
|
+
let counts = columns.length
|
|
93
|
+
backColumns.forEach((back, index) => {
|
|
94
|
+
const column = columns[index]
|
|
95
|
+
column.visible = back.visible === undefined || back.visible
|
|
96
|
+
if (!column.visible) {
|
|
97
|
+
counts -= 1
|
|
98
|
+
}
|
|
99
|
+
if (back.fixed !== undefined) {
|
|
100
|
+
column.fixed = back.fixed
|
|
101
|
+
} else {
|
|
102
|
+
this.$set(column, 'fixed', undefined)
|
|
103
|
+
}
|
|
104
|
+
this.$set(column, 'searchAble', back.searchAble)
|
|
105
|
+
// column.searchAble = back.searchAble
|
|
106
|
+
this.resetSearch(column)
|
|
107
|
+
})
|
|
108
|
+
this.checkedCounts = counts
|
|
109
|
+
this.visible = false
|
|
110
|
+
this.$emit('reset', this.getConditions(columns))
|
|
111
|
+
},
|
|
112
|
+
onCheckAllChange (e) {
|
|
113
|
+
if (e.target.checked) {
|
|
114
|
+
this.checkedCounts = this.columns.length
|
|
115
|
+
// eslint-disable-next-line no-return-assign
|
|
116
|
+
this.columns.forEach(col => col.visible = true)
|
|
117
|
+
} else {
|
|
118
|
+
this.checkedCounts = 0
|
|
119
|
+
// eslint-disable-next-line no-return-assign
|
|
120
|
+
this.columns.forEach(col => col.visible = false)
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
getConditions (columns) {
|
|
124
|
+
const conditions = {}
|
|
125
|
+
columns.filter(item => item.search.value !== undefined && item.search.value !== '' && item.search.value !== null)
|
|
126
|
+
.forEach(col => {
|
|
127
|
+
conditions[col.dataIndex] = col.search.value
|
|
128
|
+
})
|
|
129
|
+
return conditions
|
|
130
|
+
},
|
|
131
|
+
formatColumns (columns) {
|
|
132
|
+
for (const col of columns) {
|
|
133
|
+
if (col.visible === undefined) {
|
|
134
|
+
this.$set(col, 'visible', true)
|
|
135
|
+
}
|
|
136
|
+
if (!col.visible) {
|
|
137
|
+
this.checkedCounts -= 1
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
|
+
<style scoped lang="less">
|
|
146
|
+
.action-columns{
|
|
147
|
+
display: inline-block;
|
|
148
|
+
.check-all{
|
|
149
|
+
margin-right: 8px;
|
|
150
|
+
}
|
|
151
|
+
.left,.right{
|
|
152
|
+
transform: rotate(-90deg);
|
|
153
|
+
}
|
|
154
|
+
.active{
|
|
155
|
+
color: @primary-color;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
</style>
|