修改盘点流程计功能

This commit is contained in:
yangjun 2026-04-23 10:19:42 +08:00
parent 79facad90c
commit 2e623df6d5
11 changed files with 352 additions and 209 deletions

View File

@ -133,12 +133,12 @@ export const rkcolumns: BasicColumn[] = [
dataIndex: 'procurementPrice',
width: 90
},
// {
// title: '到货价格',
// align: "center",
// dataIndex: 'arrivalPrice',
// width: 100
// },
{
title: '到货价格',
align: "center",
dataIndex: 'arrivalPrice',
width: 90
},
{
title: '采购数量',
align: "center",

View File

@ -34,6 +34,11 @@
<span>{{formData.procurementPrice}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="到货价格" v-bind="validateInfos.arrivalPrice" id="NuInvoicingCgdMainForm-arrivalPrice" name="arrivalPrice">
<span>{{formData.arrivalPrice}}</span>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="采购数量" v-bind="validateInfos.purchaseQuantity" id="NuInvoicingCgdMainForm-purchaseQuantity" name="purchaseQuantity">
<span>{{formData.purchaseQuantity}}</span>
@ -52,7 +57,7 @@
<a-col :span="8">
<a-form-item label="入库类型" v-bind="validateInfos.jhType" id="NuInvoicingCgdMainForm-rksl" name="jhType">
<a-radio-group v-model:value="formData.jhType">
<a-radio :value="0">入库</a-radio>
<a-radio :value="0" checked>入库</a-radio>
<a-radio :value="1">销账</a-radio>
</a-radio-group>
</a-form-item>
@ -162,11 +167,6 @@
*/
function edit(record) {
console.log("🚀 ~ edit ~ record:", record)
var purchaseQuantity = record.purchaseQuantity;
record.yrksl = record.rksl;
var xzsl = record.xzsl;
var rksl = record.wrksl == 0 ? purchaseQuantity - xzsl : record.wrksl;
record.rksl = rksl;
nextTick(() => {
resetFields();
const tmpData = {};
@ -175,8 +175,14 @@
tmpData[key] = record[key]
}
})
var purchaseQuantity = record.purchaseQuantity;
record.yrksl = record.rksl;
var xzsl = record.xzsl;
var rksl = record.wrksl == 0 ? purchaseQuantity - xzsl : record.wrksl;
//
Object.assign(formData, tmpData);
formData.rksl = rksl;
formData.jhType = 0;
});
}

View File

@ -34,53 +34,6 @@
<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>
@ -99,18 +52,12 @@
<!-- :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" @blur="(value) => handleInputChange(record, 'rksl', value)" />
</template> -->
<template v-if="column.dataIndex === 'action'">
<a @click="handleJianhuo(record)" v-if="record.purchaseQuantity - record.rksl - record.xzsl != 0">拣货</a>
</template>
</template>
</a-table>
<!-- 物料拣货 -->
<NuInvoicingCgdJhModal ref="jhModal" @success="handleJhOk"></NuInvoicingCgdJhModal>
</a-spin>
</template>

View File

