提交 55bb21b2 编写于 作者: ibizdev's avatar ibizdev

zhujiamin 发布系统代码 [TrainSys,网页端]

上级 3ec071e0
......@@ -13,13 +13,13 @@
"dependencies": {
"@floating-ui/dom": "^1.0.11",
"@ibiz-template/command": "^0.0.1-beta.50",
"@ibiz-template/controller": "^0.0.1-beta.95",
"@ibiz-template/core": "^0.0.1-beta.95",
"@ibiz-template/model": "^0.0.1-beta.95",
"@ibiz-template/runtime": "^0.0.1-beta.95",
"@ibiz-template/service": "^0.0.1-beta.95",
"@ibiz-template/theme": "^0.0.1-beta.95",
"@ibiz-template/vue-util": "^0.0.1-beta.95",
"@ibiz-template/controller": "^0.0.1-beta.96",
"@ibiz-template/core": "^0.0.1-beta.96",
"@ibiz-template/model": "^0.0.1-beta.96",
"@ibiz-template/runtime": "^0.0.1-beta.96",
"@ibiz-template/service": "^0.0.1-beta.96",
"@ibiz-template/theme": "^0.0.1-beta.96",
"@ibiz-template/vue-util": "^0.0.1-beta.96",
"@ibiz/dynamic-model-api": "^2.1.24",
"@riophae/vue-treeselect": "^0.4.0",
"dayjs": "^1.11.7",
......
此差异已折叠。
......@@ -104,6 +104,7 @@ import {
IBizPickerDropDown,
IBizRadio,
IBizSpan,
IBizSpanLink,
NotSupportedEditor,
IBizGridInput,
IBizGridCheckbox,
......@@ -204,6 +205,7 @@ export const AppRegister = {
// 注册编辑器组件
v.component('GridEditor', GridEditor);
v.component('IBizSpan', IBizSpan);
v.component('IBizSpanLink', IBizSpanLink);
v.component('IBizInput', IBizInput);
v.component('IBizInputNumber', IBizInputNumber);
v.component('IBizCheckbox', IBizCheckbox);
......
import { ref, defineComponent, Ref, watch, computed } from 'vue';
import { getSpanProps, useNamespace } from '@ibiz-template/vue-util';
import dayjs from 'dayjs';
import '@ibiz-template/theme/style/components/editor/ibiz-span-link/ibiz-span-link.scss';
import { CodeListItem } from '@ibiz-template/service';
export const IBizSpanLink = defineComponent({
name: 'IBizSpanLink',
props: getSpanProps(),
setup(props) {
const ns = useNamespace('span-link');
const c = props.controller;
const text: Ref<string> = ref('');
const codeList = c.model.codeList;
// 值分隔符
let valueSeparator = ',';
if (codeList && codeList.valueSeparator) {
valueSeparator = codeList.valueSeparator;
}
watch(
() => props.value,
(newVal, oldVal) => {
if (newVal !== oldVal) {
if (newVal == null) {
text.value = '';
return;
}
if (c.valueFormat) {
text.value = dayjs(newVal).format(c.valueFormat);
} else {
text.value = `${newVal}`;
}
if (c.unitName) {
text.value += c.unitName;
}
}
},
{
immediate: true,
},
);
// 代码表数据
const items = ref<readonly CodeListItem[]>([]);
if (codeList) {
watch(
() => props.data,
newVal => {
c.loadCodeList(newVal).then(_codeList => {
items.value = _codeList;
});
},
{
immediate: true,
deep: true,
},
);
}
/** 代码表转换后文本 */
const codeListText = computed(() => {
if (!codeList || !props.value || items.value.length === 0) {
return undefined;
}
if (codeList.codeItemValueNumber) {
return items.value.find(item => item.value === props.value);
}
const values = (props.value as string).split(valueSeparator);
const selects = items.value.filter(item =>
values.includes(item.value as string & Number),
);
return selects.map(item => item.text).join(valueSeparator);
});
const openLinkView = async () => {
await c.openLinkView(props.data);
};
return {
ns,
text,
codeListText,
openLinkView,
};
},
render() {
let text = '';
if (this.codeListText != null) {
text = this.codeListText as string;
} else if (this.text != null) {
text = this.text;
}
return (
<span
class={[
this.ns.b(),
this.disabled ? this.ns.m('disabled') : '',
this.readonly ? this.ns.m('readonly') : '',
]}
>
<a onClick={this.openLinkView}>{text}</a>
</span>
);
},
});
export { IBizSpan } from './ibiz-span/ibiz-span';
export { IBizGridSpan } from './ibiz-grid-span/ibiz-grid-span';
export { IBizSpanLink } from './ibiz-span-link/ibiz-span-link';
......@@ -21,6 +21,7 @@ export function presetEditorProvider(): void {
}
// 标签
editorRegister.register('SPAN', new SpanEditorProvider());
editorRegister.register('SPAN_LINK', new SpanEditorProvider('SPAN_LINK'));
// 输入框
const textBoxEditorProvider = new TextBoxEditorProvider();
......
......@@ -19,6 +19,13 @@ export class SpanEditorProvider implements IEditorProvider {
gridEditor: string = 'IBizGridSpan';
constructor(editorType?: string) {
if (editorType === 'SPAN_LINK') {
this.formEditor = 'IBizSpanLink';
this.gridEditor = 'IBizSpanLink';
}
}
async createController(
editorModel: SpanEditorModel,
parentController: FormItemController | GridEditItemController,
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册