ocpview-plus 1.0.19 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocpview-plus",
3
- "version": "1.0.19",
3
+ "version": "1.1.2",
4
4
  "title": "ocpviewPlus",
5
5
  "description": "A high quality Service UI components Library with Vue.js",
6
6
  "homepage": "",
@@ -587,6 +587,7 @@ export default {
587
587
  return obj;
588
588
  }
589
589
  },
590
+
590
591
  // 导入
591
592
  billImport(action) {
592
593
  const url = this.uiconfig.resources;
@@ -616,6 +617,36 @@ export default {
616
617
  billImport.setUrl(url,classPrefix,para);
617
618
  billImport.setShowUpload(true);
618
619
  },
620
+ // 导出
621
+ billExport(action) {
622
+ let url = this.uiconfig.resources;
623
+ const method = this.uiconfig.classPrefix + '.' + this.getActionMethod(action);
624
+ let param = this.getExportParam();
625
+ let billImport = this.getBillImport();
626
+ const cfg = billImport.config || {};
627
+ const typeData = cfg.typeData || [];
628
+ if (typeData.length <= 1) {
629
+ this.doBillExport(url, method, param, this);
630
+ return;
631
+ }
632
+ billImport.setExportUrl(url, method, param, typeData);
633
+ },
634
+ getExportParam() {
635
+ if (this.customGetExportParam) {
636
+ return this.customGetExportParam();
637
+ }
638
+
639
+ let data = this.getData();
640
+ let obj = {};
641
+ let name = 'billno';
642
+ obj.billno = data[name];
643
+ obj.billmoduleid = this.globalConfig.modulecode;
644
+ if(data['mktcode']) {
645
+ obj.mktcode = data['mktcode'];
646
+ }
647
+ return obj;
648
+ },
649
+
619
650
  getBillImport() {
620
651
  return this.$refs.billImport;
621
652
  },
@@ -1,263 +1,301 @@
1
1
  <template>
2
- <div>
3
- <template v-if="modeltype==='upload'">
4
- <Modal title="上传文件" v-model="showUpload" class-name="vertical-center-modal—bill" :footer-hide="true">
5
- <div class="demo-spin-col-bill">
6
- <RadioGroup v-if="showType" v-model="type" style="margin-bottom:24px">
7
- <Radio v-for="(item,index) in myConfig.typeData" :key="index" :label="item.code">
8
- <span>{{item.name}}</span>
9
- </Radio>
10
- </RadioGroup>
11
- <div style="height:220px;background-color: #F5F7FA;border:1px #DCDFE6 dashed">
12
- <Row type="flex" justify="center" >
13
- <Col style="margin-top:30px;margin-bottom:10px">
14
- <Icon custom="iconfont icon-custom-excel" size="60" />
15
- </Col>
16
- </Row>
17
- <Row type="flex" justify="center">
18
- <Col>
19
- <Input v-model="name" style="width:150px;" :border="false" placeholder="(支持xls、xlsx格式)" clearable disabled/>
20
- </Col>
21
- </Row>
22
- <Row type="flex" justify="center" :gutter="10">
23
- <Col>
24
- <Upload ref="upload"
25
- :before-upload="handleUpload"
26
- accept=".xlsx,.xls"
27
- :format="myConfig.fileType"
28
- :on-format-error="handleFormatError"
29
- :on-success="handleSuccess"
30
- :show-upload-list="false"
31
- :action="url">
32
- <Button style="width:150px;">选择文件</Button>
33
- </Upload>
34
- </Col>
35
- </Row>
36
- </div>
37
- <Spin v-show="loading" fix>
38
- <Icon type="ios-loading" size="18" class="demo-spin-icon-load"></Icon>
39
- <div>导入中</div>
40
- </Spin>
41
- </div>
42
- </Modal>
43
- </template>
44
- <template v-if="modeltype === 'down'">
45
- <Modal v-model="showUpload" title="选择模版" @on-ok="downTemplate" class-name="vertical-center-modal—bill">
46
- <RadioGroup v-model="type">
47
- <Radio v-for="(item,index) in myConfig.typeData" :key="index" :label="item.code">
48
- <span>{{item.name}}</span>
49
- </Radio>
50
- </RadioGroup>
51
- </Modal>
52
- </template>
53
- </div>
2
+ <div>
3
+ <template v-if="modeltype==='upload'">
4
+ <Modal title="上传文件" v-model="showUpload" class-name="vertical-center-modal—bill" :footer-hide="true">
5
+ <div class="demo-spin-col-bill">
6
+ <RadioGroup v-if="showType" v-model="type" style="margin-bottom:24px">
7
+ <Radio v-for="(item,index) in myConfig.typeData" :key="index" :label="item.code">
8
+ <span>{{item.name}}</span>
9
+ </Radio>
10
+ </RadioGroup>
11
+ <div style="height:220px;background-color: #F5F7FA;border:1px #DCDFE6 dashed">
12
+ <Row type="flex" justify="center" >
13
+ <Col style="margin-top:30px;margin-bottom:10px">
14
+ <Icon custom="iconfont icon-custom-excel" size="60" />
15
+ </Col>
16
+ </Row>
17
+ <Row type="flex" justify="center">
18
+ <Col>
19
+ <Input v-model="name" style="width:150px;" :border="false" placeholder="(支持xls、xlsx格式)" clearable disabled/>
20
+ </Col>
21
+ </Row>
22
+ <Row type="flex" justify="center" :gutter="10">
23
+ <Col>
24
+ <Upload ref="upload"
25
+ :before-upload="handleUpload"
26
+ accept=".xlsx,.xls"
27
+ :format="myConfig.fileType"
28
+ :on-format-error="handleFormatError"
29
+ :on-success="handleSuccess"
30
+ :show-upload-list="false"
31
+ :action="url">
32
+ <Button style="width:150px;">选择文件</Button>
33
+ </Upload>
34
+ </Col>
35
+ </Row>
36
+ </div>
37
+ <Spin v-show="loading" fix>
38
+ <Icon type="ios-loading" size="18" class="demo-spin-icon-load"></Icon>
39
+ <div>导入中</div>
40
+ </Spin>
41
+ </div>
42
+ </Modal>
43
+ </template>
44
+ <template v-if="modeltype === 'down'">
45
+ <Modal v-model="showUpload" title="选择模版" @on-ok="downTemplate" class-name="vertical-center-modal—bill">
46
+ <RadioGroup v-model="type">
47
+ <Radio v-for="(item,index) in myConfig.typeData" :key="index" :label="item.code">
48
+ <span>{{item.name}}</span>
49
+ </Radio>
50
+ </RadioGroup>
51
+ </Modal>
52
+ </template>
53
+ <template v-if="modeltype === 'export'">
54
+ <Modal
55
+ v-model="showUpload"
56
+ title="导出选择"
57
+ @on-ok="confirmExport"
58
+ class-name="vertical-center-modal—bill"
59
+ >
60
+ <RadioGroup v-model="type">
61
+ <Radio
62
+ v-for="(item, index) in myConfig.typeData"
63
+ :key="index"
64
+ :label="item.code"
65
+ >
66
+ <span>{{ item.name }}</span>
67
+ </Radio>
68
+ </RadioGroup>
69
+ </Modal>
70
+ </template>
71
+ </div>
54
72
  </template>
55
73
  <script>
56
- export default {
57
- name:'mbillimport',
58
- data () {
59
- return {
60
- myConfig:{
61
- typeData:[],
62
- fileType:['xlsx','xls'],
63
- setImportUrl:null
64
- },
65
- initConfig:{
66
- typeData:[],
67
- fileType:['xlsx','xls'],
68
- setImportUrl:null
69
- },
70
- file: null,
71
- name:'',
72
- type:'',
73
- showType:false,
74
- showUpload:false,
75
- modeltype:'upload',
76
- param:{},
77
- curlUrl:'',
78
- loading:false,
79
- downMethod:'exportTemplate',
80
- importMethod:'import'
81
- };
82
- },
83
- props:{
84
- config: {
85
- type:Object,
86
- default () {
87
- return {};
88
- }
74
+ export default {
75
+ name:'mbillimport',
76
+ data () {
77
+ return {
78
+ myConfig:{
79
+ typeData:[],
80
+ fileType:['xlsx','xls'],
81
+ setImportUrl:null
89
82
  },
90
- } ,
91
- computed:{
92
- filename(){
93
- if (this.name) {
94
- return this.name;
95
- } else {
96
- return '(支持xls、xlsx格式)';
97
- }
83
+ initConfig:{
84
+ typeData:[],
85
+ fileType:['xlsx','xls'],
86
+ setImportUrl:null
98
87
  },
99
- url() {
100
- let url = this.curlUrl;
101
- let para = this.$Method.copy(this.param);
102
- if (this.showType) {
103
- if (this.myConfig.typeData.length > 0) {
104
- if (this.type) {
105
- para.billmoduleid = para.billmoduleid+'_' + this.type;
106
- }
88
+ file: null,
89
+ name:'',
90
+ type:'',
91
+ showType:false,
92
+ showUpload:false,
93
+ modeltype:'upload',
94
+ param:{},
95
+ curlUrl:'',
96
+ loading:false,
97
+ downMethod:'exportTemplate',
98
+ importMethod:'import'
99
+ };
100
+ },
101
+ props:{
102
+ config: {
103
+ type:Object,
104
+ default () {
105
+ return {};
106
+ }
107
+ },
108
+ } ,
109
+ computed:{
110
+ filename(){
111
+ if (this.name) {
112
+ return this.name;
113
+ } else {
114
+ return '(支持xls、xlsx格式)';
115
+ }
116
+ },
117
+ url() {
118
+ let url = this.curlUrl;
119
+ let para = this.$Method.copy(this.param);
120
+ if (this.showType) {
121
+ if (this.myConfig.typeData.length > 0) {
122
+ if (this.type) {
123
+ para.billmoduleid = para.billmoduleid+'_' + this.type;
107
124
  }
108
125
  }
109
- return url+'&param=' +encodeURI(JSON.stringify(para));
110
126
  }
127
+ return url+'&param=' +encodeURI(JSON.stringify(para));
128
+ }
129
+ },
130
+ methods: {
131
+ init () {
132
+ this.myConfig = Object.assign({},this.initConfig, this.config);
133
+ if (this.myConfig.typeData && this.myConfig.typeData.length > 0) {
134
+ this.showType = true;
135
+ this.type = this.myConfig.typeData[0].code;
136
+ }
137
+ if (this.myConfig.importMethod) {
138
+ this.importMethod = this.myConfig.importMethod;
139
+ }
140
+ if (this.myConfig.downMethod) {
141
+ this.downMethod = this.myConfig.downMethod;
142
+ }
143
+ },
144
+ setModeltype(value) {
145
+ this.modeltype = value;
146
+ },
147
+
148
+ setExportUrl(url, method, param, typeData) {
149
+ this.modeltype = "export";
150
+ this.curlUrl = this.getResturl(url, method, {}, this);
151
+ this.param = param;
152
+ this.myConfig.typeData = typeData;
153
+ this.showUpload = true;
111
154
  },
112
- methods: {
113
- init () {
114
- this.myConfig = Object.assign({},this.initConfig, this.config);
115
- if (this.myConfig.typeData && this.myConfig.typeData.length > 0) {
116
- this.showType = true;
155
+
156
+ confirmExport() {
157
+ if (!this.type) {
158
+ this.$Message.error("请选择导出类型");
159
+ return;
160
+ }
161
+ let newParam = Object.assign({}, this.param);
162
+ // 拼接 billmoduleid_xxx
163
+ newParam.billmoduleid = newParam.billmoduleid + "_" + this.type.split("_")[1];
164
+ this.downloadExcel(this.curlUrl, this, newParam);
165
+ },
166
+
167
+ setShowUpload(flag) {
168
+ if (flag) {
169
+ this.init ();
170
+ }
171
+ this.showUpload = flag;
172
+ },
173
+ setUrl(url,method,param) {
174
+ if (url) {
175
+ url = url.replace('rest', this.importMethod);
176
+ }
177
+ let self = this;
178
+ this.curlUrl = this.getResturl(url,method,{},self);
179
+ if (this.myConfig.setImportUrl) {
180
+ this.curlUrl = this.myConfig.setImportUrl(this.curlUrl,'import');
181
+ }
182
+ Object.assign(this.param, param);
183
+
184
+ if (this.myConfig.typeData.length > 1) {
185
+ if (!this.type) {
117
186
  this.type = this.myConfig.typeData[0].code;
118
187
  }
119
- if (this.myConfig.importMethod) {
120
- this.importMethod = this.myConfig.importMethod;
121
- }
122
- if (this.myConfig.downMethod) {
123
- this.downMethod = this.myConfig.downMethod;
124
- }
125
- },
126
- setModeltype(value) {
127
- this.modeltype = value;
128
- },
129
- setShowUpload(flag) {
130
- if (flag) {
131
- this.init ();
132
- }
133
- this.showUpload = flag;
134
- },
135
- setUrl(url,method,param) {
136
- if (url) {
137
- url = url.replace('rest', this.importMethod);
138
- }
139
- let self = this;
140
- this.curlUrl = this.getResturl(url,method,{},self);
188
+ }
189
+ },
190
+ setDownUrl(url,param) {
191
+ if (url) {
192
+ url = url.replace('rest', this.downMethod);
193
+ }
194
+ let self = this;
195
+ this.curlUrl = this.getResturl(url,null,{},self);
196
+ if (this.myConfig.typeData.length > 1) {
197
+ this.param = param;
198
+ this.type = this.myConfig.typeData[0].code;
199
+ this.showUpload = true;
200
+ } else {
201
+ let temp = this.curlUrl +'&param=' +encodeURI(JSON.stringify(param));
141
202
  if (this.myConfig.setImportUrl) {
142
- this.curlUrl = this.myConfig.setImportUrl(this.curlUrl,'import');
143
- }
144
- Object.assign(this.param, param);
145
-
146
- if (this.myConfig.typeData.length > 1) {
147
- if (!this.type) {
148
- this.type = this.myConfig.typeData[0].code;
149
- }
150
- }
151
- },
152
- setDownUrl(url,param) {
153
- if (url) {
154
- url = url.replace('rest', this.downMethod);
155
- }
156
- let self = this;
157
- this.curlUrl = this.getResturl(url,null,{},self);
158
- if (this.myConfig.typeData.length > 1) {
159
- this.param = param;
160
- this.type = this.myConfig.typeData[0].code;
161
- this.showUpload = true;
162
- } else {
163
- let temp = this.curlUrl +'&param=' +encodeURI(JSON.stringify(param));
164
- if (this.myConfig.setImportUrl) {
165
- temp = this.myConfig.setImportUrl(temp,'down');
166
- }
167
- window.open(temp,'_self');
168
- }
169
- },
170
- handleUpload (file) {
171
- if (!this.checkFormat(file)) {
172
- this.handleFormatError(file);
173
- this.file = null;
174
- this.name = '';
175
- return false;
176
- } else {
177
- this.file = file;
178
- this.name = file.name;
179
- this.upload();
203
+ temp = this.myConfig.setImportUrl(temp,'down');
180
204
  }
205
+ window.open(temp,'_self');
206
+ }
207
+ },
208
+ handleUpload (file) {
209
+ if (!this.checkFormat(file)) {
210
+ this.handleFormatError(file);
211
+ this.file = null;
212
+ this.name = '';
181
213
  return false;
182
- },
183
- checkFormat(file) {
184
- const _file_format = file.name.split('.').pop().toLocaleLowerCase();
185
- const checked = this.myConfig.fileType.some(item => item.toLocaleLowerCase() === _file_format);
186
- return checked;
187
- },
188
- upload () {
189
- if (!this.name) {
190
- this.file = null;
191
- }
192
- if (this.file !== null) {
193
- this.loading = true;
194
- this.$refs.upload.post(this.file);
195
- }
196
- },
197
- handleFormatError (file) {
198
- let type = this.myConfig.fileType.join(',');
199
- this.alert('文件[' + file.name + ']的格式不正确,请上传格式为(' + type + ')的文件');
200
- },
201
- handleSuccess(res) {
202
- if (res && Number(res.returncode) !== 0) {
203
- this.showUpload = false;
204
- this.file = null;
205
- this.name = '';
206
- this.alert(res.data);
214
+ } else {
215
+ this.file = file;
216
+ this.name = file.name;
217
+ this.upload();
218
+ }
219
+ return false;
220
+ },
221
+ checkFormat(file) {
222
+ const _file_format = file.name.split('.').pop().toLocaleLowerCase();
223
+ const checked = this.myConfig.fileType.some(item => item.toLocaleLowerCase() === _file_format);
224
+ return checked;
225
+ },
226
+ upload () {
227
+ if (!this.name) {
228
+ this.file = null;
229
+ }
230
+ if (this.file !== null) {
231
+ this.loading = true;
232
+ this.$refs.upload.post(this.file);
233
+ }
234
+ },
235
+ handleFormatError (file) {
236
+ let type = this.myConfig.fileType.join(',');
237
+ this.alert('文件[' + file.name + ']的格式不正确,请上传格式为(' + type + ')的文件');
238
+ },
239
+ handleSuccess(res) {
240
+ if (res && Number(res.returncode) !== 0) {
241
+ this.showUpload = false;
242
+ this.file = null;
243
+ this.name = '';
244
+ this.alert(res.data);
245
+ } else {
246
+ this.showUpload = false;
247
+ this.file = null;
248
+ this.name = '';
249
+ if (this.myConfig.importSuccess) {
250
+ this.myConfig.importSuccess(res);
207
251
  } else {
208
- this.showUpload = false;
209
- this.file = null;
210
- this.name = '';
211
- if (this.myConfig.importSuccess) {
212
- this.myConfig.importSuccess(res);
213
- } else {
214
- if (this.$parent.doImportSuccess) {
215
- this.$parent.doImportSuccess();
216
- }
217
- this.alert(res.elapsed,'导入成功');
252
+ if (this.$parent.doImportSuccess) {
253
+ this.$parent.doImportSuccess();
218
254
  }
255
+ this.alert(res.elapsed,'导入成功');
219
256
  }
220
- this.loading = false;
221
-
222
- },
223
- downTemplate() {
224
- if (this.type) {
225
- let param = this.$Method.copy(this.param);
226
- if (param.billmoduleid) {
227
- param.billmoduleid = param.billmoduleid + '_' + this.type;
228
- let temp = this.url +'&param=' +encodeURI(JSON.stringify(param));
229
- window.open(temp,'_self');
230
- this.showUpload = false;
231
- }
232
-
257
+ }
258
+ this.loading = false;
259
+
260
+ },
261
+ downTemplate() {
262
+ if (this.type) {
263
+ let param = this.$Method.copy(this.param);
264
+ if (param.billmoduleid) {
265
+ param.billmoduleid = param.billmoduleid + '_' + this.type;
266
+ let temp = this.url +'&param=' +encodeURI(JSON.stringify(param));
267
+ window.open(temp,'_self');
268
+ this.showUpload = false;
233
269
  }
270
+
234
271
  }
235
272
  }
236
- };
273
+ }
274
+ };
237
275
  </script>
238
276
  <style lang="less" scoped>
239
- .ivu-modal-wrap.vertical-center-modal—bill .ivu-modal-header{
240
- border-bottom:none;
241
- border-radius:10px;
242
- }
243
- .ivu-modal-wrap.vertical-center-modal—bill .ivu-modal-body{
244
- padding-top: 8px;
245
- padding-right: 28px;
246
- padding-bottom: 32px;
247
- padding-left: 28px;
248
- }
249
- .demo-spin-icon-load{
250
- animation: ani-demo-spin 1s linear infinite;
251
- }
252
- @keyframes ani-demo-spin {
253
- from { transform: rotate(0deg);}
254
- 50% { transform: rotate(180deg);}
255
- to { transform: rotate(360deg);}
256
- }
257
- .demo-spin-col-bill{
258
- position: relative;
259
- }
277
+ .ivu-modal-wrap.vertical-center-modal—bill .ivu-modal-header{
278
+ border-bottom:none;
279
+ border-radius:10px;
280
+ }
281
+ .ivu-modal-wrap.vertical-center-modal—bill .ivu-modal-body{
282
+ padding-top: 8px;
283
+ padding-right: 28px;
284
+ padding-bottom: 32px;
285
+ padding-left: 28px;
286
+ }
287
+ .demo-spin-icon-load{
288
+ animation: ani-demo-spin 1s linear infinite;
289
+ }
290
+ @keyframes ani-demo-spin {
291
+ from { transform: rotate(0deg);}
292
+ 50% { transform: rotate(180deg);}
293
+ to { transform: rotate(360deg);}
294
+ }
295
+ .demo-spin-col-bill{
296
+ position: relative;
297
+ }
260
298
  </style>
261
299
  <style>
262
300
 
263
- </style>
301
+ </style>