This commit is contained in:
yangjun 2025-10-10 10:30:16 +08:00
parent 7a6d6dc85d
commit 829bc4dfc0
10 changed files with 904 additions and 16 deletions

View File

@ -45,11 +45,11 @@ export const columns: BasicColumn[] = [
align: "center", align: "center",
dataIndex: 'wlLowerLimit' dataIndex: 'wlLowerLimit'
}, },
{ // {
title: '供应商名称', // title: '供应商名称',
align: "center", // align: "center",
dataIndex: 'suppliersName' // dataIndex: 'suppliersName'
}, // },
{ {
title: '请购数量', title: '请购数量',
align: "center", align: "center",
@ -87,6 +87,71 @@ export const columns: BasicColumn[] = [
// }, // },
]; ];
//列表数据
export const rkcolumns: BasicColumn[] = [
{
title: '物料编码',
align: "center",
dataIndex: 'wlMaterialNo'
},
{
title: '物料名称',
align: "center",
dataIndex: 'wlName'
},
{
title: '采购单位',
align: "center",
dataIndex: 'wlUnits'
},
{
title: '规格型号',
align: "center",
dataIndex: 'wlSpecificationModel'
},
{
title: '上限',
align: "center",
dataIndex: 'wlUpperLimit'
},
{
title: '下限',
align: "center",
dataIndex: 'wlLowerLimit'
},
{
title: '库房',
align: "center",
dataIndex: 'nuId'
},
{
title: '采购单价',
align: "center",
dataIndex: 'procurementPrice'
},
{
title: '到货单价',
align: "center",
dataIndex: 'arrivalPrice'
},
{
title: '请购数量',
align: "center",
dataIndex: 'purchaseQuantity'
},
{
title: '入库数量',
align: "center",
dataIndex: 'rksl'
},
{
title: '未入库数量',
align: "center",
dataIndex: 'wrksl'
},
];
// 高级查询数据 // 高级查询数据
export const superQuerySchema = { export const superQuerySchema = {
mainId: {title: '请购单id',order: 0,view: 'text', type: 'string',}, mainId: {title: '请购单id',order: 0,view: 'text', type: 'string',},

View File

@ -12,6 +12,7 @@ enum Api {
importExcel = '/cgd/nuInvoicingCgdMain/importExcel', importExcel = '/cgd/nuInvoicingCgdMain/importExcel',
exportXls = '/cgd/nuInvoicingCgdMain/exportXls', exportXls = '/cgd/nuInvoicingCgdMain/exportXls',
auditInfo='/cgd/nuInvoicingCgdMain/auditInfo', auditInfo='/cgd/nuInvoicingCgdMain/auditInfo',
rukuInfo='/cgd/nuInvoicingCgdMain/rukuInfo',
} }
/** /**
@ -71,8 +72,13 @@ export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save; let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false }); return defHttp.post({ url: url, params }, { isTransformResponse: false });
} }
// 审核 // 采购单审核
export const auditInfo = (params, isUpdate) => { export const auditInfo = (params, isUpdate) => {
let url = Api.auditInfo; let url = Api.auditInfo;
return defHttp.post({ url: url, params }, { isTransformResponse: false }); return defHttp.post({ url: url, params }, { isTransformResponse: false });
} }
// 采购单入库
export const rukuInfo = (params, isUpdate) => {
let url = Api.rukuInfo;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}

View File

@ -42,7 +42,7 @@ export const columns: BasicColumn[] = [
{ {
title: '付款方式', title: '付款方式',
align: "center", align: "center",
dataIndex: 'gysFkfs' dataIndex: 'gysFkfs_dictText'
}, },
{ {
title: '状态', title: '状态',

View File

@ -61,8 +61,12 @@
<template v-slot:bodyCell="{ column, record, index, text }"> <template v-slot:bodyCell="{ column, record, index, text }">
</template> </template>
</BasicTable> </BasicTable>
<!-- 表单区域 --> <!-- 审批 -->
<NuInvoicingCgdMainModal ref="registerModal" @success="handleSuccess"></NuInvoicingCgdMainModal> <NuInvoicingCgdMainModal ref="registerModal" @success="handleSuccess"></NuInvoicingCgdMainModal>
<!-- 入库单 -->
<NuInvoicingCgdRkdModal ref="rkdModal" @success="handleSuccess"></NuInvoicingCgdRkdModal>
<!-- 入库单 -->
<NuInvoicingCgdDetailModal ref="detailModal" @success="handleSuccess"></NuInvoicingCgdDetailModal>
</div> </div>
</template> </template>
@ -74,6 +78,8 @@
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuInvoicingCgdMain.api'; import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuInvoicingCgdMain.api';
import { downloadFile } from '/@/utils/common/renderUtils'; import { downloadFile } from '/@/utils/common/renderUtils';
import NuInvoicingCgdMainModal from './components/NuInvoicingCgdMainModal.vue' import NuInvoicingCgdMainModal from './components/NuInvoicingCgdMainModal.vue'
import NuInvoicingCgdRkdModal from './components/NuInvoicingCgdRkdModal.vue'
import NuInvoicingCgdDetailModal from './components/NuInvoicingCgdDetailModal.vue'
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue'; import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
@ -83,6 +89,8 @@
const queryParam = reactive<any>({}); const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false); const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref(); const registerModal = ref();
const rkdModal = ref();
const detailModal = ref();
const userStore = useUserStore(); const userStore = useUserStore();
//table //table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
@ -144,19 +152,26 @@
} }
/** /**
* 编辑事件 * 审核事件
*/ */
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false; registerModal.value.disableSubmit = false;
registerModal.value.edit(record); registerModal.value.edit(record);
} }
/**
* 入库单
*/
function handleRkd(record: Recordable) {
rkdModal.value.disableSubmit = false;
rkdModal.value.edit(record);
}
/** /**
* 详情 * 详情
*/ */
function handleDetail(record: Recordable) { function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true; detailModal.value.disableSubmit = true;
registerModal.value.edit(record); detailModal.value.edit(record);
} }
/** /**
@ -193,7 +208,7 @@
}, },
{ {
label: '入库', label: '入库',
onClick: handleEdit.bind(null, record), onClick: handleRkd.bind(null, record),
auth: 'cgd:nu_invoicing_cgd_main:edit', auth: 'cgd:nu_invoicing_cgd_main:edit',
ifShow: record.status == '1' ifShow: record.status == '1'
}, },

View File

@ -0,0 +1,316 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuInvoicingCgdMainForm">
<a-row>
<a-col :span="8">
<a-form-item label="采购单单号" v-bind="validateInfos.cgdNo" id="NuInvoicingCgdMainForm-cgdNo" name="cgdNo">
<span>{{formData.cgdNo}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="请购时间" v-bind="validateInfos.qgDate" id="NuInvoicingCgdMainForm-qgDate" name="qgDate">
<span>{{formData.qgDate}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="请购人" v-bind="validateInfos.qgBy" id="NuInvoicingCgdMainForm-qgBy" name="qgBy">
<span>{{formData.qgBy}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商" v-bind="validateInfos.gysId" id="NuInvoicingCgdMainForm-gysId" name="gysId">
<span>{{formData.gysId_dictText}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="联系人" v-bind="validateInfos.gysLxr" id="NuInvoicingCgdMainForm-gysLxr" name="gysLxr">
<span>{{formData.gysLxr}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="联系电话" v-bind="validateInfos.gysLxrdh" id="NuInvoicingCgdMainForm-gysLxrdh" name="gysLxrdh">
<span>{{formData.gysLxrdh}}</span>
</a-form-item>
</a-col>
<!-- <a-col :span="8">
<a-form-item label="采购单类型" v-bind="validateInfos.cgdType" id="NuInvoicingCgdMainForm-cgdType" name="cgdType">
<span>{{formData.cgdType_dictText}}</span>
</a-form-item>
</a-col> -->
<!--
<a-col :span="8">
<a-form-item label="销账单" v-bind="validateInfos.xzdPath" id="NuInvoicingCgdMainForm-xzdPath" name="xzdPath">
<j-image-upload :fileMax="0" v-model:value="formData.xzdPath" ></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结账单" v-bind="validateInfos.jzdPath" id="NuInvoicingCgdMainForm-jzdPath" name="jzdPath">
<j-image-upload :fileMax="0" v-model:value="formData.jzdPath" ></j-image-upload>
</a-form-item>
</a-col> -->
<!-- <a-col :span="8">
<a-form-item label="审核状态" v-bind="validateInfos.status" id="NuInvoicingCgdMainForm-status" name="status">
<a-select v-model:value="formData.status" :disabled="disabled" placeholder="请选择审核状态">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="1">审核通过</a-select-option>
<a-select-option value="3">作废</a-select-option>
</a-select>
</a-form-item>
</a-col> -->
<a-col :span="8">
<a-form-item label="审核人" v-bind="validateInfos.reviewedBy" id="NuInvoicingCgdMainForm-reviewedBy" name="reviewedBy">
<span>{{formData.reviewedBy}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="审核时间" v-bind="validateInfos.reviewedTime" id="NuInvoicingCgdMainForm-reviewedTime" name="reviewedTime">
<span>{{formData.reviewedTime}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="付款方式" v-bind="validateInfos.gysFkfs" id="NuInvoicingCgdMainForm-gysFkfs" name="gysFkfs">
<span>{{formData.gysFkfs_dictText}}</span>
</a-form-item>
</a-col>
<a-col :span="24" >
<a-form-item label="审核备注" v-bind="validateInfos.content" id="NuInvoicingCgdMainForm-content" name="content" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<span>{{formData.content}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="随行单" v-bind="validateInfos.sxdPath" id="NuInvoicingCgdMainForm-sxdPath" name="sxdPath">
<j-image-upload :fileMax="1" v-model:value="formData.sxdPath" ></j-image-upload>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
<a-table
:columns="rkcolumns"
:row-key="id"
:data-source="dataSource"
:pagination="false"
:loading="loading"
@change="handleTableChange"
>
<template #bodyCell="{ column, text ,record }">
</template>
</a-table>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { getValueType } from '/@/utils';
import { rukuInfo } from '../NuInvoicingCgdMain.api';
import { rkcolumns } from '../NuInvoicingCgdInfo.data';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { useUserStore } from '/@/store/modules/user';
import dayjs from 'dayjs';
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({})},
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const dataSource = ref([]);
const userStore = useUserStore();
const formData = reactive<Record<string, any>>({
id: '',
qgdId: '',
cgdNo: '',
gysId: '',
qgDate: '',
qgBy: '',
gysLxr: '',
gysLxrdh: '',
gysFkfs: '',
status: '',
cgdType: '',
sxdPath: '',
xzdPath: '',
jzdPath: '',
reviewedBy: '',
reviewedTime: '',
content: '',
gysId_dictText:'',
status_dictText:'',
cgdType_dictText:'',
gysFkfs_dictText:'',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 9 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 15 } });
const labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 3 } });
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 19 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
const handleInputChange = (record, field, value) => {
//
record[field] = value;
var b = record.purchaseQuantity - value;
if(b<0){
record.wrksl = 0;
record.rksl = record.purchaseQuantity;
return;
}
record.wrksl = b;
// rksl wrksl
// 使
// 1使 Vue 使
// this.$forceUpdate();
// 2 dataSource
const index = dataSource.value.findIndex(item => item.id === record.id);
if (index !== -1) {
dataSource.value[index] = { ...record };
dataSource.value = [...dataSource.value]; //
}
};
const handleRkslChange = (record, field, value) => {
//
record[field] = value;
// // 2 dataSource
// const index = dataSource.value.findIndex(item => item.id === record.id);
// if (index !== -1) {
// dataSource.value[index] = { ...record };
// dataSource.value = [...dataSource.value]; //
// }
};
//
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return false;
}else{
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
getCgdInfoList();
});
}
function getCgdInfoList() {
defHttp.get({ url: '/cgd/nuInvoicingCgdInfo/list', params: { cgdId: formData.id,pageSize:-1 } }).then((res) => {
console.log("🚀 ~ getCgdInfoList ~ res:", res)
dataSource.value = res.records;
for (let i = 0; i < dataSource.value.length; i++) {
const element = dataSource.value[i];
element.rksl = element.purchaseQuantity;
element.wrksl = 0;
element.arrivalPrice = element.procurementPrice;
}
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
console.log("🚀 ~ submitForm ~ model.status:", model.status)
if(model.status == '3'){
model.cgdType = '9'
}
console.log("🚀 ~ submitForm ~ model:", model)
model.cgdInfoList = dataSource.value;
await rukuInfo(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
</style>

View File

@ -0,0 +1,82 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
<NuInvoicingCgdDetailForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuInvoicingCgdDetailForm>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import NuInvoicingCgdDetailForm from './NuInvoicingCgdDetailForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<string>('90%');
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = disableSubmit.value ? '详情' : '编辑';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
add,
edit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>

View File

@ -25,12 +25,12 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="供应商联系人" v-bind="validateInfos.gysLxr" id="NuInvoicingCgdMainForm-gysLxr" name="gysLxr"> <a-form-item label="联系人" v-bind="validateInfos.gysLxr" id="NuInvoicingCgdMainForm-gysLxr" name="gysLxr">
<span>{{formData.gysLxr}}</span> <span>{{formData.gysLxr}}</span>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="供应商联系电话" v-bind="validateInfos.gysLxrdh" id="NuInvoicingCgdMainForm-gysLxrdh" name="gysLxrdh"> <a-form-item label="联系电话" v-bind="validateInfos.gysLxrdh" id="NuInvoicingCgdMainForm-gysLxrdh" name="gysLxrdh">
<span>{{formData.gysLxrdh}}</span> <span>{{formData.gysLxrdh}}</span>
</a-form-item> </a-form-item>
</a-col> </a-col>

View File

@ -1,6 +1,6 @@
<template> <template>
<a-drawer :title="title" :width="`70vw`" v-model:visible="visible" :closable="true" <a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" @close="handleCancel"> :footer-style="{ textAlign: 'right' }" @close="handleCancel">
<NuInvoicingCgdMainForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuInvoicingCgdMainForm> <NuInvoicingCgdMainForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuInvoicingCgdMainForm>
<template #footer> <template #footer>
@ -16,7 +16,7 @@
import JModal from '/@/components/Modal/src/JModal/JModal.vue'; import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>(''); const title = ref<string>('');
const width = ref<number>(800); const width = ref<string>('90%');
const visible = ref<boolean>(false); const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false); const disableSubmit = ref<boolean>(false);
const registerForm = ref(); const registerForm = ref();

View File

@ -0,0 +1,322 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuInvoicingCgdMainForm">
<a-row>
<a-col :span="8">
<a-form-item label="采购单单号" v-bind="validateInfos.cgdNo" id="NuInvoicingCgdMainForm-cgdNo" name="cgdNo">
<span>{{formData.cgdNo}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="请购时间" v-bind="validateInfos.qgDate" id="NuInvoicingCgdMainForm-qgDate" name="qgDate">
<span>{{formData.qgDate}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="请购人" v-bind="validateInfos.qgBy" id="NuInvoicingCgdMainForm-qgBy" name="qgBy">
<span>{{formData.qgBy}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商" v-bind="validateInfos.gysId" id="NuInvoicingCgdMainForm-gysId" name="gysId">
<span>{{formData.gysId_dictText}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="联系人" v-bind="validateInfos.gysLxr" id="NuInvoicingCgdMainForm-gysLxr" name="gysLxr">
<span>{{formData.gysLxr}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="联系电话" v-bind="validateInfos.gysLxrdh" id="NuInvoicingCgdMainForm-gysLxrdh" name="gysLxrdh">
<span>{{formData.gysLxrdh}}</span>
</a-form-item>
</a-col>
<!-- <a-col :span="8">
<a-form-item label="采购单类型" v-bind="validateInfos.cgdType" id="NuInvoicingCgdMainForm-cgdType" name="cgdType">
<span>{{formData.cgdType_dictText}}</span>
</a-form-item>
</a-col> -->
<!--
<a-col :span="8">
<a-form-item label="销账单" v-bind="validateInfos.xzdPath" id="NuInvoicingCgdMainForm-xzdPath" name="xzdPath">
<j-image-upload :fileMax="0" v-model:value="formData.xzdPath" ></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结账单" v-bind="validateInfos.jzdPath" id="NuInvoicingCgdMainForm-jzdPath" name="jzdPath">
<j-image-upload :fileMax="0" v-model:value="formData.jzdPath" ></j-image-upload>
</a-form-item>
</a-col> -->
<!-- <a-col :span="8">
<a-form-item label="审核状态" v-bind="validateInfos.status" id="NuInvoicingCgdMainForm-status" name="status">
<a-select v-model:value="formData.status" :disabled="disabled" placeholder="请选择审核状态">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="1">审核通过</a-select-option>
<a-select-option value="3">作废</a-select-option>
</a-select>
</a-form-item>
</a-col> -->
<a-col :span="8">
<a-form-item label="审核人" v-bind="validateInfos.reviewedBy" id="NuInvoicingCgdMainForm-reviewedBy" name="reviewedBy">
<span>{{formData.reviewedBy}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="审核时间" v-bind="validateInfos.reviewedTime" id="NuInvoicingCgdMainForm-reviewedTime" name="reviewedTime">
<span>{{formData.reviewedTime}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="付款方式" v-bind="validateInfos.gysFkfs" id="NuInvoicingCgdMainForm-gysFkfs" name="gysFkfs">
<span>{{formData.gysFkfs_dictText}}</span>
</a-form-item>
</a-col>
<a-col :span="24" >
<a-form-item label="审核备注" v-bind="validateInfos.content" id="NuInvoicingCgdMainForm-content" name="content" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<span>{{formData.content}}</span>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="随行单" v-bind="validateInfos.sxdPath" id="NuInvoicingCgdMainForm-sxdPath" name="sxdPath" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<j-image-upload :fileMax="0" v-model:value="formData.sxdPath" ></j-image-upload>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
<a-table
:columns="rkcolumns"
:row-key="id"
:data-source="dataSource"
:pagination="false"
:loading="loading"
@change="handleTableChange"
>
<template #bodyCell="{ column, text ,record }">
<template v-if="column.dataIndex === 'arrivalPrice'">
<a-input-number :value="text" placeholder="到货单价" min="0" max="999" @change="(value) => handleRkslChange(record, 'arrivalPrice', value)" />
</template>
<template v-if="column.dataIndex === 'rksl'">
<a-input-number :value="text" placeholder="入库数量" min="0" max="999" @change="(value) => handleInputChange(record, 'rksl', value)" />
</template>
</template>
</a-table>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { getValueType } from '/@/utils';
import { rukuInfo } from '../NuInvoicingCgdMain.api';
import { rkcolumns } from '../NuInvoicingCgdInfo.data';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { useUserStore } from '/@/store/modules/user';
import dayjs from 'dayjs';
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({})},
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const dataSource = ref([]);
const userStore = useUserStore();
const formData = reactive<Record<string, any>>({
id: '',
qgdId: '',
cgdNo: '',
gysId: '',
qgDate: '',
qgBy: '',
gysLxr: '',
gysLxrdh: '',
gysFkfs: '',
status: '',
cgdType: '',
sxdPath: '',
xzdPath: '',
jzdPath: '',
reviewedBy: '',
reviewedTime: '',
content: '',
gysId_dictText:'',
status_dictText:'',
cgdType_dictText:'',
gysFkfs_dictText:'',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 9 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 15 } });
const labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 3 } });
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 19 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
const handleInputChange = (record, field, value) => {
//
record[field] = value;
var b = record.purchaseQuantity - value;
if(b<0){
record.wrksl = 0;
record.rksl = record.purchaseQuantity;
return;
}
record.wrksl = b;
// rksl wrksl
// 使
// 1使 Vue 使
// this.$forceUpdate();
// 2 dataSource
const index = dataSource.value.findIndex(item => item.id === record.id);
if (index !== -1) {
dataSource.value[index] = { ...record };
dataSource.value = [...dataSource.value]; //
}
};
const handleRkslChange = (record, field, value) => {
//
record[field] = value;
// // 2 dataSource
// const index = dataSource.value.findIndex(item => item.id === record.id);
// if (index !== -1) {
// dataSource.value[index] = { ...record };
// dataSource.value = [...dataSource.value]; //
// }
};
//
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return false;
}else{
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
getCgdInfoList();
});
}
function getCgdInfoList() {
defHttp.get({ url: '/cgd/nuInvoicingCgdInfo/list', params: { cgdId: formData.id,pageSize:-1 } }).then((res) => {
console.log("🚀 ~ getCgdInfoList ~ res:", res)
dataSource.value = res.records;
for (let i = 0; i < dataSource.value.length; i++) {
const element = dataSource.value[i];
element.rksl = element.purchaseQuantity;
element.wrksl = 0;
element.arrivalPrice = element.procurementPrice;
}
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
console.log("🚀 ~ submitForm ~ model.status:", model.status)
if(model.status == '3'){
model.cgdType = '9'
}
console.log("🚀 ~ submitForm ~ model:", model)
model.cgdInfoList = dataSource.value;
await rukuInfo(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
</style>

View File

@ -0,0 +1,82 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
<NuInvoicingCgdRkdForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuInvoicingCgdRkdForm>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">入库</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import NuInvoicingCgdRkdForm from './NuInvoicingCgdRkdForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<string>('90%');
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = disableSubmit.value ? '详情' : '编辑';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
add,
edit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>