Commit ad09e035 authored by 王纵's avatar 王纵

页面跳转刷新数据、 提供数据给外层页面使用

parent c07e8f2a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12 * @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 14:29:10 * @LastEditTime: 2024-08-15 17:01:36
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 动态渲染-日期组件 * @Description: 动态渲染-日期组件
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
<script> <script>
import {Cell, DatetimePicker, Popup, Icon, Field, Picker} from 'vant'; import {Cell, DatetimePicker, Popup, Icon, Field, Picker} from 'vant';
import DLabel from './DLabel'; import DLabel from './DLabel';
import {dateFormat} from '../../../utils/utils';
export default { export default {
name: 'DDate', name: 'DDate',
...@@ -163,7 +164,7 @@ export default { ...@@ -163,7 +164,7 @@ export default {
}, },
dateParse(val) { dateParse(val) {
if (val) { if (val) {
const {value, description} = this.dateFormat(new Date(val)); const {value, description} = dateFormat(this.type, new Date(val));
this.currentValue = value; this.currentValue = value;
this.description = description; this.description = description;
} else { } else {
...@@ -200,7 +201,7 @@ export default { ...@@ -200,7 +201,7 @@ export default {
this.currentValue = `${date}-00-00`; this.currentValue = `${date}-00-00`;
this.description = date; this.description = date;
} else { } else {
const {value, description} = this.dateFormat(date); const {value, description} = dateFormat(this.type, date);
this.currentValue = value; this.currentValue = value;
this.description = description; this.description = description;
} }
...@@ -211,38 +212,38 @@ export default { ...@@ -211,38 +212,38 @@ export default {
this.$emit('input', this.currentValue); this.$emit('input', this.currentValue);
this.$emit('change', this.currentValue); this.$emit('change', this.currentValue);
}, },
dateFormat(time) { // 时间格式化 2019-09-08 // dateFormat(type, time) { // 时间格式化 2019-09-08
let year = time.getFullYear(); // let year = time.getFullYear();
let month = this.suppField(time.getMonth() + 1); // let month = this.suppField(time.getMonth() + 1);
let day = this.suppField(time.getDate()); // let day = this.suppField(time.getDate());
let hour = this.suppField(time.getHours()); // let hour = this.suppField(time.getHours());
let minutes = this.suppField(time.getMinutes()); // let minutes = this.suppField(time.getMinutes());
let seconds = this.suppField(time.getSeconds()); // let seconds = this.suppField(time.getSeconds());
let dateDescription = `${year}-${month}-${day}`; // let dateDescription = `${year}-${month}-${day}`;
let dateValue = `${year}-${month}-${day}`; // let dateValue = `${year}-${month}-${day}`;
if (['time', 'dateTime'].includes(this.type)) { // if (['time', 'dateTime'].includes(this.type)) {
dateDescription = `${year}-${month}-${day} ${hour}:${minutes}:${seconds}`; // dateDescription = `${year}-${month}-${day} ${hour}:${minutes}:${seconds}`;
dateValue = dateDescription; // dateValue = dateDescription;
} else if (this.type === 'month') { // } else if (type === 'month') {
dateDescription = `${year}-${month}`; // dateDescription = `${year}-${month}`;
dateValue = `${year}-${month}-01`; // dateValue = `${year}-${month}-01`;
} else if (this.type === 'year') { // } else if (type === 'year') {
dateDescription = `${year}`; // dateDescription = `${year}`;
dateValue = `${year}-00-00`; // dateValue = `${year}-00-00`;
} else if (this.type === 'week') { // } else if (type === 'week') {
const firstDayOfYear = new Date(year, 0, 1); // 获取当年的第一天 // const firstDayOfYear = new Date(year, 0, 1); // 获取当年的第一天
const pastDaysOfYear = (time - firstDayOfYear) / 86400000; // 计算已经过去的天数 // const pastDaysOfYear = (time - firstDayOfYear) / 86400000; // 计算已经过去的天数
const weekNum = Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); // 计算当前日期是第几周 // const weekNum = Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); // 计算当前日期是第几周
dateDescription = `${year}-${weekNum}周`; // dateDescription = `${year}-${weekNum}周`;
} // }
return { // return {
value: dateValue, // value: dateValue,
description: dateDescription // description: dateDescription
} // }
}, // },
suppField(num) { // 补充显示 // suppField(num) { // 补充显示
return `${num < 10 ? `0`: ''}${num}`; // return `${num < 10 ? `0`: ''}${num}`;
} // }
}, },
} }
</script> </script>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56 * @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 12:04:42 * @LastEditTime: 2024-08-15 17:48:20
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 表单渲染 * @Description: 表单渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -183,6 +183,7 @@ export default { ...@@ -183,6 +183,7 @@ export default {
default: () => [] default: () => []
} }
}, },
inject: ['dynamicInfo', 'addFormRef', 'setDataSetData', 'dataLoadHandle'],
data () { data () {
return { return {
fieldComponents: ['TextField',"TextArea", "NumberField", "EmailField","CentField"], fieldComponents: ['TextField',"TextArea", "NumberField", "EmailField","CentField"],
...@@ -196,13 +197,10 @@ export default { ...@@ -196,13 +197,10 @@ export default {
status: 'add', status: 'add',
} }
}, },
inject: ['dynamicInfo', 'addFormRef', 'setDataSetData'],
mounted() { mounted() {
console.log('D-form', this.fields)
this.init(); this.init();
}, },
activated() { activated() {
console.log('D-form-activated', this.fields)
this.init(); this.init();
}, },
methods: { methods: {
...@@ -226,8 +224,10 @@ export default { ...@@ -226,8 +224,10 @@ export default {
if (this.formType === 'normal') { if (this.formType === 'normal') {
if (this.tabInfo.readUrl) { 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 hlsHttp.get(this.tabInfo.readUrl, this.queryParams)
this.fieldsObj = res.content.length ? res.content[0] : {}; this.fieldsObj = res.content.length ? res.content[0] : {};
this.dataLoadHandle(this.fieldsObj, this.tabInfo.tabCode); // 数据查询后的回调
this.addFormRef(this, this.tabInfo.tabCode); //正常表单保存表单组件实例,供页面整体保存时使用 this.addFormRef(this, this.tabInfo.tabCode); //正常表单保存表单组件实例,供页面整体保存时使用
this.setDataSetData(this.tabInfo.tabCode, {...this.fieldsObj}); // 保存一份原始数据 this.setDataSetData(this.tabInfo.tabCode, {...this.fieldsObj}); // 保存一份原始数据
this.status = 'update'; this.status = 'update';
...@@ -241,7 +241,6 @@ export default { ...@@ -241,7 +241,6 @@ export default {
this.originFields.forEach(item => { this.originFields.forEach(item => {
if (item.validationTypeDisplay === 'CentField' && this.fieldsObj[item.columnName]) { if (item.validationTypeDisplay === 'CentField' && this.fieldsObj[item.columnName]) {
this.fieldsObj[item.columnName] = this.fieldsObj[item.columnName] * 100; this.fieldsObj[item.columnName] = this.fieldsObj[item.columnName] * 100;
console.log('CentField', this.fieldsObj[item.columnName])
} }
if (item.bind && this.fieldsObj[item.columnName]) { // 主要处理lov绑定字段 if (item.bind && this.fieldsObj[item.columnName]) { // 主要处理lov绑定字段
const bindField = item.bind.split('.'); const bindField = item.bind.split('.');
...@@ -259,7 +258,6 @@ export default { ...@@ -259,7 +258,6 @@ export default {
} }
}) })
this.originFieldsObj = {...this.fieldsObj}; this.originFieldsObj = {...this.fieldsObj};
console.log('this.fieldsObj', this.fieldsObj)
}, },
getInputType(type) { getInputType(type) {
if (type === 'TextArea') { if (type === 'TextArea') {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 09:41:54 * @Date: 2024-07-30 09:41:54
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-14 16:21:18 * @LastEditTime: 2024-08-15 17:06:59
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 表格列渲染 * @Description: 表格列渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -41,7 +41,7 @@ const DTableTd = { ...@@ -41,7 +41,7 @@ const DTableTd = {
methods: { methods: {
columnValue() { columnValue() {
if (['Lov', 'Select'].includes(this.typeDisplay)) { if (['Lov', 'Select'].includes(this.typeDisplay)) {
return this.record[`${this.columnName}Name`]; return this.record[`${this.columnName}Name`] || this.record[`${this.columnName}N`] || this.record[this.columnName];
} else { } else {
return this.record[this.columnName]; return this.record[this.columnName];
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56 * @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-14 16:22:00 * @LastEditTime: 2024-08-15 17:42:48
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 表格渲染 * @Description: 表格渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
<template v-if="booleanType.includes(column.validationTypeDisplay)"> <template v-if="booleanType.includes(column.validationTypeDisplay)">
{{booleanDisplay[item[column.columnName]] || '--'}} {{booleanDisplay[item[column.columnName]] || '--'}}
</template> </template>
<template v-if="dateType[column.dataType]">
{{dateDescription(dateType[column.dataType], item[column.columnName]) || '--'}}
</template>
<!-- {{(column.validationTypeDisplay === 'Switch' ? (item[column.columnName] ? '是' : '否' ) : item[column.columnName]) || '--'}} --> <!-- {{(column.validationTypeDisplay === 'Switch' ? (item[column.columnName] ? '是' : '否' ) : item[column.columnName]) || '--'}} -->
</d-table-td> </d-table-td>
</div> </div>
...@@ -88,7 +91,7 @@ import DForm from '../DForm'; ...@@ -88,7 +91,7 @@ import DForm from '../DForm';
import DTableTd from './DTableTd.jsx'; import DTableTd from './DTableTd.jsx';
import { Checkbox, CheckboxGroup, Popup, Button, Icon, Toast } from 'vant'; import { Checkbox, CheckboxGroup, Popup, Button, Icon, Toast } from 'vant';
import hlsHttp from '../../utils/hlsHttp'; import hlsHttp from '../../utils/hlsHttp';
import {getDataSetName, getOrganizationId} from '../../utils/utils'; import {getDataSetName, getOrganizationId, dateFormat} from '../../utils/utils';
import EventBus from '../../utils/eventBus'; import EventBus from '../../utils/eventBus';
export default { export default {
...@@ -122,9 +125,17 @@ export default { ...@@ -122,9 +125,17 @@ export default {
default: () => [], default: () => [],
} }
}, },
inject: ['dynamicInfo'], inject: ['dynamicInfo', 'dataLoadHandle'],
data () { data () {
return { return {
dateType: {
dateTime: 'datetime',
time: 'datetime',
month: 'year-month',
year: 'year-month',
week: 'date',
date: 'date',
},
booleanType: ['Switch', 'Radio', 'CheckBox'], booleanType: ['Switch', 'Radio', 'CheckBox'],
booleanDisplay: { booleanDisplay: {
1: '是', 1: '是',
...@@ -145,11 +156,9 @@ export default { ...@@ -145,11 +156,9 @@ export default {
} }
}, },
mounted() { mounted() {
this.dynamicConfigInfo = this.dynamicInfo();
this.init(); this.init();
}, },
activated() { activated() {
this.dynamicConfigInfo = this.dynamicInfo();
this.init(); this.init();
}, },
deactivated() { deactivated() {
...@@ -160,6 +169,8 @@ export default { ...@@ -160,6 +169,8 @@ export default {
}, },
methods: { methods: {
init() { init() {
this.$nextTick(() => {
this.dynamicConfigInfo = this.dynamicInfo();
if (this.tabInfo.queryTabCode) { if (this.tabInfo.queryTabCode) {
EventBus.$on('tableQuery', (data, queryTabCode) => { EventBus.$on('tableQuery', (data, queryTabCode) => {
if (this.tabInfo.queryTabCode === queryTabCode) { if (this.tabInfo.queryTabCode === queryTabCode) {
...@@ -177,6 +188,7 @@ export default { ...@@ -177,6 +188,7 @@ export default {
} else { } else {
this.showEdit = this.columns.some(o => !o.readOnly); // 存在可输入则显示编辑 this.showEdit = this.columns.some(o => !o.readOnly); // 存在可输入则显示编辑
} }
})
}, },
refresh() { refresh() {
this.page = 0; this.page = 0;
...@@ -184,7 +196,6 @@ export default { ...@@ -184,7 +196,6 @@ export default {
this.getList(); this.getList();
}, },
getList() { getList() {
// console.log('D-Table', this.columns)
const params = { const params = {
page: this.page, page: this.page,
size: this.size, size: this.size,
...@@ -193,27 +204,33 @@ export default { ...@@ -193,27 +204,33 @@ export default {
} }
hlsHttp.get(this.tabInfo.readUrl, params).then(res => { hlsHttp.get(this.tabInfo.readUrl, params).then(res => {
this.tableData = this.tableData.concat(res.content || []); this.tableData = this.tableData.concat(res.content || []);
this.dataLoadHandle(this.tableData, this.tabInfo.tabCode)
// EventBus.$on('dataLoad', this.tableData, this.tabInfo.tabCode); // 将查询的数据
if (res.totalElements > this.tableData.length) { if (res.totalElements > this.tableData.length) {
this.page = this.page + 1; this.page = this.page + 1;
this.$refs.scroll.update(false) this.$refs.scroll.update(false)
} else { } else {
this.$refs.scroll.update(true) this.$refs.scroll.update(true)
} }
}) })
}, },
showRecord(res, index) { showRecord(res, index) {
if (this.tabInfo.createUrl) {
this.record = {...res}; this.record = {...res};
this.recordIndex = index; this.recordIndex = index;
this.visible = true; this.visible = true;
// if (this.tabInfo.createUrl) {
// this.record = {...res};
// this.recordIndex = index;
// this.visible = true;
// console.log('this.record', this.record) // console.log('this.record', this.record)
// } else { } else {
// Toast.fail('保存接口未配置,请检查配置'); Toast.fail('保存接口未配置,请检查配置');
// } }
},
dateDescription(type, val) {
if (val) {
const res = dateFormat(type, new Date(val));
return res.description;
}
return val;
}, },
async saveRecord() { async saveRecord() {
const {allValues} = await this.$refs.dformRef.validate(); const {allValues} = await this.$refs.dformRef.validate();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-02 15:32:36 * @Date: 2024-08-02 15:32:36
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-14 09:19:09 * @LastEditTime: 2024-08-15 16:00:59
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 组件头部渲染 * @Description: 组件头部渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -86,13 +86,15 @@ export default { ...@@ -86,13 +86,15 @@ export default {
mounted() { mounted() {
this.init(); this.init();
}, },
// activated() {
// this.init();
// },
methods: { methods: {
init() { init() {
if(this.tabButtons.length > this.num) { if(this.tabButtons.length > this.num) {
this.defaultBtns = this.tabButtons.slice(0, this.num); this.defaultBtns = this.tabButtons.slice(0, this.num);
this.hideBtns = this.tabButtons.slice(this.num, this.tabButtons.length); this.hideBtns = this.tabButtons.slice(this.num, this.tabButtons.length);
this.actions = this.hideBtns.map(o => ({...o, text: o.description})); this.actions = this.hideBtns.map(o => ({...o, text: o.description}));
console.log('this.actions', this.actions)
} else { } else {
this.defaultBtns = [...this.tabButtons]; this.defaultBtns = [...this.tabButtons];
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 21:21:37 * @Date: 2024-07-30 21:21:37
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-14 16:35:48 * @LastEditTime: 2024-08-15 17:34:58
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: * @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -96,19 +96,6 @@ export class ColumnBuilder extends BaseBuilder { ...@@ -96,19 +96,6 @@ export class ColumnBuilder extends BaseBuilder {
getCustomizedRenderer(columnName) { getCustomizedRenderer(columnName) {
const currentRenderers = this.getCurrentRenderers(columnName, this.componentRenderers); const currentRenderers = this.getCurrentRenderers(columnName, this.componentRenderers);
let renderer = currentRenderers.length > 0 ? currentRenderers[0].renderer : undefined; let renderer = currentRenderers.length > 0 ? currentRenderers[0].renderer : undefined;
// if (this.type === 'Table') {
// renderer = currentRenderers.length > 0 ? currentRenderers[0].renderer : undefined;
// } else if (this.type === 'Form') {
// if (currentRenderers.length > 0 && isFunction(currentRenderers[0].renderer) && this.dataSet) {
// renderer = currentRenderers[0].renderer({
// dataSet: this.dataSet,
// record: this.dataSet ? this.dataSet.current : undefined,
// });
// }
// }
// if (currentRenderers.length > 0) {
// return { renderer, editor: currentRenderers[0].editor };
// }
return { renderer }; return { renderer };
} }
...@@ -216,115 +203,115 @@ export class ColumnBuilder extends BaseBuilder { ...@@ -216,115 +203,115 @@ export class ColumnBuilder extends BaseBuilder {
/** /**
* 表格、表单按钮建造类 * 表格、表单按钮建造类
*/ */
export class TabButtonBuilder extends BaseBuilder { // export class TabButtonBuilder extends BaseBuilder {
constructor() { // constructor() {
super(); // super();
/** // /**
* 组件级按钮 // * 组件级按钮
* @type {Array.<{name: string, description: string}>} // * @type {Array.<{name: string, description: string}>}
*/ // */
this.tabButtons = []; // this.tabButtons = [];
/** // /**
* // *
* @type {Array.<{tabCode: string, layoutCode: string, name: string, clickFunction: Function}>} // * @type {Array.<{tabCode: string, layoutCode: string, name: string, clickFunction: Function}>}
*/ // */
this.componentButtons = []; // this.componentButtons = [];
/** // /**
* 组件code // * 组件code
* @type {string} // * @type {string}
*/ // */
this.tabCode = ''; // this.tabCode = '';
this.layoutCode = ''; // this.layoutCode = '';
/** // /**
* 组件类型 // * 组件类型
* @type {string} // * @type {string}
*/ // */
this.type = ''; // this.type = '';
/** // /**
* 是否只读 // * 是否只读
* @type {boolean} // * @type {boolean}
*/ // */
this.readOnly = false; // this.readOnly = false;
this.setBtnRef = null; // this.setBtnRef = null;
this.createElement = () => {}; // this.createElement = () => {};
this.init(); // this.init();
} // }
/** // /**
* 获取点击事件 // * 获取点击事件
* @param {string} name - 名称 // * @param {string} name - 名称
* @returns {Function} 点击事件 // * @returns {Function} 点击事件
*/ // */
getClickFunction(name) { // getClickFunction(name) {
if (this.type === 'Form') { // if (this.type === 'Form') {
switch (name) { // switch (name) {
case 'query': // case 'query':
console.log('表单查询') // console.log('表单查询')
break; // break;
case 'reset': // case 'reset':
console.log('表单重置') // console.log('表单重置')
break; // break;
default: // default:
} // }
} else if (this.type === 'Table') { // } else if (this.type === 'Table') {
switch (name) { // switch (name) {
case 'create': // case 'create':
console.log('创建') // console.log('创建')
break; // break;
case 'query': // case 'query':
console.log('查询') // console.log('查询')
break; // break;
case 'export': // case 'export':
console.log('导出') // console.log('导出')
break; // break;
case 'remove': // case 'remove':
console.log('删除') // console.log('删除')
break; // break;
case 'save': // case 'save':
console.log('保存') // console.log('保存')
break; // break;
default: // default:
} // }
} // }
} // }
build() { // build() {
return this.tabButtons.map(btn => { // return this.tabButtons.map(btn => {
return this.createElement( // return this.createElement(
'h-button', // 元素类型 // 'h-button', // 元素类型
{ // 属性对象 // { // 属性对象
props: { // props: {
type: "primary", // type: "primary",
key: btn.name // key: btn.name
}, // },
// on: { // // on: {
// click: this.test, // // click: this.test,
// test2: function(){ // // test2: function(){
// console.log('22222') // // console.log('22222')
// } // // }
// }, // // },
nativeOn: { // nativeOn: {
click: () => this.getClickFunction(btn.name) // click: () => this.getClickFunction(btn.name)
} // }
}, // },
[ // 子元素数组 // [ // 子元素数组
btn.description, // 文本内容 // btn.description, // 文本内容
] // ]
) // )
}) // })
} // }
} // }
class BaseComponentBuilder extends BaseBuilder { class BaseComponentBuilder extends BaseBuilder {
constructor() { constructor() {
...@@ -371,7 +358,9 @@ class BaseComponentBuilder extends BaseBuilder { ...@@ -371,7 +358,9 @@ class BaseComponentBuilder extends BaseBuilder {
this.routeParams = {}; // 路由信息 this.routeParams = {}; // 路由信息
this.createElement = () => {} this.createElement = () => {};
this.parentProps = {};
super.init(); super.init();
} }
...@@ -443,50 +432,6 @@ class BaseComponentBuilder extends BaseBuilder { ...@@ -443,50 +432,6 @@ class BaseComponentBuilder extends BaseBuilder {
return columns; return columns;
} }
/**
* 包裹组件
* @param tab
* @param tabType
* @param cols
* @returns {*}
*/
// eslint-disable-next-line no-unused-vars
// wrapTab(tab, tabType, cols) {
// if (tabType === 'Form') {
// const {dataSet, tabCode, layoutCode} = tab.props;
// const {cascadeKey} = this;
// const Cmp = observer(
// class extends React.Component {
// render() {
// // eslint-disable-next-line no-shadow
// const {dataSet: ds, setTabRef, tabCode, layoutCode} = this.props;
// const refKey = `${parseCode(layoutCode)}_${parseCode(tabCode)}_formRef`;
// return cascadeKey && ds.current && !isNil(ds.current.get(cascadeKey)) ? (
// <Eva.Form
// setRef={(ref) => {
// setTabRef({[refKey]: ref})
// }}
// {...tab.props}
// >{cols[ds.current.get(cascadeKey)] || cols.DEFAULT}
// </Eva.Form>
// ) : (
// <Eva.Form
// setRef={(ref) => {
// setTabRef({[refKey]: ref})
// }}
// {...tab.props}
// >{cols.DEFAULT}
// </Eva.Form>
// );
// }
// }
// );
// return <Cmp dataSet={dataSet} setTabRef={this.setTabRef} tabCode={tabCode} layoutCode={layoutCode} />;
// }
// return <>{tab}</>;
// }
urlHandler(url) { urlHandler(url) {
const allInfo = { ...getCurrentUser(), ...this.routeParams }; const allInfo = { ...getCurrentUser(), ...this.routeParams };
if (url === undefined || url === null) { if (url === undefined || url === null) {
...@@ -539,32 +484,6 @@ class BaseComponentBuilder extends BaseBuilder { ...@@ -539,32 +484,6 @@ class BaseComponentBuilder extends BaseBuilder {
}, },
[] []
); );
// return this.wrapTab(<div>table</div>, this.tabType, this.loadTableColumns(this.columns))
// props = {
// ...props,
// dataSet: this.dataSet,
// dataSetName: this.dataSet == null ? '' : this.dataSet.name,
// border: true,
// height: undefined,
// style: props.height ? {height: props.height} : undefined,
// buttons: this.buttons,
// id: undefined,
// header: this.getHeader(props),
// showFold: props.showFold === 'Y',
// defaultFold: props.defaultFold === 'Y',
// ...this.loadTableProps(props),
// };
// return this.wrapTab(
// <Tab
// {...props}
// ref={ref => {
// this.setTabRef({[refKey]: ref})
// }}
// >{this.loadTableColumns(this.columns)}
// </Tab>,
// this.tabType,
// this.loadTableColumns(this.columns)
// );
case 'Form': case 'Form':
// 不存在baseTable意味着是查询组件 只有查询组件有按钮 // 不存在baseTable意味着是查询组件 只有查询组件有按钮
const { cascadeKey } = this; const { cascadeKey } = this;
...@@ -598,17 +517,13 @@ class BaseComponentBuilder extends BaseBuilder { ...@@ -598,17 +517,13 @@ class BaseComponentBuilder extends BaseBuilder {
} }
// 处理嵌入布局 // 处理嵌入布局
case 'Layout': case 'Layout':
// const components = this.staticComponents.filter(item => item.tabCode === this.tabCode); const components = this.staticComponents.filter(item => item.tabCode === this.tabCode);
// if (components && components.length) { if (components && components.length) {
// const StaticComponent = components[0].component const StaticComponent = components[0].component;
// return React.cloneElement(StaticComponent) return StaticComponent();
// } }
// return <></> return null;
return this.createElement(
'div',
{},
['嵌入布局']
)
default: default:
throw new Error('Unsupported tab type'); throw new Error('Unsupported tab type');
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56 * @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-13 17:52:35 * @LastEditTime: 2024-08-15 17:07:36
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 查询表单渲染 * @Description: 查询表单渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -81,9 +81,12 @@ export default { ...@@ -81,9 +81,12 @@ export default {
mounted() { mounted() {
this.configDatas = this.dynamicInfo().config; this.configDatas = this.dynamicInfo().config;
}, },
activated() {
this.configDatas = this.dynamicInfo().config;
},
methods: { methods: {
onSearch() { // 搜索 onSearch() { // 搜索
console.log('souusole') // console.log('souusole')
}, },
showForm() { showForm() {
this.show = true; this.show = true;
...@@ -103,6 +106,7 @@ export default { ...@@ -103,6 +106,7 @@ export default {
values[key] = formValues[key]; values[key] = formValues[key];
} }
}); });
delete values._status;
EventBus.$emit('tableQuery', values, this.tabInfo.tabCode); EventBus.$emit('tableQuery', values, this.tabInfo.tabCode);
this.show = false; this.show = false;
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 09:41:54 * @Date: 2024-07-30 09:41:54
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-13 16:43:34 * @LastEditTime: 2024-08-15 16:44:45
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: * @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
import Vue from 'vue'; import Vue from 'vue';
import {Button} from 'vant' import {Button} from 'vant'
import layouts from '../layout/index.js'; import layouts from '../layout/index.js';
import {ColumnBuilder, TabButtonBuilder, ComponentBuilder} from './LayoutBuilder.jsx' import {ColumnBuilder, ComponentBuilder} from './LayoutBuilder.jsx'
import QueryForm from './QueryForm'; import QueryForm from './QueryForm';
import DTable from './DTable'; import DTable from './DTable';
import DForm from './DForm'; import DForm from './DForm';
...@@ -53,13 +53,9 @@ const ConfigRenderComponent = { ...@@ -53,13 +53,9 @@ const ConfigRenderComponent = {
}, },
mounted() { mounted() {
this.configInfo = this.dynamicInfo().config; this.configInfo = this.dynamicInfo().config;
console.log('this.componentRenderers', this.componentRenderers, this.dynamicInfo())
console.log(this.$refs);
}, },
activated () { activated () {
this.configInfo = this.dynamicInfo().config; this.configInfo = this.dynamicInfo().config;
console.log('激活', this.dynamicInfo().queryParams);
}, },
methods: { methods: {
getTabs(layoutTabs, state, layoutCode, createElement) { getTabs(layoutTabs, state, layoutCode, createElement) {
...@@ -67,17 +63,6 @@ const ConfigRenderComponent = { ...@@ -67,17 +63,6 @@ const ConfigRenderComponent = {
const parentTabCode = layoutTab.tabCode; const parentTabCode = layoutTab.tabCode;
// 布局类型 // 布局类型
const layoutName = layoutTab.tabType; const layoutName = layoutTab.tabType;
// 静态嵌入布局
if (layoutName === 'Layout' && layoutTab.tabStatusType === 'STATIC') {
const currentStaticLayoutTabs = this.staticLayoutTabs.filter(
value => value.tabCode === parentTabCode
);
if (currentStaticLayoutTabs.length > 0 && currentStaticLayoutTabs[0].component) {
const StaticComponent = currentStaticLayoutTabs[0].component;
return [<StaticComponent {...this} />];
}
return [];
}
if (!layoutTab.childrenTabs || layoutTab.childrenTabs.length === 0) { if (!layoutTab.childrenTabs || layoutTab.childrenTabs.length === 0) {
return []; return [];
} }
...@@ -86,7 +71,6 @@ const ConfigRenderComponent = { ...@@ -86,7 +71,6 @@ const ConfigRenderComponent = {
let components; let components;
if (this.layoutComponents.some(item => layoutTab.childrenTabs[0].tabType === item)) { if (this.layoutComponents.some(item => layoutTab.childrenTabs[0].tabType === item)) {
layoutTab.childrenTabs.forEach(childrenTab => { layoutTab.childrenTabs.forEach(childrenTab => {
// componentNames.push(childrenTab.description);
componentNames.push({code: childrenTab.tabCode, label: childrenTab.description}) componentNames.push({code: childrenTab.tabCode, label: childrenTab.description})
}); });
components = this.getTabs(layoutTab.childrenTabs, state, layoutCode, createElement); components = this.getTabs(layoutTab.childrenTabs, state, layoutCode, createElement);
...@@ -95,20 +79,16 @@ const ConfigRenderComponent = { ...@@ -95,20 +79,16 @@ const ConfigRenderComponent = {
const { const {
tabType, tabType,
tabCode, tabCode,
baseTable,
parentTable,
tabFields, tabFields,
tabButtons,
description description
} = childrenTab; } = childrenTab;
// componentNames.push(description);
componentNames.push({code: tabCode, label: description}); componentNames.push({code: tabCode, label: description});
const columns = new ColumnBuilder() const columns = new ColumnBuilder()
.withFields(tabFields) .withFields(tabFields)
.withType(tabType) .withType(tabType)
.withTabCode(tabCode) .withTabCode(tabCode)
// .withTableFooterRenderers(tableFooterRenderers)
.withLayoutCode(childrenTab.layoutCode || layoutCode) .withLayoutCode(childrenTab.layoutCode || layoutCode)
.withParentTabCode(parentTabCode) .withParentTabCode(parentTabCode)
.withComponentRenderers(this.componentRenderers) .withComponentRenderers(this.componentRenderers)
...@@ -117,21 +97,16 @@ const ConfigRenderComponent = { ...@@ -117,21 +97,16 @@ const ConfigRenderComponent = {
const findField = find(tabFields, { formatCascadeFlag: 'Y' }); const findField = find(tabFields, { formatCascadeFlag: 'Y' });
return new ComponentBuilder() return new ComponentBuilder()
// .withDataSet(dataSet)
// .withHistoryDataSet(dataSets[`history_${dataSetName}`])
// .withDifference(differenceMap[dataSetName])
.withCascadeKey(findField && findField.columnName) .withCascadeKey(findField && findField.columnName)
// .withHistoryButtonName(historyButtonName)
// .withCurrentButtonName(currentButtonName)
.withRouteParams(this.queryParams) .withRouteParams(this.queryParams)
.withCreateElement(createElement) .withCreateElement(createElement)
.withTabType(tabType) .withTabType(tabType)
.withColumns(columns) .withColumns(columns)
// .withButtons(buttons)
.withLayoutCode(childrenTab.layoutCode || layoutCode) .withLayoutCode(childrenTab.layoutCode || layoutCode)
.withTabCode(childrenTab.tabCode) .withTabCode(childrenTab.tabCode)
.withProps(childrenTab) .withProps(childrenTab)
// .withComponentHeaderExtras(componentHeaderExtras) .withStaticComponents(this.staticLayoutTabs)
.withParentProps(this)
.build(); .build();
}); });
} }
...@@ -146,7 +121,7 @@ const ConfigRenderComponent = { ...@@ -146,7 +121,7 @@ const ConfigRenderComponent = {
// 为了弥补缺少的实例 // 为了弥补缺少的实例
// 提供第二个参数作为上下文 // 提供第二个参数作为上下文
render: function (h, context) { render: function (h, context) {
console.log('context', context, this.configInfo) // console.log('context', context, this.configInfo)
const { layoutCode, layoutTabs = [] } = this.configInfo; const { layoutCode, layoutTabs = [] } = this.configInfo;
return <div style="height: 100%">{layoutTabs.length ? this.getTabs(layoutTabs, this, layoutCode, h) : null}</div>; return <div style="height: 100%">{layoutTabs.length ? this.getTabs(layoutTabs, this, layoutCode, h) : null}</div>;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56 * @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 10:48:44 * @LastEditTime: 2024-08-15 17:42:29
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: * @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -17,8 +17,9 @@ ...@@ -17,8 +17,9 @@
<h-content> <h-content>
<van-loading size="24px" vertical v-if="loading">加载中...</van-loading> <van-loading size="24px" vertical v-if="loading">加载中...</van-loading>
<config-render-component <config-render-component
v-if="configDatas.id" v-if="configDatas.id && !loading"
:componentRenderers="componentRenderers" :componentRenderers="componentRenderers"
:staticLayoutTabs="staticLayoutTabs"
/> />
</h-content> </h-content>
<layout-buttons <layout-buttons
...@@ -35,8 +36,7 @@ import LayoutButtons from './LayoutButtons'; ...@@ -35,8 +36,7 @@ import LayoutButtons from './LayoutButtons';
import ConfigRenderComponent from './ConfigRenderComponent/index.jsx'; import ConfigRenderComponent from './ConfigRenderComponent/index.jsx';
import {query, queryRoute} from './service' import {query, queryRoute} from './service'
import './index.less' import './index.less'
import { getOrganizationId } from './utils/utils'; import EventBus from './utils/eventBus';
import Constants from './utils/Constants';
export default { export default {
name: 'Dynamic', name: 'Dynamic',
...@@ -65,6 +65,18 @@ export default { ...@@ -65,6 +65,18 @@ export default {
layoutButtons: { // 布局按钮方法 layoutButtons: { // 布局按钮方法
type: Object, type: Object,
default: () => ({}) default: () => ({})
},
staticLayoutTabs: { // 静态布局内容
type: Array,
default: () => []
},
configLoadHandle: {
type: Function,
default: () => {}
},
dataLoadHandle: {
type: Function,
default: () => {}
} }
}, },
data () { data () {
...@@ -82,13 +94,8 @@ export default { ...@@ -82,13 +94,8 @@ export default {
return { return {
addFormRef: this.addFormRef, addFormRef: this.addFormRef,
setDataSetData: this.setDataSetData, setDataSetData: this.setDataSetData,
dynamicInfo: () => ({ // 配置的所有信息 dataLoadHandle: this.dataLoadHandle,
layoutCode: this.layoutCode, dynamicInfo: this.getDynamicInfo
config: this.configDatas,
dataSetObject: this.dataSetObject,
queryParams: this.qpara,
componentRenderers: this.componentRenderers
})
}; };
}, },
created() { created() {
...@@ -104,6 +111,7 @@ export default { ...@@ -104,6 +111,7 @@ export default {
...this.$route.query ...this.$route.query
} }
console.log('activated', this.params) console.log('activated', this.params)
this.layoutCodeQuery();
}, },
beforeMount() { beforeMount() {
this.layoutCodeQuery(); this.layoutCodeQuery();
...@@ -118,16 +126,19 @@ export default { ...@@ -118,16 +126,19 @@ export default {
if (this.params.readOnly === "YES" || this.params.readOnly == 'true') { if (this.params.readOnly === "YES" || this.params.readOnly == 'true') {
readOnly = true readOnly = true
} }
// if (disabled) {
// readOnly = disabled const qpara = {
// }
this.qpara = {
...this.params, ...this.params,
readOnly, readOnly,
}; }
// if (this.store.config.datas !== null && isEqual(this.qpara, this.store.config.param)) {
// return; if (JSON.stringify(this.qpara) === JSON.stringify(qpara)) {
// } this.loading = false;
return;
}
this.qpara = qpara;
let res = {datas: {}, params: {}} let res = {datas: {}, params: {}}
if (this.layoutCode) { if (this.layoutCode) {
res = await query(this.layoutCode, this.qpara); res = await query(this.layoutCode, this.qpara);
...@@ -138,7 +149,8 @@ export default { ...@@ -138,7 +149,8 @@ export default {
this.configDatas = {...res.datas}; this.configDatas = {...res.datas};
this.params = res.params; this.params = res.params;
this.dataSetObject = this.transformDateSetTree(res.datas.dataSetsTree); this.dataSetObject = this.transformDateSetTree(res.datas.dataSetsTree);
// this.getDataSets(res.datas.dataSetsTree)
this.configLoadHandle(this.getDynamicInfo());
}, },
transformDateSetTree(tree) { transformDateSetTree(tree) {
let obj = {}; let obj = {};
...@@ -157,7 +169,16 @@ export default { ...@@ -157,7 +169,16 @@ export default {
setDataSetData(tabCode, data) { setDataSetData(tabCode, data) {
this.dataSetObject[tabCode].data = data; this.dataSetObject[tabCode].data = data;
}, },
getDynamicInfo() {
return { // 配置的所有信息
layoutCode: this.layoutCode, // 布局编码
config: this.configDatas, // 页面配置信息
dataSetObject: this.dataSetObject, // 页面datasetTree的转换,方便快速找出datasetname
queryParams: this.qpara, // 页面查询参数
EventBus: EventBus
// componentRenderers: this.componentRenderers // 组件渲染内容
}
}
}, },
} }
</script> </script>
......
/*
* @Description: 布局抽象类
* @Author: huangtianyang
* @Date: 2020-01-13 15:56
*/
import { Bind } from 'lodash-decorators';
import React, { Component } from 'react';
/**
* @extends {Component}
* @ReactProps {React.ReactElement} components
*/
class AbstractLayout extends Component {
constructor(props) {
super(props);
this.counter = 0;
}
/**
* 包装渲染布局下组件
* @param {Array.<React.ReactElement>} components 组件
*/
@Bind()
packageContents(components) {
return components;
}
@Bind()
getCounter() {
this.counter += 1;
return this.counter;
}
/**
* 获取框架
* @param {*} content
* @returns {React.ReactElement}
*/
@Bind()
getLayoutFrame(content) {
return <div>{content}</div>;
}
render() {
const { components } = this.props;
return <>{this.getLayoutFrame(this.packageContents(components))}</>;
}
}
export default AbstractLayout;
/*
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 17:19:32
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-07-30 17:34:57
* @Version: 1.0.0
* @Description: 布局抽象类
* @Copyright: Copyright (c) 2021, Hand-RongJing
*/
import Vue from 'vue';
import { Fragment } from 'vue-fragment';
const AbstractLayout = {
// functional: true,
// Props 是可选的
props: {
components: { // 是否需要返回键
type: Boolean,
default: true
},
staticLayoutTabs: {
type: Array,
default: () => [],
}
},
data () {
return {
counter: 0, // 配置信息
}
},
methods: {
/**
* 包装渲染布局下组件
* @param {Array.<VueElement>} components 组件
*/
packageContents(components) {
return components;
},
getCounter() {
this.counter += 1;
return this.counter;
},
/**
* 获取框架
* @param {*} content
* @returns {Element}
*/
getLayoutFrame(content) {
return <div>{content}</div>;
}
},
// 为了弥补缺少的实例
// 提供第二个参数作为上下文
render: function (h, context) {
return <div></div>
return <Fragment>{this.getLayoutFrame(this.packageContents(components))}</Fragment>;
}
};
export default AbstractLayout;
/*
* @Description: In User Settings Edit
* @Author: gaoyang
* @Date: 2020-05-26 15:57
*/
import AbstractLayout from '../AbstractLayout';
export default class TabPane extends AbstractLayout {
/**
* @override
* @param {React.ReactElement} content
* @returns {*}
*/
getLayoutFrame(content) {
return content;
}
/**
* @override
* @param components 组件
* @returns {*[]}
*/
packageContents(components) {
return components;
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-02 11:06:33 * @Date: 2024-08-02 11:06:33
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-06 12:03:35 * @LastEditTime: 2024-08-15 16:44:04
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: * @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
......
/*
* @Description: In User Settings Edit
* @Author: huangtianyang
* @Date: 2020-03-09 12:16
*/
import { Bind } from 'lodash-decorators';
import { debounce } from 'lodash';
import NavigationContentItem from './NavigationContentItem';
import React from 'react';
import classNames from 'classnames';
import styles from './index.less';
/**
*
* @param components {Array,<React.ReactElement>} -组件数组
* @param componentNames {Array.<String>} -组件描述名
* @returns {*}
* @constructor
*/
class NavigationContent extends React.Component {
constructor(props) {
super(props);
this.state = {
activeIndex: 0,
windowHeight: window.innerHeight
};
this.ref = React.createRef();
this.scrollTops = [];
this.nodes = [];
this.content = null;
this.disableScrollHandler = false;
}
@Bind()
resizeHandler() {
if (window.parent === window.self) {
this.setState({ windowHeight: window.innerHeight });
}
}
componentDidMount() {
window.addEventListener('resize', this.resizeHandler);
const node = this.ref.current;
if (node) {
const { children } = node;
this.content = node;
for (let i = 0; i < children.length; i++) {
this.nodes.push(children[i]);
this.scrollTops.push(children[i].offsetTop - node.offsetTop);
}
}
}
componentWillUnmount() {
window.removeEventListener('resize', this.resizeHandler);
}
@Bind()
wheelHandler() {
this.disableScrollHandler = false;
}
@Bind()
getIndex(index) {
this.setState({ activeIndex: index });
}
@Bind()
getScrollTop(index) {
return this.nodes[index].offsetTop - this.content.offsetTop;
}
render() {
const { windowHeight, activeIndex } = this.state;
const { componentNames, components } = this.props;
return (
<div
className={classNames(styles['navigation-content'])}
style={{ maxHeight: windowHeight - 210 }}
>
<div
ref={this.ref}
onWheel={this.wheelHandler}
onScroll={event => {
if (!this.disableScrollHandler) {
debounce(e => {
e.persist();
const { scrollTop } = this.ref.current;
for (let i = 0; i < this.scrollTops.length; i++) {
const minTop = this.scrollTops[i];
const maxTop = this.scrollTops[i + 1];
if (
(scrollTop >= minTop && maxTop && scrollTop < maxTop) ||
(scrollTop >= minTop && !maxTop)
) {
this.setState({ activeIndex: i });
}
}
}, 100)(event);
}
}}
className={styles.content}
>
{components.map((component, index) => {
return (
<NavigationContentItem
parentRef={this.ref}
key={
/* eslint-disable-next-line react/no-array-index-key */
index
}
component={component}
index={index}
getIndex={() => this.getIndex(index)}
/>
);
})}
</div>
<div className={styles.menus}>
{componentNames.map((name, index) => {
return (
<div
key={name}
onClick={() => {
// eslint-disable-next-line no-undef
if (this.ref.current) {
this.ref.current.scrollTop = this.getScrollTop(index);
this.disableScrollHandler = true;
this.setState({ activeIndex: index });
}
}}
className={classNames(styles.menu, index === activeIndex ? styles.active : null)}
>
<div className={classNames(styles.menuCro, index === activeIndex ? styles.active : null,index===componentNames.length-1?styles.menuCroLast:null)} />
<span>{name}</span>
</div>
);
})}
</div>
</div>
);
}
}
export default NavigationContent;
/*
* @Description: In User Settings Edit
* @Author: huangtianyang
* @Date: 2020-03-09 22:21
*/
import React from 'react';
import classNames from 'classnames';
import styles from './index.less';
const NavigationContentItem = ({ component, index, getIndex }) => {
return (
<div
className={classNames(styles.item)}
onClick={() => {
getIndex(index);
}}
>
{component}
</div>
);
};
export default NavigationContentItem;
/*
* @Description: Server Config
* @Author: huangtianyang
* @Date: 2020-03-09 12:11
*/
import NavigationContent from './NavigationContent';
import React from 'react';
import styles from './index.less';
const NavigationBar = ({ components, componentNames }) => {
return (
<div className={styles['hls-navigation-bar']}>
<NavigationContent components={components} componentNames={componentNames} />
</div>
);
};
export default NavigationBar;
@import '~leaf-ui/lib/style/themes/default.less';
.hls-navigation-bar {
.navigation-content {
display: flex;
margin: 8px 0 0 0;
.menus {
flex-shrink: 0;
height: 100%;
background: #fff;
overflow: auto;
padding: 0 5px 0 10px;
width: 150px;
.menu {
height: 35px;
line-height: 35px;
margin: 4px 6px;
cursor: pointer;
font-family: @font-family;
font-weight: bold;
font-size: 13px;
color: #6a6a6a;
letter-spacing: 0.59px;
text-align: center;
display: flex;
align-items: center;
&.active {
color: @leaf-primary-color;
border-radius: 4px;
}
span{
margin-left: 10px;
width: 100px;
max-width: 100px;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
white-space: nowrap;
}
}
.menuCro {
width: 10px;
height: 10px;
border-radius: 10px;
border: 2px solid rgba(0,0,0,.2);
position: relative;
&::after {
position: absolute;
content: '';
height: 30px;
border: 1px solid rgba(0,0,0,.2);
margin-top: 8px;
margin-left: -1px;
}
&.active {
border: 2px solid @leaf-primary-color;
}
}
.menuCroLast{
&::after{
position: absolute;
content: '';
height: 0;
border: 0;
}
}
}
.content {
width: 100%;
overflow-x: hidden;
overflow-y: auto;
padding: 0 8px;
.item {
margin: 5px 0;
}
}
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 14:39:47 * @Date: 2024-07-30 14:39:47
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 11:48:09 * @LastEditTime: 2024-08-15 17:02:23
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 工具类 * @Description: 工具类
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -33,35 +33,48 @@ const getDataSetName = (config, tabCode) => { ...@@ -33,35 +33,48 @@ const getDataSetName = (config, tabCode) => {
return config[tabCode].dataSetName || ''; return config[tabCode].dataSetName || '';
}; };
const suppField = (num) => { // 补充显示
return `${num < 10 ? `0`: ''}${num}`;
}
/** /**
* 判断对象为空 * 日期格式话
* @param v * @param {*} type 日期类型
* @return {boolean} * @param {*} time date类型
* @returns
*/ */
const isEmpty = (v) => { const dateFormat = (type, time) => { // 时间格式化 2019-09-08
if (typeof v === 'undefined') { let year = time.getFullYear();
return true let month = suppField(time.getMonth() + 1);
} let day = suppField(time.getDate());
if (v === undefined || v === 'undefined' || v === null || v === '' || v === 'null') { let hour = suppField(time.getHours());
return true let minutes = suppField(time.getMinutes());
} let seconds = suppField(time.getSeconds());
let dateDescription = `${year}-${month}-${day}`;
let dateValue = `${year}-${month}-${day}`;
if (['time', 'dateTime'].includes(type)) {
dateDescription = `${year}-${month}-${day} ${hour}:${minutes}:${seconds}`;
dateValue = dateDescription;
switch (typeof v) { } else if (type === 'month') { // 月
case 'string' : dateDescription = `${year}-${month}`;
if (v.trim().length === 0) { dateValue = `${year}-${month}-01`;
return true
} } else if (type === 'year') { // 年
break dateDescription = `${year}`;
case 'boolean' : dateValue = `${year}-00-00`;
if (!v) {
return true } else if (type === 'week') { // 周
const firstDayOfYear = new Date(year, 0, 1); // 获取当年的第一天
const pastDaysOfYear = (time - firstDayOfYear) / 86400000; // 计算已经过去的天数
const weekNum = Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); // 计算当前日期是第几周
dateDescription = `${year}-${weekNum}周`;
} }
break return {
case 'object' : value: dateValue,
return undefined !== v.length && v.length === 0 description: dateDescription
} }
return false };
}
const getOrganizationId = () => { const getOrganizationId = () => {
return 0; return 0;
...@@ -128,6 +141,7 @@ export { ...@@ -128,6 +141,7 @@ export {
getCustomized, getCustomized,
getHeaderExtrasProp, getHeaderExtrasProp,
getDataSetName, getDataSetName,
dateFormat,
getOrganizationId, getOrganizationId,
getCurrentUser getCurrentUser
}; };
...@@ -31,3 +31,7 @@ ...@@ -31,3 +31,7 @@
@popover-action-width: auto; @popover-action-width: auto;
@popover-action-font-size: 12px; @popover-action-font-size: 12px;
@popover-light-text-color: rgba(19,19,19,0.80); @popover-light-text-color: rgba(19,19,19,0.80);
::-webkit-scrollbar {
display: none;
}
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-31 18:41:49 * @Date: 2024-07-31 18:41:49
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 10:13:48 * @LastEditTime: 2024-08-15 17:42:00
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: * @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -14,20 +14,29 @@ ...@@ -14,20 +14,29 @@
:componentRenderers="componentRenderers" :componentRenderers="componentRenderers"
:headerButtons="headerButtons" :headerButtons="headerButtons"
:layoutButtons="layoutButtons" :layoutButtons="layoutButtons"
:staticLayoutTabs="staticLayoutTabs"
:configLoadHandle="configLoadHandle"
:dataLoadHandle="dataLoadHandle"
ref="dynamicRef"
/> />
</template> </template>
<script> <script>
import {Button} from 'vant';
export default { export default {
name: 'DynamicDetail', name: 'DynamicDetail',
components: {
[Button.name]: Button
},
data () { data () {
return { return {
buttonText: '嵌入内容',
componentRenderers: [ componentRenderers: [
{ {
tabCode: 'F_BASIC', tabCode: 'F_BASIC',
columnName: 'test', columnName: 'test',
renderer: (field, getRecord) => { renderer: (field, getRecord) => {
console.log('------->>>', field, getRecord())
return <span>328388</span> return <span>328388</span>
}, },
}, },
...@@ -46,35 +55,34 @@ export default { ...@@ -46,35 +55,34 @@ export default {
submit: this.handleHeaderSubmit, submit: this.handleHeaderSubmit,
remove: this.handleDelete, remove: this.handleDelete,
copy: this.handleCopyClick copy: this.handleCopyClick
} },
// layoutButtons: [ staticLayoutTabs: [
// { {
// name: 'submit', tabCode: 'F_STATIC',
// clickFunction: () => { component: (props) => {
// this.handleHeaderSubmit() return (
// }, <van-button onClick={this.handleCopyClick}>{this.buttonText}</van-button>
// }, )
// {
// name: 'remove', },
// clickFunction: () => { },
// this.handleDelete() ]
// },
// },
// {
// name: 'copy',
// clickFunction: () => {
// this.handleCopyClick()
// },
// },
// ],
} }
}, },
methods: { methods: {
configLoadHandle(config) { // 查询配置信息之后的回调
console.log('configLoadHandle', config)
},
dataLoadHandle(data, tabCode) {
console.log(tabCode, data);
},
handleCopyClick() { handleCopyClick() {
console.log('复制') console.log('复制')
this.buttonText = '复制'
}, },
handleHeaderSubmit() { handleHeaderSubmit() {
console.log("点击提交") console.log("点击提交")
this.buttonText = '提交'
}, },
handleDelete() { handleDelete() {
console.log("点击删除") console.log("点击删除")
......
...@@ -2,14 +2,20 @@ ...@@ -2,14 +2,20 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 11:02:22 * @Date: 2024-07-29 11:02:22
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-14 16:22:37 * @LastEditTime: 2024-08-15 17:43:42
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: * @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
--> -->
<template> <template>
<Dynamic layoutCode="PRJ005" :componentRenderers="componentRenderers" /> <Dynamic
layoutCode="CN001"
:componentRenderers="componentRenderers"
:configLoadHandle="configLoadHandle"
:dataLoadHandle="dataLoadHandle"
ref="dynamicRef"
/>
</template> </template>
<script> <script>
...@@ -34,6 +40,12 @@ export default { ...@@ -34,6 +40,12 @@ export default {
} }
}, },
methods: { methods: {
configLoadHandle(config) { // 查询配置信息之后的回调
console.log('configLoadHandle', config)
},
dataLoadHandle(data, tabCode) {
console.log(tabCode, data);
},
toDetail(record) { toDetail(record) {
this.$router.push({ this.$router.push({
name: 'DynamicDetail', name: 'DynamicDetail',
......
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