|
|
|
|
@ -38,7 +38,7 @@
|
|
|
|
|
:columns="columns"
|
|
|
|
|
:data="data"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:scroll-x="1000"
|
|
|
|
|
:scroll-x="dataTableConfig.scrollWidth(columns)"
|
|
|
|
|
@update-checked-row-keys="handleSelect"
|
|
|
|
|
/>
|
|
|
|
|
<my-pagination v-model:search-form="searchForm" @init="init"></my-pagination>
|
|
|
|
|
@ -50,18 +50,107 @@
|
|
|
|
|
:get-list="getWmsItemRecptData"
|
|
|
|
|
/>
|
|
|
|
|
</my-card>
|
|
|
|
|
|
|
|
|
|
<!-- 审批模态框 -->
|
|
|
|
|
<n-modal
|
|
|
|
|
v-model:show="approveModalVisible"
|
|
|
|
|
preset="dialog"
|
|
|
|
|
title="审批采购入库单"
|
|
|
|
|
style="width: 950px; height: 680px;"
|
|
|
|
|
:mask-closable="false"
|
|
|
|
|
@positive-click="handleApproveSubmit"
|
|
|
|
|
@negative-click="handleApproveCancel"
|
|
|
|
|
>
|
|
|
|
|
<div class="grid grid-cols-1 gap-4 p-4">
|
|
|
|
|
<!-- 详情展示 -->
|
|
|
|
|
<div >
|
|
|
|
|
<h3 class="text-lg font-semibold mb-3">入库单详情</h3>
|
|
|
|
|
<div class="grid grid-cols-2 gap-4">
|
|
|
|
|
<div>
|
|
|
|
|
<p class="text-sm text-gray-500">入库单编号</p>
|
|
|
|
|
<p>{{ currentOrder?.recptCode || '-' }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<p class="text-sm text-gray-500">供应商名称</p>
|
|
|
|
|
<p>{{ currentOrder?.vendorName || '-' }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<p class="text-sm text-gray-500">采购单编号</p>
|
|
|
|
|
<p>{{ currentOrder?.fromBillCode || '-' }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<p class="text-sm text-gray-500">销售订单号</p>
|
|
|
|
|
<p>{{ currentOrder?.poCode || '-' }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<p class="text-sm text-gray-500">数量</p>
|
|
|
|
|
<p>{{ currentOrder?.quantityRecived || '-' }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<p class="text-sm text-gray-500">当前状态</p>
|
|
|
|
|
<dict-tag
|
|
|
|
|
:options="wms_item_recpt_status"
|
|
|
|
|
:value="currentOrder?.status"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<n-data-table
|
|
|
|
|
|
|
|
|
|
:columns="columns2"
|
|
|
|
|
:data="data2"
|
|
|
|
|
/>
|
|
|
|
|
<!-- 审批操作 -->
|
|
|
|
|
<div v-if="viewType === 'APPROVE'">
|
|
|
|
|
<h3 class="text-lg font-semibold mb-3">审批操作</h3>
|
|
|
|
|
<n-form
|
|
|
|
|
ref="approveFormRef"
|
|
|
|
|
:model="approveForm"
|
|
|
|
|
:rules="approveRules"
|
|
|
|
|
>
|
|
|
|
|
<n-form-item label="审批意见" path="remark" style="width: 100%;">
|
|
|
|
|
<n-input
|
|
|
|
|
type="textarea"
|
|
|
|
|
placeholder="请输入审批意见"
|
|
|
|
|
v-model:value="approveForm.remark"
|
|
|
|
|
rows="3"
|
|
|
|
|
/>
|
|
|
|
|
</n-form-item>
|
|
|
|
|
</n-form>
|
|
|
|
|
|
|
|
|
|
<div class="mt-6 flex justify-end gap-4">
|
|
|
|
|
<n-button
|
|
|
|
|
type="error"
|
|
|
|
|
@click="handleAudit(currentOrder, 'REJECT')"
|
|
|
|
|
>
|
|
|
|
|
驳回
|
|
|
|
|
</n-button>
|
|
|
|
|
<n-button
|
|
|
|
|
type="success"
|
|
|
|
|
@click="handleAudit(currentOrder, 'APPROVE')"
|
|
|
|
|
>
|
|
|
|
|
通过
|
|
|
|
|
</n-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</n-modal>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="tsx" setup>
|
|
|
|
|
import { ref, getCurrentInstance } from 'vue';
|
|
|
|
|
import { ref, getCurrentInstance, computed } from 'vue';
|
|
|
|
|
import type { Ref } from 'vue';
|
|
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
|
import { useMessage } from 'naive-ui';
|
|
|
|
|
import type { DataTableColumns, DataTableRowKey } from 'naive-ui';
|
|
|
|
|
import { useLoading, useBoolean } from '@/hooks';
|
|
|
|
|
import { useAuthStore } from '@/store';
|
|
|
|
|
// import { deepClone } from '@/utils';
|
|
|
|
|
import { selectWmsItemRecptList, delWmsItemRecpt } from '@/service/api/wms/recpt';
|
|
|
|
|
import { selectWmsItemRecptList, delWmsItemRecpt , approveWmsItemRecpt} from '@/service/api/wms/recpt';
|
|
|
|
|
import {
|
|
|
|
|
useSearchBtn,
|
|
|
|
|
useDelBtn,
|
|
|
|
|
@ -72,9 +161,11 @@ import {
|
|
|
|
|
import { useSocketStore } from '@/store/modules/socket/index';
|
|
|
|
|
import type { ModalType } from './components/table-action-modal.vue';
|
|
|
|
|
import TableActionModal from './components/table-action-modal.vue';
|
|
|
|
|
import {dataTableConfig} from "@/config/dataTableConfig";
|
|
|
|
|
import {selectWmsItemRecptLineList} from "@/service/api/wms/recptLine";
|
|
|
|
|
|
|
|
|
|
const socketStore = useSocketStore();
|
|
|
|
|
|
|
|
|
|
const authStore = useAuthStore();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const { proxy } = getCurrentInstance() as any;
|
|
|
|
|
const { wms_item_recpt_status } = proxy.useDict('wms_item_recpt_status', 'wms_item_recpt_type');
|
|
|
|
|
@ -85,6 +176,87 @@ const modalType = ref<ModalType>('add');
|
|
|
|
|
// const menuOptions = ref();
|
|
|
|
|
const message = useMessage();
|
|
|
|
|
|
|
|
|
|
// 审批相关
|
|
|
|
|
const viewType = ref('');
|
|
|
|
|
const approveFormRef = ref<any | null>(null);
|
|
|
|
|
const currentOrder = ref<any | null>(null);
|
|
|
|
|
const data2 = ref<any[]>([]);
|
|
|
|
|
const approveModalVisible = ref(false);
|
|
|
|
|
const approveForm = ref<{
|
|
|
|
|
id: number | string | null; // 单个订单ID或批量订单ID列表(逗号分隔)
|
|
|
|
|
status: string;
|
|
|
|
|
remark: string;
|
|
|
|
|
}>({
|
|
|
|
|
id: null,
|
|
|
|
|
status: '',
|
|
|
|
|
remark: ''
|
|
|
|
|
});
|
|
|
|
|
const approveRules = {
|
|
|
|
|
remark: [{ required: true, message: '请输入审批意见' }]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 审批相关函数
|
|
|
|
|
function handleApprove(row: any, type: 'view' | 'APPROVE') {
|
|
|
|
|
viewType.value = type;
|
|
|
|
|
currentOrder.value = { ...row }; // 深拷贝防止响应式污染
|
|
|
|
|
if (type === 'APPROVE') {
|
|
|
|
|
approveForm.value = {
|
|
|
|
|
id: row.recptId,
|
|
|
|
|
status: 'APPROVE',
|
|
|
|
|
remark: ''
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectWmsItemRecptLineList({params:{recptId: currentOrder?.value.recptId} }).then(res => {
|
|
|
|
|
data2.value = res.rows;
|
|
|
|
|
// list.value.data = res.rows;
|
|
|
|
|
approveModalVisible.value = true;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function handleAudit(row: any, status: 'APPROVE' | 'REJECT') {
|
|
|
|
|
if (!row.recptId) return;
|
|
|
|
|
approveForm.value = {
|
|
|
|
|
id: row.recptId,
|
|
|
|
|
status: status,
|
|
|
|
|
remark: approveForm.value.remark
|
|
|
|
|
};
|
|
|
|
|
handleApproveSubmit();
|
|
|
|
|
}
|
|
|
|
|
async function handleApproveSubmit() {
|
|
|
|
|
if (!approveFormRef.value) return;
|
|
|
|
|
|
|
|
|
|
await approveFormRef.value.validate(errors => {
|
|
|
|
|
if (errors) return;
|
|
|
|
|
|
|
|
|
|
const params = {
|
|
|
|
|
recptId: approveForm.value.id,
|
|
|
|
|
status: approveForm.value.status,
|
|
|
|
|
remark: approveForm.value.remark
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
approveWmsItemRecpt(params)
|
|
|
|
|
.then(res => {
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
message.success(`审批${params.status === 'APPROVE' ? '通过' : '驳回'}成功`);
|
|
|
|
|
approveModalVisible.value = false;
|
|
|
|
|
getWmsItemRecptData();
|
|
|
|
|
} else {
|
|
|
|
|
message.error(res.msg || '审批失败');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(() => message.error('网络请求失败'));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleApproveCancel() {
|
|
|
|
|
approveModalVisible.value = false;
|
|
|
|
|
approveForm.value = { id: null, status: '', remark: '' };
|
|
|
|
|
currentOrder.value = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// const delIds = ref();
|
|
|
|
|
// const show = ref(false);
|
|
|
|
|
const total = ref();
|
|
|
|
|
@ -150,7 +322,61 @@ const selectKeys = ref<DataTableRowKey[]>([]);
|
|
|
|
|
function handleSelect(keys: DataTableRowKey[]) {
|
|
|
|
|
selectKeys.value = keys;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 权限判断
|
|
|
|
|
const hasApprovePermission = computed(() =>
|
|
|
|
|
authStore.userInfo.roles.includes('CKGL') || authStore.userInfo.userName === 'admin'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const data = ref<wms.recptRawType.columns[]>([]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const columns2: Ref<any> = ref([
|
|
|
|
|
{
|
|
|
|
|
title: '物料类型',
|
|
|
|
|
key: 'itemTypeName',
|
|
|
|
|
width: 120,
|
|
|
|
|
ellipsis: {
|
|
|
|
|
tooltip: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '物料编码',
|
|
|
|
|
key: 'itemCode',
|
|
|
|
|
width: 120,
|
|
|
|
|
ellipsis: {
|
|
|
|
|
tooltip: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '物料名称',
|
|
|
|
|
key: 'itemName',
|
|
|
|
|
width: 120,
|
|
|
|
|
ellipsis: {
|
|
|
|
|
tooltip: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '规格型号',
|
|
|
|
|
key: 'specification',
|
|
|
|
|
width: 120
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '颜色',
|
|
|
|
|
key: 'colorName',
|
|
|
|
|
width: 120
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '单位',
|
|
|
|
|
key: 'unitOfMeasure',
|
|
|
|
|
width: 120
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '数量',
|
|
|
|
|
key: 'quantityRecived',
|
|
|
|
|
width: 120
|
|
|
|
|
},
|
|
|
|
|
])
|
|
|
|
|
const columns: Ref<DataTableColumns<wms.recptRawType.columns>> = ref([
|
|
|
|
|
{
|
|
|
|
|
type: 'selection',
|
|
|
|
|
@ -252,6 +478,24 @@ const columns: Ref<DataTableColumns<wms.recptRawType.columns>> = ref([
|
|
|
|
|
tooltip: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '审批人',
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 150,
|
|
|
|
|
key: 'checkedBy',
|
|
|
|
|
render: (row) => {
|
|
|
|
|
return row.checkedBy || '-';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '审批时间',
|
|
|
|
|
align: 'center',
|
|
|
|
|
key: 'checkedTime',
|
|
|
|
|
width: 150,
|
|
|
|
|
render: (row) => {
|
|
|
|
|
return row.checkedTime ? new Date(row.checkedTime).toLocaleDateString() : '-';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
key: 'action',
|
|
|
|
|
@ -267,7 +511,18 @@ const columns: Ref<DataTableColumns<wms.recptRawType.columns>> = ref([
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
const Btn: JSX.Element[] = [];
|
|
|
|
|
if (row.status !== 'FINISHED') {
|
|
|
|
|
if (row.status === 'PREPARE' && hasApprovePermission.value) {
|
|
|
|
|
Btn.push(
|
|
|
|
|
<n-button
|
|
|
|
|
size="small"
|
|
|
|
|
type="warning"
|
|
|
|
|
onClick={() => handleApprove(row, 'APPROVE')}
|
|
|
|
|
>
|
|
|
|
|
审批
|
|
|
|
|
</n-button>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (row.status == 'APPROVE') {
|
|
|
|
|
Btn.push(
|
|
|
|
|
useEditBtn(
|
|
|
|
|
() => {
|
|
|
|
|
|