@zscreate/zhxy-app-component 1.0.241 → 1.0.243

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.
@@ -1413,6 +1413,7 @@ export default {
1413
1413
  this.dataModel = value
1414
1414
  }
1415
1415
  }
1416
+ this.replaceScriptDefaultValue()
1416
1417
  },
1417
1418
  tableValueSet(val) {
1418
1419
  var cloneArr = this.models[this.tableKey];
@@ -1780,6 +1781,7 @@ export default {
1780
1781
  },
1781
1782
  dataModel: {
1782
1783
  handler(v) {
1784
+ v = this.replaceScriptDefaultValue(v)
1783
1785
  if (this.tableKey) {
1784
1786
  this.tableValueSet(v);
1785
1787
  } else {
@@ -5,17 +5,29 @@ export const valueChangeMixin = {
5
5
  dataModel: {
6
6
  immediate: true,
7
7
  handler() {
8
- let defaultValue = this.widget.options?.defaultValue
9
- if (String(defaultValue).startsWith('script:')) {
10
- defaultValue = defaultValue.replace('script:', '')
11
- const tempValue = {value: ''}
12
- run(`tempValue.value = ${defaultValue}`, {'this': this, tempValue})
13
- this.dataModel = tempValue.value
14
- }
8
+ this.replaceScriptDefaultValue()
15
9
  },
16
- }
10
+ },
11
+ widget: {
12
+ immediate: true,
13
+ handler() {
14
+ this.replaceScriptDefaultValue()
15
+ },
16
+ }
17
17
  },
18
18
  methods: {
19
+ replaceScriptDefaultValue(v) {
20
+ let defaultValue = this.widget.options?.defaultValue
21
+ if (String(defaultValue).startsWith('script:')) {
22
+ defaultValue = defaultValue.replace('script:', '')
23
+ const tempValue = {value: ''}
24
+ run(`tempValue.value = ${defaultValue}`, {'this': this, tempValue})
25
+ this.dataModel = tempValue.value
26
+ return this.dataModel
27
+
28
+ }
29
+ return v
30
+ },
19
31
  /**文件dataModal**/
20
32
  filePost(val) {
21
33
  if (!Array.isArray(this.dataModel)) this.dataModel = []
@@ -561,9 +561,13 @@ export default {
561
561
  let addModelObject = {};
562
562
  dataTemp.columns.forEach(item => {
563
563
  item.options.isCorrect = false;
564
+ let defaultValue = item.options.defaultValue
565
+ if (String(defaultValue).startsWith('script:')) {
566
+ defaultValue = ''
567
+ }
564
568
  addModelObject[item.model] = item.defaultValue ?
565
569
  item.defaultValue :
566
- item.options.defaultValue;
570
+ defaultValue;
567
571
  });
568
572
  if(!this.models[model]) this.models[model] = []
569
573
  this.models[model].push(addModelObject);
@@ -601,7 +605,6 @@ export default {
601
605
  this.models[model] instanceof Array &&
602
606
  this.models[model].length > 0
603
607
  ) {
604
- debugger
605
608
  // console.log('--',this.tableModel[model], model)
606
609
  this.models[model].forEach((item, index) => {
607
610
  this.originIndex++;
@@ -688,8 +691,13 @@ export default {
688
691
  } else {
689
692
  // console.log('TO-JSON==',JSON.stringify(this.models));
690
693
  // console.log(genList[i].model);
691
- let default_value = genList[i].options.defaultValue ? genList[i].options.defaultValue :
694
+ let default_value = genList[i].options.defaultValue
695
+ if (String(default_value).startsWith('script:')) {
696
+ default_value = ''
697
+ }
698
+ default_value = default_value ? default_value :
692
699
  '' // 避免默认值为null
700
+
693
701
  this.$set(this.models, genList[i].model, this.models[genList[i].model] ?
694
702
  this.models[genList[i].model] : default_value
695
703
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zscreate/zhxy-app-component",
3
- "version": "1.0.241",
3
+ "version": "1.0.243",
4
4
  "private": false,
5
5
  "description": "zhxy-app-component",
6
6
  "main": "index.js",
@@ -1,15 +0,0 @@
1
- import {toAwait} from "../../../utils/util";
2
- import Vue from 'vue'
3
- export default {
4
- methods: {
5
- async getOpenId() {
6
- let openId = Vue.prototype._openId
7
- if (openId) return Promise.resolve(openId)
8
-
9
- const [ err , res ] = await toAwait(this.$u.get('/sys/user/getUserPublicOpenId'))
10
- openId = await this.$async_encryption(res.result)
11
- Vue.prototype._openId = openId
12
- return openId
13
- },
14
- }
15
- }