bri-components 1.3.61 → 1.3.62

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,151 +0,0 @@
1
- export default {
2
- mixins: [],
3
- components: {},
4
- props: {
5
- data: {
6
- type: Array,
7
- default () {
8
- return [];
9
- }
10
- }
11
- },
12
- data () {
13
- return {};
14
- },
15
- computed: {
16
- selfPropsObj () {
17
- return {
18
- ...this.commonPropsObj
19
- };
20
- },
21
-
22
- allListData () {
23
- this.data.forEach(item => {
24
- !item._id && this.$set(item, "_id", this.$ObjectID().str);
25
-
26
- if (this.initFlag) {
27
- item.__old__ = true; // 标记老数据(initFlag不用在data中声明)
28
- }
29
- });
30
-
31
- this.initFlag = false;
32
- return this.data;
33
- },
34
- footerData () {
35
- return this.useSummary && this.allListData.length
36
- ? [
37
- this.filterColumns.reduce((obj, col) => {
38
- return {
39
- ...obj,
40
- [col._key]: col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType)
41
- ? this.$calNumList(
42
- this.allListData.map(item => item[col._key]),
43
- col._summaryType,
44
- { ...col, _defaultDigit: 2 }
45
- )
46
- : (obj[col._key] || "--")
47
- };
48
- }, {
49
- _id: this.$ObjectID().str,
50
- __index__: "汇总",
51
- __operation__: "——"
52
- })
53
- ]
54
- : [];
55
- },
56
-
57
- showColumns () {
58
- return [
59
- ...(this.useSelection === true ? [this.selectionColumn] : []),
60
- ...(this.useIndex === true ? [this.indexColumn] : []),
61
- ...this.$transformToColumns(this.contentColumns),
62
- ...(this.$getOperationList(["canDelete"]).length ? [this.operationColumn] : [])
63
- ];
64
- },
65
- selectionColumn () {
66
- return {
67
- _key: "__selection__",
68
- key: "__selection__",
69
- field: "__selection__",
70
- type: "checkbox",
71
- width: 66,
72
- align: "center",
73
- fixed: "left"
74
- };
75
- },
76
- indexColumn () {
77
- return {
78
- title: "序号",
79
- _key: "__index__",
80
- key: "__index__",
81
- field: "__index__",
82
- width: 76,
83
- align: "center",
84
- fixed: "left",
85
- renderBodyCell: ({ column, row, rowIndex }) => ++rowIndex
86
- };
87
- },
88
- operationColumn () {
89
- return {
90
- title: "操作",
91
- _key: "__operation__",
92
- key: "__operation__",
93
- field: "__operation__",
94
- align: "center",
95
- fixed: "right",
96
- width: 100,
97
- renderBodyCell: ({ column, row, rowIndex }, h) => {
98
- const operationList = this.$getOperationList(["canDelete"]);
99
-
100
- return h("dsh-buttons", {
101
- props: {
102
- list: operationList.map(btnItem => ({
103
- ...btnItem,
104
- disabled: !this.getRowBtnCanEdit(row)
105
- }))
106
- },
107
- on: {
108
- click: (operationItem) => {
109
- this.$dispatchEvent(operationItem, row, rowIndex, this.allListData);
110
- }
111
- }
112
- });
113
- }
114
- };
115
- }
116
- },
117
- created () { },
118
- methods: {
119
- // 点击 -添加行
120
- clickCreate (operationItem, row, rowIndex) {
121
- const list = this.allListData;
122
- const newRow = {
123
- ...this.$deepCopy(this.selfRowDefault),
124
- _id: this.$ObjectID().str
125
- };
126
- const newRowIndex = rowIndex == null ? list.length : rowIndex + 1;
127
- list.splice(newRowIndex, 0, newRow);
128
- this.$forceUpdate(); // 自定义页中点击添加一行没有更新页面
129
-
130
- this.change("createRow", null, newRow, newRowIndex);
131
- },
132
- // 点击 -删除行
133
- clickDelete (operationItem, row, rowIndex, list) {
134
- this.$Modal.confirm({
135
- title: "提示",
136
- content: "确定删除吗?",
137
- onOk: () => {
138
- list.splice(rowIndex, 1);
139
-
140
- this.change("deleteRow", null, row, rowIndex);
141
- }
142
- });
143
- },
144
- changeSelect (list) {
145
- this.$emit("changeSelect", list);
146
- },
147
- change (...params) {
148
- this.$emit("change", { list: this.allListData, rowDefault: this.rowDefault }, ...params);
149
- }
150
- }
151
- };