ocpview-pro 0.1.30 → 0.1.31

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-pro",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "title": "ocpviewPlus",
5
5
  "description": "A high quality Service UI components Library with Vue.js",
6
6
  "homepage": "",
@@ -10,17 +10,15 @@
10
10
  </div>
11
11
  <Card :padding="0" :bordered="false" style="padding-top:0px;padding-left:16px;padding-right:16px;padding-bottom:14px;" dis-hover>
12
12
  <div :id="headid" :style="style2" @scroll="handleScroll">
13
- <div v-for="(item,index) in myConfig.formsConfig.items" :id="item.divId" :key="item.divId" v-show="headVisible[index].visible">
14
- <Formcard :ref="item.name" :config="item" :dictData="dictData" @doAction="doAction" >
13
+ <div v-for="temp in renderItems" :key="temp.el.divId" :id="temp.el.divId" v-show="temp.isHead ? headVisible[temp.index].visible : detailVisible[temp.index].visible" >
14
+ <Formcard v-if="temp.isHead" :ref="temp.el.name" :config="temp.el" :dictData="dictData" @doAction="doAction" >
15
15
  </Formcard>
16
- </div>
17
- <div v-for="(temp2,index) in detailConfig.items" :key="temp2.divId" :id="temp2.divId" v-show="detailVisible[index].visible" >
18
- <EditGridCardS v-if="temp2.type === 'EditGridCard'" :ref="temp2.name" :config="temp2" :dictData="dictData" @doAction="doAction"/>
19
- <DetailsBoxs v-if="temp2.type === 'DetailsBox'" :ref="temp2.name" :config="temp2" :dictData="dictData" @doAction="doAction"/>
20
- <FormCardBox v-if="temp2.type === 'FormCardBox'" :ref="temp2.name" :config="temp2" :dictData="dictData"/>
21
- <AppendixBoxs v-if="temp2.type === 'AppendixBox'" :ref="temp2.name" :config="temp2" :modulecode="modulecode" @doAction="doAction"/>
22
- <FormCardBox2 v-if="temp2.type === 'FormCardBox2'" :ref="temp2.name" :config="temp2" :dictData="dictData"/>
23
- <AppendixBoxs2 v-if="temp2.type === 'AppendixBox2'" :ref="temp2.name" :config="temp2" :dictData="dictData" :modulecode="modulecode" @handleSuccessAfter="handleSuccessAfter" @doAction="doAction"/>
16
+ <EditGridCardS v-if="!temp.isHead && temp.el.type === 'EditGridCard'" :ref="temp.el.name" :config="temp.el" :dictData="dictData" @doAction="doAction"/>
17
+ <DetailsBoxs v-if="!temp.isHead && temp.el.type === 'DetailsBox'" :ref="temp.el.name" :config="temp.el" :dictData="dictData" @doAction="doAction"/>
18
+ <FormCardBox v-if="!temp.isHead && temp.el.type === 'FormCardBox'" :ref="temp.el.name" :config="temp.el" :dictData="dictData"/>
19
+ <AppendixBoxs v-if="!temp.isHead && temp.el.type === 'AppendixBox'" :ref="temp.el.name" :config="temp.el" :modulecode="modulecode" @doAction="doAction"/>
20
+ <FormCardBox2 v-if="!temp.isHead && temp.el.type === 'FormCardBox2'" :ref="temp.el.name" :config="temp.el" :dictData="dictData"/>
21
+ <AppendixBoxs2 v-if="!temp.isHead && temp.el.type === 'AppendixBox2'" :ref="temp.el.name" :config="temp.el" :dictData="dictData" :modulecode="modulecode" @handleSuccessAfter="handleSuccessAfter" @doAction="doAction"/>
24
22
  </div>
25
23
  </div>
26
24
  </Card>
@@ -123,7 +121,7 @@ export default {
123
121
  el.modetype = modetype;
124
122
  el.divId = 'headForm_' + this.getRandom() + '_' + index;
125
123
  this.headVisible.push({refname:el.name,visible:true});
126
- this.anchorData.push({id:'#'+el.divId ,name:el.title ? this.$t(el.title) : el.title,visible:true,refname:el.name,isHead:true});
124
+ this.anchorData.push({id:'#'+el.divId ,name:el.title ? this.$t(el.title) : el.title,visible:true,refname:el.name,isHead:true,sort:el.sort === undefined ? 0 : el.sort});
127
125
  });
