no message
parent
63224c8786
commit
7b46c2a0a7
|
|
@ -16,8 +16,9 @@ VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
|
|||
VITE_GLOB_API_URL=/cpte-wms
|
||||
|
||||
#后台接口全路径地址(必填)
|
||||
VITE_GLOB_DOMAIN_URL=http://10.180.9.60:8000/cpte-wms
|
||||
|
||||
#VITE_GLOB_DOMAIN_URL=http://10.180.9.60:8000/cpte-wms
|
||||
#VITE_GLOB_DOMAIN_URL=http://47.117.45.79:8000/cpte-wms
|
||||
VITE_GLOB_DOMAIN_URL=http://10.254.27.192:8000/cpte-wms
|
||||
# 接口父路径前缀
|
||||
VITE_GLOB_API_URL_PREFIX=
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ enum Api {
|
|||
exportXls = '/agvTask/exportXls',
|
||||
taskReporter = '/api/robot/reporter/task',
|
||||
callBackTask = '/tes/apiv2/callBackTask',
|
||||
cancelTask = '/tes/apiv2/cancelTask',
|
||||
resendTesTask = '/tes/apiv2/resendTesTask',
|
||||
cancelTes = '/tes/apiv2/cancelTes',
|
||||
cancelAgv = '/api/robot/cancelAgv',
|
||||
resendTes = '/tes/apiv2/resendTes',
|
||||
resendAgv = '/api/robot/resendAgv',
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -79,7 +81,7 @@ export const batchDelete = (params, handleSuccess) => {
|
|||
* @param isUpdate
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||
};
|
||||
|
||||
|
|
@ -110,12 +112,12 @@ export const callBackTask = (params) => {
|
|||
};
|
||||
|
||||
/**
|
||||
* 任务取消
|
||||
* TES任务取消
|
||||
* @param params
|
||||
*/
|
||||
export const cancelTask = (params) => {
|
||||
export const cancelTes = (params) => {
|
||||
return defHttp.post(
|
||||
{ url: Api.cancelTask, params },
|
||||
{ url: Api.cancelTes, params },
|
||||
{
|
||||
isTransformResponse: false,
|
||||
}
|
||||
|
|
@ -123,11 +125,40 @@ export const cancelTask = (params) => {
|
|||
};
|
||||
|
||||
/**
|
||||
* 任务重送
|
||||
* AGV任务取消
|
||||
* @param params
|
||||
*/
|
||||
export const resendTesTask = (params) => {
|
||||
return defHttp.post({ url: Api.resendTesTask, params },{
|
||||
isTransformResponse: false,
|
||||
});
|
||||
export const cancelAgv = (params) => {
|
||||
return defHttp.post(
|
||||
{ url: Api.cancelAgv, params },
|
||||
{
|
||||
isTransformResponse: false,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* TES任务重送
|
||||
* @param params
|
||||
*/
|
||||
export const resendTes = (params) => {
|
||||
return defHttp.post(
|
||||
{ url: Api.resendTes, params },
|
||||
{
|
||||
isTransformResponse: false,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* AGV任务重送
|
||||
* @param params
|
||||
*/
|
||||
export const resendAgv = (params) => {
|
||||
return defHttp.post(
|
||||
{ url: Api.resendAgv, params },
|
||||
{
|
||||
isTransformResponse: false,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -45,19 +45,20 @@
|
|||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<HikAgvModal ref="registerModal" @success="handleSuccess"></HikAgvModal>
|
||||
<ResendAgvModal ref="registerResendModal" @success="handleSuccess"></ResendAgvModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="agvTask" setup>
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './HikAgv.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, taskReporter } from './AgvTask.api';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, taskReporter, cancelAgv } from './AgvTask.api';
|
||||
import HikAgvModal from './components/HikAgvModal.vue';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
import ResendAgvModal from '@/views/agvTask/components/ResendAgvModal.vue';
|
||||
|
||||
const fieldPickers = reactive({});
|
||||
|
||||
|
|
@ -65,12 +66,11 @@
|
|||
const queryParam = reactive<any>({
|
||||
agvVendor: 'HIK',
|
||||
});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
const registerResendModal = ref();
|
||||
const { createMessage } = useMessage();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: 'AGV任务表',
|
||||
api: list,
|
||||
|
|
@ -100,8 +100,7 @@
|
|||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] =
|
||||
tableContext;
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const labelCol = reactive({
|
||||
xs: 24,
|
||||
sm: 4,
|
||||
|
|
@ -132,10 +131,10 @@
|
|||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
/* function handleDetail(record: Recordable) {
|
||||
registerModal.value.disableSubmit = true;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
|
|
@ -144,6 +143,13 @@
|
|||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务完成事件
|
||||
*/
|
||||
|
|
@ -174,10 +180,31 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
* 任务取消事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
async function hanndleCancel(record) {
|
||||
const params = {
|
||||
robotTaskCode: record.id,
|
||||
};
|
||||
try {
|
||||
const res = await cancelAgv(params);
|
||||
if (res && res.code === 'SUCCESS') {
|
||||
createMessage.success('操作成功');
|
||||
handleSuccess();
|
||||
} else {
|
||||
createMessage.error(res.message || '任务处理失败');
|
||||
}
|
||||
} catch (error) {
|
||||
createMessage.error('请求异常: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务重发
|
||||
*/
|
||||
function hanndleResend(record) {
|
||||
registerResendModal.value.disableSubmit = false;
|
||||
registerResendModal.value.resend(record);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -205,10 +232,10 @@
|
|||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '任务详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
/* {
|
||||
label: '任务详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},*/
|
||||
{
|
||||
label: '任务完成',
|
||||
popConfirm: {
|
||||
|
|
@ -217,7 +244,23 @@
|
|||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'agvTask:data_agv_task:edit',
|
||||
disabled: record.status === 4 || record.status === 1
|
||||
disabled: record.status === 4 || record.status === 1 || record.status === 5,
|
||||
},
|
||||
{
|
||||
label: '任务取消',
|
||||
popConfirm: {
|
||||
title: '是否确认取消?',
|
||||
confirm: hanndleCancel.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'agvTask:data_agv_task:edit',
|
||||
disabled: record.status != 2,
|
||||
},
|
||||
{
|
||||
label: '任务重送',
|
||||
onClick: hanndleResend.bind(null, record),
|
||||
auth: 'agvTask:data_agv_task:edit',
|
||||
disabled: record.status != 5,
|
||||
},
|
||||
{
|
||||
label: '任务删除',
|
||||
|
|
@ -227,7 +270,7 @@
|
|||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'agvTask:data_agv_task:delete',
|
||||
disabled: record.status != 1
|
||||
disabled: record.status != 1,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<TesAgvModal ref="registerModal" @success="handleSuccess"></TesAgvModal>
|
||||
<ResendTesAgvModal ref="registerResendModal" @success="handleSuccess"></ResendTesAgvModal>
|
||||
<ResendAgvModal ref="registerResendModal" @success="handleSuccess"></ResendAgvModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -54,9 +54,9 @@
|
|||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './TesAgv.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, callBackTask, cancelTask } from './AgvTask.api';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, callBackTask, cancelTes } from './AgvTask.api';
|
||||
import TesAgvModal from './components/TesAgvModal.vue';
|
||||
import ResendTesAgvModal from './components/ResendTesAgvModal.vue';
|
||||
import ResendAgvModal from './components/ResendAgvModal.vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
|
||||
|
|
@ -131,10 +131,10 @@
|
|||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
/* function handleDetail(record: Recordable) {
|
||||
registerModal.value.disableSubmit = true;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
|
|
@ -167,13 +167,12 @@
|
|||
const res = await callBackTask(params);
|
||||
if (res && res.returnCode === 0) {
|
||||
createMessage.success('操作成功');
|
||||
handleSuccess();
|
||||
} else {
|
||||
createMessage.error(res.returnMsg || '任务处理失败');
|
||||
}
|
||||
} catch (error) {
|
||||
createMessage.error('请求异常: ' + error.message);
|
||||
} finally {
|
||||
handleSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -185,16 +184,15 @@
|
|||
taskID: record.id,
|
||||
};
|
||||
try {
|
||||
const res = await cancelTask(params);
|
||||
const res = await cancelTes(params);
|
||||
if (res && res.returnCode === 0) {
|
||||
createMessage.success('操作成功');
|
||||
handleSuccess();
|
||||
} else {
|
||||
createMessage.error(res.returnMsg || '任务处理失败');
|
||||
}
|
||||
} catch (error) {
|
||||
createMessage.error('请求异常: ' + error.message);
|
||||
} finally {
|
||||
handleSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -231,10 +229,10 @@
|
|||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
/* {
|
||||
label: '任务详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
},*/
|
||||
{
|
||||
label: '任务完成',
|
||||
popConfirm: {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
import { ref, reactive, defineExpose, nextTick } from 'vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getTenantId } from '@/utils/auth';
|
||||
import { cancelTask, resendTesTask } from '../AgvTask.api';
|
||||
import { resendTes, resendAgv } from '../AgvTask.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import { JSearchSelect, JDictSelectTag } from '@/components/Form';
|
||||
|
|
@ -76,14 +76,14 @@
|
|||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
carrierCode: '',
|
||||
carrierType: 'TRAY',
|
||||
carrierType: '',
|
||||
taskType: '',
|
||||
type: '',
|
||||
status: 'CREATED',
|
||||
priority: 3,
|
||||
status: '',
|
||||
priority: '',
|
||||
startCode: '',
|
||||
endCode: '',
|
||||
agvVendor: 'TES',
|
||||
agvVendor: '',
|
||||
tenantId: tenantId,
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
|
|
@ -128,8 +128,16 @@
|
|||
console.error(error);
|
||||
}
|
||||
confirmLoading.value = true;
|
||||
if (formData.agvVendor === 'TES') {
|
||||
await responseTes(formData);
|
||||
} else {
|
||||
await responseAgv(formData);
|
||||
}
|
||||
}
|
||||
|
||||
async function responseTes(formData) {
|
||||
try {
|
||||
const res = await resendTesTask(formData);
|
||||
const res = await resendTes(formData);
|
||||
if (res && res.returnCode === 0) {
|
||||
createMessage.success('操作成功');
|
||||
emit('ok');
|
||||
|
|
@ -137,7 +145,23 @@
|
|||
createMessage.error(res.returnMsg || '任务处理失败');
|
||||
}
|
||||
} catch (error) {
|
||||
createMessage.error('请求异常: ' + error.message);
|
||||
createMessage.error('请求异常: ' + error);
|
||||
} finally {
|
||||
confirmLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function responseAgv(formData) {
|
||||
try {
|
||||
const res = await resendAgv(formData);
|
||||
if (res && res.code === 'SUCCESS') {
|
||||
createMessage.success('操作成功');
|
||||
emit('ok');
|
||||
} else {
|
||||
createMessage.error(res.message || '任务处理失败');
|
||||
}
|
||||
} catch (error) {
|
||||
createMessage.error('请求异常: ' + error);
|
||||
} finally {
|
||||
confirmLoading.value = false;
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
@cancel="handleCancel"
|
||||
cancelText="关闭"
|
||||
>
|
||||
<ResendTesAgvForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ResendTesAgvForm>
|
||||
<ResendAgvForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ResendAgvForm>
|
||||
<template #footer>
|
||||
<a-button @click="handleCancel">取消</a-button>
|
||||
<a-button :class="{ 'jee-hidden': disableSubmit }" type="primary" @click="handleOk">确认 </a-button>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
import ResendTesAgvForm from '@/views/agvTask/components/ResendTesAgvForm.vue';
|
||||
import ResendAgvForm from '@/views/agvTask/components/ResendAgvForm.vue';
|
||||
|
||||
const title = ref<string>('');
|
||||
const visible = ref<boolean>(false);
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
* 重送
|
||||
*/
|
||||
function resend(record) {
|
||||
title.value = 'TES任务重送';
|
||||
record.agvVendor === 'TES' ? (title.value = 'TES任务重送') : (title.value = 'AGV任务重送');
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
|
|
@ -23,12 +23,7 @@ export const columns: BasicColumn[] = [
|
|||
},
|
||||
},
|
||||
{
|
||||
title: '排',
|
||||
align: 'center',
|
||||
dataIndex: 'rowNum',
|
||||
},
|
||||
{
|
||||
title: '列',
|
||||
title: '巷道编码',
|
||||
align: 'center',
|
||||
dataIndex: 'colNum',
|
||||
},
|
||||
|
|
@ -37,6 +32,11 @@ export const columns: BasicColumn[] = [
|
|||
align: 'center',
|
||||
dataIndex: 'layerNum',
|
||||
},
|
||||
{
|
||||
title: '深位',
|
||||
align: 'center',
|
||||
dataIndex: 'rowNum',
|
||||
},
|
||||
{
|
||||
title: '是否启用',
|
||||
align: 'center',
|
||||
|
|
|
|||
|
|
@ -4,23 +4,24 @@
|
|||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="PointForm">
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="库区" v-bind="validateInfos.areaId" id="PointForm-areaId" name="areaId">
|
||||
<JSearchSelect
|
||||
v-model:value="formData.areaId"
|
||||
placeholder="请选择库区"
|
||||
dict="base_area where iz_active=1 and del_flag=0,area_name,id"
|
||||
allowClear
|
||||
@change="onAreaChange"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="编码" v-bind="validateInfos.pointCode" id="PointForm-pointCode" name="pointCode">
|
||||
<a-input v-model:value="formData.pointCode" placeholder="请输入库位编码" allow-clear></a-input>
|
||||
<a-input v-model:value="formData.pointCode" placeholder="请输入库位编码" :disabled="isAutoGenerateCode" allow-clear></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="状态" v-bind="validateInfos.status" id="PointForm-status" name="status">
|
||||
<JDictSelectTag
|
||||
v-model:value="formData.status"
|
||||
|
|
@ -32,28 +33,89 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item label="排" v-bind="validateInfos.rowNum" id="PointForm-rowNum" name="rowNum">
|
||||
<a-input v-model:value="formData.rowNum" placeholder="请输入排" allow-clear></a-input>
|
||||
<a-col :span="12" v-if="showSpecialFields">
|
||||
<a-form-item label="巷道编码" v-bind="validateInfos.colNum" id="PointForm-colNum" name="colNum">
|
||||
<a-input v-model:value="formData.colNum" placeholder="巷道编码" allow-clear @change="generatePointCode"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="列" v-bind="validateInfos.colNum" id="PointForm-colNum" name="colNum">
|
||||
<a-input v-model:value="formData.colNum" placeholder="请输入列" allow-clear></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
|
||||
<a-col :span="12" v-if="showSpecialFields">
|
||||
<a-form-item label="层" v-bind="validateInfos.layerNum" id="PointForm-layerNum" name="layerNum">
|
||||
<a-input v-model:value="formData.layerNum" placeholder="请输入层" allow-clear></a-input>
|
||||
<a-input-number
|
||||
v-model:value="formData.layerNum"
|
||||
:min="1"
|
||||
:max="2"
|
||||
placeholder="请输入层"
|
||||
allow-clear
|
||||
@change="generatePointCode"
|
||||
style="width: 220px"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12" v-if="showSpecialFields">
|
||||
<a-form-item label="深度" v-bind="validateInfos.rowNum" id="PointForm-rowNum" name="rowNum">
|
||||
<a-input-number
|
||||
v-model:value="formData.rowNum"
|
||||
placeholder="请输入深度"
|
||||
:min="1"
|
||||
:max="7"
|
||||
allow-clear
|
||||
@change="generatePointCode"
|
||||
style="width: 220px"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12" v-if="showCoordinateFields">
|
||||
<a-form-item label="坐标X" v-bind="validateInfos.positionX" id="PointForm-positionX" name="positionX">
|
||||
<a-input-number v-model:value="formData.positionX" placeholder="请输入坐标X" allow-clear style="width: 220px"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12" v-if="showCoordinateFields">
|
||||
<a-form-item label="坐标Y" v-bind="validateInfos.positionY" id="PointForm-positionY" name="positionY">
|
||||
<a-input-number v-model:value="formData.positionY" placeholder="请输入坐标Y" allow-clear style="width: 220px"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="描述" v-bind="validateInfos.description" id="PointForm-description" name="description">
|
||||
<a-form-item
|
||||
label="描述"
|
||||
v-bind="validateInfos.description"
|
||||
id="AsnForm-description"
|
||||
name="description"
|
||||
:labelCol="{ span: 3 }"
|
||||
:wrapperCol="{ span: 20 }"
|
||||
>
|
||||
<a-textarea v-model:value="formData.description" :rows="4" placeholder="请输入描述" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="是否启用" v-bind="validateInfos.izActive" id="PointForm-izActive" name="izActive">
|
||||
<a-col :span="12" v-if="showSpecialFields">
|
||||
<a-form-item
|
||||
:labelCol="{ span: 6 }"
|
||||
:wrapperCol="{ span: 12 }"
|
||||
label="巷道"
|
||||
v-bind="validateInfos.izDoubleLane"
|
||||
id="PointForm-izDoubleLane"
|
||||
name="izDoubleLane"
|
||||
>
|
||||
<JSwitch
|
||||
v-model:value="formData.izDoubleLane"
|
||||
:checked-children="'双通道'"
|
||||
:un-checked-children="'单通道'"
|
||||
:options="['1', '0']"
|
||||
></JSwitch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item
|
||||
:labelCol="{ span: 6 }"
|
||||
:wrapperCol="{ span: 12 }"
|
||||
label="是否启用"
|
||||
v-bind="validateInfos.izActive"
|
||||
id="PointForm-izActive"
|
||||
name="izActive"
|
||||
>
|
||||
<JSwitch v-model:value="formData.izActive" :options="['1', '0']"></JSwitch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
|
@ -90,26 +152,31 @@
|
|||
areaId: '',
|
||||
pointCode: '',
|
||||
status: 0,
|
||||
rowNum: '00',
|
||||
colNum: '00',
|
||||
layerNum: '00',
|
||||
colNum: '',
|
||||
layerNum: '',
|
||||
rowNum: '',
|
||||
positionX: 0,
|
||||
positionY: 0,
|
||||
izDoubleLane: 1,
|
||||
description: '',
|
||||
delFlag: 0,
|
||||
izActive: 1,
|
||||
tenantId: tenantId,
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 6 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
areaId: [{ required: true, message: '请选择库区!' }],
|
||||
pointCode: [{ required: true, message: '请输入库位编码!' }],
|
||||
rowNum: [{ required: true, message: '请输入排!' }],
|
||||
colNum: [{ required: true, message: '请输入列!' }],
|
||||
layerNum: [{ required: true, message: '请输入层!' }],
|
||||
pointCode: [], // 初始化为空数组,动态添加规则
|
||||
status: [{ required: true, message: '请选择状态!' }],
|
||||
colNum: [], // 初始化为空数组,动态添加规则
|
||||
rowNum: [], // 初始化为空数组,动态添加规则
|
||||
layerNum: [], // 初始化为空数组,动态添加规则
|
||||
positionX: [], // 初始化为空数组,动态添加规则
|
||||
positionY: [], // 初始化为空数组,动态添加规则
|
||||
});
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
//日期个性化选择
|
||||
|
|
@ -127,6 +194,84 @@
|
|||
return props.formDisabled;
|
||||
});
|
||||
|
||||
// 库区类型相关变量
|
||||
const isAutoGenerateCode = ref<boolean>(false); // 是否自动生成编码
|
||||
const showSpecialFields = ref<boolean>(false); // 是否显示巷道相关字段
|
||||
const showCoordinateFields = ref<boolean>(false); // 是否显示坐标字段
|
||||
|
||||
// 定义库区ID常量,提高可读性和可维护性
|
||||
const CP_MJ_AREA_IDS = new Set(['1988794761598668802', '1988795017837088770']);
|
||||
//成品存储区、模具存储区、入库工作站、出库工作站
|
||||
const CP_MJ_RK_CK_AREA_IDS = new Set([
|
||||
'1988794761598668802',
|
||||
'1988795017837088770',
|
||||
'1986328561044119554',
|
||||
'1986337742572707841'
|
||||
]);
|
||||
|
||||
/**
|
||||
* 库区选择变化事件
|
||||
*/
|
||||
function onAreaChange(option: string | undefined) {
|
||||
// 参数合法性检查
|
||||
if (!option) return;
|
||||
|
||||
const isSpecialArea = CP_MJ_AREA_IDS.has(option);
|
||||
const isCoordinateArea = CP_MJ_RK_CK_AREA_IDS.has(option);
|
||||
|
||||
// 更新响应式状态
|
||||
isAutoGenerateCode.value = isSpecialArea;
|
||||
showSpecialFields.value = isSpecialArea;
|
||||
showCoordinateFields.value = isCoordinateArea;
|
||||
|
||||
// 清除所有字段之前的验证规则
|
||||
validatorRules.pointCode.splice(0);
|
||||
validatorRules.colNum.splice(0);
|
||||
validatorRules.rowNum.splice(0);
|
||||
validatorRules.layerNum.splice(0);
|
||||
validatorRules.positionX.splice(0);
|
||||
validatorRules.positionY.splice(0);
|
||||
|
||||
// 根据类型设置新的验证规则
|
||||
if (isSpecialArea) {
|
||||
// 自动编码不需要 pointCode 必填
|
||||
validatorRules.colNum.push({ required: true, message: '请输入巷道编码!' });
|
||||
validatorRules.rowNum.push({ required: true, message: '请输入深度!' });
|
||||
validatorRules.layerNum.push({ required: true, message: '请输入层!' });
|
||||
} else {
|
||||
// 手动编码需要 pointCode 必填
|
||||
validatorRules.pointCode.push({ required: true, message: '请输入编码!' });
|
||||
}
|
||||
|
||||
if (isCoordinateArea) {
|
||||
validatorRules.positionX.push({ required: true, message: '请输入坐标X!' });
|
||||
validatorRules.positionY.push({ required: true, message: '请输入坐标Y!' });
|
||||
}
|
||||
|
||||
// 仅在必要时重新生成编码
|
||||
if (isSpecialArea || isCoordinateArea) {
|
||||
generatePointCode();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动生成库位编码
|
||||
*/
|
||||
function generatePointCode() {
|
||||
if (isAutoGenerateCode.value) {
|
||||
// 格式: 巷道编码-层-深度
|
||||
const colNum = formData.colNum || '';
|
||||
const layerNum = formData.layerNum || '';
|
||||
const rowNum = formData.rowNum || '';
|
||||
|
||||
if (colNum && layerNum && rowNum) {
|
||||
formData.pointCode = `${colNum}-${layerNum}-${rowNum}`;
|
||||
} else {
|
||||
formData.pointCode = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
|
|
@ -148,6 +293,11 @@
|
|||
});
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
|
||||
// 如果记录中有 areaId,则手动触发 onAreaChange
|
||||
if (record.areaId) {
|
||||
onAreaChange(record.areaId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<j-modal :title="title" :maxHeight="500" :width="600" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<j-modal :title="title" :maxHeight="500" :width="700" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<PointForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></PointForm>
|
||||
<template #footer>
|
||||
<a-button @click="handleCancel">取消</a-button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue