bri-components 1.3.30 → 1.3.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": "bri-components",
3
- "version": "1.3.30",
3
+ "version": "1.3.31",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -28,6 +28,7 @@
28
28
  :parentObj="value"
29
29
  @change="change"
30
30
  ></dsh-tree-table>
31
+
31
32
  <dsh-cascader-table
32
33
  v-else
33
34
  :canEdit="finalCanEdit"
@@ -44,72 +45,33 @@
44
45
 
45
46
  <!-- 正常使用 -->
46
47
  <template v-else>
47
- <!-- 操作按钮 -->
48
- <dsh-buttons
49
- class="cascaderTable-btns"
50
- itemClass="cascaderTable-btns-item"
51
- :list="$getOperationList(operationBtns)"
52
- @click="$dispatchEvent($event)"
53
- ></dsh-buttons>
54
-
55
- <template>
56
- <dsh-tree-table
57
- v-if="showMode === 'treeTable'"
58
- ref="table"
59
- :canEdit="finalCanEdit"
60
- :data="curVal.tree"
61
- :rowDefault="curVal.rowDefault"
62
- :columns="subForm"
63
- :propsObj="propsObj"
64
- :parentFormList="allFormList"
65
- :parentObj="value"
66
- @change="change"
67
- ></dsh-tree-table>
68
- <dsh-cascader-table
69
- v-else
70
- ref="table"
71
- :canEdit="finalCanEdit"
72
- :data="curVal"
73
- :treeColumns="treeForm"
74
- :subColumns="subForm"
75
- :propsObj="propsObj"
76
- :parentFormList="allFormList"
77
- :parentObj="value"
78
- @change="change"
79
- ></dsh-cascader-table>
80
- </template>
81
-
82
- <!-- 全屏查看 -->
83
- <dsh-modal
84
- v-model="isEnlarge"
85
- mode="custom"
86
- :propsObj="modalPropsObj"
87
- >
88
- <template>
89
- <dsh-tree-table
90
- v-if="showMode === 'treeTable'"
91
- :canEdit="finalCanEdit"
92
- :data="curVal.tree"
93
- :rowDefault="curVal.rowDefault"
94
- :columns="subForm"
95
- :propsObj="propsObj"
96
- :parentFormList="allFormList"
97
- :parentObj="value"
98
- @change="change"
99
- ></dsh-tree-table>
100
- <dsh-cascader-table
101
- v-else
102
- :canEdit="finalCanEdit"
103
- :data="curVal"
104
- :treeColumns="treeForm"
105
- :subColumns="subForm"
106
- :propsObj="propsObj"
107
- :parentFormList="allFormList"
108
- :parentObj="value"
109
- @change="change"
110
- ></dsh-cascader-table>
111
- </template>
112
- </dsh-modal>
48
+ <!-- 层级表 -->
49
+ <dsh-tree-table
50
+ v-if="showMode === 'treeTable'"
51
+ ref="table"
52
+ :canEdit="finalCanEdit"
53
+ :data="curVal.tree"
54
+ :rowDefault="curVal.rowDefault"
55
+ :columns="subForm"
56
+ :propsObj="propsObj"
57
+ :parentFormList="allFormList"
58
+ :parentObj="value"
59
+ @change="change"
60
+ ></dsh-tree-table>
61
+
62
+ <!-- 级联表 -->
63
+ <dsh-cascader-table
64
+ v-else
65
+ ref="table"
66
+ :canEdit="finalCanEdit"
67
+ :data="curVal"
68
+ :treeColumns="treeForm"
69
+ :subColumns="subForm"
70
+ :propsObj="propsObj"
71
+ :parentFormList="allFormList"
72
+ :parentObj="value"
73
+ @change="change"
74
+ ></dsh-cascader-table>
113
75
  </template>
114
76
  </template>
115
77
  </div>
@@ -133,29 +95,7 @@
133
95
  },
134
96
  props: {},
135
97
  data () {
136
- return {
137
- isEnlarge: false,
138
- timer: null,
139
-
140
- operationMap: {
141
- canExport: {
142
- name: "导出",
143
- type: "canExport",
144
- icon: "md-share-alt",
145
- size: "small",
146
- btnType: "text",
147
- event: "clickExport"
148
- },
149
- canEnlarge: {
150
- name: "全屏展示",
151
- type: "canEnlarge",
152
- icon: "md-expand",
153
- size: "small",
154
- btnType: "text",
155
- event: "clickEnlarge"
156
- }
157
- }
158
- };
98
+ return {};
159
99
  },
