添加盘点单页面
This commit is contained in:
parent
824e1f5940
commit
7a1cf615fd
|
|
@ -0,0 +1,72 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/pdd/nuInvoicingPddInfo/list',
|
||||
save='/pdd/nuInvoicingPddInfo/add',
|
||||
edit='/pdd/nuInvoicingPddInfo/edit',
|
||||
deleteOne = '/pdd/nuInvoicingPddInfo/delete',
|
||||
deleteBatch = '/pdd/nuInvoicingPddInfo/deleteBatch',
|
||||
importExcel = '/pdd/nuInvoicingPddInfo/importExcel',
|
||||
exportXls = '/pdd/nuInvoicingPddInfo/exportXls',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
* @param 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();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
* @param isUpdate
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
// {
|
||||
// title: '盘点单id',
|
||||
// align: "center",
|
||||
// dataIndex: 'pddId_dictText'
|
||||
// },
|
||||
// {
|
||||
// title: '库房id',
|
||||
// align: "center",
|
||||
// dataIndex: 'nuId'
|
||||
// },
|
||||
// {
|
||||
// title: '物料id',
|
||||
// align: "center",
|
||||
// dataIndex: 'wlId'
|
||||
// },
|
||||
{
|
||||
title: '一级分类',
|
||||
align: "center",
|
||||
dataIndex: 'categoryName'
|
||||
},
|
||||
{
|
||||
title: '二级分类',
|
||||
align: "center",
|
||||
dataIndex: 'typeName'
|
||||
},
|
||||
{
|
||||
title: '三级分类',
|
||||
align: "center",
|
||||
dataIndex: 'medicationName'
|
||||
},
|
||||
{
|
||||
title: '货品名称',
|
||||
align: "center",
|
||||
dataIndex: 'materialName'
|
||||
},
|
||||
{
|
||||
title: '货品编码',
|
||||
align: "center",
|
||||
dataIndex: 'materialNo'
|
||||
},
|
||||
{
|
||||
title: '规格型号',
|
||||
align: "center",
|
||||
dataIndex: 'specificationModel'
|
||||
},
|
||||
{
|
||||
title: '当前库存数量',
|
||||
align: "center",
|
||||
dataIndex: 'dqkcsl'
|
||||
},
|
||||
{
|
||||
title: '盘点数量',
|
||||
align: "center",
|
||||
dataIndex: 'pdsl'
|
||||
},
|
||||
{
|
||||
title: '差额数量',
|
||||
align: "center",
|
||||
dataIndex: 'cesl'
|
||||
},
|
||||
{
|
||||
title: '货品单位',
|
||||
align: "center",
|
||||
dataIndex: 'materialUnits'
|
||||
},
|
||||
{
|
||||
title: '盈亏类型',
|
||||
align: "center",
|
||||
dataIndex: 'pdType_dictText'
|
||||
},
|
||||
{
|
||||
title: '备注信息',
|
||||
align: "center",
|
||||
dataIndex: 'content'
|
||||
},
|
||||
{
|
||||
title: '拍照图片',
|
||||
align: "center",
|
||||
dataIndex: 'picPath'
|
||||
},
|
||||
// {
|
||||
// title: '物料图片',
|
||||
// align: "center",
|
||||
// dataIndex: 'materialImg'
|
||||
// },
|
||||
];
|
||||
|
||||
// 高级查询数据
|
||||
export const superQuerySchema = {
|
||||
pddId: {title: '盘点单id',order: 0,view: 'list', type: 'string',dictTable: "nu_invoicing_pdd_main", dictCode: 'id', dictText: 'pdd_no',},
|
||||
nuId: {title: '库房id',order: 1,view: 'text', type: 'string',},
|
||||
wlId: {title: '物料id',order: 2,view: 'text', type: 'string',},
|
||||
dqkcsl: {title: '当前库存数量',order: 3,view: 'number', type: 'number',},
|
||||
pdsl: {title: '盘点数量',order: 4,view: 'number', type: 'number',},
|
||||
cesl: {title: '差额数量',order: 5,view: 'number', type: 'number',},
|
||||
pdType: {title: '盘点类型 1盘盈单 2盘亏单',order: 6,view: 'text', type: 'string',},
|
||||
content: {title: '备注信息',order: 7,view: 'text', type: 'string',},
|
||||
picPath: {title: '拍照图片',order: 8,view: 'textarea', type: 'string',},
|
||||
categoryId: {title: '物料类别',order: 9,view: 'text', type: 'string',},
|
||||
typeId: {title: '物料类型',order: 10,view: 'text', type: 'string',},
|
||||
medicationId: {title: '用药类型',order: 11,view: 'text', type: 'string',},
|
||||
materialName: {title: '货品名称',order: 12,view: 'text', type: 'string',},
|
||||
materialNo: {title: '货品编码',order: 13,view: 'text', type: 'string',},
|
||||
specificationModel: {title: '规格型号',order: 14,view: 'text', type: 'string',},
|
||||
materialImg: {title: '物料图片',order: 15,view: 'text', type: 'string',},
|
||||
materialUnits: {title: '货品单位',order: 16,view: 'text', type: 'string',},
|
||||
};
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--查询区域-->
|
||||
<!-- <div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div> -->
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<span style="font-size: 15px;font-weight: bold;">盘点信息</span>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<NuInvoicingPddInfoModal ref="registerModal" @success="handleSuccess"></NuInvoicingPddInfoModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="pdd-nuInvoicingPddInfo" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns, superQuerySchema } from './NuInvoicingPddInfo.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuInvoicingPddInfo.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import NuInvoicingPddInfoModal from './components/NuInvoicingPddInfoModal.vue'
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
const pddId = ref()
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '进销存-盘点单物料详细信息',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
useSearchForm: false,
|
||||
showActionColumn: false,
|
||||
showTableSetting: false,
|
||||
immediate: false,
|
||||
showIndexColumn: true,
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
queryParam.pddId = pddId.value
|
||||
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({
|
||||
xs:24,
|
||||
sm:4,
|
||||
xl:6,
|
||||
xxl:4
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
registerModal.value.disableSubmit = true;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
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 getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'pdd:nu_invoicing_pdd_info:edit'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'pdd:nu_invoicing_pdd_info:delete'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
function init(pddId_) {
|
||||
pddId.value = pddId_
|
||||
reload();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.query-group-cust{
|
||||
min-width: 100px !important;
|
||||
}
|
||||
.query-group-split-cust{
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
}
|
||||
.ant-form-item:not(.ant-form-item-with-help){
|
||||
margin-bottom: 16px;
|
||||
height: 32px;
|
||||
}
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/pdd/nuInvoicingPddMain/list',
|
||||
save='/pdd/nuInvoicingPddMain/add',
|
||||
edit='/pdd/nuInvoicingPddMain/edit',
|
||||
deleteOne = '/pdd/nuInvoicingPddMain/delete',
|
||||
deleteBatch = '/pdd/nuInvoicingPddMain/deleteBatch',
|
||||
importExcel = '/pdd/nuInvoicingPddMain/importExcel',
|
||||
exportXls = '/pdd/nuInvoicingPddMain/exportXls',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
* @param 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();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
* @param isUpdate
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '单号',
|
||||
align: "center",
|
||||
dataIndex: 'pddNo'
|
||||
},
|
||||
{
|
||||
title: '盘点单发起人',
|
||||
align: "center",
|
||||
dataIndex: 'pddStartBy'
|
||||
},
|
||||
{
|
||||
title: '发起时间',
|
||||
align: "center",
|
||||
dataIndex: 'pddStartTime'
|
||||
},
|
||||
{
|
||||
title: '完成人',
|
||||
align: "center",
|
||||
dataIndex: 'pddEndBy'
|
||||
},
|
||||
{
|
||||
title: '完成时间',
|
||||
align: "center",
|
||||
dataIndex: 'pddEndTime'
|
||||
},
|
||||
{
|
||||
title: '仓库',
|
||||
align: "center",
|
||||
dataIndex: 'nuName'
|
||||
},
|
||||
{
|
||||
title: '是否是盘盈单',
|
||||
align: "center",
|
||||
dataIndex: 'pydNum',
|
||||
customRender:function ({text}) {
|
||||
return parseInt(text)>=1?'是':'否';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '是否是盘亏单',
|
||||
align: "center",
|
||||
dataIndex: 'pkdNum',
|
||||
customRender:function ({text}) {
|
||||
return parseInt(text)>=1?'是':'否';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '盘点单类型',
|
||||
align: "center",
|
||||
dataIndex: 'pddType_dictText'
|
||||
},
|
||||
// {
|
||||
// title: '盘点单状态 1盘点中 2盘点结束',
|
||||
// align: "center",
|
||||
// dataIndex: 'pddStatus_dictText'
|
||||
// },
|
||||
];
|
||||
|
||||
// 高级查询数据
|
||||
export const superQuerySchema = {
|
||||
pddNo: {title: '盘点单单号',order: 0,view: 'text', type: 'string',},
|
||||
pddType: {title: '盘点单类型 1盘点中 2已完成 3作废',order: 1,view: 'list', type: 'string',dictCode: 'pdd_type',},
|
||||
pddStatus: {title: '盘点单状态 1盘点中 2盘点结束',order: 2,view: 'list', type: 'string',dictCode: 'pdd_status',},
|
||||
pddStartBy: {title: '盘点单发起人',order: 3,view: 'text', type: 'string',},
|
||||
pddStartTime: {title: '盘点单发起时间',order: 4,view: 'datetime', type: 'string',},
|
||||
pddEndBy: {title: '盘点单完成人',order: 5,view: 'text', type: 'string',},
|
||||
pddEndTime: {title: '盘点单完成时间',order: 6,view: 'datetime', type: 'string',},
|
||||
nuId: {title: '对应仓库',order: 7,view: 'text', type: 'string',},
|
||||
pydNum: {title: '盘盈单数量 0是没有 其他是具体数字',order: 8,view: 'text', type: 'string',},
|
||||
pkdNum: {title: '盘亏单数量 0是没有 其他是具体数字',order: 9,view: 'number', type: 'number',},
|
||||
serverId: {title: '服务指令id (预留字段)',order: 10,view: 'text', type: 'string',},
|
||||
};
|
||||
|
|
@ -0,0 +1,261 @@
|
|||
<template>
|
||||
<div class="p-2">
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="pddNo">
|
||||
<template #label><span title="盘点单单号">单号</span></template>
|
||||
<j-input placeholder="请输入盘点单单号" v-model:value="queryParam.pddNo" allow-clear ></j-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="pddStartTime">
|
||||
<template #label><span title="盘点时间">盘点时间</span></template>
|
||||
<a-range-picker showTime value-format="YYYY-MM-DD HH:mm:ss" v-model:value="queryParam.pddStartTime" class="query-group-cust"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<!-- <a-button type="primary" v-auth="'pdd:nu_invoicing_pdd_main:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
<a-button type="primary" v-auth="'pdd:nu_invoicing_pdd_main:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||
<j-upload-button type="primary" v-auth="'pdd:nu_invoicing_pdd_main: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"></Icon>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'pdd:nu_invoicing_pdd_main:deleteBatch'">批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown> -->
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<NuInvoicingPddMainModal ref="registerModal" @success="handleSuccess"></NuInvoicingPddMainModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="pdd-nuInvoicingPddMain" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns, superQuerySchema } from './NuInvoicingPddMain.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuInvoicingPddMain.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import NuInvoicingPddMainModal from './components/NuInvoicingPddMainModal.vue'
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { cloneDeep } from "lodash-es";
|
||||
|
||||
import { JInput} from '/@/components/Form';
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '进销存-盘点单主表',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
useSearchForm: false,
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
let rangerQuery = await setRangeQuery();
|
||||
return Object.assign(params, rangerQuery);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: "进销存-盘点单主表",
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const labelCol = reactive({
|
||||
xs:24,
|
||||
sm:4,
|
||||
xl:6,
|
||||
xxl:4
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
registerModal.value.disableSubmit = true;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
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 getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let rangeField = 'pddStartTime,'
|
||||
|
||||
/**
|
||||
* 设置范围查询条件
|
||||
*/
|
||||
async function setRangeQuery(){
|
||||
let queryParamClone = cloneDeep(queryParam);
|
||||
if (rangeField) {
|
||||
let fieldsValue = rangeField.split(',');
|
||||
fieldsValue.forEach(item => {
|
||||
if (queryParamClone[item]) {
|
||||
let range = queryParamClone[item];
|
||||
queryParamClone[item+'_begin'] = range[0];
|
||||
queryParamClone[item+'_end'] = range[1];
|
||||
delete queryParamClone[item];
|
||||
} else {
|
||||
queryParamClone[item+'_begin'] = '';
|
||||
queryParamClone[item+'_end'] = '';
|
||||
}
|
||||
})
|
||||
}
|
||||
return queryParamClone;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.query-group-cust{
|
||||
min-width: 100px !important;
|
||||
}
|
||||
.query-group-split-cust{
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
}
|
||||
.ant-form-item:not(.ant-form-item-with-help){
|
||||
margin-bottom: 16px;
|
||||
height: 32px;
|
||||
}
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<JFormContainer :disabled="disabled">
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuInvoicingPddInfoForm">
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="盘点单id" v-bind="validateInfos.pddId" id="NuInvoicingPddInfoForm-pddId" name="pddId">
|
||||
<j-dict-select-tag v-model:value="formData.pddId" dictCode="nu_invoicing_pdd_main,pdd_no,id" placeholder="请选择盘点单id" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="库房id" v-bind="validateInfos.nuId" id="NuInvoicingPddInfoForm-nuId" name="nuId">
|
||||
<a-input v-model:value="formData.nuId" placeholder="请输入库房id" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="物料id" v-bind="validateInfos.wlId" id="NuInvoicingPddInfoForm-wlId" name="wlId">
|
||||
<a-input v-model:value="formData.wlId" placeholder="请输入物料id" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="当前库存数量" v-bind="validateInfos.dqkcsl" id="NuInvoicingPddInfoForm-dqkcsl" name="dqkcsl">
|
||||
<a-input-number v-model:value="formData.dqkcsl" placeholder="请输入当前库存数量" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="盘点数量" v-bind="validateInfos.pdsl" id="NuInvoicingPddInfoForm-pdsl" name="pdsl">
|
||||
<a-input-number v-model:value="formData.pdsl" placeholder="请输入盘点数量" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="差额数量" v-bind="validateInfos.cesl" id="NuInvoicingPddInfoForm-cesl" name="cesl">
|
||||
<a-input-number v-model:value="formData.cesl" placeholder="请输入差额数量" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="盘点类型 1盘盈单 2盘亏单" v-bind="validateInfos.pdType" id="NuInvoicingPddInfoForm-pdType" name="pdType">
|
||||
<a-input v-model:value="formData.pdType" placeholder="请输入盘点类型 1盘盈单 2盘亏单" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="备注信息" v-bind="validateInfos.content" id="NuInvoicingPddInfoForm-content" name="content">
|
||||
<a-input v-model:value="formData.content" placeholder="请输入备注信息" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="拍照图片" v-bind="validateInfos.picPath" id="NuInvoicingPddInfoForm-picPath" name="picPath">
|
||||
<a-textarea v-model:value="formData.picPath" :rows="4" placeholder="请输入拍照图片" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="物料类别" v-bind="validateInfos.categoryId" id="NuInvoicingPddInfoForm-categoryId" name="categoryId">
|
||||
<a-input v-model:value="formData.categoryId" placeholder="请输入物料类别" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="物料类型" v-bind="validateInfos.typeId" id="NuInvoicingPddInfoForm-typeId" name="typeId">
|
||||
<a-input v-model:value="formData.typeId" placeholder="请输入物料类型" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="用药类型" v-bind="validateInfos.medicationId" id="NuInvoicingPddInfoForm-medicationId" name="medicationId">
|
||||
<a-input v-model:value="formData.medicationId" placeholder="请输入用药类型" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="货品名称" v-bind="validateInfos.materialName" id="NuInvoicingPddInfoForm-materialName" name="materialName">
|
||||
<a-input v-model:value="formData.materialName" placeholder="请输入货品名称" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="货品编码" v-bind="validateInfos.materialNo" id="NuInvoicingPddInfoForm-materialNo" name="materialNo">
|
||||
<a-input v-model:value="formData.materialNo" placeholder="请输入货品编码" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="规格型号" v-bind="validateInfos.specificationModel" id="NuInvoicingPddInfoForm-specificationModel" name="specificationModel">
|
||||
<a-input v-model:value="formData.specificationModel" placeholder="请输入规格型号" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="物料图片" v-bind="validateInfos.materialImg" id="NuInvoicingPddInfoForm-materialImg" name="materialImg">
|
||||
<a-input v-model:value="formData.materialImg" placeholder="请输入物料图片" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="货品单位" v-bind="validateInfos.materialUnits" id="NuInvoicingPddInfoForm-materialUnits" name="materialUnits">
|
||||
<a-input v-model:value="formData.materialUnits" placeholder="请输入货品单位" allow-clear ></a-input>
|
||||
</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 JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { saveOrUpdate } from '../NuInvoicingPddInfo.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: '',
|
||||
pddId: '',
|
||||
nuId: '',
|
||||
wlId: '',
|
||||
dqkcsl: undefined,
|
||||
pdsl: undefined,
|
||||
cesl: undefined,
|
||||
pdType: '',
|
||||
content: '',
|
||||
picPath: '',
|
||||
categoryId: '',
|
||||
typeId: '',
|
||||
medicationId: '',
|
||||
materialName: '',
|
||||
materialNo: '',
|
||||
specificationModel: '',
|
||||
materialImg: '',
|
||||
materialUnits: '',
|
||||
});
|
||||
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({
|
||||
});
|
||||
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) {
|
||||
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 saveOrUpdate(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>
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
<template>
|
||||
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<NuInvoicingPddInfoForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuInvoicingPddInfoForm>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import NuInvoicingPddInfoForm from './NuInvoicingPddInfoForm.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>
|
||||
|
|
@ -0,0 +1,221 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<JFormContainer :disabled="disabled">
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuInvoicingPddMainForm">
|
||||
<a-row class="card-class">
|
||||
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;">
|
||||
<SectionDivider :title="'基本信息'" />
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="盘点单单号" v-bind="validateInfos.pddNo" id="NuInvoicingPddMainForm-pddNo" name="pddNo">
|
||||
<a-input v-model:value="formData.pddNo" placeholder="请输入盘点单单号" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="盘点单类型" v-bind="validateInfos.pddType" id="NuInvoicingPddMainForm-pddType" name="pddType">
|
||||
<a-input v-model:value="formData.pddType_dictText" placeholder="盘点单类型" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="盘点单状态" v-bind="validateInfos.pddStatus" id="NuInvoicingPddMainForm-pddStatus" name="pddStatus">
|
||||
<a-input v-model:value="formData.pddStatus_dictText" placeholder="盘点单状态" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="盘点单发起人" v-bind="validateInfos.pddStartBy" id="NuInvoicingPddMainForm-pddStartBy" name="pddStartBy">
|
||||
<a-input v-model:value="formData.pddStartBy" placeholder="请输入盘点单发起人" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="盘点单发起时间" v-bind="validateInfos.pddStartTime" id="NuInvoicingPddMainForm-pddStartTime" name="pddStartTime">
|
||||
<a-date-picker placeholder="请选择盘点单发起时间" v-model:value="formData.pddStartTime" showTime value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="盘盈单数量" v-bind="validateInfos.pydNum" id="NuInvoicingPddMainForm-pydNum" name="pydNum">
|
||||
<a-input v-model:value="formData.pydNum" placeholder="请输入盘盈单数量" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="盘点单完成人" v-bind="validateInfos.pddEndBy" id="NuInvoicingPddMainForm-pddEndBy" name="pddEndBy">
|
||||
<a-input v-model:value="formData.pddEndBy" placeholder="请输入盘点单完成人" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="盘点单完成时间" v-bind="validateInfos.pddEndTime" id="NuInvoicingPddMainForm-pddEndTime" name="pddEndTime">
|
||||
<a-date-picker placeholder="请选择盘点单完成时间" v-model:value="formData.pddEndTime" showTime value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="盘亏单数量" v-bind="validateInfos.pkdNum" id="NuInvoicingPddMainForm-pkdNum" name="pkdNum">
|
||||
<a-input-number v-model:value="formData.pkdNum" placeholder="请输入盘亏单数量" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="盘点仓库" v-bind="validateInfos.nuName" id="NuInvoicingPddMainForm-nuName" name="nuName">
|
||||
<a-input v-model:value="formData.nuName" placeholder="请输入对应仓库" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
<div>
|
||||
<NuInvoicingPddInfoList ref="listRef"></NuInvoicingPddInfoList>
|
||||
</div>
|
||||
</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 JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { saveOrUpdate } from '../NuInvoicingPddMain.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import NuInvoicingPddInfoList from '/@/views/invoicing/pdd/NuInvoicingPddInfoList.vue';
|
||||
|
||||
const props = defineProps({
|
||||
formDisabled: { type: Boolean, default: false },
|
||||
formData: { type: Object, default: () => ({})},
|
||||
formBpm: { type: Boolean, default: true }
|
||||
});
|
||||
const formRef = ref();
|
||||
const listRef = ref()
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
pddNo: '',
|
||||
pddType_dictText: '',
|
||||
pddStatus_dictText: '',
|
||||
pddStartBy: '',
|
||||
pddStartTime: '',
|
||||
pddEndBy: '',
|
||||
pddEndTime: '',
|
||||
nuName: '',
|
||||
pydNum: undefined,
|
||||
pkdNum: undefined,
|
||||
serverId: '',
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 8 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
});
|
||||
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) {
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
listRef.value.init(record.id)
|
||||
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 saveOrUpdate(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>
|
||||
|
||||
.card-class {
|
||||
padding-top: 24px;
|
||||
padding-bottom: 24px;
|
||||
padding-left: 14px;
|
||||
padding-right: 14px;
|
||||
// background-color: rgba(255, 255, 255, 0.9);
|
||||
background-color: #fcfdff;
|
||||
border-radius: 10px;
|
||||
// box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 12px;
|
||||
margin-bottom: 14px;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
<template>
|
||||
<a-drawer :title="title" width="70vw" :visible="visible" :closable="true" :footer-style="{ textAlign: 'right' }"
|
||||
:bodyStyle="{ padding: '14px' }" @close="handleCancel">
|
||||
<template #footer>
|
||||
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
|
||||
</template>
|
||||
<NuInvoicingPddMainForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuInvoicingPddMainForm>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import NuInvoicingPddMainForm from './NuInvoicingPddMainForm.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>
|
||||
Loading…
Reference in New Issue