128
126
  }
129
127
 
@@ -164,7 +162,7 @@ export default {
164
162
  }
165
163
  el.divId = 'detail_'+ this.getRandom() + '_'+ index;
166
164
  this.detailVisible.push({refname:el.name,visible:true});
167
- this.anchorData.push({id:'#'+ el.divId, name:el.title ? this.$t(el.title) : el.title,refname:el.name,visible:true,isHead:false});
165
+ this.anchorData.push({id:'#'+ el.divId, name:el.title ? this.$t(el.title) : el.title,refname:el.name,visible:true,isHead:false,sort:el.sort === undefined ? Number.MAX_SAFE_INTEGER : el.sort});
168
166
  });
169
167
  }
170
168
  }
@@ -185,7 +183,7 @@ export default {
185
183
  tmp.divId = 'detail_'+ this.getRandom() + '_'+ this.detailConfig.items.length;
186
184
  this.detailConfig.items.push(tmp);
187
185
  this.detailVisible.push({refname:tmp.name,visible:true});
188
- this.anchorData.push({id:'#'+ tmp.divId, name:tmp.title ? this.$t(tmp.title) : tmp.title,refname:tmp.name,visible:true});
186
+ this.anchorData.push({id:'#'+ tmp.divId, name:tmp.title ? this.$t(tmp.title) : tmp.title,refname:tmp.name,visible:true,sort:Number.MAX_SAFE_INTEGER});
189
187
  } else if (this.billAppendixConfig.showAppendix2) {
190
188
  let tmp = Object.assign({}, {}, this.billAppendixConfig);
191
189
  tmp.type = 'AppendixBox2';
@@ -195,14 +193,34 @@ export default {
195
193
  tmp.divId = 'detail_'+ this.getRandom() + '_'+ this.detailConfig.items.length;
196
194
  this.detailConfig.items.push(tmp);
197
195
  this.detailVisible.push({refname:tmp.name,visible:true});
198
- this.anchorData.push({id:'#'+ tmp.divId, name:tmp.title ? this.$t(tmp.title) : tmp.title,refname:tmp.name,visible:true});
196
+ this.anchorData.push({id:'#'+ tmp.divId, name:tmp.title ? this.$t(tmp.title) : tmp.title,refname:tmp.name,visible:true,sort:Number.MAX_SAFE_INTEGER});
199
197
  }
200
198
 
201
199
  if (this.myConfig.showAnchorLink !== undefined) {
202
200
  this.showAnchorLink = this.myConfig.showAnchorLink;
203
201
  }
202
+
203
+ // 锚点导航顺序与混排后的渲染顺序保持一致
204
+ this.anchorData.sort((a, b) => a.sort - b.sort);
204
205
  },
205
206
  computed:{
207
+ renderItems () {
208
+ // formsConfig.items 与 detailConfig.items 按 sort 升序混排;
209
+ // 未配置 sort 时 formsConfig 项视为 0、detailConfig 项视为最大值,保持 forms 在前 details 在后的现状
210
+ let heads = [];
211
+ let details = [];
212
+ if (this.myConfig.formsConfig && this.myConfig.formsConfig.items) {
213
+ heads = this.myConfig.formsConfig.items.map((el, index) => {
214
+ return { el: el, index: index, isHead: true, sort: el.sort === undefined ? 0 : el.sort };
215
+ });
216
+ }
217
+ if (this.detailConfig.items) {
218
+ details = this.detailConfig.items.map((el, index) => {
219
+ return { el: el, index: index, isHead: false, sort: el.sort === undefined ? Number.MAX_SAFE_INTEGER : el.sort };
220
+ });
221
+ }
222
+ return heads.concat(details).sort((a, b) => a.sort - b.sort);
223
+ },
206
224
  style2 () {
207
225
  let height = this.$Store.state.app.clientHeight;
208
226
  if (this.extraHeight) {