mooho-base-admin-plus 2.9.4 → 2.10.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.
@@ -7,11 +7,23 @@
7
7
  <view-form ref="form" view-code="I18nTextFilter" @on-change="formChange"></view-form>
8
8
  <div v-if="canSave" style="margin-bottom: 8px; text-align: center">
9
9
  <Button type="primary" style="margin-right: 8px" custom-icon="fa fa-save" @click="save()">{{ $t('Front_Btn_Save') }}</Button>
10
- <Button v-if="i18nType == 'Server' || i18nType == 'Front'" type="primary" custom-icon="fa fa-plus" @click="$refs.newForm.openDefault({ i18nType: i18nType })">
10
+ <Button
11
+ v-if="i18nType == 'Server' || i18nType == 'Front'"
12
+ type="primary"
13
+ style="margin-right: 8px"
14
+ custom-icon="fa fa-plus"
15
+ @click="$refs.newForm.openDefault({ i18nType: i18nType })"
16
+ >
11
17
  {{ $t('Front_Btn_Add') }}
12
18
  </Button>
19
+ <Button v-if="allow('export')" style="margin-right: 8px" type="info" custom-icon="fa fa-cloud-download-alt" @click="exportFile()">{{ $t('Front_Btn_Export') }}</Button>
20
+ <file-upload v-if="allow('import')" url="api/I18nText/importFile" accept=".i18n" @on-success="importFileSuccess">
21
+ <template #>
22
+ <Button type="primary" custom-icon="fa fa-cloud-upload-alt">{{ $t('Front_Btn_Import') }}</Button>
23
+ </template>
24
+ </file-upload>
13
25
  </div>
14
- <view-table ref="table" view-code="I18nText" :static="true" :onSearch="loadData">
26
+ <view-table ref="table" view-code="I18nText" :static="true" :select-enable="true" :onSearch="loadData">
15
27
  <template #command="{ row }">
16
28
  <Button
17
29
  v-if="i18nType == 'Server' || i18nType == 'Front'"
@@ -92,6 +104,27 @@
92
104
  this.loadData();
93
105
  });
94
106
  });
107
+ },
108
+ // 导出文件
109
+ exportFile() {
110
+ let ids = this.$refs.table.getSelected().map(x => {
111
+ return x.id;
112
+ });
113
+ if (ids.length > 0) {
114
+ i18nTextApi.exportFile(ids);
115
+ } else {
116
+ this.error('Front_Msg_Please_Select_Export_Item');
117
+ }
118
+ },
119
+ // 导入成功
120
+ importFileSuccess(res) {
121
+ if (res.code == 0) {
122
+ this.success('Front_Msg_Success', () => {
123
+ this.loadData();
124
+ });
125
+ } else {
126
+ this.error(res.message);
127
+ }
95
128
  }
96
129
  }
97
130
  };
@@ -34,18 +34,10 @@
34
34
  <Input type="text" :readonly="true" v-model="data.keywordColumn" @click="keywordColumnOpen()"></Input>
35
35
  </div>
36
36
  <div v-if="code == 'sorting'">
37
- <Input type="text" :readonly="true" v-model="$refs.form.data.sorting" @click="openSort">
38
- <template #prepend>
39
- <Button custom-icon="fa fa-edit" @click="openSort"></Button>
40
- </template>
41
- </Input>
37
+ <modal-setting-sorting ref="settingSorting" v-model="data.sorting" :is-data-source="data.isDataSource" :model="data.model" :data-source="data.dataSource" />
42
38
  </div>
43
39
  <div v-if="code == 'filtering'">
44
- <Input type="text" :readonly="true" v-model="$refs.form.data.filtering" @click="openFilter">
45
- <template #prepend>
46
- <Button custom-icon="fa fa-edit" @click="openFilter"></Button>
47
- </template>
48
- </Input>
40
+ <modal-setting-filtering ref="settingFiltering" v-model="data.filtering" :is-data-source="data.isDataSource" :model="data.model" :data-source="data.dataSource" />
49
41
  </div>
