mooho-base-admin-plus 2.4.27 → 2.4.29

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,7 +1,7 @@
1
1
  {
2
2
  "name": "mooho-base-admin-plus",
3
3
  "description": "MOOHO basic framework for admin by Vue3",
4
- "version": "2.4.27",
4
+ "version": "2.4.29",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -1,4 +1,6 @@
1
1
  import request from '../libs/request';
2
+ import dateFormat from 'date-fns/format';
3
+ import saveAs from 'file-saver';
2
4
 
3
5
  const res = 'CustomPage';
4
6
 
@@ -11,5 +13,20 @@ export default {
11
13
  id
12
14
  }
13
15
  });
16
+ },
17
+ async exportFile(ids) {
18
+ const result = await request({
19
+ url: `api/${res}/exportFile`,
20
+ method: 'post',
21
+ responseType: 'blob',
22
+ data: {
23
+ ids
24
+ }
25
+ });
26
+
27
+ const blob = new Blob([result], {
28
+ type: 'application/octet-stream'
29
+ });
30
+ saveAs(blob, 'CustomPage-' + dateFormat(new Date(), 'yyyyMMddHHmmss') + '.cp');
14
31
  }
15
32
  };
@@ -142,6 +142,26 @@
142
142
  <Option v-for="item in getDataSource(data, column)" :key="item.id" :value="item.id">{{ item.name }}</Option>
143
143
  </Select>
144
144
  </template>
145
+
146
+ <template v-else-if="column.controlType === 'ComboSelect'">
147
+ <Select
148
+ :ref="'control_' + column.code"
149
+ :model-value="parseComboData(data, column)"
150
+ @update:model-value="$event => setData(data, column.code, $event)"
151
+ :disabled="readonly || column.isReadonly"
152
+ :clearable="true"
153
+ filterable
154
+ remote
155
+ :remote-method="search => loadOption(data, column, search)"
156
+ :style="{ width: column.controlWidth == null ? null : column.controlWidth + 'px' }"
157
+ :placeholder="column.description"
158
+ :transfer="true"
159
+ @on-change="selected => onSelectDataChange(column, selected)"
160
+ >
161
+ <Option v-for="item in getDataSource(data, column)" :key="item.id" :value="item.id">{{ item.name }}</Option>
162
+ </Select>
163
+ </template>
164
+
145
165
  <template v-else-if="column.controlType === 'MultiComboSelect'">
146
166
  <Select
147
167
  :ref="'control_' + column.code"
@@ -907,7 +927,7 @@
907
927
 
908
928
  if (column.controlType == 'ComboSelect') {
909
929
  // 添加筛选内容
910
- this.$refs['control_' + column.code][0].$data.query = label;
930
+ //this.$refs['control_' + column.code][0].$data.query = label;
911
931
  }
912
932
 
913
933
  let newValue = pendings.find(i => i.value == v);
@@ -1133,7 +1133,7 @@
1133
1133
 
1134
1134
  if (column.controlType == 'ComboSelect') {
1135
1135
  // 添加筛选内容
1136
- this.$refs['control_' + column.code][0].$data.query = label;
1136
+ //this.$refs['control_' + column.code][0].$data.query = label;
1137
1137
  }
1138
1138
 
1139
1139
  let newValue = pendings.find(i => i.value == v);
@@ -1632,7 +1632,6 @@
1632
1632
  // 根据表达式取值(可筛选选择框)
1633
1633
  parseComboData(model, column) {
1634
1634
  let value = this.parseData(model, column.code);
1635
-
1636
1635
  this.loadComboDataLabel(model, column, value);
1637
1636
 
1638
1637
  return value;
@@ -1696,7 +1695,7 @@
1696
1695
 
1697
1696
  if (column.controlType == 'ComboSelect') {
1698
1697
  // 添加筛选内容
1699
- this.$refs['control_' + column.code][0].$data.query = label;
1698
+ //this.$refs['control_' + column.code][0].$data.query = label;
1700
1699
  }
1701
1700
 
1702
1701
  let newValue = pendings.find(i => i.value == v);
@@ -2367,7 +2367,7 @@
2367
2367
  return item[batchSelectDataCode] == selected[i].id;
2368
2368
  })
2369
2369
  ) {
2370
- let item = {};
2370
+ let item = this.getDefaultData();
2371
2371
  item[batchSelectDataCode] = selected[i].id;
2372
2372
  item[key] = selected[i];
2373
2373
 
@@ -2726,7 +2726,7 @@
2726
2726
 
2727
2727
  if (column.controlType == 'ComboSelect') {
2728
2728
  // 添加筛选内容
2729
- this.$refs['control_' + column.code + '_' + index].$data.query = label;
2729
+ //this.$refs['control_' + column.code + '_' + index].$data.query = label;
2730
2730
  //this.$refs['control_' + column.code + '_' + index].setQuery(label);
2731
2731
  }
2732
2732
 
@@ -4,7 +4,15 @@
4
4
  <PageHeader :title="$route.meta.title" :content="$route.meta.description" hidden-breadcrumb />
5
5
  </div>
6
6
  <Card :bordered="false" dis-hover class="ivu-mt">
7
- <view-table ref="table" view-code="CustomPage" @create="$refs.form.open()" @edit="({ row, index }) => $refs.form.open(row)">
7
+ <view-table ref="table" view-code="CustomPage" :selectEnable="true" @create="$refs.form.open()" @edit="({ row, index }) => $refs.form.open(row)">
8
+ <template #filterCommand>
9
+ <Button size="small" type="info" custom-icon="fa fa-cloud-download-alt" @click="exportFile()">{{ $t('Front_Btn_Export') }}</Button>
10
+ <file-upload url="api/CustomPage/importFile" accept=".cp" @on-success="importFileSuccess">
11
+ <template #>
12
+ <Button type="primary" custom-icon="fa fa-cloud-upload-alt" size="small">{{ $t('Front_Btn_Import') }}</Button>
13
+ </template>
14
+ </file-upload>
15
+ </template>
8
16
  <template #command="{}">
9
17
  <!-- <Button size="small"
10
18
  title="页面组件"
@@ -47,6 +55,7 @@
47
55
  </template>
48
56
  <script>
49
57
  import mixinPage from '../../mixins/page';
58
+ import customPageApi from '../../api/customPage';
50
59
 
51
60
  export default {
52
61
  name: 'system-page',
@@ -57,6 +66,28 @@
57
66
  },
58
67
  computed: {},
59
68
  created() {},
60
- methods: {}
69
+ methods: {
70
+ // 导出文件
71
+ exportFile() {
72
+ let ids = this.$refs.table.getSelected().map(x => {
73
+ return x.id;
74
+ });
75
+ if (ids.length > 0) {
76
+ customPageApi.exportFile(ids);
77
+ } else {
78
+ this.error('Front_Msg_Please_Select_Export_Item');
79
+ }
80
+ },
81
+ // 导入成功
82
+ importFileSuccess(res) {
83
+ if (res.code == 0) {
84
+ this.success('Front_Msg_Success', () => {
85
+ this.$refs.table.loadData();
86
+ });
87
+ } else {
88
+ this.error(res.message);
89
+ }
90
+ }
91
+ }
61
92
  };
62
93
  </script>
@@ -4,13 +4,26 @@
4
4
  <PageHeader :title="$route.meta.title" :content="$route.meta.description" hidden-breadcrumb />
5
5
  </div>
6
6
  <Card :bordered="false" dis-hover class="ivu-mt">
7
- <view-table ref="table" view-code="OpenUser" @create="$refs.form.open()" @edit="({ row, index }) => $refs.form.open(row)">
7
+ <view-table ref="table" view-code="OpenUser" @create="$refs.form.open()" @edit="edit">
8
8
  <template #command="{ row }">
9
9
  <Button size="small" :title="$t('Front_Btn_API_Permission')" type="primary" custom-icon="fa fa-atom" @click="openApiTableOpen(row)"></Button>
10
10
  </template>
11
11
  </view-table>
12
12
  </Card>
13
- <modal-form ref="form" view-code="OpenUserEdit" @on-after-save="$refs.table.loadData()" />
13
+ <modal-form ref="form" view-code="OpenUserEdit" @on-after-save="$refs.table.loadData()">
14
+ <template #column="{ data, column, code }">
15
+ <template v-if="code == 'password'">
16
+ <Input
17
+ type="password"
18
+ :model-value="parseData(data, column.code)"
19
+ @update:model-value="$event => setData(data, column.code, $event)"
20
+ :readonly="readonly || column.isReadonly"
21
+ :style="{ width: column.controlWidth == null ? null : column.controlWidth + 'px' }"
22
+ :maxlength="column.maxLength"
23
+ />
24
+ </template>
25
+ </template>
26
+ </modal-form>
14
27
  <modal-table ref="openApiTable" view-code="OpenApiCheck" :select-enable="true" :static="true" :footerEnable="true">
15
28
  <template #footer>
16
29
  <Button type="primary" custom-icon="fa fa-save" @click="saveOpenApiPermission()">{{ $t('Front_Btn_Save') }}</Button>
@@ -35,6 +48,10 @@
35
48
  computed: {},
36
49
  created() {},
37
50
  methods: {
51
+ edit({ row, index }) {
52
+ row.password = '$$$$$$$$';
53
+ this.$refs.form.open(row);
54
+ },
38
55
  // 打开接口列表界面
39
56
  async openApiTableOpen(row) {
40
57
  this.openUserID = row.id;