160
100
  computed: {
161
101
  selfPropsObj () {
@@ -163,7 +103,6 @@
163
103
  _showMode: "default", // "default", "treeTable"
164
104
  _subForm: [],
165
105
  _treeForm: [],
166
- _isExport: false,
167
106
  ...this.propsObj
168
107
  };
169
108
  },
@@ -179,23 +118,6 @@
179
118
  ? this.curVal._treeForm
180
119
  : this.propsObj._treeForm;
181
120
  },
182
- isExport () {
183
- return this.propsObj._isExport;
184
- },
185
-
186
- operationBtns () {
187
- return this.isExport
188
- ? ["canExport", "canEnlarge"]
189
- : ["canEnlarge"];
190
- },
191
- modalPropsObj () {
192
- return {
193
- title: this.controlName,
194
- fullscreen: true,
195
- showSlotClose: false,
196
- closable: true
197
- };
198
- },
199
121
 
200
122
  showVal () {
201
123
  return `${this.curVal ? this.$getTreeLeafTotal(this.curVal.tree) : 0} 行`;
@@ -208,66 +130,9 @@
208
130
  return this.$refs.table.validate();
209
131
  },
210
132
 
211
- // 点击导出
212
- clickExport (operationItem) {
213
- operationItem.disabled = true;
214
- this.handleExport(operationItem);
215
- },
216
- // 打开全屏模态框
217
- clickEnlarge () {
218
- this.isEnlarge = true;
219
- },
220
133
  // 发生变动
221
134
  change (...params) {
222
135
  this.$emit("change", ...params);
223
- },
224
-
225
- // 接口 -导出级联表
226
- handleExport (operationItem) {
227
- this.$https({
228
- url: {
229
- module: "sheet",
230
- name: "exportCascaderTableExcel"
231
- },
232
- params: {
233
- _key: this.controlKey,
234
- _id: this.value._id
235
- },
236
- callback: data => {
237
- this.timer = setInterval(() => {
238
- this.getJobStatusData(operationItem, data.jobId, data.excel_url);
239
- }, 1000);
240
- }
241
- });
242
- },
243
- // 接口 -
244
- getJobStatusData (operationItem, id, url) {
245
- this.$https({
246
- url: {
247
- module: "sheet",
248
- name: "getJobStatus"
249
- },
250
- params: {
251
- jobId: id
252
- },
253
- callback: data => {
254
- operationItem.disabled = false;
255
-
256
- if (data.status === "completed") {
257
- clearInterval(this.timer);
258
- window.location.href = data.url;
259
- } else if (data.status === "failed") {
260
- clearInterval(this.timer);
261
- this.$Message.info({
262
- content: "操作失败,请稍后再试"
263
- });
264
- }
265
- },
266
- error: data => {
267
- operationItem.disabled = false;
268
- this.timer = null;
269
- }
270
- });
271
136
  }
272
137
  }
273
138
  };
@@ -282,14 +147,5 @@
282
147
 
283
148
  }
284
149
  }
285
-
286
- &-btns {
287
- text-align: right;
288
- color: @textColor;
289
-
290
- &-item {
291
-
292
- }
293
- }
294
150
  }
295
151
  </style>
@@ -1,100 +1,56 @@
1
1
  <template>
2
2
  <div class="flatTable">
3
- <!-- 多选模式 -->
4
- <template v-if="multipleMode"></template>
5
-
6
- <!-- 单选模式 -->
7
- <template v-else>
8
- <!-- 查看 单元格内 -->
9
- <span
10
- v-if="isUnitShow"
11
- class="flatTable-unit"
12
- >
13
- <dsh-icons :list="[{
14
- customIcon: 'bico-internaltable'
15
- }]"></dsh-icons>
16
- <span class="flatTable-unit-text">
17
- {{ curVal.list.length }}行
18
- </span>
3
+ <!-- 查看 单元格内 -->
4
+ <span
5
+ v-if="isUnitShow"
6
+ class="flatTable-unit"
7
+ >
8
+ <dsh-icons :list="[{
9
+ customIcon: 'bico-internaltable'
10
+ }]"></dsh-icons>
11
+ <span class="flatTable-unit-text">
12
+ {{ curVal.list.length }}行
19
13
  </span>
14
+ </span>
20
15
 
21
- <!-- 编辑、查看(查看页内) -->
22
- <template v-else>
23
- <!-- 配置端 设置默认值用-->
24
- <dsh-btn-modal v-if="propsObj._key === '_default'">
25
- <dsh-flat-table
26
- :canEdit="finalCanEdit"
27
- :data="curVal.list"
28
- :rowDefault="curVal.rowDefault"
29
- :columns="columns"
30
- :propsObj="propsObj"
31
- :parentFormList="allFormList"
32
- :parentObj="value"
33
- @change="change"
34
- ></dsh-flat-table>
35
- </dsh-btn-modal>
36
-
37
- <!-- 正常使用 -->
38
- <template v-else>
39
- <!-- 操作按钮 -->
40
- <dsh-buttons
41
- class="flatTable-btns"
42
- itemClass="flatTable-btns-item"
43
- :list="$getOperationList(operationFieldList)"
44
- @click="$dispatchEvent($event)"
45
- ></dsh-buttons>
46
-
47
- <dsh-flat-table
48
- ref="dshFatTable"
49
- :canEdit="finalCanEdit"
50
- :data="curVal.list"
51
- :oldData="curVal.oldList"
52
- :rowDefault="curVal.rowDefault"
53
- :columns="columns"
54
- :propsObj="propsObj"
55
- :parentFormList="allFormList"
56
- :parentObj="value"
57
- @change="change"
58
- ></dsh-flat-table>
59
-
60
- <!-- 全屏查看 -->
61
- <dsh-modal
62
- v-model="isEnlarge"
63
- mode="custom"
64
- :propsObj="modalPropsObj"
65
- >
66
- <dsh-flat-table
67
- :canEdit="finalCanEdit"
68
- :data="curVal.list"
69
- :oldData="curVal.oldList"
70
- :rowDefault="curVal.rowDefault"
71
- :columns="columns"
72
- :propsObj="propsObj"
73
- :parentFormList="allFormList"
74
- :parentObj="value"
75
- @change="change"
76
- ></dsh-flat-table>
77
- </dsh-modal>
78
- </template>
79
- </template>
16
+ <!-- 编辑、查看(查看页内) -->
17
+ <template v-else>
18
+ <!-- 配置端 设置默认值用-->
19
+ <dsh-btn-modal v-if="propsObj._key === '_default'">
20
+ <dsh-flat-table
21
+ :canEdit="finalCanEdit"
22
+ :data="curVal.list"
23
+ :rowDefault="curVal.rowDefault"
24
+ :columns="subForm"
25
+ :propsObj="propsObj"
26
+ :parentFormList="allFormList"
27
+ :parentObj="value"
28
+ @change="change"
29
+ ></dsh-flat-table>
30
+ </dsh-btn-modal>
31
+
32
+ <!-- 正常使用 -->
33
+ <dsh-flat-table
34
+ v-else
35
+ ref="table"
36
+ :canEdit="finalCanEdit"
37
+ :data="curVal.list"
38
+ :oldData="curVal.oldList"
39
+ :rowDefault="curVal.rowDefault"
40
+ :columns="subForm"
41
+ :propsObj="propsObj"
42
+ :parentFormList="allFormList"
43
+ :parentObj="value"
44
+ @change="change"
45
+ ></dsh-flat-table>
80
46
  </template>
81
-
82
- <flat-table-import-modal
83
- v-if="showBatchImportModal"
84
- :value="showBatchImportModal"
85
- :propsObj="propsObj"
86
- :importParams="importParams"
87
- @input="toggleBatchImportModal"
88
- @importCb="importCb"
89
- ></flat-table-import-modal>
90
47
  </div>
91
48
  </template>
92
49
 
93
50
  <script>
94
51
  import controlMixin from "../../mixins/controlMixin.js";
95
- import DshBtnModal from "../../../small/DshBtnModal.vue";
96
52
  import DshFlatTable from "../../../list/DshFlatTable.vue";
97
- import flatTableImportModal from "./flatTableImportModal.vue";
53
+ import DshBtnModal from "../../../small/DshBtnModal.vue";
98
54
 
99
55
  export default {
100
56
  name: "flatTable",
@@ -102,48 +58,24 @@
102
58
  controlMixin
103
59
  ],
104
60
  components: {
105
- DshBtnModal,
106
61
  DshFlatTable,
107
- flatTableImportModal
62
+ DshBtnModal
108
63
  },
109
64
  props: {},
110
65
  data () {
111
- return {
112
- isEnlarge: false,
113
-
114
- operationMap: {
115
- canEnlarge: {
116
- name: "全屏展示",
117
- type: "canEnlarge",
118
- icon: "md-expand",
119
- size: "small",
120
- btnType: "text",
121
- event: "enlarge"
122
- },
123
- canImport: {
124
- name: "导入",
125
- type: "canImport",
126
- icon: "ios-create-outline",
127
- size: "small",
128
- btnType: "text",
129
- event: "clickBatchImport"
130
- },
131
- canExport: {
132
- name: "导出",
133
- type: "canExport",
134
- icon: "md-share-alt",
135
- size: "small",
136
- btnType: "text",
137
- disabled: false,
138
- event: "clickExport"
139
- }
140
- },
141
-
142
- showBatchImportModal: false,
143
- timer: null
144
- };
66
+ return {};
145
67
  },
