<template>
|
<div class="wmsQc-container">
|
<el-dialog v-model="isShowDialog" :width="800" draggable="" :close-on-click-modal="false">
|
<template #header>
|
<div style="color: #fff">
|
<!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>-->
|
<span>{{ props.title }}</span>
|
</div>
|
</template>
|
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
|
<el-row :gutter="35">
|
<el-form-item v-show="false">
|
<el-input v-model="ruleForm.id" />
|
</el-form-item>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="质检单号" prop="qCNo">
|
<el-input v-model="ruleForm.qCNo" placeholder="请输入质检单号" maxlength="50" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="业务类型" prop="businessType">
|
<el-select clearable v-model="ruleForm.businessType" placeholder="请选择业务类型">
|
<el-option v-for="(item,index) in getEnumBusinessTypeData" :key="index" :value="item.value" :label="`${item.describe}`"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="业务类型名称" prop="businessTypeName">
|
<el-input v-model="ruleForm.businessTypeName" placeholder="请输入业务类型名称" maxlength="50" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="单据状态" prop="qCOrderStatus">
|
<el-select clearable v-model="ruleForm.qCOrderStatus" placeholder="请选择单据状态">
|
<el-option v-for="(item,index) in getEnumQCOrderStatusData" :key="index" :value="item.value" :label="`${item.describe}`"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="单据状态名称" prop="qCOrderStatusName">
|
<el-input v-model="ruleForm.qCOrderStatusName" placeholder="请输入单据状态名称" maxlength="50" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="供应商名称" prop="supplierName">
|
<el-input v-model="ruleForm.supplierName" placeholder="请输入供应商名称" maxlength="50" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="供应商编号" prop="supplierCode">
|
<el-input v-model="ruleForm.supplierCode" placeholder="请输入供应商编号" maxlength="50" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="客户编号" prop="custCode">
|
<el-input v-model="ruleForm.custCode" placeholder="请输入客户编号" maxlength="50" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="客户中文名称" prop="custChinaName">
|
<el-input v-model="ruleForm.custChinaName" placeholder="请输入客户中文名称" maxlength="255" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="客户英文名称" prop="custEnglishName">
|
<el-input v-model="ruleForm.custEnglishName" placeholder="请输入客户英文名称" maxlength="255" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="关联单号" prop="relationNo">
|
<el-input v-model="ruleForm.relationNo" placeholder="请输入关联单号" maxlength="50" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="关联单据类型" prop="relationOrderType">
|
<el-input-number v-model="ruleForm.relationOrderType" placeholder="请输入关联单据类型" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="关联单据类型名称" prop="relationOrderTypeName">
|
<el-input v-model="ruleForm.relationOrderTypeName" placeholder="请输入关联单据类型名称" maxlength="50" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="备注" prop="remarks">
|
<el-input v-model="ruleForm.remarks" placeholder="请输入备注" maxlength="255" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="版本" prop="version">
|
<el-input v-model="ruleForm.version" placeholder="请输入版本" maxlength="50" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="工厂名称" prop="factoryName">
|
<el-input v-model="ruleForm.factoryName" placeholder="请输入工厂名称" maxlength="255" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="工厂编号" prop="factoryCode">
|
<el-input v-model="ruleForm.factoryCode" placeholder="请输入工厂编号" maxlength="50" show-word-limit clearable />
|
|
</el-form-item>
|
|
</el-col>
|
</el-row>
|
</el-form>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="cancel">取 消</el-button>
|
<el-button type="primary" @click="submit">确 定</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</div>
|
</template>
|
<style scoped>
|
:deep(.el-select),
|
:deep(.el-input-number) {
|
width: 100%;
|
}
|
</style>
|
<script lang="ts" setup>
|
import { ref,onMounted } from "vue";
|
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
|
import { ElMessage } from "element-plus";
|
import type { FormRules } from "element-plus";
|
import { addWmsQc, updateWmsQc, detailWmsQc } from "/@/api/main/WmsQC/wmsOrderQc";
|
import { getAPI } from '/@/utils/axios-utils';
|
import { SysEnumApi } from '/@/api-services/api';
|
import { listWmsBusinessType } from "/@/api/main/WmsBase/wmsBusinessType";
|
|
const getEnumBusinessTypeData = ref<any>([]);
|
const getEnumQCOrderStatusData = ref<any>([]);
|
//父级传递来的参数
|
var props = defineProps({
|
title: {
|
type: String,
|
default: "",
|
},
|
});
|
//父级传递来的函数,用于回调
|
const emit = defineEmits(["reloadTable"]);
|
const ruleFormRef = ref();
|
const isShowDialog = ref(false);
|
const ruleForm = ref<any>({});
|
//自行添加其他规则
|
const rules = ref<FormRules>({
|
qCNo: [{required: true, message: '请输入质检单号!', trigger: 'blur',},],
|
businessType: [{required: true, message: '请选择业务类型!', trigger: 'change',},],
|
businessTypeName: [{required: true, message: '请输入业务类型名称!', trigger: 'blur',},],
|
qCOrderStatus: [{required: true, message: '请选择单据状态!', trigger: 'change',},],
|
qCOrderStatusName: [{required: true, message: '请输入单据状态名称!', trigger: 'blur',},],
|
supplierName: [{required: true, message: '请输入供应商名称!', trigger: 'blur',},],
|
supplierCode: [{required: true, message: '请输入供应商编号!', trigger: 'blur',},],
|
});
|
|
// 打开弹窗
|
const openDialog = async (row: any) => {
|
// ruleForm.value = JSON.parse(JSON.stringify(row));
|
// 改用detail获取最新数据来编辑
|
let rowData = JSON.parse(JSON.stringify(row));
|
if (rowData.id)
|
ruleForm.value = (await detailWmsQc(rowData.id)).data.result;
|
else
|
ruleForm.value = rowData;
|
isShowDialog.value = true;
|
};
|
|
// 关闭弹窗
|
const closeDialog = () => {
|
emit("reloadTable");
|
isShowDialog.value = false;
|
};
|
|
// 取消
|
const cancel = () => {
|
isShowDialog.value = false;
|
};
|
|
// 提交
|
const submit = async () => {
|
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
if (isValid) {
|
let values = ruleForm.value;
|
if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
|
await addWmsQc(values);
|
} else {
|
await updateWmsQc(values);
|
}
|
closeDialog();
|
} else {
|
ElMessage({
|
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
type: "error",
|
});
|
}
|
});
|
};
|
|
|
|
|
|
|
|
// 页面加载时
|
onMounted(async () => {
|
|
getEnumQCOrderStatusData.value = (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet('OrderStatusEnum')).data.result ?? [];
|
|
//业务类型
|
var res = await listWmsBusinessType();
|
res = res.data;
|
if(res && res.code == 200){
|
getEnumBusinessTypeData.value = res?.result ?? [];
|
}
|
|
});
|
|
//将属性或者函数暴露给父组件
|
defineExpose({ openDialog });
|
</script>
|