@ -14,6 +14,8 @@ enum Api {
importExcel = '/invoicing/blWarehouseMaterialInfo/importExcel',
exportXls = '/invoicing/blWarehouseMaterialInfo/exportXls',
getConfiguredList = '/invoicing/configMaterialInfo/getConfiguredList',
getCkWlList = '/api/pad/invoicing/getCkWlList',
editXsjg='/api/pad/invoicing/editXsjg',
}
/**
@ -32,6 +34,7 @@ export const getImportUrl = Api.importExcel;
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
export const getCkWlList = (params) => defHttp.get({ url: Api.getCkWlList, params });
/**
*
@ -94,3 +97,6 @@ export const saveOrUpdate = (params, isUpdate) => {
export const editFzr = (params, isUpdate) => {
return defHttp.post({ url: Api.editFzr, params }, { isTransformResponse: false });
}
export const editXsjg = (params, isUpdate) => {
return defHttp.post({ url: Api.editXsjg, params }, { isTransformResponse: false });
}

View File

@ -8,7 +8,7 @@ export const columns: BasicColumn[] = [
{
title: '护理单元',
align: "center",
dataIndex: 'nuName'
dataIndex: 'nuId'
},
{
title: '单号',
@ -18,7 +18,7 @@ export const columns: BasicColumn[] = [
{
title: '物料名称',
align: "center",
dataIndex: 'wlId_dictText'
dataIndex: 'materialName'
},
{
title: '物料编码',
@ -46,6 +46,24 @@ export const columns: BasicColumn[] = [
dataIndex: 'kcsl',
width: 100
},
{
title: '采购价格',
align: "center",
dataIndex: 'procurementPrice',
width: 100
},
{
title: '到货价格',
align: "center",
dataIndex: 'arrivalPrice',
width: 100
},
{
title: '销售价格',
align: "center",
dataIndex: 'xsjg',
width: 100
},
];
export const columns2: BasicColumn[] = [

View File

@ -5,32 +5,31 @@
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
:wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6" hidden>
<a-col :lg="6">
<a-form-item name="nuId">
<template #label><span title="库房">库房</span></template>
<j-dict-select-tag type='list' placeholder="请选择库房" v-model:value="queryParam.nuId"
dictCode="nu_base_info,nu_name,nu_id,area_flag = '3'" allow-clear />
dictCode="nu_base_info,nu_name,nu_id" allow-clear />
</a-form-item>
</a-col>
<a-col :lg="5">
<a-col :lg="6">
<a-form-item name="wlParamInfo">
<template #label><span title="物料信息">物料信息</span></template>
<a-input placeholder="请填写物料信息" v-model:value="queryParam.wlParamInfo" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :lg="5">
<!-- <a-col :lg="6">
<a-form-item name="categoryId">
<template #label><span title="一级分类">一级分类</span></template>
<j-dict-select-tag v-model:value="queryParam.categoryId"
:dictCode="`nu_config_material_category,category_name,id,del_flag = 0 and iz_enabled = 0 order by sort asc`"
placeholder="请选择一级分类" allowClear :ignoreDisabled="true"
@select="handleSearch({ 'levle': 1, 'key': queryParam.categoryId }, false)" />
<!-- <span v-else>请选择源平台</span> -->
</a-form-item>
</a-col>
<a-col :lg="5">
<a-col :lg="6">
<a-form-item name="typeId">
<template #label><span title="二级分类">二级分类</span></template>
<j-dict-select-tag type="list" v-model:value="queryParam.typeId"
@ -40,7 +39,7 @@
</a-form-item>
</a-col>
<a-col :lg="5">
<a-col :lg="6">
<a-form-item name="medicationId">
<template #label><span title="三级分类">三级分类</span></template>
<j-dict-select-tag type="list" v-model:value="queryParam.medicationId"
@ -48,7 +47,7 @@
placeholder="请选择三级分类" allowClear :ignoreDisabled="true"
@select="handleSearch({ 'levle': 3, 'categoryId': queryParam.categoryId, 'typeId': queryParam.typeId, 'key': queryParam.medicationId }, false)" />
</a-form-item>
</a-col>
</a-col> -->
<a-col :xl="2" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
@ -66,10 +65,10 @@
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'warehouseMaterialInfo:bl_warehouse_material_info:add'" @click="handleAdd"
<!-- <a-button type="primary" v-auth="'warehouseMaterialInfo:bl_warehouse_material_info:add'" @click="handleAdd"
preIcon="ant-design:plus-outlined"> 添加物料</a-button>
<a-button type="primary" v-auth="'warehouseMaterialInfo:bl_warehouse_material_info:add'" @click="handleDel"
preIcon="ant-design:plus-outlined"> 移除物料</a-button>
preIcon="ant-design:plus-outlined"> 移除物料</a-button> -->
</template>
<!--操作栏-->
<template #action="{ record }">
@ -84,9 +83,13 @@
<CheckWuliaoModal ref="registerAddModal" @success="handleSuccess"></CheckWuliaoModal>
<!-- 移除物料 -->
<DelWuliaoModal ref="registerDelModal" @success="handleSuccess"></DelWuliaoModal>
<!-- 出入库详情 -->
<NuWarehouseMaterialCrkInfoListModal ref="registerCrkModal" @success="handleSuccess">
</NuWarehouseMaterialCrkInfoListModal>
<NuWarehouseMaterialCrkInfoListModal ref="registerCrkModal" @success="handleSuccess"></NuWarehouseMaterialCrkInfoListModal>
<!-- 销售价格 -->
<BlWarehouseXsjgModal ref="xsjgModal" @success="handleSuccess"></BlWarehouseXsjgModal>
</div>
</template>
@ -95,12 +98,13 @@ import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './BlWarehouseMaterialInfo.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './BlWarehouseMaterialInfo.api';
import { getCkWlList, deleteOne, batchDelete } from './BlWarehouseMaterialInfo.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import BlWarehouseMaterialInfoModal from './components/BlWarehouseMaterialInfoModal.vue'
import CheckWuliaoModal from './components/CheckWuliaoModal.vue'
import DelWuliaoModal from './components/DelWuliaoModal.vue'
import NuWarehouseMaterialCrkInfoListModal from '/@/views/invoicing/warehouseMaterialInfo/NuWarehouseMaterialCrkInfoListModal.vue'
import BlWarehouseXsjgModal from '/@/views/invoicing/warehouseMaterialInfo/components/BlWarehouseXsjgModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
@ -117,13 +121,14 @@ const registerModal = ref();
const registerAddModal = ref();
const registerDelModal = ref();
const registerCrkModal = ref();
const xsjgModal = ref();
const userStore = useUserStore();
const { createConfirm, createMessage} = useMessage();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '库房物料配置信息',
api: list,
api: getCkWlList,
columns,
canResize: false,
useSearchForm: false,
@ -136,15 +141,6 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "库房物料配置信息",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
@ -158,69 +154,15 @@ const wrapperCol = reactive({
sm: 18,
});
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
searchQuery();
}
/**
* 新增事件
*/
function handleAdd() {
var params = { nuId: queryParam.nuId }
registerAddModal.value.disableSubmit = false;
registerAddModal.value.edit(params);
}
/**
* 新增事件
*/
function handleDel() {
var params = { nuId: queryParam.nuId }
registerDelModal.value.disableSubmit = false;
registerDelModal.value.edit(params);
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
//
function handleCrkjl(record: Recordable) {
registerCrkModal.value.disableSubmit = true;
registerCrkModal.value.init(record);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
function handleXsjg(record: Recordable) {
xsjgModal.value.disableSubmit = false;
xsjgModal.value.edit(record);
}
/**
@ -235,30 +177,17 @@ function handleSuccess() {
*/
function getTableAction(record) {
return [
// {
// label: '',
// onClick: handleEdit.bind(null, record),
// auth: 'warehouseMaterialInfo:bl_warehouse_material_info:edit'
// },
// {
// label: '',
// onClick: handleDetail.bind(null, record),
// },
{
label: '启用',
onClick: handleQyty.bind(null, record, 'Y'),
auth: 'warehouseMaterialInfo:bl_warehouse_material_info:edit',
ifShow: record.izEnabled == 'N'
label: '盘点',
onClick: handleCrkjl.bind(null, record),
},
{
label: '停用',
onClick: handleQyty.bind(null, record, 'N'),
auth: 'warehouseMaterialInfo:bl_warehouse_material_info:edit',
ifShow: record.izEnabled == 'Y'
label: '出入库',
onClick: handleCrkjl.bind(null, record),
},
{
label: '记录',
onClick: handleCrkjl.bind(null, record, '1'),
label: '销售价格',
onClick: handleXsjg.bind(null, record),
},
];
}

View File

@ -5,6 +5,7 @@ const { createConfirm } = useMessage();
enum Api {
list = '/cgd/nuWarehouseMaterialCrkInfo/list',
queryCrkInfoList = '/api/pad/invoicing/queryCrkInfoList',
save='/cgd/nuWarehouseMaterialCrkInfo/add',
edit='/cgd/nuWarehouseMaterialCrkInfo/edit',
deleteOne = '/cgd/nuWarehouseMaterialCrkInfo/delete',
@ -29,6 +30,7 @@ export const getImportUrl = Api.importExcel;
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryCrkInfoList = (params) => defHttp.get({ url: Api.queryCrkInfoList, params });
/**
*

View File

@ -15,6 +15,11 @@ export const columns: BasicColumn[] = [
align: "center",
dataIndex: 'nuId_dictText'
},
{
title: '单号',
align: "center",
dataIndex: 'ddNo'
},
{
title: '物料',
align: "center",
@ -25,15 +30,25 @@ export const columns: BasicColumn[] = [
align: "center",
dataIndex: 'czqkcl'
},
{
title: '当前库存量',
align: "center",
dataIndex: 'dqkcl'
},
{
title: '出入库数量',
align: "center",
dataIndex: 'crkNum'
},
{
title: '当前库存量',
title: '挂账数量',
align: "center",
dataIndex: 'dqkcl'
dataIndex: 'gzsl'
},
{
title: '销账数量',
align: "center",
dataIndex: 'xzsl'
},
{
title: '出入库类型',
@ -41,10 +56,15 @@ export const columns: BasicColumn[] = [
dataIndex: 'crkType_dictText'
},
{
title: '备注',
title: '采购人',
align: "center",
dataIndex: 'content'
dataIndex: 'cgBy'
},
// {
// title: '备注',
// align: "center",
// dataIndex: 'content'
// },
{
title: '操作时间',
align: "center",

View File

@ -35,7 +35,7 @@
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
<TableAction />
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
@ -50,7 +50,7 @@
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './NuWarehouseMaterialCrkInfo.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuWarehouseMaterialCrkInfo.api';
import { queryCrkInfoList, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuWarehouseMaterialCrkInfo.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import NuWarehouseMaterialCrkInfoModal from './components/NuWarehouseMaterialCrkInfoModal.vue'
import { useUserStore } from '/@/store/modules/user';
@ -65,7 +65,7 @@ import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectT
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '库房物料出入库信息',
api: list,
api: queryCrkInfoList,
columns,
canResize:false,
useSearchForm: false,
@ -79,15 +79,6 @@ import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectT
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "库房物料出入库信息",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
@ -101,26 +92,6 @@ import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectT
sm: 20,
});
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
searchQuery();
}
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
@ -145,12 +116,6 @@ import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectT
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
@ -210,8 +175,10 @@ import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectT
}
function init(record) {
console.log("🚀 ~ init ~ record:", record)
queryParam.nuId = record.nuId;
queryParam.wlId = record.wlId;
queryParam.cgdId = record.cgdId;
reload();
}

View File

@ -0,0 +1,165 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="BlWarehouseMaterialInfoForm">
<a-row>
<a-col :span="24">
<a-form-item label="物料" v-bind="validateInfos.materialName" id="BlWarehouseMaterialInfoForm-materialName" name="materialName" >
<a-input v-model:value="formData.materialName" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="采购价格" v-bind="validateInfos.procurementPrice" id="BlWarehouseMaterialInfoForm-procurementPrice" name="procurementPrice" >
<a-input v-model:value="formData.procurementPrice" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="到货价格" v-bind="validateInfos.arrivalPrice" id="BlWarehouseMaterialInfoForm-arrivalPrice" name="arrivalPrice" >
<a-input v-model:value="formData.arrivalPrice" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="销售价格" v-bind="validateInfos.xsjg" id="BlWarehouseMaterialInfoForm-xsjg" name="xsjg" >
<a-input-number style="width: 100%;" v-model:value="formData.xsjg" placeholder="请输入销售价格" ></a-input-number>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</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 { getValueType } from '/@/utils';
import { editXsjg } from '../BlWarehouseMaterialInfo.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
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 formData = reactive<Record<string, any>>({
id: '',
materialName:'',
arrivalPrice:'',
procurementPrice: '',
xsjg: undefined,
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
xsjg: [{ required: true, message: '请输入销售价格!' },],
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
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) {
console.log("🚀 ~ edit ~ record:", record)
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
});
}
/**
* 提交数据
*/
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(',');
}
}
}
await editXsjg(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,83 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
<BlWarehouseXsjgForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></BlWarehouseXsjgForm>
<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 BlWarehouseXsjgForm from './BlWarehouseXsjgForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<number>(800);
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>