imeik-bizui 1.6.8 → 1.7.0

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.
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <div :class="!attrs.isView ? 'w-full' : 'inline'">
3
- <span v-if="attrs.isView" :title="myValueName">{{ myValueName || '-' }}</span>
3
+ <div v-if="attrs.isView">
4
+ <ImDiffText v-if="showDiff" :show-diff="showDiff" :old-value="myValueName" :no-absolute="true" :new-value="newMyValueName" />
5
+ <span v-else :title="myValueName">{{ myValueName || '-' }}</span>
6
+ </div>
4
7
  <el-cascader
5
8
  v-else
6
9
  :key="keyValue"
@@ -54,6 +57,12 @@ export default {
54
57
  }
55
58
  },
56
59
  computed: {
60
+ showDiff() {
61
+ return this.attrs.showDiff || false
62
+ },
63
+ diffValue() {
64
+ return this.attrs.diffValue || undefined
65
+ },
57
66
  dicValue() {
58
67
  return this.$bizui.userInfo.departmentCode
59
68
  },
@@ -85,6 +94,20 @@ export default {
85
94
  return this.myValue ? this.getAllLabel(this.options, this.myValue) : ''
86
95
  }
87
96
  },
97
+ newMyValueName() {
98
+ if (this.attrs.multiple) {
99
+ return this.diffValue && this.diffValue.length
100
+ ? this.diffValue
101
+ .map((item) => {
102
+ return this.getLabel(this.options, item)
103
+ })
104
+ .join(',')
105
+ : ''
106
+ } else {
107
+ // 如果是单选 就获取全部路径的值
108
+ return this.diffValue ? this.getAllLabel(this.options, this.diffValue) : ''
109
+ }
110
+ },
88
111
  myValueOrgCode() {
89
112
  if (this.attrs.multiple) {
90
113
  return this.myValue && this.myValue.length
@@ -150,7 +150,7 @@ export default {
150
150
  /**
151
151
  * 格式化后的值
152
152
  */
153
- formatedValue() {
153
+ newFormatedValue() {
154
154
  if (Array.isArray(this.diffValue)) {
155
155
  return this.diffValue.map((item) => moment(item).format(this.momentFormat)).join('~')
156
156
  } else {
@@ -161,7 +161,7 @@ export default {
161
161
  }
162
162
  }
163
163
  },
164
- newFormatedValue() {
164
+ formatedValue() {
165
165
  if (Array.isArray(this.myValue)) {
166
166
  return this.myValue.map((item) => moment(item).format(this.momentFormat)).join('~')
167
167
  } else {
@@ -225,10 +225,7 @@ export default {
225
225
  timeFormat(val) {
226
226
  if (this.isRange) {
227
227
  if (Array.isArray(val) && val.length === 2) {
228
- return [
229
- moment(val[0]).format(this.momentFormat),
230
- moment(val[1]).format(this.momentFormat)
231
- ]
228
+ return [moment(val[0]).format(this.momentFormat), moment(val[1]).format(this.momentFormat)]
232
229
  } else {
233
230
  return []
234
231
  }