bri-components 1.4.90 → 1.4.92

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": "bri-components",
3
- "version": "1.4.90",
3
+ "version": "1.4.92",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -52,7 +52,7 @@
52
52
  >
53
53
  <!-- 上传完 -->
54
54
  <Icon
55
- v-if="percent === 100"
55
+ v-if="Number(percent) === 100"
56
56
  type="ios-checkmark"
57
57
  ></Icon>
58
58
  <!-- 上传中 -->
@@ -150,7 +150,7 @@
150
150
 
151
151
  _multiple: true,
152
152
  _useType: "drag",
153
- _maxSize: 1024 * 1024,
153
+ _maxSize: 1024 * 1024 * 2, // 根据四局要求,限制文件为2G
154
154
  _format: [],
155
155
 
156
156
  ...this.propsObj,
@@ -254,7 +254,6 @@
254
254
  if (!this.multipleMode) {
255
255
  postFiles = postFiles.slice(0, 1);
256
256
  }
257
-
258
257
  postFiles.forEach(fileItem => {
259
258
  if (
260
259
  (!this.format.length || this.format.some(item => item.toLocaleLowerCase() === fileItem.name.split(".").pop().toLocaleLowerCase())) &&
@@ -24,7 +24,8 @@ export default {
24
24
  },
25
25
  data () {
26
26
  return {
27
- percent: 0
27
+ percent: 0,
28
+ uploadSuccess: false
28
29
  };
29
30
  },
30
31
  created () { },
@@ -42,7 +43,7 @@ export default {
42
43
  return this.propsObj._archiveKey || [];
43
44
  },
44
45
  percentColor () {
45
- if (this.percent === 100) {
46
+ if (Number(this.percent) === 100) {
46
47
  return "#5cb85c";
47
48
  } else {
48
49
  return "#6090ed";
@@ -88,9 +89,15 @@ export default {
88
89
  filebody: JSON.stringify(fileBody)
89
90
  },
90
91
  onUploadProgress: progressEvent => {
91
- this.inProgress(Number((progressEvent.loaded / progressEvent.total * 100).toFixed(0)));
92
+ this.inProgress(Number((progressEvent.loaded / progressEvent.total * 100).toFixed(1)));
92
93
  }
93
94
  }).then(response => {
95
+ this.uploadSuccess = true;
96
+ this.percent = 100;
97
+ setTimeout(() => {
98
+ this.percent = 0;
99
+ this.uploadSuccess = false;
100
+ }, 500);
94
101
  this.successCb && this.successCb(response, response.data, file);
95
102
  callback && callback(response.data);
96
103
  }).catch(error => {
@@ -161,7 +168,7 @@ export default {
161
168
 
162
169
  new Oss(newOss).multipartUpload(remoteName, file, {
163
170
  progress: (percentage) => {
164
- this.inProgress(Number((percentage * 100).toFixed(0)));
171
+ this.inProgress(Number((percentage * 100).toFixed(1)));
165
172
  this.handleProgress && this.handleProgress(percentage, file);
166
173
  },
167
174
  headers: {
@@ -169,6 +176,12 @@ export default {
169
176
  "Content-Disposition": type === "pdf" ? `inline;filename=${encodeURI(file.name)}` : `attachment;filename=${encodeURI(file.name)}`
170
177
  }
171
178
  }).then(response => {
179
+ this.uploadSuccess = true;
180
+ this.percent = 100;
181
+ setTimeout(() => {
182
+ this.percent = 0;
183
+ this.uploadSuccess = false;
184
+ }, 500);
172
185
  this.successCb && this.successCb(response, response.data, file);
173
186
  callback && callback(response.data);
174
187
  }).catch((err, response) => {
@@ -303,7 +316,7 @@ export default {
303
316
 
304
317
  new Oss(newOss).multipartUpload(remoteName, file, {
305
318
  progress: (percentage) => {
306
- this.inProgress(Number((percentage * 100).toFixed(0)));
319
+ this.inProgress(Number((percentage * 100).toFixed(1)));
307
320
  this.handleProgress && this.handleProgress(percentage, file);
308
321
  },
309
322
  headers: {
@@ -311,6 +324,12 @@ export default {
311
324
  "Content-Disposition": type === "pdf" ? `inline;filename=${encodeURI(file.name)}` : `attachment;filename=${encodeURI(file.name)}`
312
325
  }
313
326
  }).then(response => {
327
+ this.percent = 100;
328
+ this.uploadSuccess = true;
329
+ setTimeout(() => {
330
+ this.percent = 0;
331
+ this.uploadSuccess = false;
332
+ }, 500);
314
333
  this.successCb && this.successCb(response, response.data, file);
315
334
  callback && callback(response.data);
316
335
  }).catch((err, response) => {
@@ -320,8 +339,12 @@ export default {
320
339
 
321
340
  },
322
341
  inProgress (percent) {
323
- this.percent = percent;
324
- if (percent >= 100) {
342
+ if (percent === 100 && !this.uploadSuccess) {
343
+ this.percent = 99.9;
344
+ } else {
345
+ this.percent = percent;
346
+ }
347
+ if (this.percent >= 100) {
325
348
  this.percent = 100;
326
349
  setTimeout(() => {
327
350
  this.percent = 0;
@@ -109,7 +109,9 @@ export default {
109
109
  this.subType !== "datetime" && this.changeOpen(false, index);
110
110
  },
111
111
  changeOpen (bool, index) {
112
- this[`open${index}`] = bool;
112
+ if (!this.disabled) {
113
+ this[`open${index}`] = bool;
114
+ }
113
115
  },
114
116
 
115
117
  /* -------- 方法 ------- */
@@ -96,7 +96,7 @@ export default {
96
96
  return this.tableDataObj.rowspanMap || {};
97
97
  },
98
98
  allListData () {
99
- this.data.forEach(row => {
99
+ this.data.forEach((row) => {
100
100
  this.fixRowData(row);
101
101
  });
102
102
  this.initFlag = false;
@@ -125,6 +125,14 @@ export default {
125
125
  ? this.showListData
126
126
  : this.curPageShowListData;
127
127
  },
128
+ // 替换tableBaseMixin里的
129
+ changedCols () {
130
+ return this.selfShowListData.reduce((totalCols, row) => {
131
+ return [
132
+ ...new Set([...totalCols, ...(row.__changed__ || []).map(item => item.fieldKey)])
133
+ ];
134
+ }, []);
135
+ },
128
136
  footerData () {
129
137
  return this.isSearching
130
138
  ? []
@@ -682,6 +682,9 @@ export default {
682
682
  // useCampare () {
683
683
  // return !!this.compareListData.length;
684
684
  // },
685
+ changedCols () {
686
+ return [];
687
+ },
685
688
 
686
689
  /* --- 功能按钮 --- */
687
690
  baseOperationBtns () {
@@ -1267,6 +1270,8 @@ export default {
1267
1270
  _key: column.colType === "tree" ? "name" : column._key
1268
1271
  },
1269
1272
  allFormList: this.selfColumns,
1273
+ changedCols: this.changedCols,
1274
+ changedFields: (row.__changed__ || []).map(item => item.fieldKey),
1270
1275
  inTableType: this.inTableType,
1271
1276
  allListRows: this.allListData,
1272
1277
  rowIndex: rowIndex,
@@ -35,7 +35,7 @@
35
35
  <span
36
36
  v-if="changedFields.includes(formItem._key)"
37
37
  class="DshFormUnit-label-name-sign"
38
- >!有更新</span>
38
+ >!有更新</span>
39
39
  </slot>
40
40
 
41
41
  <!-- label后可自定义内容 -->
@@ -104,12 +104,6 @@
104
104
  unitMixin
105
105
  ],
106
106
  props: {
107
- changedFields: {
108
- type: Array,
109
- default () {
110
- return [];
111
- }
112
- },
113
107
  // 实际最精确值是68px(label:30px, control:32px, 上下padding各: 2px 8px,因为ivu-form-item-content里line-height: 32px导致有问题,故先74px
114
108
  height: {
115
109
  type: [String, Number],
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <div class="DshListUnit">
2
+ <div :class="{
3
+ DshListUnit: true,
4
+ 'DshListUnit-changed': changedCols.includes(formItem._key)
5
+ }">
3
6
  <template v-if="selfFormItem._type === 'index'">
4
7
  <span>{{ indexStr || rowIndex + 1 }}</span>
5
8
  </template>
@@ -15,6 +18,7 @@
15
18
 
16
19
  <template v-else>
17
20
  <component
21
+ :class="changedCols.includes(formItem._key) ? 'DshListUnit-control' : ''"
18
22
  :is="curComponentName"
19
23
  :canEdit="canEdit"
20
24
  :value="formData"
@@ -33,6 +37,19 @@
33
37
  @quickChange="quickChange"
34
38
  @change="change"
35
39
  ></component>
40
+
41
+ <template>
42
+ <!-- 有更新标记-->
43
+ <span
44
+ v-if="changedFields.includes(formItem._key)"
45
+ class="DshListUnit-sign"
46
+ >!有更新</span>
47
+ <!-- 占位 -制药某列的某行有,没更新也要占位,保持对齐 -->
48
+ <span
49
+ v-else-if="changedCols.includes(formItem._key)"
50
+ class="DshListUnit-sign-empty"
51
+ ></span>
52
+ </template>
36
53
  </template>
37
54
  </div>
38
55
  </template>
@@ -46,6 +63,12 @@
46
63
  unitMixin
47
64
  ],
48
65
  props: {
66
+ changedCols: {
67
+ type: Array,
68
+ default () {
69
+ return [];
70
+ }
71
+ },
49
72
  canEdit: {
50
73
  type: Boolean,
51
74
  default: false
@@ -68,6 +91,25 @@
68
91
 
69
92
  <style lang="less" scoped>
70
93
  .DshListUnit {
94
+ &-changed {
95
+ display: flex;
96
+ align-items: center;
97
+ }
98
+
99
+ &-control {
100
+ display: inline-block;
101
+ width: calc(100% - 66px);
102
+ }
103
+
104
+ &-sign {
105
+ display: inline-block;
106
+ width: 56px;
107
+ #dsh-sign-change();
71
108
 
109
+ &-empty {
110
+ display: inline-block;
111
+ width: 56px;
112
+ }
113
+ }
72
114
  }
73
115
  </style>
@@ -25,6 +25,12 @@ export default {
25
25
  return [];
26
26
  }
27
27
  },
28
+ changedFields: {
29
+ type: Array,
30
+ default () {
31
+ return [];
32
+ }
33
+ },
28
34
 
29
35
  /* 表格字段内用到的 */
30
36
  inTableType: {
@@ -29,8 +29,8 @@
29
29
 
30
30
  #dsh-sign-change () {
31
31
  display: inline-block;
32
- padding: 3px 8px;
33
- margin-left: 5px;
32
+ padding: 3px 6px;
33
+ margin-left: 4px;
34
34
  border-radius: 4px;
35
35
  background-color: #f75252;
36
36
  font-size: 12px;