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

update:更新

1、表格列类型获取逻辑调整
2、多数据视图快速分组加载逻辑调整
3、预置导出行为调整
4、标签组件格式化逻辑调整
上级 b24eb94b
...@@ -23,9 +23,13 @@ ...@@ -23,9 +23,13 @@
<AppSpan <AppSpan
name="{{#if item.dataItemName}}{{lowerCase item.dataItemName}}{{else}}{{item.codeName}}{{/if}}" name="{{#if item.dataItemName}}{{lowerCase item.dataItemName}}{{else}}{{item.codeName}}{{/if}}"
:value="text" :value="text"
{{#if item.psAppDEField}} {{#each ctrl.psDEGridDataItems as | dataItem |}}
:dataType="{{item.psAppDEField.stdDataType}}" {{#eq dataItem.name item.dataItemName}}
{{/if}} {{#if dataItem.dataType}}
:dataType="{{dataItem.dataType}}"
{{/if}}
{{/eq}}
{{/each}}
valueFormat="{{item.valueFormat}}" valueFormat="{{item.valueFormat}}"
:precision="{{#if item.precision}}{{item.precision}}{{else}}0{{/if}}" :precision="{{#if item.precision}}{{item.precision}}{{else}}0{{/if}}"
></AppSpan> ></AppSpan>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<span> <span>
<a-input-number v-model:value="startPage" @change="onChange('start')" :min="1" @click.stop :controls="false" /> <a-input-number v-model:value="startPage" @change="onChange('start')" :min="1" @click.stop :controls="false" />
~ ~
<a-input-number v-model:value="endPage" @change="onChange('end')" @click.stop :min="1" :controls="false" /> <a-input-number v-model:value="endPage" @change="onChange('end')" @click.stop :min="2" :controls="false" />
<a-button type="text" @click="exportExcel('custom', $event)">GO</a-button> <a-button type="text" @click="exportExcel('custom', $event)">GO</a-button>
</span> </span>
</a-menu-item> </a-menu-item>
...@@ -38,7 +38,7 @@ const props = withDefaults(defineProps<exportExcelProps>(), {}); ...@@ -38,7 +38,7 @@ const props = withDefaults(defineProps<exportExcelProps>(), {});
// 初始化选择值 // 初始化选择值
const startPage = ref(1); const startPage = ref(1);
const endPage = ref(10); const endPage = ref(2);
/** /**
* 导出数据 * 导出数据
......
...@@ -21,7 +21,7 @@ const handleClick = ($event: any) => { ...@@ -21,7 +21,7 @@ const handleClick = ($event: any) => {
selectItem.value = $event; selectItem.value = $event;
emit('onQuickGroupEvent', { emit('onQuickGroupEvent', {
tag: 'quickGroup', tag: 'quickGroup',
action: "valueChange", action: 'valueChange',
data: $event, data: $event,
}); });
}; };
...@@ -31,27 +31,50 @@ const codeListService = App.getCodeListService(); ...@@ -31,27 +31,50 @@ const codeListService = App.getCodeListService();
onBeforeMount(() => { onBeforeMount(() => {
if (codeListService) { if (codeListService) {
codeListService.getCodeListItems({ tag: props.quickGroupModel.codeListTag, context: props.context, viewParams: props.viewParams }).then((codeListItems: any[]) => { codeListService
items.value = codeListItems; .getCodeListItems({
// 默认选中第一项 tag: props.quickGroupModel.codeListTag,
if (codeListItems.length) { context: props.context,
handleClick(items.value[0]); viewParams: props.viewParams,
} })
}) .then((codeListItems: any[]) => {
items.value = codeListItems;
// 默认选中第一项
if (codeListItems.length) {
emit('onQuickGroupEvent', {
tag: 'quickGroup',
action: 'initSuccess',
data: items.value[0],
});
}
})
.catch((error: any) => {
emit('onQuickGroupEvent', {
tag: 'quickGroup',
action: 'initError',
data: null,
});
});
} }
}); });
</script> </script>
<template> <template>
<a-space class="app-quick-group" :size="0"> <a-space class="app-quick-group" :size="0">
<a-button class="quick-group-item" v-for="(item, index) in items" :key="index" type="text" @click="handleClick(item)"> <a-button
class="quick-group-item"
v-for="(item, index) in items"
:key="index"
type="text"
@click="handleClick(item)"
>
<span :style="{ color: item.color }"> <span :style="{ color: item.color }">
<AppIconText v-if="!item.children" :text="item.text" :iconClass="item.iconClass" :imgPath="item.imgPath" /> <AppIconText v-if="!item.children" :text="item.text" :iconClass="item.iconClass" :imgPath="item.imgPath" />
<a-dropdown v-else> <a-dropdown v-else>
<AppIconText :text="item.text" :iconClass="item.iconClass" :imgPath="item.imgPath" /> <AppIconText :text="item.text" :iconClass="item.iconClass" :imgPath="item.imgPath" />
<template #overlay> <template #overlay>
<a-menu> <a-menu>
<a-menu-item v-for="(childItem,index) in item.children" :key="index"> <a-menu-item v-for="(childItem, index) in item.children" :key="index">
<AppIconText :text="childItem.text" :iconClass="childItem.iconClass" :imgPath="childItem.imgPath" /> <AppIconText :text="childItem.text" :iconClass="childItem.iconClass" :imgPath="childItem.imgPath" />
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
......
<script setup lang="ts"> <script setup lang="ts">
import { IParam, EditorBase, IContext } from "@core"; import { IParam, EditorBase, IContext, DataTypes, isExistAndNotEmpty } from "@core";
import moment from "moment";
import { onBeforeMount, ref, Ref } from "vue"; import { onBeforeMount, ref, Ref } from "vue";
interface SpanProps { interface SpanProps {
/** /**
...@@ -24,7 +25,7 @@ interface SpanProps { ...@@ -24,7 +25,7 @@ interface SpanProps {
* @type {string} * @type {string}
* @memberof AppSpan * @memberof AppSpan
*/ */
dataType?: string; dataType?: number;
/** /**
* 单位名称 * 单位名称
...@@ -92,9 +93,14 @@ interface SpanProps { ...@@ -92,9 +93,14 @@ interface SpanProps {
const props = withDefaults(defineProps<SpanProps>(), { const props = withDefaults(defineProps<SpanProps>(), {
unitName: "", unitName: "",
precision: 2, precision: 2,
dataType: 0
}); });
const { handleEditorNavParams, loadCodeListData } = new EditorBase(); const { handleEditorNavParams, loadCodeListData } = new EditorBase();
const { navContext, navViewParam } = handleEditorNavParams(props); const { navContext, navViewParam } = handleEditorNavParams(props);
// 数据类型
const dataTypeValue = computed(() => {
return DataTypes.toString(props.dataType);
})
let text: Ref<string> = ref(""); let text: Ref<string> = ref("");
let textFormat: Ref<string> = ref(""); let textFormat: Ref<string> = ref("");
// 初始化值 // 初始化值
...@@ -119,18 +125,24 @@ const initText = () => { ...@@ -119,18 +125,24 @@ const initText = () => {
} }
if (props.valueFormat) { if (props.valueFormat) {
textFormat.value = props.valueFormat; textFormat.value = props.valueFormat;
} else if ( } else if (DataTypes.isDate(dataTypeValue.value)) {
Object.is(props.dataType, "DATETIME") ||
Object.is(props.dataType, "DATE") ||
Object.is(props.dataType, "TIME") ||
Object.is(props.dataType, "SMALLDATETIME")
) {
textFormat.value = "YYYY-MM-DD HH:mm:ss"; textFormat.value = "YYYY-MM-DD HH:mm:ss";
} else if (Object.is(props.dataType, "NUMBER")) { } else if (DataTypes.isNumber(dataTypeValue.value)) {
textFormat.value = `#${props.unitName}`; textFormat.value = `#${props.unitName}`;
} }
} }
const getFormatDate = () => {
if (!isExistAndNotEmpty(props.value)) {
return '';
}
const value = moment(props.value).format(textFormat.value);
if (value !== 'Invalid date') {
return value;
}
return props.value;
}
onBeforeMount(() => { onBeforeMount(() => {
// 监听值变化 // 监听值变化
watch(() => props.value, (newVal: any, oldVal: any) => { if (newVal !== oldVal) initText(); }); watch(() => props.value, (newVal: any, oldVal: any) => { if (newVal !== oldVal) initText(); });
...@@ -140,7 +152,9 @@ onBeforeMount(() => { ...@@ -140,7 +152,9 @@ onBeforeMount(() => {
<template> <template>
<div :class="['app-editor-container', 'app-span', `app-span-${name}`]"> <div :class="['app-editor-container', 'app-span', `app-span-${name}`]">
<span v-format="textFormat">{{text}}</span> <span v-if="DataTypes.isDate(dataTypeValue)">{{getFormatDate()}}</span>
<span v-else-if="textFormat" v-format="textFormat">{{text}}</span>
<span v-else>{{text}}</span>
</div> </div>
</template> </template>
......
...@@ -408,12 +408,16 @@ export class AppSysAction { ...@@ -408,12 +408,16 @@ export class AppSysAction {
* @return {*} * @return {*}
*/ */
public static async exportExcel(params: IUIActionParams) { public static async exportExcel(params: IUIActionParams) {
const { actionEnvironment } = params; const { actionEnvironment, event } = params;
const exportParams: IParam = {};
if (event && (event as any).exportParams) {
Object.assign(exportParams, (event as any).exportParams);
}
// 视图里获取多数据部件 // 视图里获取多数据部件
if (actionEnvironment.xDataControl && hasFunction(actionEnvironment.xDataControl, "exportExcel")) { if (actionEnvironment.xDataControl && hasFunction(actionEnvironment.xDataControl, "exportExcel")) {
await actionEnvironment.xDataControl.exportExcel(); await actionEnvironment.xDataControl.exportExcel(exportParams);
} else if (isExist(actionEnvironment.exportExcel)) { } else if (isExist(actionEnvironment.exportExcel)) {
await actionEnvironment.exportExcel(); await actionEnvironment.exportExcel(exportParams);
} }
} }
} }
...@@ -76,7 +76,11 @@ export class MDView extends MainView { ...@@ -76,7 +76,11 @@ export class MDView extends MainView {
// 初始化搜索栏引用 // 初始化搜索栏引用
this.searchBar = ref(null); this.searchBar = ref(null);
onMounted(() => { onMounted(() => {
this.xDataControlLoad(); const { enableQuickGroup, quickGroupPSCodeList } = this.state;
// 开启快速分组时,挂载完成不主动加载数据
if (!enableQuickGroup || !quickGroupPSCodeList) {
this.xDataControlLoad();
}
}); });
} }
...@@ -131,9 +135,11 @@ export class MDView extends MainView { ...@@ -131,9 +135,11 @@ export class MDView extends MainView {
* @memberof MDView * @memberof MDView
*/ */
public handleQuickGroupSearch(args: any = {}): void { public handleQuickGroupSearch(args: any = {}): void {
this.state.quickGroupData = JSON.parse(args.data); if (args.data) {
const tag = this.getMDCtrl().name; this.state.quickGroupData = JSON.parse(args.data);
this.next({ tag: tag, action: 'load', data: null }); const tag = this.getMDCtrl().name;
this.next({ tag: tag, action: 'load', data: null });
}
} }
/** /**
...@@ -211,10 +217,6 @@ export class MDView extends MainView { ...@@ -211,10 +217,6 @@ export class MDView extends MainView {
if (searchBar) { if (searchBar) {
Object.assign(args, searchBar.getData()); Object.assign(args, searchBar.getData());
} }
// 快速搜索
// if (this.view && !this.view.isExpandSearchForm) {
// Object.assign(args, { query: this.view.query });
// }
// 快速分组 // 快速分组
const { quickGroupData } = this.state; const { quickGroupData } = this.state;
if (quickGroupData && Object.keys(quickGroupData).length) { if (quickGroupData && Object.keys(quickGroupData).length) {
...@@ -286,12 +288,22 @@ export class MDView extends MainView { ...@@ -286,12 +288,22 @@ export class MDView extends MainView {
/** /**
* @description 处理快速分组事件 * @description 处理快速分组事件
* @param {IActionParam} $event * @param {IActionParam} actionParam
* @memberof MDView * @memberof MDView
*/ */
public onQuickGroupEvent($event: IActionParam) { public onQuickGroupEvent(actionParam: IActionParam) {
if ($event) { const { action, data } = actionParam;
this.handleQuickGroupSearch($event.data); switch (action) {
case 'valueChange': // 值变化
this.handleQuickGroupSearch(data);
return;
case 'initSuccess': // 初始化完成
if (data.data) {
this.state.quickGroupData = JSON.parse(data.data);
}
case 'initError': // 初始化失败
this.xDataControlLoad();
break;
} }
} }
......
...@@ -892,7 +892,7 @@ export class FormControl extends MainControl { ...@@ -892,7 +892,7 @@ export class FormControl extends MainControl {
* @memberof FormControl * @memberof FormControl
*/ */
private async formValidateStatus(): Promise<boolean> { private async formValidateStatus(): Promise<boolean> {
const form = this.getXDataCtrl()?.value; const form = this.xDataControl;
let result: boolean = true; let result: boolean = true;
if (form && hasFunction(form, 'validate')) { if (form && hasFunction(form, 'validate')) {
try { try {
......
...@@ -507,13 +507,18 @@ export class MDControl extends MainControl { ...@@ -507,13 +507,18 @@ export class MDControl extends MainControl {
// 最大行 // 最大行
if (Object.is(opt.type, 'maxRowCount')) { if (Object.is(opt.type, 'maxRowCount')) {
Object.assign(tempViewParams, { page: 0, size: opt.maxRowCount ? opt.maxRowCount : 1000 }); Object.assign(tempViewParams, { page: 0, size: opt.maxRowCount ? opt.maxRowCount : 1000 });
// } else if (Object.is(opt.type, 'activatedPage')) { } else if (Object.is(opt.type, 'activatedPage')) {
} else {
// 当前激活页 // 当前激活页
const { current, pageSize } = mdCtrlPaging; const { current, pageSize } = mdCtrlPaging;
Object.assign(tempViewParams, { page: current - 1, size: pageSize }); Object.assign(tempViewParams, { page: current - 1, size: pageSize });
this.doExport(items); this.doExport(items);
return; return;
} else if (Object.is(opt.type, 'custom')) {
const { pageSize } = this.state;
const { startPage, endPage } = opt;
if (startPage && endPage) {
Object.assign(tempViewParams, { page: 0, offset: (startPage - 1) * pageSize, size: (endPage - startPage + 1) * pageSize });
}
} }
// 远程获取 // 远程获取
const { noSort, minorSortDir, minorSortPSDEF } = mdCtrlSort; const { noSort, minorSortDir, minorSortPSDEF } = mdCtrlSort;
......
...@@ -43,7 +43,7 @@ export class TreeExpBarControl extends ExpBarControl { ...@@ -43,7 +43,7 @@ export class TreeExpBarControl extends ExpBarControl {
protected useSearch() { protected useSearch() {
const search = (value: any, event: MouseEvent) => { const search = (value: any, event: MouseEvent) => {
const { viewSubject } = this.state; const { viewSubject } = this.state;
const xData = this.getXDataCtrl(); const xData = this.xDataControl;
if (xData) { if (xData) {
viewSubject.next({ tag: xData.name, action: 'search', data: { query: value } }); viewSubject.next({ tag: xData.name, action: 'search', data: { query: value } });
} }
......
...@@ -3,38 +3,38 @@ ...@@ -3,38 +3,38 @@
* 数据类型 * 数据类型
* *
*/ */
export class DataTypes { export class DataTypes {
static readonly DataTypes: any = { static readonly DataTypes: any = {
UNKNOWN : 0, // UNKNOWN: 0, //
BIGINT : 1, BIGINT: 1,
BINARY : 2, BINARY: 2,
BIT : 3, BIT: 3,
CHAR : 4, CHAR: 4,
DATETIME : 5, DATETIME: 5,
DECIMAL : 6, DECIMAL: 6,
FLOAT : 7, FLOAT: 7,
IMAGE : 8, IMAGE: 8,
INT : 9, INT: 9,
MONEY : 10, MONEY: 10,
NCHAR : 11, NCHAR: 11,
NTEXT : 12, NTEXT: 12,
NVARCHAR : 13, NVARCHAR: 13,
NUMERIC : 14, NUMERIC: 14,
REAL : 15, REAL: 15,
SMALLDATETIME : 16, SMALLDATETIME: 16,
SMALLINT : 17, SMALLINT: 17,
SMALLMONEY : 18, SMALLMONEY: 18,
SQL_VARIANT : 19, SQL_VARIANT: 19,
SYSNAME : 20, SYSNAME: 20,
TEXT : 21, TEXT: 21,
TIMESTAMP : 22, TIMESTAMP: 22,
TINYINT : 23, TINYINT: 23,
VARBINARY : 24, VARBINARY: 24,
VARCHAR : 25, VARCHAR: 25,
UNIQUEIDENTIFIER : 26, UNIQUEIDENTIFIER: 26,
DATE : 27, // 纯日期型 DATE: 27, // 纯日期型
TIME : 28, // 纯时间 TIME: 28, // 纯时间
BIGDECIMAL : 29, // 大数值 BIGDECIMAL: 29, // 大数值
} }
/** /**
...@@ -46,11 +46,11 @@ export class DataTypes { ...@@ -46,11 +46,11 @@ export class DataTypes {
* @return {*} * @return {*}
* @memberof DataTypes * @memberof DataTypes
*/ */
protected static equalsIgnoreCase(value:string, value2: string){ protected static equalsIgnoreCase(value: string, value2: string) {
return value.toLocaleLowerCase() == value2.toLocaleLowerCase(); return value.toLocaleLowerCase() == value2.toLocaleLowerCase();
} }
/** /**
* @description 字符串转数值 * @description 字符串转数值
* @static * @static
* @param {string} strValue * @param {string} strValue
...@@ -58,11 +58,11 @@ export class DataTypes { ...@@ -58,11 +58,11 @@ export class DataTypes {
* @memberof DataTypes * @memberof DataTypes
*/ */
public static fromString(strValue: string): number { public static fromString(strValue: string): number {
let result = this.DataTypes[strValue.toUpperCase()]; let result = this.DataTypes[strValue.toUpperCase()];
return result || this.DataTypes.VARCHAR; return result || this.DataTypes.VARCHAR;
} }
/** /**
* @description 是否为number类型 * @description 是否为number类型
* @static * @static
* @param {string} strValue * @param {string} strValue
...@@ -70,15 +70,31 @@ export class DataTypes { ...@@ -70,15 +70,31 @@ export class DataTypes {
* @memberof DataTypes * @memberof DataTypes
*/ */
public static isNumber(strValue: string): boolean { public static isNumber(strValue: string): boolean {
const numberTypes: any[] = ['BIGINT','BINARY','DECIMAL','FLOAT','INT','MONEY','NUMERIC','REAL','SMALLINT','SMALLMONEY','TINYINT','VARBINARY']; const numberTypes: any[] = ['BIGINT', 'BINARY', 'DECIMAL', 'FLOAT', 'INT', 'MONEY', 'NUMERIC', 'REAL', 'SMALLINT', 'SMALLMONEY', 'TINYINT', 'VARBINARY'];
if(numberTypes.indexOf(strValue) !== -1){ if (numberTypes.indexOf(strValue) !== -1) {
return true; return true;
}else{ } else {
return false return false
} }
} }
/** /**
* @description 是否是日期类型
* @static
* @param {string} strValue
* @return {*} {boolean}
* @memberof DataTypes
*/
public static isDate(strValue: string): boolean {
const numberTypes: any[] = ['DATETIME', 'DATE', 'TIME', 'SMALLDATETIME'];
if (numberTypes.indexOf(strValue) !== -1) {
return true;
} else {
return false
}
}
/**
* @description 获取字符串名称 * @description 获取字符串名称
* @static * @static
* @param {number} nDataType * @param {number} nDataType
...@@ -87,13 +103,13 @@ export class DataTypes { ...@@ -87,13 +103,13 @@ export class DataTypes {
*/ */
public static toString(nDataType: number) { public static toString(nDataType: number) {
let result = 'VARCHAR'; let result = 'VARCHAR';
for(let key in this.DataTypes){ for (let key in this.DataTypes) {
if(nDataType == this.DataTypes[key]){ if (nDataType == this.DataTypes[key]) {
result = key; result = key;
break; break;
} }
} }
return result; return result;
} }
} }
...@@ -410,12 +410,14 @@ export class FormatController { ...@@ -410,12 +410,14 @@ export class FormatController {
} else if (temp === '?') { } else if (temp === '?') {
returnHtml += ' '; returnHtml += ' ';
} }
if ( if (temp === '0') {
isQianfenwei && if (
(codeZhengshuNumCount - finishedNumCount) % 3 === 1 && isQianfenwei &&
codeZhengshuNumCount - finishedNumCount !== 1 (codeZhengshuNumCount - finishedNumCount) % 3 === 1 &&
) { codeZhengshuNumCount - finishedNumCount !== 1
returnHtml += ','; ) {
returnHtml += ',';
}
} }
newFormatRule = newFormatRule.slice(1); newFormatRule = newFormatRule.slice(1);
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册