From 981ae623e052b85829111b69abab193bad09ddb3 Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Wed, 6 Dec 2023 13:55:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/api/DesignForm/requestapi.ts | 8 + src/api/DesignForm/types.ts | 6 + src/components/DesignForm/assembly/index.ts | 13 +- src/components/DesignForm/formControlAttr.vue | 98 +++++++- .../DesignForm/public/form/form.vue | 12 +- .../DesignForm/public/form/formGroup.vue | 16 +- src/main.ts | 8 +- src/views/sysworkflow/codepage/createform.vue | 3 + .../taskplatform/taskmanagement/myrequest.vue | 1 + .../taskmanagement/taskcustomerformnew.vue | 3 +- src/widget/index.ts | 8 + src/widget/number/index.vue | 209 ++++++++++++++++++ 13 files changed, 366 insertions(+), 21 deletions(-) create mode 100644 src/widget/index.ts create mode 100644 src/widget/number/index.vue diff --git a/package.json b/package.json index e253438c0..4f113b7ba 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ ] }, "dependencies": { - "@element-plus/icons-vue": "^2.1.0", + "@element-plus/icons-vue": "^2.3.1", "@vitejs/plugin-vue": "^4.2.3", "@vueuse/core": "^10.1.2", "@wangeditor/editor": "^5.1.23", diff --git a/src/api/DesignForm/requestapi.ts b/src/api/DesignForm/requestapi.ts index 5f5c00c4b..bbd78ff83 100644 --- a/src/api/DesignForm/requestapi.ts +++ b/src/api/DesignForm/requestapi.ts @@ -261,3 +261,11 @@ export function gainEditFormFlowInfo(data?:enableVersionId){ data: data }); } +//获取要修改的数据 +export function gainNumber(data?:any){ + return request({ + url: '/systemapi/public/gainNumber', + method: 'post', + data: data + }); +} diff --git a/src/api/DesignForm/types.ts b/src/api/DesignForm/types.ts index ecdbc2c9e..9ffa2ed06 100644 --- a/src/api/DesignForm/types.ts +++ b/src/api/DesignForm/types.ts @@ -98,6 +98,12 @@ export interface formData{ config: any; events?:any } +//表单基本信息 +export interface formTableInfo{ + size?: any; + name?:any, + formName?:any +} //其他表单数据 export interface formOtherData{ source: any; diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts index b8861bbe3..309673312 100644 --- a/src/components/DesignForm/assembly/index.ts +++ b/src/components/DesignForm/assembly/index.ts @@ -199,7 +199,18 @@ const selectOption: any = [ label: '保存' }, config: {} - } + }, + { + type: 'serialNumber', + label: '编码', + icon: 'number', + iconFont: 'fa-sort-numeric-asc', + control: { + }, + config: { + automatic:false + } + } ] }, { diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue index 454f8cdc5..9e6d340d7 100644 --- a/src/components/DesignForm/formControlAttr.vue +++ b/src/components/DesignForm/formControlAttr.vue @@ -66,7 +66,29 @@ const state = reactive({ "可参考UI组件表单校验,详情点击", props: '可添加当前组件所有prop属性及事件方法' }, - tabsName: 'second' + tabsName: 'second', + numberRulesList:[ + { + type: 'time', + label: '时间', + msg:'请选择时间格式' + }, + { + type: 'text', + label: '自定义字符', + msg:'请输入自定义字符' + }, + { + type: 'serialnumber', + label: '流水序号', + msg:'流水号起始值' + }, + { + type: 'randomnumber', + label: '随机数', + msg:'请输入随机数位数' + } + ] }) const formAttr = computed(() => { @@ -1049,6 +1071,23 @@ const delAddRules = (index: number) => { controlData.value.customRules && controlData.value.customRules.splice(index, 1) } + +//添加一条编码规则 +const addNumRules = () => { + if (!controlData.value.config.customRules) { + controlData.value.config.customRules = [] + } + controlData.value.config.customRules.push({ + type:'time', + rule:"YYYYMMDD" + }) +} +//删除一条编码规则 +const delNumRules = (index: number) => { + controlData.value.config.customRules && + controlData.value.config.customRules.splice(index, 1) +} + // 编辑表单样式 const editFormStyle = (tooltip: string) => { emits('openDialog', { @@ -1100,7 +1139,7 @@ const getDataSource = () => { } // 表单属性修改 const formAttrChange = (obj: any, val?: any) => { - console.log("表单属性修改--->",obj,val,{ [obj.key]: obj.value }) + // console.log("表单属性修改--->",obj,val,{ [obj.key]: obj.value }) if (obj.key === 'source') { getFormFieldBySource(obj.value) // 改变了数据源了,重新请求数据 // 清空设计区已选择的组件,再一次选择时字段标识才会变 @@ -1138,6 +1177,18 @@ const rulesSelectChange = (item: any, val: string) => { item.message = filter[0].message } } +const rulesSelectNumChange = (item: any, val: string) => { + console.log("快速添加校验规则改变时",item,val) + const filter = state.numberRulesList.filter(item => item.type === val) + if (filter && filter.length) { + item.message = filter[0].msg + if(val == "time") { + item.rule = "YYYYMMDD" + }else{ + item.rule = "" + } + } +} // options动态选项数据源请求时 const optionsEvent = (type: string, tooltip?: string) => { openAttrDialog(type, tooltip) @@ -1149,7 +1200,7 @@ getDataSource() defineExpose({ getFormFieldBySource }) //判断输入框是否可写 const isNotWrite = (val:any) =>{ - console.log("判断输入框是否可写--->",val) + // console.log("判断输入框是否可写--->",val) if(val.key === "name" && props.customerformid != ""){ return true } @@ -1265,6 +1316,47 @@ const isNotWrite = (val:any) =>{ 增加标签 + +
+

