diff --git a/OrangeFormsOpen-VUE3/index.html b/OrangeFormsOpen-VUE3/index.html
index 023f6a14..ad5c1710 100644
--- a/OrangeFormsOpen-VUE3/index.html
+++ b/OrangeFormsOpen-VUE3/index.html
@@ -4,7 +4,7 @@
-
加载中
+ 橙单代码生成平台
diff --git a/OrangeFormsOpen-VUE3/package-lock.json b/OrangeFormsOpen-VUE3/package-lock.json
index de4c4fd8..b8c21295 100644
--- a/OrangeFormsOpen-VUE3/package-lock.json
+++ b/OrangeFormsOpen-VUE3/package-lock.json
@@ -25,6 +25,7 @@
"highlight.js": "^11.9.0",
"jsencrypt": "^3.3.2",
"json-bigint": "^1.0.0",
+ "lodash": "^4.17.21",
"pinia": "^2.1.6",
"pinia-plugin-persist": "^1.0.0",
"vant": "^4.7.3",
@@ -58,7 +59,6 @@
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.8.0",
- "lodash": "^4.17.21",
"node-polyfill-webpack-plugin": "^4.0.0",
"postcss": "^8.4.20",
"postcss-html": "^1.5.0",
diff --git a/OrangeFormsOpen-VUE3/package.json b/OrangeFormsOpen-VUE3/package.json
index 00840b51..a8f3a02d 100644
--- a/OrangeFormsOpen-VUE3/package.json
+++ b/OrangeFormsOpen-VUE3/package.json
@@ -1,5 +1,5 @@
{
- "name": "vite",
+ "name": "orange",
"private": true,
"version": "0.0.0",
"scripts": {
diff --git a/OrangeFormsOpen-VUE3/src/common/hooks/useCommon.ts b/OrangeFormsOpen-VUE3/src/common/hooks/useCommon.ts
index ba27c94e..ccbf4d08 100644
--- a/OrangeFormsOpen-VUE3/src/common/hooks/useCommon.ts
+++ b/OrangeFormsOpen-VUE3/src/common/hooks/useCommon.ts
@@ -1,5 +1,5 @@
+import { getCurrentInstance } from 'vue';
import { Delete, Search, Edit, Plus, Refresh, Picture } from '@element-plus/icons-vue';
-import { EpPropMergeType } from 'element-plus/es/utils';
import { useDate } from '@/common/hooks/useDate';
import { usePermissions } from '@/common/hooks/usePermission';
import { Dialog } from '@/components/Dialog';
diff --git a/OrangeFormsOpen-VUE3/src/common/hooks/useDate.ts b/OrangeFormsOpen-VUE3/src/common/hooks/useDate.ts
index e710d295..8c5018c9 100644
--- a/OrangeFormsOpen-VUE3/src/common/hooks/useDate.ts
+++ b/OrangeFormsOpen-VUE3/src/common/hooks/useDate.ts
@@ -43,43 +43,24 @@ export const useDate = () => {
* @param {String} statsType 转换类型(day, month, year)
* @param {String} format 输出格式
*/
- const getDateRangeFilter = (date: string, statsType = 'day', format = 'YYYY-MM-dd HH:mm:ss') => {
+ const getDateRangeFilter = (date: string, statsType = 'day', format = 'YYYY-MM-DD HH:mm:ss') => {
if (date == null) return [];
-
- statsType = allowStatsType.indexOf(statsType) === -1 ? 'day' : statsType;
- date = date.substring(0, date.indexOf(' '));
- const tempList = date.split('-');
- const year = Number.parseInt(tempList[0]);
- const month = Number.parseInt(tempList[1]);
- const day = Number.parseInt(tempList[2]);
- if (isNaN(year) || isNaN(month) || isNaN(day)) {
+ const tempDate = parseDate(date, format);
+ console.log('tempDate', tempDate);
+ if (tempDate && tempDate.isValid()) {
+ switch (statsType) {
+ case 'day':
+ return [tempDate.startOf('d').format(format), tempDate.endOf('d').format(format)];
+ case 'month':
+ return [tempDate.startOf('M').format(format), tempDate.endOf('M').format(format)];
+ case 'year':
+ return [tempDate.startOf('y').format(format), tempDate.endOf('y').format(format)];
+ default:
+ return [];
+ }
+ } else {
return [];
}
- const tempDate = new Date(year, month - 1, day);
- // 判断是否正确的日期
- if (isNaN(tempDate.getTime())) return [];
-
- tempDate.setHours(0, 0, 0, 0);
- let retDate: Date[] = [];
- // TODO 如果类型为'time', 'datetime'会出错
- switch (statsType) {
- case 'day':
- retDate = [new Date(tempDate), new Date(tempDate.setDate(tempDate.getDate() + 1))];
- break;
- case 'month':
- tempDate.setDate(1);
- retDate = [new Date(tempDate), new Date(tempDate.setMonth(tempDate.getMonth() + 1))];
- break;
- case 'year':
- tempDate.setDate(1);
- tempDate.setMonth(0);
- retDate = [new Date(tempDate), new Date(tempDate.setFullYear(tempDate.getFullYear() + 1))];
- break;
- }
-
- retDate[1] = new Date(retDate[1].getTime() - 1);
-
- return [formatDate(retDate[0], format), formatDate(retDate[1], format)];
};
return {
diff --git a/OrangeFormsOpen-VUE3/src/components/DeptSelect/index.vue b/OrangeFormsOpen-VUE3/src/components/DeptSelect/index.vue
index 0504fc74..da29ddd4 100644
--- a/OrangeFormsOpen-VUE3/src/components/DeptSelect/index.vue
+++ b/OrangeFormsOpen-VUE3/src/components/DeptSelect/index.vue
@@ -1,7 +1,7 @@
();
+const emit = defineEmits<{
+ 'update:modelValue': [string | number | ANY_OBJECT[]];
+ change: [string | number | ANY_OBJECT[], string | number | ANY_OBJECT[]];
+}>();
const props = withDefaults(
defineProps<{
- value: string | number | Array;
+ modelValue: string | number | Array | undefined;
size?: '' | 'default' | 'small' | 'large';
placeholder?: string;
props?: ANY_OBJECT;
@@ -69,12 +72,11 @@ const refreshData = (data: ANY_OBJECT) => {
}
};
const handlerEditOperate = (items: Ref) => {
- console.log('DeptSelect > handlerEditOperate', items);
selectedItems.value = [];
if (props.multiple) {
- if (Array.isArray(items.value)) selectedItems.value = items.value;
+ if (Array.isArray(items)) selectedItems.value = items;
} else {
- if (items.value != null) selectedItems.value.push(items.value);
+ if (items != null) selectedItems.value.push(items);
}
if (!checkSelectChange()) return;
emitChange();
@@ -115,7 +117,7 @@ const onClear = () => {
emitChange();
};
const emitChange = () => {
- let tempValue;
+ let tempValue: string | number | ANY_OBJECT[];
if (props.multiple) {
tempValue = selectedItems.value.map(item => {
return item[props.props.value];
@@ -123,19 +125,19 @@ const emitChange = () => {
} else {
tempValue = (selectedItems.value[0] || {})[props.props.value];
}
- emit('input', tempValue);
- emit('change', tempValue);
+ emit('update:modelValue', tempValue);
+ emit('change', tempValue, selectedItems.value);
};
const checkSelectChange = () => {
let valueIdString =
- props.multiple && Array.isArray(props.value)
- ? (props.value || [])
+ props.multiple && Array.isArray(props.modelValue)
+ ? (props.modelValue || [])
.sort((val1: ANY_OBJECT, val2: ANY_OBJECT) => {
if (val1 === val2) return 0;
return val1 < val2 ? -1 : 1;
})
.join(',')
- : props.value || '';
+ : props.modelValue || '';
let selectedItemsString = selectedItems.value
.sort((item1, item2) => {
if (item1[props.props.value] === item2[props.props.value]) return 0;
@@ -149,12 +151,16 @@ const getSelectDeptList = () => {
let params: ANY_OBJECT = {
widgetType: 'upms_dept',
};
- if (props.value == null || props.value === '' || props.value.length <= 0)
+ if (
+ props.modelValue == null ||
+ props.modelValue === '' ||
+ (props.modelValue as ANY_OBJECT[]).length <= 0
+ )
selectedItems.value = [];
if (props.multiple) {
- params.fieldValues = Array.isArray(props.value) ? props.value : [];
+ params.fieldValues = Array.isArray(props.modelValue) ? props.modelValue : [];
} else {
- params.fieldValues = Array.isArray(props.value) ? props.value[0] : props.value;
+ params.fieldValues = Array.isArray(props.modelValue) ? props.modelValue[0] : props.modelValue;
params.fieldValues = params.fieldValues == null ? [] : [params.fieldValues];
}
if (Array.isArray(params.fieldValues) && params.fieldValues.length > 0) {
@@ -173,9 +179,9 @@ const getSelectDeptList = () => {
}
};
watch(
- () => props.value,
+ () => props.modelValue,
() => {
- if (props.value) getSelectDeptList();
+ if (props.modelValue) getSelectDeptList();
},
{
immediate: true,
diff --git a/OrangeFormsOpen-VUE3/src/components/UserSelect/index.vue b/OrangeFormsOpen-VUE3/src/components/UserSelect/index.vue
index 6c156134..3dd45b66 100644
--- a/OrangeFormsOpen-VUE3/src/components/UserSelect/index.vue
+++ b/OrangeFormsOpen-VUE3/src/components/UserSelect/index.vue
@@ -1,7 +1,7 @@
();
+const emit = defineEmits<{
+ 'update:modelValue': [string | number | ANY_OBJECT[]];
+ change: [string | number | ANY_OBJECT[], string | number | ANY_OBJECT[]];
+}>();
const pps = withDefaults(
defineProps<{
- value: string | number;
+ modelValue: string | number | Array | undefined;
size?: '' | 'default' | 'small' | 'large';
placeholder?: string;
props?: ANY_OBJECT;
@@ -68,13 +71,15 @@ const refreshData = (data: ANY_OBJECT) => {
}
};
const handlerEditOperate = (items: Ref) => {
+ console.log('handlerEditOperate', items);
selectedItems.value = [];
if (pps.multiple) {
- if (Array.isArray(items.value)) selectedItems.value = items.value;
+ if (Array.isArray(items)) selectedItems.value = items;
} else {
- if (items.value != null) selectedItems.value.push(items.value);
+ if (items != null) selectedItems.value.push(items);
}
if (!checkSelectChange()) return;
+ console.log('1111', selectedItems.value);
emitChange();
};
const onVisibleChange = (visible: boolean) => {
@@ -119,7 +124,7 @@ const emitChange = () => {
return item;
});
emit(
- 'input',
+ 'update:modelValue',
tempValue.map(item => item[pps.props.value]),
);
emit(
@@ -129,19 +134,19 @@ const emitChange = () => {
);
} else {
tempValue = selectedItems.value[0] || {};
- emit('input', tempValue[pps.props.value]);
+ emit('update:modelValue', tempValue[pps.props.value]);
emit('change', tempValue[pps.props.value], selectedItems.value);
}
};
const checkSelectChange = () => {
let valueIdString = pps.multiple
- ? (pps.value || [])
- .sort((val1, val2) => {
+ ? ((pps.modelValue || []) as ANY_OBJECT[])
+ .sort((val1: ANY_OBJECT, val2: ANY_OBJECT) => {
if (val1 === val2) return 0;
return val1 < val2 ? -1 : 1;
})
.join(',')
- : pps.value || '';
+ : pps.modelValue || '';
let selectedItemsString = selectedItems.value
.sort((item1, item2) => {
if (item1[pps.props.value] === item2[pps.props.value]) return 0;
@@ -155,12 +160,16 @@ const getSelectUserList = () => {
let params: ANY_OBJECT = {
widgetType: 'upms_user',
};
- if (pps.value == null || pps.value === '' || (Array.isArray(pps.value) && pps.value.length <= 0))
+ if (
+ pps.modelValue == null ||
+ pps.modelValue === '' ||
+ (Array.isArray(pps.modelValue) && pps.modelValue.length <= 0)
+ )
selectedItems.value = [];
if (pps.multiple) {
- params.fieldValues = Array.isArray(pps.value) ? pps.value : [];
+ params.fieldValues = Array.isArray(pps.modelValue) ? pps.modelValue : [];
} else {
- params.fieldValues = Array.isArray(pps.value) ? pps.value[0] : pps.value;
+ params.fieldValues = Array.isArray(pps.modelValue) ? pps.modelValue[0] : pps.modelValue;
params.fieldValues = params.fieldValues == null ? [] : [params.fieldValues];
}
if (Array.isArray(params.fieldValues) && params.fieldValues.length > 0) {
@@ -179,9 +188,9 @@ const getSelectUserList = () => {
}
};
watch(
- () => pps.value,
+ () => pps.modelValue,
() => {
- if (pps.value) getSelectUserList();
+ if (pps.modelValue) getSelectUserList();
},
{
immediate: true,
diff --git a/OrangeFormsOpen-VUE3/src/main.ts b/OrangeFormsOpen-VUE3/src/main.ts
index 8690725d..93b90fe4 100644
--- a/OrangeFormsOpen-VUE3/src/main.ts
+++ b/OrangeFormsOpen-VUE3/src/main.ts
@@ -1,10 +1,13 @@
import { createApp } from 'vue';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import '@/common/http/request';
+// eslint-disable-next-line import/named
+import { debounce } from 'lodash';
import { VxeTable, VxeColumn, Edit } from 'vxe-table';
import App from '@/App.vue';
import { router } from '@/router/index';
import pinia from '@/store';
+import useStaticDictStore from '@/store/staticDict';
// 表格样式
import 'vxe-table/lib/style.css';
@@ -31,17 +34,20 @@ import * as olineDicgt from '@/common/staticDict/online';
import * as flowDict from '@/common/staticDict/flow';
import { ANY_OBJECT } from '@/types/generic';
-import { debounce } from 'lodash';
+// vxe-table设置
function useTable(app: ANY_OBJECT) {
app.use(VxeTable).use(VxeColumn).use(Edit);
}
+// 静态字典设置
function useStaticDict(app: ANY_OBJECT, staticDict: ANY_OBJECT) {
+ if (app.config.globalProperties.StaticDict == null) {
+ app.config.globalProperties.StaticDict = {};
+ }
Object.keys(staticDict).forEach(key => {
- app.config.globalProperties[key] = staticDict[key];
+ app.config.globalProperties.StaticDict[key] = staticDict[key];
});
}
-
// webpack需要重写ResizeObserver,否则会报错
const resizeObserver = window.ResizeObserver;
window.ResizeObserver = class ResizeObserver extends resizeObserver {
@@ -60,3 +66,6 @@ useStaticDict(app, olineDicgt);
useStaticDict(app, flowDict);
app.use(pinia).use(router).use(useTable);
app.mount('#app');
+// 设置静态字典
+const staticDictStore = useStaticDictStore();
+staticDictStore.setStaticDict(app.config.globalProperties.StaticDict);
diff --git a/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWidget.vue b/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWidget.vue
index 010a968c..d6571685 100644
--- a/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWidget.vue
+++ b/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWidget.vue
@@ -150,7 +150,6 @@ const isMobileFilter = computed(() => {
);
});
const getAllDropdownData = computed(() => {
- console.log('widget getAllDropdownData', pps.widget.props.supportAll, dictDataList);
if (pps.widget.props.supportAll) {
return [
{
diff --git a/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWorkFlowTable.vue b/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWorkFlowTable.vue
index 84d1f160..f39a4392 100644
--- a/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWorkFlowTable.vue
+++ b/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWorkFlowTable.vue
@@ -156,7 +156,9 @@ import { downloadBlob, post } from '@/common/http/request';
import { useDownload } from '@/common/hooks/useDownload';
import { useUpload } from '@/common/hooks/useUpload';
import { API_CONTEXT } from '@/api/config';
+import { useLayoutStore } from '@/store';
+const layoutStore = useLayoutStore();
const emit = defineEmits<{
viewWorkOrder: [ANY_OBJECT, ANY_OBJECT | null];
handlerWorkOrder: [ANY_OBJECT, ANY_OBJECT | null];
@@ -194,8 +196,6 @@ const props = withDefaults(defineProps(), {
operationList: () => [],
});
-import { useLayoutStore } from '@/store';
-const layoutStore = useLayoutStore();
const form = inject('form', () => {
console.error('OnlineCustomWorkFlowTable: form not injected');
return { isEdit: false } as ANY_OBJECT;
@@ -210,6 +210,11 @@ const tableColumnList = computed(() => {
props.widget && props.widget.props && Array.isArray(props.widget.props.tableColumnList)
? props.widget.props.tableColumnList
: [];
+ tempList = tempList.map(item => {
+ return {
+ ...item,
+ };
+ });
tempList.forEach((item: ANY_OBJECT) => {
if (item.fieldType === 0 || item.fieldType == null) {
// 绑定表字段
diff --git a/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/hooks/useForm.ts b/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/hooks/useForm.ts
index b4535da9..026e8061 100644
--- a/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/hooks/useForm.ts
+++ b/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/hooks/useForm.ts
@@ -51,8 +51,8 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref | null = n
});
const form = computed(() => {
- const temp: ANY_OBJECT = buildFormConfig(dialogParams.value.formConfig) || {};
- return temp;
+ buildFormConfig(dialogParams.value.formConfig);
+ return dialogParams.value.formConfig;
});
const loginStore = useLoginStore();
diff --git a/OrangeFormsOpen-VUE3/src/pages/online/hooks/useFormConfig.ts b/OrangeFormsOpen-VUE3/src/pages/online/hooks/useFormConfig.ts
index e0821346..a14f5e38 100644
--- a/OrangeFormsOpen-VUE3/src/pages/online/hooks/useFormConfig.ts
+++ b/OrangeFormsOpen-VUE3/src/pages/online/hooks/useFormConfig.ts
@@ -245,7 +245,8 @@ export const useFormConfig = () => {
};
const buildFormConfig = (formData: ANY_OBJECT) => {
- if (formData == null) return;
+ if (formData == null || formData.rawData == null || formData.rawData.onlineTableList == null)
+ return;
const formConfig = formData;
formConfig.datasourceMap = new Map();
formConfig.relationMap = new Map();
diff --git a/OrangeFormsOpen-VUE3/src/store/index.ts b/OrangeFormsOpen-VUE3/src/store/index.ts
index dfb7b62e..408112c0 100644
--- a/OrangeFormsOpen-VUE3/src/store/index.ts
+++ b/OrangeFormsOpen-VUE3/src/store/index.ts
@@ -4,7 +4,9 @@ import useLoginStore from './login';
import useLayoutStore from './layout';
import useOtherStore from './other';
import useMessage from './message';
+import useStaticDictStore from './staticDict';
+
const pinia = createPinia();
pinia?.use(piniaPersist);
-export { useLoginStore, useLayoutStore, useMessage, useOtherStore };
+export { useLoginStore, useLayoutStore, useMessage, useOtherStore, useStaticDictStore };
export default pinia;
diff --git a/OrangeFormsOpen-VUE3/src/store/staticDict.ts b/OrangeFormsOpen-VUE3/src/store/staticDict.ts
new file mode 100644
index 00000000..466ab544
--- /dev/null
+++ b/OrangeFormsOpen-VUE3/src/store/staticDict.ts
@@ -0,0 +1,15 @@
+import { defineStore } from 'pinia';
+import { ANY_OBJECT } from '@/types/generic';
+
+export default defineStore('staticDict', {
+ state: () => {
+ return {
+ staticDict: {} as ANY_OBJECT,
+ };
+ },
+ actions: {
+ setStaticDict(dict: ANY_OBJECT) {
+ this.staticDict = dict;
+ },
+ },
+});