ocpview-plus 1.3.2 → 1.3.3

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.3.2",
3
+ "version": "1.3.3",
4
4
  "title": "ocpviewPlus",
5
5
  "description": "A high quality Service UI components Library with Vue.js",
6
6
  "homepage": "",
@@ -9,12 +9,6 @@
9
9
  </p>
10
10
  <div style="padding-left:24px">
11
11
  <Divider v-if="showTitle" style="margin-top:0px;margin-bottom:10px;"/>
12
- <!-- <Row v-show="showGrid" type="flex" justify="start" align="middle" :gutter="0" style="margin-bottom:10px;">-->
13
- <!-- <Button v-if="loadFlag" customIcon="iconfont icon-custom-fileupload" :disabled="btnReadOnly"-->
14
- <!-- @click="editGrid">上传-->
15
- <!-- </Button>-->
16
- <!-- <Button v-else :loading="true">{{ loadingtext }}</Button>-->
17
- <!-- </Row>-->
18
12
  <Upload v-show="false" id="billiviewUp"
19
13
  multiple
20
14
  ref="billupload"
@@ -63,6 +57,8 @@ export default {
63
57
  myConfig: {
64
58
  headStyle: '',
65
59
  readOnly: false,
60
+ showAddBtn:true,
61
+ showDelBatchBtn:true,
66
62
  downfile: '',
67
63
  delfile: '',
68
64
  pdffile: '/mss-sysconf-boot/downloadPdf?filekey=',
@@ -90,12 +86,14 @@ export default {
90
86
  name: 'filememo',
91
87
  type: 'ComboBox',
92
88
  dictkey: 'CUSTFILETYPE',
93
- visible: false,
89
+ codeWithName: false,
90
+ width: 300,
94
91
  }, {
95
92
  label: '附件类型',
96
93
  name: 'filemode',
97
94
  type: 'TextBox',
98
95
  width: 300,
96
+ visible: false,
99
97
  }, {
100
98
  label: '文件名称',
101
99
  name: 'filename',
@@ -182,8 +180,11 @@ export default {
182
180
  if (!this.myConfig.pdffile) {
183
181
  this.myConfig.pdffile = this.OmdUrl.pdffile;
184
182
  }
185
- this.myConfig.showAddBtn = false;
186
- this.myConfig.showDelBatchBtn = false;
183
+ if (this.myConfig.showTitle !== undefined) {
184
+ this.showTitle = this.myConfig.showTitle;
185
+ }
186
+ // this.myConfig.showAddBtn = true;
187
+ // this.myConfig.showDelBatchBtn = true;
187
188
  this.myConfig.generalOrientation = true;
188
189
  if (this.myConfig.fileSize !== undefined) {
189
190
  this.fileSize = Number(this.myConfig.fileSize) * 1024;
@@ -450,7 +451,7 @@ export default {
450
451
  let obj = {};
451
452
  obj.readOnly = value;
452
453
  this.setPro(obj);
453
- this.$refs.grid.setReadOnly(true);
454
+ this.$refs.grid.setReadOnly(value);
454
455
  this.setBtnReadOnly(value);
455
456
  },
456
457
  showTxt (params) {
@@ -633,8 +634,7 @@ export default {
633
634
  } else {
634
635
  this.btnReadOnly = value;
635
636
  }
636
- }
637
-
637
+ },
638
638
  }
639
639
  };
640
640
  </script>
@@ -0,0 +1,386 @@
1
+ <template>
2
+ <Card :bordered="false" :padding="0" dis-hover>
3
+ <p @click="toggle" style="cursor:pointer;" >
4
+ <Row type="flex" :gutter="0" justify="start" align="middle" style="margin-bottom:14px;margin-top:14px;">
5
+ <Col span="18">
6
+ <Icon custom='iconfont icon-custom-pack' color="#f3b352" v-show="showForm" size="14" /><Icon v-show="!showForm" color="#f3b352" custom='iconfont icon-custom-spread' size="14"/>
7
+ <span style="margin-left:10px;font-size: 14px;font-weight:bold" v-text="myConfig.title" />
8
+ </Col>
9
+ <Col v-show="showForm" span="6">
10
+ <Row type="flex" justify="end" :gutter="0" align="middle">
11
+ <Dropdown placement="bottom-start" style="float:right">
12
+ <Button style="height:21px" type="info">
13
+ 更多操作
14
+ <Icon type="ios-arrow-down"></Icon>
15
+ </Button>
16
+ <template #list>
17
+ <DropdownMenu>
18
+ <DropdownItem>
19
+ <Button @click.stop="openForm" >全部展开</Button>
20
+ </DropdownItem>
21
+ <DropdownItem >
22
+ <Button @click.stop="closeForm">全部收起</Button>
23
+ </DropdownItem>
24
+ </DropdownMenu>
25
+ </template>
26
+ </Dropdown>
27
+ </Row>
28
+ </Col>
29
+ </Row>
30
+ </p>
31
+ <Divider style="margin-left:24px;margin-bottom:10px;margin-top: 0px;"/>
32
+ <div style="margin-left:24px;" v-show="showForm" >
33
+ <Row style="margin-bottom:10px;">
34
+ <Button style="padding-left:0px;padding-right:0px" customIcon="iconfont icon-custom-rowadd3" type="text" :disabled="btnReadOnly" @click="add" >添加</Button>
35
+ </Row>
36
+ <FormDetail v-if="showAdd" ref="addform" :config="myConfig" :isAdd="true" @doAction="newDoAction" :dictData="dictData"/>
37
+ <FormDetail v-for="(temp,index) in data" :ref="temp.curlIndex" :key="temp.curlIndex" :valueData="temp" :curlIndex="temp.curlIndex" :index="index" :config="myConfig" @doAction="doAction" :dictData="dictData"/>
38
+ </div>
39
+ </Card>
40
+ </template>
41
+
42
+ <script>
43
+ import FormDetail from './formdetailtwo.vue';
44
+ import random from '../../utils/random_str';
45
+ export default {
46
+ name:'mddetail',
47
+ components:{
48
+ FormDetail
49
+ },
50
+ data () {
51
+ return {
52
+ readOnly:false,
53
+ showAdd:false,
54
+ isGrid:false,
55
+ myConfig:{
56
+ title:'',
57
+ titleType:1,
58
+ addBtnType:'1',
59
+ hide:true,
60
+ addBtnName:'新增',
61
+ editBtnName:'编辑'
62
+ },
63
+ showForm:true,
64
+ editFlag:false,
65
+ showBtn:true,
66
+ iconStyle:'',
67
+ pStyle:'',
68
+ data:[],
69
+ delData:[],
70
+ btnReadOnly:false
71
+ };
72
+ },
73
+ props:{
74
+ config:{
75
+ type:Object,
76
+ default:null
77
+ },
78
+ dictData: {
79
+ type: Object,
80
+ default:null
81
+ }
82
+ },
83
+ created () {
84
+ this.init();
85
+ },
86
+ computed: {
87
+ },
88
+ methods:{
89
+ init (){
90
+ this.myConfig = Object.assign({},this.myConfig,this.config);
91
+ if (this.myConfig.effectKey) {
92
+ if (this.myConfig.gridConfig) {
93
+ if (this.myConfig.gridConfig.effectKey === undefined) {
94
+ this.myConfig.gridConfig.effectKey = this.myConfig.effectKey;
95
+ }
96
+ }
97
+ }
98
+ delete this.myConfig.formConfig.name;
99
+ delete this.myConfig.formConfig.title;
100
+ delete this.myConfig.gridConfig.name;
101
+ delete this.myConfig.gridConfig.title;
102
+ },
103
+ setShowGrid (value) {
104
+ this.showForm = value;
105
+ },
106
+ toggle () {
107
+ this.showForm = !this.showForm;
108
+ },
109
+ getRowObject(index) {
110
+ if (index < this.date.length) {
111
+ if (this.$refs[this.date[index].curlIndex] && this.$refs[this.date[index].curlIndex][0]) {
112
+ return this.$refs[this.date[index].curlIndex][0];
113
+ }
114
+ }
115
+ return null;
116
+ },
117
+ getRandom() {
118
+ return random(8);
119
+ },
120
+ add (obj) {
121
+ let row = null;
122
+ if (this.myConfig.addRowBefore) {
123
+ row = this.myConfig.addRowBefore();
124
+ if (row === false) {
125
+ return;
126
+ }
127
+ }
128
+ if (!row || row === true) {
129
+ row = {};
130
+ }
131
+ if (obj) {
132
+ row = Object.assign({},row, obj);
133
+ }
134
+ if (!this.showForm) {
135
+ this.showForm = true;
136
+ }
137
+ this.showAdd = false;
138
+ let self = this;
139
+ this.$nextTick(() => {
140
+ this.showAdd = true;
141
+ this.$nextTick(() => {
142
+ setTimeout(() => {
143
+ row.flag = 'I';
144
+ self.$refs.addform.clearData();
145
+ self.$refs.addform.setData(row);
146
+ self.$refs.addform.setFormReadOnly(false);
147
+ }, 200);
148
+ });
149
+ });
150
+ },
151
+ newDoAction (obj) {
152
+ if (this['new' + obj.name]) {
153
+ this['new' + obj.name](obj);
154
+ }
155
+ },
156
+ newsaveForm (obj) {
157
+ let flag = true;
158
+ let temp = obj.para.data;
159
+ temp.curlIndex = 'formdetail_' + this.getRandom();
160
+ temp.flag = 'I';
161
+ if (this.myConfig.newSaveFormBefore) {
162
+ flag = this.myConfig.newSaveFormBefore(temp);
163
+ }
164
+ if (flag) {
165
+ this.data.push(temp);
166
+ this.showAdd = false;
167
+ }
168
+
169
+ },
170
+ isChange () {
171
+ let flag = false;
172
+ if (this.data && this.data.length > 0) {
173
+ this.data.forEach(el => {
174
+ if (!flag) {
175
+ if (this.$refs[el.curlIndex] && this.$refs[el.curlIndex][0]) {
176
+ flag = this.$refs[el.curlIndex][0].isChange();
177
+ }
178
+ }
179
+ });
180
+ }
181
+ return flag;
182
+ },
183
+ isEdit() {
184
+ return this.showAdd;
185
+ },
186
+ newcancelForm () {
187
+ this.showAdd = false;
188
+ },
189
+ doAction (obj) {
190
+ if (this[obj.name]) {
191
+ this[obj.name](obj);
192
+ }
193
+ },
194
+ getData (flag) {
195
+ let data = [];
196
+ this.data.forEach(el => {
197
+ let obj = this.$Method.copy(el);
198
+ if (!flag) {
199
+ delete obj.curlIndex;
200
+ }
201
+ data.push(obj);
202
+ });
203
+ return data;
204
+ },
205
+ setData (data) {
206
+ this.data = [];
207
+ this.delData = [];
208
+ data.forEach(el => {
209
+ el.curlIndex = 'formdetail_' + this.getRandom();
210
+ });
211
+ this.$nextTick(() => {
212
+ this.data =this.$Method.copy(data);
213
+ });
214
+ },
215
+ setEffectData(data) {
216
+ this.data.forEach(el => {
217
+ if (this.$refs[el.curlIndex] && this.$refs[el.curlIndex][0]) {
218
+ let tmp = [];
219
+ if (this.myConfig.effectKey) {
220
+ let tmpIdex = data.findIndex(el2 => el[this.myConfig.effectKey] === el2[this.myConfig.effectKey]);
221
+ if (tmpIdex > -1) {
222
+ tmp = this.$Method.copy(data[tmpIdex]);
223
+ }
224
+ this.$refs[el.curlIndex][0].setEffectData(tmp);
225
+ }
226
+ }
227
+ });
228
+ },
229
+
230
+ saveForm (obj) {
231
+ let index = this.data.findIndex(el => el.curlIndex === obj.para.curlIndex);
232
+ if (index > -1) {
233
+ if (this.data[index].flag === undefined) {
234
+ obj.para.data.flag = 'U';
235
+ }
236
+ this.data.splice(index, 1, obj.para.data);
237
+ }
238
+ },
239
+ delForm (obj) {
240
+ this.delCommonForm(obj);
241
+ },
242
+ delCommonForm(obj) {
243
+ let index = this.data.findIndex(el => el.curlIndex === obj.para.curlIndex);
244
+ let that = this;
245
+ if (index > -1) {
246
+ let form = this.$Method.copy(this.data[index]);
247
+ if (this.$refs[obj.para.curlIndex] && this.$refs[obj.para.curlIndex][0]) {
248
+ form = this.$refs[obj.para.curlIndex][0].getData();
249
+ }
250
+ if (this.myConfig.delRowBefore) {
251
+ let obj = {};
252
+ obj.index = index;
253
+ obj.gridObject = that;
254
+ obj.form = Object.assign({}, form);
255
+ let flag = this.myConfig.delRowBefore(obj);
256
+ if (flag === false) {
257
+ return;
258
+ }
259
+ }
260
+ if (form.flag === undefined || form.flag === 'U') {
261
+ form.flag = 'D';
262
+ delete form.index;
263
+ delete form.curlIndex;
264
+ this.delData.push(form);
265
+ }
266
+ this.data.splice(index, 1);
267
+ }
268
+ },
269
+ editForm(obj) {
270
+ this.showAdd = false;
271
+ if (this.$refs.addform) {
272
+ this.$refs.addform.clearData(obj);
273
+ }
274
+ },
275
+ setReadOnly(value) {
276
+ this.readOnly = value;
277
+ this.$nextTick(() => {
278
+ this.data.forEach(el => {
279
+ if (this.$refs[el.curlIndex] && this.$refs[el.curlIndex][0]) {
280
+ this.$refs[el.curlIndex][0].setReadOnly(value);
281
+ }
282
+ });
283
+ });
284
+ if (this.readOnly) {
285
+ this.showAdd = false;
286
+ }
287
+ this.setBtnReadOnly(value);
288
+ },
289
+ clearData () {
290
+ this.data = [];
291
+ this.delData = [];
292
+ this.showAdd = false;
293
+ if (this.$refs.addform) {
294
+ this.$refs.addform.clearData();
295
+ }
296
+ },
297
+ getChangeData() {
298
+ return this.getCommonChangeData(this.data);
299
+ },
300
+ getCommonChangeData(data) {
301
+ let changeData = [];
302
+ if (data.length > 0) {
303
+ data.forEach(el => {
304
+ if (this.$refs[el.curlIndex] && this.$refs[el.curlIndex][0]) {
305
+ if (this.$refs[el.curlIndex][0].isChange()) {
306
+ changeData.push(this.$refs[el.curlIndex][0].getChangeData());
307
+ }
308
+ }
309
+ });
310
+ }
311
+ return changeData.concat(this.delData);
312
+ },
313
+ editDetails() {
314
+ if (this.checkIsEdit()) {
315
+ this.editFlag = true;
316
+ this.setReadOnly(false);
317
+ } else {
318
+ this.editFlag = false;
319
+ this.setReadOnly(true);
320
+ }
321
+ },
322
+ checkIsEdit() {
323
+ let flag = true;
324
+ if (this.myConfig.editObjectBefore) {
325
+ flag = this.myConfig.editObjectBefore(this.myConfig.name);
326
+ }
327
+ return flag;
328
+ },
329
+ save () {
330
+ if (this.checkValidate()){
331
+ return;
332
+ }
333
+ let obj = {};
334
+ obj.name = 'saveDetails';
335
+ obj.detailsname = this.myConfig.name;
336
+ this.editFlag = false;
337
+ this.$emit('doAction', obj);
338
+ },
339
+ delRowData (obj) {
340
+ this.delForm(obj);
341
+ },
342
+ checkValidate () {
343
+ let flag = false;
344
+ this.data.some(el => {
345
+ if (this.$refs[el.curlIndex] && this.$refs[el.curlIndex][0]) {
346
+ flag = this.$refs[el.curlIndex][0].checkValidate();
347
+ if (flag) {
348
+ return true;
349
+ }
350
+ }
351
+ });
352
+ if (flag) {
353
+ this.alert('必填项不允许为空');
354
+ }
355
+ return flag;
356
+ },
357
+ cancel() {
358
+ this.editFlag = false;
359
+ this.delData = [];
360
+ },
361
+ setShowBtn(value) {
362
+ this.showBtn = value;
363
+ },
364
+ setBtnReadOnly(value) {
365
+ this.btnReadOnly = value;
366
+ },
367
+ openForm () {
368
+ this.data.forEach(el => {
369
+ if (this.$refs[el.curlIndex] && this.$refs[el.curlIndex][0]) {
370
+ this.$refs[el.curlIndex][0].setShowForm(true);
371
+ }
372
+ });
373
+ },
374
+ closeForm() {
375
+ this.data.forEach(el => {
376
+ if (this.$refs[el.curlIndex] && this.$refs[el.curlIndex][0]) {
377
+ this.$refs[el.curlIndex][0].setShowForm(false);
378
+ }
379
+ });
380
+ this.showAdd = false;
381
+ },
382
+ },
383
+ mounted () {
384
+ }
385
+ };
386
+ </script>
@@ -1,8 +1,22 @@
1
1
  <template>
2
2
  <Card ref="card" :bordered="false" :padding="0" dis-hover>
3
+ <div v-if="$slots.header">
4
+ <slot name="header"></slot>
5
+ </div>
6
+ <Row class-name="row-box" v-else v-show="showGrid" type="flex" justify="start" align="middle" :gutter="0" style="margin-bottom: 10px;">
7
+ <Col v-if="showAddBtn">
8
+ <Button :style="btnStyle" customIcon="iconfont icon-custom-rowadd3" type="text" :disabled="myConfig.readOnly" @click="addRow" >添加</Button>
9
+ </Col>
10
+ <Col v-if="showAddBtn && showDelBatchBtn">
11
+ <Divider type="vertical" style="margin: 0 6px 0 6px;"/>
12
+ </Col>
13
+ <Col v-if="showDelBatchBtn">
14
+ <Button :style="btnStyle" customIcon="iconfont icon-custom-rowdel3" type="text" :disabled="myConfig.readOnly" @click="delBatchRow">删除</Button>
15
+ </Col>
16
+ </Row>
3
17
  <Row style="margin-top: 10px;">
4
18
  <Table ref="table" :row-class-name="rowClassName" :loading="loading" :size="myConfig.tableSize" :stripe="myConfig.showStripe" :border="myConfig.showBorder" :height="tableHeight" :maxHeight="tableMaxHeight" :show-header="myConfig.showHeader" @on-selection-change="OnSelectionChange" :columns="tableColumns" :data="data" @on-column-width-resize="onColumnWidthResize" :show-summary="myConfig.showSummary" :summary-method="handleSummary">
5
- <template v-for="config in soltTableColumns" v-slot:[config.key]="{ index }" :key="'show_' + config.key">
19
+ <template v-for="config in soltTableColumns" v-slot:[config.key]="{ index }" :key="'show_' + config.key">
6
20
  <div @click="EditCell(index,config)" :class="config.cellClassName">
7
21
  <ControlBox v-if="editIndex === index && editKey=== config.key" :autofocus="true" :config="getCellConfig(index,config)" :valueData="getCurRow(index)" @inputValue="input" :editIndex="index" @doAction="doAction"></ControlBox>
8
22
  <ShowText v-else :label="formatValue(index,config)" :contentAlign="config.contentAlign" :class="IsCellError(index,config)" :config="config" :rowIndex="index"></ShowText>
@@ -41,8 +55,9 @@ export default {
41
55
  showAppendixCol:false,
42
56
  appedixLable:'附件'
43
57
  },
44
- showAddBtn:true,
45
- showDelBatchBtn:true,
58
+ btnStyle:'padding-left:0px;padding-right:0px',
59
+ showAddBtn:false,
60
+ showDelBatchBtn:false,
46
61
  showGrid:true,
47
62
  showTitle:true,
48
63
  actionAppendixConfig:{
@@ -55,6 +70,9 @@ export default {
55
70
 
56
71
  };
57
72
  },
73
+ created () {
74
+ this.myConfig = Object.assign({}, this.myConfig, this.config);
75
+ },
58
76
  methods: {
59
77
  customInit2() {
60
78
  if (this.myConfig.showTitle !== undefined) {
@@ -67,13 +85,13 @@ export default {
67
85
  if (!el.width && !el.minWidth) {
68
86
  el.minWidth = 60;
69
87
  }
70
- });
88
+ });
71
89
  if (this.myConfig.showAppendixCol) {
72
90
  this.actionAppendixConfig.label = this.myConfig.appedixLable;
73
91
  this.myConfig.items.push(this.actionAppendixConfig);
74
92
  }
75
93
 
76
-
94
+
77
95
  },
78
96
  toggle () {
79
97
  this.showGrid = !this.showGrid;
@@ -105,8 +105,6 @@ export default {
105
105
  this.myConfig.gridConfig.overrideData = this.gridOverrideData;
106
106
  this.myConfig.gridConfig.showCondition = false;
107
107
  this.myConfig.gridConfig.resources = this.myConfig.resources;
108
- this.myConfig.gridConfig.method = this.myConfig.classPrefix + '.search';
109
- this.myConfig.gridConfig.response = this.myConfig.response;
110
108
  this.myConfig.gridConfig.tableSize ='small';
111
109
  this.myConfig.gridConfig.showBorder = false;
112
110
  this.myConfig.gridConfig.pageShowSizer = false;
@@ -116,6 +114,12 @@ export default {
116
114
  if (this.myConfig.gridConfig.title !== undefined) {
117
115
  this.myConfig.gridtitle = this.myConfig.gridConfig.title;
118
116
  }
117
+ if (!this.myConfig.gridConfig.method) {
118
+ this.myConfig.gridConfig.method = this.myConfig.classPrefix + '.search';
119
+ }
120
+ if (!this.myConfig.gridConfig.response) {
121
+ this.myConfig.gridConfig.response = this.myConfig.response;
122
+ }
119
123
 
120
124
  this.myConfig.gridConfig.multiSelect = false;
121
125
  if (this.myConfig.treeConfig.items) {