Skip to content

Commit 4e675a6

Browse files
Merge branch 'opentiny:develop' into develop
2 parents 857e5f3 + 52ab14b commit 4e675a6

22 files changed

Lines changed: 420 additions & 237 deletions

File tree

docs/advanced-features/conditional-rendering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
![addvar-15](./imgs/addvar-15.png)
1111

1212
3. 选中组件,在组件属性设置面板选择“高级”。
13-
4. 单击“是否渲染“后的 ![变量绑定图标](./imgs/icon-code.png)<!-- {.image-inline} -->,进行变量绑定。
13+
4. 单击“是否渲染“后的 <img src="./imgs/icon-code.png" alt="变量绑定图标" class="image-inline">,进行变量绑定。
1414

1515
**图 2** 绑定变量
1616

docs/advanced-features/loop-rendering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
![addVar-17](./imgs/addVar-17.png)
1111

1212
3. 选中组件,在组件属性设置面板选择“高级”。
13-
4. 单击“循环数据“后的![](./imgs/icon-code.png)<!-- {.image-inline} -->,进行变量绑定。
13+
4. 单击“循环数据“后的<img src="./imgs/icon-code.png" alt="" class="image-inline">,进行变量绑定。
1414
5. 选择绑定的变量,单击“确定”。
1515

1616
**图 2** 绑定变量

docs/basic-features/frontend-application-flow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
## 步骤一:新建文件夹
99

1010
1. 单击应用模块内的“应用开发”,进入设计器。
11-
2. 在左侧插件栏中,单击![页面管理插件图标](./imgs/icon-page.png)<!-- {.image-inline} -->,进入“页面管理“页面。
11+
2. 在左侧插件栏中,单击<img src="./imgs/icon-page.png" alt="页面管理插件图标" class="image-inline">,进入“页面管理“页面。
1212
3. 单击“页面管理“的新增文件夹按钮。
1313
4. 设置基本属性,如输入文件夹ID及设置路由。
1414

docs/basic-features/inline-style-variable-binding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
![addVar](./imgs/addVar.png)
1313

1414
2. 画布中选中组件,在组件属性设置面板选择“样式”。
15-
3. 单击行内样式的编辑框后的![变量绑定图标](./imgs/icon-code.png)<!-- {.image-inline} -->
15+
3. 单击行内样式的编辑框后的<img src="./imgs/icon-code.png" alt="变量绑定图标" class="image-inline">。
1616
4. 在弹框中进行变量绑定。
1717

1818
**图 2** 绑定变量

docs/basic-features/internationalization.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
## 添加国际化词条
1111

12-
1. 在左侧插件栏中,单击![国际化插件图标](./imgs/icon-i18n.png)<!-- {.image-inline} -->,展开国际化资源页面。
12+
1. 在左侧插件栏中,单击<img src="./imgs/icon-i18n.png" alt="国际化插件图标" class="image-inline">,展开国际化资源页面。
1313
2. 单击“新增词条”。
1414
3. 编辑key,中文和英文内容
1515

@@ -25,8 +25,8 @@
2525

2626
## 编辑国际化词条
2727

28-
1. 在左侧插件栏中,单击![国际化插件图标](./imgs/icon-i18n.png)<!-- {.image-inline} -->,展开国际化资源页面。
29-
2. 选择待操作的词条,单击“操作”列的![编辑图标](./imgs/icon-edit.png)<!-- {.image-inline} -->
28+
1. 在左侧插件栏中,单击<img src="./imgs/icon-i18n.png" alt="国际化插件图标" class="image-inline">,展开国际化资源页面。
29+
2. 选择待操作的词条,单击“操作”列的<img src="./imgs/icon-edit.png" alt="编辑图标" class="image-inline">。
3030

3131
**图 2** 编辑词条
3232
![编辑词条](./imgs/editWord.png "editWord")
@@ -36,16 +36,16 @@
3636

3737
## 单个删除国际化词条
3838

39-
1. 在左侧插件栏中,单击![国际化插件图标](./imgs/icon-i18n.png)<!-- {.image-inline} -->,展开国际化资源页面。
40-
2. 选择待操作的词条,单击“操作”列的![删除图标](./imgs/icon-del.png)<!-- {.image-inline} -->
39+
1. 在左侧插件栏中,单击<img src="./imgs/icon-i18n.png" alt="国际化插件图标" class="image-inline">,展开国际化资源页面。
40+
2. 选择待操作的词条,单击“操作”列的<img src="./imgs/icon-del.png" alt="删除图标" class="image-inline">。
4141
3. 在弹框中单击“确定”,完成国际化词条删除。
4242

4343
**图 3** 删除词条
4444
![删除词条](./imgs/delWord.png "delWord")
4545

4646
## 批量删除国际化词条
4747

48-
1. 在左侧插件栏中,单击![国际化插件图标](./imgs/icon-i18n.png)<!-- {.image-inline} -->,展开国际化资源页面。
48+
1. 在左侧插件栏中,单击<img src="./imgs/icon-i18n.png" alt="国际化插件图标" class="image-inline">,展开国际化资源页面。
4949
2. 勾选待操作的词条,单击“批量删除”。
5050

