Commit adfd4b15 by 董晓奇

(1)工艺路线按照产品种类分,工艺路线上增加个字段,生产任务自动匹配

parent 21b17708
<template> <template>
<div class="pt-4"> <div class="pt-4">
<SimpleForm <SimpleForm
ref="systemFormRef" ref="systemFormRef"
:formProps="data.formDataProps" :formProps="data.formDataProps"
:formModel="state.formModel" :formModel="state.formModel"
:isWorkFlow="props.fromPage!=FromPageType.MENU" :isWorkFlow="props.fromPage != FromPageType.MENU"
:isCamelCase="true" :isCamelCase="true"
@model-change="handleChange" @model-change="handleChange"
/> />
</div> </div>
...@@ -16,20 +15,25 @@ ...@@ -16,20 +15,25 @@
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 { addRokeRouting, getRokeRouting, updateRokeRouting } from '/@/api/jcsj/gylx'; import { addRokeRouting, getRokeRouting, updateRokeRouting } from '/@/api/jcsj/gylx';
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,
...@@ -42,34 +46,52 @@ ...@@ -42,34 +46,52 @@
}); });
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);
}, },
{ {
deep: true, deep: true,
}, },
); );
onMounted(async () => { onMounted(async () => {
try { try {
if (props.fromPage == FromPageType.MENU) { if (props.fromPage == FromPageType.MENU) {
setMenuPermission(); setMenuPermission();
if(currentRoute.value.meta){ if (currentRoute.value.meta) {
state.formInfo.formName = currentRoute.value.meta.title&&isString(currentRoute.value.meta.title)?currentRoute.value.meta.title:''; state.formInfo.formName =
state.formInfo.formId = currentRoute.value.meta.formId&&isString(currentRoute.value.meta.formId)?currentRoute.value.meta.formId:''; currentRoute.value.meta.title && isString(currentRoute.value.meta.title)
? currentRoute.value.meta.title
: '';
state.formInfo.formId =
currentRoute.value.meta.formId && isString(currentRoute.value.meta.formId)
? currentRoute.value.meta.formId
: '';
} }
await createFormEvent(formEventConfigs, state.formModel, await createFormEvent(
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,
); //表单事件:初始化表单
await nextTick(); await nextTick();
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,
); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) { } else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕 emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法 // loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
...@@ -78,15 +100,28 @@ ...@@ -78,15 +100,28 @@
} else if (props.fromPage == FromPageType.DESKTOP) { } else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行 // 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕 emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(formEventConfigs, state.formModel, await createFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value, systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单 formProps.schemas,
await loadFormEvent(formEventConfigs, state.formModel, true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:初始化表单
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,
); //表单事件:加载表单
} }
} catch (error) {} } catch (error) {}
}); });
// 根据菜单页面权限,设置表单属性(必填,禁用,显示) // 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() { function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!); data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
...@@ -106,20 +141,26 @@ ...@@ -106,20 +141,26 @@
} finally { } finally {
} }
return values; return values;
} }
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】 // 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async function setFormDataFromId(rowId) { async function setFormDataFromId(rowId) {
try { try {
const record = await getRokeRouting(rowId); const record = await getRokeRouting(rowId);
setFieldsValue(record); setFieldsValue(record);
state.formModel = record; state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel, await getFormDataEvent(
formEventConfigs,
state.formModel,
systemFormRef.value, systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:获取表单数据 formProps.schemas,
} catch (error) { true,
state.formInfo.formName,
} state.formInfo.formId,
); //表单事件:获取表单数据
} catch (error) {}
} }
// 辅助返回表单数据 // 辅助返回表单数据
async function getFieldsValue() { async function getFieldsValue() {
let values = []; let values = [];
...@@ -135,47 +176,66 @@ ...@@ -135,47 +176,66 @@
} }
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;
let saveVal = await updateRokeRouting(values); let saveVal = await updateRokeRouting(values);
await submitFormEvent(formEventConfigs, state.formModel, await submitFormEvent(
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,
); //表单事件:提交表单
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 addRokeRouting(values); let saveVal = await addRokeRouting(values);
await submitFormEvent(formEventConfigs, state.formModel, await submitFormEvent(
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,
); //表单事件:提交表单
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;
...@@ -189,23 +249,38 @@ ...@@ -189,23 +249,38 @@
state.formModel = formModels; state.formModel = formModels;
setFieldsValue(formModels); setFieldsValue(formModels);
} catch (error) {} } catch (error) {}
await createFormEvent(formEventConfigs, state.formModel, await createFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value, systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单 formProps.schemas,
await loadFormEvent(formEventConfigs, state.formModel, true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:初始化表单
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,
...@@ -218,8 +293,6 @@ ...@@ -218,8 +293,6 @@
setWorkFlowForm, setWorkFlowForm,
getRowKey, getRowKey,
getFieldsValue, getFieldsValue,
sendMessageForAllIframe sendMessageForAllIframe,
}); });
</script> </script>
\ No newline at end of file
<template> <template>
<BasicModal
:height="600"
<BasicModal v-bind="$attrs"
:height="600" @register="registerModal"
v-bind="$attrs" @register="registerModal" :title="getTitle" :title="getTitle"
@ok="handleSubmit" @cancel="handleClose" > @ok="handleSubmit"
<ModalForm ref="formRef" v-model:value="state.formModel" :fromPage="FromPageType.MENU" /> @cancel="handleClose"
<template #footer v-if=" !state.isView"> >
<ModalForm ref="formRef" v-model:value="state.formModel" :fromPage="FromPageType.MENU" />
<template #footer v-if="!state.isView">
<template v-for="(item, index) in sortBy(formButtons, 'index')" :key="item.key"> <template v-for="(item, index) in sortBy(formButtons, 'index')" :key="item.key">
<template v-if="item.isShow"> <template v-if="item.isShow">
<CustomButtonModal v-if="item.type == CustomButtonModalType.Modal" :info="item" /> <CustomButtonModal v-if="item.type == CustomButtonModalType.Modal" :info="item" />
<a-button <a-button
:type="item.style" :type="item.style"
...@@ -22,29 +23,28 @@ ...@@ -22,29 +23,28 @@
</template> </template>
</template> </template>
</template> </template>
</BasicModal> </BasicModal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, reactive, provide, Ref } from 'vue'; import { ref, computed, reactive, provide, Ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicModal, useModalInner } from '/@/components/Modal';
import { CustomButtonModalType } from '/@/enums/userEnum'; import { CustomButtonModalType } from '/@/enums/userEnum';
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue'; import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
import { formProps ,formButtons } from './config'; import { formProps, formButtons } from './config';
import ModalForm from './Form.vue'; import ModalForm from './Form.vue';
import { FromPageType } from '/@/enums/workflowEnum'; import { FromPageType } from '/@/enums/workflowEnum';
import { sortBy } from 'lodash-es'; import { sortBy } from 'lodash-es';
import { executeCurFormEvent } from '/@/utils/event/data'; import { executeCurFormEvent } from '/@/utils/event/data';
const emit = defineEmits(['success', 'register']); const emit = defineEmits(['success', 'register']);
const { notification } = useMessage(); const { notification } = useMessage();
const formRef = ref(); const formRef = ref();
const isCopy = ref<boolean>(false) const isCopy = ref<boolean>(false);
const state = reactive({ const state = reactive({
formModel: {}, formModel: {},
isUpdate: true, isUpdate: true,
...@@ -55,40 +55,41 @@ ...@@ -55,40 +55,41 @@
const { t } = useI18n(); const { t } = useI18n();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await handleInner(data); await handleInner(data);
}); });
const getTitle = computed(() => (state.isView ? '查看' : state.isUpdate ? '编辑' : isCopy.value ? '复制数据' : '新增')); const getTitle = computed(() =>
state.isView ? '查看' : state.isUpdate ? '编辑' : isCopy.value ? '复制数据' : '新增',
);
async function handleInner(data) {
async function handleInner(data){
state.isUpdate = !!data?.isUpdate; state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView; state.isView = !!data?.isView;
isCopy.value = !!data?.isCopy; isCopy.value = !!data?.isCopy;
setModalProps({ setModalProps({
destroyOnClose: true, destroyOnClose: true,
maskClosable: false, maskClosable: false,
showCancelBtn: false, showCancelBtn: false,
showOkBtn: false, showOkBtn: false,
canFullscreen: true, canFullscreen: true,
width: 1200, width: 1200,
footer: state.isView ? null : undefined,defaultFullscreen:true, footer: state.isView ? null : undefined,
defaultFullscreen: true,
}); });
if (state.isUpdate || state.isView || isCopy.value) { if (state.isUpdate || state.isView || isCopy.value) {
state.rowId = data.id; state.rowId = data.id;
if (state.isView) { if (state.isView) {
await formRef.value.setDisabledForm(); await formRef.value.setDisabledForm();
} }
await formRef.value.setFormDataFromId(state.rowId); await formRef.value.setFormDataFromId(state.rowId);
} else { } else {
formRef.value.resetFields(); formRef.value.resetFields();
} }
} }
async function saveModal() { async function saveModal() {
let saveSuccess = false; let saveSuccess = false;
try { try {
...@@ -117,9 +118,9 @@ ...@@ -117,9 +118,9 @@
async function handleSubmit() { async function handleSubmit() {
try { try {
const saveSuccess = await saveModal(); const saveSuccess = await saveModal();
setModalProps({ confirmLoading: true }); setModalProps({ confirmLoading: true });
if (saveSuccess) { if (saveSuccess) {
if (!state.isUpdate || isCopy.value) { if (!state.isUpdate || isCopy.value) {
//false 新增 //false 新增
...@@ -133,34 +134,31 @@ ...@@ -133,34 +134,31 @@
description: t('修改成功!'), description: t('修改成功!'),
}); //提示消息 }); //提示消息
} }
closeModal(); closeModal();
formRef.value.resetFields(); formRef.value.resetFields();
emit('success'); emit('success');
} }
} finally { } finally {
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
} }
} }
function customClick(item) { function customClick(item) {
if (item.key == 'confirm') { if (item.key == 'confirm') {
handleSubmit(); handleSubmit();
} else if (item.key == 'cancel' && props.formType !== 'normal') { } else if (item.key == 'cancel') {
handleClose(); handleClose();
closeModal(); closeModal();
} else if (item.key == 'reset') { } else if (item.key == 'reset') {
formRef.value.resetFields(); formRef.value.resetFields();
} else { } else {
executeCurFormEvent(item.event, state.formModel, true); executeCurFormEvent(item.event, state.formModel, true);
} }
} }
function handleClose() { function handleClose() {
formRef.value.resetFields(); formRef.value.resetFields();
} }
</script> </script>
\ No newline at end of file
...@@ -55,6 +55,18 @@ export const columns: BasicColumn[] = [ ...@@ -55,6 +55,18 @@ export const columns: BasicColumn[] = [
styleConfig: undefined, styleConfig: undefined,
listStyle: undefined, listStyle: undefined,
}, },
{
resizable: true,
dataIndex: 'productType',
title: '产品类型',
componentType: 'select',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
]; ];
//表头合并配置 //表头合并配置
export const headerMergingData = []; export const headerMergingData = [];
...@@ -136,7 +148,7 @@ export const formProps: FormProps = { ...@@ -136,7 +148,7 @@ export const formProps: FormProps = {
component: 'Grid', component: 'Grid',
children: [ children: [
{ {
span: 8, span: 6,
list: [ list: [
{ {
key: '536715321b4c49df8b63b2fcb7cc14ab', key: '536715321b4c49df8b63b2fcb7cc14ab',
...@@ -164,7 +176,7 @@ export const formProps: FormProps = { ...@@ -164,7 +176,7 @@ export const formProps: FormProps = {
], ],
}, },
{ {
span: 8, span: 6,
list: [ list: [
{ {
key: '8d9ef135306242729fb4673b9e2dd918', key: '8d9ef135306242729fb4673b9e2dd918',
...@@ -202,7 +214,7 @@ export const formProps: FormProps = { ...@@ -202,7 +214,7 @@ export const formProps: FormProps = {
], ],
}, },
{ {
span: 8, span: 6,
list: [ list: [
{ {
key: '6636f959cd3a4c239aeb3ab43505a27b', key: '6636f959cd3a4c239aeb3ab43505a27b',
...@@ -229,6 +241,58 @@ export const formProps: FormProps = { ...@@ -229,6 +241,58 @@ export const formProps: FormProps = {
}, },
], ],
}, },
{
span: 6,
list: [
{
key: '2fbc5d1e99af41beb0232f448f39432f',
field: 'productType',
label: '产品类型',
type: 'select',
component: 'XjrSelect',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: 7,
placeholder: '请选择下拉选择',
showLabel: true,
showSearch: false,
isMultiple: false,
clearable: false,
disabled: false,
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
defaultSelect: '',
datasourceType: 'api',
params: null,
labelField: 'label',
valueField: 'value',
apiConfig: {
path: '/jcxx/cplx/getAllCPLX',
method: 'GET',
apiId: 'd0471a2c71d242ebbdc3ce88e00f8008',
apiParams: [
{ key: '1', title: 'Query Params', tableInfo: [] },
{ key: '2', title: 'Header', tableInfo: [] },
{ key: '3', title: 'Body' },
],
script:
"var sql='SELECT id as value, cm as label FROM mes_base_cplx WHERE delete_mark = 0 ORDER BY pid ASC, paixu ASC';\r\nreturn db.select(sql)",
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
], ],
componentProps: { componentProps: {
gutter: 16, gutter: 16,
......
<template> <template>
<ResizePageWrapper :hasLeft="false">
<template #resizeRight>
<ResizePageWrapper :hasLeft="false"> <BasicTable @register="registerTable" isMenuTable ref="tableRef">
<template #resizeRight>
<BasicTable @register="registerTable" isMenuTable ref="tableRef"
>
<template #toolbar> <template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code"> <template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" type="primary" @click="buttonClick(button.code)"> <a-button v-if="button.isDefault" type="primary" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template> <template #icon>
<Icon :icon="button.icon" />
</template>
{{ button.name }} {{ button.name }}
</a-button> </a-button>
<CustomButtonModal v-else-if="button.buttonType == 'modal'" :info="button" /> <CustomButtonModal v-else-if="button.buttonType == 'modal'" :info="button" />
<a-button v-else :type="button.buttonType === 'danger' ? 'default' : button.buttonType || 'primary'" :danger="button.buttonType === 'danger'" > <a-button
<template #icon><Icon :icon="button.icon" /></template> v-else
:type="button.buttonType === 'danger' ? 'default' : button.buttonType || 'primary'"
:danger="button.buttonType === 'danger'"
>
<template #icon>
<Icon :icon="button.icon" />
</template>
{{ button.name }} {{ button.name }}
</a-button> </a-button>
</template> </template>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<TableAction
<TableAction
:actions="getLessActions(record)" :actions="getLessActions(record)"
:dropDownActions="getMoreActions(record)" :dropDownActions="getMoreActions(record)"
/> />
</template> </template>
<template v-else-if="column.dataIndex && column?.listStyle"> <template v-else-if="column.dataIndex && column?.listStyle">
<span :style="executeListStyle(getValue(record, column, 'style'), column?.listStyle)">{{ <span :style="executeListStyle(getValue(record, column, 'style'), column?.listStyle)">{{
getValue(record, column, 'value') getValue(record, column, 'value')
}}</span> }}</span>
</template> </template>
</template> </template>
</BasicTable> </BasicTable>
</template> </template>
<GylxModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/>
</ResizePageWrapper>
<GylxModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel" />
</ResizePageWrapper>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed,provide,Ref, createVNode, import { ref, computed, provide, Ref, createVNode } from 'vue';
} from 'vue';
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table'; import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getRokeRoutingPage, deleteRokeRouting} from '/@/api/jcsj/gylx'; import { getRokeRoutingPage, deleteRokeRouting } from '/@/api/jcsj/gylx';
import { ResizePageWrapper } from '/@/components/Page'; import { ResizePageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
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 { executeListStyle, getValue } from '/@/hooks/web/useListStyle';//列表样式配置 import { executeListStyle, getValue } from '/@/hooks/web/useListStyle'; //列表样式配置
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import GylxModal from './components/GylxModal.vue'; import GylxModal from './components/GylxModal.vue';
import { searchFormSchema, columns } from './components/config';
import { searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index'; import Icon from '/@/components/Icon/index';
const listSpliceNum = ref(3); //操作列最先展示几个
const listSpliceNum = ref(3); //操作列最先展示几个
import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock'; import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock';
const pageParamsInfo = ref<any>({}); const pageParamsInfo = ref<any>({});
const { enableLockeData,handleOpenFormEnableLockeData, handleCloseFormEnableLocke, handleHasEnableLocke } = const {
useConcurrentLock(); enableLockeData,
handleOpenFormEnableLockeData,
handleCloseFormEnableLocke,
handleHasEnableLocke,
} = useConcurrentLock();
const { notification } = useMessage(); const { notification } = useMessage();
const { t } = useI18n(); const { t } = useI18n();
...@@ -124,18 +85,47 @@ ...@@ -124,18 +85,47 @@
const filterColumns = filterColumnAuth(columns); const filterColumns = filterColumnAuth(columns);
const tableRef = ref(); const tableRef = ref();
//展示在列表内的按钮 //展示在列表内的按钮
const actionButtons = ref<string[]>(["view","edit","delete"]); const actionButtons = ref<string[]>(['view', 'edit', 'delete']);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(() => {
const list = [{"buttonId":"2006195708167311360","name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"buttonId":"2006195708171505664","name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"buttonId":"2006195708171505665","name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true,"isEnableLock":true},{"buttonId":"2006195708171505666","name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}] const list = [
{
buttonId: '2006195708167311360',
name: '查看',
code: 'view',
icon: 'ant-design:eye-outlined',
isDefault: true,
isUse: true,
},
{
buttonId: '2006195708171505664',
name: '新增',
code: 'add',
icon: 'ant-design:plus-outlined',
isDefault: true,
isUse: true,
},
{
buttonId: '2006195708171505665',
name: '编辑',
code: 'edit',
icon: 'ant-design:form-outlined',
isDefault: true,
isUse: true,
isEnableLock: true,
},
{
buttonId: '2006195708171505666',
name: '删除',
code: 'delete',
icon: 'ant-design:delete-outlined',
isDefault: true,
isUse: true,
},
];
return filterButtonAuth(list); return filterButtonAuth(list);
}) });
const tableButtonConfig = computed(() => { const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code)); return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
...@@ -145,27 +135,16 @@ ...@@ -145,27 +135,16 @@
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code)); return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
}); });
const btnEvent = {view : handleView,add : handleAdd,edit : handleEdit,delete : handleDelete,} const btnEvent = { view: handleView, add: handleAdd, edit: handleEdit, delete: handleDelete };
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
const formIdComputedRef = computed(() => currentRoute.value.meta.formId as string); const formIdComputedRef = computed(() => currentRoute.value.meta.formId as string);
provide<Ref<string>>('currentFormId', formIdComputedRef); provide<Ref<string>>('currentFormId', formIdComputedRef);
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
const [registerTable, { reload }] = useTable({
const [registerTable, { reload, }] = useTable({
title: 'Gylx列表', title: 'Gylx列表',
api: getRokeRoutingPage, api: getRokeRoutingPage,
rowKey: 'id', rowKey: 'id',
...@@ -179,23 +158,15 @@ ...@@ -179,23 +158,15 @@
fieldMapToTime: [], fieldMapToTime: [],
showResetButton: false, showResetButton: false,
}, },
bordered:false, bordered: false,
beforeFetch: (params) => { beforeFetch: (params) => {
pageParamsInfo.value = {...params, FormId: formIdComputedRef.value,PK: 'id' } pageParamsInfo.value = { ...params, FormId: formIdComputedRef.value, PK: 'id' };
return pageParamsInfo.value; return pageParamsInfo.value;
}, },
afterFetch: (res) => { afterFetch: (res) => {},
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
striped: false, striped: false,
actionColumn: { actionColumn: {
width: 195, width: 195,
...@@ -207,60 +178,44 @@ ...@@ -207,60 +178,44 @@
size: false, size: false,
}, },
customRow, customRow,
isAdvancedQuery: false, isAdvancedQuery: false,
querySelectOption: JSON.stringify(searchFormSchema), querySelectOption: JSON.stringify(searchFormSchema),
objectId: formIdComputedRef.value, ////系统表单formId,自定义表单releaseId的id值 objectId: formIdComputedRef.value, ////系统表单formId,自定义表单releaseId的id值
}); });
function buttonClick(code) { function buttonClick(code) {
btnEvent[code](); btnEvent[code]();
} }
function handleAdd() { function handleAdd() {
openModal(true, { isUpdate: false });
}
openModal(true, { isUpdate: false, });
}
async function handleEdit(record: Recordable) { async function handleEdit(record: Recordable) {
let field = 'id'; let field = 'id';
try { try {
let hasIn = handleHasEnableLocke(buttonConfigs.value, 'edit'); let hasIn = handleHasEnableLocke(buttonConfigs.value, 'edit');
if (hasIn) { if (hasIn) {
let res = await handleOpenFormEnableLockeData( let res = await handleOpenFormEnableLockeData(record[field], formIdComputedRef.value);
record[field],
formIdComputedRef.value,
);
if (res !== null) { if (res !== null) {
return; return;
} }
} }
let info = { let info = {
id: record[field], id: record[field],
isUpdate: true, isUpdate: true,
};
};
openModal(true, info);
openModal(true, info); } catch (error) {}
} catch (error) {}
} }
function handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
deleteList([record.id]); deleteList([record.id]);
} }
function deleteList(ids) { function deleteList(ids) {
Modal.confirm({ Modal.confirm({
title: '提示信息', title: '提示信息',
...@@ -280,70 +235,59 @@ ...@@ -280,70 +235,59 @@
onCancel() {}, onCancel() {},
}); });
} }
function customRow(record: Recordable) { function customRow(record: Recordable) {
return { return {
ondblclick: () => { ondblclick: () => {
if (record.isCanEdit && hasPermission("gylx:edit")) { if (record.isCanEdit && hasPermission('gylx:edit')) {
handleEdit(record); handleEdit(record);
} }
}, },
}; };
} }
function handleSuccess() { function handleSuccess() {
reload(); reload();
} }
function handleFormSuccess() {
function handleFormSuccess() {
handleSuccess(); handleSuccess();
handleCloseFormEnableLocke(buttonConfigs.value, 'edit'); handleCloseFormEnableLocke(buttonConfigs.value, 'edit');
} }
function handleFormCancel() { function handleFormCancel() {
handleCloseFormEnableLocke(buttonConfigs.value, 'edit'); handleCloseFormEnableLocke(buttonConfigs.value, 'edit');
} }
function handleView(record: Recordable) { function handleView(record: Recordable) {
let info={ let info = {
isView: true, isView: true,
id: record.id, id: record.id,
} };
openModal(true, info); openModal(true, info);
} }
function getLessActions(record: Recordable) { function getLessActions(record: Recordable) {
let list = getActions(record); let list = getActions(record);
return list.slice(0, listSpliceNum.value); return list.slice(0, listSpliceNum.value);
} }
function getMoreActions(record: Recordable) { function getMoreActions(record: Recordable) {
let list = getActions(record); let list = getActions(record);
return list.slice(listSpliceNum.value); return list.slice(listSpliceNum.value);
} }
function getActions(record: Recordable):ActionItem[] {
function getActions(record: Recordable): ActionItem[] {
record.isCanEdit = false; record.isCanEdit = false;
let actionsList: ActionItem[] = []; let actionsList: ActionItem[] = [];
actionButtonConfig.value?.map((button) => { actionButtonConfig.value?.map((button) => {
if (!record?.workflowData?.processId) { if (!record?.workflowData?.processId) {
record.isCanEdit = true; record.isCanEdit = true;
actionsList.push({ actionsList.push({
...button, ...button,
auth: `gylx:${button.code}`, auth: `gylx:${button.code}`,
label: button?.name, label: button?.name,
color: button.code === 'delete' ? 'error' : undefined, color: button.code === 'delete' ? 'error' : undefined,
...@@ -352,34 +296,26 @@ ...@@ -352,34 +296,26 @@
} else { } else {
if (!['edit', 'delete'].includes(button.code)) { if (!['edit', 'delete'].includes(button.code)) {
actionsList.push({ actionsList.push({
auth: `gylx:${button.code}`, auth: `gylx:${button.code}`,
label: button?.name, label: button?.name,
onClick: btnEvent[button.code]?.bind(null, record), onClick: btnEvent[button.code]?.bind(null, record),
}); });
} }
} }
}); });
return actionsList; return actionsList;
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
:deep(.ant-table-selection-col) { :deep(.ant-table-selection-col) {
width: 50px; width: 50px;
} }
.show{ .show {
display: flex; display: flex;
} }
.hide{ .hide {
display: none !important; display: none !important;
} }
</style>
</style>
\ No newline at end of file
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
ref="systemFormRef" ref="systemFormRef"
:formProps="data.formDataProps" :formProps="data.formDataProps"
:formModel="state.formModel" :formModel="state.formModel"
:isWorkFlow="props.fromPage!=FromPageType.MENU" :isWorkFlow="props.fromPage != FromPageType.MENU"
:isCamelCase="true" :isCamelCase="true"
@model-change="handleChange" @model-change="handleChange"
/> />
</div> </div>
...@@ -14,26 +14,35 @@ ...@@ -14,26 +14,35 @@
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 { addMesProductionTask, getMesProductionTask, updateMesProductionTask } from '/@/api/scgl/scrw'; import {
import { getRokeRouting } from '/@/api/jcsj/gylx'; addMesProductionTask,
import { cloneDeep, isString } from 'lodash-es'; getMesProductionTask,
updateMesProductionTask,
} from '/@/api/scgl/scrw';
import { getRokeRouting } from '/@/api/jcsj/gylx';
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';
import { notification } from 'ant-design-vue'; import { notification } from 'ant-design-vue';
import axios from 'axios'; import axios from 'axios';
import { getEnvConfig } from '/@/build/utils'; import { getEnvConfig } from '/@/build/utils';
import { log } from 'node:console'; import { log } from 'node:console';
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,
...@@ -46,13 +55,13 @@ import { log } from 'node:console'; ...@@ -46,13 +55,13 @@ import { log } from 'node:console';
}); });
const state = reactive({ const state = reactive({
formModel: {}, formModel: {},
formInfo:{formId:'',formName:''}, formInfo: { formId: '', formName: '' },
isInitializing: false isInitializing: false,
}); });
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
watch( watch(
() => state.formModel, () => state.formModel,
(val) => { (val) => {
emits('update:value', val); emits('update:value', val);
}, },
{ {
...@@ -67,7 +76,9 @@ import { log } from 'node:console'; ...@@ -67,7 +76,9 @@ import { log } from 'node:console';
if (newBomId && !state.isInitializing) { if (newBomId && !state.isInitializing) {
try { try {
const apiUrl = import.meta.env.VITE_GLOB_API_URL || ''; const apiUrl = import.meta.env.VITE_GLOB_API_URL || '';
const response = await axios.get(apiUrl + '/magic-api/jcxx/wlxList', { params: { bomId: newBomId } }); const response = await axios.get(apiUrl + '/magic-api/jcxx/wlxList', {
params: { bomId: newBomId },
});
state.formModel.mesWarehouseMaterialList = []; state.formModel.mesWarehouseMaterialList = [];
//铸造量的值 //铸造量的值
let sl = state.formModel.sl; let sl = state.formModel.sl;
...@@ -81,12 +92,12 @@ import { log } from 'node:console'; ...@@ -81,12 +92,12 @@ import { log } from 'node:console';
let result = Number((sl / bomsl).toFixed(2)); let result = Number((sl / bomsl).toFixed(2));
//物料数量等于原数量*倍数 //物料数量等于原数量*倍数
if (item.wlsl && item.wlsl > 0) { if (item.wlsl && item.wlsl > 0) {
item.wlsl = Number((item.wlsl*result).toFixed(2)); item.wlsl = Number((item.wlsl * result).toFixed(2));
} }
} }
}) });
} }
state.formModel.mesWarehouseMaterialList = response.data.data.map(item => ({ state.formModel.mesWarehouseMaterialList = response.data.data.map((item) => ({
wlbh: item.wlbh, wlbh: item.wlbh,
wlmc: item.wlmc, wlmc: item.wlmc,
blsl: item.wlsl, blsl: item.wlsl,
...@@ -95,13 +106,13 @@ import { log } from 'node:console'; ...@@ -95,13 +106,13 @@ import { log } from 'node:console';
nkbz: item.nkbz, nkbz: item.nkbz,
sftl: item.sftl, sftl: item.sftl,
bomsl: item.bomsl, bomsl: item.bomsl,
wlId: item.id wlId: item.id,
})); }));
} catch (error) { } catch (error) {
notification.error({ message: '获取物料清单失败' }); notification.error({ message: '获取物料清单失败' });
} }
} }
} },
); );
// Watch for changes to process route field and call API // Watch for changes to process route field and call API
...@@ -112,43 +123,63 @@ import { log } from 'node:console'; ...@@ -112,43 +123,63 @@ import { log } from 'node:console';
try { try {
const response = await getRokeRouting(newGylxId); const response = await getRokeRouting(newGylxId);
//计划数量 //计划数量
const jhsl = state.formModel["sl"]; const jhsl = state.formModel['sl'];
//计划开始时间 //计划开始时间
const jhksrq = state.formModel["jhksrq"]; const jhksrq = state.formModel['jhksrq'];
//计划结束时间 //计划结束时间
const jhjsrq = state.formModel["jhjsrq"]; const jhjsrq = state.formModel['jhjsrq'];
// Assign the process list from API response to production order list with field mapping // Assign the process list from API response to production order list with field mapping
state.formModel.mesProductionGongdanList = response.rokeRoutingProcessList.map(item => ({ state.formModel.mesProductionGongdanList = response.rokeRoutingProcessList.map(
gxbh: item.code, // 工序编号 → 工序编号 (item) => ({
gxmc: item.name, // 工序名称 → 工序名称 gxbh: item.code, // 工序编号 → 工序编号
jhsl: jhsl, gxmc: item.name, // 工序名称 → 工序名称
jhksrq: jhksrq, jhsl: jhsl,
jhjsrq: jhjsrq, jhksrq: jhksrq,
gxId: item.processId // 工序ID → 工序ID jhjsrq: jhjsrq,
})); gxId: item.processId, // 工序ID → 工序ID
}),
);
} catch (error) { } catch (error) {
notification.error({ message: '获取工艺路线详情失败' }); notification.error({ message: '获取工艺路线详情失败' });
} }
} }
} },
); );
onMounted(async () => { onMounted(async () => {
try { try {
if (props.fromPage == FromPageType.MENU) { if (props.fromPage == FromPageType.MENU) {
setMenuPermission(); setMenuPermission();
if(currentRoute.value.meta){ if (currentRoute.value.meta) {
state.formInfo.formName = currentRoute.value.meta.title&&isString(currentRoute.value.meta.title)?currentRoute.value.meta.title:''; state.formInfo.formName =
state.formInfo.formId = currentRoute.value.meta.formId&&isString(currentRoute.value.meta.formId)?currentRoute.value.meta.formId:''; currentRoute.value.meta.title && isString(currentRoute.value.meta.title)
? currentRoute.value.meta.title
: '';
state.formInfo.formId =
currentRoute.value.meta.formId && isString(currentRoute.value.meta.formId)
? currentRoute.value.meta.formId
: '';
} }
await createFormEvent(formEventConfigs, state.formModel, await createFormEvent(
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,
); //表单事件:初始化表单
await nextTick(); await nextTick();
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,
); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) { } else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕 emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法 // loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
...@@ -157,15 +188,28 @@ import { log } from 'node:console'; ...@@ -157,15 +188,28 @@ import { log } from 'node:console';
} else if (props.fromPage == FromPageType.DESKTOP) { } else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行 // 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕 emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(formEventConfigs, state.formModel, await createFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value, systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单 formProps.schemas,
await loadFormEvent(formEventConfigs, state.formModel, true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:初始化表单
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,
); //表单事件:加载表单
} }
} catch (error) {} } catch (error) {}
}); });
// 根据菜单页面权限,设置表单属性(必填,禁用,显示) // 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() { function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!); data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
...@@ -185,7 +229,8 @@ import { log } from 'node:console'; ...@@ -185,7 +229,8 @@ import { log } from 'node:console';
} finally { } finally {
} }
return values; return values;
} }
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】 // 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async function setFormDataFromId(rowId) { async function setFormDataFromId(rowId) {
try { try {
...@@ -193,15 +238,21 @@ import { log } from 'node:console'; ...@@ -193,15 +238,21 @@ import { log } from 'node:console';
const record = await getMesProductionTask(rowId); const record = await getMesProductionTask(rowId);
setFieldsValue(record); setFieldsValue(record);
state.formModel = record; state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel, await getFormDataEvent(
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,
); //表单事件:获取表单数据
} catch (error) { } catch (error) {
} finally { } finally {
state.isInitializing = false; state.isInitializing = false;
} }
} }
// 辅助返回表单数据 // 辅助返回表单数据
async function getFieldsValue() { async function getFieldsValue() {
let values = []; let values = [];
...@@ -217,47 +268,66 @@ import { log } from 'node:console'; ...@@ -217,47 +268,66 @@ import { log } from 'node:console';
} }
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;
let saveVal = await updateMesProductionTask(values); let saveVal = await updateMesProductionTask(values);
await submitFormEvent(formEventConfigs, state.formModel, await submitFormEvent(
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,
); //表单事件:提交表单
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 addMesProductionTask(values); let saveVal = await addMesProductionTask(values);
await submitFormEvent(formEventConfigs, state.formModel, await submitFormEvent(
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,
); //表单事件:提交表单
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;
...@@ -272,17 +342,20 @@ import { log } from 'node:console'; ...@@ -272,17 +342,20 @@ import { log } from 'node:console';
setFieldsValue(formModels); setFieldsValue(formModels);
} catch (error) {} } catch (error) {}
} }
function handleChange(val) {
function handleChange(val) {
state.formModel = val; state.formModel = 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,
...@@ -295,6 +368,6 @@ import { log } from 'node:console'; ...@@ -295,6 +368,6 @@ import { log } from 'node:console';
setWorkFlowForm, setWorkFlowForm,
getRowKey, getRowKey,
getFieldsValue, getFieldsValue,
sendMessageForAllIframe sendMessageForAllIframe,
}); });
</script> </script>
<template> <template>
<BasicModal
:height="1080"
<BasicModal v-bind="$attrs"
:height="1080" @register="registerModal"
v-bind="$attrs" @register="registerModal" :title="getTitle" :title="getTitle"
@ok="handleSubmit" @cancel="handleClose" > @ok="handleSubmit"
<ModalForm ref="formRef" v-model:value="state.formModel" :fromPage="FromPageType.MENU" /> @cancel="handleClose"
>
</BasicModal> <ModalForm ref="formRef" v-model:value="state.formModel" :fromPage="FromPageType.MENU" />
</BasicModal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, reactive, provide, Ref } from 'vue'; import { ref, computed, reactive, provide, Ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
import { formProps } from './config'; import { formProps } from './config';
import ModalForm from './Form.vue'; import ModalForm from './Form.vue';
import { FromPageType } from '/@/enums/workflowEnum'; import { FromPageType } from '/@/enums/workflowEnum';
const emit = defineEmits(['success', 'register']); const emit = defineEmits(['success', 'register']);
const { notification } = useMessage(); const { notification } = useMessage();
const formRef = ref(); const formRef = ref();
const isCopy = ref<boolean>(false) const isCopy = ref<boolean>(false);
const state = reactive({ const state = reactive({
formModel: {}, formModel: {},
isUpdate: true, isUpdate: true,
...@@ -38,40 +34,41 @@ ...@@ -38,40 +34,41 @@
const { t } = useI18n(); const { t } = useI18n();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await handleInner(data); await handleInner(data);
}); });
const getTitle = computed(() => (state.isView ? '查看' : state.isUpdate ? '编辑' : isCopy.value ? '复制数据' : '新增')); const getTitle = computed(() =>
state.isView ? '查看' : state.isUpdate ? '编辑' : isCopy.value ? '复制数据' : '新增',
);
async function handleInner(data) {
async function handleInner(data){
state.isUpdate = !!data?.isUpdate; state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView; state.isView = !!data?.isView;
isCopy.value = !!data?.isCopy; isCopy.value = !!data?.isCopy;
setModalProps({ setModalProps({
destroyOnClose: true, destroyOnClose: true,
maskClosable: false, maskClosable: false,
showCancelBtn: !state.isView, showCancelBtn: !state.isView,
showOkBtn: !state.isView, showOkBtn: !state.isView,
canFullscreen: true, canFullscreen: true,
width: 1920, width: 1920,
footer: state.isView ? null : undefined,defaultFullscreen:true, footer: state.isView ? null : undefined,
defaultFullscreen: true,
}); });
if (state.isUpdate || state.isView || isCopy.value) { if (state.isUpdate || state.isView || isCopy.value) {
state.rowId = data.id; state.rowId = data.id;
if (state.isView) { if (state.isView) {
await formRef.value.setDisabledForm(); await formRef.value.setDisabledForm();
} }
await formRef.value.setFormDataFromId(state.rowId); await formRef.value.setFormDataFromId(state.rowId);
} else { } else {
formRef.value.resetFields(); formRef.value.resetFields();
} }
} }
async function saveModal() { async function saveModal() {
let saveSuccess = false; let saveSuccess = false;
try { try {
...@@ -94,14 +91,14 @@ ...@@ -94,14 +91,14 @@
} }
} catch (error) { } catch (error) {
if (error) { if (error) {
let errorFields = error["errorFields"]; let errorFields = error['errorFields'];
if (Array.isArray(errorFields) && errorFields.length > 0) { if (Array.isArray(errorFields) && errorFields.length > 0) {
let errorInfos = errorFields[0]["errors"]; let errorInfos = errorFields[0]['errors'];
if (Array.isArray(errorInfos) && errorInfos.length > 0) { if (Array.isArray(errorInfos) && errorInfos.length > 0) {
let description = errorInfos[0]; let description = errorInfos[0];
notification.error({ notification.error({
message: t('提示'), message: t('提示'),
description: "物料清单列表"+description, description: '物料清单列表' + description,
}); });
} }
} }
...@@ -113,9 +110,9 @@ ...@@ -113,9 +110,9 @@
async function handleSubmit() { async function handleSubmit() {
try { try {
const saveSuccess = await saveModal(); const saveSuccess = await saveModal();
setModalProps({ confirmLoading: true }); setModalProps({ confirmLoading: true });
if (saveSuccess) { if (saveSuccess) {
if (!state.isUpdate || isCopy.value) { if (!state.isUpdate || isCopy.value) {
//false 新增 //false 新增
...@@ -129,23 +126,19 @@ ...@@ -129,23 +126,19 @@
description: t('修改成功!'), description: t('修改成功!'),
}); //提示消息 }); //提示消息
} }
closeModal(); closeModal();
formRef.value.resetFields(); formRef.value.resetFields();
emit('success'); emit('success');
} }
} finally { } finally {
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
} }
} }
function handleClose() { function handleClose() {
formRef.value.resetFields(); formRef.value.resetFields();
closeModal(); closeModal();
} }
</script> </script>
import { FormProps, FormSchema } from '/@/components/Form'; import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
import {uploadApi} from "/@/api/sys/upload"; import { uploadApi } from '/@/api/sys/upload';
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ {
...@@ -170,7 +170,7 @@ export const columns: BasicColumn[] = [ ...@@ -170,7 +170,7 @@ export const columns: BasicColumn[] = [
styleConfig: undefined, styleConfig: undefined,
listStyle: undefined, listStyle: undefined,
} },
]; ];
//表头合并配置 //表头合并配置
export const headerMergingData = []; export const headerMergingData = [];
...@@ -331,32 +331,32 @@ export const formProps: FormProps = { ...@@ -331,32 +331,32 @@ export const formProps: FormProps = {
style: { width: '100%' }, style: { width: '100%' },
}, },
}, },
/* { /* {
key: '25e30bcce47a437fb5674d9dbce3523a', key: '25e30bcce47a437fb5674d9dbce3523a',
field: 'zl', field: 'zl',
label: '重量/KG', label: '重量/KG',
type: 'number', type: 'number',
component: 'InputNumber', component: 'InputNumber',
colProps: { span: 24 }, colProps: { span: 24 },
defaultValue: 0, defaultValue: 0,
componentProps: { componentProps: {
width: '100%', width: '100%',
span: 7, span: 7,
defaultValue: 0, defaultValue: 0,
min: 0, min: 0,
step: 0.1, step: 0.1,
disabled: false, disabled: false,
showLabel: true, showLabel: true,
controls: true, controls: true,
required: false, required: false,
subTotal: false, subTotal: false,
isShow: true, isShow: true,
rules: [], rules: [],
events: { change: '' }, events: { change: '' },
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' }, style: { width: '100%' },
}, },
},*/ },*/
{ {
key: 'd66e5ebfa5d64b829fde596c82155158', key: 'd66e5ebfa5d64b829fde596c82155158',
field: 'sfnbdd', field: 'sfnbdd',
...@@ -610,39 +610,39 @@ export const formProps: FormProps = { ...@@ -610,39 +610,39 @@ export const formProps: FormProps = {
{ {
span: 6, span: 6,
list: [ list: [
/* { /* {
key: 'eb29665fc1e3453d9ef8aa88f8dfac0c', key: 'eb29665fc1e3453d9ef8aa88f8dfac0c',
field: 'zzl', field: 'zzl',
label: '铸造量', label: '铸造量',
type: 'input', type: 'input',
component: 'Input', component: 'Input',
colProps: { span: 24 }, colProps: { span: 24 },
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
width: '100%', width: '100%',
span: 7, span: 7,
defaultValue: '', defaultValue: '',
placeholder: '', placeholder: '',
prefix: '', prefix: '',
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
addonAfter: '', addonAfter: '',
disabled: false, disabled: false,
allowClear: false, allowClear: false,
showLabel: true, showLabel: true,
required: false, required: false,
rules: [], rules: [],
events: { change: '' }, events: { change: '' },
listStyle: '', listStyle: '',
isSave: false, isSave: false,
isShow: true, isShow: true,
scan: false, scan: false,
bordered: true, bordered: true,
isShowAi: false, isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' }, style: { width: '100%' },
}, },
},*/ },*/
{ {
key: '99da98d5a335454a9d613715e539c7bd', key: '99da98d5a335454a9d613715e539c7bd',
field: 'kh', field: 'kh',
...@@ -791,7 +791,6 @@ export const formProps: FormProps = { ...@@ -791,7 +791,6 @@ export const formProps: FormProps = {
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
}, },
}, },
], ],
}, },
{ {
...@@ -891,14 +890,11 @@ export const formProps: FormProps = { ...@@ -891,14 +890,11 @@ export const formProps: FormProps = {
style: { width: '100%' }, style: { width: '100%' },
}, },
}, },
], ],
}, },
{ {
span: 6, span: 6,
list: [ list: [],
],
}, },
], ],
componentProps: { componentProps: {
...@@ -988,6 +984,14 @@ export const formProps: FormProps = { ...@@ -988,6 +984,14 @@ export const formProps: FormProps = {
width: 150, width: 150,
component: '6baebd752fae4267aa0ce0a684aa3a1c', component: '6baebd752fae4267aa0ce0a684aa3a1c',
}, },
{
name: 'routing_id',
tableTitle: '工艺路线',
bindField: 'gylx',
show: true,
width: 150,
component: '90df3bd996a3469789d4557edf80aca7',
},
], ],
}, },
dicOptions: [], dicOptions: [],
...@@ -1084,7 +1088,6 @@ export const formProps: FormProps = { ...@@ -1084,7 +1088,6 @@ export const formProps: FormProps = {
}, },
], ],
}, },
], ],
componentProps: { componentProps: {
gutter: 16, gutter: 16,
...@@ -1224,7 +1227,8 @@ export const formProps: FormProps = { ...@@ -1224,7 +1227,8 @@ export const formProps: FormProps = {
}, },
], ],
}, },
{ span: 6, {
span: 6,
list: [ list: [
{ {
key: 'v2n5h0j9v1k1b5n6n7i2a1d8t8y4x8s7', key: 'v2n5h0j9v1k1b5n6n7i2a1d8t8y4x8s7',
...@@ -1274,7 +1278,7 @@ export const formProps: FormProps = { ...@@ -1274,7 +1278,7 @@ export const formProps: FormProps = {
style: { width: '100%' }, style: { width: '100%' },
}, },
}, },
] ],
}, },
{ span: 6, list: [] }, { span: 6, list: [] },
], ],
......
export const permissionList = [ export const permissionList = [
{ {
required: false, required: false,
view: true, view: true,
......
<template> <template>
<ResizePageWrapper :hasLeft="false">
<template #resizeRight>
<ResizePageWrapper :hasLeft="false"> <BasicTable
@register="registerTable"
isMenuTable
<template #resizeRight> ref="tableRef"
<BasicTable @register="registerTable" isMenuTable ref="tableRef" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }"
>
>
<template #toolbar> <template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code"> <template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" type="primary" @click="buttonClick(button.code)"> <a-button v-if="button.isDefault" type="primary" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template> <template #icon>
<Icon :icon="button.icon" />
</template>
{{ button.name }} {{ button.name }}
</a-button> </a-button>
<CustomButtonModal v-else-if="button.buttonType == 'modal'" :info="button" /> <CustomButtonModal v-else-if="button.buttonType == 'modal'" :info="button" />
<a-button v-else :type="button.buttonType === 'danger' ? 'default' : button.buttonType || 'primary'" :danger="button.buttonType === 'danger'" > <a-button
<template #icon><Icon :icon="button.icon" /></template> v-else
:type="button.buttonType === 'danger' ? 'default' : button.buttonType || 'primary'"
:danger="button.buttonType === 'danger'"
>
<template #icon>
<Icon :icon="button.icon" />
</template>
{{ button.name }} {{ button.name }}
</a-button> </a-button>
</template> </template>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<TableAction
<TableAction
:actions="getLessActions(record)" :actions="getLessActions(record)"
:dropDownActions="getMoreActions(record)" :dropDownActions="getMoreActions(record)"
/> />
</template> </template>
<template v-else-if="column.dataIndex && column?.listStyle"> <template v-else-if="column.dataIndex && column?.listStyle">
<span :style="executeListStyle(getValue(record, column, 'style'), column?.listStyle)">{{ <span :style="executeListStyle(getValue(record, column, 'style'), column?.listStyle)">{{
getValue(record, column, 'value') getValue(record, column, 'value')
}}</span> }}</span>
</template> </template>
</template> </template>
</BasicTable> </BasicTable>
</template> </template>
<ScrwModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/>
</ResizePageWrapper>
<ScrwModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel" />
</ResizePageWrapper>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed,provide,Ref, createVNode, import { ref, computed, provide, Ref, createVNode } from 'vue';
} from 'vue';
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table'; import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getMesProductionTaskPage, deleteMesProductionTask} from '/@/api/scgl/scrw'; import { getMesProductionTaskPage, deleteMesProductionTask } from '/@/api/scgl/scrw';
import { ResizePageWrapper } from '/@/components/Page'; import { ResizePageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
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 { executeListStyle, getValue } from '/@/hooks/web/useListStyle';//列表样式配置 import { executeListStyle, getValue } from '/@/hooks/web/useListStyle'; //列表样式配置
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import ScrwModal from './components/ScrwModal.vue'; import ScrwModal from './components/ScrwModal.vue';
import { searchFormSchema, columns } from './components/config';
import { searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index'; import Icon from '/@/components/Icon/index';
const listSpliceNum = ref(3); //操作列最先展示几个
const listSpliceNum = ref(3); //操作列最先展示几个
import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock'; import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock';
const pageParamsInfo = ref<any>({}); const pageParamsInfo = ref<any>({});
const { enableLockeData,handleOpenFormEnableLockeData, handleCloseFormEnableLocke, handleHasEnableLocke } = const {
useConcurrentLock(); enableLockeData,
handleOpenFormEnableLockeData,
handleCloseFormEnableLocke,
handleHasEnableLocke,
} = useConcurrentLock();
const { notification } = useMessage(); const { notification } = useMessage();
const { t } = useI18n(); const { t } = useI18n();
...@@ -124,18 +90,111 @@ ...@@ -124,18 +90,111 @@
const filterColumns = filterColumnAuth(columns); const filterColumns = filterColumnAuth(columns);
const tableRef = ref(); const tableRef = ref();
//展示在列表内的按钮 //展示在列表内的按钮
const actionButtons = ref<string[]>(["view","edit","ddzh","delete"]); const actionButtons = ref<string[]>(['view', 'edit', 'ddzh', 'delete']);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(() => {
const list = [{"buttonId":"2008813468518432768","name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"buttonId":"2008813468518432769","name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"buttonId":"2008813468518432770","name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true,"isEnableLock":true},{"buttonId":"2008813468518432771","name":"打印","code":"sclld","icon":"ant-design:file-text-outlined","isDefault":false,"isUse":true,"setting":[],"showType":"top","buttonType":"primary"},{"isUse":true,"name":"订单转换","code":"ddzh","icon":"","isDefault":false,"setting":[],"showType":"inline","buttonType":"modal","modal":{"bindModal":"2010615112372113410","innerParams":[{"name":"任务ID","type":"value","value":"1","apiConfig":{"path":"CodeGeneration/selection","method":"GET","apiId":"93d735dcb7364a0f8102188ec4d77ac7"},"component":"{\"table\":\"table_19041\",\"field\":\"ren_wuid1465\"}"},{"name":"任务编号","type":"value","value":"CCRW001","apiConfig":{"path":"CodeGeneration/selection","method":"GET","apiId":"93d735dcb7364a0f8102188ec4d77ac7"},"component":"{\"table\":\"table_19041\",\"field\":\"zhuan_huan_qian_ding_dan5032\"}"}],"outParams":[{"name":"转换后","component":"{\"table\":\"table_19041\",\"field\":\"zhuan_huan_hou_ding_dan6513\"}","mainComponent":""}],"modalWidth":900,"modalWidthUnit":"px","modalHeight":300,"modalHeightUnit":"px","title":"订单转换","confirm":"","cancel":"","open":"","close":""}},{"buttonId":"2008813468518432772","name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}] const list = [
{
buttonId: '2008813468518432768',
name: '查看',
code: 'view',
icon: 'ant-design:eye-outlined',
isDefault: true,
isUse: true,
},
{
buttonId: '2008813468518432769',
name: '新增',
code: 'add',
icon: 'ant-design:plus-outlined',
isDefault: true,
isUse: true,
},
{
buttonId: '2008813468518432770',
name: '编辑',
code: 'edit',
icon: 'ant-design:form-outlined',
isDefault: true,
isUse: true,
isEnableLock: true,
},
{
buttonId: '2008813468518432771',
name: '打印',
code: 'sclld',
icon: 'ant-design:file-text-outlined',
isDefault: false,
isUse: true,
setting: [],
showType: 'top',
buttonType: 'primary',
},
{
isUse: true,
name: '订单转换',
code: 'ddzh',
icon: '',
isDefault: false,
setting: [],
showType: 'inline',
buttonType: 'modal',
modal: {
bindModal: '2010615112372113410',
innerParams: [
{
name: '任务ID',
type: 'value',
value: '1',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
component: '{"table":"table_19041","field":"ren_wuid1465"}',
},
{
name: '任务编号',
type: 'value',
value: 'CCRW001',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
component: '{"table":"table_19041","field":"zhuan_huan_qian_ding_dan5032"}',
},
],
outParams: [
{
name: '转换后',
component: '{"table":"table_19041","field":"zhuan_huan_hou_ding_dan6513"}',
mainComponent: '',
},
],
modalWidth: 900,
modalWidthUnit: 'px',
modalHeight: 300,
modalHeightUnit: 'px',
title: '订单转换',
confirm: '',
cancel: '',
open: '',
close: '',
},
},
{
buttonId: '2008813468518432772',
name: '删除',
code: 'delete',
icon: 'ant-design:delete-outlined',
isDefault: true,
isUse: true,
},
];
return filterButtonAuth(list); return filterButtonAuth(list);
}) });
const tableButtonConfig = computed(() => { const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code)); return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
...@@ -145,29 +204,19 @@ ...@@ -145,29 +204,19 @@
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code)); return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
}); });
const btnEvent = {view : handleView,add : handleAdd,edit : handleEdit,delete : handleDelete,} const btnEvent = { view: handleView, add: handleAdd, edit: handleEdit, delete: handleDelete };
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
const formIdComputedRef = computed(() => currentRoute.value.meta.formId as string); const formIdComputedRef = computed(() => currentRoute.value.meta.formId as string);
provide<Ref<string>>('currentFormId', formIdComputedRef); provide<Ref<string>>('currentFormId', formIdComputedRef);
const selectedKeys = ref<string[]>([]); const selectedKeys = ref<string[]>([]);
const selectedRowsData = ref<any[]>([]); const selectedRowsData = ref<any[]>([]);
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
const [registerTable, { reload }] = useTable({
const [registerTable, { reload, }] = useTable({
title: 'Scrw列表', title: 'Scrw列表',
api: getMesProductionTaskPage, api: getMesProductionTaskPage,
rowKey: 'id', rowKey: 'id',
...@@ -181,25 +230,18 @@ ...@@ -181,25 +230,18 @@
fieldMapToTime: [], fieldMapToTime: [],
showResetButton: false, showResetButton: false,
}, },
bordered:false, bordered: false,
beforeFetch: (params) => { beforeFetch: (params) => {
pageParamsInfo.value = {...params, FormId: formIdComputedRef.value,PK: 'id' } pageParamsInfo.value = { ...params, FormId: formIdComputedRef.value, PK: 'id' };
return pageParamsInfo.value; return pageParamsInfo.value;
}, },
afterFetch: (res) => { afterFetch: (res) => {
selectedKeys.value = []; selectedKeys.value = [];
selectedRowsData.value = []; selectedRowsData.value = [];
}, },
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
striped: false, striped: false,
actionColumn: { actionColumn: {
width: 225, width: 225,
...@@ -211,30 +253,21 @@ ...@@ -211,30 +253,21 @@
size: false, size: false,
}, },
customRow, customRow,
isAdvancedQuery: false, isAdvancedQuery: false,
querySelectOption: JSON.stringify(searchFormSchema), querySelectOption: JSON.stringify(searchFormSchema),
objectId: formIdComputedRef.value, ////系统表单formId,自定义表单releaseId的id值 objectId: formIdComputedRef.value, ////系统表单formId,自定义表单releaseId的id值
}); });
function buttonClick(code) { function buttonClick(code) {
btnEvent[code](); btnEvent[code]();
} }
function handleAdd() { function handleAdd() {
openModal(true, { isUpdate: false });
}
openModal(true, { isUpdate: false, });
}
async function handleEdit(record: Recordable) { async function handleEdit(record: Recordable) {
const hasNonDraft = (record.zt !== '草稿' && record.zt !== '未开始'); const hasNonDraft = record.zt !== '草稿' && record.zt !== '未开始';
if (hasNonDraft) { if (hasNonDraft) {
Modal.warning({ Modal.warning({
title: '提示', title: '提示',
...@@ -243,36 +276,29 @@ ...@@ -243,36 +276,29 @@
return; return;
} }
let field = 'id'; let field = 'id';
try { try {
let hasIn = handleHasEnableLocke(buttonConfigs.value, 'edit'); let hasIn = handleHasEnableLocke(buttonConfigs.value, 'edit');
if (hasIn) { if (hasIn) {
let res = await handleOpenFormEnableLockeData( let res = await handleOpenFormEnableLockeData(record[field], formIdComputedRef.value);
record[field],
formIdComputedRef.value,
);
if (res !== null) { if (res !== null) {
return; return;
} }
} }
let info = { let info = {
id: record[field], id: record[field],
isUpdate: true, isUpdate: true,
};
};
openModal(true, info);
openModal(true, info); } catch (error) {}
} catch (error) {}
} }
function handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
deleteList([record.id]); deleteList([record.id]);
} }
function deleteList(ids) { function deleteList(ids) {
Modal.confirm({ Modal.confirm({
title: '提示信息', title: '提示信息',
...@@ -292,19 +318,14 @@ ...@@ -292,19 +318,14 @@
onCancel() {}, onCancel() {},
}); });
} }
function onSelectChange(selectedRowKeys: [], selectedRows) { function onSelectChange(selectedRowKeys: [], selectedRows) {
selectedKeys.value = selectedRowKeys; selectedKeys.value = selectedRowKeys;
selectedRowsData.value = selectedRows; selectedRowsData.value = selectedRows;
} }
function customRow(record: Recordable) { function customRow(record: Recordable) {
return { return {
onClick: () => { onClick: () => {
let selectedRowKeys = [...selectedKeys.value]; let selectedRowKeys = [...selectedKeys.value];
if (selectedRowKeys.indexOf(record.id) >= 0) { if (selectedRowKeys.indexOf(record.id) >= 0) {
...@@ -316,62 +337,57 @@ ...@@ -316,62 +337,57 @@
selectedKeys.value = selectedRowKeys; selectedKeys.value = selectedRowKeys;
}, },
ondblclick: () => { ondblclick: () => {
if (record.isCanEdit && hasPermission("scrw:edit")) { if (record.isCanEdit && hasPermission('scrw:edit')) {
handleEdit(record); handleEdit(record);
} }
}, },
}; };
} }
function handleSuccess() { function handleSuccess() {
selectedKeys.value = [];
selectedRowsData.value = [];
selectedKeys.value = [];
selectedRowsData.value = [];
reload(); reload();
} }
function handleFormSuccess() {
function handleFormSuccess() {
handleSuccess(); handleSuccess();
handleCloseFormEnableLocke(buttonConfigs.value, 'edit'); handleCloseFormEnableLocke(buttonConfigs.value, 'edit');
} }
function handleFormCancel() { function handleFormCancel() {
handleCloseFormEnableLocke(buttonConfigs.value, 'edit'); handleCloseFormEnableLocke(buttonConfigs.value, 'edit');
} }
function handleView(record: Recordable) { function handleView(record: Recordable) {
let info={ let info = {
isView: true, isView: true,
id: record.id, id: record.id,
} };
openModal(true, info); openModal(true, info);
} }
function getLessActions(record: Recordable) { function getLessActions(record: Recordable) {
let list = getActions(record); let list = getActions(record);
return list.slice(0, listSpliceNum.value); return list.slice(0, listSpliceNum.value);
} }
function getMoreActions(record: Recordable) { function getMoreActions(record: Recordable) {
let list = getActions(record); let list = getActions(record);
return list.slice(listSpliceNum.value); return list.slice(listSpliceNum.value);
} }
function getActions(record: Recordable):ActionItem[] {
function getActions(record: Recordable): ActionItem[] {
record.isCanEdit = false; record.isCanEdit = false;
let actionsList: ActionItem[] = []; let actionsList: ActionItem[] = [];
actionButtonConfig.value?.map((button) => { actionButtonConfig.value?.map((button) => {
if (!record?.workflowData?.processId) { if (!record?.workflowData?.processId) {
record.isCanEdit = true; record.isCanEdit = true;
actionsList.push({ actionsList.push({
...button, ...button,
auth: `scrw:${button.code}`, auth: `scrw:${button.code}`,
label: button?.name, label: button?.name,
color: button.code === 'delete' ? 'error' : undefined, color: button.code === 'delete' ? 'error' : undefined,
...@@ -380,34 +396,26 @@ ...@@ -380,34 +396,26 @@
} else { } else {
if (!['edit', 'delete'].includes(button.code)) { if (!['edit', 'delete'].includes(button.code)) {
actionsList.push({ actionsList.push({
auth: `scrw:${button.code}`, auth: `scrw:${button.code}`,
label: button?.name, label: button?.name,
onClick: btnEvent[button.code]?.bind(null, record), onClick: btnEvent[button.code]?.bind(null, record),
}); });
} }
} }
}); });
return actionsList; return actionsList;
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
:deep(.ant-table-selection-col) { :deep(.ant-table-selection-col) {
width: 50px; width: 50px;
} }
.show{ .show {
display: flex; display: flex;
} }
.hide{ .hide {
display: none !important; display: none !important;
} }
</style> </style>
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