50
42
  <div v-if="code == 'batchSelectDataCode'">
51
43
  <Input type="text" :readonly="true" v-model="$refs.form.data.batchSelectDataCode" @click="openColumnCheck($refs.form.data, 'batchSelectDataCode')">
@@ -172,8 +164,6 @@
172
164
  <Button type="primary" v-if="canCopy" custom-icon="fa fa-copy" @click="copy">{{ $t('Front_Btn_Copy') }}</Button>
173
165
  </template>
174
166
  </modal-form>
175
- <modal-form-sort ref="modal_sort" :sort="data.sorting" :dataView="data" @bindSort="bindSort" />
176
- <modal-form-filter ref="modal_filter" :filter="data.filtering" :dataView="data" @bindFilter="bindFilter" />
177
167
  <table-setting ref="tableSetting" />
178
168
  <filter-setting ref="filterSetting" />
179
169
  <column-select ref="columnSelect" />
@@ -194,11 +184,13 @@
194
184
  import groupMethod from '../../components/view/group-method.vue';
195
185
  import groupColumn from '../../components/view/group-column.vue';
196
186
  import conditionEdit from '../../components/view/condition-edit.vue';
187
+ import modalSettingSorting from '../../components/view/modal-setting-sorting.vue';
188
+ import modalSettingFiltering from '../../components/view/modal-setting-filtering.vue';
197
189
 
