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

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

上级 53e6111d
......@@ -8,8 +8,8 @@ pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
dist/**
dist-ssr/**
*.local
# Editor directories and files
......
registry=http://npm.zhr.icu/
......@@ -11,14 +11,14 @@
"lint:style": "stylelint 'src/**/*.scss'"
},
"dependencies": {
"@ibiz-template/command": "^0.0.1-alpha.37",
"@ibiz-template/controller": "^0.0.1-alpha.40",
"@ibiz-template/core": "^0.0.1-alpha.40",
"@ibiz-template/model": "^0.0.1-alpha.39",
"@ibiz-template/runtime": "^0.0.1-alpha.40",
"@ibiz-template/service": "^0.0.1-alpha.40",
"@ibiz-template/theme": "^0.0.1-alpha.40",
"@ibiz-template/vue-util": "^0.0.1-alpha.40",
"@ibiz-template/command": "^0.0.1-alpha.41",
"@ibiz-template/controller": "^0.0.1-alpha.41",
"@ibiz-template/core": "^0.0.1-alpha.41",
"@ibiz-template/model": "^0.0.1-alpha.41",
"@ibiz-template/runtime": "^0.0.1-alpha.41",
"@ibiz-template/service": "^0.0.1-alpha.41",
"@ibiz-template/theme": "^0.0.1-alpha.41",
"@ibiz-template/vue-util": "^0.0.1-alpha.41",
"@ibiz/dynamic-model-api": "^2.1.5",
"dayjs": "^1.11.6",
"lodash-es": "^4.17.21",
......
......@@ -3,14 +3,14 @@ lockfileVersion: 5.4
specifiers:
'@commitlint/cli': ^17.2.0
'@commitlint/config-conventional': ^17.2.0
'@ibiz-template/command': ^0.0.1-alpha.37
'@ibiz-template/controller': ^0.0.1-alpha.40
'@ibiz-template/core': ^0.0.1-alpha.40
'@ibiz-template/model': ^0.0.1-alpha.39
'@ibiz-template/runtime': ^0.0.1-alpha.40
'@ibiz-template/service': ^0.0.1-alpha.40
'@ibiz-template/command': ^0.0.1-alpha.41
'@ibiz-template/controller': ^0.0.1-alpha.41
'@ibiz-template/core': ^0.0.1-alpha.41
'@ibiz-template/model': ^0.0.1-alpha.41
'@ibiz-template/runtime': ^0.0.1-alpha.41
'@ibiz-template/service': ^0.0.1-alpha.41
'@ibiz-template/theme': ^0.0.1-alpha.40
'@ibiz-template/vue-util': ^0.0.1-alpha.40
'@ibiz-template/vue-util': ^0.0.1-alpha.41
'@ibiz/dynamic-model-api': ^2.1.5
'@types/lodash-es': ^4.17.6
'@types/node': ^18.11.9
......@@ -61,14 +61,14 @@ specifiers:
vue-tsc: ^1.0.9
dependencies:
'@ibiz-template/command': 0.0.1-alpha.37
'@ibiz-template/controller': 0.0.1-alpha.40_ih5ecz32a4ibmstgfcjyi3tpam
'@ibiz-template/core': 0.0.1-alpha.40_qzytosuu5eg3bvoa74ldx6evva
'@ibiz-template/model': 0.0.1-alpha.39_yslesr4iih24kokbsmhl36awki
'@ibiz-template/runtime': 0.0.1-alpha.40_5kdc272ska6i73jbiqdmud7zjq
'@ibiz-template/service': 0.0.1-alpha.40_q2gs43s4muf6wdt2kzef2bkl5u
'@ibiz-template/command': 0.0.1-alpha.41
'@ibiz-template/controller': 0.0.1-alpha.41_qiggmtl4kdjswnuiwqfbo6qhu4
'@ibiz-template/core': 0.0.1-alpha.41_qzytosuu5eg3bvoa74ldx6evva
'@ibiz-template/model': 0.0.1-alpha.41_yslesr4iih24kokbsmhl36awki
'@ibiz-template/runtime': 0.0.1-alpha.41_htntrmo5c6ybvxgifiug67fuva
'@ibiz-template/service': 0.0.1-alpha.41_pqm4hovalqiydv7ewa72l7tngy
'@ibiz-template/theme': 0.0.1-alpha.40
'@ibiz-template/vue-util': 0.0.1-alpha.40_ugp54vtapc454oxcr74b5b6rda
'@ibiz-template/vue-util': 0.0.1-alpha.41_7ld4khxzprgdjxio25v3wsr5ie
'@ibiz/dynamic-model-api': 2.1.5_qx-util@0.4.4
dayjs: 1.11.6
lodash-es: 4.17.21
......@@ -661,14 +661,14 @@ packages:
resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==}
dev: true
/@ibiz-template/command/0.0.1-alpha.37:
resolution: {integrity: sha512-7KPS16osgsOHgPekTC8W2SKMtVIF4lsY6XP5IPttkQiZU6nhBDLs4MoRyRvhHPA30aKHzgxmYT/Whl186apoqg==}
/@ibiz-template/command/0.0.1-alpha.41:
resolution: {integrity: sha512-zT43FCKM343d4rpfRx2YhcoymriTdAn3Ujb598U39hxLltJZpEp4LkqR4HqCVB0MazpfWA4QRviifPbQPA+3jw==}
dependencies:
qx-util: 0.4.4
dev: false
/@ibiz-template/controller/0.0.1-alpha.40_ih5ecz32a4ibmstgfcjyi3tpam:
resolution: {integrity: sha512-s9xXqRStODQBPvam7UVKx/U7oqj1yM/qHhZH+K0RMMLVEn/IoCp3ir1asjbgPSqBWxwJ4JM5ZIfvWm4dyyJxkg==}
/@ibiz-template/controller/0.0.1-alpha.41_qiggmtl4kdjswnuiwqfbo6qhu4:
resolution: {integrity: sha512-NOeX2Kf4qgx6LUR9KUrt+/Dm8RJPXRk81UBL0mDQw5eQFy11GFPQhVoY5Ls/xQk8Wrxn6IOYOiu/JrLNxp3heg==}
peerDependencies:
'@ibiz-template/core': ^0.0.1-alpha.2
'@ibiz-template/model': ^0.0.1-alpha.2
......@@ -677,18 +677,18 @@ packages:
lodash-es: ^4.17.21
qx-util: ^0.4.4
dependencies:
'@ibiz-template/core': 0.0.1-alpha.40_qzytosuu5eg3bvoa74ldx6evva
'@ibiz-template/model': 0.0.1-alpha.39_yslesr4iih24kokbsmhl36awki
'@ibiz-template/runtime': 0.0.1-alpha.40_5kdc272ska6i73jbiqdmud7zjq
'@ibiz-template/service': 0.0.1-alpha.40_q2gs43s4muf6wdt2kzef2bkl5u
'@ibiz-template/core': 0.0.1-alpha.41_qzytosuu5eg3bvoa74ldx6evva
'@ibiz-template/model': 0.0.1-alpha.41_yslesr4iih24kokbsmhl36awki
'@ibiz-template/runtime': 0.0.1-alpha.41_htntrmo5c6ybvxgifiug67fuva
'@ibiz-template/service': 0.0.1-alpha.41_pqm4hovalqiydv7ewa72l7tngy
async-validator: 4.2.5
dayjs: 1.11.6
lodash-es: 4.17.21
qx-util: 0.4.4
dev: false
/@ibiz-template/core/0.0.1-alpha.40_qzytosuu5eg3bvoa74ldx6evva:
resolution: {integrity: sha512-8O411O3StgmbohRkOhh1GkdSln3xH4CEIqBqc/sVtPw/1YuTP/LaLr8g/qfCiuq8KriVOk1IDkKMZrPrVqG7Qg==}
/@ibiz-template/core/0.0.1-alpha.41_qzytosuu5eg3bvoa74ldx6evva:
resolution: {integrity: sha512-zrrt/cCGFj4eOYSjmhqc7D9v8rPQ71CbE6UJjvOuDrTu4BSjktqNC5L1tX/fl+mt8V0x1FkaZH1vrSSktwstKw==}
peerDependencies:
lodash-es: ^4.17.21
qx-util: ^0.4.4
......@@ -703,8 +703,8 @@ packages:
- debug
dev: false
/@ibiz-template/model/0.0.1-alpha.39_yslesr4iih24kokbsmhl36awki:
resolution: {integrity: sha512-HPpCR8W6enEjWxGdYdDKJJdirO4Qx5dIpYNfZVrmhHX7dd+Ov9OnpunnIXeTLk8RFzFfQEf9ZuOTziU7QX5dfg==}
/@ibiz-template/model/0.0.1-alpha.41_yslesr4iih24kokbsmhl36awki:
resolution: {integrity: sha512-aakOQlZNTS7lIl0J3vICitswVN3xqACDSNj1HBLoM/mYshyjtpcwyY84/6KurAoGWI9y0KVGpBJjLufGsVevhA==}
peerDependencies:
'@ibiz/dynamic-model-api': ^2.1.5
lodash-es: ^4.17.21
......@@ -716,31 +716,31 @@ packages:
qx-util: 0.4.4
dev: false
/@ibiz-template/runtime/0.0.1-alpha.40_5kdc272ska6i73jbiqdmud7zjq:
resolution: {integrity: sha512-QnGZ9A32caNbPUyhHP3+rNJBM6HdxKxJh4FgNvtlpuiNga9Cw8vG0OHmM9LkMZFs4u6Gu79fationwJIBducqA==}
/@ibiz-template/runtime/0.0.1-alpha.41_htntrmo5c6ybvxgifiug67fuva:
resolution: {integrity: sha512-b9ALOMwVJxPsadqiD+Z/+c/v7kBuVRHqKuYwLYKLe64jEnFwi+KA3PARfQhSw9ntKGvg+9s9uiehC058ti4c6Q==}
peerDependencies:
'@ibiz-template/core': ^0.0.1-alpha.2
'@ibiz-template/model': ^0.0.1-alpha.2
'@ibiz-template/service': ^0.0.1-alpha.2
qx-util: ^0.4.4
dependencies:
'@ibiz-template/command': 0.0.1-alpha.37
'@ibiz-template/core': 0.0.1-alpha.40_qzytosuu5eg3bvoa74ldx6evva
'@ibiz-template/model': 0.0.1-alpha.39_yslesr4iih24kokbsmhl36awki
'@ibiz-template/service': 0.0.1-alpha.40_q2gs43s4muf6wdt2kzef2bkl5u
'@ibiz-template/command': 0.0.1-alpha.41
'@ibiz-template/core': 0.0.1-alpha.41_qzytosuu5eg3bvoa74ldx6evva
'@ibiz-template/model': 0.0.1-alpha.41_yslesr4iih24kokbsmhl36awki
'@ibiz-template/service': 0.0.1-alpha.41_pqm4hovalqiydv7ewa72l7tngy
qx-util: 0.4.4
dev: false
/@ibiz-template/service/0.0.1-alpha.40_q2gs43s4muf6wdt2kzef2bkl5u:
resolution: {integrity: sha512-DAcha7xUwxmpdC0fuL4InGlDAy2L9sABmoP3n5er8SXMzfGRKxlCt6cOtwwC5+P/4igCb/Uqv80Is8XWuqNDbg==}
/@ibiz-template/service/0.0.1-alpha.41_pqm4hovalqiydv7ewa72l7tngy:
resolution: {integrity: sha512-g/P9mqu/uem+V70JFpIWag8IysjmiwcBNCO5dsRjaxRpUg7BIZob6elHfucyPth0z3iXXooO9cng/eqLsZUvHA==}
peerDependencies:
'@ibiz-template/core': ^0.0.1-alpha.2
'@ibiz-template/model': ^0.0.1-alpha.2
qx-util: ^0.4.4
ramda: ^0.28.0
dependencies:
'@ibiz-template/core': 0.0.1-alpha.40_qzytosuu5eg3bvoa74ldx6evva
'@ibiz-template/model': 0.0.1-alpha.39_yslesr4iih24kokbsmhl36awki
'@ibiz-template/core': 0.0.1-alpha.41_qzytosuu5eg3bvoa74ldx6evva
'@ibiz-template/model': 0.0.1-alpha.41_yslesr4iih24kokbsmhl36awki
qx-util: 0.4.4
ramda: 0.28.0
dev: false
......@@ -749,8 +749,8 @@ packages:
resolution: {integrity: sha512-e3R5XAhG23QgwZheW92vzZGf+CklnvE18UG+NJ2XsIORWVJfwxA3ix89/oFmA0sXUVX7+iI4SuhubhvbWu787A==}
dev: false
/@ibiz-template/vue-util/0.0.1-alpha.40_ugp54vtapc454oxcr74b5b6rda:
resolution: {integrity: sha512-dSLVzVA0b3bHe2Y4eOvcCCauCawYE0L2PTimgeYieVK36KGSk5wbA75JLaDJJyXhNYU3tbtK3TV9fS0EvU9upw==}
/@ibiz-template/vue-util/0.0.1-alpha.41_7ld4khxzprgdjxio25v3wsr5ie:
resolution: {integrity: sha512-oyfyldxjELlYx9u/PHxaPJNrCgvjeQmWRdy547wrCeEYPcJrAGQB80LQJ8SdzBq68CPuEfX0ZuX99m82RNT6SQ==}
peerDependencies:
'@ibiz-template/controller': '>=0.0.1-alpha.2'
'@ibiz-template/core': '>=0.0.1-alpha.2'
......@@ -761,9 +761,9 @@ packages:
vue: ^2.7.13
vue-router: ^3.6.5
dependencies:
'@ibiz-template/controller': 0.0.1-alpha.40_ih5ecz32a4ibmstgfcjyi3tpam
'@ibiz-template/core': 0.0.1-alpha.40_qzytosuu5eg3bvoa74ldx6evva
'@ibiz-template/model': 0.0.1-alpha.39_yslesr4iih24kokbsmhl36awki
'@ibiz-template/controller': 0.0.1-alpha.41_qiggmtl4kdjswnuiwqfbo6qhu4
'@ibiz-template/core': 0.0.1-alpha.41_qzytosuu5eg3bvoa74ldx6evva
'@ibiz-template/model': 0.0.1-alpha.41_yslesr4iih24kokbsmhl36awki
qs: 6.11.0
qx-util: 0.4.4
ramda: 0.28.0
......
rm -rf node_modules
yarn
yarn add "@ibiz-template/vue-util@latest" "@ibiz-template/service@latest" "@ibiz-template/runtime@latest" "@ibiz-template/model@latest" "@ibiz-template/core@latest" "@ibiz-template/command@latest" "@ibiz-template/controller@latest"
yarn add "@ibiz-template/vue-util@latest" "@ibiz-template/service@latest" "@ibiz-template/runtime@latest" "@ibiz-template/model@latest" "@ibiz-template/core@latest" "@ibiz-template/command@latest" "@ibiz-template/controller@latest" "@ibiz-template/theme@latest"
yarn build
rm -rf node_modules
pnpm install
......
......@@ -83,7 +83,7 @@ import {
IBizPickerLink,
IBizCheckbox,
IBizDatePicker,
IBizDropDownList,
IBizDropdown,
IBizFileUpload,
IBizInput,
IBizMPicker,
......@@ -94,6 +94,12 @@ import {
NotSupportedEditor,
IBizGridInput,
IBizGridCheckbox,
IBizGridInputNumber,
IBizGridSpan,
IBizGridDatePicker,
IBizGridDropdown,
IBizGridRadio,
IBizGridPicker,
} from './components/editor';
export const AppRegister = {
......@@ -176,7 +182,7 @@ export const AppRegister = {
v.component('IBizCheckbox', IBizCheckbox);
v.component('IBizRadio', IBizRadio);
v.component('IBizDatePicker', IBizDatePicker);
v.component('IBizDropDownList', IBizDropDownList);
v.component('IBizDropdown', IBizDropdown);
v.component('IBizPicker', IBizPicker);
v.component('IBizPickerDropDown', IBizPickerDropDown);
v.component('IBizPickerLink', IBizPickerLink);
......@@ -188,6 +194,12 @@ export const AppRegister = {
v.component('NotSupportedEditor', NotSupportedEditor);
// 注册表格编辑器
v.component('IBizGridInput', IBizGridInput);
v.component('IBizGridSpan', IBizGridSpan);
v.component('IBizGridInputNumber', IBizGridInputNumber);
v.component('IBizGridCheckbox', IBizGridCheckbox);
v.component('IBizGridDatePicker', IBizGridDatePicker);
v.component('IBizGridDropdown', IBizGridDropdown);
v.component('IBizGridRadio', IBizGridRadio);
v.component('IBizGridPicker', IBizGridPicker);
},
};
......@@ -120,10 +120,22 @@ export const IBizCheckbox = defineComponent({
selectArray.value = value;
};
const valueText = computed(() => {
const valueArr = Array.isArray(selectArray.value)
? selectArray.value
: [selectArray.value];
return items.value
.filter(item => valueArr.includes(item.value))
.map(item => item.text)
.join(',');
});
return {
ns,
items,
selectArray,
valueText,
onSelectArrayChange,
};
},
......@@ -131,19 +143,19 @@ export const IBizCheckbox = defineComponent({
return (
<div class={this.ns.b()}>
{this.infoMode ? (
this.value
this.valueText
) : (
<i-checkbox-group
value={this.selectArray}
on-on-change={this.onSelectArrayChange}
>
{this.items.map((_item, index: number) => (
{this.items.map((item, index: number) => (
<i-checkbox
key={index}
label={_item.value}
label={item.value}
readonly={this.controller.model.readOnly}
>
<span class={this.ns.e('text')}>{_item.text}</span>
<span class={this.ns.e('text')}>{item.text}</span>
</i-checkbox>
))}
</i-checkbox-group>
......
......@@ -4,7 +4,6 @@ import {
useGridCellEditor,
useNamespace,
} from '@ibiz-template/vue-util';
import '@ibiz-template/theme/style/components/editor/ibiz-input/ibiz-input.scss';
export const IBizGridCheckbox = defineComponent({
name: 'IBizGridCheckbox',
......@@ -13,8 +12,8 @@ export const IBizGridCheckbox = defineComponent({
const ns = useNamespace('grid-checkbox');
const { isInfoMode, componentRef, onOperateChange, onChange } =
useGridCellEditor(props.rowDataChange, {
isCacheValue: true,
useGridCellEditor(props.rowDataChange, props.rowSave, {
isDelaySave: true,
});
return {
......
import { defineComponent, ref } from 'vue';
import {
getGridDataPickerProps,
useGridCellEditor,
useNamespace,
} from '@ibiz-template/vue-util';
export const IBizGridPicker = defineComponent({
name: 'IBizGridPicker',
props: getGridDataPickerProps(),
setup(props) {
const ns = useNamespace('grid-picker');
const multiple = props.controller.model.editorType === 'ADDRESSPICKUP';
const provider = ref();
ibiz.register.editor.get(props.controller.model).then(value => {
provider.value = value;
});
const { isInfoMode, componentRef, onOperateChange, onChange } =
useGridCellEditor(props.rowDataChange, props.rowSave, {
isDelaySave: multiple,
});
return {
ns,
isInfoMode,
componentRef,
provider,
onOperateChange,
onChange,
};
},
render(h) {
return (
<div
ref='componentRef'
class={`${this.ns.b()} ibiz-grid-editor`}
onDblclick={evt => evt.stopPropagation()}
onClick={evt => evt.stopPropagation()}
>
{this.provider &&
h(this.provider.formEditor, {
props: {
...this.$props,
infoMode: this.isInfoMode,
},
on: {
change: this.onChange,
operate: this.onOperateChange,
},
})}
</div>
);
},
});
import { PickerEditorController } from '@ibiz-template/controller';
import { ref, watch, Ref, defineComponent, PropType } from 'vue';
import { useNamespace } from '@ibiz-template/vue-util';
import { ref, watch, Ref, defineComponent, computed } from 'vue';
import {
getDataPickerProps,
getEditorEmits,
useNamespace,
} from '@ibiz-template/vue-util';
import '@ibiz-template/theme/style/components/editor/ibiz-mpicker/ibiz-mpicker.scss';
export const IBizMPicker = defineComponent({
name: 'IBizMPicker',
props: {
value: {
type: String,
},
controller: {
type: PickerEditorController,
},
data: {
type: Object as PropType<IData>,
},
disabled: {
type: Boolean,
},
},
emits: {
change: (_value: Array<string> | string | null, _tag?: string) => true,
},
props: getDataPickerProps(),
emits: getEditorEmits(),
setup(props, { emit }) {
const ns = useNamespace('mpicker');
......@@ -239,12 +227,21 @@ export const IBizMPicker = defineComponent({
onSearch('');
}
};
const valueText = computed(() => {
return selectItems.value
.map(item => {
return item[c.textName] || item.srfmajortext;
})
.join(',');
});
return {
ns,
c,
curValue,
loading,
items,
valueText,
onSearch,
onSelectOpen,
onSelect,
......@@ -254,34 +251,41 @@ export const IBizMPicker = defineComponent({
render() {
return (
<div class={this.ns.b()}>
<i-select
value={this.curValue}
filterable
multiple
loading={this.loading}
placeholder={this.c.placeHolder}
remote-method={this.onSearch}
on-on-open-change={this.onSelectOpen}
on-on-change={this.onSelect}
disabled={this.disabled}
>
{this.items.map((item, index) => {
return (
<i-option key={index} value={item[this.c.keyName]}>
{item[this.c.textName]}
</i-option>
);
})}
</i-select>
<div class={this.ns.e('btns')}>
{this.c.pickupView ? (
<i-button
icon='ios-search'
on-click={this.openPickUpView}
type={'text'}
></i-button>
) : null}
</div>
{this.infoMode && this.valueText}
{!this.infoMode && (
<i-select
value={this.curValue}
filterable
multiple
loading={this.loading}
placeholder={this.c.placeHolder}
remote-method={this.onSearch}
on-on-open-change={this.onSelectOpen}
on-on-change={this.onSelect}
disabled={this.disabled}
>
{this.items.map((item, index) => {
return (
<i-option key={index} value={item[this.c.keyName]}>
{item[this.c.textName]}
</i-option>
);
})}
</i-select>
)}
{!this.infoMode && (
<div class={this.ns.e('buns-position')}>
<div class={this.ns.e('btns')}>
{this.c.pickupView ? (
<i-button
icon='ios-search'
on-click={this.openPickUpView}
type={'text'}
></i-button>
) : null}
</div>
</div>
)}
</div>
);
},
......
import { PickerEditorController } from '@ibiz-template/controller';
import { ref, Ref, watch, defineComponent, PropType } from 'vue';
import { useNamespace } from '@ibiz-template/vue-util';
import { ref, Ref, watch, defineComponent } from 'vue';
import {
getDataPickerProps,
getEditorEmits,
useNamespace,
} from '@ibiz-template/vue-util';
import { debounce } from 'lodash-es';
import { isNil } from 'ramda';
import '@ibiz-template/theme/style/components/editor/ibiz-picker-dropdown/ibiz-picker-dropdown.scss';
export const IBizPickerDropDown = defineComponent({
name: 'IBizPickerDropDown',
props: {
value: {
type: String,
},
controller: {
type: PickerEditorController,
},
data: {
type: Object as PropType<IData>,
required: true,
},
disabled: {
type: Boolean,
},
},
emits: {
change: (_value?: string | Array<string> | IData | null, _tag?: string) =>
true,
},
props: getDataPickerProps(),
emits: getEditorEmits(),
setup(props, { emit }) {
const ns = useNamespace('picker-dropdown');
const c = props.controller as PickerEditorController;
const c = props.controller;
// 允许搜索
const allowSearch = ref(true);
......@@ -189,6 +175,9 @@ export const IBizPickerDropDown = defineComponent({
};
},
render() {
if (this.infoMode) {
return <div class={this.ns.b()}>{this.value}</div>;
}
return (
<div class={this.ns.b()}>
<i-select
......
import { PickerEditorController } from '@ibiz-template/controller';
import { defineComponent, PropType, ref, Ref, watch } from 'vue';
import { useNamespace } from '@ibiz-template/vue-util';
import { defineComponent, ref, Ref, watch } from 'vue';
import {
getDataPickerProps,
getEditorEmits,
useNamespace,
} from '@ibiz-template/vue-util';
export const IBizPickerLink = defineComponent({
name: 'IBizPickerLink',
props: {
value: {
type: String,
},
controller: {
type: PickerEditorController,
},
data: {
type: Object as PropType<IData>,
},
},
emits: {
change: (_value: Array<string | number> | string, _tag?: string) => true,
},
props: getDataPickerProps(),
emits: getEditorEmits(),
setup(props, { emit }) {
const ns = useNamespace('picker-link');
......@@ -59,7 +50,11 @@ export const IBizPickerLink = defineComponent({
render() {
return (
<div class={this.ns.b()}>
<a on-click={this.openLinkView}>{this.curValue}</a>
{this.infoMode ? (
this.value
) : (
<a on-click={this.openLinkView}>{this.curValue}</a>
)}
</div>
);
},
......
import { PickerEditorController } from '@ibiz-template/controller';
import { ref, watch, Ref, defineComponent, PropType } from 'vue';
import { useNamespace } from '@ibiz-template/vue-util';
import { ref, watch, Ref, defineComponent } from 'vue';
import {
getDataPickerProps,
getEditorEmits,
useNamespace,
} from '@ibiz-template/vue-util';
import { isEmpty } from 'ramda';
import '@ibiz-template/theme/style/components/editor/ibiz-picker/ibiz-picker.scss';
export const IBizPicker = defineComponent({
name: 'IBizPicker',
props: {
value: {
type: String,
},
controller: {
type: PickerEditorController,
},
data: {
type: Object as PropType<IData>,
required: true,
},
disabled: {
type: Boolean,
},
},
props: getDataPickerProps(),
emits: getEditorEmits(),
setup(props, { emit }) {
const ns = useNamespace('picker');
......@@ -144,6 +134,9 @@ export const IBizPicker = defineComponent({
};
},
render() {
if (this.infoMode) {
return <div class={this.ns.b()}>{this.value}</div>;
}
return (
<div class={this.ns.b()}>
{this.c.noAC ? (
......@@ -201,23 +194,25 @@ export const IBizPicker = defineComponent({
);
})}
</i-auto-complete>
<div class={this.ns.e('btns')}>
{this.c.pickupView ? (
<i-button
icon='ios-search'
on-click={this.openPickUpView}
type={'text'}
></i-button>
) : null}
{this.c.linkView ? (
<i-button
on-click={this.openLinkView}
type={'text'}
class={this.ns.e('link')}
>
<ion-icon src={'./assets/img/link.svg'}></ion-icon>
</i-button>
) : null}
<div class={this.ns.e('buns-position')}>
<div class={this.ns.e('btns')}>
{this.c.pickupView ? (
<i-button
icon='ios-search'
on-click={this.openPickUpView}
type={'text'}
></i-button>
) : null}
{this.c.linkView ? (
<i-button
on-click={this.openLinkView}
type={'text'}
class={this.ns.e('link')}
>
<ion-icon src={'./assets/img/link.svg'}></ion-icon>
</i-button>
) : null}
</div>
</div>
</div>
)}
......
......@@ -2,3 +2,4 @@ export { IBizPicker } from './ibiz-picker/ibiz-picker';
export { IBizPickerDropDown } from './ibiz-picker-dropdown/ibiz-picker-dropdown';
export { IBizMPicker } from './ibiz-mpicker/ibiz-mpicker';
export { IBizPickerLink } from './ibiz-picker-link/ibiz-picker-link';
export { IBizGridPicker } from './ibiz-grid-picker/ibiz-grid-picker';
import { DatePickerEditorController } from '@ibiz-template/controller';
import { ref, watch, defineComponent, PropType } from 'vue';
import { useNamespace } from '@ibiz-template/vue-util';
import { ref, watch, defineComponent } from 'vue';
import {
getDatePickerProps,
getEditorEmits,
useNamespace,
} from '@ibiz-template/vue-util';
import '@ibiz-template/theme/style/components/editor/ibiz-date-picker/ibiz-date-picker.scss';
import dayjs from 'dayjs';
export const IBizDatePicker = defineComponent({
name: 'IBizDatePicker',
props: {
value: {
type: String,
},
controller: {
type: DatePickerEditorController,
required: true,
},
data: {
type: Object as PropType<IData>,
},
disabled: {
type: Boolean,
},
},
emits: {
change: (_value: string) => true,
},
props: getDatePickerProps(),
emits: getEditorEmits(),
setup(props, { emit }) {
const ns = useNamespace('date-picker');
const c = props.controller;
......@@ -33,53 +21,19 @@ export const IBizDatePicker = defineComponent({
const format = ref('yyyy-MM-dd');
switch (editorModel.editorType) {
// 时间选择器
case 'DATEPICKER':
type.value = 'datetime';
format.value = 'yyyy-MM-dd HH:mm:ss';
break;
// 时间选择控件
case 'DATEPICKEREX':
type.value = 'date';
format.value = 'yyyy-MM-dd HH:mm:ss';
break;
// 时间选择控件_无小时
case 'DATEPICKEREX_NOTIME':
type.value = 'date';
format.value = 'yyyy-MM-dd';
break;
// 时间选择控件_小时
case 'DATEPICKEREX_HOUR':
type.value = 'datetime';
format.value = 'yyyy-MM-dd HH';
break;
// 时间选择控件_分钟
case 'DATEPICKEREX_MINUTE':
type.value = 'datetime';
format.value = 'yyyy-MM-dd HH:mm';
break;
// 时间选择控件_秒钟
case 'DATEPICKEREX_SECOND':
type.value = 'datetime';
format.value = 'yyyy-MM-dd HH:mm:ss';
break;
// 时间选择控件_无日期
case 'DATEPICKEREX_NODAY':
type.value = 'datetime';
format.value = 'HH:mm:ss';
break;
// 时间选择控件_无日期无秒钟
case 'DATEPICKEREX_NODAY_NOSECOND':
type.value = 'datetime';
format.value = 'HH:mm';
break;
// 时间选择控件_无秒钟
case 'DATEPICKEREX_NOSECOND':
type.value = 'datetime';
format.value = 'yyyy-MM-dd HH:mm';
break;
case 'DATEPICKER':
default:
break;
type.value = 'datetime';
}
// 值格式化
const valueFormat = c!.valueFormat;
......@@ -89,12 +43,12 @@ export const IBizDatePicker = defineComponent({
.replace('DD', 'dd');
format.value = tempFormat;
}
const currentVal = ref();
const formatValue = ref();
watch(
() => props.value,
(newVal, oldVal) => {
if (newVal !== oldVal) {
currentVal.value = newVal || null;
formatValue.value = dayjs(newVal).format(valueFormat);
}
},
{ immediate: true },
......@@ -103,20 +57,24 @@ export const IBizDatePicker = defineComponent({
const handleChange = (date: string, _dateType: IData) => {
emit('change', date);
};
return { ns, c, editorModel, type, format, currentVal, handleChange };
return { ns, c, editorModel, type, format, formatValue, handleChange };
},
render() {
return (
<div class={this.ns.b()}>
<i-CalendarPicker
type={this.type}
format={this.format}
placeholder={this.c!.placeHolder}
value={this.currentVal}
readonly={this.c!.model.readOnly}
on-on-change={this.handleChange}
disabled={this.disabled}
></i-CalendarPicker>
{this.infoMode ? (
this.formatValue
) : (
<i-CalendarPicker
type={this.type}
format={this.format}
placeholder={this.c!.placeHolder}
value={this.value}
readonly={this.c!.model.readOnly}
on-on-change={this.handleChange}
disabled={this.disabled}
></i-CalendarPicker>
)}
</div>
);
},
......
import { defineComponent } from 'vue';
import {
getGridDatePickerProps,
useGridCellEditor,
useNamespace,
} from '@ibiz-template/vue-util';
export const IBizGridDatePicker = defineComponent({
name: 'IBizGridDatePicker',
props: getGridDatePickerProps(),
setup(props) {
const ns = useNamespace('grid-date-picker');
const { isInfoMode, componentRef, onOperateChange, onChange } =
useGridCellEditor(props.rowDataChange, props.rowSave, {
isDelaySave: true,
});
return {
ns,
isInfoMode,
componentRef,
onOperateChange,
onChange,
};
},
render(h) {
return (
<div
ref='componentRef'
class={`${this.ns.b()} ibiz-grid-editor`}
onDblclick={evt => evt.stopPropagation()}
onClick={evt => evt.stopPropagation()}
>
{h('IBizDatePicker', {
props: {
...this.$props,
infoMode: this.isInfoMode,
},
on: {
change: this.onChange,
operate: this.onOperateChange,
},
})}
</div>
);
},
});
export { IBizDatePicker } from './ibiz-date-picker/ibiz-date-picker';
export { IBizGridDatePicker } from './ibiz-grid-date-picker/ibiz-grid-date-picker';
import { ref, Ref, defineComponent, computed } from 'vue';
import {
getDropdownProps,
getEditorEmits,
useNamespace,
} from '@ibiz-template/vue-util';
import '@ibiz-template/theme/style/components/editor/ibiz-dropdown/ibiz-dropdown.scss';
export const IBizDropdown = defineComponent({
name: 'IBizDropdown',
props: getDropdownProps(),
emits: getEditorEmits(),
setup(props, { emit }) {
const ns = useNamespace('dropdown');
const c = props.controller;
// 是否是树形
const hasChildren = ref(false);
// 代码表
const items: Ref<readonly IData[]> = ref([]);
c!.loadCodeList(props.data!).then((codeList: readonly IData[]) => {
items.value = codeList;
for (let i = 0; i < codeList.length; i++) {
const _item = codeList[i];
if (_item.children) {
hasChildren.value = true;
break;
}
}
});
// 当前值
const curValue: Ref<Array<string> | string | undefined> = computed({
get() {
if (props.value) {
return c!.multiple ? props.value?.split(',') : props.value;
}
return props.value;
},
set(select: string | Array<string> | undefined) {
if (Array.isArray(select)) {
emit('change', select.length === 0 ? null : select.join(','));
} else {
emit('change', select);
}
},
});
const valueText = computed(() => {
const valueArr = Array.isArray(curValue.value)
? curValue.value
: [curValue.value];
return items.value
.filter(item => valueArr.includes(item.value))
.map(item => item.text)
.join(',');
});
return { ns, c, curValue, items, valueText, hasChildren };
},
render() {
// 编辑态内容
const editContent = this.hasChildren ? (
<app-select-tree
class={this.ns.e('tree-select')}
value={this.curValue}
nodes-data={this.items}
multiple={this.c!.multiple}
></app-select-tree>
) : (
<i-select
v-model={this.curValue}
allow-clear
clearable
class={this.ns.e('select')}
multiple={this.c!.multiple}
placeholder={this.c!.placeHolder}
disabled={this.disabled}
>
{this.items.map(item => {
return <i-option value={item.value}>{item.text}</i-option>;
})}
</i-select>
);
return (
<div class={this.ns.b()}>
{this.infoMode ? this.valueText : editContent}
</div>
);
},
});
import { defineComponent } from 'vue';
import {
getGridDropdownProps,
useGridCellEditor,
useNamespace,
} from '@ibiz-template/vue-util';
export const IBizGridDropdown = defineComponent({
name: 'IBizGridDropdown',
props: getGridDropdownProps(),
setup(props) {
const ns = useNamespace('grid-dropdown');
const { isInfoMode, componentRef, onOperateChange, onChange } =
useGridCellEditor(props.rowDataChange, props.rowSave, {
isDelaySave: props.controller.multiple,
});
return {
ns,
isInfoMode,
componentRef,
onOperateChange,
onChange,
};
},
render(h) {
return (
<div
ref='componentRef'
class={`${this.ns.b()} ibiz-grid-editor`}
onDblclick={evt => evt.stopPropagation()}
onClick={evt => evt.stopPropagation()}
>
{h('IBizDropdown', {
props: {
...this.$props,
infoMode: this.isInfoMode,
},
on: {
change: this.onChange,
operate: this.onOperateChange,
},
})}
</div>
);
},
});
export { IBizDropDownList } from './ibiz-dropdown-list/ibiz-dropdown-list';
export { IBizDropdown } from './ibiz-dropdown/ibiz-dropdown';
export { IBizGridDropdown } from './ibiz-grid-dropdown/ibiz-grid-dropdown';
import { defineComponent } from 'vue';
import {
getGridRadioProps,
useGridCellEditor,
useNamespace,
} from '@ibiz-template/vue-util';
export const IBizGridRadio = defineComponent({
name: 'IBizGridRadio',
props: getGridRadioProps(),
setup(props) {
const ns = useNamespace('grid-radio');
const { isInfoMode, componentRef, onOperateChange, onChange } =
useGridCellEditor(props.rowDataChange, props.rowSave, {
isDelaySave: false,
});
return {
ns,
isInfoMode,
componentRef,
onOperateChange,
onChange,
};
},
render(h) {
return (
<div
ref='componentRef'
class={`${this.ns.b()} ibiz-grid-editor`}
onDblclick={evt => evt.stopPropagation()}
onClick={evt => evt.stopPropagation()}
>
{h('IBizRadio', {
props: {
...this.$props,
infoMode: this.isInfoMode,
},
on: {
change: this.onChange,
operate: this.onOperateChange,
},
})}
</div>
);
},
});
import { RadioButtonListEditorController } from '@ibiz-template/controller';
import { computed, defineComponent, ref } from 'vue';
import type { PropType } from 'vue';
import { useNamespace } from '@ibiz-template/vue-util';
import {
getEditorEmits,
getRadioProps,
useNamespace,
} from '@ibiz-template/vue-util';
import '@ibiz-template/theme/style/components/editor/ibiz-radio/ibiz-radio.scss';
export const IBizRadio = defineComponent({
name: 'IBizRadio',
props: {
value: [String, Number],
controller: {
type: RadioButtonListEditorController,
required: true,
},
data: {
type: Object as PropType<IData>,
required: true,
},
},
emits: {
change: (_value: string | number) => true,
},
props: getRadioProps(),
emits: getEditorEmits(),
setup(props, { emit }) {
const ns = useNamespace('radio');
......@@ -27,17 +17,8 @@ export const IBizRadio = defineComponent({
const editorModel = c.model;
const selectValue = computed({
get() {
return props.value || '';
},
set(newValue: string | number) {
emit('change', newValue);
},
});
const onSelectValueChange = (value: string | number) => {
selectValue.value = value;
emit('change', value);
};
// 代码表
......@@ -47,32 +28,40 @@ export const IBizRadio = defineComponent({
items.value = codeList;
});
const valueText = computed(() => {
return items.value.find(item => item.value === props.value)?.text || '';
});
return {
ns,
editorModel,
selectValue,
items,
valueText,
onSelectValueChange,
};
},
render() {
return (
<div class={this.ns.b()}>
<i-radio-group
class={this.ns.b('group')}
value={this.selectValue}
on-on-change={this.onSelectValueChange}
>
{this.items.map((_item, index: number) => (
<i-radio
key={index}
label={_item.value}
readonly={this.editorModel.readOnly}
>
<span class={this.ns.be('group', 'text')}>{_item.text}</span>
</i-radio>
))}
</i-radio-group>
{this.infoMode ? (
this.valueText
) : (
<i-radio-group
class={this.ns.e('group')}
value={this.value}
on-on-change={this.onSelectValueChange}
>
{this.items.map((_item, index: number) => (
<i-radio
key={index}
label={_item.value}
readonly={this.editorModel.readOnly}
>
<span class={this.ns.e('text')}>{_item.text}</span>
</i-radio>
))}
</i-radio-group>
)}
</div>
);
},
......
export { IBizRadio } from './ibiz-radio/ibiz-radio';
export { IBizGridRadio } from './ibiz-grid-radio/ibiz-grid-radio';
import { defineComponent } from 'vue';
import { getGridSpanProps, useNamespace } from '@ibiz-template/vue-util';
export const IBizGridSpan = defineComponent({
name: 'IBizGridSpan',
props: getGridSpanProps(),
setup() {
const ns = useNamespace('grid-span');
return { ns };
},
render(h) {
return (
<div
class={`${this.ns.b()} ibiz-grid-editor`}
onDblclick={evt => evt.stopPropagation()}
onClick={evt => evt.stopPropagation()}
>
{h('IBizSpan', {
props: {
...this.$props,
},
})}
</div>
);
},
});
import { ref, defineComponent, Ref, watch } from 'vue';
import type { PropType } from 'vue';
import { SpanEditorController } from '@ibiz-template/controller';
import { useNamespace } from '@ibiz-template/vue-util';
import { getSpanProps, useNamespace } from '@ibiz-template/vue-util';
import dayjs from 'dayjs';
import '@ibiz-template/theme/style/components/editor/ibiz-span/ibiz-span.scss';
export const IBizSpan = defineComponent({
name: 'IBizSpan',
props: {
value: String,
controller: {
type: SpanEditorController,
required: true,
},
data: {
type: Object as PropType<IData>,
required: true,
},
},
props: getSpanProps(),
setup(props) {
const ns = useNamespace('span');
const c = props.controller;
......
export { IBizSpan } from './ibiz-span/ibiz-span';
export { IBizGridSpan } from './ibiz-grid-span/ibiz-grid-span';
import { defineComponent } from 'vue';
import {
getGridInputNumberProps,
useGridCellEditor,
useNamespace,
} from '@ibiz-template/vue-util';
export const IBizGridInputNumber = defineComponent({
name: 'IBizGridInputNumber',
props: getGridInputNumberProps(),
setup(props) {
const ns = useNamespace('grid-input-number');
const { isInfoMode, componentRef, onOperateChange, onChange } =
useGridCellEditor(props.rowDataChange, props.rowSave, {
isDelaySave: true,
});
return {
ns,
isInfoMode,
componentRef,
onOperateChange,
onChange,
};
},
render(h) {
return (
<div
ref='componentRef'
class={`${this.ns.b()} ibiz-grid-editor`}
onDblclick={evt => evt.stopPropagation()}
onClick={evt => evt.stopPropagation()}
>
{h('IBizInputNumber', {
props: {
...this.$props,
infoMode: this.isInfoMode,
},
on: {
change: this.onChange,
operate: this.onOperateChange,
},
})}
</div>
);
},
});
......@@ -4,7 +4,6 @@ import {
useGridCellEditor,
useNamespace,
} from '@ibiz-template/vue-util';
import '@ibiz-template/theme/style/components/editor/ibiz-input/ibiz-input.scss';
export const IBizGridInput = defineComponent({
name: 'IBizGridInput',
......@@ -12,8 +11,8 @@ export const IBizGridInput = defineComponent({
setup(props) {
const ns = useNamespace('grid-input');
const { isInfoMode, componentRef, onOperateChange, onChange } =
useGridCellEditor(props.rowDataChange, {
isCacheValue: true,
useGridCellEditor(props.rowDataChange, props.rowSave, {
isDelaySave: true,
});
return {
......
import { defineComponent, ref, watch } from 'vue';
import type { PropType } from 'vue';
import { TextBoxEditorController } from '@ibiz-template/controller';
import { useNamespace } from '@ibiz-template/vue-util';
import {
getEditorEmits,
getInputNumberProps,
useNamespace,
} from '@ibiz-template/vue-util';
export const IBizInputNumber = defineComponent({
name: 'IBizInputNumber',
props: {
value: Number,
controller: {
type: TextBoxEditorController,
required: true,
},
data: {
type: Object as PropType<IData>,
required: true,
},
},
emits: {
change: (_value: number | null) => true,
},
props: getInputNumberProps(),
emits: getEditorEmits(),
setup(props, { emit }) {
const ns = useNamespace('input-number');
......
......@@ -37,16 +37,16 @@ export const IBizInput = defineComponent({
}
});
const currentVal = ref<string | number>('');
const currentVal = ref<string>('');
watch(
() => props.value,
(newVal, oldVal) => {
if (newVal !== oldVal) {
if (newVal === null) {
if (!newVal) {
currentVal.value = '';
} else {
currentVal.value = newVal as string | number;
currentVal.value = newVal;
}
}
},
......
export { IBizInput } from './ibiz-input/ibiz-input';
export { IBizGridInput } from './ibiz-grid-input/ibiz-grid-input';
export { IBizInputNumber } from './ibiz-input-number/ibiz-input-number';
export { IBizGridInputNumber } from './ibiz-grid-input-number/ibiz-grid-input-number';
import { UploadEditorController } from '@ibiz-template/controller';
import { getCookie } from 'qx-util';
import { onMounted, ref, Ref, watch, defineComponent, PropType } from 'vue';
import { useNamespace } from '@ibiz-template/vue-util';
import { onMounted, ref, Ref, watch, defineComponent } from 'vue';
import {
getEditorEmits,
getUploadProps,
useNamespace,
} from '@ibiz-template/vue-util';
import { RuntimeError } from '@ibiz-template/core';
import '@ibiz-template/theme/style/components/editor/ibiz-file-upload/ibiz-file-upload.scss';
export const IBizFileUpload = defineComponent({
name: 'IBizFileUpload',
props: {
value: {
type: String,
},
controller: {
type: UploadEditorController,
require: true,
},
data: {
type: Object as PropType<IData>,
},
},
emits: {
change: (_value: string | null) => true,
},
props: getUploadProps(),
emits: getEditorEmits(),
setup(props, { emit }) {
const ns = useNamespace('file-upload');
const c = props.controller as UploadEditorController;
const c = props.controller;
// 文件列表
const files: Ref<IData[]> = ref([]);
......@@ -305,33 +295,35 @@ export const IBizFileUpload = defineComponent({
render(h) {
return (
<div class={this.ns.b()}>
{h(
'IUpload',
{
ref: 'fileUpload',
props: {
action: this.uploadUrl,
headers: this.headers,
'default-file-list': this.files,
multiple: this.c.multiple,
type: this.c.isDrag ? 'drag' : 'select',
accept: this.c.accept,
'before-upload': this.beforeUpload,
'on-success': this.onSuccess,
'on-error': this.onError,
'on-remove': this.onRemove,
'on-preview': this.onDownload,
},
},
[
<i-button
icon='ios-cloud-upload-outline'
class={this.ns.b('button')}
>
上传文件
</i-button>,
],
)}
{this.infoMode
? this.value
: h(
'IUpload',
{
ref: 'fileUpload',
props: {
action: this.uploadUrl,
headers: this.headers,
'default-file-list': this.files,
multiple: this.c.multiple,
type: this.c.isDrag ? 'drag' : 'select',
accept: this.c.accept,
'before-upload': this.beforeUpload,
'on-success': this.onSuccess,
'on-error': this.onError,
'on-remove': this.onRemove,
'on-preview': this.onDownload,
},
},
[
<i-button
icon='ios-cloud-upload-outline'
class={this.ns.b('button')}
>
上传文件
</i-button>,
],
)}
</div>
);
},
......
import { UploadEditorController } from '@ibiz-template/controller';
import { defineComponent, onMounted, ref, watch } from 'vue';
import type { PropType } from 'vue';
import { useNamespace } from '@ibiz-template/vue-util';
import { getGridUploadProps, useNamespace } from '@ibiz-template/vue-util';
import { getCookie } from 'qx-util';
import { RuntimeError } from '@ibiz-template/core';
export const IBizGridFileUpload = defineComponent({
name: 'IBizGridFileUpload',
props: {
value: String,
controller: {
type: UploadEditorController,
required: true,
},
data: {
type: Object as PropType<IData>,
required: true,
},
},
emits: {
change: (_value: string | null) => true,
},
setup(props, { emit }) {
props: getGridUploadProps(),
setup(props) {
const ns = useNamespace('grid-file-upload');
const c = props.controller;
......@@ -174,7 +159,7 @@ export const IBizGridFileUpload = defineComponent({
// 抛出值变更事件
const value: string | null =
result.length > 0 ? JSON.stringify(result) : null;
emit('change', value);
props.rowDataChange(value);
// 清空缓存的文件数据
uploadCache.cacheFiles = [];
}
......@@ -195,7 +180,7 @@ export const IBizGridFileUpload = defineComponent({
}
});
const value: string | null = arr.length > 0 ? JSON.stringify(arr) : null;
emit('change', value);
props.rowDataChange(value);
};
// 计算文件mime类型
......@@ -333,7 +318,7 @@ export const IBizGridFileUpload = defineComponent({
}}
>
查看
<badge count={this.files.length}></badge>
<i-badge count={this.files.length}></i-badge>
</i-button>
</i-col>
) : null}
......
import { UploadEditorController } from '@ibiz-template/controller';
import { defineComponent, onMounted, ref, watch } from 'vue';
import type { PropType } from 'vue';
import { useNamespace } from '@ibiz-template/vue-util';
import {
getEditorEmits,
getUploadProps,
useNamespace,
} from '@ibiz-template/vue-util';
import { getCookie } from 'qx-util';
import { RuntimeError } from '@ibiz-template/core';
import '@ibiz-template/theme/style/components/editor/ibiz-image-upload/ibiz-image-upload.scss';
export const IBizImageUpload = defineComponent({
name: 'IBizImageUpload',
props: {
value: String,
controller: {
type: UploadEditorController,
required: true,
},
data: {
type: Object as PropType<IData>,
required: true,
},
},
emits: {
change: (_value: string | null) => true,
},
props: getUploadProps(),
emits: getEditorEmits(),
setup(props, { emit }) {
const ns = useNamespace('image-upload');
......@@ -329,53 +319,57 @@ export const IBizImageUpload = defineComponent({
render(h) {
return (
<div class={this.ns.b()}>
<div class={this.ns.e('image-upload-list')}>
{this.files.map(item => (
<div key={item.id} class={this.ns.e('list-item')}>
<img src={item.url} />
<div class={this.ns.e('list-item-cover')}>
<i-icon
type='ios-eye-outline'
on-click={() => this.onPreview(item)}
></i-icon>
<i-icon
type='ios-download-outline'
on-click={() => this.onDownload(item)}
></i-icon>
<i-icon
type='ios-trash-outline'
on-click={() => this.onRemove(item, this.files)}
></i-icon>
{this.infoMode && this.value}
{!this.infoMode && (
<div class={this.ns.e('image-upload-list')}>
{this.files.map(item => (
<div key={item.id} class={this.ns.e('list-item')}>
<img src={item.url} />
<div class={this.ns.e('list-item-cover')}>
<i-icon
type='ios-eye-outline'
on-click={() => this.onPreview(item)}
></i-icon>
<i-icon
type='ios-download-outline'
on-click={() => this.onDownload(item)}
></i-icon>
<i-icon
type='ios-trash-outline'
on-click={() => this.onRemove(item, this.files)}
></i-icon>
</div>
</div>
</div>
))}
</div>
))}
</div>
)}
{h(
'IUpload',
{
ref: 'imageUpload',
props: {
action: this.uploadUrl,
headers: this.headers,
'default-file-list': this.files,
multiple: this.c.multiple,
type: 'drag',
accept: this.c.accept,
'show-upload-list': false,
'before-upload': this.beforeUpload,
'on-success': this.onSuccess,
'on-error': this.onError,
'on-remove': this.onRemove,
'on-preview': this.onDownload,
{!this.infoMode &&
h(
'IUpload',
{
ref: 'imageUpload',
props: {
action: this.uploadUrl,
headers: this.headers,
'default-file-list': this.files,
multiple: this.c.multiple,
type: 'drag',
accept: this.c.accept,
'show-upload-list': false,
'before-upload': this.beforeUpload,
'on-success': this.onSuccess,
'on-error': this.onError,
'on-remove': this.onRemove,
'on-preview': this.onDownload,
},
},
},
[
<div class={this.ns.e('btn')}>
<i-icon type='ios-add' size='30'></i-icon>
</div>,
],
)}
[
<div class={this.ns.e('btn')}>
<i-icon type='ios-add' size='30'></i-icon>
</div>,
],
)}
<i-modal
class-name={this.ns.b('modal')}
......
......@@ -2,9 +2,9 @@ import {
GridEditItemController,
GridRowController,
} from '@ibiz-template/controller';
import { defineComponent } from 'vue';
import { defineComponent, getCurrentInstance } from 'vue';
import '@ibiz-template/theme/style/components/widgets/grid/grid-edit-item.scss';
import { useNamespace } from '@ibiz-template/vue-util';
import { useForce, useNamespace } from '@ibiz-template/vue-util';
export const GridEditItem = defineComponent({
name: 'GridEditItem',
......@@ -20,23 +20,24 @@ export const GridEditItem = defineComponent({
},
setup(props) {
const ns = useNamespace('grid-edit-item');
const force = useForce(getCurrentInstance()!.proxy);
// 编辑器值变更事件
const rowDataChange = async (val: unknown, name?: string) => {
const _name = name || props.controller.model.codeName;
// 值不变则无后续,也不保存
if (props.row.data[_name] === val) {
return;
}
await props.controller.setRowValue(props.row, val, name);
// 保存时机由界面控制
await props.controller.grid.save(props.row.data);
force();
};
// 行数据保存
const rowSave = async () => {
return props.controller.grid.save(props.row.data);
};
const onStopPropagation = (e: MouseEvent) => {
e.stopPropagation();
};
return { ns, rowDataChange, onStopPropagation };
return { ns, rowDataChange, rowSave, onStopPropagation };
},
render(h) {
const codeName = this.controller.model.codeName;
......@@ -55,6 +56,7 @@ export const GridEditItem = defineComponent({
controller: this.controller.editor,
disabled: this.row.columnState[codeName]!.disabled,
rowDataChange: this.rowDataChange.bind(this),
rowSave: this.rowSave.bind(this),
},
})}
</appGridEditItem>
......
......@@ -41,6 +41,7 @@ import {
// 绑在原型上
LoadingBar,
Notice,
Badge,
} from 'view-design';
const components = [
......@@ -82,6 +83,7 @@ const components = [
AutoComplete,
InputNumber,
Drawer,
Badge,
];
export const IViewRegister = {
......
......@@ -34,7 +34,7 @@ export class DataPickerEditorProvider implements IEditorProvider {
default:
}
this.formEditor = componentName;
this.gridEditor = componentName;
this.gridEditor = 'IBizGridPicker';
}
async createController(
......
......@@ -18,7 +18,7 @@ import {
export class DatePickerEditorProvider implements IEditorProvider {
formEditor: string = 'IBizDatePicker';
gridEditor: string = 'IBizDatePicker';
gridEditor: string = 'IBizGridDatePicker';
async createController(
editorModel: DatePickerEditorModel,
......
......@@ -15,9 +15,9 @@ import {
* @implements {EditorProvider}
*/
export class DropDownListEditorProvider implements IEditorProvider {
formEditor: string = 'IBizDropDownList';
formEditor: string = 'IBizDropdown';
gridEditor: string = 'IBizDropDownList';
gridEditor: string = 'IBizGridDropdown';
async createController(
editorModel: DropDownListModel,
......
......@@ -17,7 +17,7 @@ import {
export class RadioButtonListEditorProvider implements IEditorProvider {
formEditor: string = 'IBizRadio';
gridEditor: string = 'IBizRadio';
gridEditor: string = 'IBizGridRadio';
async createController(
editorModel: RadioButtonListModel,
......
......@@ -17,7 +17,7 @@ import {
export class SpanEditorProvider implements IEditorProvider {
formEditor: string = 'IBizSpan';
gridEditor: string = 'IBizSpan';
gridEditor: string = 'IBizGridSpan';
async createController(
editorModel: SpanEditorModel,
......
......@@ -485,60 +485,60 @@
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45"
integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==
"@ibiz-template/command@^0.0.1-alpha.37":
version "0.0.1-alpha.37"
resolved "https://registry.npmmirror.com/@ibiz-template/command/-/command-0.0.1-alpha.37.tgz#2d7bee06d96a596cde290d1f2f9c1709624f0faf"
integrity sha512-7KPS16osgsOHgPekTC8W2SKMtVIF4lsY6XP5IPttkQiZU6nhBDLs4MoRyRvhHPA30aKHzgxmYT/Whl186apoqg==
"@ibiz-template/command@^0.0.1-alpha.41":
version "0.0.1-alpha.41"
resolved "http://npm.zhr.icu/@ibiz-template%2fcommand/-/command-0.0.1-alpha.41.tgz#1875c65123ac046c131df8573a004e0a4bab193b"
integrity sha512-zT43FCKM343d4rpfRx2YhcoymriTdAn3Ujb598U39hxLltJZpEp4LkqR4HqCVB0MazpfWA4QRviifPbQPA+3jw==
dependencies:
qx-util "^0.4.4"
"@ibiz-template/controller@^0.0.1-alpha.40":
version "0.0.1-alpha.40"
resolved "https://registry.yarnpkg.com/@ibiz-template/controller/-/controller-0.0.1-alpha.40.tgz#f59f42c28b7633ccaccb37fd63ad1b64a0c5fd0f"
integrity sha512-s9xXqRStODQBPvam7UVKx/U7oqj1yM/qHhZH+K0RMMLVEn/IoCp3ir1asjbgPSqBWxwJ4JM5ZIfvWm4dyyJxkg==
"@ibiz-template/controller@^0.0.1-alpha.41":
version "0.0.1-alpha.41"
resolved "http://npm.zhr.icu/@ibiz-template%2fcontroller/-/controller-0.0.1-alpha.41.tgz#4a1ca8f4dfdc4341710f2bbc8d23446617428dcc"
integrity sha512-NOeX2Kf4qgx6LUR9KUrt+/Dm8RJPXRk81UBL0mDQw5eQFy11GFPQhVoY5Ls/xQk8Wrxn6IOYOiu/JrLNxp3heg==
dependencies:
async-validator "^4.2.5"
dayjs "^1.11.5"
"@ibiz-template/core@^0.0.1-alpha.40":
version "0.0.1-alpha.40"
resolved "https://registry.yarnpkg.com/@ibiz-template/core/-/core-0.0.1-alpha.40.tgz#83773519c2befa453e5944516941f2553de67d7a"
integrity sha512-8O411O3StgmbohRkOhh1GkdSln3xH4CEIqBqc/sVtPw/1YuTP/LaLr8g/qfCiuq8KriVOk1IDkKMZrPrVqG7Qg==
"@ibiz-template/core@^0.0.1-alpha.41":
version "0.0.1-alpha.41"
resolved "http://npm.zhr.icu/@ibiz-template%2fcore/-/core-0.0.1-alpha.41.tgz#014411a468d6479f565e52af3e38d4385d8e1518"
integrity sha512-zrrt/cCGFj4eOYSjmhqc7D9v8rPQ71CbE6UJjvOuDrTu4BSjktqNC5L1tX/fl+mt8V0x1FkaZH1vrSSktwstKw==
dependencies:
axios "^1.1.3"
loglevel "^1.8.0"
pluralize "^8.0.0"
qs "^6.11.0"
"@ibiz-template/model@^0.0.1-alpha.39":
version "0.0.1-alpha.39"
resolved "https://registry.yarnpkg.com/@ibiz-template/model/-/model-0.0.1-alpha.39.tgz#75dae9cb4486758eb7ac3f0b085f109313cbe3de"
integrity sha512-HPpCR8W6enEjWxGdYdDKJJdirO4Qx5dIpYNfZVrmhHX7dd+Ov9OnpunnIXeTLk8RFzFfQEf9ZuOTziU7QX5dfg==
"@ibiz-template/model@^0.0.1-alpha.41":
version "0.0.1-alpha.41"
resolved "http://npm.zhr.icu/@ibiz-template%2fmodel/-/model-0.0.1-alpha.41.tgz#f4b5c61926768bb3c5138628fd39d921902457d7"
integrity sha512-aakOQlZNTS7lIl0J3vICitswVN3xqACDSNj1HBLoM/mYshyjtpcwyY84/6KurAoGWI9y0KVGpBJjLufGsVevhA==
dependencies:
"@ibiz/dynamic-model-api" "^2.1.5"
pluralize "^8.0.0"
"@ibiz-template/runtime@^0.0.1-alpha.40":
version "0.0.1-alpha.40"
resolved "https://registry.yarnpkg.com/@ibiz-template/runtime/-/runtime-0.0.1-alpha.40.tgz#3b60fb3d777d744037f2bc0c8492088e69d497e9"
integrity sha512-QnGZ9A32caNbPUyhHP3+rNJBM6HdxKxJh4FgNvtlpuiNga9Cw8vG0OHmM9LkMZFs4u6Gu79fationwJIBducqA==
"@ibiz-template/runtime@^0.0.1-alpha.41":
version "0.0.1-alpha.41"
resolved "http://npm.zhr.icu/@ibiz-template%2fruntime/-/runtime-0.0.1-alpha.41.tgz#dc50d155bcb97ab8e2882ebc0cc201b5b59a5497"
integrity sha512-b9ALOMwVJxPsadqiD+Z/+c/v7kBuVRHqKuYwLYKLe64jEnFwi+KA3PARfQhSw9ntKGvg+9s9uiehC058ti4c6Q==
dependencies:
"@ibiz-template/command" "^0.0.1-alpha.37"
"@ibiz-template/command" "^0.0.1-alpha.41"
"@ibiz-template/service@^0.0.1-alpha.40":
version "0.0.1-alpha.40"
resolved "https://registry.yarnpkg.com/@ibiz-template/service/-/service-0.0.1-alpha.40.tgz#94bb0df2619e195e340a33a5db1fe058918e3bbb"
integrity sha512-DAcha7xUwxmpdC0fuL4InGlDAy2L9sABmoP3n5er8SXMzfGRKxlCt6cOtwwC5+P/4igCb/Uqv80Is8XWuqNDbg==
"@ibiz-template/service@^0.0.1-alpha.41":
version "0.0.1-alpha.41"
resolved "http://npm.zhr.icu/@ibiz-template%2fservice/-/service-0.0.1-alpha.41.tgz#f97221fc3e3f4c3b07cc53e69ed29a2a8f35c5b9"
integrity sha512-g/P9mqu/uem+V70JFpIWag8IysjmiwcBNCO5dsRjaxRpUg7BIZob6elHfucyPth0z3iXXooO9cng/eqLsZUvHA==
"@ibiz-template/theme@^0.0.1-alpha.40":
version "0.0.1-alpha.40"
resolved "https://registry.yarnpkg.com/@ibiz-template/theme/-/theme-0.0.1-alpha.40.tgz#fc0c891f651d4ce25d780c2152654b31521570e9"
integrity sha512-e3R5XAhG23QgwZheW92vzZGf+CklnvE18UG+NJ2XsIORWVJfwxA3ix89/oFmA0sXUVX7+iI4SuhubhvbWu787A==
"@ibiz-template/theme@^0.0.1-alpha.41":
version "0.0.1-alpha.41"
resolved "http://npm.zhr.icu/@ibiz-template%2ftheme/-/theme-0.0.1-alpha.41.tgz#177c16d649413f536491d94a7944d9485a97897a"
integrity sha512-SP/u1HlPIGK0t/TG2WrHdf63EPd78eW3rKq/nlWZmPNBlpRiYZgE6c3iR0ZR6iUd++tkMryuD5ptpSjUodfCww==
"@ibiz-template/vue-util@^0.0.1-alpha.40":
version "0.0.1-alpha.40"
resolved "https://registry.yarnpkg.com/@ibiz-template/vue-util/-/vue-util-0.0.1-alpha.40.tgz#0080298397aff172a0f0ae5c4dcc853912f91236"
integrity sha512-dSLVzVA0b3bHe2Y4eOvcCCauCawYE0L2PTimgeYieVK36KGSk5wbA75JLaDJJyXhNYU3tbtK3TV9fS0EvU9upw==
"@ibiz-template/vue-util@^0.0.1-alpha.41":
version "0.0.1-alpha.41"
resolved "http://npm.zhr.icu/@ibiz-template%2fvue-util/-/vue-util-0.0.1-alpha.41.tgz#d33ba98009f28d42f429669f4d3989f995517e37"
integrity sha512-oyfyldxjELlYx9u/PHxaPJNrCgvjeQmWRdy547wrCeEYPcJrAGQB80LQJ8SdzBq68CPuEfX0ZuX99m82RNT6SQ==
"@ibiz/dynamic-model-api@^2.1.5":
version "2.1.5"
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册