密炼机动作维护、日罐物料对应信息、密炼机条件维护、生产订单、金蝶对接配置
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<MesXslMixerConditionList />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MesXslMixerConditionList from '../../xslmes/mesXslMixerCondition/MesXslMixerConditionList.vue';
|
||||
</script>
|
||||
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<MesXslProductionOrderList />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MesXslProductionOrderList from '../../xslmes/mesXslProductionOrder/MesXslProductionOrderList.vue';
|
||||
</script>
|
||||
@@ -11,6 +11,7 @@ enum Api {
|
||||
getThirdUserBindByWechat = '/sys/thirdApp/getThirdUserBindByWechat',
|
||||
deleteThirdAccount = '/sys/thirdApp/deleteThirdAccount',
|
||||
deleteThirdAppConfig = '/sys/thirdApp/deleteThirdAppConfig',
|
||||
testKingdeeConnect = '/sys/thirdApp/testKingdeeConnect',
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,4 +79,11 @@ export const deleteThirdAppConfig = (params, handleSuccess) => {
|
||||
return defHttp.delete({ url: Api.deleteThirdAppConfig, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 测试金蝶连接
|
||||
*/
|
||||
export const testKingdeeConnect = (params) => {
|
||||
return defHttp.get({ url: Api.testKingdeeConnect, params }, { isTransformResponse: false });
|
||||
};
|
||||
@@ -16,31 +16,43 @@ export const thirdAppFormSchema: FormSchema[] = [
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: 'CorpId',
|
||||
label: 'CorpId/服务地址',
|
||||
field: 'corpId',
|
||||
component: 'Input',
|
||||
ifShow: ({ values }) => {
|
||||
return values.thirdType === 'dingtalk';
|
||||
return values.thirdType === 'dingtalk' || values.thirdType === 'kingdee';
|
||||
},
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => ({
|
||||
placeholder: formModel?.thirdType === 'kingdee' ? '请输入金蝶服务地址,例如 https://xxx.xxx.com' : '请输入CorpId',
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Agentld',
|
||||
label: 'AgentId/账套ID',
|
||||
field: 'agentId',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => ({
|
||||
placeholder: formModel?.thirdType === 'kingdee' ? '请输入账套ID(可选业务标识)' : '请输入AgentId',
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'AppKey',
|
||||
label: 'AppKey/AppId',
|
||||
field: 'clientId',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => ({
|
||||
placeholder: formModel?.thirdType === 'kingdee' ? '请输入金蝶AppId' : '请输入AppKey',
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'AppSecret',
|
||||
field: 'clientSecret',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => ({
|
||||
placeholder: formModel?.thirdType === 'kingdee' ? '请输入金蝶AppSecret' : '请输入AppSecret',
|
||||
}),
|
||||
},{
|
||||
label: '启用',
|
||||
field: 'status',
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<ul class="ding-menu-tab">
|
||||
<li :class="activeKey === 'ding' ? 'active' : ''" @click="dingLiClick('ding')"><a>钉钉集成</a></li>
|
||||
<li :class="activeKey === 'wechat' ? 'active' : ''" @click="dingLiClick('wechat')"><a>企业微信集成</a></li>
|
||||
<li :class="activeKey === 'kingdee' ? 'active' : ''" @click="dingLiClick('kingdee')"><a>金蝶集成</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-show="activeKey === 'ding'" class="base-collapse">
|
||||
@@ -12,6 +13,9 @@
|
||||
<div v-show="activeKey === 'wechat'" class="base-collapse">
|
||||
<ThirdAppWeEnterpriseConfigForm />
|
||||
</div>
|
||||
<div v-show="activeKey === 'kingdee'" class="base-collapse">
|
||||
<ThirdAppKingdeeConfigForm />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -19,6 +23,7 @@
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import ThirdAppDingTalkConfigForm from './ThirdAppDingTalkConfigForm.vue';
|
||||
import ThirdAppWeEnterpriseConfigForm from './ThirdAppWeEnterpriseConfigForm.vue';
|
||||
import ThirdAppKingdeeConfigForm from './ThirdAppKingdeeConfigForm.vue';
|
||||
import { useDesign } from '/@/hooks/web/useDesign';
|
||||
|
||||
export default defineComponent({
|
||||
@@ -26,6 +31,7 @@
|
||||
components: {
|
||||
ThirdAppDingTalkConfigForm,
|
||||
ThirdAppWeEnterpriseConfigForm,
|
||||
ThirdAppKingdeeConfigForm,
|
||||
},
|
||||
setup() {
|
||||
const { prefixCls } = useDesign('j-dd-container');
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
setModalProps({ confirmLoading: true });
|
||||
if (data.thirdType == 'dingtalk') {
|
||||
title.value = '钉钉配置';
|
||||
} else if (data.thirdType == 'kingdee') {
|
||||
title.value = '金蝶配置';
|
||||
} else {
|
||||
title.value = '企业微信配置';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<div class="base-collapse">
|
||||
<div class="header"> 金蝶集成 </div>
|
||||
<a-collapse expand-icon-position="right" :bordered="false">
|
||||
<a-collapse-panel key="1">
|
||||
<template #header>
|
||||
<div style="font-size: 16px"> 1.配置对接信息</div>
|
||||
</template>
|
||||
<div class="base-desc">先配置金蝶服务地址、AppId、AppSecret,保存后可进行连通性测试。</div>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
<div class="sync-padding">
|
||||
<a-collapse expand-icon-position="right" :bordered="false">
|
||||
<a-collapse-panel key="2">
|
||||
<template #header>
|
||||
<div style="width: 100%; justify-content: space-between; display: flex">
|
||||
<div style="font-size: 16px"> 2.配置录入及解绑</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="flex-flow">
|
||||
<div class="base-title">服务地址</div>
|
||||
<div class="base-message">
|
||||
<a-input-password v-model:value="appConfigData.corpId" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-flow">
|
||||
<div class="base-title">账套ID</div>
|
||||
<div class="base-message">
|
||||
<a-input-password v-model:value="appConfigData.agentId" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-flow">
|
||||
<div class="base-title">AppId</div>
|
||||
<div class="base-message">
|
||||
<a-input-password v-model:value="appConfigData.clientId" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-flow">
|
||||
<div class="base-title">AppSecret</div>
|
||||
<div class="base-message">
|
||||
<a-input-password v-model:value="appConfigData.clientSecret" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 20px; width: 100%; text-align: right">
|
||||
<a-button @click="kingdeeEditClick">编辑</a-button>
|
||||
<a-button @click="testConnectClick" style="margin-left: 10px">连接测试</a-button>
|
||||
<a-button v-if="appConfigData.id" @click="cancelBindClick" danger style="margin-left: 10px">取消绑定</a-button>
|
||||
</div>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ThirdAppConfigModal @register="registerAppConfigModal" @success="handleSuccess" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, ref } from 'vue';
|
||||
import { deleteThirdAppConfig, getThirdConfigByTenantId, testKingdeeConnect } from './ThirdApp.api';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import ThirdAppConfigModal from './ThirdAppConfigModal.vue';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { getTenantId } from '/@/utils/auth';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ThirdAppKingdeeConfigForm',
|
||||
components: { ThirdAppConfigModal },
|
||||
setup() {
|
||||
const { createMessage } = useMessage();
|
||||
const appConfigData = ref<any>({ corpId: '', agentId: '', clientId: '', clientSecret: '' });
|
||||
const [registerAppConfigModal, { openModal }] = useModal();
|
||||
|
||||
async function kingdeeEditClick() {
|
||||
const tenantId = getTenantId();
|
||||
openModal(true, { tenantId, thirdType: 'kingdee' });
|
||||
}
|
||||
|
||||
async function initThirdAppConfigData(params) {
|
||||
const values = await getThirdConfigByTenantId(params);
|
||||
appConfigData.value = values || '';
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
const tenantId = getTenantId();
|
||||
initThirdAppConfigData({ tenantId, thirdType: 'kingdee' });
|
||||
}
|
||||
|
||||
async function testConnectClick() {
|
||||
const tenantId = getTenantId();
|
||||
const res = await testKingdeeConnect({ tenantId });
|
||||
if (res.success) {
|
||||
createMessage.success(res.message || '连接成功');
|
||||
} else {
|
||||
createMessage.warning(res.message || '连接失败');
|
||||
}
|
||||
}
|
||||
|
||||
function cancelBindClick() {
|
||||
if (!appConfigData.value.id) {
|
||||
createMessage.warning('请先绑定金蝶应用!');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '取消绑定',
|
||||
content: '是否要解除当前组织的金蝶配置绑定?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => deleteThirdAppConfig({ id: appConfigData.value.id }, handleSuccess),
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const tenantId = getTenantId();
|
||||
initThirdAppConfigData({ tenantId, thirdType: 'kingdee' });
|
||||
});
|
||||
|
||||
return {
|
||||
appConfigData,
|
||||
registerAppConfigModal,
|
||||
kingdeeEditClick,
|
||||
testConnectClick,
|
||||
cancelBindClick,
|
||||
handleSuccess,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.header {
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
height: 50px;
|
||||
justify-content: space-between;
|
||||
font-weight: 700;
|
||||
font-size: 18px;
|
||||
color: @text-color;
|
||||
}
|
||||
|
||||
.flex-flow {
|
||||
display: flex;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.sync-padding {
|
||||
padding: 12px 0 16px;
|
||||
color: @text-color;
|
||||
}
|
||||
|
||||
.base-collapse {
|
||||
margin-top: 20px;
|
||||
padding: 0 24px;
|
||||
font-size: 20px;
|
||||
|
||||
.base-desc {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.base-title {
|
||||
width: 100px;
|
||||
text-align: left;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
.base-message {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
:deep(.ant-collapse-header) {
|
||||
padding: 12px 0 16px;
|
||||
}
|
||||
|
||||
:deep(.ant-collapse-content-box) {
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,33 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslMixerCondition/list',
|
||||
checkConditionName = '/xslmes/mesXslMixerCondition/checkConditionName',
|
||||
checkConditionCode = '/xslmes/mesXslMixerCondition/checkConditionCode',
|
||||
save = '/xslmes/mesXslMixerCondition/add',
|
||||
edit = '/xslmes/mesXslMixerCondition/edit',
|
||||
deleteOne = '/xslmes/mesXslMixerCondition/delete',
|
||||
deleteBatch = '/xslmes/mesXslMixerCondition/deleteBatch',
|
||||
queryById = '/xslmes/mesXslMixerCondition/queryById',
|
||||
exportXls = '/xslmes/mesXslMixerCondition/exportXls',
|
||||
}
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const checkConditionName = (params: { conditionName: string; dataId?: string }) =>
|
||||
defHttp.get({ url: Api.checkConditionName, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
|
||||
|
||||
export const checkConditionCode = (params: { conditionCode: string; dataId?: string }) =>
|
||||
defHttp.get({ url: Api.checkConditionCode, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const batchDelete = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
|
||||
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
@@ -0,0 +1,78 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { checkConditionCode, checkConditionName } from './MesXslMixerCondition.api';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '设备名称', align: 'center', dataIndex: 'equipmentId_dictText', width: 180 },
|
||||
{ title: '条件名称', align: 'center', dataIndex: 'conditionName', width: 180 },
|
||||
{ title: '条件代码', align: 'center', dataIndex: 'conditionCode', width: 160 },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 170 },
|
||||
{ title: '创建用户', align: 'center', dataIndex: 'createBy', width: 120 },
|
||||
{ title: '修改时间', align: 'center', dataIndex: 'updateTime', width: 170 },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'equipmentId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '条件名称', field: 'conditionName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '条件代码', field: 'conditionCode', component: 'Input', colProps: { span: 6 } },
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'equipmentId',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id', placeholder: '请选择设备名称' },
|
||||
},
|
||||
{
|
||||
label: '条件名称',
|
||||
field: 'conditionName',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
dynamicRules: ({ model }) => [
|
||||
{ required: true, message: '请输入条件名称' },
|
||||
{
|
||||
validator: async (_rule, value) => {
|
||||
const v = value == null ? '' : String(value).trim();
|
||||
if (!v) return Promise.resolve();
|
||||
try {
|
||||
await checkConditionName({ conditionName: v, dataId: model?.id });
|
||||
return Promise.resolve();
|
||||
} catch (e: any) {
|
||||
return Promise.reject(e?.response?.data?.message || e?.message || '条件名称不能重复');
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '条件代码',
|
||||
field: 'conditionCode',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
dynamicRules: ({ model }) => [
|
||||
{ required: true, message: '请输入条件代码' },
|
||||
{
|
||||
validator: async (_rule, value) => {
|
||||
const v = value == null ? '' : String(value).trim();
|
||||
if (!v) return Promise.resolve();
|
||||
try {
|
||||
await checkConditionCode({ conditionCode: v, dataId: model?.id });
|
||||
return Promise.resolve();
|
||||
} catch (e: any) {
|
||||
return Promise.reject(e?.response?.data?.message || e?.message || '条件代码不能重复');
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'xslmes:mes_xsl_mixer_condition:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_condition:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete"><Icon icon="ant-design:delete-outlined" />删除</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button>批量操作<Icon icon="mdi:chevron-down" /></a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslMixerConditionModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import MesXslMixerConditionModal from './modules/MesXslMixerConditionModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslMixerCondition.data';
|
||||
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslMixerCondition.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '密炼机条件维护',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true },
|
||||
actionColumn: { width: 120, fixed: 'right' },
|
||||
},
|
||||
exportConfig: { name: '密炼机条件维护', url: getExportUrl },
|
||||
});
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
}
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, reload);
|
||||
}
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
|
||||
}
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
function getTableAction(record) {
|
||||
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_mixer_condition:edit' }];
|
||||
}
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'xslmes:mes_xsl_mixer_condition:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="680px" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslMixerCondition.data';
|
||||
import { saveOrUpdate } from '../MesXslMixerCondition.api';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
|
||||
labelWidth: 110,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !data?.showFooter;
|
||||
if (unref(isUpdate)) {
|
||||
await setFieldsValue({ ...data.record });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增密炼机条件' : unref(isDetail) ? '密炼机条件详情' : '编辑密炼机条件',
|
||||
);
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslProductionOrder/list',
|
||||
save = '/xslmes/mesXslProductionOrder/add',
|
||||
edit = '/xslmes/mesXslProductionOrder/edit',
|
||||
deleteOne = '/xslmes/mesXslProductionOrder/delete',
|
||||
deleteBatch = '/xslmes/mesXslProductionOrder/deleteBatch',
|
||||
queryById = '/xslmes/mesXslProductionOrder/queryById',
|
||||
exportXls = '/xslmes/mesXslProductionOrder/exportXls',
|
||||
}
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const batchDelete = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
|
||||
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
@@ -0,0 +1,66 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
function splitStatusText(v: unknown) {
|
||||
if (v === 1) return '已拆分';
|
||||
if (v === 0) return '未拆分';
|
||||
return '-';
|
||||
}
|
||||
|
||||
const splitStatusOptions = [
|
||||
{ label: '未拆分', value: 0 },
|
||||
{ label: '已拆分', value: 1 },
|
||||
];
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '销售订单号', align: 'center', dataIndex: 'salesOrderNo', width: 150 },
|
||||
{ title: '生产订单号', align: 'center', dataIndex: 'productionOrderNo', width: 150 },
|
||||
{ title: '订单日期', align: 'center', dataIndex: 'orderDate', width: 130 },
|
||||
{ title: '生产车间', align: 'center', dataIndex: 'productionWorkshop', width: 130 },
|
||||
{ title: '加工段数', align: 'center', dataIndex: 'processSegmentCount', width: 100 },
|
||||
{ title: '物料编号', align: 'center', dataIndex: 'materialCode', width: 130 },
|
||||
{ title: 'MES胶料名称', align: 'center', dataIndex: 'mesMaterialName', width: 150 },
|
||||
{ title: '金蝶物料名称', align: 'center', dataIndex: 'kingdeeMaterialName', width: 150 },
|
||||
{ title: '金蝶物料规格', align: 'center', dataIndex: 'kingdeeMaterialSpec', width: 150 },
|
||||
{ title: '计划数量', align: 'center', dataIndex: 'planQty', width: 110 },
|
||||
{ title: '拆分状态', align: 'center', dataIndex: 'splitStatus', width: 100, customRender: ({ text }) => splitStatusText(text) },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '销售订单号', field: 'salesOrderNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '生产订单号', field: 'productionOrderNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '物料编号', field: 'materialCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: 'MES胶料名称', field: 'mesMaterialName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '拆分状态',
|
||||
field: 'splitStatus',
|
||||
component: 'Select',
|
||||
componentProps: { options: splitStatusOptions },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '销售订单号', field: 'salesOrderNo', component: 'Input' },
|
||||
{ label: '生产订单号', field: 'productionOrderNo', component: 'Input' },
|
||||
{
|
||||
label: '订单日期',
|
||||
field: 'orderDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
|
||||
},
|
||||
{ label: '生产车间', field: 'productionWorkshop', component: 'Input' },
|
||||
{ label: '加工段数', field: 'processSegmentCount', component: 'InputNumber', componentProps: { min: 0, precision: 0 } },
|
||||
{ label: '物料编号', field: 'materialCode', component: 'Input' },
|
||||
{ label: 'MES胶料名称', field: 'mesMaterialName', component: 'Input' },
|
||||
{ label: '金蝶物料名称', field: 'kingdeeMaterialName', component: 'Input' },
|
||||
{ label: '金蝶物料规格', field: 'kingdeeMaterialSpec', component: 'Input' },
|
||||
{ label: '计划数量', field: 'planQty', component: 'InputNumber', componentProps: { min: 0 } },
|
||||
{
|
||||
label: '拆分状态',
|
||||
field: 'splitStatus',
|
||||
component: 'Select',
|
||||
defaultValue: 0,
|
||||
componentProps: { options: splitStatusOptions },
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'xslmes:mes_xsl_production_order:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_production_order:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete"><Icon icon="ant-design:delete-outlined" />删除</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button>批量操作<Icon icon="mdi:chevron-down" /></a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslProductionOrderModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import MesXslProductionOrderModal from './modules/MesXslProductionOrderModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslProductionOrder.data';
|
||||
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslProductionOrder.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '生产订单',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true, showAdvancedButton: true },
|
||||
actionColumn: { width: 120, fixed: 'right' },
|
||||
},
|
||||
exportConfig: { name: '生产订单', url: getExportUrl },
|
||||
});
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
}
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, reload);
|
||||
}
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
|
||||
}
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
function getTableAction(record) {
|
||||
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_production_order:edit' }];
|
||||
}
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'xslmes:mes_xsl_production_order:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="860px" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslProductionOrder.data';
|
||||
import { saveOrUpdate } from '../MesXslProductionOrder.api';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
|
||||
labelWidth: 110,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 12 },
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !data?.showFooter;
|
||||
if (unref(isUpdate)) {
|
||||
await setFieldsValue({ ...data.record });
|
||||
} else {
|
||||
await setFieldsValue({ splitStatus: 0 });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增生产订单' : unref(isDetail) ? '生产订单详情' : '编辑生产订单',
|
||||
);
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user