n20-common-lib 1.3.36 → 1.3.39
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/package.json +2 -2
- package/src/assets/css/_coreLib.scss +0 -1
- package/src/assets/css/alert.scss +2 -5
- package/src/assets/css/cl-form-item.scss +24 -10
- package/src/assets/css/normalize.scss +125 -5
- package/src/assets/getJsonc.js +4 -1
- package/src/assets/realUrl.js +2 -1
- package/src/components/Anchor/AnchorItem.vue +1 -1
- package/src/components/Button/button-group.vue +0 -6
- package/src/components/DatePicker/index.vue +6 -0
- package/src/components/DatePicker/por.vue +2 -0
- package/src/components/ECharts/index.vue +0 -1
- package/src/components/EventBubble/demo/a.vue +1 -1
- package/src/components/EventBubble/demo/b.vue +1 -1
- package/src/components/EventBubble/demo/c.vue +2 -2
- package/src/components/FileImport/index.vue +101 -2
- package/src/components/Filters/form-item-input.vue +0 -1
- package/src/components/Filters/indexO.vue +14 -12
- package/src/components/FlowStep/index.vue +50 -27
- package/src/components/InputNumber/index.vue +6 -1
- package/src/components/InputNumber/numberRange.vue +17 -2
- package/src/components/Layout/HeaderWrap/index.vue +1 -7
- package/src/components/Layout/TabsNav/index.vue +1 -2
- package/src/components/Layout/index.vue +1 -1
- package/src/components/LoginTemporary/index.vue +43 -32
- package/src/components/LoginTemporary/retrievePw.vue +6 -3
- package/src/components/MoreTab/index.vue +1 -4
- package/src/components/PageHeader/index.vue +5 -2
- package/src/components/SecondaryTab/index.vue +0 -1
- package/src/components/SelectLazy/index.vue +2 -2
- package/src/components/Sifting/index.vue +1 -2
- package/src/components/Step/index.vue +0 -1
- package/src/components/TertiaryTab/index.vue +0 -1
- package/src/components/Upload/index.vue +17 -5
- package/src/components/Upload/uploadMsg.vue +114 -0
- package/src/directives/VClickOutside/index.js +11 -3
- package/src/directives/VDrag/index.js +12 -8
- package/src/directives/VMove/index.js +3 -3
- package/src/directives/VRuleKey/index.js +201 -0
- package/src/index.js +2 -0
- package/src/utils/auth.js +3 -1
- package/src/utils/axios.js +3 -1
- package/src/utils/repairElementUI.js +32 -8
- package/src/utils/xls2json.js +1 -1
- package/style/index.css +1 -1
- package/style/index.css.map +1 -1
- package/theme/blue.css +1 -1
- package/theme/green.css +1 -1
- package/theme/lightBlue.css +1 -1
- package/theme/orange.css +1 -1
- package/theme/purple.css +1 -1
- package/theme/red.css +1 -1
- package/theme/yellow.css +1 -1
- package/src/components/FileImport/_index.vue +0 -201
- package/src/components/Search/index.vue +0 -485
- package/src/components/Search/style.scss +0 -93
- package/src/directives/VRules/index.js +0 -10
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-dropdown
|
|
3
|
-
trigger="click"
|
|
4
|
-
placement="bottom-start"
|
|
5
|
-
@command="handleCommand"
|
|
6
|
-
>
|
|
7
|
-
<el-button size="mini" type="primary"> 导入 </el-button>
|
|
8
|
-
<el-dropdown-menu slot="dropdown">
|
|
9
|
-
<el-dropdown-item command="a">导入数据</el-dropdown-item>
|
|
10
|
-
<el-dropdown-item command="b">模板下载</el-dropdown-item>
|
|
11
|
-
</el-dropdown-menu>
|
|
12
|
-
</el-dropdown>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script>
|
|
16
|
-
import XLSX from 'xlsx'
|
|
17
|
-
import axios from '../../utils/axios'
|
|
18
|
-
export default {
|
|
19
|
-
name: 'FileImport',
|
|
20
|
-
props: {
|
|
21
|
-
title: {
|
|
22
|
-
type: String,
|
|
23
|
-
default: function () {
|
|
24
|
-
return '文件导入'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
tips: {
|
|
28
|
-
type: Array,
|
|
29
|
-
default: () => {
|
|
30
|
-
return []
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
templateUrl: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: ''
|
|
36
|
-
},
|
|
37
|
-
downConfig: {
|
|
38
|
-
type: Object,
|
|
39
|
-
default() {
|
|
40
|
-
return {
|
|
41
|
-
isFrontDown: true,
|
|
42
|
-
fileName: '下载.xlsx'
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
footerHandlers: {
|
|
47
|
-
type: Object,
|
|
48
|
-
default: function () {
|
|
49
|
-
return {
|
|
50
|
-
// cancel: {
|
|
51
|
-
// text: '取消'
|
|
52
|
-
// },
|
|
53
|
-
// confirm: {
|
|
54
|
-
// text: '导入'
|
|
55
|
-
// }
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
beforeUpload: Function, // eslint-disable-line
|
|
60
|
-
callback: {
|
|
61
|
-
type: Function,
|
|
62
|
-
default: () => {}
|
|
63
|
-
},
|
|
64
|
-
handleConfirm: {
|
|
65
|
-
type: Function,
|
|
66
|
-
default: () => {}
|
|
67
|
-
},
|
|
68
|
-
reset: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: false
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
data() {
|
|
74
|
-
return {
|
|
75
|
-
excelData: {
|
|
76
|
-
tableHeader: [],
|
|
77
|
-
tableData: []
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
analysisText: 'analysis',
|
|
81
|
-
fileName: '',
|
|
82
|
-
statisticsFlag: false,
|
|
83
|
-
columnsListTemp: [],
|
|
84
|
-
errorListTemp: [],
|
|
85
|
-
successFlag: false,
|
|
86
|
-
confirmDisabledFlag: true
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
methods: {
|
|
90
|
-
handleCommand(val) {
|
|
91
|
-
if (val == 'a') {
|
|
92
|
-
this.seletFile()
|
|
93
|
-
} else if (val == 'b') {
|
|
94
|
-
this.downloadTemplate()
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
seletFile() {
|
|
98
|
-
let input = document.createElement('input')
|
|
99
|
-
let self = this
|
|
100
|
-
input.type = 'file'
|
|
101
|
-
input.accept = '.xlsx, .xls, .csv'
|
|
102
|
-
input.addEventListener('change', function (event) {
|
|
103
|
-
const files = event.target.files
|
|
104
|
-
const rawFile = files[0] // only use files[0]
|
|
105
|
-
console.log('导入的文件:', rawFile)
|
|
106
|
-
self.fileName = rawFile.name
|
|
107
|
-
if (!rawFile) return
|
|
108
|
-
self.upload(rawFile)
|
|
109
|
-
this.value = null // fix can't select the same excel
|
|
110
|
-
})
|
|
111
|
-
input.click()
|
|
112
|
-
},
|
|
113
|
-
/* 上传文件 */
|
|
114
|
-
upload(rawFile) {
|
|
115
|
-
if (!this.beforeUpload) {
|
|
116
|
-
this.readerData(rawFile)
|
|
117
|
-
return
|
|
118
|
-
}
|
|
119
|
-
const before = this.beforeUpload(rawFile)
|
|
120
|
-
if (before) {
|
|
121
|
-
this.readerData(rawFile)
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
/*解析传入的表格 */
|
|
125
|
-
readerData(rawFile) {
|
|
126
|
-
return new Promise((resolve) => {
|
|
127
|
-
const reader = new FileReader()
|
|
128
|
-
reader.onload = (e) => {
|
|
129
|
-
const data = e.target.result
|
|
130
|
-
const workbook = XLSX.read(data, {
|
|
131
|
-
type: 'array',
|
|
132
|
-
cellDates: true
|
|
133
|
-
})
|
|
134
|
-
const firstSheetName = workbook.SheetNames[0]
|
|
135
|
-
const worksheet = workbook.Sheets[firstSheetName]
|
|
136
|
-
const header = this.getHeaderRow(worksheet)
|
|
137
|
-
const results = XLSX.utils.sheet_to_json(worksheet)
|
|
138
|
-
|
|
139
|
-
this.generateData({ header, results })
|
|
140
|
-
resolve()
|
|
141
|
-
}
|
|
142
|
-
reader.readAsArrayBuffer(rawFile)
|
|
143
|
-
})
|
|
144
|
-
},
|
|
145
|
-
generateData({ header, results }) {
|
|
146
|
-
this.excelData.tableHeader = header
|
|
147
|
-
this.excelData.tableData = results
|
|
148
|
-
this.callback && this.callback(this.excelData)
|
|
149
|
-
},
|
|
150
|
-
getHeaderRow(sheet) {
|
|
151
|
-
console.log(sheet)
|
|
152
|
-
const headers = []
|
|
153
|
-
const range = XLSX.utils.decode_range(sheet['!ref'])
|
|
154
|
-
let C
|
|
155
|
-
const R = range.s.r
|
|
156
|
-
/* start in the first row */
|
|
157
|
-
for (C = range.s.c; C <= range.e.c; ++C) {
|
|
158
|
-
/* walk every column in the range */
|
|
159
|
-
const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]
|
|
160
|
-
/* find the cell in the first row */
|
|
161
|
-
let hdr = 'UNKNOWN ' + C // <-- replace with your desired default
|
|
162
|
-
if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
|
|
163
|
-
headers.push(hdr)
|
|
164
|
-
}
|
|
165
|
-
return headers
|
|
166
|
-
},
|
|
167
|
-
// 下载文件
|
|
168
|
-
downloadTemplate() {
|
|
169
|
-
// 前端下载
|
|
170
|
-
if (this.downConfig.isFrontDown) {
|
|
171
|
-
const aEl = document.createElement('a')
|
|
172
|
-
aEl.setAttribute('href', this.templateUrl)
|
|
173
|
-
aEl.target = '_blank'
|
|
174
|
-
// aEl.download = this.templateUrl
|
|
175
|
-
aEl.click()
|
|
176
|
-
} else {
|
|
177
|
-
axios({
|
|
178
|
-
url: this.templateUrl,
|
|
179
|
-
method: 'get',
|
|
180
|
-
responseType: 'blob'
|
|
181
|
-
}).then((res) => {
|
|
182
|
-
const content = res
|
|
183
|
-
const blob = new Blob([content])
|
|
184
|
-
if ('download' in document.createElement('a')) {
|
|
185
|
-
const link = document.createElement('a')
|
|
186
|
-
link.download = this.downConfig.fileName
|
|
187
|
-
link.style.display = 'none'
|
|
188
|
-
link.href = URL.createObjectURL(blob)
|
|
189
|
-
document.body.appendChild(link)
|
|
190
|
-
link.click()
|
|
191
|
-
URL.revokeObjectURL(link.href)
|
|
192
|
-
document.body.removeChild(link)
|
|
193
|
-
} else {
|
|
194
|
-
navigator.msSaveBlob(blob, this.downConfig.fileName)
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
</script>
|
|
@@ -1,485 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
功能: 自定义查询条件
|
|
3
|
-
作者: nstc
|
|
4
|
-
创建时间: 2021-02-05
|
|
5
|
-
-->
|
|
6
|
-
|
|
7
|
-
<template>
|
|
8
|
-
<div class="n20-filter-custom-box">
|
|
9
|
-
<el-popover
|
|
10
|
-
ref="popover"
|
|
11
|
-
v-model="popoverShowFlag"
|
|
12
|
-
:placement="placement"
|
|
13
|
-
trigger="click"
|
|
14
|
-
popper-class="n20-search__popper"
|
|
15
|
-
>
|
|
16
|
-
<div class="filter-custom-box-main">
|
|
17
|
-
<div class="filter-custom-box-main-header">
|
|
18
|
-
<div class="filter-text">筛选</div>
|
|
19
|
-
<div class="filter-close-img" @click="closePopover">
|
|
20
|
-
<i class="el-icon-close"></i>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
<div v-loading="loadingFlag" class="filter-custom-box-main-condition">
|
|
24
|
-
<NstcForm
|
|
25
|
-
v-model="formModel"
|
|
26
|
-
:form-data="formModel"
|
|
27
|
-
:config="formConfig"
|
|
28
|
-
:mount-and-query="false"
|
|
29
|
-
:reset.sync="reset"
|
|
30
|
-
:label-width="labelWidth"
|
|
31
|
-
@tree-node-click="clickTreeNode"
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
<div class="filter-custom-box-main-more">
|
|
35
|
-
<span @click="moreCondition">更多条件</span>
|
|
36
|
-
</div>
|
|
37
|
-
<div class="filter-custom-box-main-footer">
|
|
38
|
-
<el-button
|
|
39
|
-
type="primary"
|
|
40
|
-
class="nstc-g6-common-btn-1 nstc-g6-common-btn-size-b"
|
|
41
|
-
@click="confirmAction"
|
|
42
|
-
>确定</el-button
|
|
43
|
-
>
|
|
44
|
-
<el-tooltip
|
|
45
|
-
class="item"
|
|
46
|
-
effect="dark"
|
|
47
|
-
content="重置本次操作"
|
|
48
|
-
placement="top-start"
|
|
49
|
-
>
|
|
50
|
-
<el-button
|
|
51
|
-
class="nstc-g6-common-btn-3 nstc-g6-common-btn-size-b"
|
|
52
|
-
@click="resetAction"
|
|
53
|
-
>清空</el-button
|
|
54
|
-
>
|
|
55
|
-
</el-tooltip>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
<div slot="reference" class="filter-opt">
|
|
59
|
-
<el-button
|
|
60
|
-
icon="n20-icon-iconfontshaixuan"
|
|
61
|
-
plain
|
|
62
|
-
onlyicon
|
|
63
|
-
size="mini"
|
|
64
|
-
@click.stop="init"
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
</el-popover>
|
|
68
|
-
|
|
69
|
-
<!-- 查询条件 -->
|
|
70
|
-
<NstcTableSet
|
|
71
|
-
v-model="conditionSetFlag"
|
|
72
|
-
:type="defaultType"
|
|
73
|
-
:config="config"
|
|
74
|
-
:title="setTitle"
|
|
75
|
-
@confirm="handleConfirm"
|
|
76
|
-
/>
|
|
77
|
-
</div>
|
|
78
|
-
</template>
|
|
79
|
-
|
|
80
|
-
<script>
|
|
81
|
-
import NstcTableSet from '../../../nstc-g6/components/NstcTableSet/NstcTableSet'
|
|
82
|
-
import NstcForm from '../../../nstc-g6/components/NstcForm/Component'
|
|
83
|
-
import axios from '../../utils/axios'
|
|
84
|
-
|
|
85
|
-
export default {
|
|
86
|
-
name: 'Search',
|
|
87
|
-
|
|
88
|
-
components: {
|
|
89
|
-
NstcTableSet,
|
|
90
|
-
NstcForm
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
props: {
|
|
94
|
-
defaultConfig: {
|
|
95
|
-
type: Object,
|
|
96
|
-
default: () => {
|
|
97
|
-
return {}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
config: {
|
|
101
|
-
type: Object,
|
|
102
|
-
default: () => {
|
|
103
|
-
return {
|
|
104
|
-
pageUUID: '',
|
|
105
|
-
moduleNo: '',
|
|
106
|
-
queryType: ''
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
defaultValue: {
|
|
111
|
-
type: Object,
|
|
112
|
-
default: () => {
|
|
113
|
-
return {}
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
valueConfig: {
|
|
117
|
-
type: Object,
|
|
118
|
-
default: () => {
|
|
119
|
-
return {}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
data() {
|
|
125
|
-
return {
|
|
126
|
-
placement: 'bottom',
|
|
127
|
-
conditionSetFlag: false,
|
|
128
|
-
defaultType: 'condition',
|
|
129
|
-
formModel: {},
|
|
130
|
-
reset: false,
|
|
131
|
-
defaultSet: [],
|
|
132
|
-
setTitle: '筛选条件',
|
|
133
|
-
popoverShowFlag: false,
|
|
134
|
-
queryTypeObj: {
|
|
135
|
-
all: 1, // 全部
|
|
136
|
-
columnSet: 2, // 表格设置
|
|
137
|
-
condition: 3 // 条件设置
|
|
138
|
-
},
|
|
139
|
-
loadingFlag: false,
|
|
140
|
-
hasLoad: false,
|
|
141
|
-
formConfig: [],
|
|
142
|
-
oldFormModel: {}
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
computed: {
|
|
147
|
-
labelWidth() {
|
|
148
|
-
let l = 0
|
|
149
|
-
this.defaultSet.map((i) => {
|
|
150
|
-
l = Math.max(i[`name`].length, l)
|
|
151
|
-
})
|
|
152
|
-
return l === 0 ? '120' : l * 16 + 12
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
watch: {
|
|
156
|
-
defaultSet: {
|
|
157
|
-
handler(value) {
|
|
158
|
-
if (value && Array.isArray(value) && value.length) {
|
|
159
|
-
const that = this
|
|
160
|
-
this.formConfig = that.defaultSet.map((item) => {
|
|
161
|
-
let mold = that.typeConversion(item.type)
|
|
162
|
-
let options = []
|
|
163
|
-
try {
|
|
164
|
-
options = JSON.parse(item.options)
|
|
165
|
-
} catch (error) {
|
|
166
|
-
options = []
|
|
167
|
-
}
|
|
168
|
-
// item.multiple 添加默认配置
|
|
169
|
-
const customConfig = that.defaultConfig[item.id] || {}
|
|
170
|
-
let data = [
|
|
171
|
-
{
|
|
172
|
-
mold: mold.type, // 组件名称
|
|
173
|
-
name: item.name, // 表单选项的名称
|
|
174
|
-
prop:
|
|
175
|
-
item.type == 'select' && item.multiple
|
|
176
|
-
? item.id + 's'
|
|
177
|
-
: item.id, // 绑定的key值
|
|
178
|
-
options: options, //item.options ? JSON.parse(item.options):[], // 下拉选择框的选项
|
|
179
|
-
url: that.removeQuotation(item.url), // 远程查询的url
|
|
180
|
-
formConfig: item.formConfig || [], // 弹窗查询的 选择表单
|
|
181
|
-
columns: item.columns || [], // 弹框查询: 的表格配置
|
|
182
|
-
valueKey: that.removeQuotation(item.valueKey),
|
|
183
|
-
labelKey: that.removeQuotation(item.labelKey),
|
|
184
|
-
httpMethod: item.httpMethod || 'get', // 请求方式
|
|
185
|
-
lazyLoad: item.lazyLoad || false, // 请求方式
|
|
186
|
-
placeholder: item.placeholder,
|
|
187
|
-
width: item.width || 224,
|
|
188
|
-
disabled: item.disabled,
|
|
189
|
-
params: item.params,
|
|
190
|
-
multiple: item.multiple,
|
|
191
|
-
defaultProps: item.defaultProps,
|
|
192
|
-
remote: item.remote,
|
|
193
|
-
filterable: item.filterable,
|
|
194
|
-
query: item.query,
|
|
195
|
-
onlyClickLeaf: item.onlyClickLeaf, //item.onlyClickLeaf,
|
|
196
|
-
disableUnclickLeaf: item.disableUnclickLeaf, //下拉树是否禁用非子节点,默认false,不禁用
|
|
197
|
-
clearable: item.clearable,
|
|
198
|
-
checkStrictly: item.checkStrictly,
|
|
199
|
-
resProp: item.resProp || null,
|
|
200
|
-
isCache: item.isCache,
|
|
201
|
-
dateType: item.dateType, // 时间选择框 时间范围限制
|
|
202
|
-
class: {
|
|
203
|
-
'filter-condition-input': [
|
|
204
|
-
'input',
|
|
205
|
-
'nstcSelectTree'
|
|
206
|
-
].includes(mold.type), // 用于控制组件长度
|
|
207
|
-
[item.className || 'null-custom-class']: true
|
|
208
|
-
},
|
|
209
|
-
...customConfig,
|
|
210
|
-
isInitRequest: item.name === '融资单位' && item.id // 特殊处理
|
|
211
|
-
}
|
|
212
|
-
]
|
|
213
|
-
|
|
214
|
-
// 判断是否设置默认值
|
|
215
|
-
if (!['', null, undefined].includes(this.defaultValue[item.id])) {
|
|
216
|
-
data[0].default = this.defaultValue[item.id]
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (mold.attr) {
|
|
220
|
-
data[0].type = mold.attr
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (item.bind && item.bind instanceof Object) {
|
|
224
|
-
// 不能改变原来的属性
|
|
225
|
-
const bindKey = Object.keys(item.bind)
|
|
226
|
-
const dataKey = Object.keys(data[0])
|
|
227
|
-
const tempKey = bindKey.filter((k) => !dataKey.includes(k))
|
|
228
|
-
|
|
229
|
-
tempKey.map((k) => {
|
|
230
|
-
data[0][k] = item.bind[k]
|
|
231
|
-
})
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* 特殊自定义组件属性处理
|
|
236
|
-
*/
|
|
237
|
-
if (
|
|
238
|
-
item.type === 'nstcSelectTree' ||
|
|
239
|
-
item.type === 'nstcSelectTreeList'
|
|
240
|
-
) {
|
|
241
|
-
data[0].defaultProps = item.defaultProps
|
|
242
|
-
data[0].tagProps = item.tagProps
|
|
243
|
-
data[0].nodeKey = item.nodeKey
|
|
244
|
-
data[0].params = item.params
|
|
245
|
-
data[0].queryKey = item.queryKey
|
|
246
|
-
data[0].label = item.label
|
|
247
|
-
}
|
|
248
|
-
if (item.id === 'branchBankNo') {
|
|
249
|
-
data[0].defaultProps = item.defaultProps
|
|
250
|
-
data[0].nodeKey = item.nodeKey
|
|
251
|
-
data[0].params = item.params
|
|
252
|
-
data[0].queryKey = item.queryKey
|
|
253
|
-
data[0].filterable = item.filterable
|
|
254
|
-
data[0].httpMethod = item.httpMethod
|
|
255
|
-
data[0].queryKey = item.queryKey
|
|
256
|
-
data[0].lazyLoad = item.lazyLoad
|
|
257
|
-
data[0].pageMode = item.pageMode
|
|
258
|
-
data[0].pageCurrentKey = item.pageCurrentKey
|
|
259
|
-
data[0].pageSizeKey = item.pageSizeKey
|
|
260
|
-
data[0].remote = item.remote
|
|
261
|
-
}
|
|
262
|
-
return data
|
|
263
|
-
})
|
|
264
|
-
setTimeout(() => {
|
|
265
|
-
this.setValue()
|
|
266
|
-
}, 0)
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
immediate: true,
|
|
270
|
-
deep: true
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* 下拉等组件联动,修改组件配置
|
|
275
|
-
* 监听form-change,并使用updateFormConfig更新表单配置
|
|
276
|
-
*/
|
|
277
|
-
formModel: {
|
|
278
|
-
deep: true,
|
|
279
|
-
handler(data) {
|
|
280
|
-
this.$emit('form-change', data, this.formConfig)
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
mounted() {
|
|
285
|
-
console.log(444)
|
|
286
|
-
},
|
|
287
|
-
methods: {
|
|
288
|
-
/**
|
|
289
|
-
* 组件联动,避免多次触发nstcform.watch.config
|
|
290
|
-
*/
|
|
291
|
-
updateFormConfig(newConfig) {
|
|
292
|
-
this.formConfig = newConfig
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
clickTreeNode(queryKey, data) {
|
|
296
|
-
if (queryKey) {
|
|
297
|
-
this.formModel[queryKey] = data[queryKey]
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
/**
|
|
301
|
-
* 提交保存成功
|
|
302
|
-
*/
|
|
303
|
-
handleConfirm() {
|
|
304
|
-
console.log('查询条件设置成功', this.formModel)
|
|
305
|
-
// 缓存下之前的数据
|
|
306
|
-
const cache = JSON.parse(JSON.stringify(this.formModel))
|
|
307
|
-
this.init('update', () => {
|
|
308
|
-
this.formModel = cache
|
|
309
|
-
})
|
|
310
|
-
this.popoverShowFlag = true
|
|
311
|
-
},
|
|
312
|
-
|
|
313
|
-
async init(flag, cb) {
|
|
314
|
-
this.popoverShowFlag = !this.popoverShowFlag
|
|
315
|
-
if (this.hasLoad && flag !== 'update') {
|
|
316
|
-
this.changeDefaultSet()
|
|
317
|
-
|
|
318
|
-
this.$nextTick(() => {
|
|
319
|
-
this.$forceUpdate()
|
|
320
|
-
})
|
|
321
|
-
return
|
|
322
|
-
}
|
|
323
|
-
this.loadingFlag = true
|
|
324
|
-
this.defaultSet = []
|
|
325
|
-
const res = await axios.get(`/bems/1.0/dynamicUnit`, {
|
|
326
|
-
...this.config,
|
|
327
|
-
queryType: 3
|
|
328
|
-
})
|
|
329
|
-
this.loadingFlag = false
|
|
330
|
-
this.hasLoad = true
|
|
331
|
-
this.defaultSet = res.data
|
|
332
|
-
this.changeDefaultSet()
|
|
333
|
-
this.$nextTick(() => {
|
|
334
|
-
this.updatePop()
|
|
335
|
-
this.$forceUpdate()
|
|
336
|
-
cb && cb()
|
|
337
|
-
})
|
|
338
|
-
},
|
|
339
|
-
changeDefaultSet(type) {
|
|
340
|
-
this.defaultSet = this.defaultSet.map((item) => {
|
|
341
|
-
let nItem = Object.assign({}, item)
|
|
342
|
-
nItem.disabled = this.valueConfig[item.id]
|
|
343
|
-
? this.valueConfig[item.id].disabled || false
|
|
344
|
-
: false
|
|
345
|
-
this.valueConfig[item.id] &&
|
|
346
|
-
(nItem.label = this.valueConfig[item.id].label)
|
|
347
|
-
nItem.options = this.valueConfig[item.id]
|
|
348
|
-
? JSON.stringify(this.valueConfig[item.id].options) || []
|
|
349
|
-
: item.options
|
|
350
|
-
nItem.time = new Date().getTime()
|
|
351
|
-
nItem.clearable = this.valueConfig[item.id]
|
|
352
|
-
? this.valueConfig[item.id].clearable
|
|
353
|
-
: true
|
|
354
|
-
return nItem
|
|
355
|
-
})
|
|
356
|
-
console.log(this.defaultSet, 123)
|
|
357
|
-
},
|
|
358
|
-
setValue() {
|
|
359
|
-
let newObj = {}
|
|
360
|
-
for (let key1 in this.valueConfig) {
|
|
361
|
-
let item = this.valueConfig[key1]
|
|
362
|
-
let keyObj = this.defaultSet.find(
|
|
363
|
-
(item) => item.id === key1 && item.type === 'select' && item.multiple
|
|
364
|
-
)
|
|
365
|
-
if (item.hasOwnProperty('value')) {
|
|
366
|
-
this.$set(
|
|
367
|
-
newObj,
|
|
368
|
-
keyObj ? key1 + 's' : key1,
|
|
369
|
-
this.reset ? '' : item.value
|
|
370
|
-
)
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
// this.formModel = {...this.formModel,...this.oldFormModel, ...newObj}
|
|
374
|
-
if (JSON.stringify(this.oldFormModel) !== '{}') {
|
|
375
|
-
// 旧配置中的字段不在新的配置中,则需要移除对应的缓存值
|
|
376
|
-
this.defaultSet.forEach(({ id, multiple, type, queryKey }) => {
|
|
377
|
-
const isExist =
|
|
378
|
-
Reflect.has(this.oldFormModel, id) ||
|
|
379
|
-
Reflect.has(this.oldFormModel, id + 's')
|
|
380
|
-
// 在缓存中存在,则取缓存的值
|
|
381
|
-
if (isExist) {
|
|
382
|
-
if (type === 'select' && multiple) {
|
|
383
|
-
this.formModel[id + 's'] = this.oldFormModel[id + 's']
|
|
384
|
-
} else {
|
|
385
|
-
this.formModel[id] = this.oldFormModel[id]
|
|
386
|
-
}
|
|
387
|
-
} else {
|
|
388
|
-
this.formModel[id] = this.defaultSet[id]
|
|
389
|
-
}
|
|
390
|
-
})
|
|
391
|
-
// 新配置中移除了某些字段,需要将缓存中的字段移除
|
|
392
|
-
Object.keys(this.oldFormModel).forEach((k) => {
|
|
393
|
-
const isExist = this.defaultSet.find((item) => {
|
|
394
|
-
return item.id === k || item.id + 's' === k || item.queryKey == k
|
|
395
|
-
})
|
|
396
|
-
if (!isExist) {
|
|
397
|
-
delete this.formModel[k]
|
|
398
|
-
}
|
|
399
|
-
})
|
|
400
|
-
}
|
|
401
|
-
this.formModel = { ...this.formModel, ...newObj }
|
|
402
|
-
this.reset = false
|
|
403
|
-
},
|
|
404
|
-
/**
|
|
405
|
-
* 类型转化方法
|
|
406
|
-
*/
|
|
407
|
-
typeConversion(type) {
|
|
408
|
-
// 属性合集
|
|
409
|
-
const mold = [
|
|
410
|
-
{
|
|
411
|
-
// 时间
|
|
412
|
-
type: 'datepicker',
|
|
413
|
-
attr: 'daterange'
|
|
414
|
-
}
|
|
415
|
-
]
|
|
416
|
-
// 筛选对应需要添加属性的数据
|
|
417
|
-
// eg:
|
|
418
|
-
let isAddAttr = mold.filter((x) => x.attr === type)
|
|
419
|
-
|
|
420
|
-
return isAddAttr.length !== 0
|
|
421
|
-
? {
|
|
422
|
-
type: isAddAttr[0].type,
|
|
423
|
-
attr: isAddAttr[0].attr
|
|
424
|
-
}
|
|
425
|
-
: {
|
|
426
|
-
type: type,
|
|
427
|
-
attr: null
|
|
428
|
-
}
|
|
429
|
-
},
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* 查询更多条件
|
|
433
|
-
*/
|
|
434
|
-
moreCondition() {
|
|
435
|
-
this.conditionSetFlag = true
|
|
436
|
-
},
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* 确认查询
|
|
440
|
-
*/
|
|
441
|
-
confirmAction() {
|
|
442
|
-
this.popoverShowFlag = false
|
|
443
|
-
this.oldFormModel = JSON.parse(JSON.stringify(this.formModel))
|
|
444
|
-
// 格式化金额
|
|
445
|
-
this.$emit('search', this.formModel)
|
|
446
|
-
},
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* 去掉后台返回字段的”
|
|
450
|
-
*/
|
|
451
|
-
removeQuotation(str) {
|
|
452
|
-
return str ? str.replace(/"/g, '') : ''
|
|
453
|
-
},
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* 重置
|
|
457
|
-
*/
|
|
458
|
-
resetAction() {
|
|
459
|
-
this.reset = true
|
|
460
|
-
this.oldFormModel = {}
|
|
461
|
-
this.changeDefaultSet('reset')
|
|
462
|
-
this.$emit('reset', this.formModel)
|
|
463
|
-
},
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* 关闭
|
|
467
|
-
*/
|
|
468
|
-
closePopover() {
|
|
469
|
-
this.reset = true
|
|
470
|
-
this.$nextTick(() => {
|
|
471
|
-
this.popoverShowFlag = false
|
|
472
|
-
})
|
|
473
|
-
},
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* 手动打开
|
|
477
|
-
*/
|
|
478
|
-
openPopover() {},
|
|
479
|
-
|
|
480
|
-
updatePop() {
|
|
481
|
-
this.$refs.popover.updatePopper()
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
</script>
|