提交 160dedcd 编写于 作者: Mosher's avatar Mosher

更新看板视图逻辑

上级 aca0084a
......@@ -16,12 +16,12 @@ ${ctrl.render.code}
<Icon :type="group.folding ? 'md-arrow-dropright' : 'md-arrow-dropleft'" size="25" @click="onClick(group,index)"/>
</div>
<div class="dataview-group-folding">
<span>{{getGroupText(group.name)}}({{group.items.length}})</span>
<span>{{getGroupText(group.value)}}({{group.items.length}})</span>
</div>
</div>
<div :key="group + index" class="dataview-group-content dataview-group-kanban" style="<#if ctrl.getGroupWidth() gt 0>width: ${ctrl.getGroupWidth()?c}px;<#else>flex-grow: 1;</#if>">
<div class="dataview-group-header<#if ctrl.getGroupPSSysCss()??> ${ctrl.getGroupPSSysCss().getCssName()}</#if>">
{{ getGroupText(group.name) }}
{{ getGroupText(group.value) }}
<#if ctrl.getGroupPSUIActionGroup()??>
<Poptip trigger="hover" content="content" placement="bottom-end" style="float: right;">
<Icon type="md-more" />
......@@ -46,7 +46,7 @@ ${ctrl.render.code}
</Poptip>
</#if>
</div>
<draggable :list="group.items" group="${ctrl.name}" class="dataview-group-items" @change="onDragChange($event, group.name)">
<draggable :list="group.items" group="${ctrl.name}" class="dataview-group-items" @change="onDragChange($event, group.value)">
<div v-for="(item, i) in group.items" :key="i" :class="{'dataview-group-item': true, 'is-select': item.isselected}" @click="handleClick(item)" @dblclick="handleDblClick(item)">
<#if ctrl.getItemPSLayoutPanel()??>
<#assign panel = ctrl.getItemPSLayoutPanel()>
......@@ -89,6 +89,7 @@ ${ctrl.render.code}
</template>
<#assign import_block>
import draggable from "vuedraggable";
import CodeListService from '@/service/app/codelist-service';
</#assign>
<#assign component_block>
draggable,
......@@ -243,6 +244,22 @@ draggable,
*/
public selections: Array<any> = [];
/**
* 代码表服务
*
* @type {CodeListService}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public codeListService:CodeListService = new CodeListService( {$store: this.$store});
/**
* 代码表数据
*
* @type {Array<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public allCodeList:Array<any> = [];
/**
* 当前页
*
......@@ -304,13 +321,12 @@ draggable,
*/
public groupMode: string = '${ctrl.getGroupMode()}'
/**
* 分组模式
* 分组代码表
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public groupCodelist: string = '<#if ctrl.getGroupPSCodeList()??>${ctrl.getGroupPSCodeList().getCodeName()}</#if>'
public groupCodelist: any = {<#if ctrl.getGroupPSCodeList()??>type:'${ctrl.getGroupPSCodeList().getCodeListType()}',tag:'${ctrl.getGroupPSCodeList().getCodeName()}'</#if>};
/**
* Vue声明周期,组件挂载完毕
*
......@@ -421,7 +437,7 @@ draggable,
* @param {boolean} [isReset=false] 是否重置items
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public load(opt: any = {}, isReset: boolean = false): void {
public async load(opt: any = {}, isReset: boolean = false): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: '${view.getName()}' + (this.$t('app.kanban.notConfig.fetchAction') as string) });
return;
......@@ -626,7 +642,7 @@ draggable,
* @param {}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public setGroups() {
public async setGroups() {
if(!this.isGroup || !this.groupField || Object.is(this.groupMode, 'NONE')) {
return;
}
......@@ -637,6 +653,7 @@ draggable,
if(!group) {
this.groups.push({
name: item[this.groupField],
value: item[this.groupField],
items: this.getGroupItems(item[this.groupField])
})
}
......@@ -644,11 +661,13 @@ draggable,
}
if(Object.is(this.groupMode, 'CODELIST') && this.groupCodelist) {
this.groups = [];
let codelist: any = this.$store.getters.getCodeList(this.groupCodelist);
if(codelist) {
codelist.items.forEach((item: any) => {
let codelistItems: any = await this.codeListService.getDataItems(this.groupCodelist);
this.allCodeList = Util.deepCopy(codelistItems);
if(codelistItems && codelistItems.length >0) {
codelistItems.forEach((item: any) => {
this.groups.push({
name: item.value,
value: item.value,
items: this.getGroupItems(item.value)
})
})
......@@ -680,18 +699,18 @@ draggable,
*/
public getGroupText(name: string) {
if(Object.is(this.groupMode, 'CODELIST') && this.groupCodelist) {
let codelist: any = this.$store.getters.getCodeList(this.groupCodelist);
if(codelist) {
if(this.allCodeList && this.allCodeList.length >0) {
if(!name) {
return codelist.emptytext;
return '未定义';
}
let item = codelist.items.find((item: any) => Object.is(item.value, name));
let item = this.allCodeList.find((item: any) => Object.is(item.value, name));
if(item) {
return item.text;
}
}
}else{
return name;
}
return name;
}
/**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册