5151
**图 4** 批量删除词条
@@ -55,8 +55,8 @@
5555

5656
## 复制词条键值
5757

58-
1. 在左侧插件栏中,单击![国际化插件图标](./imgs/icon-i18n.png)<!-- {.image-inline} -->,展开国际化资源页面。
59-
2. 选择待操作的词条,单击“操作”列的![复制图标](./imgs/icon-copy.png)<!-- {.image-inline} -->
58+
1. 在左侧插件栏中,单击<img src="./imgs/icon-i18n.png" alt="国际化插件图标" class="image-inline">,展开国际化资源页面。
59+
2. 选择待操作的词条,单击“操作”列的<img src="./imgs/icon-copy.png" alt="复制图标" class="image-inline">。
6060

6161
页面显示“复制成功”,完成词条键值复制。
6262

@@ -65,10 +65,10 @@
6565

6666
## 使用国际化词条
6767

68-
1. 在左侧插件栏中,单击![物料插件图标](./imgs/icon-add.png)<!-- {.image-inline} -->,展开物料资产包。
68+
1. 在左侧插件栏中,单击<img src="./imgs/icon-add.png" alt="物料插件图标" class="image-inline">,展开物料资产包。
6969
2. 在物料资产包中选择组件,例如button组件,并拖拽至中心画布中。
7070
3. 选中组件,在组件属性设置面板选择“属性”。
71-
4. 选中文案参数旁的![变量绑定图标](./imgs/icon-code.png)<!-- {.image-inline} -->,进行变量绑定。
71+
4. 选中文案参数旁的<img src="./imgs/icon-code.png" alt="变量绑定图标" class="image-inline">,进行变量绑定。
7272
5. 输入变量t\('lowcode.67564435'\),其中lowcode.67564435为词条的key值,可参考[复制词条键值](#复制词条键值)获取。
7373

7474
**图 6** 绑定变量

docs/basic-features/outline-tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 查看大纲树
22

3-
在左侧插件栏中,单击![大纲树插件图标](./imgs/icon-tree.png)<!-- {.image-inline} -->,展开并查看页面大纲树。
3+
在左侧插件栏中,单击<img src="./imgs/icon-tree.png" alt="大纲树插件图标" class="image-inline">,展开并查看页面大纲树。
44

55
## 大纲树UI展示
66
![outline-tree-1](./imgs/outline-tree-1.png)

docs/basic-features/using-components.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
## 从物料面板中添加组件
1010

11-
1. 在左侧插件栏中,单击![物料插件图标](./imgs/icon-add.png)<!-- {.image-inline} -->,展开物料资产包。
11+
1. 在左侧插件栏中,单击<img src="./imgs/icon-add.png" alt="物料插件图标" class="image-inline">,展开物料资产包。
1212
2. 在物料资产包中选择组件,并拖拽至中心画布中。
1313

1414
![拖入组件](./imgs/dragComponent.gif)

packages/builtinComponent/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"preview": "vite preview"
2323
},
2424
"dependencies": {
25-
"@opentiny/tiny-engine-meta-register": "workspace:*",
26-
"vite-plugin-css-injected-by-js": "^3.3.1"
25+
"vite-plugin-css-injected-by-js": "^3.3.1",
26+
"axios": "~0.28.0"
2727
},
2828
"devDependencies": {
2929
"@vitejs/plugin-vue": "^5.1.2",

packages/builtinComponent/src/components/BaseForm.vue

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import {
6262
Row as TinyRow,
6363
Col as TinyCol
6464
} from '@opentiny/vue'
65-
import { getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register'
65+
import axios from 'axios'
6666
6767
const props = defineProps({
6868
style: {
@@ -115,11 +115,9 @@ const insertApi = (data = modelData.value) => {
115115
if (!apiInfo) {
116116
return undefined
117117
}
118-
return getMetaApi(META_SERVICE.Http)
119-
.post(apiInfo.url, { nameEn: formModel.value.nameEn, params: data })
120-
.catch((err) => {
121-
throw new Error(err)
122-
})
118+
return axios.post(apiInfo.url, { nameEn: formModel.value.nameEn, params: data }).catch((err) => {
119+
throw new Error(err)
120+
})
123121
}
124122
125123
const updateApi = (data = modelData.value) => {
@@ -129,7 +127,7 @@ const updateApi = (data = modelData.value) => {
129127
}
130128
const id = data.id
131129
delete data.id
132-
return getMetaApi(META_SERVICE.Http)
130+
return axios
133131
.post(apiInfo.url, {
134132
nameEn: formModel.value.nameEn,
135133
data: data,
@@ -147,7 +145,7 @@ const queryApi = ({ currentPage, pageSize, data } = {}) => {
147145
}
148146
// 处理查询参数
149147
const params = Object.fromEntries(formModel.value.parameters.map((item) => [item.prop, null]))
150-
return getMetaApi(META_SERVICE.Http)
148+
return axios
151149
.post(apiInfo.url, {
152150
currentPage: currentPage || 1,
153151
pageSize: pageSize || 10,
@@ -168,11 +166,9 @@ const deleteApi = () => {
168166
if (!apiInfo) {
169167
return undefined
170168
}
171-
return getMetaApi(META_SERVICE.Http)
172-
.post(apiInfo.url, { id: modelData.value?.id, nameEn: formModel.value.nameEn })
173-
.catch((err) => {
174-
throw new Error(err)
175-
})
169+
return axios.post(apiInfo.url, { id: modelData.value?.id, nameEn: formModel.value.nameEn }).catch((err) => {
170+
throw new Error(err)
171+
})
176172
}
177173
178174
const initFormData = () => {

packages/builtinComponent/src/components/BasePage.vue

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
</tiny-col>
5656
</tiny-row>
5757
</tiny-form>
58-
<div>
58+
<div class="operator-group">
5959
<tiny-button type="primary" :size="pageState?.size" @click="addRow"> 新增 </tiny-button>
6060
<tiny-button :size="pageState?.size" @click="search"> 搜索 </tiny-button>
6161
<tiny-button :size="pageState?.size" @click="resetSearchForm"> 重置 </tiny-button>
@@ -179,7 +179,7 @@ import {
179179
Notify
180180
} from '@opentiny/vue'
181181
import * as tinyVueIcon from '@opentiny/vue-icon'
182-
import { getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register'
182+
import axios from 'axios'
183183
184184
const props = defineProps({
185185
style: {
@@ -302,9 +302,17 @@ const insertApi = (data = addFormData.value) => {
302302
if (!apiInfo) {
303303
return undefined
304304
}
305-
return getMetaApi(META_SERVICE.Http)
305+
return axios
306306
.post(apiInfo.url, { nameEn: pageModel.value.nameEn, params: data })
307307
.then((res) => {
308+
if (res.data.error) {
309+
Notify({
310+
type: 'error',
311+
message: res.data.error.message,
312+
position: 'top-right'
313+
})
314+
return
315+
}
308316
Notify({
309317
type: 'success',
310318
message: '新增成功',
@@ -322,15 +330,27 @@ const updateApi = (data = addFormData.value) => {
322330
if (!apiInfo) {
323331
return undefined
324332
}
325-
const id = data.id
326-
delete data.id
327-
return getMetaApi(META_SERVICE.Http)
333+
const requestData = {}
334+
pageModel.value.parameters.forEach((item) => {
335+
if (data[item.prop]) {
336+
requestData[item.prop] = data[item.prop]
337+
}
338+
})
339+
return axios
328340
.post(apiInfo.url, {
329341
nameEn: pageModel.value.nameEn,
330-
data: data,
331-
params: { id }
342+
data: requestData,
343+
params: { id: data.id }
332344
})
333345
.then((res) => {
346+
if (res.data.error) {
347+
Notify({
348+
type: 'error',
349+
message: res.data.error.message,
350+
position: 'top-right'
351+
})
352+
return
353+
}
334354
Notify({
335355
type: 'success',
336356
message: '修改成功',
@@ -350,7 +370,7 @@ const queryApi = (data = formData.value) => {
350370
}
351371
// 处理查询参数
352372
const params = Object.fromEntries(pageModel.value.parameters.map((item) => [item.prop, null]))
353-
return getMetaApi(META_SERVICE.Http)
373+
return axios
354374
.post(apiInfo.url, {
355375
currentPage: pagerState.currentPage || 1,
356376
pageSize: pagerState.pageSize || 10,
@@ -362,8 +382,16 @@ const queryApi = (data = formData.value) => {
362382
}
363383
})
364384
.then((res) => {
365-
tableData.value = res.list
366-
pagerState.total = res.total
385+
if (res.data.error) {
386+
Notify({
387+
type: 'error',
388+
message: res.data.error.message,
389+
position: 'top-right'
390+
})
391+
return
392+
}
393+
tableData.value = res.data.data.list
394+
pagerState.total = res.data.data.total
367395
emit('update:tableData', tableData.value)
368396
return res
369397
})
@@ -377,14 +405,23 @@ const deleteApi = (evidence) => {
377405
if (!apiInfo) {
378406
return undefined
379407
}
380-
return getMetaApi(META_SERVICE.Http)
408+
return axios
381409
.post(apiInfo.url, { ...evidence, nameEn: pageModel.value.nameEn })
382410
.then((res) => {
411+
if (res.data.error) {
412+
Notify({
413+
type: 'error',
414+
message: res.data.error.message,
415+
position: 'top-right'
416+
})
417+
return
418+
}
383419
Notify({
384420
type: 'success',
385421
message: '已删除',
386422
position: 'top-right'
387423
})
424+
queryApi()
388425
return res
389426
})
390427
.catch((err) => {
@@ -440,6 +477,7 @@ const initEditFormData = () => {
440477
441478
const resetSearchForm = () => {
442479
initSearchFormData()
480+
queryApi()
443481
}
444482
445483
const addRow = () => {
@@ -534,4 +572,8 @@ defineExpose({
534572
text-align: center;
535573
line-height: 40px;
536574
}
575+
576+
.operator-group {
577+
margin-bottom: 10px;
578+
}
537579
</style>

0 commit comments

Comments
 (0)