198
190
  export default {
199
191
  name: 'system-ui-tableView',
200
192
  mixins: [mixinPage],
201
- components: { columnSelect, columnCheck, filterSetting, groupMethod, groupColumn, conditionEdit },
193
+ components: { columnSelect, columnCheck, conditionEdit, filterSetting, groupMethod, groupColumn, modalSettingFiltering, modalSettingSorting },
202
194
  data() {
203
195
  return {
204
196
  filter: {
@@ -267,34 +259,6 @@
267
259
  let res = await filterColumnApi.queryByDataViewID(row.id);
268
260
  this.$refs.filterSetting.open(row, res.data);
269
261
  },
270
- //绑定排序组件返回的排序json
271
- bindSort(value) {
272
- this.$refs.form.data.sorting = value;
273
- // this.data.sorting = value;
274
- },
275
- //绑定筛选组件返回的排序json
276
- bindFilter(value) {
277
- this.$refs.form.data.filtering = value;
278
- // this.data.filtering = value;
279
- },
280
- // 打开排序编辑框
281
- async openSort() {
282
- if (!this.$refs.form.data.model == '') {
283
- this.data = this.$refs.form.data;
284
- this.$refs.modal_sort.open();
285
- } else {
286
- this.error('Front_Msg_Please_Select_Model_First');
287
- }
288
- },
289
- // 打开筛选编辑框
290
- async openFilter() {
291
- if (!this.$refs.form.data.model == '') {
292
- this.data = this.$refs.form.data;
293
- this.$refs.modal_filter.open();
294
- } else {
295
- this.error('Front_Msg_Please_Select_Model_First');
296
- }
297
- },
298
262
  // 导出文件
299
263
  exportFile() {
300
264
  let ids = this.$refs.table.getSelected().map(x => {
@@ -37,7 +37,7 @@
37
37
  <Button
38
38
  type="warning"
39
39
  v-if="
40
- cancelEnable &&
40
+ isCancelable &&
41
41
  $refs.form &&
42
42
  $refs.form.data &&
43
43
  $refs.form.data.application &&
@@ -62,6 +62,21 @@
62
62
  <modal-form ref="showForm" v-if="page" :readonly="page.showViewCode == null" @on-after-save="$refs.table.loadData()">
63
63
  <template #footer>
64
64
  <span></span>
65
+ <Button
66
+ type="warning"
67
+ v-if="
68
+ isRecallable &&
69
+ $refs.showForm &&
70
+ $refs.showForm.data &&
71
+ $refs.showForm.data.application &&
72
+ $refs.showForm.data.applicationID &&
73
+ $refs.showForm.data.application.status == 'Running'
74
+ "
75
+ custom-icon="fa fa-reply-all"
76
+ @click="recall"
77
+ >
78
+ {{ $t('Front_Btn_Recall') }}
79
+ </Button>
65
80
  <Button
66
81
  type="primary"
67
82
  v-if="
@@ -139,7 +154,9 @@
139
154
  messageData: {
140
155
  message: null
141
156
  },
142
- messageOpened: false
157
+ messageOpened: false,
158
+ isCancelable: false,
159
+ isRecallable: false
143
160
  };
144
161
  },
145
162
  props: {
@@ -158,11 +175,6 @@
158
175
  // 申请类别
159
176
  applicationTypeCode: {
160
177
  type: String
161
- },
162
- // 允许撤销
163
- cancelEnable: {
164
- type: Boolean,
165
- default: true
166
178
  }
167
179
  },
168
180
  computed: {},
@@ -198,6 +210,9 @@
198
210
  ...mapActions('admin/viewPage', { loadPage: 'load' }),
199
211
  // 初始化
200
212
  async init() {
213
+ this.isCancelable = this.page.applicationType.isCancelable;
214
+ this.isRecallable = this.page.applicationType.isRecallable;
215
+
201
216
  setTimeout(() => {
202
217
  if (!this.allow('all')) {
203
218
  this.filter.createUserID = this.info.id;
@@ -302,6 +317,17 @@
302
317
  this.$refs.form.close();
303
318
  });
304
319
  });
320
+ },
321
+ // 撤回
322
+ async recall() {
323
+ this.confirm('Front_Msg_Sure_To_Recall_Application', async () => {
324
+ await applicationApi.recall(this.$refs.showForm.data.applicationID);
325
+
326
+ this.success('Front_Msg_Success', () => {
327
+ this.$refs.table.loadData();
328
+ this.$refs.showForm.close();
329
+ });
330
+ });
305
331
  }
306
332
  }
307
333
  };
@@ -21,7 +21,6 @@ export default {
21
21
  // store 赋值
22
22
  state.info = info;
23
23
 
24
- console.log('info', info);
25
24
  // 持久化
26
25
  await dispatch(
27
26
  'admin/db/set',
@@ -1,322 +0,0 @@
1
- <template>
2
- <!-- 字段筛选table展示 -->
3
- <Modal v-model="opened" scrollable :mask-closable="layout.maskClosable" :draggable="layout.draggable" :sticky="true" :reset-drag-position="true" :width="formView.width || '800'">
4
- <template #header>
5
- <div>
6
- <span class="title">{{ $t('Front_Label_Sorting_Setting') }}</span>
7
- <span class="description">{{ $t('Front_Label_Filtering_Setting_Desc') }}</span>
8
- </div>
9
- </template>
10
-
11
- <div class="i-table-no-border">
12
- <Table stripe :columns="columnsFiltering" :data="dataFiltering">
13
- <template #action="{ row, index }">
14
- <Button size="small" :title="$t('Front_Btn_Edit')" type="primary" ghost custom-icon="fa fa-edit" @click="filteringFmModalopen(row)"></Button>
15
- <Button size="small" :title="$t('Front_Btn_Up')" type="primary" ghost custom-icon="fa fa-chevron-up" @click="upfiltering(row, index)"></Button>
16
- <Button size="small" :title="$t('Front_Btn_Down')" type="primary" ghost custom-icon="fa fa-chevron-down" @click="downfiltering(row, index)"></Button>
17
- <Button size="small" :title="$t('Front_Btn_Remove')" type="primary" ghost custom-icon="fa fa-times" @click="removefiltering(row, index)"></Button>
18
- </template>
19
- </Table>
20
- </div>
21
- <template #footer>
22
- <Button type="primary" ghost custom-icon="fa fa-plus" @click="filteringFmModalopen(null)">{{ $t('Front_Btn_Add') }}</Button>
23
- <Button type="primary" custom-icon="fa fa-check" @click="SaveFiltering">{{ $t('Front_Btn_OK') }}</Button>
24
- </template>
25
- <!-- 对筛选条件进行处理 -->
26
- <Modal v-model="filteringFmModal" scrollable :mask-closable="layout.maskClosable" :draggable="layout.draggable" :sticky="true" :reset-drag-position="true" width="800">
27
- <template #header>
28
- <div>
29
- <span class="title">{{ $t('Front_Label_Filtering_Setting_Edit') }}</span>
30
- <span class="description">{{ $t('Front_Label_Filtering_Setting_Edit_Desc') }}</span>
31
- </div>
32
- </template>
33
- <Form ref="filteringform">
34
- <Row :gutter="24" type="flex">
35
- <Col>
36
- <FormItem :label="$t('Front_Label_Column')" prop="Code">
37
- <Input type="text" v-model="data.code">
38
- <template #prepend>
39
- <Button custom-icon="fa fa-search" @click="openSelect()"></Button>
40
- </template>
41
- </Input>
42
- </FormItem>
43
- </Col>
44
- <Col>
45
- <FormItem :label="$t('Front_Label_Operator')" prop="Operator">
46
- <Select v-model="data.operator" :transfer="true">
47
- <Option v-for="item in getEnumList('Operator')" :key="item.value" :value="item.id">{{ item.name }}</Option>
48
- </Select>
49
- </FormItem>
50
- </Col>
51
- <Col>
52
- <FormItem :label="$t('Front_Label_Keyword')" prop="KeyValue">
53
- <Input type="text" v-model="data.keyValue" maxlength="200" />
54
- </FormItem>
55
- </Col>
56
- </Row>
57
- </Form>
58
- <template #footer>
59
- <Button type="primary" custom-icon="fa fa-check" @click="saveFilteringForm($event)">{{ $t('Front_Btn_OK') }}</Button>
60
- </template>
61
- <column-check ref="columnCheck" />
62
- </Modal>
63
- </Modal>
64
- </template>
65
-
66
- <script>
67
- import mixinPage from '../../mixins/page';
68
- import columnCheck from './column-check.vue';
69
-
70
- export default {
71
- mixins: [mixinPage],
72
- components: { columnCheck },
73
-
74
- props: {
75
- filter: String, //原表单筛选字段json值
76
- dataView: {} //原表单对象
77
- },
78
- data() {
79
- return {
80
- opened: false,
81
- formView: {},
82
- filteringFmModal: false,
83
- dataFiltering: [],
84
- data: {}
85
- };
86
- },
87
- computed: {
88
- columnsFiltering() {
89
- return [
90
- {
91
- type: 'index',
92
- width: 100,
93
- title: ' ',
94
- align: 'center'
95
- },
96
- {
97
- title: this.$t('Front_Label_Column'),
98
- key: 'column'
99
- },
100
- {
101
- title: this.$t('Front_Label_Operator'),
102
- key: 'operatorType'
103
- },
104
- {
105
- title: this.$t('Front_Label_Keyword'),
106
- key: 'keyValue'
107
- },
108
- {
109
- title: ' ',
110
- slot: 'action',
111
- width: 200,
112
- fixed: 'right',
113
- align: 'center'
114
- }
115
- ];
116
- }
117
- },
118
- methods: {
119
- open() {
120
- this.toData();
121
- this.opened = true;
122
- },
123
- close() {
124
- this.opened = false;
125
- },
126
- // 将数据库获取的json字符串转换为数组对象
127
- toData() {
128
- let filterArr = [];
129
- if (this.filter !== '' && this.filter != null) {
130
- let json = JSON.parse(this.filter);
131
- for (let key in json) {
132
- let operatorArr = [];
133
- operatorArr = this.operatorChange(key);
134
- filterArr.push({
135
- column: operatorArr[0],
136
- operatorType: operatorArr[1],
137
- rule: operatorArr[2],
138
- operator: operatorArr[3],
139
- keyValue: json[key]
140
- });
141
- }
142
- }
143
- this.dataFiltering = filterArr;
144
- },
145
- // 操作符数据转换( companyType_g ---> companyType,_g,大于,GreaterThan)
146
- operatorChange(operator) {
147
- let operatorArr = new Array(4);
148
- if (operator.indexOf('_g') >= 0 && operator.indexOf('_ge') == -1) {
149
- operatorArr[0] = operator.replace('_g', '');
150
- operatorArr[1] = '大于';
151
- operatorArr[2] = '_g';
152
- operatorArr[3] = 'GreaterThan';
153
- } else if (operator.indexOf('_l') >= 0 && operator.indexOf('_le') == -1) {
154
- operatorArr[0] = operator.replace('_l', '');
155
- operatorArr[1] = '小于';
156
- operatorArr[2] = '_l';
157
- operatorArr[3] = 'LessThan';
158
- } else if (operator.indexOf('_ge') >= 0) {
159
- operatorArr[0] = operator.replace('_ge', '');
160
- operatorArr[1] = '大于等于';
161
- operatorArr[2] = '_ge';
162
- operatorArr[3] = 'GreaterThanOrEqual';
163
- } else if (operator.indexOf('_le') >= 0) {
164
- operatorArr[0] = operator.replace('_le', '');
165
- operatorArr[1] = '小于等于';
166
- operatorArr[2] = '_le';
167
- operatorArr[3] = 'LessThanOrEqual';
168
- } else if (operator.indexOf('_n') >= 0) {
169
- operatorArr[0] = operator.replace('_n', '');
170
- operatorArr[1] = '不等于';
171
- operatorArr[2] = '_n';
172
- operatorArr[3] = 'NotEqual';
173
- } else if (operator.indexOf('_c') >= 0) {
174
- operatorArr[0] = operator;
175
- operatorArr[1] = '文字包含';
176
- operatorArr[2] = '_c';
177
- operatorArr[3] = 'Contains';
178
- } else {
179
- operatorArr[0] = operator;
180
- operatorArr[1] = '等于';
181
- operatorArr[2] = '';
182
- operatorArr[3] = 'Equal';
183
- }
184
- return operatorArr;
185
- },
186
- // 操作符数据转换 ( companyType,_g,大于,GreaterThan ---> companyType_g )
187
- operatorReChange(operator) {
188
- let operatorArr = new Array(2);
189
- if (operator == 'GreaterThan') {
190
- operatorArr[0] = '大于';
191
- operatorArr[1] = '_g';
192
- } else if (operator == 'LessThan') {
193
- operatorArr[0] = '小于';
194
- operatorArr[1] = '_l';
195
- } else if (operator == 'GreaterThanOrEqual') {
196
- operatorArr[0] = '大于等于';
197
- operatorArr[1] = '_ge';
198
- } else if (operator == 'LessThanOrEqual') {
199
- operatorArr[0] = '小于等于';
200
- operatorArr[1] = '_le';
201
- } else if (operator == 'NotEqual') {
202
- operatorArr[0] = '不等于';
203
- operatorArr[1] = '_n';
204
- } else if (operator == 'Contains') {
205
- operatorArr[0] = '文字包含';
206
- operatorArr[1] = '_c';
207
- } else {
208
- operatorArr[0] = '等于';
209
- operatorArr[1] = '';
210
- }
211
- return operatorArr;
212
- },
213
-
214
- // 筛选结果 将table对象转换为json字符串
215
- toFilteringJson() {
216
- let jsonStr = '{';
217
- if (this.dataFiltering.length > 0) {
218
- for (let key in this.dataFiltering) {
219
- jsonStr += '"' + this.dataFiltering[key].column + this.dataFiltering[key].rule + '":"' + this.dataFiltering[key].keyValue + '",';
220
- }
221
- jsonStr = jsonStr.substring(0, jsonStr.length - 1);
222
- jsonStr += '}';
223
- } else {
224
- jsonStr = '';
225
- }
226
- this.$emit('bindFilter', jsonStr);
227
- this.close();
228
- },
229
-
230
- // 打开筛选编辑表单
231
- filteringFmModalopen(row) {
232
- // // row = null表示新增
233
- if (row != null) {
234
- this.data.code = row.column;
235
- this.data.operator = row.operator;
236
- this.data.keyValue = row.keyValue;
237
- }
238
- // 表示新增
239
- else {
240
- this.data.code = '';
241
- this.data.rule = '';
242
- this.data.operator = 'Equal';
243
- this.data.keyValue = '';
244
- }
245
- this.filteringFmModal = true;
246
- },
247
-
248
- // 添加筛选字段表单确认
249
- async saveFilteringForm() {
250
- if (!!(this.data.code || '').trim() && !!(this.data.keyValue || '').trim() && !!(this.data.operator || '').trim()) {
251
- let ope = this.operatorReChange(this.data.operator);
252
- let checkSort = false;
253
- this.dataFiltering.forEach(item => {
254
- // 如果编辑列与原数据中有相同列,则做更新不做添加
255
- if (item.column == this.data.code) {
256
- checkSort = true;
257
- (item.operatorType = ope[0]), (item.rule = ope[1]), (item.operator = this.data.operator), (item.keyValue = this.data.keyValue);
258
- }
259
- });
260
- if (!checkSort) {
261
- this.dataFiltering.push({
262
- column: this.data.code,
263
- operatorType: ope[0],
264
- rule: ope[1],
265
- operator: this.data.operator,
266
- keyValue: this.data.keyValue
267
- });
268
- }
269
-
270
- this.filteringFmModal = false;
271
- } else {
272
- this.error('Front_Msg_Column_Filtering_Required');
273
- }
274
- },
275
- SaveFiltering() {
276
- this.toFilteringJson();
277
- },
278
-
279
- // 筛选字段的移动操作
280
- // 移除一行数据
281
- removefiltering(row, index) {
282
- if (row != null) {
283
- this.dataFiltering.splice(index, 1);
284
- }
285
- },
286
- // 上移
287
- upfiltering(row, index) {
288
- if (index > 0) {
289
- this.dataFiltering.splice(index, 1);
290
- this.dataFiltering.splice(index - 1, 0, row);
291
- }
292
- },
293
- // 下移
294
- downfiltering(row, index) {
295
- if (index < this.dataFiltering.length - 1) {
296
- this.dataFiltering.splice(index, 1);
297
- this.dataFiltering.splice(index + 1, 0, row);
298
- }
299
- },
300
- // 打开字段选择界面
301
- openSelect() {
302
- this.$refs.columnCheck.open(this.dataView.model, checked => {
303
- this.data.code = checked.code;
304
- this.data.name = checked.name;
305
- this.data.dataType = checked.dataType;
306
- this.data.source = checked.objColumn != null ? checked.objColumn.dataType : null;
307
- this.data.sourceDataCode = checked.objColumn != null ? 'id' : null;
308
- this.data.sourceDisplayCode =
309
- checked.objColumn != null &&
310
- checked.objColumn.columns.some(function (column) {
311
- return column.code === checked.objColumn.code + '.name';
312
- })
313
- ? 'name'
314
- : null;
315
- setTimeout(() => {
316
- //this.$forceUpdate();
317
- });
318
- });
319
- }
320
- }
321
- };
322
- </script>