import { useMPickupViewController, useNamespace, } from '@ibiz-template/vue-util'; import { defineComponent, getCurrentInstance, PropType, Ref, ref } from 'vue'; import { IModal } from '@ibiz-template/runtime'; import '@ibiz-template/theme/style/components/views/mpickup-view/mpickup-view.scss'; export const MPickupView = defineComponent({ props: { context: Object as PropType, params: { type: Object as PropType, default: () => ({}) }, modelPath: { type: String, required: true }, modal: { type: Object as PropType }, }, setup(props) { const { proxy } = getCurrentInstance()!; const c = useMPickupViewController(proxy, props.modelPath); // model.typeClass const ns = useNamespace('view-dempickupview'); // UI层单击选中的数组 const UISelections: Ref = ref([]); const handleSelectionClick = (selection: IData) => { const index = UISelections.value.indexOf(selection); if (index === -1) { UISelections.value.push(selection); } else { UISelections.value.splice(index, 1); } }; const isSelected = (selection: IData) => { return UISelections.value.includes(selection); }; const addRight = () => { c.addSelections(c.embedSelection); UISelections.value = []; }; const addRightAll = () => { c.selectAll(); UISelections.value = []; }; const removeRight = () => { c.removeSelections(UISelections.value); UISelections.value = []; }; const removeRightAll = () => { c.selfSelection = []; UISelections.value = []; }; return { ns, c, addRight, addRightAll, removeRight, removeRightAll, handleSelectionClick, isSelected, }; }, render(h) { let panelComponent = null; if (this.c.complete) { const { pickupViewPanel } = this.c.model; if (this.c.providers[pickupViewPanel.name]) { panelComponent = h(this.c.providers[pickupViewPanel.name].component, { props: { modelData: pickupViewPanel, context: this.c.context, params: this.c.params, }, on: { neuronInit: this.c.nerve.onNeuronInit(pickupViewPanel.name), }, }); } } return ( { return (
{ this.c.onOkButtonClick(); }} > 确定 { this.c.onCancelButtonClick(); }} > 取消
); }, }} >
{this.c.complete && this.c.model.pickupViewPanel && (
{panelComponent}
)}
{'>'} {'<'} {'>>'} {'<<'}
{this.c.selfSelection.map(item => { return (
this.handleSelectionClick(item)} > {item.srfmajortext} { this.c.removeSelections([item]); }} />
); })}
); }, });