146
68
  computed: {
69
+ selfPropsObj () {
70
+ return {
71
+ _subForm: [],
72
+ ...this.propsObj
73
+ };
74
+ },
75
+ subForm () {
76
+ return this.selfPropsObj._subForm;
77
+ },
78
+
147
79
  curVal () {
148
80
  // TODO: 待定处理
149
81
  return this.value[this.controlKey] || {
@@ -151,125 +83,15 @@
151
83
  oldList: [],
152
84
  rowDefault: {}
153
85
  };
154
- },
155
- columns () {
156
- return this.propsObj._subForm;
157
- },
158
-
159
- modalPropsObj () {
160
- return {
161
- title: this.propsObj._name,
162
- fullscreen: true,
163
- showSlotClose: false,
164
- closable: true
165
- };
166
- },
167
-
168
- operationFieldList () {
169
- let btnList = ["canEnlarge"];
170
- if (this.propsObj._isExport) {
171
- btnList.unshift("canExport");
172
- }
173
- if (this.propsObj._isImport && this.finalCanEdit) {
174
- btnList.unshift("canImport");
175
- }
176
-
177
- return btnList;
178
- },
179
- importParams () {
180
- return {
181
- _key: this.controlKey,
182
- _id: this.value._id
183
- };
184
86
  }
185
87
  },
186
88
  created () {},
187
89
  methods: {
188
- clickBatchImport () {
189
- this.openBatchImportModal();
190
- },
191
- openBatchImportModal () {
192
- this.showBatchImportModal = true;
193
- },
194
- // 关闭批量导入模态框
195
- closeBatchImportModal () {
196
- this.showBatchImportModal = false;
197
- },
198
- // 切换批量导入模态框
199
- toggleBatchImportModal (bool) {
200
- bool ? this.openBatchImportModal() : this.closeBatchImportModal();
201
- },
202
- // 导出点击
203
- clickExport (operationItem) {
204
- if (operationItem.disabled || this.timer) {
205
- return;
206
- }
207
- operationItem.disabled = true;
208
- this.$https({
209
- url: {
210
- module: "sheet",
211
- name: "exportFlatTableExcel"
212
- },
213
- params: {
214
- _key: this.controlKey,
215
- _id: this.value._id,
216
- screenKey: this.screenKey
217
- },
218
- callback: data => {
219
- setTimeout(() => {
220
- operationItem.disabled = false;
221
- }, 500);
222
- this.timer = setInterval(this.getTransitStatus(data.jobId, data.excel_url), 1000);
223
- }
224
- });
225
- },
226
- getTransitStatus (id, url) {
227
- let that = this;
228
- return function () {
229
- that.getJobStatus(id, url);
230
- };
231
- },
232
- getJobStatus (id, url) {
233
- this.$https({
234
- url: {
235
- module: "sheet",
236
- name: "getJobStatus"
237
- },
238
- params: {
239
- jobId: id
240
- },
241
- callback: data => {
242
- if (data.status === "completed") {
243
- clearInterval(this.timer);
244
- this.timer = null;
245
- window.location.href = data.url;
246
- } else if (data.status === "failed") {
247
- clearInterval(this.timer);
248
- this.timer = null;
249
- // this.exportBtnLoading = false;
250
- this.$Message.info({ content: "操作失败,请稍后再试" });
251
- }
252
- },
253
- error: data => {
254
- this.timer = null;
255
- }
256
- });
257
- },
258
- // 回调- 导入成功
259
- importCb (data) {
260
- this.value[this.controlKey] = data;
261
- this.change(data);
262
- },
263
-
264
90
  // 校验方法 -供外部使用
265
91
  validate () {
266
- return this.$refs.dshFatTable.validate();
92
+ return this.$refs.table.validate();
267
93
  },
268
94
 
269
- // 打开全屏模态框
270
- enlarge () {
271
- this.isEnlarge = true;
272
- },
273
95
  change (...params) {
274
96
  this.$emit("change", ...params);
275
97
  }
@@ -288,14 +110,5 @@
288
110
 
289
111
  }
290
112
  }
291
-
292
- &-btns {
293
- text-align: right;
294
- color: @textColor;
295
-
296
- &-item {
297
-
298
- }
299
- }
300
113
  }
301
114
  </style>