Commit a91c95ae authored by 王纵's avatar 王纵

接口请求汇总

parent 14e90b9d
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 14:30:48
* @LastEditTime: 2024-08-19 10:58:15
* @Version: 1.0.0
* @Description: 动态渲染-Lov
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -95,8 +95,7 @@
<script>
import {Cell, Switch, Icon, Popup, Search, Checkbox, Tag, Field} from 'vant';
import DLabel from './DLabel';
import hlsHttp from '../../../utils/hlsHttp';
import {getOrganizationId} from '../../../utils/utils';
import {getLovConfig, getLovData} from '../../../service';
export default {
name: 'DLov',
......@@ -184,7 +183,7 @@ export default {
},
methods: {
getLovConfig() {
hlsHttp.get(`/hpfm/v1/${getOrganizationId()}/lov-view/info`, {viewCode: this.fieldConfig.lovCode}).then(res => {
getLovConfig({viewCode: this.fieldConfig.lovCode}).then(res => {
this.lovConfig = res;
});
},
......@@ -194,11 +193,9 @@ export default {
lovCode,
page: this.page,
size: this.size,
tenantId: getOrganizationId(),
...this.cascadesParams
}
console.log('cascadesParams', this.cascadesParams)
hlsHttp.get(queryUrl, params).then(res => {
};
getLovData(queryUrl, params).then(res => {
this.lovData = this.lovData.concat(res.content.map(item => ({...item, _selected: false})));
if (res.totalElements > this.lovData.length) {
this.page = this.page + 1;
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-14 11:01:18
* @LastEditTime: 2024-08-19 11:01:14
* @Version: 1.0.0
* @Description: 动态渲染-Select
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -65,8 +65,7 @@
import {isNumber} from 'lodash';
import {Cell, Switch, Icon, Popup, Field} from 'vant';
import DLabel from './DLabel';
import hlsHttp from '../../../utils/hlsHttp';
import {getOrganizationId} from '../../../utils/utils';
import {getSelectOptions} from '../../../service';
export default {
name: 'DSelect',
......@@ -157,7 +156,7 @@ export default {
},
methods: {
getOptions() {
hlsHttp.get(`/hpfm/v1/${getOrganizationId()}/lovs/data`, {lovCode: this.fieldConfig.lookupCode, ...this.cascadesParams}).then(res => {
getSelectOptions({lovCode: this.fieldConfig.lookupCode, ...this.cascadesParams}).then(res => {
this.options = res.map(item => ({...item, _selected: false}));
});
},
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-16 10:13:28
* @LastEditTime: 2024-08-19 10:59:43
* @Version: 1.0.0
* @Description: 表单渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -138,7 +138,7 @@ import DDate from './FormItem/DDate';
import DCheckbox from './FormItem/DCheckbox';
import DUrl from './FormItem/DUrl';
import DTitle from '../DTitle';
import hlsHttp from '../../utils/hlsHttp';
import {getFormData} from '../../service';
export default {
name: 'DForm',
......@@ -230,7 +230,7 @@ export default {
if (this.formType === 'normal') {
if (this.tabInfo.readUrl) {
// console.log('D-form-activated', this.tabInfo.readUrl, JSON.stringify(this.queryParams))
const res = await hlsHttp.get(this.tabInfo.readUrl, this.queryParams)
const res = await getFormData(this.tabInfo.readUrl, this.queryParams)
this.fieldsObj = res.content.length ? res.content[0] : {};
this.dataLoadHandle(this.fieldsObj, this.tabInfo.tabCode); // 数据查询后的回调
this.addFormRef(this, this.tabInfo.tabCode); //正常表单保存表单组件实例,供页面整体保存时使用
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 09:41:54
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 17:06:59
* @LastEditTime: 2024-08-19 11:18:32
* @Version: 1.0.0
* @Description: 表格列渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -52,7 +52,8 @@ const DTableTd = {
render: function (h, context) {
return this.tdRender ?
this.tdRender(this.record, this.index) :
<span>{this.$slots.default || (this.columnValue() || '--')}</span>
<span><slot>{this.columnValue() || '--'}</slot></span>
// <span>{this.$slots.default || (this.columnValue() || '--')}</span>
}
};
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-16 10:27:18
* @LastEditTime: 2024-08-19 11:17:46
* @Version: 1.0.0
* @Description: 表格渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -16,7 +16,7 @@
:showBtns="!readOnly"
/>
<scroll
<d-scroll
ref="scroll" :pullUp="true" :pull-down="true" @pullingUp="getList"
@pullingDown="getList"
style="max-height: calc(100vh - 130px)"
......@@ -44,11 +44,14 @@
:index="pIndex"
:typeDisplay="column.validationTypeDisplay"
>
<template v-if="booleanType.includes(column.validationTypeDisplay)">
{{booleanDisplay[item[column.columnName]] || '--'}}
</template>
<template v-if="dateType[column.dataType]">
{{dateDescription(dateType[column.dataType], item[column.columnName]) || '--'}}
<template #default>
<fragment v-if="booleanType.includes(column.validationTypeDisplay)" >
{{booleanDisplay[item[column.columnName]] || '--'}}
</fragment>
<fragment v-if="dateType[column.dataType]" >
{{dateDescription(dateType[column.dataType], item[column.columnName]) || '--'}}
</fragment>
</template>
<!-- {{(column.validationTypeDisplay === 'Switch' ? (item[column.columnName] ? '是' : '否' ) : item[column.columnName]) || '--'}} -->
</d-table-td>
......@@ -81,17 +84,18 @@
</div>
</van-popup>
</scroll>
</d-scroll>
</fragment>
</template>
<script>
import {DScroll} from '../../LayoutComponents';
import DTitle from '../DTitle';
import DForm from '../DForm';
import DTableTd from './DTableTd.jsx';
import { Checkbox, CheckboxGroup, Popup, Button, Icon, Toast } from 'vant';
import hlsHttp from '../../utils/hlsHttp';
import {getDataSetName, getOrganizationId, dateFormat} from '../../utils/utils';
import {getTableData, saveTableRecord, deleteTableRecords} from '../../service';
import {getDataSetName, dateFormat} from '../../utils/utils';
import EventBus from '../../utils/eventBus';
export default {
......@@ -100,6 +104,7 @@ export default {
DTitle,
DForm,
DTableTd,
DScroll,
[Button.name]: Button,
[Checkbox.name]: Checkbox,
[CheckboxGroup.name]: CheckboxGroup,
......@@ -202,7 +207,7 @@ export default {
...this.queryParams,
...this.dynamicConfigInfo.queryParams,
}
hlsHttp.get(this.tabInfo.readUrl, params).then(res => {
getTableData(this.tabInfo.readUrl, params).then(res => {
this.tableData = this.tableData.concat(res.content || []);
this.dataLoadHandle(this.tableData, this.tabInfo.tabCode)
// EventBus.$on('dataLoad', this.tableData, this.tabInfo.tabCode); // 将查询的数据
......@@ -234,7 +239,7 @@ export default {
},
async saveRecord() {
const {allValues} = await this.$refs.dformRef.validate();
hlsHttp.post(this.tabInfo.createUrl, [{...allValues, ...this.dynamicConfigInfo.queryParams}]).then(() => {
saveTableRecord(this.tabInfo.createUrl, [{...allValues, ...this.dynamicConfigInfo.queryParams}]).then(() => {
this.visible = false;
Toast.success('保存成功!');
this.init();
......@@ -247,9 +252,7 @@ export default {
deleteRecords() {
let result = this.tableData.filter(o => this.checkResult.includes(o[this.tabInfo.primaryKey]));
const dataSetName = getDataSetName(this.dynamicConfigInfo.dataSetObject, this.tabInfo.tabCode);
const url = this.tabInfo.destroyUrl ||
`/hllc/v1/${getOrganizationId()}/dynamic-crud/delete${dataSetName ? '?datasetName=' + dataSetName : ''}`;
hlsHttp.delete(url , result).then(res=> {
deleteTableRecords(this.tabInfo.destroyUrl, dataSetName, result).then(res=> {
Toast.success('删除成功!');
this.init();
})
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-31 15:09:30
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 10:18:13
* @LastEditTime: 2024-08-19 11:09:17
* @Version: 1.0.0
* @Description: 页面按钮渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -47,8 +47,7 @@
<script>
import { Button, Icon, Popover, Toast } from 'vant';
import { v4 as uuidv4 } from 'uuid';
import hlsHttp from '../utils/hlsHttp';
import { getOrganizationId } from '../utils/utils';
import {save} from '../service';
export default {
name: 'LayoutButtons',
......@@ -145,9 +144,7 @@ export default {
}
}
const {layoutCode, metaKeys, dataSetMap} = this.getDataSets(dataSets);
hlsHttp.post(`/hllc/v1/${getOrganizationId()}/dynamic-crud/save`, [{
layoutCode, metaKeys, ...dataSetMap
}]).then(res => {
save([{layoutCode, metaKeys, ...dataSetMap}]).then(res => {
Toast.success('保存成功!');
})
},
......
......@@ -2,13 +2,13 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-09 10:54:02
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-09 14:42:17
* @LastEditTime: 2024-08-19 11:08:33
* @Version: 1.0.0
* @Description: 页面配置请求
* @Copyright: Copyright (c) 2021, Hand-RongJing
*/
import {getOrganizationId} from './utils/utils';
import {get} from './utils/hlsHttp'
import hlsHttp from './utils/hlsHttp'
export async function query(layoutCode, param) {
let config = {
......@@ -16,7 +16,7 @@ export async function query(layoutCode, param) {
param: {},
};
try {
const data = await get(`/hllc/v1/${getOrganizationId()}/doc-layouts/config/app/${layoutCode}`, param);
const data = await hlsHttp.get(`/hllc/v1/${getOrganizationId()}/doc-layouts/config/app/${layoutCode}`, param);
config.param = param;
config.datas = data || {};
return config;
......@@ -31,7 +31,7 @@ export async function queryRoute(match, param) {
param: {},
};
try {
const res = await get(
const res = await hlsHttp.get(
`/hllc/v1/${getOrganizationId()}/rule-engine-low-code?route=${window.encodeURIComponent(
match
)}`
......@@ -47,3 +47,49 @@ export async function queryRoute(match, param) {
}
}
// 获取下拉框值
export function getSelectOptions(params) {
return hlsHttp.get(`/hpfm/v1/${getOrganizationId()}/lovs/data`, params);
}
// 获取lov配置信息
export function getLovConfig(params) {
return hlsHttp.get(`/hpfm/v1/${getOrganizationId()}/lov-view/info`, params);
}
// 获取lov数据
export function getLovData(url, params) {
const newParams = {
...params,
tenantId: getOrganizationId(),
}
return hlsHttp.get(url, newParams);
}
// 获取表单数据
export function getFormData(url, params) {
return hlsHttp.get(url, params);
}
// 获取表格数据
export function getTableData(url, params) {
return hlsHttp.get(url, params);
}
// 表格单条数据保存
export function saveTableRecord(url, params) {
return hlsHttp.post(url, params);
}
// 表格删除
export function deleteTableRecords(destroyUrl, dataSetName, params) {
const url = destroyUrl ||
`/hllc/v1/${getOrganizationId()}/dynamic-crud/delete${dataSetName ? '?datasetName=' + dataSetName : ''}`;
return hlsHttp.delete(url, params);
}
// 页面大保存
export function save(params) {
return hlsHttp.post(`/hllc/v1/${getOrganizationId()}/dynamic-crud/save`, params);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment