ocpview-plus 0.0.1
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/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/efviewplus.min.esm.js +99954 -0
- package/dist/efviewplus.min.js +142 -0
- package/dist/locale/lang.js +1 -0
- package/dist/locale/zh-CN.js +1 -0
- package/dist/locale/zh-TW.js +1 -0
- package/dist/locale/zh-UG.js +1 -0
- package/dist/style.css +9 -0
- package/dist/styles/efviewplus.css +1 -0
- package/package.json +144 -0
- package/src/components/base/controlbase.vue +191 -0
- package/src/components/base/controlbox.vue +102 -0
- package/src/components/base/index.js +3 -0
- package/src/components/base/load.js +20 -0
- package/src/components/base/probase.js +220 -0
- package/src/components/base/size.js +78 -0
- package/src/components/billbox/billbox.vue +68 -0
- package/src/components/billbox/index.js +2 -0
- package/src/components/cascaderbox/cascaderbox.vue +184 -0
- package/src/components/cascaderbox/index.js +2 -0
- package/src/components/checkbox/checkbox.vue +76 -0
- package/src/components/checkbox/checkgroupbox.vue +104 -0
- package/src/components/checkbox/index.js +3 -0
- package/src/components/colorbox/colorbox.vue +44 -0
- package/src/components/colorbox/index.js +2 -0
- package/src/components/combobox/combobox.vue +220 -0
- package/src/components/combobox/index.js +2 -0
- package/src/components/conditionbox/conditionbase.vue +195 -0
- package/src/components/conditionbox/conditionbox.vue +63 -0
- package/src/components/conditionbox/conditionfilterbox.vue +477 -0
- package/src/components/conditionbox/conditionselectorbox.vue +237 -0
- package/src/components/conditionbox/index.js +5 -0
- package/src/components/conditionbox/queryconditionbox.vue +26 -0
- package/src/components/conditionbox/queryconditionboxbase.vue +124 -0
- package/src/components/conditionbox/searchconditionbox.vue +114 -0
- package/src/components/conditionbox/searchgrid.vue +391 -0
- package/src/components/datebox/datebox.vue +129 -0
- package/src/components/datebox/daterangebox.vue +155 -0
- package/src/components/datebox/index.js +3 -0
- package/src/components/form/baseform.vue +677 -0
- package/src/components/form/detailsbox.vue +487 -0
- package/src/components/form/formbox.vue +29 -0
- package/src/components/form/formcardbox.vue +268 -0
- package/src/components/form/formcardgroupbox.vue +252 -0
- package/src/components/form/formcompro.js +19 -0
- package/src/components/form/formdetail.vue +129 -0
- package/src/components/form/formdetailtwo.vue +302 -0
- package/src/components/form/index.js +8 -0
- package/src/components/form/toolanchor.js +46 -0
- package/src/components/form/workform.vue +168 -0
- package/src/components/grid/basegrid.vue +1061 -0
- package/src/components/grid/editgrid.vue +51 -0
- package/src/components/grid/editgridbase.vue +947 -0
- package/src/components/grid/editgridcard.vue +193 -0
- package/src/components/grid/expandrow.vue +137 -0
- package/src/components/grid/index.js +6 -0
- package/src/components/grid/viewgrid.vue +122 -0
- package/src/components/grid/viewgridbase.vue +1284 -0
- package/src/components/icon/common-icon.vue +53 -0
- package/src/components/icon/eicon.vue +29 -0
- package/src/components/icon/icons.vue +42 -0
- package/src/components/icon/index.js +2 -0
- package/src/components/label/index.js +3 -0
- package/src/components/label/showtext.vue +95 -0
- package/src/components/load/loadcartoon.vue +228 -0
- package/src/components/map/index.js +2 -0
- package/src/components/map/mapbox.vue +348 -0
- package/src/components/masterplate/appendix.vue +586 -0
- package/src/components/masterplate/approval.vue +803 -0
- package/src/components/masterplate/base.vue +985 -0
- package/src/components/masterplate/billasyncimport.vue +614 -0
- package/src/components/masterplate/billconditionbox.vue +224 -0
- package/src/components/masterplate/billconditionsbox.vue +427 -0
- package/src/components/masterplate/billdetailform.vue +990 -0
- package/src/components/masterplate/billimport.vue +263 -0
- package/src/components/masterplate/billquerygrid.vue +316 -0
- package/src/components/masterplate/billsinglegrid.vue +234 -0
- package/src/components/masterplate/birtreport.vue +185 -0
- package/src/components/masterplate/detailbtntoolbar.vue +311 -0
- package/src/components/masterplate/detailsbox.vue +386 -0
- package/src/components/masterplate/editgridcard.vue +222 -0
- package/src/components/masterplate/editgridcard2.vue +109 -0
- package/src/components/masterplate/formcard.vue +106 -0
- package/src/components/masterplate/formcardgroupbox.vue +168 -0
- package/src/components/masterplate/formdetailtwo.vue +356 -0
- package/src/components/masterplate/gridcolset.vue +227 -0
- package/src/components/masterplate/index.js +23 -0
- package/src/components/masterplate/layouttemplate.vue +33 -0
- package/src/components/masterplate/leftlistrightdetails.vue +474 -0
- package/src/components/masterplate/leftlistrightlist.vue +465 -0
- package/src/components/masterplate/lefttreerightdetails.vue +619 -0
- package/src/components/masterplate/levelreport.vue +510 -0
- package/src/components/masterplate/listbtntoolbar.vue +257 -0
- package/src/components/masterplate/listdetails.vue +769 -0
- package/src/components/masterplate/operlog.vue +272 -0
- package/src/components/masterplate/options.vue +110 -0
- package/src/components/masterplate/page.vue +102 -0
- package/src/components/masterplate/promptmessage.vue +74 -0
- package/src/components/masterplate/querybar.vue +490 -0
- package/src/components/masterplate/report.vue +357 -0
- package/src/components/masterplate/rowbtntoolbar.vue +126 -0
- package/src/components/masterplate/simpletree.vue +129 -0
- package/src/components/masterplate/simpleviewgrid.vue +144 -0
- package/src/components/mychart/bar/bar.vue +202 -0
- package/src/components/mychart/basechart.vue +190 -0
- package/src/components/mychart/complexmychart/barline.vue +154 -0
- package/src/components/mychart/gauge/gauge.vue +83 -0
- package/src/components/mychart/index.js +9 -0
- package/src/components/mychart/line/line.vue +202 -0
- package/src/components/mychart/liquidfill/liquidfill.vue +109 -0
- package/src/components/mychart/pie/pie.vue +96 -0
- package/src/components/mychart/radar/radar.vue +122 -0
- package/src/components/mychart/scatter/scatter.vue +76 -0
- package/src/components/numberbox/append.js +11 -0
- package/src/components/numberbox/index.js +3 -0
- package/src/components/numberbox/numberbox.vue +303 -0
- package/src/components/numberbox/numberrangebox.vue +423 -0
- package/src/components/picturebox/filebox.vue +365 -0
- package/src/components/picturebox/index.js +3 -0
- package/src/components/picturebox/picturebox.vue +541 -0
- package/src/components/picturebox/uploadbox.vue +164 -0
- package/src/components/poptagbox/index.js +2 -0
- package/src/components/poptagbox/poptagbox.vue +389 -0
- package/src/components/poptextbox/index.js +2 -0
- package/src/components/poptextbox/poptextbox.vue +601 -0
- package/src/components/radiobox/index.js +2 -0
- package/src/components/radiobox/radiogroupbox.vue +76 -0
- package/src/components/richtextbox/editor.vue +150 -0
- package/src/components/richtextbox/index.js +2 -0
- package/src/components/richtextbox/richtextbox.vue +448 -0
- package/src/components/textbox/index.js +2 -0
- package/src/components/textbox/textbox.vue +98 -0
- package/src/components/timebox/index.js +2 -0
- package/src/components/timebox/timebox.vue +76 -0
- package/src/components/toolbar/ebutton.vue +169 -0
- package/src/components/toolbar/index.js +3 -0
- package/src/components/toolbar/toolbar.vue +446 -0
- package/src/components/tree/basetree.vue +725 -0
- package/src/components/tree/index.js +3 -0
- package/src/components/tree/treedata.vue +51 -0
- package/src/components/tree/treedatabase.vue +189 -0
- package/src/components/upload/billimport.vue +233 -0
- package/src/components/upload/index.js +2 -0
- package/src/components/videobox/index.js +2 -0
- package/src/components/videobox/uploadbox.vue +148 -0
- package/src/components/videobox/videobox.vue +503 -0
- package/src/components/wrichtextbox/editor.vue +219 -0
- package/src/components/wrichtextbox/index.js +2 -0
- package/src/components/wrichtextbox/wrichtextbox.vue +63 -0
- package/src/index.js +215 -0
- package/src/locale/format.js +51 -0
- package/src/locale/index.js +63 -0
- package/src/locale/lang/zh-CN.js +123 -0
- package/src/locale/lang/zh-TW.js +114 -0
- package/src/locale/lang/zh-UG.js +115 -0
- package/src/locale/lang.js +15 -0
- package/src/method/case/case.js +1180 -0
- package/src/method/config/queryconfig.js +24 -0
- package/src/method/const/const.js +815 -0
- package/src/method/index.js +8 -0
- package/src/static/excel/exportexcel.js +627 -0
- package/src/static/iview/coustom.js +463 -0
- package/src/store/index.js +19 -0
- package/src/store/modules/app.js +53 -0
- package/src/styles/README.md +3 -0
- package/src/styles/common.less +75 -0
- package/src/styles/components/anchor.less +74 -0
- package/src/styles/components/approval.less +136 -0
- package/src/styles/components/button.less +208 -0
- package/src/styles/components/card.less +51 -0
- package/src/styles/components/content.less +38 -0
- package/src/styles/components/font.less +314 -0
- package/src/styles/components/form.less +72 -0
- package/src/styles/components/iconfont/fonts/iconfont.less +1376 -0
- package/src/styles/components/iconfont/fonts/iconfont.svg +699 -0
- package/src/styles/components/iconfont/fonts/iconfont.ttf +0 -0
- package/src/styles/components/iconfont/fonts/iconfont.woff +0 -0
- package/src/styles/components/iconfont/fonts/iconfont.woff2 +0 -0
- package/src/styles/components/index.less +16 -0
- package/src/styles/components/input.less +290 -0
- package/src/styles/components/modal.less +203 -0
- package/src/styles/components/page.less +340 -0
- package/src/styles/components/select.less +361 -0
- package/src/styles/components/steps.less +367 -0
- package/src/styles/components/table.less +544 -0
- package/src/styles/components/tabs.less +249 -0
- package/src/styles/components/upload.less +83 -0
- package/src/styles/custom.less +67 -0
- package/src/styles/index.less +6 -0
- package/src/styles/pack.less +6 -0
- package/src/utils/EfuMessenger.js +155 -0
- package/src/utils/assist.js +353 -0
- package/src/utils/index.js +1 -0
- package/src/utils/random_str.js +10 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div ref="condition">
|
|
4
|
+
<Row v-if="showCondition">
|
|
5
|
+
<Col span='24'>
|
|
6
|
+
<ConditionBox ref="condition" :config="myConfig" :dictData="dictData" @conditionAction="conditionAction" :isPop="isPop" modelType="treeSearch" > </ConditionBox>
|
|
7
|
+
</Col>
|
|
8
|
+
</Row>
|
|
9
|
+
</div>
|
|
10
|
+
<Row class="customLayout" :style="style">
|
|
11
|
+
<Card v-show="showTree" :padding="0" :bordered="myConfig.bordered" :dis-hover="myConfig.disHover" style="width:100%;overflow-x:hidden">
|
|
12
|
+
<template v-if="myConfig.showTitle" #title>
|
|
13
|
+
<p>
|
|
14
|
+
{{config.title}}
|
|
15
|
+
</p>
|
|
16
|
+
</template>
|
|
17
|
+
<Tree ref="tree" :data="treeData" :class="myConfig.className" :show-checkbox="myConfig.showCheckBox" @on-select-change="onSelectChange" @on-check-change="onCheckChange" @on-toggle-expand="onToggleExpand" :load-data="loadData"/>
|
|
18
|
+
</Card>
|
|
19
|
+
<ViewGrid v-show="!showTree" ref="grid" :config="gridConfig" :dictData="dictData" @dbclick="dbclick"/>
|
|
20
|
+
</Row>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
<script>
|
|
24
|
+
import Base from '@/components/tree/treedatabase.vue';
|
|
25
|
+
import elementResizeDetectorMaker from 'element-resize-detector';
|
|
26
|
+
export default {
|
|
27
|
+
name:'treedata',
|
|
28
|
+
extends: Base,
|
|
29
|
+
mounted () {
|
|
30
|
+
this.observer = elementResizeDetectorMaker();
|
|
31
|
+
if (this.$refs.condition) {
|
|
32
|
+
this.observer.listenTo(this.$refs.condition, this.setExtraHeight);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
},
|
|
36
|
+
beforeUnmount() {
|
|
37
|
+
if (this.$refs.condition) {
|
|
38
|
+
this.observer.removeListener(this.$refs.condition, this.setExtraHeight);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
.customLayout{
|
|
47
|
+
OVERFLOW-Y: auto;
|
|
48
|
+
/*background: url('./images/bg.jpg') no-repeat 4px 5px;*/
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
51
|
+
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Base from '@/components/tree/basetree.vue';
|
|
3
|
+
export default {
|
|
4
|
+
name:'treedatabase',
|
|
5
|
+
extends: Base,
|
|
6
|
+
props:{
|
|
7
|
+
isPop: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default:false
|
|
10
|
+
}
|
|
11
|
+
} ,
|
|
12
|
+
computed:{
|
|
13
|
+
style() {
|
|
14
|
+
let height = this.currentHeight;
|
|
15
|
+
if (this.extraHeight) {
|
|
16
|
+
height = height - Number(this.extraHeight);
|
|
17
|
+
}
|
|
18
|
+
if (this.outsideHeight) {
|
|
19
|
+
height = height - Number(this.outsideHeight);
|
|
20
|
+
}
|
|
21
|
+
return 'height:' + height + 'px';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
},
|
|
25
|
+
methods: {
|
|
26
|
+
customInit() {
|
|
27
|
+
if (this.myConfig.showCondition === undefined) {
|
|
28
|
+
if (this.myConfig.items && this.myConfig.items.length >0) {
|
|
29
|
+
let flag = false;
|
|
30
|
+
this.myConfig.items.forEach(el=> {
|
|
31
|
+
if (el.condition || el.conditionPrior) {
|
|
32
|
+
flag = true;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
this.showCondition = flag;
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
this.showCondition = this.myConfig.showCondition;
|
|
40
|
+
}
|
|
41
|
+
if (this.isPop) {
|
|
42
|
+
this.myConfig.showTitle = false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (this.myConfig.gridConfig) {
|
|
46
|
+
this.gridConfig = Object.assign({}, this.gridConfig, this.myConfig.gridConfig);
|
|
47
|
+
}
|
|
48
|
+
if (this.myConfig.formConfig && this.myConfig.formConfig.items && this.myConfig.formConfig.items.length > 0) {
|
|
49
|
+
if (!this.gridConfig.items || this.gridConfig.items.length === 0) {
|
|
50
|
+
this.gridConfig.items = this.$Method.copy(this.myConfig.formConfig.items);
|
|
51
|
+
}
|
|
52
|
+
this.gridConfig.items.forEach(el => {
|
|
53
|
+
if (el.tooltip === undefined) {
|
|
54
|
+
el.tooltip = true;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
this.gridConfig.response = this.myConfig.response;
|
|
58
|
+
this.gridConfig.method = this.myConfig.method;
|
|
59
|
+
this.gridConfig.resources = this.myConfig.resources;
|
|
60
|
+
if (this.myConfig.searchParam) {
|
|
61
|
+
this.gridConfig.searchParam = this.myConfig.searchParam;
|
|
62
|
+
}
|
|
63
|
+
this.gridConfig.headStyle = '';
|
|
64
|
+
if (this.gridConfig.height === undefined) {
|
|
65
|
+
this.gridConfig.height = 360;
|
|
66
|
+
}
|
|
67
|
+
this.gridConfig.tableSize = 'small';
|
|
68
|
+
this.gridConfig.showBorder = false;
|
|
69
|
+
this.gridConfig.pageSize = 'small';
|
|
70
|
+
this.gridConfig.pageShowElevator = false;
|
|
71
|
+
this.gridConfig.pageShowTotal = false;
|
|
72
|
+
this.gridConfig.pageShowSizer = false;
|
|
73
|
+
if (this.myConfig.multiSelect !== undefined) {
|
|
74
|
+
this.gridConfig.multiSelect = this.myConfig.multiSelect;
|
|
75
|
+
} else {
|
|
76
|
+
this.gridConfig.multiSelect = false;
|
|
77
|
+
}
|
|
78
|
+
if (this.gridConfig.pageSizeNum === undefined) {
|
|
79
|
+
this.gridConfig.pageSizeNum = 50;
|
|
80
|
+
}
|
|
81
|
+
this.showGrid = true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
},
|
|
85
|
+
getSearchParam(para) {
|
|
86
|
+
let searchParam = Object.assign({},this.myConfig.searchParam,this.searchBeforeSearchParam);
|
|
87
|
+
if (!searchParam) {
|
|
88
|
+
searchParam = {};
|
|
89
|
+
}
|
|
90
|
+
if (this.myConfig.response === 'report') {
|
|
91
|
+
searchParam = Object.assign({},searchParam,this.conditionSearchParam);
|
|
92
|
+
} else {
|
|
93
|
+
let tempSearchParam = {};
|
|
94
|
+
for (let el in searchParam) {
|
|
95
|
+
if (this.conditionSearchParam[el]) {
|
|
96
|
+
tempSearchParam[el]={'$and':[]};
|
|
97
|
+
tempSearchParam[el]['$and'].push(searchParam[el]);
|
|
98
|
+
tempSearchParam[el]['$and'].push(this.conditionSearchParam[el]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
searchParam = Object.assign({},searchParam,this.conditionSearchParam);
|
|
102
|
+
for (let el in tempSearchParam) {
|
|
103
|
+
delete searchParam[el];
|
|
104
|
+
searchParam['$and'] = el['$and'];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (para) {
|
|
108
|
+
Object.assign(searchParam, para);
|
|
109
|
+
}
|
|
110
|
+
if (this.myConfig.overrideSearchParam) {
|
|
111
|
+
return this.myConfig.overrideSearchParam(searchParam);
|
|
112
|
+
} else {
|
|
113
|
+
return searchParam;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
setWhereParam(para) {
|
|
117
|
+
this.conditionSearchParam = para;
|
|
118
|
+
},
|
|
119
|
+
gridRefurbish (obj) {
|
|
120
|
+
this.$refs.grid.clearSearchBeforeSearchParam();
|
|
121
|
+
this.$refs.grid.setSearchBeforeSearchParam(obj);
|
|
122
|
+
this.$refs.grid.refurbish();
|
|
123
|
+
this.$refs.grid.refurbish();
|
|
124
|
+
},
|
|
125
|
+
conditionAction(temp) {
|
|
126
|
+
let data=[];
|
|
127
|
+
switch (temp.action) {
|
|
128
|
+
case 'condition_search' :
|
|
129
|
+
if (JSON.stringify(temp.para) !== '{}') {
|
|
130
|
+
if (this.showGrid) {
|
|
131
|
+
this.showTree = false;
|
|
132
|
+
this.gridRefurbish(temp.para);
|
|
133
|
+
} else {
|
|
134
|
+
this.conditionSearchParam = temp.para;
|
|
135
|
+
this.refurbish();
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
this.showTree = true;
|
|
139
|
+
this.conditionSearchParam = {};
|
|
140
|
+
this.refurbish();
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
case 'condition_clear' :
|
|
144
|
+
this.conditionSearchParam = {};
|
|
145
|
+
this.refurbish();
|
|
146
|
+
break;
|
|
147
|
+
case 'condition_ok' :
|
|
148
|
+
data = this.getData();
|
|
149
|
+
if (data.length === 0) {
|
|
150
|
+
this.alert('请选择');
|
|
151
|
+
} else {
|
|
152
|
+
temp.rows = data;
|
|
153
|
+
this.$emit('conditionAction',temp);
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
case 'condition_cancel' :
|
|
157
|
+
this.$emit('conditionAction',temp);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
getSelection() {
|
|
162
|
+
if (this.showTree) {
|
|
163
|
+
return this.getData();
|
|
164
|
+
} else {
|
|
165
|
+
return this.$refs.grid.getSelection();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
},
|
|
169
|
+
dbclick (e) {
|
|
170
|
+
let temp = {};
|
|
171
|
+
temp.action= 'condition_ok';
|
|
172
|
+
temp.rows = [];
|
|
173
|
+
temp.rows.push(e);
|
|
174
|
+
this.$emit('conditionAction',temp);
|
|
175
|
+
},
|
|
176
|
+
clearCondition() {
|
|
177
|
+
if (this.$refs.condition && this.$refs.condition.clear) {
|
|
178
|
+
this.$refs.condition.clear();
|
|
179
|
+
}
|
|
180
|
+
this.conditionSearchParam = {};
|
|
181
|
+
this.showTree = true;
|
|
182
|
+
this.refurbish();
|
|
183
|
+
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
</script>
|
|
188
|
+
|
|
189
|
+
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
<style lang="less">
|
|
2
|
+
.vertical-center-modal{
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
|
|
7
|
+
.ivu-modal{
|
|
8
|
+
top: 0;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
.demo-spin-icon-load{
|
|
12
|
+
animation: ani-demo-spin 1s linear infinite;
|
|
13
|
+
}
|
|
14
|
+
@keyframes ani-demo-spin {
|
|
15
|
+
from { transform: rotate(0deg);}
|
|
16
|
+
50% { transform: rotate(180deg);}
|
|
17
|
+
to { transform: rotate(360deg);}
|
|
18
|
+
}
|
|
19
|
+
.demo-spin-col{
|
|
20
|
+
height: 100px;
|
|
21
|
+
position: relative;
|
|
22
|
+
border: 1px solid #eee;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
<template>
|
|
26
|
+
<div >
|
|
27
|
+
<template v-if="modeltype==='upload'">
|
|
28
|
+
<Modal title="上传文件" v-model="showUpload" class-name="vertical-center-modal" :footer-hide="true">
|
|
29
|
+
<div class="demo-spin-col">
|
|
30
|
+
<Row v-if="showType" type="flex" justify="center" :gutter="4" style="margin-bottom: 20px">
|
|
31
|
+
<Col>
|
|
32
|
+
<RadioGroup v-model="type">
|
|
33
|
+
<Radio v-for="(item,index) in myConfig.typeData" :key="index" :label="item.code">
|
|
34
|
+
<span>{{item.name}}</span>
|
|
35
|
+
</Radio>
|
|
36
|
+
</RadioGroup>
|
|
37
|
+
</Col>
|
|
38
|
+
</Row>
|
|
39
|
+
<Row type="flex" justify="center" :gutter="4">
|
|
40
|
+
<Col>
|
|
41
|
+
<Button @click="upload">上传</Button>
|
|
42
|
+
</Col>
|
|
43
|
+
<Col>
|
|
44
|
+
<Poptip trigger="focus">
|
|
45
|
+
<Input v-model="name" clearable readonly/>
|
|
46
|
+
<template #content>
|
|
47
|
+
<div>{{filename}}</div>
|
|
48
|
+
</template>
|
|
49
|
+
</Poptip>
|
|
50
|
+
</Col>
|
|
51
|
+
<Col>
|
|
52
|
+
<Upload ref="upload"
|
|
53
|
+
:before-upload="handleUpload"
|
|
54
|
+
accept=".xlsx,.xls"
|
|
55
|
+
:format="myConfig.fileType"
|
|
56
|
+
:on-format-error="handleFormatError"
|
|
57
|
+
:on-success="handleSuccess"
|
|
58
|
+
:show-upload-list="false"
|
|
59
|
+
:action="url">
|
|
60
|
+
<Button>浏览</Button>
|
|
61
|
+
</Upload>
|
|
62
|
+
</Col>
|
|
63
|
+
</Row>
|
|
64
|
+
<Spin v-show="loading" fix>
|
|
65
|
+
<CommonIcon type="ios-loading" size="18" class="demo-spin-icon-load"></CommonIcon>
|
|
66
|
+
<div>导入中</div>
|
|
67
|
+
</Spin>
|
|
68
|
+
</div>
|
|
69
|
+
</Modal>
|
|
70
|
+
</template>
|
|
71
|
+
<template v-if="modeltype === 'down'">
|
|
72
|
+
<Modal v-model="showUpload" title="选择模版" @on-ok="downTemplate" class-name="vertical-center-modal">
|
|
73
|
+
<RadioGroup v-model="type">
|
|
74
|
+
<Radio v-for="(item,index) in myConfig.typeData" :key="index" :label="item.code">
|
|
75
|
+
<span>{{item.name}}</span>
|
|
76
|
+
</Radio>
|
|
77
|
+
</RadioGroup>
|
|
78
|
+
</Modal>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
<script>
|
|
84
|
+
export default {
|
|
85
|
+
name:'billimport',
|
|
86
|
+
data () {
|
|
87
|
+
return {
|
|
88
|
+
myConfig:{
|
|
89
|
+
typeData:[],
|
|
90
|
+
fileType:['xlsx','xls']
|
|
91
|
+
},
|
|
92
|
+
file: null,
|
|
93
|
+
name:'',
|
|
94
|
+
type:'',
|
|
95
|
+
showType:false,
|
|
96
|
+
showUpload:false,
|
|
97
|
+
url:'',
|
|
98
|
+
modeltype:'upload',
|
|
99
|
+
param:{},
|
|
100
|
+
loading:false
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
props:{
|
|
104
|
+
config: {
|
|
105
|
+
type:Object,
|
|
106
|
+
default () {
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
} ,
|
|
111
|
+
computed:{
|
|
112
|
+
filename(){
|
|
113
|
+
if (this.name) {
|
|
114
|
+
return this.name;
|
|
115
|
+
} else {
|
|
116
|
+
return '请选择Excel文件';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
created () {
|
|
121
|
+
this.init();
|
|
122
|
+
},
|
|
123
|
+
methods: {
|
|
124
|
+
init () {
|
|
125
|
+
if (this.config) {
|
|
126
|
+
let config = this.$Method.copy(this.config);
|
|
127
|
+
for (let temp2 in this.myConfig) {
|
|
128
|
+
if (config[temp2] !== undefined) {
|
|
129
|
+
this.myConfig[temp2] = config[temp2];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (this.myConfig.typeData && this.myConfig.typeData.length > 0) {
|
|
133
|
+
this.showType = true;
|
|
134
|
+
this.type = this.myConfig.typeData[0].code;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
setModeltype(value) {
|
|
139
|
+
this.modeltype = value;
|
|
140
|
+
},
|
|
141
|
+
setShowUpload(flag) {
|
|
142
|
+
this.showUpload = flag;
|
|
143
|
+
},
|
|
144
|
+
setUrl(url,method,param) {
|
|
145
|
+
if (url) {
|
|
146
|
+
url = url.replace('rest', 'import');
|
|
147
|
+
}
|
|
148
|
+
let self = this;
|
|
149
|
+
this.url = this.getResturl(url,method,{},self);
|
|
150
|
+
if (this.type) {
|
|
151
|
+
param.billmoduleid = param.billmoduleid+'_' +this.type;
|
|
152
|
+
}
|
|
153
|
+
if (this.myConfig.typeData.length > 1) {
|
|
154
|
+
this.type = this.myConfig.typeData[0].code;
|
|
155
|
+
}
|
|
156
|
+
this.url = this.url+'¶m=' +encodeURI(JSON.stringify(param));
|
|
157
|
+
},
|
|
158
|
+
setDownUrl(url,param) {
|
|
159
|
+
if (url) {
|
|
160
|
+
url = url.replace('rest', 'exportTemplate');
|
|
161
|
+
}
|
|
162
|
+
let self = this;
|
|
163
|
+
this.url = this.getResturl(url,null,{},self);
|
|
164
|
+
if (this.myConfig.typeData.length > 1) {
|
|
165
|
+
this.param = param;
|
|
166
|
+
this.type = this.myConfig.typeData[0].code;
|
|
167
|
+
this.showUpload = true;
|
|
168
|
+
} else {
|
|
169
|
+
let temp = this.url +'¶m=' +encodeURI(JSON.stringify(param));
|
|
170
|
+
window.open(temp,'_self');
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
handleUpload (file) {
|
|
174
|
+
if (!this.checkFormat(file)) {
|
|
175
|
+
this.handleFormatError(file);
|
|
176
|
+
this.file = null;
|
|
177
|
+
this.name = '';
|
|
178
|
+
return false;
|
|
179
|
+
} else {
|
|
180
|
+
this.file = file;
|
|
181
|
+
this.name = file.name;
|
|
182
|
+
}
|
|
183
|
+
return false;
|
|
184
|
+
},
|
|
185
|
+
checkFormat(file) {
|
|
186
|
+
const _file_format = file.name.split('.').pop().toLocaleLowerCase();
|
|
187
|
+
const checked = this.myConfig.fileType.some(item => item.toLocaleLowerCase() === _file_format);
|
|
188
|
+
return checked;
|
|
189
|
+
},
|
|
190
|
+
upload () {
|
|
191
|
+
if (!this.name) {
|
|
192
|
+
this.file = null;
|
|
193
|
+
}
|
|
194
|
+
if (this.file !== null) {
|
|
195
|
+
this.loading = true;
|
|
196
|
+
this.$refs.upload.post(this.file);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
handleFormatError (file) {
|
|
200
|
+
let type = this.myConfig.fileType.join(',');
|
|
201
|
+
this.alert('文件[' + file.name + ']的格式不正确,请上传格式为(' + type + ')的文件');
|
|
202
|
+
},
|
|
203
|
+
handleSuccess(res) {
|
|
204
|
+
if (res && res.returncode !== '0') {
|
|
205
|
+
this.showUpload = false;
|
|
206
|
+
this.file = null;
|
|
207
|
+
this.name = '';
|
|
208
|
+
this.alert(res.data);
|
|
209
|
+
} else {
|
|
210
|
+
this.alert(res.elapsed,'导入成功');
|
|
211
|
+
this.showUpload = false;
|
|
212
|
+
this.file = null;
|
|
213
|
+
this.name = '';
|
|
214
|
+
this.$emit('importSuccess',res);
|
|
215
|
+
}
|
|
216
|
+
this.loading = false;
|
|
217
|
+
|
|
218
|
+
},
|
|
219
|
+
downTemplate() {
|
|
220
|
+
if (this.type) {
|
|
221
|
+
let param = this.$Method.copy(this.param);
|
|
222
|
+
if (param.billmoduleid) {
|
|
223
|
+
param.billmoduleid = param.billmoduleid + '_' + this.type;
|
|
224
|
+
let temp = this.url +'¶m=' +encodeURI(JSON.stringify(param));
|
|
225
|
+
window.open(temp,'_self');
|
|
226
|
+
this.showUpload = false;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
</script>
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Upload
|
|
3
|
+
ref="upload"
|
|
4
|
+
:show-upload-list="false"
|
|
5
|
+
:default-file-list="defaultList"
|
|
6
|
+
:on-success="handleSuccess"
|
|
7
|
+
:format="myConfig.fileType"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
:max-size="fileSize"
|
|
10
|
+
:data="headers"
|
|
11
|
+
:on-format-error="handleFormatError"
|
|
12
|
+
:on-exceeded-size="handleMaxSize"
|
|
13
|
+
:before-upload="handleBeforeUpload"
|
|
14
|
+
multiple
|
|
15
|
+
type="drag"
|
|
16
|
+
:class="uploadClass"
|
|
17
|
+
:action="uploadUrl"
|
|
18
|
+
>
|
|
19
|
+
<slot name="btn"></slot>
|
|
20
|
+
</Upload>
|
|
21
|
+
</template>
|
|
22
|
+
<script>
|
|
23
|
+
export default {
|
|
24
|
+
name: 'uploadbox',
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
defaultList: [],
|
|
28
|
+
fileSize: 2048,
|
|
29
|
+
myConfig: {},
|
|
30
|
+
uploadUrl: '',
|
|
31
|
+
disabled: false,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
props: {
|
|
35
|
+
config: {
|
|
36
|
+
type: Object,
|
|
37
|
+
default: null,
|
|
38
|
+
},
|
|
39
|
+
headers: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: null,
|
|
42
|
+
},
|
|
43
|
+
readOnly:{
|
|
44
|
+
type:Boolean,
|
|
45
|
+
default:false
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
uploadClass () {
|
|
50
|
+
if (this.disabled) {
|
|
51
|
+
return 'efuture-upload-disabled';
|
|
52
|
+
} else {
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
created() {
|
|
58
|
+
this.myConfig = Object.assign({}, this.myConfig, this.config);
|
|
59
|
+
if (this.myConfig.fileSize !== undefined) {
|
|
60
|
+
this.fileSize = 1024 * Number(this.myConfig.fileSize);
|
|
61
|
+
}
|
|
62
|
+
this.uploadUrl = this.myConfig.uploadfile;
|
|
63
|
+
},
|
|
64
|
+
methods: {
|
|
65
|
+
handleSuccess(res, file) {
|
|
66
|
+
if (res.data && res.data.length > 0) {
|
|
67
|
+
if (res.data[0].filekey) {
|
|
68
|
+
file.filekey = res.data[0].filekey;
|
|
69
|
+
} else {
|
|
70
|
+
if (res.data[0].fileKey) {
|
|
71
|
+
file.filekey = res.data[0].fileKey;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.$emit('success', res);
|
|
77
|
+
},
|
|
78
|
+
handleFormatError(file) {
|
|
79
|
+
let type = this.myConfig.fileType.join(',');
|
|
80
|
+
this.alert('文件[' + file.name + ']的格式不正确,请上传格式为(' + type + ')的文件');
|
|
81
|
+
},
|
|
82
|
+
handleMaxSize(file) {
|
|
83
|
+
this.alert(
|
|
84
|
+
'文件[' +
|
|
85
|
+
file.name +
|
|
86
|
+
']的文件大小不允许超过' +
|
|
87
|
+
this.myConfig.fileSize +
|
|
88
|
+
'M'
|
|
89
|
+
);
|
|
90
|
+
},
|
|
91
|
+
handleBeforeUpload() {
|
|
92
|
+
if (!this.myConfig.multiSelect) {
|
|
93
|
+
const check = this.$refs.upload.fileList.length < this.myConfig.fileNum;
|
|
94
|
+
if (!check) {
|
|
95
|
+
this.alert('上传的文件数量过多,请先删除部分已上传文件再上传');
|
|
96
|
+
}
|
|
97
|
+
return check;
|
|
98
|
+
} else {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
delFile(filekey) {
|
|
103
|
+
const index = this.$refs.upload.fileList.findIndex(el => el.filekey === filekey);
|
|
104
|
+
if (index > -1) {
|
|
105
|
+
this.$refs.upload.fileList.splice(index, 1);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
onClick() {
|
|
109
|
+
let flag = true;
|
|
110
|
+
if (this.$parent.$parent.$parent.checkPara) {
|
|
111
|
+
flag = this.$parent.$parent.$parent.checkPara();
|
|
112
|
+
}
|
|
113
|
+
if (flag) {
|
|
114
|
+
if (this.config.onOpenChange) {
|
|
115
|
+
this.config.onOpenChange(true);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (flag) {
|
|
120
|
+
if (this.$refs.upload.$refs && this.$refs.upload.$refs.input) {
|
|
121
|
+
this.$refs.upload.$refs.input.click();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return flag;
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
watch: {
|
|
128
|
+
config: {
|
|
129
|
+
handler(data) {
|
|
130
|
+
if (this.readOnly || data.readOnly) {
|
|
131
|
+
this.disabled = true;
|
|
132
|
+
} else {
|
|
133
|
+
this.disabled = false;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
deep: true,
|
|
137
|
+
immediate: true,
|
|
138
|
+
},
|
|
139
|
+
readOnly(value) {
|
|
140
|
+
if (value || this.config.readOnly) {
|
|
141
|
+
this.disabled = true;
|
|
142
|
+
} else {
|
|
143
|
+
this.disabled = false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
</script>
|