Merge remote-tracking branch 'origin/main' into 20260519-3.9.2版本-葛昊天分支
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { useGlobSetting } from '/@/hooks/setting';
|
||||
const globSetting = useGlobSetting();
|
||||
const baseUploadUrl = globSetting.uploadUrl;
|
||||
import { resolveApiBaseUrl } from '/@/utils/env/apiBaseUrl';
|
||||
|
||||
enum Api {
|
||||
positionList = '/sys/position/list',
|
||||
userList = '/sys/user/list',
|
||||
@@ -25,9 +24,9 @@ enum Api {
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传父路径
|
||||
* 上传地址(须含 context-path;开发环境 domain 仅为 host 时需拼 apiUrl)
|
||||
*/
|
||||
export const uploadUrl = `${baseUploadUrl}/sys/common/upload`;
|
||||
export const uploadUrl = `${resolveApiBaseUrl()}/sys/common/upload`;
|
||||
|
||||
/**
|
||||
* 职务列表
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useGlobSetting } from '/@/hooks/setting';
|
||||
import { merge, random } from 'lodash-es';
|
||||
import { isArray } from '/@/utils/is';
|
||||
import { FormSchema } from '/@/components/Form';
|
||||
@@ -14,11 +13,10 @@ import { useI18n } from "@/hooks/web/useI18n";
|
||||
import {$electron} from "@/electron";
|
||||
import {router} from "@/router";
|
||||
import {encryptByBase64} from "@/utils/cipher";
|
||||
import { resolveApiBaseUrl } from '/@/utils/env/apiBaseUrl';
|
||||
//存放部门路径的数组
|
||||
const departNamePath = ref<Record<string, string>>({});
|
||||
|
||||
const globSetting = useGlobSetting();
|
||||
const baseApiUrl = globSetting.domainUrl;
|
||||
/**
|
||||
* 获取文件服务访问路径
|
||||
* @param fileUrl 文件路径
|
||||
@@ -31,10 +29,10 @@ export const getFileAccessHttpUrl = (fileUrl, prefix = 'http') => {
|
||||
//判断是否是数组格式
|
||||
let isArray = fileUrl.indexOf('[') != -1;
|
||||
if (!isArray) {
|
||||
let prefix = `${baseApiUrl}/sys/common/static/`;
|
||||
const staticPrefix = `${resolveApiBaseUrl()}/sys/common/static/`;
|
||||
// 判断是否已包含前缀
|
||||
if (!fileUrl.startsWith(prefix)) {
|
||||
result = `${prefix}${fileUrl}`;
|
||||
if (!fileUrl.startsWith(staticPrefix)) {
|
||||
result = `${staticPrefix}${fileUrl}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
jeecgboot-vue3/src/utils/env/apiBaseUrl.ts
vendored
Normal file
18
jeecgboot-vue3/src/utils/env/apiBaseUrl.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useGlobSetting } from '/@/hooks/setting';
|
||||
|
||||
/**
|
||||
* 后端 API 根地址(含 servlet.context-path,如 /jeecg-boot)
|
||||
* 开发环境 VITE_GLOB_DOMAIN_URL 常为 http://host:port,需与 VITE_GLOB_API_URL 拼接
|
||||
*/
|
||||
export function resolveApiBaseUrl(): string {
|
||||
const { domainUrl, apiUrl } = useGlobSetting();
|
||||
const domain = (domainUrl || '').replace(/\/$/, '');
|
||||
const api = apiUrl || '';
|
||||
if (!domain) {
|
||||
return api;
|
||||
}
|
||||
if (!api || domain.endsWith(api) || domain.includes(`${api}/`)) {
|
||||
return domain;
|
||||
}
|
||||
return `${domain}${api}`;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<MesXslDayTankMaterialMapList />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MesXslDayTankMaterialMapList from '../../xslmes/mesXslDayTankMaterialMap/MesXslDayTankMaterialMapList.vue';
|
||||
</script>
|
||||
7
jeecgboot-vue3/src/views/mes/mixeractioninfo/index.vue
Normal file
7
jeecgboot-vue3/src/views/mes/mixeractioninfo/index.vue
Normal file
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<MesXslMixerActionList />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MesXslMixerActionList from '../../xslmes/mesXslMixerAction/MesXslMixerActionList.vue';
|
||||
</script>
|
||||
@@ -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,28 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslDayTankMaterialMap/list',
|
||||
save = '/xslmes/mesXslDayTankMaterialMap/add',
|
||||
edit = '/xslmes/mesXslDayTankMaterialMap/edit',
|
||||
deleteOne = '/xslmes/mesXslDayTankMaterialMap/delete',
|
||||
deleteBatch = '/xslmes/mesXslDayTankMaterialMap/deleteBatch',
|
||||
queryById = '/xslmes/mesXslDayTankMaterialMap/queryById',
|
||||
exportXls = '/xslmes/mesXslDayTankMaterialMap/exportXls',
|
||||
equipmentQueryById = '/xslmes/mesXslEquipmentLedger/queryById',
|
||||
}
|
||||
|
||||
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 queryEquipmentById = (params: { id: string }) => defHttp.get({ url: Api.equipmentQueryById, params });
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
@@ -0,0 +1,154 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { loadTreeData } from '/@/api/common/api';
|
||||
import { queryEquipmentById } from './MesXslDayTankMaterialMap.api';
|
||||
|
||||
function useStatusText(v: unknown) {
|
||||
if (v === 1) return '使用中';
|
||||
if (v === 0) return '停用';
|
||||
return '-';
|
||||
}
|
||||
|
||||
function allowSyncText(v: unknown) {
|
||||
if (v === 1) return '允许';
|
||||
if (v === 0) return '不允许';
|
||||
return '-';
|
||||
}
|
||||
|
||||
const useStatusOptions = [
|
||||
{ label: '使用中', value: 1 },
|
||||
{ label: '停用', value: 0 },
|
||||
];
|
||||
|
||||
const allowSyncOptions = [
|
||||
{ label: '允许', value: 1 },
|
||||
{ label: '不允许', value: 0 },
|
||||
];
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '机台代码', align: 'center', dataIndex: 'machineCode', width: 140 },
|
||||
{ title: '机台名称', align: 'center', dataIndex: 'equipmentId_dictText', width: 160 },
|
||||
{ title: '料仓分类', align: 'center', dataIndex: 'siloCategoryId_dictText', width: 140 },
|
||||
{ title: '工位', align: 'center', dataIndex: 'station', width: 120 },
|
||||
{ title: '料仓号', align: 'center', dataIndex: 'siloNo', width: 120 },
|
||||
{ title: '物料名称', align: 'center', dataIndex: 'materialId_dictText', width: 160 },
|
||||
{
|
||||
title: '使用状态',
|
||||
align: 'center',
|
||||
dataIndex: 'useStatus',
|
||||
width: 120,
|
||||
customRender: ({ text }) => useStatusText(text),
|
||||
},
|
||||
{
|
||||
title: '是否允许同步',
|
||||
align: 'center',
|
||||
dataIndex: 'allowSync',
|
||||
width: 120,
|
||||
customRender: ({ text }) => allowSyncText(text),
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '机台名称',
|
||||
field: 'equipmentId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '物料名称',
|
||||
field: 'materialId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'mes_material,material_name,id' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '料仓分类',
|
||||
field: 'siloCategoryId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: loadTreeData,
|
||||
params: { pcode: 'XSLMES_LCTYPE' },
|
||||
resultField: '',
|
||||
labelField: 'title',
|
||||
valueField: 'key',
|
||||
placeholder: '请选择料仓分类',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '使用状态',
|
||||
field: 'useStatus',
|
||||
component: 'Select',
|
||||
componentProps: { options: useStatusOptions },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '机台名称',
|
||||
field: 'equipmentId',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => ({
|
||||
dictCode: 'mes_xsl_equipment_ledger,equipment_name,id',
|
||||
placeholder: '请选择设备台账中的机台名称',
|
||||
onChange: async (value: string) => {
|
||||
if (!value) {
|
||||
formModel.machineCode = '';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const equipment = await queryEquipmentById({ id: value });
|
||||
formModel.machineCode = equipment?.equipmentCode || '';
|
||||
} catch {
|
||||
formModel.machineCode = '';
|
||||
}
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: '机台代码',
|
||||
field: 'machineCode',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '选择机台名称后自动带出设备编号' },
|
||||
},
|
||||
{
|
||||
label: '料仓分类',
|
||||
field: 'siloCategoryId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: loadTreeData,
|
||||
params: { pcode: 'XSLMES_LCTYPE' },
|
||||
resultField: '',
|
||||
labelField: 'title',
|
||||
valueField: 'key',
|
||||
placeholder: '请选择料仓分类',
|
||||
},
|
||||
},
|
||||
{ label: '工位', field: 'station', component: 'Input' },
|
||||
{ label: '料仓号', field: 'siloNo', component: 'Input' },
|
||||
{
|
||||
label: '物料名称',
|
||||
field: 'materialId',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: { dictCode: 'mes_material,material_name,id', placeholder: '请选择胶料信息中的物料名称' },
|
||||
},
|
||||
{
|
||||
label: '使用状态',
|
||||
field: 'useStatus',
|
||||
component: 'Select',
|
||||
defaultValue: 1,
|
||||
componentProps: { options: useStatusOptions },
|
||||
},
|
||||
{
|
||||
label: '是否允许同步',
|
||||
field: 'allowSync',
|
||||
component: 'Select',
|
||||
defaultValue: 1,
|
||||
componentProps: { options: allowSyncOptions },
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'xslmes:mes_xsl_day_tank_material_map:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_day_tank_material_map: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>
|
||||
<MesXslDayTankMaterialMapModal @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 MesXslDayTankMaterialMapModal from './modules/MesXslDayTankMaterialMapModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslDayTankMaterialMap.data';
|
||||
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslDayTankMaterialMap.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_day_tank_material_map:edit' }];
|
||||
}
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'xslmes:mes_xsl_day_tank_material_map:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="760px" @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 '../MesXslDayTankMaterialMap.data';
|
||||
import { queryEquipmentById, saveOrUpdate } from '../MesXslDayTankMaterialMap.api';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = 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 });
|
||||
} else {
|
||||
await setFieldsValue({ useStatus: 1, allowSync: 1 });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增日罐物料对应信息' : unref(isDetail) ? '日罐物料对应信息详情' : '编辑日罐物料对应信息',
|
||||
);
|
||||
|
||||
async function fillMachineCodeByEquipment() {
|
||||
const values = getFieldsValue();
|
||||
if (!values?.equipmentId) {
|
||||
await setFieldsValue({ machineCode: '' });
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const equipment = await queryEquipmentById({ id: values.equipmentId });
|
||||
await setFieldsValue({ machineCode: equipment?.equipmentCode || '' });
|
||||
} catch {
|
||||
await setFieldsValue({ machineCode: '' });
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
await fillMachineCodeByEquipment();
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,51 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslEquipInspectConfig/list',
|
||||
save = '/xslmes/mesXslEquipInspectConfig/add',
|
||||
edit = '/xslmes/mesXslEquipInspectConfig/edit',
|
||||
deleteOne = '/xslmes/mesXslEquipInspectConfig/delete',
|
||||
deleteBatch = '/xslmes/mesXslEquipInspectConfig/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslEquipInspectConfig/importExcel',
|
||||
exportXls = '/xslmes/mesXslEquipInspectConfig/exportXls',
|
||||
queryById = '/xslmes/mesXslEquipInspectConfig/queryById',
|
||||
queryLineList = '/xslmes/mesXslEquipInspectConfig/queryLineListByConfigId',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const queryLineListByConfigId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) => {
|
||||
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url, params });
|
||||
};
|
||||
@@ -0,0 +1,86 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 160 },
|
||||
{ title: '设备编号', align: 'center', dataIndex: 'equipmentCode', width: 140 },
|
||||
{ title: '类型', align: 'center', dataIndex: 'configType_dictText', width: 90 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||
{
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '类型',
|
||||
field: 'configType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_im_item_category' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '', field: 'equipmentLedgerId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'equipmentName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentLedgerPicker',
|
||||
dynamicRules: () => [{ required: true, message: '请选择设备台账' }],
|
||||
},
|
||||
{
|
||||
label: '设备编号',
|
||||
field: 'equipmentCode',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true, placeholder: '选择设备后自动带出' },
|
||||
},
|
||||
{
|
||||
label: '类型',
|
||||
field: 'configType',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: { dictCode: 'xslmes_im_item_category', placeholder: '点检/保养' },
|
||||
},
|
||||
];
|
||||
|
||||
export const lineJVxeColumns: JVxeColumn[] = [
|
||||
{ title: '', key: 'inspectMaintainItemId', type: JVxeTypes.hidden },
|
||||
{ title: '点检项目编号', key: 'itemCode', type: JVxeTypes.normal, width: 130, disabled: true },
|
||||
{ title: '项目名称', key: 'itemName', type: JVxeTypes.normal, width: 140, disabled: true },
|
||||
{
|
||||
title: '项目类别',
|
||||
key: 'itemCategory',
|
||||
type: JVxeTypes.select,
|
||||
width: 100,
|
||||
disabled: true,
|
||||
dictCode: 'xslmes_im_item_category',
|
||||
},
|
||||
{
|
||||
title: '项目类型',
|
||||
key: 'itemType',
|
||||
type: JVxeTypes.select,
|
||||
width: 100,
|
||||
disabled: true,
|
||||
dictCode: 'xslmes_im_item_type',
|
||||
},
|
||||
{ title: '设备部位', key: 'equipmentPartName', type: JVxeTypes.normal, width: 120, disabled: true },
|
||||
{ title: '设备小部位', key: 'equipmentSubPartName', type: JVxeTypes.normal, width: 120, disabled: true },
|
||||
{
|
||||
title: '点检方式',
|
||||
key: 'inspectMethod',
|
||||
type: JVxeTypes.select,
|
||||
width: 100,
|
||||
disabled: true,
|
||||
dictCode: 'xslmes_im_inspect_method',
|
||||
},
|
||||
{ title: '判断基准', key: 'judgmentCriteria', type: JVxeTypes.normal, width: 180, disabled: true },
|
||||
];
|
||||
@@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equip_inspect_config:add'"
|
||||
@click="handleAdd"
|
||||
preIcon="ant-design:plus-outlined"
|
||||
>
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equip_inspect_config:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equip_inspect_config:importExcel'"
|
||||
preIcon="ant-design:import-outlined"
|
||||
@click="onImportXls"
|
||||
>
|
||||
导入
|
||||
</j-upload-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 v-auth="'mes:mes_xsl_equip_inspect_config:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_equip_inspect_config:edit' },
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipInspectConfigModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslEquipInspectConfig" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslEquipInspectConfigModal from './components/MesXslEquipInspectConfigModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslEquipInspectConfig.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipInspectConfig.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '设备点检配置',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '设备点检配置',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
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 }, handleSuccess);
|
||||
}
|
||||
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
selectedRowKeys.value = [];
|
||||
reload();
|
||||
}
|
||||
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'mes:mes_xsl_equip_inspect_config:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,239 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
destroyOnClose
|
||||
:title="title"
|
||||
width="1100px"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
>
|
||||
<BasicForm @register="registerForm">
|
||||
<template #equipmentLedgerPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择设备台账" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="isDetail" @click="openLedgerSelect">选择</a-button>
|
||||
<a-button v-if="model.equipmentLedgerId && !isDetail" @click="clearLedger">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<a-divider orientation="left">点检项目明细</a-divider>
|
||||
<JVxeTable
|
||||
v-if="tableReady"
|
||||
ref="lineTableRef"
|
||||
toolbar
|
||||
row-number
|
||||
rowSelection
|
||||
keep-source
|
||||
:insert-row="false"
|
||||
:max-height="380"
|
||||
:loading="lineLoading"
|
||||
:columns="lineJVxeColumns"
|
||||
:dataSource="lineDataSource"
|
||||
:disabled="!showFooterFlag"
|
||||
:toolbar-config="{ btn: ['remove'], slots: ['suffix'] }"
|
||||
:add-btn-cfg="{ enabled: false }"
|
||||
>
|
||||
<template #toolbarSuffix>
|
||||
<a-button
|
||||
v-if="showFooterFlag"
|
||||
type="primary"
|
||||
preIcon="ant-design:plus-outlined"
|
||||
@click="openBatchItemSelect"
|
||||
>
|
||||
选择点检及保养项目
|
||||
</a-button>
|
||||
</template>
|
||||
</JVxeTable>
|
||||
<MesXslEquipmentLedgerSelectModal @register="registerLedgerModal" @select="onLedgerSelect" />
|
||||
<MesXslInspectMaintainItemSelectModal @register="registerItemModal" @select="onItemsSelect" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import type { JVxeTableInstance } from '/@/components/jeecg/JVxeTable/types';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { formSchema, lineJVxeColumns } from '../MesXslEquipInspectConfig.data';
|
||||
import { saveOrUpdate, queryById, queryLineListByConfigId } from '../MesXslEquipInspectConfig.api';
|
||||
import MesXslEquipmentLedgerSelectModal from './MesXslEquipmentLedgerSelectModal.vue';
|
||||
import MesXslInspectMaintainItemSelectModal from './MesXslInspectMaintainItemSelectModal.vue';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const { createMessage } = useMessage();
|
||||
const isUpdate = ref(false);
|
||||
const isDetail = ref(false);
|
||||
const showFooterFlag = ref(true);
|
||||
const tableReady = ref(false);
|
||||
const lineLoading = ref(false);
|
||||
const lineDataSource = ref<Recordable[]>([]);
|
||||
const lineTableRef = ref<JVxeTableInstance>();
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
|
||||
labelWidth: 110,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 12 },
|
||||
});
|
||||
|
||||
const [registerLedgerModal, { openModal: openLedgerModal }] = useModal();
|
||||
const [registerItemModal, { openModal: openItemModal }] = useModal();
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
tableReady.value = false;
|
||||
lineDataSource.value = [];
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !data?.showFooter;
|
||||
showFooterFlag.value = !!data?.showFooter;
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
if (unref(isUpdate) && data?.record?.id) {
|
||||
lineLoading.value = true;
|
||||
try {
|
||||
const mainRaw = await queryById({ id: data.record.id });
|
||||
const m = (mainRaw as any)?.id != null ? mainRaw : (mainRaw as any)?.result ?? mainRaw;
|
||||
const linesRaw = await queryLineListByConfigId({ id: data.record.id });
|
||||
const list = Array.isArray(linesRaw) ? linesRaw : (linesRaw as any)?.result ?? [];
|
||||
await setFieldsValue({ ...m });
|
||||
lineDataSource.value = [...(list || [])];
|
||||
} finally {
|
||||
lineLoading.value = false;
|
||||
}
|
||||
}
|
||||
tableReady.value = true;
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增设备点检配置' : unref(isDetail) ? '设备点检配置详情' : '编辑设备点检配置',
|
||||
);
|
||||
|
||||
function itemToLineRow(item: Recordable) {
|
||||
return {
|
||||
inspectMaintainItemId: item.id,
|
||||
itemCode: item.itemCode,
|
||||
itemName: item.itemName,
|
||||
itemCategory: item.itemCategory,
|
||||
itemType: item.itemType,
|
||||
equipmentPartName: item.equipmentPartName,
|
||||
equipmentSubPartName: item.equipmentSubPartName,
|
||||
inspectMethod: item.inspectMethod,
|
||||
judgmentCriteria: item.judgmentCriteria,
|
||||
};
|
||||
}
|
||||
|
||||
function getExistingItemIds(): Set<string> {
|
||||
const lineRef = lineTableRef.value as any;
|
||||
const tableData = (lineRef?.getTableData?.() || lineDataSource.value || []) as Recordable[];
|
||||
const ids = new Set<string>();
|
||||
for (const r of tableData) {
|
||||
if (r?.inspectMaintainItemId) {
|
||||
ids.add(String(r.inspectMaintainItemId));
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
function openLedgerSelect() {
|
||||
const vals = getFieldsValue();
|
||||
openLedgerModal(true, { equipmentLedgerId: vals.equipmentLedgerId });
|
||||
}
|
||||
|
||||
function clearLedger() {
|
||||
setFieldsValue({ equipmentLedgerId: '', equipmentName: '', equipmentCode: '' });
|
||||
}
|
||||
|
||||
function onLedgerSelect(payload: { equipmentLedgerId?: string; equipmentName?: string; equipmentCode?: string }) {
|
||||
setFieldsValue({
|
||||
equipmentLedgerId: payload.equipmentLedgerId || '',
|
||||
equipmentName: payload.equipmentName || '',
|
||||
equipmentCode: payload.equipmentCode || '',
|
||||
});
|
||||
}
|
||||
|
||||
function openBatchItemSelect() {
|
||||
const configType = getFieldsValue()?.configType;
|
||||
if (!configType) {
|
||||
createMessage.warning('请先选择类型(点检/保养)');
|
||||
return;
|
||||
}
|
||||
openItemModal(true, { itemCategory: configType, multiple: true });
|
||||
}
|
||||
|
||||
function onItemsSelect(payload: Recordable | Recordable[]) {
|
||||
const items = Array.isArray(payload) ? payload : payload ? [payload] : [];
|
||||
if (!items.length) {
|
||||
return;
|
||||
}
|
||||
const existing = getExistingItemIds();
|
||||
const toAdd: Recordable[] = [];
|
||||
const skipped: string[] = [];
|
||||
for (const item of items) {
|
||||
if (!item?.id) {
|
||||
continue;
|
||||
}
|
||||
const id = String(item.id);
|
||||
if (existing.has(id)) {
|
||||
skipped.push(item.itemName || item.itemCode || id);
|
||||
continue;
|
||||
}
|
||||
existing.add(id);
|
||||
toAdd.push(itemToLineRow(item));
|
||||
}
|
||||
if (!toAdd.length) {
|
||||
if (skipped.length) {
|
||||
createMessage.warning('所选项目均已在明细中,未添加新行');
|
||||
}
|
||||
return;
|
||||
}
|
||||
const lineRef = lineTableRef.value as any;
|
||||
if (lineRef?.pushRows) {
|
||||
lineRef.pushRows(toAdd);
|
||||
} else {
|
||||
lineDataSource.value = [...lineDataSource.value, ...toAdd];
|
||||
}
|
||||
if (skipped.length) {
|
||||
createMessage.warning(`已添加 ${toAdd.length} 项,跳过 ${skipped.length} 项重复项目`);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
const lineRef = lineTableRef.value as any;
|
||||
const tableData = (lineRef?.getTableData?.() || []) as Recordable[];
|
||||
const lineList = tableData
|
||||
.filter((r) => r && r.inspectMaintainItemId)
|
||||
.map((r) => ({
|
||||
inspectMaintainItemId: r.inspectMaintainItemId,
|
||||
itemCode: r.itemCode,
|
||||
itemName: r.itemName,
|
||||
itemCategory: r.itemCategory,
|
||||
itemType: r.itemType,
|
||||
equipmentPartName: r.equipmentPartName,
|
||||
equipmentSubPartName: r.equipmentSubPartName,
|
||||
inspectMethod: r.inspectMethod,
|
||||
judgmentCriteria: r.judgmentCriteria,
|
||||
}));
|
||||
if (!lineList.length) {
|
||||
createMessage.warning('请通过「选择点检及保养项目」至少添加一条明细');
|
||||
return;
|
||||
}
|
||||
const ids = new Set<string>();
|
||||
for (const line of lineList) {
|
||||
if (ids.has(line.inspectMaintainItemId)) {
|
||||
createMessage.warning('明细中点检项目不能重复');
|
||||
return;
|
||||
}
|
||||
ids.add(line.inspectMaintainItemId);
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate({ ...values, lineList }, unref(isUpdate));
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" title="选择设备台账" :width="1000" @register="registerModal" @ok="handleOk">
|
||||
<BasicTable @register="registerTable" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicTable, useTable } from '/@/components/Table';
|
||||
import { list, queryById } from '/@/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.api';
|
||||
|
||||
const emit = defineEmits(['register', 'select']);
|
||||
|
||||
const selectedRow = ref<Recordable | null>(null);
|
||||
|
||||
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
|
||||
selectedRow.value = rows?.[0] ?? null;
|
||||
}
|
||||
|
||||
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
|
||||
api: list,
|
||||
columns: [
|
||||
{ title: '设备名称', dataIndex: 'equipmentName', width: 160 },
|
||||
{ title: '设备编号', dataIndex: 'equipmentCode', width: 140 },
|
||||
{ title: '设备类别', dataIndex: 'equipmentCategoryName', width: 120 },
|
||||
{ title: '设备类型', dataIndex: 'equipmentTypeName', width: 120 },
|
||||
],
|
||||
rowKey: 'id',
|
||||
useSearchForm: true,
|
||||
formConfig: {
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 8 } },
|
||||
],
|
||||
},
|
||||
pagination: { pageSize: 10 },
|
||||
canResize: false,
|
||||
showIndexColumn: false,
|
||||
immediate: true,
|
||||
rowSelection: {
|
||||
type: 'radio',
|
||||
columnWidth: 48,
|
||||
onChange: handleSelectionChange,
|
||||
},
|
||||
clickToRowSelect: true,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
selectedRow.value = null;
|
||||
clearSelectedRowKeys?.();
|
||||
setModalProps({ confirmLoading: false });
|
||||
const lid = data?.equipmentLedgerId as string | undefined;
|
||||
if (lid) {
|
||||
setSelectedRowKeys?.([lid]);
|
||||
try {
|
||||
const raw = await queryById({ id: lid });
|
||||
const row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
if (row) {
|
||||
selectedRow.value = row;
|
||||
}
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
reload();
|
||||
});
|
||||
|
||||
async function handleOk() {
|
||||
const keys = (getSelectRowKeys?.() || []) as string[];
|
||||
let row = selectedRow.value || ((getSelectRows?.() || []) as Recordable[])[0];
|
||||
if (!row && keys.length) {
|
||||
try {
|
||||
const raw = await queryById({ id: keys[0] });
|
||||
row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
if (!row?.id) {
|
||||
emit('select', { equipmentLedgerId: '', equipmentName: '', equipmentCode: '' });
|
||||
closeModal();
|
||||
return;
|
||||
}
|
||||
emit('select', {
|
||||
equipmentLedgerId: row.id,
|
||||
equipmentName: row.equipmentName || '',
|
||||
equipmentCode: row.equipmentCode || '',
|
||||
});
|
||||
closeModal();
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" :title="modalTitle" :width="1100" @register="registerModal" @ok="handleOk">
|
||||
<BasicTable @register="registerTable" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicTable, useTable } from '/@/components/Table';
|
||||
import { list } from '/@/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainItem.api';
|
||||
|
||||
const emit = defineEmits(['register', 'select']);
|
||||
|
||||
const multipleMode = ref(true);
|
||||
const filterItemCategory = ref('');
|
||||
const selectedRows = ref<Recordable[]>([]);
|
||||
|
||||
const modalTitle = computed(() => (multipleMode.value ? '选择点检及保养项目(可多选)' : '选择点检及保养项目'));
|
||||
|
||||
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
|
||||
selectedRows.value = rows || [];
|
||||
}
|
||||
|
||||
function fetchItemPage(params: Recordable) {
|
||||
const p = { ...params };
|
||||
if (filterItemCategory.value) {
|
||||
p.itemCategory = filterItemCategory.value;
|
||||
}
|
||||
return list(p);
|
||||
}
|
||||
|
||||
const [registerTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({
|
||||
api: fetchItemPage,
|
||||
columns: [
|
||||
{ title: '项目编号', dataIndex: 'itemCode', width: 120 },
|
||||
{ title: '项目名称', dataIndex: 'itemName', width: 140 },
|
||||
{ title: '项目类别', dataIndex: 'itemCategory_dictText', width: 90 },
|
||||
{ title: '项目类型', dataIndex: 'itemType_dictText', width: 90 },
|
||||
{ title: '设备部位', dataIndex: 'equipmentPartName', width: 110 },
|
||||
{ title: '设备小部位', dataIndex: 'equipmentSubPartName', width: 110 },
|
||||
{ title: '点检方式', dataIndex: 'inspectMethod_dictText', width: 90 },
|
||||
{ title: '判断基准', dataIndex: 'judgmentCriteria', width: 160, ellipsis: true },
|
||||
],
|
||||
rowKey: 'id',
|
||||
useSearchForm: true,
|
||||
formConfig: {
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{ label: '项目编号', field: 'itemCode', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '项目名称', field: 'itemName', component: 'Input', colProps: { span: 8 } },
|
||||
],
|
||||
},
|
||||
pagination: { pageSize: 10 },
|
||||
canResize: false,
|
||||
showIndexColumn: false,
|
||||
immediate: true,
|
||||
rowSelection: {
|
||||
type: 'checkbox',
|
||||
columnWidth: 48,
|
||||
onChange: handleSelectionChange,
|
||||
},
|
||||
clickToRowSelect: true,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
multipleMode.value = data?.multiple !== false;
|
||||
filterItemCategory.value = data?.itemCategory ? String(data.itemCategory) : '';
|
||||
selectedRows.value = [];
|
||||
clearSelectedRowKeys?.();
|
||||
setModalProps({ confirmLoading: false });
|
||||
reload();
|
||||
});
|
||||
|
||||
async function handleOk() {
|
||||
let rows = selectedRows.value?.length ? [...selectedRows.value] : ((getSelectRows?.() || []) as Recordable[]);
|
||||
const valid = rows.filter((r) => r?.id && (r.itemCode != null || r.itemName != null));
|
||||
if (!valid.length) {
|
||||
closeModal();
|
||||
return;
|
||||
}
|
||||
if (multipleMode.value) {
|
||||
emit('select', valid);
|
||||
} else {
|
||||
emit('select', valid[0]);
|
||||
}
|
||||
closeModal();
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,65 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslEquipInspectRecord/list',
|
||||
save = '/xslmes/mesXslEquipInspectRecord/add',
|
||||
edit = '/xslmes/mesXslEquipInspectRecord/edit',
|
||||
deleteOne = '/xslmes/mesXslEquipInspectRecord/delete',
|
||||
deleteBatch = '/xslmes/mesXslEquipInspectRecord/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslEquipInspectRecord/importExcel',
|
||||
exportXls = '/xslmes/mesXslEquipInspectRecord/exportXls',
|
||||
queryById = '/xslmes/mesXslEquipInspectRecord/queryById',
|
||||
queryLineList = '/xslmes/mesXslEquipInspectRecord/queryLineListByRecordId',
|
||||
generateRecordNo = '/xslmes/mesXslEquipInspectRecord/generateRecordNo',
|
||||
loadLinesByEquipment = '/xslmes/mesXslEquipInspectRecord/loadLinesByEquipment',
|
||||
batchCreateFromEquipment = '/xslmes/mesXslEquipInspectRecord/batchCreateFromEquipment',
|
||||
handleFail = '/xslmes/mesXslEquipInspectRecord/handleFail',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const queryLineListByRecordId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
|
||||
|
||||
export const generateRecordNo = () => defHttp.get({ url: Api.generateRecordNo });
|
||||
|
||||
export const loadLinesByEquipment = (params: { equipmentLedgerId: string; recordType: string }) =>
|
||||
defHttp.get({ url: Api.loadLinesByEquipment, params });
|
||||
|
||||
export const batchCreateFromEquipment = (params: { equipmentLedgerIds: string[]; recordType: string }) =>
|
||||
defHttp.post({ url: Api.batchCreateFromEquipment, params });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) => {
|
||||
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url, params });
|
||||
};
|
||||
|
||||
export const handleFailRecord = (params: Recordable) => defHttp.post({ url: Api.handleFail, params });
|
||||
@@ -0,0 +1,222 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
|
||||
import { uploadUrl } from '/@/api/common/api';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '记录编号', align: 'center', dataIndex: 'recordNo', width: 150 },
|
||||
{ title: '计划单号', align: 'center', dataIndex: 'planNo', width: 130 },
|
||||
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 150 },
|
||||
{ title: '设备编码', align: 'center', dataIndex: 'equipmentCode', width: 130 },
|
||||
{ title: '类型', align: 'center', dataIndex: 'recordType_dictText', width: 80 },
|
||||
{ title: '点检日期', align: 'center', dataIndex: 'inspectDate', width: 110 },
|
||||
{ title: '点检人', align: 'center', dataIndex: 'inspectorRealname', width: 100 },
|
||||
{ title: '点检结果', align: 'center', dataIndex: 'inspectResult_dictText', width: 90 },
|
||||
{ title: '是否已处理', align: 'center', dataIndex: 'handledFlag_dictText', width: 90 },
|
||||
{ title: '状态', align: 'center', dataIndex: 'recordStatus_dictText', width: 90 },
|
||||
{
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '记录编号', field: 'recordNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '计划单号', field: 'planNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '类型',
|
||||
field: 'recordType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_im_item_category' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
field: 'recordStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_im_record_status' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '', field: 'equipmentLedgerId', component: 'Input', show: false },
|
||||
{ label: '', field: 'planId', component: 'Input', show: false },
|
||||
{ label: '', field: 'equipInspectConfigId', component: 'Input', show: false },
|
||||
{ label: '', field: 'inspectorUserId', component: 'Input', show: false },
|
||||
{ label: '', field: 'inspectorUsername', component: 'Input', show: false },
|
||||
{
|
||||
label: '记录编号',
|
||||
field: 'recordNo',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true, placeholder: '保存时自动生成' },
|
||||
dynamicRules: () => [{ required: true, message: '记录编号不能为空' }],
|
||||
},
|
||||
{ label: '计划单号', field: 'planNo', component: 'Input' },
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'equipmentName',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
},
|
||||
{
|
||||
label: '设备编码',
|
||||
field: 'equipmentCode',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
},
|
||||
{
|
||||
label: '类型',
|
||||
field: 'recordType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_im_item_category', disabled: true },
|
||||
},
|
||||
{
|
||||
label: '点检日期',
|
||||
field: 'inspectDate',
|
||||
component: 'DatePicker',
|
||||
required: true,
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: '点检人',
|
||||
field: 'inspectorRealname',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true, placeholder: '当前登录用户' },
|
||||
dynamicRules: () => [{ required: true, message: '点检人不能为空' }],
|
||||
},
|
||||
{
|
||||
label: '点检结果',
|
||||
field: 'inspectResult',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: { dictCode: 'xslmes_im_inspect_result', placeholder: '合格/不合格' },
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
field: 'recordStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_im_record_status', disabled: true },
|
||||
},
|
||||
];
|
||||
|
||||
/** 详情页:仅不合格记录展示的处理信息(只读) */
|
||||
export const processDisplayFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '是否已处理',
|
||||
field: 'handledFlag',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'yn', disabled: true },
|
||||
},
|
||||
{
|
||||
label: '处理人',
|
||||
field: 'handlerRealname',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
},
|
||||
{
|
||||
label: '处理时间',
|
||||
field: 'handleTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
style: { width: '100%' },
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/** 不合格记录处理弹窗 */
|
||||
export const handleFormSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '', field: 'handlerUsername', component: 'Input', show: false },
|
||||
{ label: '', field: 'handlerRealname', component: 'Input', show: false },
|
||||
{
|
||||
label: '处理人',
|
||||
field: 'handlerUserId',
|
||||
component: 'JSelectUser',
|
||||
required: true,
|
||||
componentProps: ({ formActionType }) => ({
|
||||
rowKey: 'id',
|
||||
labelKey: 'realname',
|
||||
isRadioSelection: true,
|
||||
maxSelectCount: 1,
|
||||
onOptionsChange: (options) => {
|
||||
const row = options?.[0];
|
||||
if (row && formActionType) {
|
||||
formActionType.setFieldsValue({
|
||||
handlerUsername: row.username,
|
||||
handlerRealname: row.realname,
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: '处理时间',
|
||||
field: 'handleTime',
|
||||
component: 'DatePicker',
|
||||
required: true,
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const lineJVxeColumns: JVxeColumn[] = [
|
||||
{ title: '', key: 'equipInspectConfigLineId', type: JVxeTypes.hidden },
|
||||
{ title: '', key: 'inspectMaintainItemId', type: JVxeTypes.hidden },
|
||||
{ title: '点检项目编号', key: 'itemCode', type: JVxeTypes.normal, width: 120, disabled: true },
|
||||
{ title: '点检项目', key: 'itemName', type: JVxeTypes.normal, width: 130, disabled: true },
|
||||
{
|
||||
title: '项目类别',
|
||||
key: 'itemCategory',
|
||||
type: JVxeTypes.select,
|
||||
width: 90,
|
||||
disabled: true,
|
||||
dictCode: 'xslmes_im_item_category',
|
||||
filters: false,
|
||||
sortable: false,
|
||||
},
|
||||
{
|
||||
title: '项目类型',
|
||||
key: 'itemType',
|
||||
type: JVxeTypes.select,
|
||||
width: 90,
|
||||
disabled: true,
|
||||
dictCode: 'xslmes_im_item_type',
|
||||
filters: false,
|
||||
sortable: false,
|
||||
},
|
||||
{ title: '设备部位', key: 'equipmentPartName', type: JVxeTypes.normal, width: 100, disabled: true },
|
||||
{ title: '设备小部位', key: 'equipmentSubPartName', type: JVxeTypes.normal, width: 100, disabled: true },
|
||||
{
|
||||
title: '点检方式',
|
||||
key: 'inspectMethod',
|
||||
type: JVxeTypes.select,
|
||||
width: 90,
|
||||
disabled: true,
|
||||
dictCode: 'xslmes_im_inspect_method',
|
||||
filters: false,
|
||||
sortable: false,
|
||||
},
|
||||
{ title: '判断基准', key: 'judgmentCriteria', type: JVxeTypes.normal, width: 150, disabled: true },
|
||||
{ title: '点检描述', key: 'lineInspectResult', type: JVxeTypes.input, width: 140 },
|
||||
{
|
||||
title: '图片',
|
||||
key: 'pictureFiles',
|
||||
type: JVxeTypes.image,
|
||||
width: 160,
|
||||
maxCount: 3,
|
||||
token: true,
|
||||
action: uploadUrl,
|
||||
responseName: 'message',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record: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 v-auth="'mes:mes_xsl_equip_inspect_record:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableActions(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipInspectRecordModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipInspectRecordHandleModal @register="registerHandleModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslEquipInspectRecord" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslEquipInspectRecordModal from './components/MesXslEquipInspectRecordModal.vue';
|
||||
import MesXslEquipInspectRecordHandleModal from './components/MesXslEquipInspectRecordHandleModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslEquipInspectRecord.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl } from './MesXslEquipInspectRecord.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerHandleModal, { openModal: openHandleModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '点检保养记录',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 240,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '点检保养记录',
|
||||
url: getExportUrl,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleEnterResult(record: Recordable) {
|
||||
if (record.recordStatus !== 'pending') {
|
||||
createMessage.warning('仅待点检记录可录入点检结果');
|
||||
return;
|
||||
}
|
||||
openModal(true, { record, showFooter: true });
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, showFooter: false });
|
||||
}
|
||||
|
||||
function canHandleFail(record: Recordable) {
|
||||
return (
|
||||
record.inspectResult === 'fail' &&
|
||||
record.recordStatus === 'done' &&
|
||||
record.handledFlag !== '1'
|
||||
);
|
||||
}
|
||||
|
||||
function handleProcess(record: Recordable) {
|
||||
if (!canHandleFail(record)) {
|
||||
createMessage.warning('仅未处理的不合格记录可登记处理');
|
||||
return;
|
||||
}
|
||||
openHandleModal(true, { record });
|
||||
}
|
||||
|
||||
function getTableActions(record: Recordable) {
|
||||
if (record.recordStatus === 'pending') {
|
||||
return [
|
||||
{
|
||||
label: '录入点检结果',
|
||||
onClick: handleEnterResult.bind(null, record),
|
||||
auth: 'mes:mes_xsl_equip_inspect_record:edit',
|
||||
},
|
||||
];
|
||||
}
|
||||
const actions: Recordable[] = [{ label: '详情', onClick: handleDetail.bind(null, record) }];
|
||||
if (canHandleFail(record)) {
|
||||
actions.push({
|
||||
label: '处理',
|
||||
onClick: handleProcess.bind(null, record),
|
||||
auth: 'mes:mes_xsl_equip_inspect_record:edit',
|
||||
});
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
selectedRowKeys.value = [];
|
||||
reload();
|
||||
}
|
||||
|
||||
function getDropDownAction(record: Recordable) {
|
||||
if (record.recordStatus === 'pending') {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'mes:mes_xsl_equip_inspect_record:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" destroyOnClose title="不合格记录处理" width="520px" @register="registerModal" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import dayjs from 'dayjs';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { handleFormSchema } from '../MesXslEquipInspectRecord.data';
|
||||
import { handleFailRecord } from '../MesXslEquipInspectRecord.api';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const { createMessage } = useMessage();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
schemas: handleFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false });
|
||||
const record = data?.record;
|
||||
if (!record?.id) {
|
||||
return;
|
||||
}
|
||||
const user = userStore.getUserInfo || {};
|
||||
await setFieldsValue({
|
||||
id: record.id,
|
||||
handlerUserId: user.id,
|
||||
handlerUsername: user.username,
|
||||
handlerRealname: user.realname,
|
||||
handleTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
});
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
if (!values.handlerUserId) {
|
||||
createMessage.warning('请选择处理人');
|
||||
return;
|
||||
}
|
||||
if (!values.handleTime) {
|
||||
createMessage.warning('请选择处理时间');
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
await handleFailRecord(values);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,173 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
destroyOnClose
|
||||
:title="title"
|
||||
width="1150px"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
>
|
||||
<BasicForm @register="registerForm" />
|
||||
<a-divider orientation="left">点检项目明细(来自设备点检配置,只读)</a-divider>
|
||||
<JVxeTable
|
||||
v-if="tableReady"
|
||||
ref="lineTableRef"
|
||||
row-number
|
||||
keep-source
|
||||
:insert-row="false"
|
||||
:toolbar="false"
|
||||
:row-selection="false"
|
||||
:max-height="400"
|
||||
:loading="lineLoading"
|
||||
:columns="lineColumns"
|
||||
:dataSource="lineDataSource"
|
||||
/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import type { JVxeColumn, JVxeTableInstance } from '/@/components/jeecg/JVxeTable/types';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { formSchema, lineJVxeColumns, processDisplayFormSchema } from '../MesXslEquipInspectRecord.data';
|
||||
import { saveOrUpdate, queryById, queryLineListByRecordId } from '../MesXslEquipInspectRecord.api';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const { createMessage } = useMessage();
|
||||
const userStore = useUserStore();
|
||||
const isDetail = ref(false);
|
||||
const showFooterFlag = ref(true);
|
||||
const tableReady = ref(false);
|
||||
const lineLoading = ref(false);
|
||||
const lineDataSource = ref<Recordable[]>([]);
|
||||
const lineTableRef = ref<JVxeTableInstance>();
|
||||
|
||||
const lineColumns = computed<JVxeColumn[]>(() =>
|
||||
lineJVxeColumns.map((col) => {
|
||||
const editable = col.key === 'lineInspectResult' || col.key === 'pictureFiles';
|
||||
if (editable) {
|
||||
return { ...col, disabled: !showFooterFlag.value };
|
||||
}
|
||||
return { ...col, disabled: true };
|
||||
}),
|
||||
);
|
||||
|
||||
const showProcessFields = ref(false);
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps, resetSchema }] = useForm({
|
||||
labelWidth: 110,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 12 },
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
tableReady.value = false;
|
||||
lineDataSource.value = [];
|
||||
await resetFields();
|
||||
const editable = !!data?.showFooter;
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: editable, showOkBtn: editable });
|
||||
isDetail.value = !editable;
|
||||
showFooterFlag.value = editable;
|
||||
setProps({ disabled: !editable });
|
||||
showProcessFields.value = false;
|
||||
await resetSchema(formSchema);
|
||||
|
||||
if (data?.record?.id) {
|
||||
lineLoading.value = true;
|
||||
try {
|
||||
const mainRaw = await queryById({ id: data.record.id });
|
||||
const m = (mainRaw as any)?.id != null ? mainRaw : (mainRaw as any)?.result ?? mainRaw;
|
||||
if (editable && m.recordStatus !== 'pending') {
|
||||
createMessage.warning('仅待点检记录可录入点检结果');
|
||||
setModalProps({ showOkBtn: false, showCancelBtn: true });
|
||||
isDetail.value = true;
|
||||
showFooterFlag.value = false;
|
||||
setProps({ disabled: true });
|
||||
}
|
||||
const linesRaw = await queryLineListByRecordId({ id: data.record.id });
|
||||
const list = Array.isArray(linesRaw) ? linesRaw : (linesRaw as any)?.result ?? [];
|
||||
const user = userStore.getUserInfo || {};
|
||||
const patch: Recordable = { ...m };
|
||||
if (editable && showFooterFlag.value) {
|
||||
if (!patch.inspectDate) {
|
||||
patch.inspectDate = dayjs().format('YYYY-MM-DD');
|
||||
}
|
||||
if (!patch.inspectorRealname) {
|
||||
patch.inspectorUserId = user.id;
|
||||
patch.inspectorUsername = user.username;
|
||||
patch.inspectorRealname = user.realname;
|
||||
}
|
||||
}
|
||||
await setFieldsValue(patch);
|
||||
if (!editable && m.inspectResult === 'fail') {
|
||||
showProcessFields.value = true;
|
||||
await resetSchema([...formSchema, ...processDisplayFormSchema]);
|
||||
await setFieldsValue(patch);
|
||||
}
|
||||
lineDataSource.value = [...(list || [])];
|
||||
} finally {
|
||||
lineLoading.value = false;
|
||||
}
|
||||
}
|
||||
tableReady.value = true;
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
unref(isDetail) ? '点检保养记录详情' : '录入点检结果',
|
||||
);
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!showFooterFlag.value) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const values = await validate();
|
||||
const lineRef = lineTableRef.value as any;
|
||||
const tableData = (lineRef?.getTableData?.() || lineDataSource.value || []) as Recordable[];
|
||||
const lineList = tableData
|
||||
.filter((r) => r && r.equipInspectConfigLineId)
|
||||
.map((r) => ({
|
||||
id: r.id,
|
||||
equipInspectConfigLineId: r.equipInspectConfigLineId,
|
||||
inspectMaintainItemId: r.inspectMaintainItemId,
|
||||
itemCode: r.itemCode,
|
||||
itemName: r.itemName,
|
||||
itemCategory: r.itemCategory,
|
||||
itemType: r.itemType,
|
||||
equipmentPartName: r.equipmentPartName,
|
||||
equipmentSubPartName: r.equipmentSubPartName,
|
||||
inspectMethod: r.inspectMethod,
|
||||
judgmentCriteria: r.judgmentCriteria,
|
||||
lineInspectResult: r.lineInspectResult,
|
||||
pictureFiles: r.pictureFiles,
|
||||
}));
|
||||
if (!lineList.length) {
|
||||
createMessage.warning('点检明细不能为空');
|
||||
return;
|
||||
}
|
||||
if (!values.inspectResult) {
|
||||
createMessage.warning('请选择点检结果');
|
||||
return;
|
||||
}
|
||||
if (!values.inspectDate) {
|
||||
createMessage.warning('请选择点检日期');
|
||||
return;
|
||||
}
|
||||
if (!values.inspectorRealname) {
|
||||
createMessage.warning('点检人不能为空');
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate({ ...values, recordStatus: 'done', lineList }, true);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -5,6 +5,24 @@
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_ledger:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
preIcon="ant-design:audit-outlined"
|
||||
@click="handleBatchCreateRecord('inspect')"
|
||||
>
|
||||
点检
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
preIcon="ant-design:tool-outlined"
|
||||
@click="handleBatchCreateRecord('maintain')"
|
||||
>
|
||||
保养
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equipment_ledger:exportXls'"
|
||||
@@ -53,10 +71,14 @@
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslEquipmentLedgerModal from './components/MesXslEquipmentLedgerModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentLedger.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentLedger.api';
|
||||
import { batchCreateFromEquipment } from '../mesXslEquipInspectRecord/MesXslEquipInspectRecord.api';
|
||||
|
||||
const { createMessage, createConfirm } = useMessage();
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
@@ -87,7 +109,7 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getSelectRows }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
@@ -114,6 +136,46 @@
|
||||
selectedRowKeys.value = [];
|
||||
}
|
||||
|
||||
function handleBatchCreateRecord(recordType: 'inspect' | 'maintain') {
|
||||
const rows = (getSelectRows?.() || []) as Recordable[];
|
||||
if (!rows.length) {
|
||||
createMessage.warning('请先勾选设备');
|
||||
return;
|
||||
}
|
||||
const ids = rows.map((r) => r.id).filter(Boolean);
|
||||
const typeLabel = recordType === 'inspect' ? '点检' : '保养';
|
||||
createConfirm({
|
||||
iconType: 'info',
|
||||
title: `生成${typeLabel}记录`,
|
||||
content: `确定为选中的 ${ids.length} 台设备各生成一条${typeLabel}记录?`,
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
try {
|
||||
const res = await batchCreateFromEquipment({ equipmentLedgerIds: ids, recordType });
|
||||
const data = (res as any)?.result ?? res;
|
||||
const failList: string[] = data?.failMessages || [];
|
||||
const successCount = data?.successCount ?? 0;
|
||||
if (successCount > 0 && !failList.length) {
|
||||
createMessage.success(`成功生成 ${successCount} 条${typeLabel}记录`);
|
||||
handleSuccess();
|
||||
} else if (successCount > 0 && failList.length) {
|
||||
createMessage.warning(`成功生成 ${successCount} 条;未生成:${failList.join(';')}`);
|
||||
handleSuccess();
|
||||
} else if (failList.length) {
|
||||
createMessage.warning(failList.join(';'));
|
||||
} else {
|
||||
createMessage.warning((res as any)?.message || `未生成任何${typeLabel}记录`);
|
||||
}
|
||||
} catch (e: any) {
|
||||
const errMsg =
|
||||
e?.response?.data?.message || e?.message || `生成${typeLabel}记录失败`;
|
||||
createMessage.warning(errMsg);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function getDropDownAction(record: Recordable) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslMixerAction/list',
|
||||
checkActionName = '/xslmes/mesXslMixerAction/checkActionName',
|
||||
checkActionCode = '/xslmes/mesXslMixerAction/checkActionCode',
|
||||
save = '/xslmes/mesXslMixerAction/add',
|
||||
edit = '/xslmes/mesXslMixerAction/edit',
|
||||
deleteOne = '/xslmes/mesXslMixerAction/delete',
|
||||
deleteBatch = '/xslmes/mesXslMixerAction/deleteBatch',
|
||||
queryById = '/xslmes/mesXslMixerAction/queryById',
|
||||
exportXls = '/xslmes/mesXslMixerAction/exportXls',
|
||||
}
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const checkActionName = (params: { actionName: string; dataId?: string }) =>
|
||||
defHttp.get({ url: Api.checkActionName, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
|
||||
|
||||
export const checkActionCode = (params: { actionCode: string; dataId?: string }) =>
|
||||
defHttp.get({ url: Api.checkActionCode, 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,76 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { checkActionCode, checkActionName } from './MesXslMixerAction.api';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '设备名称', align: 'center', dataIndex: 'equipmentId_dictText', width: 180 },
|
||||
{ title: '动作名称', align: 'center', dataIndex: 'actionName', width: 180 },
|
||||
{ title: '动作代号', align: 'center', dataIndex: 'actionCode', width: 160 },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', 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: 'actionName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '动作代号', field: 'actionCode', 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: 'actionName',
|
||||
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 checkActionName({ actionName: v, dataId: model?.id });
|
||||
return Promise.resolve();
|
||||
} catch (e: any) {
|
||||
return Promise.reject(e?.response?.data?.message || e?.message || '动作名称不能重复');
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '动作代号',
|
||||
field: 'actionCode',
|
||||
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 checkActionCode({ actionCode: 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_action:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_action: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>
|
||||
<MesXslMixerActionModal @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 MesXslMixerActionModal from './modules/MesXslMixerActionModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslMixerAction.data';
|
||||
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslMixerAction.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_action:edit' }];
|
||||
}
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'xslmes:mes_xsl_mixer_action:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,48 @@
|
||||
<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 '../MesXslMixerAction.data';
|
||||
import { saveOrUpdate } from '../MesXslMixerAction.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,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