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

更新看板视图逻辑

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