renusify 2.2.0 → 2.2.1
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/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/.github/ISSUE_TEMPLATE/custom.md +10 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/LICENSE +1 -1
- package/README.md +89 -1
- package/components/chip/style.scss +2 -2
- package/components/container/row.vue +2 -1
- package/components/container/style.scss +31 -0
- package/components/form/radioInput/index.vue +6 -2
- package/components/table/crud/index.vue +460 -459
- package/components/tree/index.vue +2 -2
- package/components/tree/tree-element.vue +2 -2
- package/package.json +1 -1
- package/plugins/request/Request.js +1 -0
|
@@ -1,500 +1,501 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
<div :class="`${$r.prefix}table-manage`">
|
|
3
|
+
<r-modal v-model="showForm" bottom full-width>
|
|
4
|
+
<slot :autoSend="autoSend" :method="method"
|
|
5
|
+
:modelValue="editedItem"
|
|
6
|
+
:ok="ok"
|
|
7
|
+
:options="table.option"
|
|
8
|
+
:title="title"
|
|
9
|
+
:url="url"
|
|
10
|
+
name="form">
|
|
11
|
+
<r-form-creator :autoSend="autoSend"
|
|
12
|
+
:method="method"
|
|
13
|
+
:modelValue="editedItem"
|
|
14
|
+
:options="table.option"
|
|
15
|
+
:title="title"
|
|
16
|
+
:url="url"
|
|
17
|
+
@ok="ok"
|
|
18
|
+
></r-form-creator>
|
|
19
|
+
</slot>
|
|
20
|
+
</r-modal>
|
|
21
|
+
<r-modal v-model="showCopy" bottom full-width>
|
|
22
|
+
<div class="pa-3">
|
|
23
|
+
<div v-for="(item,key) in table.option" :key="key"
|
|
24
|
+
class="mb-5">
|
|
25
|
+
<template v-if="item['formInput']!==false">
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
<r-json-input v-if="item['type']==='file-uploader'" v-model="copyItem['d'][key]" :label="$t(key,'renusify')"
|
|
28
|
+
baseArray></r-json-input>
|
|
29
|
+
<component
|
|
30
|
+
:is="item['type']"
|
|
31
|
+
v-else
|
|
32
|
+
v-model="copyItem['d'][key]"
|
|
33
|
+
:label="$t(key,'renusify')"
|
|
34
|
+
v-bind="getAttr(table.option[key],copyItem['t'])['props']"
|
|
35
|
+
></component>
|
|
36
|
+
</template>
|
|
37
|
+
</div>
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
<r-divider class="my-5"></r-divider>
|
|
40
|
+
<div class="d-flex h-space-between v-baseline">
|
|
41
41
|
<span>
|
|
42
42
|
<r-number-input v-if="copyItem['t']==='copy'" :label="$t('count_copy','renusify')"
|
|
43
43
|
v-model="copyItem['c']"></r-number-input>
|
|
44
44
|
</span>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
45
|
+
<r-btn :loading="loading" class="color-success" @click.prevent="copyAll()">{{
|
|
46
|
+
$t('send', 'renusify')
|
|
47
|
+
}}
|
|
48
|
+
</r-btn>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</r-modal>
|
|
52
|
+
<manage-header v-model="search" :advance-search="advanceSearch"
|
|
53
|
+
:disable-add="disableAdd"
|
|
54
|
+
:header-table="table.headers"
|
|
55
|
+
:loading="loading" :mcud="showMCUD" :new-item="newItem"
|
|
56
|
+
@copy="copyHandle('copy')"
|
|
57
|
+
@delete="deleteAll()"
|
|
58
|
+
@edit="copyHandle('edit')"
|
|
59
|
+
@update:modelValue="searching()"
|
|
60
|
+
@a-search="(a_search=$event),(searching())"></manage-header>
|
|
61
|
+
<r-table :headers="headerTable" :items="table.data" :key-item="itemId" :responsive="responsive"
|
|
62
|
+
transition="table-row">
|
|
63
|
+
<template v-slot:header="{header}">
|
|
64
|
+
<th v-for="(item,key) in header"
|
|
65
|
+
:key="`th-${key}`"
|
|
66
|
+
:class="{
|
|
65
67
|
'header-sortable':$helper.ifHas(item, true, 'option', 'sortable')
|
|
66
68
|
}"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<div class="w-90"><span>{{ item.text }}</span></div>
|
|
78
|
-
<div class="w-10 icon-holder" :class="{
|
|
69
|
+
@click.stop="sortSetup(item)">
|
|
70
|
+
<div v-if="item.option.type==='mcud'">
|
|
71
|
+
<input
|
|
72
|
+
v-model="check_all"
|
|
73
|
+
class="table-checkbox"
|
|
74
|
+
type="checkbox">
|
|
75
|
+
</div>
|
|
76
|
+
<div v-else class="d-flex v-end">
|
|
77
|
+
<div class="w-90"><span>{{ item.text }}</span></div>
|
|
78
|
+
<div :class="{
|
|
79
79
|
'icon-hidden': !(sortBy === item.value && sortType !== 0)
|
|
80
|
-
}"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
}" class="w-10 icon-holder"
|
|
81
|
+
>
|
|
82
|
+
<r-icon v-if="(sortType === 2 && sortBy === item.value)"
|
|
83
|
+
v-html="this.$r.icons.arrow_down"></r-icon>
|
|
84
|
+
<r-icon v-if="(sortType !== 2 || sortBy !== item.value)"
|
|
85
|
+
v-html="this.$r.icons.arrow_up"></r-icon>
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
</div>
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
</div>
|
|
90
|
+
</th>
|
|
91
|
+
</template>
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
93
|
+
<template v-slot:row="props">
|
|
94
|
+
<slot :deleteItem="deleteItem" :editItem="editItem" :table="props" name="row">
|
|
95
|
+
<td v-for="(value,key2) in props.th"
|
|
96
|
+
:key="`td-${key2}`">
|
|
97
|
+
<input v-if="value['option']['type']==='mcud'"
|
|
98
|
+
v-model="checked[props.item[itemId]]"
|
|
99
|
+
:checked="check_all"
|
|
100
|
+
class="table-checkbox"
|
|
101
|
+
type="checkbox"
|
|
102
|
+
@update:model-value="$event===false?check_all=false:''">
|
|
103
|
+
<r-btn v-if="props.show(key2)"
|
|
104
|
+
icon text @click.prevent="props.open(props.key)">
|
|
105
|
+
<r-icon v-html="props.opened!==props.key?$r.icons.plus:$r.icons.minus"></r-icon>
|
|
106
|
+
</r-btn>
|
|
107
|
+
<slot :editItem="editItem" :item="props.item" :value="value" name="cell">
|
|
108
|
+
<div
|
|
109
|
+
v-if="value['option']['type']==='r-date-input' && props.item[value['value']]!==undefined">
|
|
110
|
+
{{ $d(new Date(props.item[value['value']]), value['option']['format'] || 'short') }}
|
|
111
|
+
</div>
|
|
112
|
+
<div
|
|
113
|
+
v-else-if="value['option']['type']==='r-time-ago' && props.item[value['value']]!==undefined">
|
|
114
|
+
<r-time-ago :time="props.item[value['value']]"></r-time-ago>
|
|
115
|
+
</div>
|
|
116
|
+
<div v-else-if="value['option']['type']==='r-switch-input'">
|
|
117
|
+
<r-switch-input
|
|
118
|
+
:modelValue="props.item[value['value']]"
|
|
119
|
+
:readonly="value['option']['formInput']===false"
|
|
120
|
+
class="mt-0"
|
|
121
|
+
@update:modelValue="value['option']['formInput']!==false?editItem(props.item,true,value['value']):''"
|
|
122
|
+
></r-switch-input>
|
|
123
|
+
</div>
|
|
124
|
+
<div v-else-if="value['option']['type'] === 'r-number-input'">
|
|
125
|
+
{{ $n(props.item[value["value"]]) }}
|
|
126
|
+
</div>
|
|
127
|
+
<div v-else-if="value['option']['type']!=='action'">
|
|
128
|
+
{{
|
|
129
|
+
value['value'] in cast ?
|
|
130
|
+
$helper.ifHas(props.item, '', value['value'], cast[value['value']])
|
|
131
|
+
: props.item[value['value']]
|
|
132
|
+
}}
|
|
133
|
+
</div>
|
|
134
|
+
</slot>
|
|
135
|
+
<div v-if="value['option']['type']==='action'">
|
|
136
|
+
<r-btn v-if="!disableUpdate" class="mx-0 color-success-text"
|
|
137
|
+
icon text @click.prevent="editItem(props.item)">
|
|
138
|
+
<r-icon exact v-html="$r.icons.edit"></r-icon>
|
|
139
|
+
</r-btn>
|
|
140
|
+
<r-btn v-if="!disableDelete" class="mx-0 color-error-text"
|
|
141
|
+
icon text @click.prevent="deleteItem(props.item)">
|
|
142
|
+
<r-icon v-html="$r.icons.delete"></r-icon>
|
|
143
|
+
</r-btn>
|
|
144
|
+
<r-btn v-for="(val,index) in actions" :key="index" :class="`color-${val.color}-text`" class="mx-0" icon
|
|
145
|
+
text @click.prevent="$emit(val.name,props.item)">
|
|
146
|
+
<r-icon exact v-html="val.icon"></r-icon>
|
|
147
|
+
</r-btn>
|
|
148
|
+
</div>
|
|
149
|
+
</td>
|
|
150
|
+
</slot>
|
|
151
|
+
</template>
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
</r-table>
|
|
154
|
+
<manage-footer v-model:page="page" v-model:per-page="itemsPerPage" :total="table.total"></manage-footer>
|
|
155
|
+
<r-confirm
|
|
156
|
+
v-model="showConfirm"
|
|
157
|
+
hard
|
|
158
|
+
v-on:accept="accept"
|
|
159
|
+
v-on:cancel="showConfirm = false"
|
|
160
|
+
/>
|
|
161
|
+
</div>
|
|
162
162
|
</template>
|
|
163
163
|
|
|
164
164
|
<script>
|
|
165
165
|
import {defineAsyncComponent} from 'vue'
|
|
166
166
|
|
|
167
167
|
export default {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
168
|
+
name: 'r-table-crud',
|
|
169
|
+
components: {
|
|
170
|
+
ManageHeader: defineAsyncComponent(() =>
|
|
171
|
+
import("./header")
|
|
172
|
+
), ManageFooter: defineAsyncComponent(() =>
|
|
173
|
+
import("./footer")
|
|
174
|
+
)
|
|
175
|
+
},
|
|
176
|
+
props: {
|
|
177
|
+
link: {
|
|
178
|
+
required: true,
|
|
179
|
+
type: String
|
|
180
|
+
},
|
|
181
|
+
actions: {
|
|
182
|
+
default: function () {
|
|
183
|
+
return []
|
|
184
|
+
},
|
|
185
|
+
type: Array
|
|
186
|
+
},
|
|
187
|
+
cast: {
|
|
188
|
+
default: function () {
|
|
189
|
+
return {}
|
|
190
|
+
},
|
|
191
|
+
type: Object
|
|
192
|
+
},
|
|
193
|
+
perPage: {
|
|
194
|
+
type: Object, default: () => {
|
|
195
|
+
return {name: '10', value: 10}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
query: Object,
|
|
199
|
+
responsive: {
|
|
200
|
+
type: Boolean,
|
|
201
|
+
default: true
|
|
175
202
|
},
|
|
176
|
-
props: {
|
|
177
|
-
link: {
|
|
178
|
-
required: true,
|
|
179
|
-
type: String
|
|
180
|
-
},
|
|
181
|
-
actions: {
|
|
182
|
-
default: function () {
|
|
183
|
-
return []
|
|
184
|
-
},
|
|
185
|
-
type: Array
|
|
186
|
-
},
|
|
187
|
-
cast: {
|
|
188
|
-
default: function () {
|
|
189
|
-
return {}
|
|
190
|
-
},
|
|
191
|
-
type: Object
|
|
192
|
-
},
|
|
193
|
-
perPage: {
|
|
194
|
-
type: Object, default: () => {
|
|
195
|
-
return {name: '10', value: 10}
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
query: Object,
|
|
199
|
-
responsive: {
|
|
200
|
-
type: Boolean,
|
|
201
|
-
default: true
|
|
202
|
-
},
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
204
|
+
disableAdd: Boolean,
|
|
205
|
+
advanceSearch: {type: Boolean, default: true},
|
|
206
|
+
disableDelete: Boolean,
|
|
207
|
+
disableUpdate: Boolean,
|
|
208
|
+
mcud: String,
|
|
209
|
+
itemId: {type: String, default: "_id"},
|
|
210
|
+
headers: Object
|
|
211
|
+
},
|
|
212
|
+
emits: ['actions'],
|
|
213
|
+
data() {
|
|
214
|
+
return {
|
|
215
|
+
time_out_id: null,
|
|
216
|
+
loading: false,
|
|
217
|
+
showForm: false,
|
|
218
|
+
showCopy: false,
|
|
219
|
+
showConfirm: false,
|
|
220
|
+
search: '',
|
|
221
|
+
a_search: {},
|
|
222
|
+
copyItem: {'d': {}, 'c': 1},
|
|
223
|
+
editedItem: {},
|
|
224
|
+
deleted: '',
|
|
225
|
+
url: '',
|
|
226
|
+
method: 'post',
|
|
227
|
+
title: '',
|
|
228
|
+
autoSend: false,
|
|
229
|
+
itemsPerPage: this.perPage,
|
|
230
|
+
page: 1,
|
|
231
|
+
sortBy: null,
|
|
232
|
+
sortType: 0,
|
|
233
|
+
table: {
|
|
234
|
+
headers: [],
|
|
235
|
+
option: {},
|
|
236
|
+
data: [],
|
|
237
|
+
startTime: false,
|
|
238
|
+
total: 0
|
|
239
|
+
},
|
|
240
|
+
check_all: false,
|
|
241
|
+
checked: {}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
created() {
|
|
245
|
+
this.refresh()
|
|
246
|
+
},
|
|
247
|
+
watch: {
|
|
248
|
+
page: function (n, o) {
|
|
249
|
+
if (n > 0) {
|
|
250
|
+
this.refresh()
|
|
251
|
+
}
|
|
210
252
|
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
253
|
+
itemsPerPage: function () {
|
|
254
|
+
this.refresh()
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
computed: {
|
|
258
|
+
showMCUD() {
|
|
259
|
+
if (this.check_all) {
|
|
260
|
+
return true
|
|
261
|
+
}
|
|
262
|
+
for (let k in this.checked) {
|
|
263
|
+
if (this.checked[k] === true) {
|
|
264
|
+
return true
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return false
|
|
268
|
+
},
|
|
269
|
+
headerTable() {
|
|
270
|
+
const headers = this.table.headers
|
|
271
|
+
const res = []
|
|
272
|
+
const lng = headers.length
|
|
273
|
+
for (let i = 0; i < lng; i++) {
|
|
274
|
+
if (this.$helper.ifHas(headers[i], true, 'option', 'tableShow') !== false) {
|
|
275
|
+
res.push(headers[i])
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return res
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
methods: {
|
|
282
|
+
getAttr(data, typ) {
|
|
283
|
+
let res = {}
|
|
284
|
+
let ls = ['formInput', 'sortable', 'type', 'tableShow', 'priority']
|
|
285
|
+
if (typ === 'edit') {
|
|
286
|
+
ls.push('rules')
|
|
287
|
+
}
|
|
288
|
+
for (let i in data) {
|
|
289
|
+
if (this.$helper.hasKey(data, i) &&
|
|
290
|
+
!ls.includes(i)) {
|
|
291
|
+
res[i] = data[i]
|
|
241
292
|
}
|
|
293
|
+
}
|
|
294
|
+
return res
|
|
242
295
|
},
|
|
243
|
-
|
|
296
|
+
copyAll() {
|
|
297
|
+
this.loading = true
|
|
298
|
+
this.$axios[this.copyItem['t'] === 'copy' ? 'post' : 'put'](this.mcud, this.copyItem, {headers: this.headers}).then(() => {
|
|
299
|
+
this.loading = false
|
|
300
|
+
this.showCopy = false
|
|
244
301
|
this.refresh()
|
|
302
|
+
}, () => {
|
|
303
|
+
this.loading = false
|
|
304
|
+
})
|
|
245
305
|
},
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
306
|
+
copyHandle(typ = 'copy') {
|
|
307
|
+
this.copyItem = {'d': {}, 'c': 1, 't': typ}
|
|
308
|
+
if (typ === 'edit') {
|
|
309
|
+
this.copyItem['ids'] = this.get_ids()
|
|
310
|
+
if (this.copyItem['ids'].length === 0) {
|
|
311
|
+
return
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (typ === 'copy') {
|
|
315
|
+
if (this.check_all) {
|
|
316
|
+
this.copyItem['d'] = this.table.data[0]
|
|
317
|
+
this.copyItem['c'] = 1
|
|
318
|
+
}
|
|
319
|
+
for (let k in this.checked) {
|
|
320
|
+
if (this.checked[k] === true) {
|
|
321
|
+
this.table.data.forEach((item) => {
|
|
322
|
+
if (item[this.itemId] === k) {
|
|
323
|
+
this.copyItem['d'] = item
|
|
324
|
+
this.copyItem['c'] = 1
|
|
325
|
+
}
|
|
326
|
+
})
|
|
327
|
+
break
|
|
328
|
+
}
|
|
254
329
|
}
|
|
330
|
+
}
|
|
331
|
+
this.showCopy = true
|
|
255
332
|
},
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return false
|
|
267
|
-
},
|
|
268
|
-
headerTable() {
|
|
269
|
-
const headers = this.table.headers
|
|
270
|
-
const res = []
|
|
271
|
-
const lng = headers.length
|
|
272
|
-
for (let i = 0; i < lng; i++) {
|
|
273
|
-
if (this.$helper.ifHas(headers[i], true, 'option', 'tableShow') !== false) {
|
|
274
|
-
res.push(headers[i])
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return res
|
|
333
|
+
get_ids() {
|
|
334
|
+
let res = []
|
|
335
|
+
if (this.check_all) {
|
|
336
|
+
this.table.data.forEach((item) => {
|
|
337
|
+
res.push(item[this.itemId])
|
|
338
|
+
})
|
|
339
|
+
}
|
|
340
|
+
for (let k in this.checked) {
|
|
341
|
+
if (this.checked[k] === true) {
|
|
342
|
+
res.push(k)
|
|
278
343
|
}
|
|
344
|
+
}
|
|
345
|
+
return res
|
|
279
346
|
},
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return res
|
|
294
|
-
},
|
|
295
|
-
copyAll() {
|
|
296
|
-
this.loading = true
|
|
297
|
-
this.$axios[this.copyItem['t'] === 'copy' ? 'post' : 'put'](this.mcud, this.copyItem, {headers: this.headers}).then(() => {
|
|
298
|
-
this.loading = false
|
|
299
|
-
this.showCopy = false
|
|
300
|
-
this.refresh()
|
|
301
|
-
}, () => {
|
|
302
|
-
this.loading = false
|
|
347
|
+
deleteAll() {
|
|
348
|
+
let res = this.get_ids()
|
|
349
|
+
if (res.length > 0) {
|
|
350
|
+
this.$axios.delete(this.mcud, {
|
|
351
|
+
data: {
|
|
352
|
+
ids: res
|
|
353
|
+
},
|
|
354
|
+
headers: this.headers
|
|
355
|
+
})
|
|
356
|
+
.then(() => {
|
|
357
|
+
this.refresh()
|
|
303
358
|
})
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
let res = this.get_ids()
|
|
348
|
-
if (res.length > 0) {
|
|
349
|
-
this.$axios.delete(this.mcud, {
|
|
350
|
-
data: {
|
|
351
|
-
ids: res
|
|
352
|
-
},
|
|
353
|
-
headers: this.headers
|
|
354
|
-
})
|
|
355
|
-
.then(() => {
|
|
356
|
-
this.refresh()
|
|
357
|
-
})
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
sortSetup(item) {
|
|
361
|
-
if (!this.$helper.ifHas(item, true, 'option', 'sortable')) {
|
|
362
|
-
return
|
|
363
|
-
}
|
|
364
|
-
if (this.sortBy !== item.value) {
|
|
365
|
-
this.sortType = 0
|
|
366
|
-
}
|
|
367
|
-
this.sortBy = item.value
|
|
368
|
-
if (this.sortType >= 2) {
|
|
369
|
-
this.sortType = 0
|
|
370
|
-
} else {
|
|
371
|
-
this.sortType += 1
|
|
372
|
-
}
|
|
373
|
-
this.refresh()
|
|
374
|
-
},
|
|
375
|
-
ok() {
|
|
376
|
-
this.refresh()
|
|
377
|
-
this.autoSend = false
|
|
378
|
-
this.showForm = false
|
|
379
|
-
},
|
|
380
|
-
refresh(e) {
|
|
381
|
-
this.loading = true
|
|
382
|
-
this.check_all = false
|
|
383
|
-
this.checked = {}
|
|
384
|
-
const perPage = e !== undefined ? e.value : this.itemsPerPage.value
|
|
385
|
-
let params = this.query || {}
|
|
386
|
-
params.page = this.page
|
|
387
|
-
if (this.table.startTime !== false) {
|
|
388
|
-
params.t = this.table.startTime
|
|
389
|
-
}
|
|
390
|
-
if (this.sortType !== 0) {
|
|
391
|
-
const sort = (this.sortType === 2) ? 'desc' : 'asc'
|
|
392
|
-
params[sort] = this.sortBy
|
|
393
|
-
}
|
|
394
|
-
params.per_page = perPage
|
|
395
|
-
if (this.search.length >= 1) {
|
|
396
|
-
params.search = this.search
|
|
397
|
-
}
|
|
398
|
-
if (this.$helper.size(this.a_search) > 0) {
|
|
399
|
-
params.a_search = JSON.stringify(this.a_search)
|
|
400
|
-
}
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
sortSetup(item) {
|
|
362
|
+
if (!this.$helper.ifHas(item, true, 'option', 'sortable')) {
|
|
363
|
+
return
|
|
364
|
+
}
|
|
365
|
+
if (this.sortBy !== item.value) {
|
|
366
|
+
this.sortType = 0
|
|
367
|
+
}
|
|
368
|
+
this.sortBy = item.value
|
|
369
|
+
if (this.sortType >= 2) {
|
|
370
|
+
this.sortType = 0
|
|
371
|
+
} else {
|
|
372
|
+
this.sortType += 1
|
|
373
|
+
}
|
|
374
|
+
this.refresh()
|
|
375
|
+
},
|
|
376
|
+
ok() {
|
|
377
|
+
this.refresh()
|
|
378
|
+
this.autoSend = false
|
|
379
|
+
this.showForm = false
|
|
380
|
+
},
|
|
381
|
+
refresh(e) {
|
|
382
|
+
this.loading = true
|
|
383
|
+
this.check_all = false
|
|
384
|
+
this.checked = {}
|
|
385
|
+
const perPage = e !== undefined ? e.value : this.itemsPerPage.value
|
|
386
|
+
let params = this.query || {}
|
|
387
|
+
params.page = this.page
|
|
388
|
+
if (this.table.startTime !== false) {
|
|
389
|
+
params.t = this.table.startTime
|
|
390
|
+
}
|
|
391
|
+
if (this.sortType !== 0) {
|
|
392
|
+
const sort = (this.sortType === 2) ? 'desc' : 'asc'
|
|
393
|
+
params[sort] = this.sortBy
|
|
394
|
+
}
|
|
395
|
+
params.per_page = perPage
|
|
396
|
+
if (this.search.length >= 1) {
|
|
397
|
+
params.search = this.search
|
|
398
|
+
}
|
|
399
|
+
if (this.$helper.size(this.a_search) > 0) {
|
|
400
|
+
params.a_search = JSON.stringify(this.a_search)
|
|
401
|
+
}
|
|
401
402
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
403
|
+
this.setup('/' + this.link, params)
|
|
404
|
+
},
|
|
405
|
+
searching() {
|
|
406
|
+
clearTimeout(this.time_out_id)
|
|
407
|
+
this.loading = true
|
|
408
|
+
this.time_out_id = setTimeout(() => {
|
|
409
|
+
this.page = 1
|
|
410
|
+
this.refresh()
|
|
411
|
+
}, 1000)
|
|
411
412
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
413
|
+
},
|
|
414
|
+
newItem() {
|
|
415
|
+
this.title = this.$t('new', 'renusify')
|
|
416
|
+
this.url = this.link
|
|
417
|
+
const items = {}
|
|
418
|
+
this.table.headers.map((item) => {
|
|
419
|
+
if (item.option.formInput !== false) {
|
|
420
|
+
if (item.option.type === 'boolean') {
|
|
421
|
+
items[item.value] = false
|
|
422
|
+
} else {
|
|
423
|
+
items[item.value] = null
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
})
|
|
427
|
+
this.editedItem = items
|
|
428
|
+
this.method = 'post'
|
|
429
|
+
this.autoSend = false
|
|
430
|
+
this.showForm = true
|
|
431
|
+
},
|
|
432
|
+
editItem(item, autoSend = false, key = null) {
|
|
433
|
+
let sw
|
|
434
|
+
this.title = this.$t('edit', 'renusify')
|
|
435
|
+
this.url = this.link + '/' + item[this.itemId]
|
|
436
|
+
if (key) {
|
|
437
|
+
sw = !item[key]
|
|
438
|
+
}
|
|
439
|
+
const items = {}
|
|
440
|
+
this.table.headers.map((header) => {
|
|
441
|
+
if (header.option.formInput !== false) {
|
|
442
|
+
if (header.option.type === 'boolean') {
|
|
443
|
+
items[header.value] = item[header.value] !== undefined ? item[header.value] : false
|
|
444
|
+
} else {
|
|
445
|
+
items[header.value] = item[header.value] !== undefined ? item[header.value] : null
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
})
|
|
449
|
+
this.editedItem = Object.assign({}, items)
|
|
449
450
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
this.refresh()
|
|
465
|
-
})
|
|
466
|
-
},
|
|
467
|
-
accept() {
|
|
468
|
-
this.showConfirm = false
|
|
469
|
-
this.delete(this.deleted)
|
|
470
|
-
this.deleted = ''
|
|
451
|
+
if (key) {
|
|
452
|
+
this.editedItem[key] = sw
|
|
453
|
+
}
|
|
454
|
+
this.method = 'put'
|
|
455
|
+
this.autoSend = autoSend
|
|
456
|
+
this.showForm = true
|
|
457
|
+
},
|
|
458
|
+
deleteItem(item) {
|
|
459
|
+
this.showConfirm = true
|
|
460
|
+
this.deleted = item[this.itemId]
|
|
461
|
+
},
|
|
462
|
+
delete(_id) {
|
|
463
|
+
this.$axios.delete(this.link + '/' + _id, {headers: this.headers})
|
|
464
|
+
.then((res) => {
|
|
471
465
|
this.refresh()
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
value: "action"
|
|
483
|
-
})
|
|
484
|
-
}
|
|
485
|
-
all = all.concat(data.headers)
|
|
466
|
+
})
|
|
467
|
+
},
|
|
468
|
+
accept() {
|
|
469
|
+
this.showConfirm = false
|
|
470
|
+
this.delete(this.deleted)
|
|
471
|
+
this.deleted = ''
|
|
472
|
+
this.refresh()
|
|
473
|
+
},
|
|
474
|
+
setup(url, params = null) {
|
|
475
|
+
this.loading = true
|
|
486
476
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
this.loading = false
|
|
496
|
-
})
|
|
477
|
+
this.$axios.get(url, {params: params, headers: this.headers}).then(({data}) => {
|
|
478
|
+
let all = []
|
|
479
|
+
if (this.mcud) {
|
|
480
|
+
all.push({
|
|
481
|
+
option: {type: "mcud", sortable: false, formInput: false, priority: 10},
|
|
482
|
+
text: "action",
|
|
483
|
+
value: "action"
|
|
484
|
+
})
|
|
497
485
|
}
|
|
486
|
+
all = all.concat(data.headers)
|
|
487
|
+
|
|
488
|
+
this.table.headers = all.map((item) => {
|
|
489
|
+
this.table.option[item.value] = item.option
|
|
490
|
+
item.text = this.$t(item.value)
|
|
491
|
+
return item
|
|
492
|
+
})
|
|
493
|
+
this.table.data = data.data
|
|
494
|
+
this.table.total = data.total
|
|
495
|
+
this.table.startTime = this.$helper.ifHas(data, false, 't')
|
|
496
|
+
this.loading = false
|
|
497
|
+
})
|
|
498
498
|
}
|
|
499
|
+
}
|
|
499
500
|
}
|
|
500
501
|
</script>
|