编码规则配置

+ + + +
+ + + + + + + + + + + 添加规则 + +
+
",props.beforeSubmit) // loading.value = true - // console.log("apiUrl--->",apiUrl) - // console.log("submitParams--->",submitParams) - // console.log("formatParams--->",formatParams) + console.log("apiUrl--->",apiUrl) + console.log("submitParams--->",submitParams) + console.log("formatParams--->",formatParams) // 提交保存表单 currencyFormApiSubmit(apiUrl, submitParams ?? formatParams) .then((res: any) => { @@ -617,7 +619,7 @@ const resetFields = () => { // setValue(Object.assign(model.value, obj || {})) // 这才能清空组件显示的值 } onMounted(() => { - console.log("数据处理结束--->",props.type) + console.log("数据处理结束--->",props.formData) getInitModel() nextTick(() => { appendRemoveStyle(true) @@ -1004,7 +1006,7 @@ defineExpose({ 'detail-form': type === 3 || type === 4 }" > - +
diff --git a/src/components/DesignForm/public/form/formGroup.vue b/src/components/DesignForm/public/form/formGroup.vue index 6734289eb..8753c2524 100644 --- a/src/components/DesignForm/public/form/formGroup.vue +++ b/src/components/DesignForm/public/form/formGroup.vue @@ -11,7 +11,7 @@ import ChildTable from './childTable.vue' import Tooltips from '@/components/DesignForm/tooltip.vue' import FlexBox from './flexBox.vue' import { useDesignFormStore } from '@/store/DesignForm/designForm' -import { FormList } from '@/api/DesignForm/types' +import { FormList,formTableInfo } from '@/api/DesignForm/types' import { constFormBtnEvent, constFormProps @@ -22,6 +22,8 @@ import { jsonParseStringify } from '@/utils/DesignForm' const props = withDefaults( defineProps<{ data: FormList[] + tableinfo:formTableInfo + numrun?:number }>(), { data: () => { @@ -251,6 +253,9 @@ onUnmounted(() => { store.setActiveKey('') store.setControlAttr({}) }) +onMounted(()=>{ + console.log('formGroup onMounted',dataList,props.tableinfo) +})