提交 9c8aa3ac 编写于 作者: Mosher's avatar Mosher

update:更新

上级 9d52e4f8
......@@ -16,7 +16,7 @@ export class {{pascalCase appEntity.codeName}}ServiceBase extends EntityService
* @memberof {{pascalCase appEntity.codeName}}ServiceBase
*/
constructor(opts: IParam = {}) {
super(opts,'{{pascalCase appEntity.codeName}}');
super(opts,'{{pascalCase appEntity.codeName}}');
}
/**
......@@ -32,12 +32,12 @@ export class {{pascalCase appEntity.codeName}}ServiceBase extends EntityService
this.appEntityKeyCodeName = '{{lowerCase appEntity.keyPSAppDEField.codeName}}';
{{/if}}
{{#if appEntity.majorPSAppDEField}}
this.appEntityTextCodeName = '{{lowerCase appEntity.majorPSAppDEField.codeName}}';
this.appEntityTextCodeName = '{{lowerCase appEntity.majorPSAppDEField.codeName}}';
{{/if}}
// 初始化关系实体路径集合
this.deResPaths = [
{{#each appEntity.appEntityResources as |appEntityResource| }}
{{appEntityResource.deResPaths}}{{#unless @last}},{{/unless}}
{{appEntityResource.deResPaths}}{{#unless @last}},{{/unless}}
{{/each}}
]
}
......@@ -57,7 +57,7 @@ export class {{pascalCase appEntity.codeName}}ServiceBase extends EntityService
{{!-- 脚本代码 --}}
{{> @macro/front-end/entity/service-script-method.hbs singleAppMethod=singleAppMethod}}
{{else if (and singleAppMethod.psDEServiceAPIMethod appEntity.major)}}
{{else if (and singleAppMethod.psDEServiceAPIMethod (or appEntity.major appEntity.minorPSAppDERSs))}}
{{!-- 远程接口 --}}
{{> @macro/front-end/entity/service-remote-method.hbs singleAppMethod=singleAppMethod}}
......
......@@ -102,8 +102,9 @@ export class MPickupView extends PickupView {
* @memberof MPickupView
*/
protected onAllMoveLeft() {
const { selections } = toRefs(this.state);
const { selections, selectedData } = toRefs(this.state);
selections.value = [];
selectedData.value = [];
}
/**
......@@ -141,6 +142,8 @@ export class MPickupView extends PickupView {
srfmajortext += `${select.srfmajortext}${index !== selections.value.length - 1 ? ',' : ''}`;
});
data.push({ srfkey: srfkey, srfmajortext: srfmajortext });
} else {
data.push({ srfkey: '', srfmajortext: '' });
}
this.emit('viewEvent', { tag: this.state.viewName, action: 'viewDataChange', data: data });
this.emit('viewEvent', { tag: this.state.viewName, action: 'viewClose', data: null });
......
......@@ -25,30 +25,71 @@ export class TreeControl extends MDControl {
this.state.isBranchAvailable = toRef(this.props, 'isBranchAvailable') !== false;
}
/**
* @description 处理选中数据
* @protected
* @param {IParam[]} newVal
* @param {*} oldVal
* @memberof TreeControl
*/
protected handleSelectedData(newVal: IParam[], oldVal: any) {
const { selectedKeys, selectedNodes } = toRefs(this.state);
const keys: string[] = [];
const nodes: IParam[] = [];
newVal.forEach((value: IParam) => {
if (value.srfkey) {
const node = this.getTreeNodeByKey(value.srfkey, 'srfkey');
if (node) {
keys.push(node.id);
nodes.push(node);
}
}
});
selectedKeys.value = [...keys];
selectedNodes.value = [...nodes];
}
/**
* @description 树节点选中
* @param {string} nodeId
* @param { nativeEvent: MouseEvent, node: any, selected: boolean } e
* @memberof TreeControl
*/
public onTreeNodeSelect(nodeId: string, e: { nativeEvent: MouseEvent, node: any, selected: boolean }) {
protected onTreeNodeSelect(nodeId: string, e: { nativeEvent: MouseEvent, node: any, selected: boolean }) {
if (e.node.disabled) {
e.node.isCurrent = false;
return;
}
const { isBranchAvailable, currentSelectedNode, isMultiple } = this.state;
let { selectedNodes } = this.state;
const { isBranchAvailable, isMultiple } = this.state;
const { selectedNodes, currentSelectedNode } = toRefs(this.state);
if (isBranchAvailable || e.node.isLeaf) {
if (currentSelectedNode.value && Object.keys(currentSelectedNode.value).length > 0) {
currentSelectedNode.value.srfchecked = 0;
}
e.node.srfchecked = 1;
currentSelectedNode.value = e.node;
// 多选树树选中不识别,使用checkbox多选
if (!isMultiple) {
selectedNodes = [currentSelectedNode.value];
this.emit("ctrlEvent", { tag: this.props.name, action: 'selectionChange', data: deepCopy(selectedNodes) });
selectedNodes.value = [currentSelectedNode.value];
} else {
selectedNodes.value.push(e.node);
}
this.emit("ctrlEvent", { tag: this.props.name, action: 'selectionChange', data: deepCopy(selectedNodes.value) });
}
}
/**
* 树节点复选框选中
*
* @protected
* @param {string[]} _checkedKeys
* @param {{ nativeEvent: MouseEvent, node: IParam, checkedNodes: IParam[] }} { nativeEvent: event, node, checkedNodes }
* @memberof TreeControl
*/
protected onCheck(_checkedKeys: string[], { nativeEvent: event, node, checkedNodes }: { nativeEvent: MouseEvent, node: IParam, checkedNodes: IParam[] }) {
const { selectedNodes } = toRefs(this.state);
if (this.state.isMultiple) {
selectedNodes.value = [...checkedNodes];
this.emit("ctrlEvent", { tag: this.props.name, action: "selectionChange", data: selectedNodes.value });
}
}
......@@ -62,8 +103,8 @@ export class TreeControl extends MDControl {
private computecurNodeContext(curNode: any) {
const { context } = this.state;
let tempContext: any = {};
if (curNode && curNode.data && curNode.data.srfappctx) {
tempContext = deepCopy(curNode.data.srfappctx);
if (curNode && curNode.srfappctx) {
tempContext = deepCopy(curNode.srfappctx);
} else {
tempContext = deepCopy(context);
}
......@@ -132,7 +173,7 @@ export class TreeControl extends MDControl {
items.value.push(item);
});
} else {
const nodeData = this.getTreeNodeById(node.id);
const nodeData = this.getTreeNodeByKey(node.id);
data.forEach((item: any) => {
item.parentNodeId = node.id;
});
......@@ -250,7 +291,7 @@ export class TreeControl extends MDControl {
const { currentSelectedNode } = this.state;
if (currentSelectedNode && currentSelectedNode.parentNodeId) {
// 父节点
const parentNode = this.getTreeNodeById(currentSelectedNode.parentNodeId);
const parentNode = this.getTreeNodeByKey(currentSelectedNode.parentNodeId);
if (parentNode) {
delete parentNode.children;
// this.load(parentNode);
......@@ -484,7 +525,7 @@ export class TreeControl extends MDControl {
* @return {*}
* @memberof TreeControl
*/
private getTreeNodeById(id: string): any {
private getTreeNodeByKey(id: string, key: string = 'id'): any {
const { items } = toRefs(this.state);
if (!isExistAndNotEmpty(id) || (!items.value || items.value.length === 0)) {
return null;
......@@ -492,7 +533,7 @@ export class TreeControl extends MDControl {
let node: any = null;
const getNode = (item: any): boolean => {
let flag: boolean = false;
if (item.id === id) {
if (item[key] === id) {
node = item;
flag = true;
}
......@@ -526,7 +567,8 @@ export class TreeControl extends MDControl {
...superParams,
onTreeNodeSelect: this.onTreeNodeSelect.bind(this),
onContextMenuClick: this.onContextMenuClick.bind(this),
onRightClick: this.onRightClick.bind(this)
onRightClick: this.onRightClick.bind(this),
onCheck: this.onCheck.bind(this)
};
}
}
\ No newline at end of file
......@@ -293,7 +293,8 @@ export class TreeService<T extends ControlVOBase> extends ControlServiceBase<T>
Object.assign(tempContext, {
srfparentdename: deCodeName,
srfparentdemapname: node.appDataEntity?.deName,
srfparentkey: strId
srfparentkey: strId,
[deCodeName.toLowerCase()]: strId
});
Object.assign(treeNode, {
srfappctx: tempContext,
......
......@@ -135,14 +135,20 @@ export class RouteUtil {
deResPath.some((deResNode: any, index: number) => {
let value: any = context[deResNode.parameterName];
if (notEmpty(value)) {
curMatch++;
curRoutPath += `/${deResNode.pathName}/${value}`;
// 如果不是最后一条,则正常拼接,否则会一直拼接
if (index !== deResPath.length - 1) {
if (notEmpty(value)) {
curMatch++;
curRoutPath += `/${deResNode.pathName}/${value}`;
} else {
// 只要有一个节点没值,则整个路径作废。
curMatch = 0;
curRoutPath = '';
return true
}
} else {
// 只要有一个节点没值,则整个路径作废。
curMatch = 0;
curRoutPath = '';
return true
curMatch++;
curRoutPath += `/${deResNode.pathName}/${notEmpty(value) ? value : 'undefined'}`;
}
});
......@@ -154,9 +160,9 @@ export class RouteUtil {
});
// 如果一个匹配的没有,即没有任何主键匹配上,关系路径为实体自身的/pathName/undefined
if(routePath == ''){
routePath = "/"+deResPaths[deResPaths.length -1][0].pathName+"/undefined";
}
// if(routePath == ''){
// routePath = "/"+deResPaths[deResPaths.length -1][0].pathName+"/undefined";
// }
return routePath;
}
......
......@@ -7,4 +7,5 @@
@use './lock.scss';
@use './app-form-item.scss';
@use './app-popover.scss';
@use './app-form-button.scss';
\ No newline at end of file
@use './app-form-button.scss';
@use './app-modal.scss';
\ No newline at end of file
......@@ -4,6 +4,7 @@
padding: 0;
}
.app-mpickup-view__split {
height: 100%;
.split__buttons {
display: flex;
align-items: center;
......@@ -13,8 +14,23 @@
background-color: #f6f6f6;
}
}
.app-mpickup-view__split > .ant-col {
height: 100%;
}
.app-view-layout__footer {
padding: 12px 0;
justify-content: flex-end;
}
.picker-item {
height: 32px;
line-height: 32px;
background: #ffffff;
color: #666666;
border-radius: 3px;
margin: 10px;
text-indent: 20px;
}
.picker-item__selected {
background: #e6f7ff;
}
}
\ No newline at end of file
......@@ -9,6 +9,11 @@
line-height: 16px;
transform: translate(40px, -1px);
}
// TODO 缺少包含工具栏,搜索高度
.ant-tree-list .ant-tree-list-holder-inner {
height: 100%;
overflow: auto;
}
}
// 树节点上下文菜单
.tree-node__context-menu {
......
......@@ -9,4 +9,5 @@
@use './app-grid.scss';
@use './app-tree.scss';
@use './app-list.scss';
@use './app-panel.scss';
\ No newline at end of file
@use './app-panel.scss';
@use './app-pickup-view-panel.scss';
\ No newline at end of file
......@@ -73,8 +73,8 @@ const { state, pickupViewPanel, onCancel, onConfirm, onCtrlEvent, onMoveRight, o
</a-col>
<a-col :span="1" class="split__buttons">
<a-space direction="vertical">
<a-button @click="onMoveRight"><right-outlined /></a-button>
<a-button @click="onMoveLeft"><left-outlined /></a-button>
<a-button @click="onMoveRight" :disabled="state.selectedData.length === 0"><right-outlined /></a-button>
<a-button @click="onMoveLeft" :disabled="state.rightPanelSelections.length === 0"><left-outlined /></a-button>
<a-button @click="onAllMoveRight"><double-right-outlined /></a-button>
<a-button @click="onAllMoveLeft"><double-left-outlined /></a-button>
</a-space>
......@@ -91,7 +91,7 @@ const { state, pickupViewPanel, onCancel, onConfirm, onCtrlEvent, onMoveRight, o
</a-row>
<template v-slot:footer>
<a-space class="app-mpickup-view--footer">
<a-button @click="onConfirm">确认</a-button>
<a-button @click="onConfirm" :disabled="state.selections.length === 0">确认</a-button>
<a-button @click="onCancel">取消</a-button>
</a-space>
</template>
......
......@@ -22,11 +22,13 @@ interface Props {
viewParams?: IParam;
openType?: "ROUTE" | "MODAL" | "EMBED";
viewSubject?: Subject<IActionParam>;
selectedData?: IParam[];
selectedData?: IParam[];
multiple?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
openType:'ROUTE',
multiple: false,
viewSubject: () => new Subject<IActionParam>()
})
......@@ -104,7 +106,7 @@ const { state, tree, onCtrlEvent, onQuickGroupEvent, onQuickSearchEvent } = pick
<{{codeName}}Tree
ref="tree"
name="{{name}}"
:multiple="false"
:multiple="multiple"
:context="state.context"
:showBusyIndicator="true"
:viewParams="state.viewParams"
......
......@@ -13,14 +13,17 @@ interface Props {
viewParams?: IParam;
controlAction: ControlAction;
showBusyIndicator?: boolean;
multiple?: boolean;
viewSubject: Subject<IActionParam>;
selectedData?: IParam[];
}
const props = withDefaults(defineProps<Props>(), {
viewSubject: () => new Subject<IActionParam>(),
showBusyIndicator: true,
selectFirstDefault: false,
isBranchAvailable: false
isBranchAvailable: false,
multiple: false
})
// emit声明
......@@ -46,7 +49,7 @@ const getCustomText = (scriptCode: any) => {
}
// 安装功能模块,提供状态和能力方法
const { name, state, load, refresh, onTreeNodeSelect, onContextMenuClick, onRightClick } = new TreeControl(ctrlState, props, emit).moduleInstall();
const { name, state, load, refresh, onTreeNodeSelect, onContextMenuClick, onRightClick, onCheck } = new TreeControl(ctrlState, props, emit).moduleInstall();
{{#and ctrl.psAppCounterRef ctrl.psAppCounterRef.psAppCounter}}
// 获取计数器数据
......@@ -74,8 +77,10 @@ defineExpose({ name, state, load, refresh });
show-icon
v-model:expandedKeys="state.expandedKeys"
v-model:selectedKeys="state.selectedKeys"
v-model:checkedKeys="state.selectedKeys"
@select="onTreeNodeSelect"
@rightClick="onRightClick">
@rightClick="onRightClick"
@check="onCheck">
<template #icon="node">
<span class="app-tree-node__icon">
<template v-if="node.iconCustomCode && node.iconScriptCode">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册