Commit b5c09c01 by 史雅文

生产计划显示字段

parent ac30f4d4
...@@ -12,40 +12,40 @@ ...@@ -12,40 +12,40 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref, onMounted, nextTick, watch } from 'vue'; import { reactive, ref, onMounted, nextTick, watch } from 'vue';
import { formProps, formEventConfigs } from './config'; import { formProps, formEventConfigs } from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue'; import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addMesProductionPlan, getMesProductionPlan, updateMesProductionPlan } from '/@/api/scgl/scjh'; import { addMesProductionPlan, getMesProductionPlan, updateMesProductionPlan } from '/@/api/scgl/scjh';
import { cloneDeep, isString } from 'lodash-es'; import { cloneDeep, isString } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types'; import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission'; import { usePermission } from '/@/hooks/web/usePermission';
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue'; import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
import { FromPageType } from '/@/enums/workflowEnum'; import { FromPageType } from '/@/enums/workflowEnum';
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent'; import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm'; import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig'; import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
const { filterFormSchemaAuth } = usePermission(); const { filterFormSchemaAuth } = usePermission();
const RowKey = 'id'; const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'update:value']); const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'update:value']);
const props = defineProps({ const props = defineProps({
fromPage: { fromPage: {
type: Number, type: Number,
default: FromPageType.MENU, default: FromPageType.MENU,
}, },
}); });
const systemFormRef = ref(); const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({ const data: { formDataProps: FormDataProps } = reactive({
formDataProps: cloneDeep(formProps), formDataProps: cloneDeep(formProps),
}); });
const state = reactive({ const state = reactive({
formModel: {}, formModel: {},
formInfo:{formId:'',formName:''} formInfo:{formId:'',formName:''}
}); });
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
watch( watch(
() => state.formModel, () => state.formModel,
(val) => { (val) => {
emits('update:value', val); emits('update:value', val);
...@@ -53,9 +53,9 @@ ...@@ -53,9 +53,9 @@
{ {
deep: true, deep: true,
}, },
); );
onMounted(async () => { onMounted(async () => {
try { try {
if (props.fromPage == FromPageType.MENU) { if (props.fromPage == FromPageType.MENU) {
setMenuPermission(); setMenuPermission();
...@@ -86,14 +86,14 @@ ...@@ -86,14 +86,14 @@
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单 formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
} }
} catch (error) {} } catch (error) {}
}); });
// 根据菜单页面权限,设置表单属性(必填,禁用,显示) // 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() { function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!); data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
} }
// 校验form 通过返回表单数据 // 校验form 通过返回表单数据
async function validate() { async function validate() {
let values = []; let values = [];
try { try {
values = await systemFormRef.value?.validate(); values = await systemFormRef.value?.validate();
...@@ -106,9 +106,9 @@ ...@@ -106,9 +106,9 @@
} finally { } finally {
} }
return values; return values;
} }
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】 // 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async function setFormDataFromId(rowId) { async function setFormDataFromId(rowId) {
try { try {
const record = await getMesProductionPlan(rowId); const record = await getMesProductionPlan(rowId);
// 处理 mesProductionPlanProductList 字段映射 // 处理 mesProductionPlanProductList 字段映射
...@@ -132,9 +132,9 @@ ...@@ -132,9 +132,9 @@
} catch (error) { } catch (error) {
} }
} }
// 辅助返回表单数据 // 辅助返回表单数据
async function getFieldsValue() { async function getFieldsValue() {
let values = []; let values = [];
try { try {
values = await systemFormRef.value?.getFieldsValue(); values = await systemFormRef.value?.getFieldsValue();
...@@ -147,25 +147,25 @@ ...@@ -147,25 +147,25 @@
} finally { } finally {
} }
return values; return values;
} }
// 辅助设置表单数据 // 辅助设置表单数据
function setFieldsValue(record) { function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record); systemFormRef.value.setFieldsValue(record);
} }
// 重置表单数据 // 重置表单数据
async function resetFields() { async function resetFields() {
await systemFormRef.value.resetFields(); await systemFormRef.value.resetFields();
} }
// 设置表单数据全部为Disabled 【查看】 // 设置表单数据全部为Disabled 【查看】
async function setDisabledForm( ) { async function setDisabledForm( ) {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas)); data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas));
} }
// 获取行键值 // 获取行键值
function getRowKey() { function getRowKey() {
return RowKey; return RowKey;
} }
// 更新api表单数据 // 更新api表单数据
async function update({ values, rowId }) { async function update({ values, rowId }) {
try { try {
values[RowKey] = rowId; values[RowKey] = rowId;
state.formModel = values; state.formModel = values;
...@@ -175,9 +175,9 @@ ...@@ -175,9 +175,9 @@
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单 formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
return saveVal; return saveVal;
} catch (error) {} } catch (error) {}
} }
// 新增api表单数据 // 新增api表单数据
async function add(values) { async function add(values) {
try { try {
state.formModel = values; state.formModel = values;
let saveVal = await addMesProductionPlan(values); let saveVal = await addMesProductionPlan(values);
...@@ -186,9 +186,9 @@ ...@@ -186,9 +186,9 @@
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单 formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
return saveVal; return saveVal;
} catch (error) {} } catch (error) {}
} }
// 根据工作流页面权限,设置表单属性(必填,禁用,显示) // 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) { async function setWorkFlowForm(obj: WorkFlowFormParams) {
try { try {
if (obj.formId) state.formInfo.formId = obj.formId; if (obj.formId) state.formInfo.formId = obj.formId;
if (obj.formName) state.formInfo.formName = obj.formName; if (obj.formName) state.formInfo.formName = obj.formName;
...@@ -208,18 +208,18 @@ ...@@ -208,18 +208,18 @@
await loadFormEvent(formEventConfigs, state.formModel, await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value, systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单 formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
} }
function handleChange(val) { function handleChange(val) {
emits('update:value', val); emits('update:value', val);
} }
async function sendMessageForAllIframe() { async function sendMessageForAllIframe() {
try { try {
if (systemFormRef.value && systemFormRef.value.sendMessageForAllIframe) { if (systemFormRef.value && systemFormRef.value.sendMessageForAllIframe) {
systemFormRef.value.sendMessageForAllIframe(); systemFormRef.value.sendMessageForAllIframe();
} }
} catch (error) {} } catch (error) {}
} }
defineExpose({ defineExpose({
setFieldsValue, setFieldsValue,
resetFields, resetFields,
validate, validate,
...@@ -232,6 +232,6 @@ ...@@ -232,6 +232,6 @@
getRowKey, getRowKey,
getFieldsValue, getFieldsValue,
sendMessageForAllIframe sendMessageForAllIframe
}); });
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment