| | |
| | | // æ¥è¯¢è½¦è¾å表 |
| | | export function listVehicle(page, query) { |
| | | return request({ |
| | | url: "/vehicleManagement/getList", |
| | | url: "/carInfo/listPage", |
| | | method: "get", |
| | | params: { |
| | | ...page, |
| | |
| | | // æ°å¢è½¦è¾ |
| | | export function addVehicle(data) { |
| | | return request({ |
| | | url: "/vehicleManagement/add", |
| | | url: "/carInfo/add", |
| | | method: "post", |
| | | data, |
| | | }); |
| | |
| | | // ä¿®æ¹è½¦è¾ |
| | | export function updateVehicle(data) { |
| | | return request({ |
| | | url: "/vehicleManagement/update", |
| | | url: "/carInfo/update", |
| | | method: "post", |
| | | data, |
| | | }); |
| | |
| | | // å é¤è½¦è¾ |
| | | export function delVehicle(query) { |
| | | return request({ |
| | | url: "/vehicleManagement/delete", |
| | | url: "/carInfo/delete", |
| | | method: "delete", |
| | | data: query, |
| | | }); |
| | |
| | | // 使ç¨è½¦è¾ |
| | | export function useVehicle(data) { |
| | | return request({ |
| | | url: "/vehicleManagement/useVehicle", |
| | | url: "/carInfoRecord/add", |
| | | method: "post", |
| | | data, |
| | | }); |
| | |
| | | // è¿è½¦ |
| | | export function returnVehicle(data) { |
| | | return request({ |
| | | url: "/vehicleManagement/returnVehicle", |
| | | url: "/carInfoRecord/update", |
| | | method: "post", |
| | | data, |
| | | }); |
| | |
| | | // 使ç¨è®°å½ |
| | | export function getVehicleUsageRecords(page, query) { |
| | | return request({ |
| | | url: "/vehicleManagement/getUsageRecords", |
| | | url: "/carInfoRecord/list", |
| | | method: "get", |
| | | params: { |
| | | ...page, |
| | |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | // æå¨æ°å¢ç产订å |
| | | export function addProductOrder(data) { |
| | | return request({ |
| | | url: "/productOrder/add", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ç产订å-æ¹éå é¤ï¼ä¼ id æ°ç»ï¼ |
| | | export function deleteProductOrder(ids) { |
| | | return request({ |
| | | url: "/productOrder/delete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | |
| | | }
|
| | | .table_list {
|
| | | height: calc(100vh - 11em);
|
| | | margin-top: 20px;
|
| | | background: #fff;
|
| | | padding: 18px
|
| | | padding: 18px;
|
| | | margin-top: 16px;
|
| | | }
|
| | | .components-container {
|
| | | margin: 30px 50px;
|
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="page-header-wrapper"> |
| | | <el-page-header @back="handleBack" :content="content"> |
| | | <template #icon v-if="$slots.icon"> |
| | | <slot name="icon"></slot> |
| | | </template> |
| | | <template #title v-if="$slots.title"> |
| | | <slot name="title"></slot> |
| | | </template> |
| | | <template #content v-if="$slots.content"> |
| | | <slot name="content"></slot> |
| | | </template> |
| | | <template #extra> |
| | | <slot name="extra"> |
| | | <slot name="right-button"></slot> |
| | | </slot> |
| | | </template> |
| | | </el-page-header> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { useRouter } from 'vue-router' |
| | | |
| | | const props = defineProps({ |
| | | content: { |
| | | type: String, |
| | | default: '' |
| | | } |
| | | }) |
| | | |
| | | const emit = defineEmits(['back']) |
| | | |
| | | const router = useRouter() |
| | | |
| | | const handleBack = () => { |
| | | emit('back') |
| | | // é»è®¤è¿åå°ä¸ä¸çº§ |
| | | router.back() |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .page-header-wrapper { |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .page-header-wrapper :deep(.el-page-header__extra) { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8px; |
| | | } |
| | | </style> |
| | |
| | | import DictTag from "@/components/DictTag"; |
| | | // è¡¨æ ¼ç»ä»¶ |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | // 页é¢å¤´é¨ç»ä»¶ |
| | | import PageHeader from "@/components/PageHeader/index.vue"; |
| | | |
| | | import { getToken } from "@/utils/auth"; |
| | | import { |
| | |
| | | app.component("RightToolbar", RightToolbar); |
| | | app.component("Editor", Editor); |
| | | app.component("PIMTable", PIMTable); |
| | | app.component("PageHeader", PageHeader); |
| | | |
| | | app.use(router); |
| | | app.use(store); |
| | |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" :inline="true"> |
| | | <el-form-item label="车çå·ï¼"> |
| | | <el-input v-model="searchForm.plateNumber" placeholder="请è¾å
¥è½¦çå·" clearable prefix-icon="Search" |
| | | <el-input v-model="searchForm.carNo" placeholder="请è¾å
¥è½¦çå·" clearable prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="é¢è²ï¼"> |
| | |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="使ç¨ç¶æï¼"> |
| | | <el-select v-model="searchForm.status" placeholder="è¯·éæ©" clearable @change="handleQuery" style="width: 200px"> |
| | | <el-option label="空é²" value="idle" /> |
| | | <el-option label="使ç¨ä¸" value="in_use" /> |
| | | <el-option label="ç»´ä¿®ä¸" value="maintenance" /> |
| | | <el-select v-model="searchForm.usageStatus" placeholder="è¯·éæ©" clearable @change="handleQuery" style="width: 200px"> |
| | | <el-option label="空é²" value="空é²" /> |
| | | <el-option label="使ç¨ä¸" value="使ç¨ä¸" /> |
| | | <el-option label="ç»´ä¿®ä¸" value="ç»´ä¿®ä¸" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | <el-button type="primary" @click="openForm('add')"> |
| | | æ°å¢è½¦è¾ |
| | | </el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <!-- <el-button @click="handleOut">导åº</el-button>--> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | |
| | | :column="tableColumns" |
| | | :is-selection="true" |
| | | :border="true" |
| | | :row-key="'id'" |
| | | :expand-row-keys="expandRowKeys" |
| | | :table-loading="tableLoading" |
| | | :table-style="{ width: '100%', height: 'calc(100vh - 18.5em)' }" |
| | | :table-style="{ width: '100%', height: 'calc(100vh - 21.5em)' }" |
| | | :page="{ |
| | | current: page.current, |
| | | size: page.size, |
| | |
| | | }" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="paginationChange" |
| | | @expand-change="handleExpandChange" |
| | | > |
| | | <template #expand="{ row }"> |
| | | <div class="expand-wrapper"> |
| | | <el-skeleton v-if="expandChildLoading[row.id]" animated :rows="3" /> |
| | | <template v-else> |
| | | <el-empty v-if="!(expandChildData[row.id] && expandChildData[row.id].length)" description="ææ ä½¿ç¨è®°å½" /> |
| | | <el-table |
| | | v-else |
| | | :data="expandChildData[row.id]" |
| | | size="small" |
| | | border |
| | | style="width: 100%" |
| | | :header-cell-style="{ background: '#F7F8FA' }" |
| | | > |
| | | <el-table-column prop="userName" label="使ç¨äºº" width="140" /> |
| | | <el-table-column prop="desc" label="ç®çå°" width="180" /> |
| | | <el-table-column prop="useTime" label="ä½¿ç¨æ¶é´" width="180" /> |
| | | <el-table-column prop="carReturnDate" label="è¿è½¦æ¶é´" width="180" /> |
| | | <el-table-column prop="odometerBefore" label="使ç¨åéç¨(km)" width="140" /> |
| | | <el-table-column prop="odometerAfter" label="è¿è½¦æ¶éç¨(km)" width="140" /> |
| | | <el-table-column prop="thisTripMileage" label="æ¬æ¬¡è¡é©¶éç¨(km)" width="160" /> |
| | | </el-table> |
| | | </template> |
| | | </div> |
| | | </template> |
| | | <template #operation="{ row }"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', row)">ç¼è¾</el-button> |
| | | <el-button link type="primary" size="small" v-if="row.status === 'idle'" |
| | | @click="openUseForm(row)">使ç¨è½¦è¾</el-button> |
| | | <el-button link type="primary" size="small" v-if="row.status === 'in_use'" |
| | | @click="openReturnForm(row)">è¿è½¦</el-button> |
| | | <el-button link type="primary" size="small" @click="viewUsageRecords(row)">使ç¨è®°å½</el-button> |
| | | <el-button link type="primary" size="small" v-if="row.usageStatus === '空é²'" @click="openUseForm(row)">ç¨è½¦</el-button> |
| | | <el-button link type="primary" size="small" v-if="row.usageStatus === '使ç¨ä¸'" @click="openReturnForm(row)">è¿è½¦</el-button> |
| | | <el-button link type="primary" size="small" @click="openUsageRecordsDialog(row)">使ç¨è®°å½</el-button> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | |
| | | <el-form :model="form" label-width="120px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="车çå·ï¼" prop="plateNumber"> |
| | | <el-input v-model="form.plateNumber" placeholder="请è¾å
¥è½¦çå·" clearable /> |
| | | <el-form-item label="车çå·ï¼" prop="carNo"> |
| | | <el-input v-model="form.carNo" placeholder="请è¾å
¥è½¦çå·" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="使ç¨ç¶æï¼" prop="status"> |
| | | <el-select v-model="form.status" placeholder="è¯·éæ©" clearable style="width: 100%"> |
| | | <el-option label="空é²" value="idle" /> |
| | | <el-option label="使ç¨ä¸" value="in_use" /> |
| | | <el-option label="ç»´ä¿®ä¸" value="maintenance" /> |
| | | <el-form-item label="使ç¨ç¶æï¼" prop="usageStatus"> |
| | | <el-select v-model="form.usageStatus" placeholder="è¯·éæ©" clearable style="width: 100%"> |
| | | <el-option label="空é²" value="空é²" /> |
| | | <el-option label="使ç¨ä¸" value="使ç¨ä¸" /> |
| | | <el-option label="ç»´ä¿®ä¸" value="ç»´ä¿®ä¸" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="表æ¾éç¨(km)ï¼"> |
| | | <el-input-number v-model="form.odometer" :min="0" :precision="2" style="width: 100%" |
| | | <el-input-number v-model="form.odometerMileage" :min="0" :precision="2" style="width: 100%" |
| | | placeholder="请è¾å
¥è¡¨æ¾éç¨" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="车çå·ï¼"> |
| | | <el-input :value="currentUseRow ? currentUseRow.plateNumber : ''" disabled /> |
| | | <el-input :value="currentUseRow ? currentUseRow.carNo : ''" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="表æ¾éç¨(km)ï¼" prop="odometer"> |
| | | <el-input-number v-model="useForm.odometer" :min="0" :precision="2" style="width: 100%" |
| | | placeholder="请è¾å
¥è¡¨æ¾éç¨" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¬æ¬¡è¡é©¶éç¨(km)ï¼" prop="travelDistance"> |
| | | <el-input-number v-model="useForm.travelDistance" :min="0" :precision="2" style="width: 100%" |
| | | placeholder="请è¾å
¥æ¬æ¬¡è¡é©¶éç¨" clearable /> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åç¨æ¶é´ï¼" prop="carRentalDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="useForm.carRentalDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©åç¨æ¶é´" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="使ç¨äººï¼" prop="userId"> |
| | | <el-select v-model="useForm.userId" placeholder="è¯·éæ©ä½¿ç¨äºº" clearable filterable> |
| | | <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> |
| | | <el-form-item label="使ç¨äººï¼" prop="userName"> |
| | | <el-select v-model="useForm.userName" placeholder="è¯·éæ©ä½¿ç¨äºº" clearable filterable> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="表æ¾éç¨(km)ï¼" prop="odometerMileage"> |
| | | <el-input-number v-model="useForm.odometerMileage" :min="0" :precision="2" style="width: 100%" |
| | | placeholder="请è¾å
¥è¡¨æ¾éç¨" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¬æ¬¡é¢è®¡è¡é©¶éç¨(km)ï¼" prop="thisTripMileage"> |
| | | <el-input-number v-model="useForm.thisTripMileage" :min="0" :precision="2" style="width: 100%" |
| | | placeholder="请è¾å
¥æ¬æ¬¡é¢è®¡è¡é©¶éç¨" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="车çå·ï¼"> |
| | | <el-input :value="currentReturnRow ? currentReturnRow.plateNumber : ''" disabled /> |
| | | <el-input :value="currentReturnRow ? currentReturnRow.carNo : ''" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="è¿è½¦æ¶é´ï¼" prop="returnTime"> |
| | | <el-date-picker style="width: 100%" v-model="returnForm.returnTime" value-format="YYYY-MM-DD HH:mm:ss" |
| | | format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="è¯·éæ©è¿è½¦æ¶é´" clearable /> |
| | | <el-form-item label="è¿è½¦æ¶é´ï¼" prop="carReturnDate"> |
| | | <el-date-picker style="width: 100%" v-model="returnForm.carReturnDate" value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" type="date" placeholder="è¯·éæ©è¿è½¦æ¶é´" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="表æ¾éç¨(km)ï¼" prop="odometer"> |
| | | <el-input-number v-model="returnForm.odometer" :min="0" :precision="2" style="width: 100%" |
| | | <el-col :span="24"> |
| | | <el-form-item label="表æ¾éç¨(km)ï¼" prop="odometerMileage"> |
| | | <el-input-number v-model="returnForm.odometerMileage" :min="0" :precision="2" style="width: 100%" |
| | | placeholder="请è¾å
¥è¡¨æ¾éç¨" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="使ç¨äººï¼" prop="userId"> |
| | | <el-select v-model="returnForm.userId" placeholder="è¯·éæ©ä½¿ç¨äºº" clearable filterable> |
| | | <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | :column="usageRecordsColumns" |
| | | :border="true" |
| | | :table-loading="usageRecordsLoading" |
| | | :table-style="{ width: '100%' }" |
| | | :table-style="{ height: 'calc(100vh - 24em)', width: '100%' }" |
| | | :page="{ |
| | | current: usageRecordsPage.current, |
| | | size: usageRecordsPage.size, |
| | |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const expandRowKeys = ref([]); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }); |
| | | const total = ref(0); |
| | | |
| | | // 使ç¨è®°å½å¼¹çª |
| | | const usageRecordsVisible = ref(false); |
| | | const usageRecordsData = ref([]); |
| | | const usageRecordsLoading = ref(false); |
| | | const usageRecordsPage = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | }); |
| | | const usageRecordsTotal = ref(0); |
| | | const usageRecordsColumns = ref([ |
| | | { label: "使ç¨äºº", prop: "userName", width: "120" }, |
| | | { label: "ç®çå°", prop: "destination", width: "150" }, |
| | | { label: "åç¨æ¶é´", prop: "carRentalDate", }, |
| | | { label: "è¿è½¦æ¶é´", prop: "carReturnDate",}, |
| | | { label: "使ç¨åéç¨(km)", prop: "odometerMileage", }, |
| | | { label: "æ¬æ¬¡è¡é©¶éç¨(km)", prop: "thisTripMileage",}, |
| | | ]); |
| | | |
| | | // æç´¢è¡¨å |
| | | const data = reactive({ |
| | | searchForm: { |
| | | plateNumber: "", |
| | | carNo: "", |
| | | color: "", |
| | | brand: "", |
| | | status: "", |
| | | usageStatus: "", |
| | | }, |
| | | form: { |
| | | plateNumber: "", |
| | | carNo: "", |
| | | color: "", |
| | | brand: "", |
| | | status: "idle", |
| | | odometer: 0, |
| | | usageStatus: "空é²", |
| | | odometerMileage: 0, |
| | | remark: "", |
| | | }, |
| | | rules: { |
| | | plateNumber: [{ required: true, message: "请è¾å
¥è½¦çå·", trigger: "blur" }], |
| | | carNo: [{ required: true, message: "请è¾å
¥è½¦çå·", trigger: "blur" }], |
| | | color: [{ required: true, message: "请è¾å
¥é¢è²", trigger: "blur" }], |
| | | brand: [{ required: true, message: "请è¾å
¥åç", trigger: "blur" }], |
| | | status: [{ required: true, message: "è¯·éæ©ä½¿ç¨ç¶æ", trigger: "change" }], |
| | | usageStatus: [{ required: true, message: "è¯·éæ©ä½¿ç¨ç¶æ", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | |
| | | const currentUseRow = ref(null); |
| | | const useVehicleFormData = reactive({ |
| | | useForm: { |
| | | vehicleId: "", |
| | | carInfoId: "", |
| | | destination: "", |
| | | odometer: 0, |
| | | travelDistance: 0, |
| | | userId: "", |
| | | carRentalDate: dayjs().format("YYYY-MM-DD"), |
| | | odometerMileage: 0, |
| | | thisTripMileage: 0, |
| | | userName: "", |
| | | remark: "", |
| | | }, |
| | | useRules: { |
| | | destination: [{ required: true, message: "请è¾å
¥ç®çå°", trigger: "blur" }], |
| | | odometer: [{ required: true, message: "请è¾å
¥è¡¨æ¾éç¨", trigger: "blur" }], |
| | | travelDistance: [{ required: true, message: "请è¾å
¥æ¬æ¬¡è¡é©¶éç¨", trigger: "blur" }], |
| | | userId: [{ required: true, message: "è¯·éæ©ä½¿ç¨äºº", trigger: "change" }], |
| | | carRentalDate: [{ required: true, message: "è¯·éæ©åç¨æ¶é´", trigger: "change" }], |
| | | odometerMileage: [{ required: true, message: "请è¾å
¥è¡¨æ¾éç¨", trigger: "blur" }], |
| | | thisTripMileage: [{ required: true, message: "请è¾å
¥æ¬æ¬¡è¡é©¶éç¨", trigger: "blur" }], |
| | | userName: [{ required: true, message: "è¯·éæ©ä½¿ç¨äºº", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { useForm, useRules } = toRefs(useVehicleFormData); |
| | |
| | | const currentReturnRow = ref(null); |
| | | const returnFormData = reactive({ |
| | | returnForm: { |
| | | vehicleId: "", |
| | | returnTime: "", |
| | | odometer: 0, |
| | | userId: "", |
| | | carInfoId: "", |
| | | carReturnDate: "", |
| | | odometerMileage: 0, |
| | | remark: "", |
| | | }, |
| | | returnRules: { |
| | | returnTime: [{ required: true, message: "è¯·éæ©è¿è½¦æ¶é´", trigger: "change" }], |
| | | odometer: [{ required: true, message: "请è¾å
¥è¡¨æ¾éç¨", trigger: "blur" }], |
| | | userId: [{ required: true, message: "è¯·éæ©ä½¿ç¨äºº", trigger: "change" }], |
| | | carReturnDate: [{ required: true, message: "è¯·éæ©è¿è½¦æ¶é´", trigger: "change" }], |
| | | odometerMileage: [{ required: true, message: "请è¾å
¥è¡¨æ¾éç¨", trigger: "blur" }], |
| | | }, |
| | | }); |
| | | const { returnForm, returnRules } = toRefs(returnFormData); |
| | | |
| | | // 使ç¨è®°å½ |
| | | const usageRecordsVisible = ref(false); |
| | | const usageRecordsData = ref([]); |
| | | const usageRecordsLoading = ref(false); |
| | | const usageRecordsPage = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }); |
| | | const usageRecordsTotal = ref(0); |
| | | const usageRecordsColumns = ref([ |
| | | { label: "车çå·", prop: "plateNumber", width: "120" }, |
| | | { label: "使ç¨äºº", prop: "userName", width: "120" }, |
| | | { label: "ç®çå°", prop: "destination", width: "150" }, |
| | | { label: "ä½¿ç¨æ¶é´", prop: "useTime", width: "180" }, |
| | | { label: "è¿è½¦æ¶é´", prop: "returnTime", width: "180" }, |
| | | { label: "使ç¨åéç¨(km)", prop: "odometerBefore", width: "130" }, |
| | | { label: "è¿è½¦æ¶éç¨(km)", prop: "odometerAfter", width: "130" }, |
| | | { label: "æ¬æ¬¡è¡é©¶éç¨(km)", prop: "travelDistance", width: "140" }, |
| | | ]); |
| | | const currentVehicleId = ref(null); |
| | | const expandChildData = reactive({}); |
| | | const expandChildLoading = reactive({}); |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref(""); |
| | |
| | | |
| | | // è¡¨æ ¼åé
ç½® |
| | | const tableColumns = ref([ |
| | | { label: "车çå·", prop: "plateNumber", width: "120" }, |
| | | { label: "车çå·", prop: "carNo", width: "120" }, |
| | | { label: "é¢è²", prop: "color", width: "100" }, |
| | | { label: "åç", prop: "brand", width: "120" }, |
| | | { |
| | | label: "使ç¨ç¶æ", |
| | | prop: "status", |
| | | width: "100", |
| | | prop: "usageStatus", |
| | | dataType: "tag", |
| | | formatData: (val) => { |
| | | if (val === "idle") return "空é²"; |
| | | if (val === "in_use") return "使ç¨ä¸"; |
| | | if (val === "maintenance") return "ç»´ä¿®ä¸"; |
| | | return val || "-"; |
| | | }, |
| | | formatType: (val) => { |
| | | if (val === "idle") return "success"; |
| | | if (val === "in_use") return "warning"; |
| | | if (val === "maintenance") return "danger"; |
| | | if (val === "空é²") return "success"; |
| | | if (val === "使ç¨ä¸") return "warning"; |
| | | if (val === "ç»´ä¿®ä¸") return "danger"; |
| | | return "info"; |
| | | }, |
| | | }, |
| | | { label: "å½å使ç¨äºº", prop: "currentUser", width: "120" }, |
| | | { label: "表æ¾éç¨(km)", prop: "odometer", width: "120" }, |
| | | { label: "å½å使ç¨äºº", prop: "currentUserName", }, |
| | | { label: "表æ¾éç¨(km)", prop: "odometerMileage",}, |
| | | { label: "å建æ¶é´", prop: "createTime", width: "180" }, |
| | | { |
| | | label: "æä½", |
| | |
| | | slot: "operation", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: "250", |
| | | width: "180", |
| | | }, |
| | | ]); |
| | | |
| | | // æ¥è¯¢å表 |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | expandRowKeys.value = []; |
| | | getList(); |
| | | }; |
| | | |
| | |
| | | listVehicle(page, searchForm) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records || res.data || []; |
| | | total.value = res.total || 0; |
| | | tableData.value = res.data.records; |
| | | total.value = res.data.total || 0; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | // å±å¼åè¡¨æ°æ® |
| | | const handleExpandChange = (row, expandedRows) => { |
| | | expandRowKeys.value = expandedRows.map((item) => item.id); |
| | | if (expandRowKeys.value.includes(row.id)) { |
| | | loadChildRecords(row.id); |
| | | } |
| | | }; |
| | | |
| | | const loadChildRecords = (carInfoId) => { |
| | | if (expandChildLoading[carInfoId]) return; |
| | | expandChildLoading[carInfoId] = true; |
| | | getVehicleUsageRecords({ current: 1, size: 20 }, { carInfoId }) |
| | | .then((res) => { |
| | | expandChildData[carInfoId] = res.records || res.data || []; |
| | | }) |
| | | .finally(() => { |
| | | expandChildLoading[carInfoId] = false; |
| | | }); |
| | | }; |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = async (type, row) => { |
| | | operationType.value = type; |
| | | form.value = { |
| | | plateNumber: "", |
| | | carNo: "", |
| | | color: "", |
| | | brand: "", |
| | | status: "idle", |
| | | odometer: 0, |
| | | usageStatus: "空é²", |
| | | odometerMileage: 0, |
| | | remark: "", |
| | | }; |
| | | |
| | |
| | | |
| | | if (type !== "add") { |
| | | currentId.value = row.id; |
| | | getVehicleById(row.id).then((res) => { |
| | | form.value = { ...(res.data || res) }; |
| | | }); |
| | | // ç´æ¥ä½¿ç¨è¡¨æ ¼è¡æ°æ®ï¼ä¸åè°ç¨API |
| | | form.value = { ...row }; |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | currentId.value = ""; |
| | | }; |
| | | |
| | | // æå¼ä½¿ç¨è½¦è¾å¼¹æ¡ |
| | | const openUseForm = async (row) => { |
| | | currentUseRow.value = row; |
| | | useForm.value = { |
| | | vehicleId: row.id, |
| | | carInfoId: row.id, |
| | | destination: "", |
| | | odometer: row.odometer || 0, |
| | | travelDistance: 0, |
| | | userId: "", |
| | | carRentalDate: dayjs().format("YYYY-MM-DD"), |
| | | odometerMileage: row.odometerMileage || 0, |
| | | thisTripMileage: 0, |
| | | userName: "", |
| | | remark: "", |
| | | }; |
| | | |
| | |
| | | |
| | | // å
³é使ç¨è½¦è¾å¼¹æ¡ |
| | | const closeUseDia = () => { |
| | | proxy.resetForm("useFormRef"); |
| | | try { |
| | | proxy.resetForm("useFormRef"); |
| | | } catch (error) { |
| | | console.error("Error resetting form:", error); |
| | | } |
| | | useFormVisible.value = false; |
| | | currentUseRow.value = null; |
| | | }; |
| | | |
| | | // æå¼ä½¿ç¨è®°å½å¼¹çª |
| | | const openUsageRecordsDialog = async (row) => { |
| | | usageRecordsVisible.value = true; |
| | | usageRecordsPage.current = 1; |
| | | loadUsageRecords(row.id); |
| | | }; |
| | | |
| | | // å 载使ç¨è®°å½ |
| | | const loadUsageRecords = (carInfoId) => { |
| | | usageRecordsLoading.value = true; |
| | | getVehicleUsageRecords(usageRecordsPage, { carInfoId: carInfoId }) |
| | | .then((res) => { |
| | | usageRecordsData.value = res.data.records; |
| | | usageRecordsTotal.value = res.data.total || 0; |
| | | }) |
| | | .finally(() => { |
| | | usageRecordsLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // 使ç¨è®°å½å页 |
| | | const usageRecordsPaginationChange = (obj) => { |
| | | usageRecordsPage.current = obj.page; |
| | | usageRecordsPage.size = obj.limit; |
| | | loadUsageRecords(currentUseRow.value.id); |
| | | }; |
| | | |
| | | // å
³é使ç¨è®°å½å¼¹çª |
| | | const closeUsageRecords = () => { |
| | | usageRecordsVisible.value = false; |
| | | }; |
| | | |
| | | // æå¼è¿è½¦å¼¹æ¡ |
| | | const openReturnForm = async (row) => { |
| | | currentReturnRow.value = row; |
| | | returnForm.value = { |
| | | vehicleId: row.id, |
| | | returnTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), |
| | | odometer: row.odometer || 0, |
| | | userId: "", |
| | | carInfoId: row.id, |
| | | carReturnDate: dayjs().format("YYYY-MM-DD"), |
| | | odometerMileage: row.odometerMileage || 0, |
| | | remark: "", |
| | | }; |
| | | |
| | |
| | | const submitReturnForm = () => { |
| | | proxy.$refs["returnFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | returnVehicle(returnForm.value).then(() => { |
| | | // èªå¨è®¾ç½®ä½¿ç¨ç¶æä¸ºç©ºé²å¹¶æ·»å 车è¾è®°å½ID |
| | | const formData = { |
| | | ...returnForm.value, |
| | | usageStatus: "空é²", |
| | | id: currentReturnRow.value.carInfoRecordId |
| | | }; |
| | | returnVehicle(formData).then(() => { |
| | | proxy.$modal.msgSuccess("è¿è½¦æå"); |
| | | closeReturnDia(); |
| | | getList(); |
| | |
| | | proxy.resetForm("returnFormRef"); |
| | | returnFormVisible.value = false; |
| | | currentReturnRow.value = null; |
| | | }; |
| | | |
| | | // æ¥ç使ç¨è®°å½ |
| | | const viewUsageRecords = (row) => { |
| | | currentVehicleId.value = row.id; |
| | | usageRecordsPage.current = 1; |
| | | getUsageRecords(); |
| | | usageRecordsVisible.value = true; |
| | | }; |
| | | |
| | | // è·å使ç¨è®°å½ |
| | | const getUsageRecords = () => { |
| | | usageRecordsLoading.value = true; |
| | | getVehicleUsageRecords(usageRecordsPage, { vehicleId: currentVehicleId.value }) |
| | | .then((res) => { |
| | | usageRecordsLoading.value = false; |
| | | usageRecordsData.value = res.records || res.data || []; |
| | | usageRecordsTotal.value = res.total || 0; |
| | | }) |
| | | .catch(() => { |
| | | usageRecordsLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // 使ç¨è®°å½å页 |
| | | const usageRecordsPaginationChange = (obj) => { |
| | | usageRecordsPage.current = obj.page; |
| | | usageRecordsPage.size = obj.limit; |
| | | getUsageRecords(); |
| | | }; |
| | | |
| | | // å
³é使ç¨è®°å½å¼¹æ¡ |
| | | const closeUsageRecords = () => { |
| | | usageRecordsVisible.value = false; |
| | | usageRecordsData.value = []; |
| | | currentVehicleId.value = null; |
| | | }; |
| | | |
| | | // å¯¼åº |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">ä¾åºååç§°ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.supplierName" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | prefix-icon="Search" |
| | | /> |
| | | <span class="search_title ml10">åºåºæ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <!-- <el-button type="primary" @click="openForm('add')">æ°å¢</el-button> --> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | <el-button type="primary" plain @click="handlePrint">æå°</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)" |
| | | > |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column |
| | | label="åºåºæ¥æ" |
| | | prop="createTime" |
| | | min-width="250" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="ä¾åºååç§°" |
| | | prop="supplierName" |
| | | width="250" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="产å大类" |
| | | prop="productCategory" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="è§æ ¼åå·" |
| | | prop="specificationModel" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="åä½" |
| | | prop="unit" |
| | | width="80" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="åºåºæ°é" |
| | | prop="inboundNum" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="ç¨ç(%)" |
| | | prop="taxRate" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | width="180" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="åºåºäºº" |
| | | prop="createBy" |
| | | width="80" |
| | | show-overflow-tooltip |
| | | /> |
| | | <!-- <el-table-column |
| | | fixed="right" |
| | | label="æä½" |
| | | min-width="60" |
| | | align="center" |
| | | > |
| | | <template #default="scope"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="openForm('edit', scope.row)" |
| | | >ç¼è¾</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" |
| | | /> |
| | | </div> |
| | | |
| | | <el-tabs v-model="activeTab" @tab-change="handleTabChange"> |
| | | <el-tab-pane label="æååºåº" name="production"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">åºåºæ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <span class="search_title ml10">产å大类ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.productCategory" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | <el-button type="primary" plain @click="handlePrint">æå°</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)" |
| | | > |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="åºåºæ¥æ" prop="createTime" width="120" show-overflow-tooltip /> |
| | | <el-table-column label="éå®ååå·" prop="salesContractNo" width="180" show-overflow-tooltip /> |
| | | <el-table-column label="产å大类" prop="productCategory" show-overflow-tooltip /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> |
| | | <el-table-column label="åä½" prop="unit" width="80" show-overflow-tooltip /> |
| | | <el-table-column label="åºåºæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="åä»·(å
)" prop="unitPrice" width="150"></el-table-column> |
| | | <el-table-column label="æ»ä»·(å
)" prop="totalPrice" width="150"></el-table-column> |
| | | <el-table-column label="åºåºäºº" prop="createBy" width="80" show-overflow-tooltip /> |
| | | </el-table> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" |
| | | /> |
| | | </div> |
| | | </el-tab-pane> |
| | | |
| | | <el-tab-pane label="åæåºåº" name="purchase"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">åºåºæ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <span class="search_title ml10">产å大类ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.productCategory" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | <el-button type="primary" plain @click="handlePrint">æå°</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)" |
| | | > |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="åºåºæ¥æ" prop="createTime" width="120" show-overflow-tooltip /> |
| | | <el-table-column label="éè´ååå·" prop="purchaseContractNumber" width="180" show-overflow-tooltip /> |
| | | <el-table-column label="产å大类" prop="productCategory" show-overflow-tooltip /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> |
| | | <el-table-column label="åä½" prop="unit" width="80" show-overflow-tooltip /> |
| | | <el-table-column label="åºåºæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨åä»·(å
)" prop="taxInclusiveUnitPrice" width="150"></el-table-column> |
| | | <el-table-column label="å«ç¨æ»ä»·(å
)" prop="taxInclusiveTotalPrice" width="150"></el-table-column> |
| | | <el-table-column label="åºåºäºº" prop="createBy" width="80" show-overflow-tooltip /> |
| | | </el-table> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" |
| | | /> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | |
| | | <!-- æå°é¢è§å¼¹çª --> |
| | | <el-dialog |
| | | v-model="printPreviewVisible" |
| | |
| | | <div v-for="(item, index) in printData" :key="index" class="print-page"> |
| | | <div class="delivery-note"> |
| | | <div class="header"> |
| | | <div class="company-name">é¼è¯çå®ä¸æé责任å
¬å¸</div> |
| | | <div class="company-name">åæ³°ä¼ä¸ï¼å¤©æ´¥ï¼æéå
¬å¸</div> |
| | | <div class="document-title">é¶å®åè´§å</div> |
| | | </div> |
| | | |
| | | |
| | | <div class="info-section"> |
| | | <div class="info-row"> |
| | | <div> |
| | |
| | | <span class="value">{{ formatDate(item.createTime) }}</span> |
| | | </div> |
| | | <div> |
| | | |
| | | |
| | | <span class="label">客æ·åç§°ï¼</span> |
| | | <span class="value">{{ item.supplierName || 'å¼ ç±æ' }}</span> |
| | | </div> |
| | |
| | | <span class="value">{{ item.code }}</span> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="table-section"> |
| | | <table class="product-table"> |
| | | <thead> |
| | |
| | | </tfoot> |
| | | </table> |
| | | </div> |
| | | |
| | | |
| | | <div class="footer-section"> |
| | | <div class="footer-row"> |
| | | <div class="footer-item"> |
| | |
| | | </div> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | |
| | | |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref } from "vue"; |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | import { |
| | | getStockOutPage, |
| | | delStockOut, |
| | | getStockOutSemiProductPage, |
| | | } from "@/api/inventoryManagement/stockOut.js"; |
| | | import { |
| | | getStockInPageByProduct, |
| | | } from "@/api/inventoryManagement/stockIn.js"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const activeTab = ref('production'); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: "", |
| | | timeStr: "", |
| | | customerName: "", |
| | | productCategory:'', |
| | | timeStr: '', |
| | | }, |
| | | form: { |
| | | supplierId: null, |
| | |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const paginationSemiProductChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | getStockOutPage({ ...searchForm.value, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | tableData.value.map((item) => { |
| | | item.children = []; |
| | | }); |
| | | total.value = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | const params = { ...page } |
| | | if (activeTab.value === 'production') { |
| | | params.customerName = searchForm.value.customerName |
| | | params.timeStr = searchForm.value.timeStr |
| | | } else { |
| | | params.supplierName = searchForm.value.supplierName |
| | | params.timeStr = searchForm.value.timeStr |
| | | } |
| | | params.productCategory = searchForm.value.productCategory |
| | | |
| | | // æ ¹æ®ä¸åç tab ç±»åè°ç¨ä¸åçæ¥å£\ |
| | | if (activeTab.value === 'semiProduct') { |
| | | const apiCall = getStockOutSemiProductPage(params) |
| | | apiCall |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | }) |
| | | }else { |
| | | const apiCall = activeTab.value === 'production' |
| | | ? getStockInPageByProduct(params) |
| | | : getStockOutPage(params) |
| | | |
| | | apiCall |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | tableData.value.map((item) => { |
| | | item.children = []; |
| | | // åç«¯è®¡ç®æ»ä»· |
| | | const inboundNum = Number(item.inboundNum) || 0; |
| | | if (activeTab.value === 'production') { |
| | | // æååºåºï¼æ»ä»· = unitPrice à inboundNum |
| | | const unitPrice = Number(item.unitPrice) || 0; |
| | | item.totalPrice = (unitPrice * inboundNum).toFixed(2); |
| | | } else { |
| | | // åæåºåºï¼æ»ä»· = taxInclusiveUnitPrice à inboundNum |
| | | const taxInclusiveUnitPrice = Number(item.taxInclusiveUnitPrice) || 0; |
| | | item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * inboundNum).toFixed(2); |
| | | } |
| | | }); |
| | | total.value = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | } |
| | | |
| | | }; |
| | | |
| | | const handleTabChange = () => { |
| | | page.current = 1 |
| | | searchForm.value.supplierName = '' |
| | | searchForm.value.customerName = '' |
| | | searchForm.value.timeStr = '' |
| | | selectedRows.value = [] |
| | | searchForm.value.productCategory = '' |
| | | getList() |
| | | }; |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/stockmanagement/export", {}, "åºåºå°è´¦.xlsx"); |
| | | // æ ¹æ®ä¸åç tab ç±»åè°ç¨ä¸åçå¯¼åºæ¥å£ |
| | | let exportUrl = "/stockmanagement/export" |
| | | if (activeTab.value === 'production') { |
| | | exportUrl = "/stockmanagement/exportone" |
| | | } |
| | | proxy.download(exportUrl, {}, "åºåºå°è´¦.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | |
| | | const executePrint = () => { |
| | | console.log('å¼å§æ§è¡æå°ï¼æ°æ®æ¡æ°:', printData.value.length); |
| | | console.log('æå°æ°æ®:', printData.value); |
| | | |
| | | |
| | | // å建ä¸ä¸ªæ°çæå°çªå£ |
| | | const printWindow = window.open('', '_blank', 'width=800,height=600'); |
| | | |
| | | |
| | | // æå»ºæå°å
容 |
| | | let printContent = ` |
| | | <!DOCTYPE html> |
| | |
| | | </head> |
| | | <body> |
| | | `; |
| | | |
| | | |
| | | // ä¸ºæ¯æ¡æ°æ®çææå°é¡µé¢ |
| | | printData.value.forEach((item, index) => { |
| | | printContent += ` |
| | | <div class="print-page"> |
| | | <div class="delivery-note"> |
| | | <div class="header"> |
| | | <div class="company-name">é¼è¯çå®ä¸æé责任å
¬å¸</div> |
| | | <div class="company-name">åæ³°ä¼ä¸ï¼å¤©æ´¥ï¼æéå
¬å¸</div> |
| | | <div class="document-title">é¶å®åè´§å</div> |
| | | </div> |
| | | |
| | |
| | | </div> |
| | | `; |
| | | }); |
| | | |
| | | |
| | | printContent += ` |
| | | </body> |
| | | </html> |
| | | `; |
| | | |
| | | |
| | | // åå
¥å
容尿°çªå£ |
| | | printWindow.document.write(printContent); |
| | | printWindow.document.close(); |
| | | |
| | | |
| | | // çå¾
å
容å è½½å®æåæå° |
| | | printWindow.onload = () => { |
| | | setTimeout(() => { |
| | |
| | | const seconds = String(date.getSeconds()).padStart(2, "0"); |
| | | return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`; |
| | | }; |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); // æä»½ä»0å¼å§ |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | |
| | | padding: 15px; |
| | | border-bottom: 1px solid #e4e7ed; |
| | | text-align: center; |
| | | |
| | | |
| | | .el-button { |
| | | margin: 0 10px; |
| | | } |
| | | } |
| | | |
| | | |
| | | .print-preview-content { |
| | | padding: 20px; |
| | | background-color: #f5f5f5; |
| | |
| | | .header { |
| | | text-align: center; |
| | | margin-bottom: 8px; |
| | | |
| | | |
| | | .company-name { |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | margin-bottom: 4px; |
| | | } |
| | | |
| | | |
| | | .document-title { |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | |
| | | |
| | | .info-row { |
| | | line-height: 20px; |
| | | |
| | | |
| | | .label { |
| | | font-weight: bold; |
| | | width: 60px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | |
| | | .value { |
| | | margin-right: 20px; |
| | | min-width: 80px; |
| | |
| | | .table-section { |
| | | margin-bottom: 4px; |
| | | flex: 1; |
| | | |
| | | |
| | | .product-table { |
| | | width: 100%; |
| | | border-collapse: collapse; |
| | | border: 1px solid #000; |
| | | |
| | | |
| | | th, td { |
| | | border: 1px solid #000; |
| | | padding: 6px; |
| | |
| | | font-size: 14px; |
| | | line-height: 1.4; |
| | | } |
| | | |
| | | |
| | | th { |
| | | font-weight: bold; |
| | | } |
| | | |
| | | |
| | | .total-label { |
| | | text-align: right; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | |
| | | .total-value { |
| | | font-weight: bold; |
| | | } |
| | |
| | | margin-bottom: 3px; |
| | | line-height: 20px; |
| | | justify-content: space-between; |
| | | |
| | | |
| | | .footer-item { |
| | | display: flex; |
| | | margin-right: 20px; |
| | | |
| | | |
| | | .label { |
| | | font-weight: bold; |
| | | width: 80px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | |
| | | .value { |
| | | min-width: 80px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | |
| | | &.address-item { |
| | | .address-value { |
| | | min-width: 200px; |
| | |
| | | .app-container { |
| | | display: none; |
| | | } |
| | | |
| | | |
| | | .print-page { |
| | | box-shadow: none; |
| | | margin: 0; |
| | |
| | | } |
| | | } |
| | | </style> |
| | | |
| | | |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">ä¾åºååç§°ï¼</span> |
| | | <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="请è¾å
¥" @change="handleQuery" |
| | | clearable prefix-icon="Search" /> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <!-- <el-button type="primary" @click="openForm('add')">æ°å¢åºåº</el-button> --> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <!-- <el-button type="danger" plain @click="handleDelete">å é¤</el-button> --> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary style="width: 100%" |
| | | :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="å
¥åºæ¶é´" prop="createTime" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å
¥åºæ¹æ¬¡" prop="inboundBatches" width="160" show-overflow-tooltip /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" width="240" show-overflow-tooltip /> |
| | | <el-table-column label="产å大类" prop="productCategory" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="200" show-overflow-tooltip /> |
| | | <el-table-column label="åä½" prop="unit" width="70" show-overflow-tooltip /> |
| | | <el-table-column label="å
¥åºæ°é" prop="inboundNum" width="90" show-overflow-tooltip /> |
| | | <el-table-column label="åºåæ°é" prop="inboundNum0" width="90" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" show-overflow-tooltip /> |
| | | <el-table-column label="ä¸å«ç¨æ»ä»·" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å
¥åºäºº" prop="createBy" width="80" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="æä½" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm(scope.row);">é¢ç¨</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | </div> |
| | | <el-dialog v-model="dialogFormVisible" :title="'æ°å¢åºåº'" width="40%" @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-form-item label="åºåºæ°éï¼" prop="salesContractNo"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.inboundQuantity" placeholder="请è¾å
¥" clearable /> |
| | | <el-tabs v-model="activeTab" |
| | | @tab-change="handleTabChange"> |
| | | <el-tab-pane label="æååºåº" |
| | | name="production"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">产å大类ï¼</span> |
| | | <el-input v-model="searchForm.productCategory" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | clearable /> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="row => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="éå®ååå·" |
| | | prop="salesContractNo" |
| | | width="180" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="产å大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="è§æ ¼åå·" |
| | | prop="specificationModel" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="åä½" |
| | | prop="unit" |
| | | width="70" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="å©ä½åºå" |
| | | prop="inboundNum0" |
| | | width="90" |
| | | show-overflow-tooltip /> |
| | | <el-table-column fixed="right" |
| | | label="æä½" |
| | | min-width="60" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-button :disabled="scope.row.inboundNum0 <= 0" |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="openForm(scope.row);">åè´§</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" /> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="åæåºåº" |
| | | name="purchase"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">产å大类ï¼</span> |
| | | <el-input v-model="searchForm.productCategory" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | clearable /> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="row => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" |
| | | type="selection" |
| | | width="55" /> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="éè´ååå·" |
| | | prop="purchaseContractNumber" |
| | | width="180" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="产å大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="è§æ ¼åå·" |
| | | prop="specificationModel" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="åä½" |
| | | prop="unit" |
| | | width="70" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="å©ä½åºå" |
| | | prop="inboundNum0" |
| | | width="90" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | width="150"></el-table-column> |
| | | <el-table-column label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | width="150"></el-table-column> |
| | | <el-table-column fixed="right" |
| | | label="æä½" |
| | | min-width="60" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-button link |
| | | :disabled="scope.row.inboundNum0 <= 0" |
| | | type="primary" |
| | | size="small" |
| | | @click="openForm(scope.row);">é¢ç¨</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" /> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | <el-dialog v-model="dialogFormVisible" |
| | | :title="getDialogTitle()" |
| | | width="40%" |
| | | @close="closeDia"> |
| | | <el-form :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef"> |
| | | <div>{{getAvailableQuantityText()}}:{{currentRowNum}}</div> |
| | | <el-form-item :label="getQuantityLabel()" |
| | | prop="salesContractNo"> |
| | | <el-input-number :step="0.01" |
| | | :min="0" |
| | | style="width: 100%" |
| | | v-model="form.inboundQuantity" |
| | | placeholder="请è¾å
¥" |
| | | clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="åºåºæ¥æï¼" prop="projectName"> |
| | | <el-date-picker style="width: 100%" v-model="form.inboundTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" |
| | | type="date" placeholder="è¯·éæ©" clearable /> |
| | | <el-form-item :label="getDateLabel()" |
| | | prop="projectName"> |
| | | <el-date-picker style="width: 100%" |
| | | v-model="form.inboundTime" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="åºåºäººï¼" prop="entryPerson"> |
| | | <el-select v-model="form.nickName" placeholder="è¯·éæ©" clearable> |
| | | <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> |
| | | <el-form-item :label="getPersonLabel()" |
| | | prop="entryPerson"> |
| | | <el-select v-model="form.nickName" |
| | | filterable |
| | | default-first-option |
| | | :reserve-keyword="false" |
| | | placeholder="è¯·éæ©" |
| | | clearable> |
| | | <el-option v-for="item in userList" |
| | | :key="item.userId" |
| | | :label="item.nickName" |
| | | :value="item.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button type="primary" |
| | | @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref } from 'vue' |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { |
| | | getStockInPage |
| | | } from "@/api/inventoryManagement/stockIn.js"; |
| | | import { |
| | | getStockManagePage, |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { |
| | | getStockInPage, |
| | | getStockInPageByProduction, |
| | | getStockInPageByProductProduction, |
| | | } from "@/api/inventoryManagement/stockIn.js"; |
| | | import { |
| | | getStockManagePage, |
| | | delStockManage, |
| | | stockOut, |
| | | } from "@/api/inventoryManagement/stockManage.js"; |
| | | } from "@/api/inventoryManagement/stockManage.js"; |
| | | |
| | | const userStore = useUserStore() |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const userList = ref([]) |
| | | const tableLoading = ref(false) |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | const fileList = ref([]) |
| | | const userStore = useUserStore(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const dialogFormVisible = ref(false) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: '', |
| | | inboundQuantity:'', |
| | | inboundTime:'', |
| | | nickName: '', |
| | | userId: '', |
| | | timeStr: '', |
| | | }, |
| | | form: { |
| | | productrecordId: '', |
| | | }, |
| | | rules: { |
| | | inboundTime: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | inboundQuantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | nickname: [{ required: true, message: "è¯·éæ©", trigger: "change" }] |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const dialogFormVisible = ref(false); |
| | | const activeTab = ref("production"); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: "", |
| | | customerName: "", |
| | | inboundQuantity: "", |
| | | inboundTime: "", |
| | | nickName: "", |
| | | userId: "", |
| | | productCategory: "", |
| | | timeStr: "", |
| | | }, |
| | | form: { |
| | | productrecordId: "", |
| | | }, |
| | | rules: { |
| | | inboundTime: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | inboundQuantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | nickname: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | getStockInPage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | total.value = res.data.total |
| | | console.log('res', res.data.records) |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | const findNodeById = (nodes, productId) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === productId) { |
| | | return nodes[i].label; // æ¾å°èç¹ï¼è¿å该èç¹ |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...page }; |
| | | if (activeTab.value === "production") { |
| | | params.customerName = searchForm.value.customerName; |
| | | params.timeStr = searchForm.value.timeStr; |
| | | } else { |
| | | params.supplierName = searchForm.value.supplierName; |
| | | params.timeStr = searchForm.value.timeStr; |
| | | } |
| | | if (nodes[i].children && nodes[i].children.length > 0) { |
| | | const foundNode = findNodeById(nodes[i].children, productId); |
| | | if (foundNode) { |
| | | return foundNode.label; // å¨åèç¹ä¸æ¾å°ï¼è¿å该èç¹ |
| | | } |
| | | params.productCategory = searchForm.value.productCategory; |
| | | let apiCall; |
| | | if (activeTab.value === "production") { |
| | | apiCall = getStockInPageByProduction(params); |
| | | } else if (activeTab.value === "product") { |
| | | apiCall = getStockInPageByProductProduction(params); |
| | | }else { |
| | | apiCall = getStockInPage(params); |
| | | } |
| | | } |
| | | return null; // æ²¡ææ¾å°èç¹ï¼è¿ånull |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | // è¿æ»¤æåæ°æ® |
| | | selectedRows.value = selection.filter(item => item.id); |
| | | console.log('selection', selectedRows.value) |
| | | } |
| | | const expandedRowKeys = ref([]) |
| | | |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']); |
| | | }; |
| | | const currentRowId = ref(null) // æ°å¢ï¼åå¨å½åæä½çè¡ID |
| | | |
| | | const currentRowNum = ref(0) |
| | | const salesLedgerProductId = ref(null); |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = async (row) => { |
| | | dialogFormVisible.value = true |
| | | currentRowId.value = row.id |
| | | currentRowNum.value = row.inboundNum0 |
| | | salesLedgerProductId.value = row.salesLedgerProductId |
| | | form.value = {} |
| | | // åå§åè¡¨åæ°æ® |
| | | form.value = { |
| | | productrecordId: '', |
| | | inboundQuantity: '', // åºåºæ°éæ¸
空 |
| | | inboundTime: getCurrentDate(), // é»è®¤å½åæ¥æ |
| | | nickName: '', // é»è®¤å½åç¨æ· |
| | | } |
| | | console.log('form',form.value) |
| | | // å è½½ç¨æ·å表 |
| | | try { |
| | | const userLists = await userListNoPageByTenantId() |
| | | userList.value = userLists.data |
| | | } catch (error) { |
| | | console.error('å è½½ç¨æ·å表失败:', error) |
| | | } |
| | | } |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | let num = Number(form.value.inboundQuantity) |
| | | if(num <= 0 || num > currentRowNum.value){ |
| | | return proxy.$modal.msgWarning("请填å
¥æææ°å") |
| | | } |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid && currentRowId.value) { |
| | | const outData = { |
| | | id: currentRowId.value, // åå§è®°å½ID |
| | | salesLedgerProductId: salesLedgerProductId.value, |
| | | quantity: form.value.inboundQuantity, // åºåºæ°é |
| | | time: form.value.inboundTime, // åºåºæ¶é´ |
| | | userId: form.value.nickName // æä½äºº |
| | | } |
| | | console.log(outData) |
| | | |
| | | stockOut(outData).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }).catch(err => { |
| | | proxy.$modal.msgError("åºåºå¤±è´¥") |
| | | apiCall |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | total.value = res.data.total; |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef") |
| | | dialogFormVisible.value = false |
| | | } |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm( |
| | | 'æ¯å¦ç¡®è®¤å¯¼åºï¼', |
| | | '导åº', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | proxy.download("/stockin/export", {}, 'å
¥åºå°è´¦.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | }) |
| | | } |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = [] |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map(item => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning('è¯·éæ©æ°æ®') |
| | | return |
| | | } |
| | | ElMessageBox.confirm( |
| | | 'éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', |
| | | '导åº', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | delStockManage(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | getList() |
| | | const handleTabChange = () => { |
| | | page.current = 1; |
| | | searchForm.value.supplierName = ""; |
| | | searchForm.value.customerName = ""; |
| | | searchForm.value.timeStr = ""; |
| | | selectedRows.value = []; |
| | | searchForm.value.productCategory = ""; |
| | | getList(); |
| | | }; |
| | | |
| | | const findNodeById = (nodes, productId) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === productId) { |
| | | return nodes[i].label; // æ¾å°èç¹ï¼è¿å该èç¹ |
| | | } |
| | | if (nodes[i].children && nodes[i].children.length > 0) { |
| | | const foundNode = findNodeById(nodes[i].children, productId); |
| | | if (foundNode) { |
| | | return foundNode.label; // å¨åèç¹ä¸æ¾å°ï¼è¿å该èç¹ |
| | | } |
| | | } |
| | | } |
| | | return null; // æ²¡ææ¾å°èç¹ï¼è¿ånull |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = selection => { |
| | | // è¿æ»¤æåæ°æ® |
| | | selectedRows.value = selection.filter(item => item.id); |
| | | console.log("selection", selectedRows.value); |
| | | }; |
| | | const expandedRowKeys = ref([]); |
| | | |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = param => { |
| | | return proxy.summarizeTable(param, [ |
| | | "contractAmount", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ]); |
| | | }; |
| | | const currentRowId = ref(null); // æ°å¢ï¼åå¨å½åæä½çè¡ID |
| | | |
| | | const currentRowNum = ref(0); |
| | | const salesLedgerProductId = ref(null); |
| | | const productModelId = ref(null); |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = async row => { |
| | | dialogFormVisible.value = true; |
| | | currentRowId.value = row.id; |
| | | currentRowNum.value = row.inboundNum0; |
| | | salesLedgerProductId.value = row.salesLedgerProductId; |
| | | productModelId.value = row.productModelId; |
| | | form.value = {}; |
| | | // åå§åè¡¨åæ°æ® |
| | | form.value = { |
| | | productrecordId: "", |
| | | inboundQuantity: "", // åºåºæ°éæ¸
空 |
| | | inboundTime: getCurrentDate(), // é»è®¤å½åæ¥æ |
| | | nickName: "", // é»è®¤å½åç¨æ· |
| | | }; |
| | | console.log("form", form.value); |
| | | // å è½½ç¨æ·å表 |
| | | try { |
| | | const userLists = await userListNoPageByTenantId(); |
| | | userList.value = userLists.data; |
| | | } catch (error) { |
| | | console.error("å è½½ç¨æ·å表失败:", error); |
| | | } |
| | | }; |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | let num = Number(form.value.inboundQuantity); |
| | | if (num <= 0 || num > currentRowNum.value) { |
| | | return proxy.$modal.msgWarning("请填å
¥æææ°å"); |
| | | } |
| | | if (!form.value.nickName) { |
| | | return proxy.$modal.msgWarning("è¯·éæ©æä½äºº"); |
| | | } |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid && currentRowId.value) { |
| | | const typeMap = { production: 2, purchase: 1, product: 4 }; |
| | | const outData = { |
| | | id: currentRowId.value, // åå§è®°å½ID |
| | | salesLedgerProductId: salesLedgerProductId.value, |
| | | quantity: form.value.inboundQuantity, // åºåºæ°é |
| | | time: form.value.inboundTime, // åºåºæ¶é´ |
| | | userId: form.value.nickName, // æä½äºº |
| | | type: typeMap[activeTab.value], // åºåºç±»åï¼éè´1ï¼ç产2 |
| | | productModelId: productModelId.value, |
| | | }; |
| | | console.log(outData); |
| | | |
| | | stockOut(outData) |
| | | .then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }) |
| | | .catch(err => { |
| | | proxy.$modal.msgError("åºåºå¤±è´¥"); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | }) |
| | | } |
| | | onMounted(() => { |
| | | getList() |
| | | }) |
| | | .then(() => { |
| | | // æ ¹æ®ä¸åç tab ç±»åè°ç¨ä¸åçå¯¼åºæ¥å£ |
| | | let exportUrl = "/stockin/export"; |
| | | if (activeTab.value === "production") { |
| | | exportUrl = "/stockin/exportOne"; |
| | | } |
| | | proxy.download(exportUrl, {}, "å
¥åºå°è´¦.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map(item => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | delStockManage(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); // æä»½ä»0å¼å§ |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | |
| | | // æ ¹æ®tabç±»åè·åå¼¹æ¡æ é¢ |
| | | const getDialogTitle = () => { |
| | | const titleMap = { |
| | | production: "æ°å¢åè´§", |
| | | purchase: "æ°å¢é¢ç¨", |
| | | }; |
| | | return titleMap[activeTab.value] || "æ°å¢åºåº"; |
| | | }; |
| | | |
| | | // æ ¹æ®tabç±»åè·åå¯åºåºæ°éææ¬ |
| | | const getAvailableQuantityText = () => { |
| | | const textMap = { |
| | | production: "å¯åè´§æ°é", |
| | | purchase: "å¯é¢ç¨æ°é", |
| | | }; |
| | | return textMap[activeTab.value] || "å¯åºåºæ°é"; |
| | | }; |
| | | |
| | | // æ ¹æ®tabç±»åè·åæ°éåæ®µæ ç¾ |
| | | const getQuantityLabel = () => { |
| | | const labelMap = { |
| | | production: "åè´§æ°éï¼", |
| | | purchase: "é¢ç¨æ°éï¼", |
| | | }; |
| | | return labelMap[activeTab.value] || "åºåºæ°éï¼"; |
| | | }; |
| | | |
| | | // æ ¹æ®tabç±»åè·åæ¥æåæ®µæ ç¾ |
| | | const getDateLabel = () => { |
| | | const labelMap = { |
| | | production: "åè´§æ¥æï¼", |
| | | purchase: "é¢ç¨æ¥æï¼", |
| | | }; |
| | | return labelMap[activeTab.value] || "åºåºæ¥æï¼"; |
| | | }; |
| | | |
| | | // æ ¹æ®tabç±»åè·å人ååæ®µæ ç¾ |
| | | const getPersonLabel = () => { |
| | | const labelMap = { |
| | | production: "å货人ï¼", |
| | | purchase: "é¢ç¨äººï¼", |
| | | }; |
| | | return labelMap[activeTab.value] || "åºåºäººï¼"; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | | |
| | | |
| | |
| | | <template> |
| | | <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢èªå®ä¹å
¥åº' : 'ç¼è¾èªå®ä¹å
¥åº'" width="70%" |
| | | <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢æåå
¥åº' : 'ç¼è¾æåå
¥åº'" width="70%" |
| | | @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <div style="margin-bottom: 10px;" v-if="operationType === 'add'"> |
| | |
| | | width="60" |
| | | /> |
| | | <el-table-column label="产å大类" prop="productCategory" width="200"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.productCategory" placeholder="请è¾å
¥äº§å大类" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="200"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.specificationModel" placeholder="请è¾å
¥è§æ ¼åå·" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="åä½" prop="unit" width="100"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.unit" placeholder="请è¾å
¥åä½" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å
¥åºæ°é" prop="inboundNum" width="150"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.inboundNum" @change="() => calculateTotalPrice(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å
¥åºæ¥æ" prop="inboundDate" width="180"> |
| | | <template #default="scope"> |
| | | <el-date-picker |
| | | v-model="scope.row.inboundDate" |
| | | type="date" |
| | | placeholder="è¯·éæ©å
¥åºæ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | style="width: 100%" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="åä»·(å
)" prop="unitPrice" width="150"> |
| | | <el-table-column label="åä»·(å
)" prop="unitPrice" width="210"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.unitPrice" @change="() => calculateTotalPrice(scope.row)" /> |
| | | </template> |
| | |
| | | prop="totalPrice" |
| | | width="150" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="80" v-if="operationType === 'add'"> |
| | | <template #default="scope"> |
| | | <el-button type="danger" size="small" @click="removeProductRow(scope.$index)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | |
| | | const productList = ref([]);// 产ååè¡¨æ°æ® |
| | | const loadingProducts = ref(false);// 产åå è½½ç¶æ |
| | | const loading = ref(false); |
| | | const currentTabType = ref('');// å½åæ ç¾é¡µç±»å ('production' for æåå
¥åº, etc.) |
| | | |
| | | function formatDateTime(date = new Date(), includeTime = true) { |
| | | const d = new Date(date); |
| | |
| | | loading.value = true |
| | | if (operationType.value === 'edit') { |
| | | const editPayload = payloadList[0] |
| | | await updateProduct(editPayload) |
| | | // å¦ææ¯æåå
¥åºç¼è¾ï¼æ·»å type: 3åæ° |
| | | if (currentTabType.value === 'production') { |
| | | await updateProduct({...editPayload, type: 3}) |
| | | } else { |
| | | await updateProduct(editPayload) |
| | | } |
| | | } else { |
| | | await addStockInCustom(payloadList) |
| | | } |
| | |
| | | emit('close') |
| | | } |
| | | |
| | | const openDialog = async (type, row) => { |
| | | const openDialog = async (type, row, tabType) => { |
| | | operationType.value = type |
| | | currentTabType.value = tabType || '' // å卿 ç¾é¡µç±»å |
| | | dialogFormVisible.value = true |
| | | |
| | | if (type === 'add') { |
| | |
| | | <el-table-column label="å
¥åºæ¶é´" |
| | | prop="createTime" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="éå®ååå·" |
| | | prop="salesContractNo" |
| | | width="180" |
| | | show-overflow-tooltip/> |
| | | |
| | | <el-table-column label="产å大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip/> |
| | |
| | | <el-table-column label="æ»ä»·(å
)" |
| | | prop="totalPrice" |
| | | width="150"></el-table-column> |
| | | <!-- <el-table-column fixed="right" |
| | | <el-table-column fixed="right" |
| | | label="æä½" |
| | | min-width="60" |
| | | align="center"> |
| | |
| | | size="small" |
| | | @click="openForm('edit', scope.row, 'production');">ç¼è¾</el-button> |
| | | </template> |
| | | </el-table-column> --> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" |
| | | :total="total" |
| | |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange"/> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="ç产å
¥åº" |
| | | name="product"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery"/> |
| | | <span class="search_title ml10">产å大类ï¼</span> |
| | | <el-input v-model="searchForm.productCategory" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | clearable/> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢ |
| | | </el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" |
| | | @click="openForm('add', 'purchase')">æ°å¢å
¥åº |
| | | </el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | @click="handleDelete">å é¤ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="row => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" |
| | | type="selection" |
| | | width="55"/> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60"/> |
| | | <el-table-column label="å
¥åºæ¶é´" |
| | | prop="createTime" |
| | | width="100" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="产å大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="è§æ ¼åå·" |
| | | prop="specificationModel" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="åä½" |
| | | prop="unit" |
| | | width="220" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="å
¥åºæ°é" |
| | | prop="inboundNum" |
| | | width="220" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="å
¥åºäºº" |
| | | prop="createBy" |
| | | width="220" |
| | | show-overflow-tooltip/> |
| | | </el-table> |
| | | <pagination v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="pageProductChange"/> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | |
| | | const currentTab = tabType || activeTab.value; |
| | | await nextTick(() => { |
| | | if (currentTab === "production") { |
| | | formDiaProduct.value?.openDialog(type, row); |
| | | formDiaProduct.value?.openDialog(type, row, currentTab); |
| | | } else { |
| | | formDia.value?.openDialog(type, row); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog :model-value="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢æååºå' : 'ç¼è¾æååºå'" width="70%" |
| | | @update:model-value="$emit('update:dialogFormVisible', $event)" @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产å大类ï¼" prop="productCategory"> |
| | | <el-input disabled v-model="form.productCategory" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è§æ ¼åå·ï¼" prop="specificationModel"> |
| | | <el-input disabled v-model="form.specificationModel" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åä½ï¼" prop="unit"> |
| | | <el-input disabled v-model="form.unit" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å
¥åºæ¶é´ï¼" prop="createTime"> |
| | | <el-date-picker style="width: 100%" v-model="form.createTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" |
| | | type="date" placeholder="è¯·éæ©" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åºåæ°éï¼" prop="inboundNum"> |
| | | <el-input v-model="form.inboundNum" placeholder="请è¾å
¥" clearable @input="calculateTotalPrice" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·²åºåºæ°éï¼" prop="totalInboundNum"> |
| | | <el-input disabled v-model="form.totalInboundNum" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¾
åºåºæ°éï¼" prop="inboundNum0"> |
| | | <el-input disabled v-model="form.inboundNum0" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åä»·(å
)ï¼" prop="unitPrice"> |
| | | <el-input v-model="form.unitPrice" placeholder="请è¾å
¥" clearable @input="calculateTotalPrice" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ»ä»·(å
)ï¼" prop="totalPrice"> |
| | | <el-input disabled v-model="form.totalPrice" placeholder="èªå¨è®¡ç®" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, toRefs, watch } from 'vue' |
| | | |
| | | const props = defineProps({ |
| | | dialogFormVisible: Boolean, |
| | | operationType: String, |
| | | formData: Object |
| | | }) |
| | | |
| | | const emit = defineEmits(['update:dialogFormVisible', 'submit', 'close']) |
| | | |
| | | const formRef = ref() |
| | | |
| | | const data = reactive({ |
| | | form: { |
| | | productCategory: '', |
| | | specificationModel: '', |
| | | unit: '', |
| | | createTime: '', |
| | | inboundNum: '', |
| | | totalInboundNum: '', |
| | | inboundNum0: '', |
| | | unitPrice: '', |
| | | totalPrice: '' |
| | | }, |
| | | rules: { |
| | | productCategory: [{ required: true, message: '请è¾å
¥äº§å大类', trigger: 'blur' }], |
| | | specificationModel: [{ required: true, message: '请è¾å
¥è§æ ¼åå·', trigger: 'blur' }], |
| | | unit: [{ required: true, message: '请è¾å
¥åä½', trigger: 'blur' }], |
| | | createTime: [{ required: true, message: 'è¯·éæ©å
¥åºæ¶é´', trigger: 'change' }], |
| | | inboundNum: [{ required: true, message: '请è¾å
¥åºåæ°é', trigger: 'blur' }], |
| | | unitPrice: [{ required: true, message: '请è¾å
¥åä»·', trigger: 'blur' }] |
| | | } |
| | | }) |
| | | |
| | | const { form, rules } = toRefs(data) |
| | | |
| | | // è®¡ç®æ»ä»·ï¼æ»ä»· = åä»· à å©ä½åºå |
| | | const calculateTotalPrice = () => { |
| | | const unitPrice = parseFloat(form.value.unitPrice) || 0 |
| | | const stockQuantity = parseFloat(form.value.inboundNum) || 0 // åºåæ°é |
| | | const outboundQuantity = parseFloat(form.value.totalInboundNum) || 0 // å·²åºåºæ°é |
| | | const remainingStock = stockQuantity - outboundQuantity // å©ä½åºå |
| | | form.value.totalPrice = (unitPrice * remainingStock).toFixed(2) |
| | | } |
| | | |
| | | // çå¬formDataåå |
| | | watch(() => props.formData, (newVal) => { |
| | | if (newVal) { |
| | | form.value = { ...newVal } |
| | | // æ°æ®åååéæ°è®¡ç®æ»ä»· |
| | | calculateTotalPrice() |
| | | } |
| | | }, { immediate: true }) |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | formRef.value.validate(valid => { |
| | | if (valid) { |
| | | emit('submit', form.value) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | emit('close') |
| | | emit('update:dialogFormVisible', false) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .dialog-footer { |
| | | text-align: center; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog :model-value="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢åæåºå' : 'ç¼è¾åæåºå'" width="70%" |
| | | @update:model-value="$emit('update:dialogFormVisible', $event)" @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产å大类ï¼" prop="productCategory"> |
| | | <el-input disabled v-model="form.productCategory" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è§æ ¼åå·ï¼" prop="specificationModel"> |
| | | <el-input disabled v-model="form.specificationModel" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åä½ï¼" prop="unit"> |
| | | <el-input disabled v-model="form.unit" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å
¥åºæ¶é´ï¼" prop="createTime"> |
| | | <el-date-picker style="width: 100%" v-model="form.createTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" |
| | | type="date" placeholder="è¯·éæ©" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åºåæ°éï¼" prop="inboundNum"> |
| | | <el-input v-model="form.inboundNum" placeholder="请è¾å
¥" clearable @input="calculateTotalPrice" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·²åºåºæ°éï¼" prop="totalInboundNum"> |
| | | <el-input disabled v-model="form.totalInboundNum" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¾
åºåºæ°éï¼" prop="inboundNum0"> |
| | | <el-input disabled v-model="form.inboundNum0" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å«ç¨åä»·(å
)ï¼" prop="taxInclusiveUnitPrice"> |
| | | <el-input v-model="form.taxInclusiveUnitPrice" placeholder="请è¾å
¥" clearable @input="calculateTotalPrice" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å«ç¨æ»ä»·(å
)ï¼" prop="taxInclusiveTotalPrice"> |
| | | <el-input disabled v-model="form.taxInclusiveTotalPrice" placeholder="èªå¨è®¡ç®" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, toRefs, watch } from 'vue' |
| | | |
| | | const props = defineProps({ |
| | | dialogFormVisible: Boolean, |
| | | operationType: String, |
| | | formData: Object |
| | | }) |
| | | |
| | | const emit = defineEmits(['update:dialogFormVisible', 'submit', 'close']) |
| | | |
| | | const formRef = ref() |
| | | |
| | | const data = reactive({ |
| | | form: { |
| | | productCategory: '', |
| | | specificationModel: '', |
| | | unit: '', |
| | | createTime: '', |
| | | inboundNum: '', |
| | | totalInboundNum: '', |
| | | inboundNum0: '', |
| | | taxInclusiveUnitPrice: '', |
| | | taxInclusiveTotalPrice: '' |
| | | }, |
| | | rules: { |
| | | productCategory: [{ required: true, message: '请è¾å
¥äº§å大类', trigger: 'blur' }], |
| | | specificationModel: [{ required: true, message: '请è¾å
¥è§æ ¼åå·', trigger: 'blur' }], |
| | | unit: [{ required: true, message: '请è¾å
¥åä½', trigger: 'blur' }], |
| | | createTime: [{ required: true, message: 'è¯·éæ©å
¥åºæ¶é´', trigger: 'change' }], |
| | | inboundNum: [{ required: true, message: '请è¾å
¥åºåæ°é', trigger: 'blur' }], |
| | | taxInclusiveUnitPrice: [{ required: true, message: '请è¾å
¥å«ç¨åä»·', trigger: 'blur' }] |
| | | } |
| | | }) |
| | | |
| | | const { form, rules } = toRefs(data) |
| | | |
| | | // è®¡ç®æ»ä»·ï¼å«ç¨æ»ä»· = å«ç¨åä»· à å©ä½åºå |
| | | const calculateTotalPrice = () => { |
| | | const unitPrice = parseFloat(form.value.taxInclusiveUnitPrice) || 0 |
| | | const stockQuantity = parseFloat(form.value.inboundNum) || 0 // åºåæ°é |
| | | const outboundQuantity = parseFloat(form.value.totalInboundNum) || 0 // å·²åºåºæ°é |
| | | const remainingStock = stockQuantity - outboundQuantity // å©ä½åºå |
| | | form.value.taxInclusiveTotalPrice = (unitPrice * remainingStock).toFixed(2) |
| | | } |
| | | |
| | | // çå¬formDataåå |
| | | watch(() => props.formData, (newVal) => { |
| | | if (newVal) { |
| | | form.value = { ...newVal } |
| | | // æ°æ®åååéæ°è®¡ç®æ»ä»· |
| | | calculateTotalPrice() |
| | | } |
| | | }, { immediate: true }) |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | formRef.value.validate(valid => { |
| | | if (valid) { |
| | | emit('submit', form.value) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | emit('close') |
| | | emit('update:dialogFormVisible', false) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .dialog-footer { |
| | | text-align: center; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">ä¾åºååç§°ï¼</span> |
| | | <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="请è¾å
¥" @change="handleQuery" |
| | | clearable prefix-icon="Search" /> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <!-- <el-button type="primary" @click="openForm('add')">æ°å¢</el-button> --> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary style="width: 100%" |
| | | :row-class-name="tableRowClassName" |
| | | :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="å
¥åºæ¥æ" prop="createTime" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" width="240" show-overflow-tooltip /> |
| | | <el-table-column label="产å大类" prop="productCategory" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="200" show-overflow-tooltip /> |
| | | <el-table-column label="åä½" prop="unit" width="80" show-overflow-tooltip /> |
| | | <el-table-column label="åºåæ°é" prop="inboundNum0" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="åºåé¢è¦æ°é" prop="warnNum" width="130" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ä¸å«ç¨æ»ä»·" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å
¥åºäºº" prop="createBy" width="80" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="æä½" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">ç¼è¾</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | </div> |
| | | <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢åºå' : 'ç¼è¾åºå'" width="70%" |
| | | @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¾åºååç§°ï¼" prop="supplierName"> |
| | | <el-input disabled v-model="form.supplierName" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产å大类ï¼" prop="productId"> |
| | | <el-select disabled v-model="form.productCategory" placeholder="è¯·éæ©" clearable filterable> |
| | | <el-option v-for="item in productList" :key="item.id" :label="item.productName" |
| | | :value="item.productName" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è§æ ¼åå·ï¼" prop="productManageId"> |
| | | <el-select disabled v-model="form.specificationModel" placeholder="请å
éæ©äº§å大类" clearable filterable :disabled="!form.productCategory"> |
| | | <el-option v-for="item in productModelList" :key="item.id" :label="item.model" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åä½ï¼" prop="customerId"> |
| | | <el-input disabled v-model="form.unit" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åºåæ¶é´ï¼" prop="projectName"> |
| | | <el-date-picker style="width: 100%" v-model="form.updateTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" |
| | | type="date" placeholder="è¯·éæ©" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å
¥åºæ¶é´ï¼" prop="projectName"> |
| | | <el-date-picker style="width: 100%" v-model="form.createTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" |
| | | type="date" placeholder="è¯·éæ©" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="å«ç¨åä»·ï¼" prop="customerId"> |
| | | <el-input disabled v-model="form.taxInclusiveUnitPrice" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å«ç¨æ»ä»·ï¼" prop="customerContractNo"> |
| | | <el-input disabled v-model="form.taxInclusiveTotalPrice" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¨çï¼" prop="customerId"> |
| | | <el-input disabled v-model="form.taxRate" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸å«ç¨æ»ä»·ï¼" prop="entryDate"> |
| | | <el-input disabled v-model="form.taxExclusiveTotalPrice" placeholder="请è¾å
¥" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åºåºäººï¼" prop="entryPerson"> |
| | | <el-select v-model="form.createUser" placeholder="è¯·éæ©" clearable> |
| | | <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <!-- <el-col :span="12">--> |
| | | <!-- <el-form-item label="åºåé¢è¦æ°éï¼" prop="warnNum">--> |
| | | <!-- <el-input v-model="form.warnNum" placeholder="请è¾å
¥æä½åºå" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-col>--> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | <el-tabs v-model="activeTab" |
| | | @tab-change="handleTabChange"> |
| | | <el-tab-pane label="æååºå" |
| | | name="production"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" /> |
| | | <span class="search_title ml10">产å大类ï¼</span> |
| | | <el-input v-model="searchForm.productCategory" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | clearable /> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <!-- <el-button type="danger" plain @click="handleDelete">å é¤</el-button>--> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="row => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :row-class-name="tableRowClassName" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" |
| | | type="selection" |
| | | width="55" /> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="å
¥åºæ¥æ" |
| | | prop="createTime" |
| | | width="120"> |
| | | <template #default="scope"> |
| | | {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') || '-' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="产ååç§°" |
| | | prop="productName" |
| | | width="180" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="产åè§æ ¼" |
| | | prop="model" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="åä½" |
| | | prop="unit" |
| | | width="80" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="å·²åºåºæ°é" |
| | | prop="outboundNum" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="å©ä½åºå" |
| | | prop="stockQuantity" |
| | | show-overflow-tooltip /> |
| | | <!-- <el-table-column fixed="right" label="æä½" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">ç¼è¾</el-button> |
| | | </template> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | <pagination v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" /> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="åæåºå" |
| | | name="purchase"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" /> |
| | | <span class="search_title ml10">产å大类ï¼</span> |
| | | <el-input v-model="searchForm.productCategory" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | clearable /> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <!-- <el-button type="danger" plain @click="handleDelete">å é¤</el-button>--> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="row => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :row-class-name="tableRowClassName" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" |
| | | type="selection" |
| | | width="55" /> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="å
¥åºæ¥æ" |
| | | prop="createTime" |
| | | width="120" |
| | | show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') || '-' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="éè´ååå·" |
| | | prop="purchaseContractNumber" |
| | | width="180" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="产å大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="è§æ ¼åå·" |
| | | prop="specificationModel" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="åä½" |
| | | prop="unit" |
| | | width="80" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="å·²åºåºæ°é" |
| | | prop="totalInboundNum" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="å©ä½åºå" |
| | | prop="inboundNum0" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | width="150"></el-table-column> |
| | | <el-table-column label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | width="150"></el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" /> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | <!-- æååºåå¼¹æ¡ --> |
| | | <FormDiaProduction v-model:dialogFormVisible="productionDialogVisible" |
| | | :operationType="operationType" |
| | | :formData="form" |
| | | @submit="submitForm" |
| | | @close="closeDia" /> |
| | | <!-- åæåºåå¼¹æ¡ --> |
| | | <FormDiaPurchase v-model:dialogFormVisible="purchaseDialogVisible" |
| | | :operationType="operationType" |
| | | :formData="form" |
| | | @submit="submitForm" |
| | | @close="closeDia" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue' |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { productTreeList,modelList } from "@/api/basicData/product.js" |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | import { |
| | | getStockManagePage, |
| | | delStockManage, |
| | | } from "@/api/inventoryManagement/stockManage.js"; |
| | | import { |
| | | updateManagement,updateStockIn |
| | | } from "@/api/inventoryManagement/stockIn.js"; |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { productTreeList, modelList } from "@/api/basicData/product.js"; |
| | | import { |
| | | getStockManagePage, |
| | | getStockManagePageByProduction, |
| | | delStockManage, getStockManageProduction, |
| | | } from "@/api/inventoryManagement/stockManage.js"; |
| | | import { |
| | | updateManagement, |
| | | updateManagementByCustom, |
| | | updateStockIn, |
| | | } from "@/api/inventoryManagement/stockIn.js"; |
| | | |
| | | // 导å
¥ä¸¤ä¸ªç¬ç«çå¼¹æ¡ç»ä»¶ |
| | | import FormDiaProduction from "./components/FormDiaProduction.vue"; |
| | | import FormDiaPurchase from "./components/FormDiaPurchase.vue"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const productData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const productList = ref([]); |
| | | const productModelList = ref([]); |
| | | // const customerOption = ref([]) |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | const loading = ref(false); |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref(""); |
| | | const activeTab = ref("production"); |
| | | |
| | | const userStore = useUserStore() |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | | const productData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const userList = ref([]) |
| | | const productList = ref([]) |
| | | const productModelList = ref([]) |
| | | // const customerOption = ref([]) |
| | | const tableLoading = ref(false) |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | const fileList = ref([]) |
| | | const loading = ref(false); |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref('') |
| | | const dialogFormVisible = ref(false) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: '', |
| | | timeStr: '', |
| | | }, |
| | | form: { |
| | | supplierId: null, |
| | | supplierName: '', |
| | | productId: null, |
| | | productName: '', |
| | | userId: userStore.userId, |
| | | nickName: '', |
| | | productModelId: null, |
| | | model: '', |
| | | unit: '', |
| | | productrecordId: null, |
| | | taxInclusiveUnitPrice: '', |
| | | taxInclusiveTotalPrice: '', |
| | | taxRate: '', |
| | | taxExclusiveTotalPrice: '', |
| | | inboundTime: '', |
| | | inboundBatch: '', |
| | | stockQuantity: '', |
| | | boundTime: '', |
| | | warnNum: '', // æ°å¢æä½åºååæ®µ |
| | | salesLedgerProductId: null, |
| | | }, |
| | | rules: { |
| | | supplierName: [{ required: true, message: '请è¾å
¥ä¾åºååç§°', trigger: 'blur' }], |
| | | productCategory: [{ required: true, message: 'è¯·éæ©äº§å大类', trigger: 'change' }], |
| | | specificationModel: [{ required: true, message: '请è¾å
¥è§æ ¼åå·', trigger: 'blur' }], |
| | | unit: [{ required: true, message: '请è¾å
¥åä½', trigger: 'blur' }], |
| | | stockQuantity: [{ required: true, message: '请è¾å
¥åºåºæ°é', trigger: 'blur' }], |
| | | taxInclusiveUnitPrice: [{ required: true, message: '请è¾å
¥å«ç¨åä»·', trigger: 'blur' }], |
| | | taxInclusiveTotalPrice: [{ required: true, message: '请è¾å
¥å«ç¨æ»ä»·', trigger: 'blur' }], |
| | | taxRate: [{ required: true, message: '请è¾å
¥ç¨ç', trigger: 'blur' }], |
| | | taxExclusiveTotalPrice: [{ required: true, message: '请è¾å
¥ä¸å«ç¨æ»ä»·', trigger: 'blur' }], |
| | | boundTime: [{ required: true, message: 'è¯·éæ©åºåæ¶é´', trigger: 'change' }], |
| | | inboundTime: [{ required: true, message: 'è¯·éæ©å
¥åºæ¶é´', trigger: 'change' }], |
| | | inboundPerson: [{ required: true, message: 'è¯·éæ©åºåºäºº', trigger: 'change' }], |
| | | warnNum: [{ required: true, message: '请è¾å
¥æä½åºå', trigger: 'blur' }], |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | // å¼¹æ¡æ¾ç¤ºç¶æ |
| | | const productionDialogVisible = ref(false); |
| | | const purchaseDialogVisible = ref(false); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | getStockManagePage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | total.value = res.data.total |
| | | // æ°æ®å è½½å®æåæ£æ¥åºå |
| | | // checkStockAndCreatePurchase(); |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | const data = reactive({ |
| | | searchForm: { |
| | | // supplierName: '', |
| | | productCategory: "", |
| | | customerName: "", |
| | | timeStr: "", |
| | | }, |
| | | form: { |
| | | supplierId: null, |
| | | // supplierName: '', |
| | | productId: null, |
| | | productName: "", |
| | | userId: userStore.userId, |
| | | nickName: "", |
| | | productModelId: null, |
| | | model: "", |
| | | unit: "", |
| | | productrecordId: null, |
| | | unitPrice: "", // æ·»å æååºåçåä»·åæ®µ |
| | | taxInclusiveUnitPrice: "", |
| | | taxInclusiveTotalPrice: "", |
| | | taxRate: "", |
| | | taxExclusiveTotalPrice: "", |
| | | inboundTime: "", |
| | | inboundBatch: "", |
| | | stockQuantity: "", |
| | | boundTime: "", |
| | | warnNum: "", // æ°å¢æä½åºååæ®µ |
| | | salesLedgerProductId: null, |
| | | }, |
| | | rules: { |
| | | // supplierName: [{ required: true, message: '请è¾å
¥ä¾åºååç§°', trigger: 'blur' }], |
| | | productCategory: [ |
| | | { required: true, message: "è¯·éæ©äº§å大类", trigger: "change" }, |
| | | ], |
| | | specificationModel: [ |
| | | { required: true, message: "请è¾å
¥è§æ ¼åå·", trigger: "blur" }, |
| | | ], |
| | | unit: [{ required: true, message: "请è¾å
¥åä½", trigger: "blur" }], |
| | | stockQuantity: [ |
| | | { required: true, message: "请è¾å
¥åºåºæ°é", trigger: "blur" }, |
| | | ], |
| | | unitPrice: [{ required: true, message: "请è¾å
¥åä»·", trigger: "blur" }], // æ·»å æååºååä»·çéªè¯è§å |
| | | taxInclusiveUnitPrice: [ |
| | | { required: true, message: "请è¾å
¥å«ç¨åä»·", trigger: "blur" }, |
| | | ], |
| | | taxInclusiveTotalPrice: [ |
| | | { required: true, message: "请è¾å
¥å«ç¨æ»ä»·", trigger: "blur" }, |
| | | ], |
| | | taxRate: [{ required: true, message: "请è¾å
¥ç¨ç", trigger: "blur" }], |
| | | taxExclusiveTotalPrice: [ |
| | | { required: true, message: "请è¾å
¥ä¸å«ç¨æ»ä»·", trigger: "blur" }, |
| | | ], |
| | | boundTime: [ |
| | | { required: true, message: "è¯·éæ©åºåæ¶é´", trigger: "change" }, |
| | | ], |
| | | inboundTime: [ |
| | | { required: true, message: "è¯·éæ©å
¥åºæ¶é´", trigger: "change" }, |
| | | ], |
| | | inboundPerson: [ |
| | | { required: true, message: "è¯·éæ©åºåºäºº", trigger: "change" }, |
| | | ], |
| | | warnNum: [{ required: true, message: "请è¾å
¥æä½åºå", trigger: "blur" }], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const buildQueryParams = () => { |
| | | const params = { |
| | | ...page, |
| | | timeStr: searchForm.value.timeStr, |
| | | }; |
| | | params.productCategory = searchForm.value.productCategory; |
| | | if (activeTab.value === "production") { |
| | | params.customerName = searchForm.value.customerName; |
| | | } else { |
| | | // params.supplierName = searchForm.value.supplierName |
| | | } |
| | | return params; |
| | | }; |
| | | |
| | | // è¿æ»¤æåæ°æ® |
| | | selectedRows.value = selection.filter(item => item.id); |
| | | console.log('selection', selectedRows.value) |
| | | } |
| | | const expandedRowKeys = ref([]) |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = buildQueryParams(); |
| | | const apiCall = |
| | | activeTab.value === "production" |
| | | ? getStockManageProduction(params) |
| | | : getStockManagePage(params); |
| | | apiCall |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']); |
| | | }; |
| | | // ä¸ºè¡¨æ ¼æ°æ®èªå¨è®¡ç®æ»ä»· |
| | | // tableData.value = tableData.value.map(item => { |
| | | // // 计ç®å©ä½åºå |
| | | // const stockQuantity = parseFloat(item.inboundNum) || 0; |
| | | // const outboundQuantity = parseFloat(item.totalInboundNum) || 0; |
| | | // const remainingStock = Math.max(stockQuantity - outboundQuantity, 0); |
| | | // |
| | | // // æ ¹æ®æ ç¾é¡µç±»åè®¡ç®æ»ä»· |
| | | // if (activeTab.value === "production") { |
| | | // // æååºåï¼æ»ä»· = åä»· à å©ä½åºå |
| | | // const unitPrice = parseFloat(item.unitPrice) || 0; |
| | | // item.totalPrice = (unitPrice * remainingStock).toFixed(2); |
| | | // } else if (activeTab.value === "purchase") { |
| | | // // åæåºåï¼å«ç¨æ»ä»· = å«ç¨åä»· à å©ä½åºå |
| | | // const taxInclusiveUnitPrice = |
| | | // parseFloat(item.taxInclusiveUnitPrice) || 0; |
| | | // item.taxInclusiveTotalPrice = ( |
| | | // taxInclusiveUnitPrice * remainingStock |
| | | // ).toFixed(2); |
| | | // } |
| | | // |
| | | // return item; |
| | | // }); |
| | | |
| | | // è¡¨æ ¼è¡ç±»å |
| | | const tableRowClassName = ({ row }) => { |
| | | const stock = Number(row?.inboundNum0 ?? 0); |
| | | const warn = Number(row?.warnNum ?? 0); |
| | | if (!Number.isFinite(stock) || !Number.isFinite(warn)) { |
| | | return ''; |
| | | } |
| | | return stock < warn ? 'row-low-stock' : ''; |
| | | }; |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = async (type, row) => { |
| | | operationType.value = type |
| | | form.value = {} |
| | | productData.value = [] |
| | | let userLists = await userListNoPageByTenantId() |
| | | userList.value = userLists.data |
| | | if (type === 'edit') { |
| | | form.value = { ...row } |
| | | productTreeList().then(res =>{ |
| | | productList.value = res |
| | | productList.value.forEach(i =>{ |
| | | if (i.label === row.productCategory) { |
| | | modelList({ id: i.id }).then((res) => { |
| | | productModelList.value = res; |
| | | }); |
| | | } |
| | | total.value = res.data.total; |
| | | // æ°æ®å è½½å®æåæ£æ¥åºå |
| | | // checkStockAndCreatePurchase(); |
| | | }) |
| | | }) |
| | | } |
| | | form.value.entryDate = getCurrentDate() // 设置é»è®¤å½å
¥æ¥æä¸ºå½åæ¥æ |
| | | dialogFormVisible.value = true |
| | | } |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | console.log(form.value) |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | // 忢 tab |
| | | const handleTabChange = () => { |
| | | page.current = 1; |
| | | // searchForm.value.supplierName = '' |
| | | searchForm.value.customerName = ""; |
| | | searchForm.value.timeStr = ""; |
| | | selectedRows.value = []; |
| | | searchForm.value.productCategory = ""; |
| | | getList(); |
| | | }; |
| | | |
| | | updateManagement(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = selection => { |
| | | // è¿æ»¤æåæ°æ® |
| | | selectedRows.value = selection.filter(item => item.id); |
| | | console.log("selection", selectedRows.value); |
| | | }; |
| | | const expandedRowKeys = ref([]); |
| | | |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = param => { |
| | | return proxy.summarizeTable(param, [ |
| | | "contractAmount", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ]); |
| | | }; |
| | | |
| | | // è¡¨æ ¼è¡ç±»å |
| | | const tableRowClassName = ({ row }) => { |
| | | const stock = Number(row?.inboundNum0 ?? 0); |
| | | const warn = Number(row?.warnNum ?? 0); |
| | | if (!Number.isFinite(stock) || !Number.isFinite(warn)) { |
| | | return ""; |
| | | } |
| | | return stock < warn ? "row-low-stock" : ""; |
| | | }; |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = async (type, row) => { |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | productData.value = []; |
| | | let userLists = await userListNoPageByTenantId(); |
| | | userList.value = userLists.data; |
| | | if (type === "edit") { |
| | | form.value = { ...row }; |
| | | productTreeList().then(res => { |
| | | productList.value = res; |
| | | productList.value.forEach(i => { |
| | | if (i.label === row.productCategory) { |
| | | modelList({ id: i.id }).then(res => { |
| | | productModelList.value = res; |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | form.value.entryDate = getCurrentDate(); // 设置é»è®¤å½å
¥æ¥æä¸ºå½åæ¥æ |
| | | |
| | | // æ ¹æ®å½åæ ç¾é¡µæ¾ç¤ºå¯¹åºçå¼¹æ¡ |
| | | if (activeTab.value === "production") { |
| | | productionDialogVisible.value = true; |
| | | } else if (activeTab.value === "purchase") { |
| | | purchaseDialogVisible.value = true; |
| | | } |
| | | }; |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = submittedData => { |
| | | console.log("åç»ä»¶æäº¤çæ°æ®:", submittedData); |
| | | |
| | | // 使ç¨åç»ä»¶æäº¤çæ°æ®ï¼è䏿¯ç¶ç»ä»¶çform对象 |
| | | const submitData = { ...submittedData }; |
| | | |
| | | // æ ¹æ®å½åæ ç¾é¡µç§»é¤å¯¹åºçæ»ä»·å段 |
| | | if (activeTab.value === "production") { |
| | | // æååºåï¼ç§»é¤æ»ä»·å段 |
| | | delete submitData.totalPrice; |
| | | } else if (activeTab.value === "purchase") { |
| | | // åæåºåï¼ç§»é¤å«ç¨æ»ä»·å段 |
| | | delete submitData.taxInclusiveTotalPrice; |
| | | } |
| | | |
| | | // ç§»é¤å
¶ä»å¯è½çæ»ä»·å段 |
| | | delete submitData.taxExclusiveTotalPrice; |
| | | |
| | | console.log("æäº¤ç»åç«¯çæ°æ®ï¼å·²ç§»é¤æ»ä»·å段ï¼:", submitData); |
| | | |
| | | // æ ¹æ®å½åæ ç¾é¡µè°ç¨ä¸åçæäº¤æ¥å£ |
| | | let apiCall; |
| | | if (activeTab.value === "production") { |
| | | // æååºåä½¿ç¨ updateManagement æ¥å£ |
| | | apiCall = updateManagement(submitData); |
| | | } else { |
| | | // åæåºåä½¿ç¨ updateManagementByCustom æ¥å£ |
| | | apiCall = updateManagementByCustom(submitData); |
| | | } |
| | | |
| | | apiCall |
| | | .then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | // æäº¤åæ£æ¥åºåå¹¶å°è¯å建请è´å |
| | | // checkStockAndCreatePurchase(); |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | // æ£æ¥åºåå¹¶å建请è´å |
| | | // const checkStockAndCreatePurchase = async () => { |
| | | // const stockList = tableData.value; |
| | | // // handList() |
| | | // for (const item of stockList) { |
| | | // if (item.inboundNum0 < item.warnNum) { |
| | | // try { |
| | | // const stockInData = { |
| | | // id: item.id, |
| | | // quantityStock: item.warnNum + item.totalInboundNum,// ä½¿ç¨æ°æ ¼å¼å彿° |
| | | // }; |
| | | // loading.value = true |
| | | // await updateStockIn(stockInData) |
| | | // proxy.$modal.msgSuccess(`产å ${item.productCategory} ä¿®æ¹å
¥åºæå`) |
| | | // loading.value = false |
| | | // } catch (error) { |
| | | // proxy.$modal.msgError(`产å ${item.productCategory} çæè¯·è´å失败ï¼è¯·æå¨å¤ç`); |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | // }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef") |
| | | dialogFormVisible.value = false |
| | | } |
| | | .catch(error => { |
| | | console.error("æäº¤å¤±è´¥:", error); |
| | | proxy.$modal.msgError("æäº¤å¤±è´¥ï¼è¯·éè¯"); |
| | | }); |
| | | }; |
| | | // æ£æ¥åºåå¹¶å建请è´å |
| | | // const checkStockAndCreatePurchase = async () => { |
| | | // const stockList = tableData.value; |
| | | // // handList() |
| | | // for (const item of stockList) { |
| | | // if (item.inboundNum0 < item.warnNum) { |
| | | // try { |
| | | // const stockInData = { |
| | | // id: item.id, |
| | | // quantityStock: item.warnNum + item.totalInboundNum,// ä½¿ç¨æ°æ ¼å¼å彿° |
| | | // }; |
| | | // loading.value = true |
| | | // await updateStockIn(stockInData) |
| | | // proxy.$modal.msgSuccess(`产å ${item.productCategory} ä¿®æ¹å
¥åºæå`) |
| | | // loading.value = false |
| | | // } catch (error) { |
| | | // proxy.$modal.msgError(`产å ${item.productCategory} çæè¯·è´å失败ï¼è¯·æå¨å¤ç`); |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | // }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | productionDialogVisible.value = false; |
| | | purchaseDialogVisible.value = false; |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm( |
| | | 'æ¯å¦ç¡®è®¤å¯¼åºï¼', |
| | | '导åº', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | proxy.download("/stockin/exportCopy", {}, 'åºåä¿¡æ¯.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | }) |
| | | } |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = [] |
| | | if (selectedRows.value.length > 0) { |
| | | // æ£æ¥æ¯å¦æä»äººç»´æ¤çæ°æ® |
| | | const unauthorizedData = selectedRows.value.filter(item => item.createUser !== userStore.id); |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®"); |
| | | return; |
| | | } |
| | | ids = selectedRows.value.map(item => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning('è¯·éæ©æ°æ®') |
| | | return |
| | | } |
| | | ElMessageBox.confirm( |
| | | 'éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', |
| | | '导åº', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | delStockManage({ids:ids}).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | getList() |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | }) |
| | | } |
| | | onMounted(() => { |
| | | getList() |
| | | // checkStockAndCreatePurchase(); |
| | | .then(() => { |
| | | const exportParams = buildQueryParams(); |
| | | // æ ¹æ®ä¸åç tab ç±»åè°ç¨ä¸åçå¯¼åºæ¥å£ |
| | | let exportUrl = "/stockin/exportCopy"; |
| | | if (activeTab.value === "production") { |
| | | exportUrl = "/stockin/exportCopyOne"; |
| | | } |
| | | proxy.download(exportUrl, exportParams, "åºåä¿¡æ¯.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map(item => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | delStockManage({ ids: ids }).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); // æä»½ä»0å¼å§ |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | onMounted(() => { |
| | | getList(); |
| | | // checkStockAndCreatePurchase(); |
| | | // æ¯å°æ¶æ£æ¥ä¸æ¬¡åºå |
| | | // const intervalId = setInterval(checkStockAndCreatePurchase, 60 * 60 * 1000); |
| | | |
| | | // onUnmounted(() => { |
| | | // // ç»ä»¶å¸è½½æ¶æ¸
é¤å®æ¶å¨ |
| | | // clearInterval(intervalId); |
| | | // }); |
| | | }) |
| | | // onUnmounted(() => { |
| | | // // ç»ä»¶å¸è½½æ¶æ¸
é¤å®æ¶å¨ |
| | | // clearInterval(intervalId); |
| | | // }); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | :deep(.row-low-stock td) { |
| | | background-color: #fde2e2; |
| | | color: #c45656; |
| | | } |
| | | :deep(.row-low-stock td) { |
| | | background-color: #fde2e2; |
| | | color: #c45656; |
| | | } |
| | | |
| | | :deep(.row-low-stock:hover > td) { |
| | | background-color: #fcd4d4; |
| | | } |
| | | </style> |
| | | :deep(.row-low-stock:hover > td) { |
| | | background-color: #fcd4d4; |
| | | } |
| | | </style> |
| | |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="closeDialog">åæ¶</el-button> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDialog">åæ¶</el-button> |
| | | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | size="large"
|
| | | auto-complete="off"
|
| | | placeholder="è´¦å·"
|
| | | @input="getUserLoginFacotryList"
|
| | | >
|
| | | <template #prefix><el-icon><User /></el-icon></template>
|
| | | </el-input>
|
| | |
| | | <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
| | | </el-input>
|
| | | </el-form-item>
|
| | | <!-- <el-form-item prop="currentFatoryId">-->
|
| | | <!-- <el-select v-model="loginForm.currentFatoryId" placeholder="è¯·éæ©å
¬å¸" filterable>-->
|
| | | <!-- <el-option v-for="item in factoryList" :key="item.deptId" :label="item.deptName" :value="item.deptId" />-->
|
| | | <!-- </el-select>-->
|
| | | <!-- </el-form-item>-->
|
| | | <!-- <el-form-item prop="code" v-if="captchaEnabled">-->
|
| | | <!-- <el-input-->
|
| | | <!-- v-model="loginForm.code"-->
|
| | |
| | | import Cookies from "js-cookie"
|
| | | import { encrypt, decrypt } from "@/utils/jsencrypt"
|
| | | import useUserStore from '@/store/modules/user'
|
| | | import {userLoginFacotryList} from "@/api/system/user.js"
|
| | |
|
| | | const title = import.meta.env.VITE_APP_TITLE
|
| | | const userStore = useUserStore()
|
| | |
| | | // 注åå¼å
³
|
| | | const register = ref(false)
|
| | | const redirect = ref(undefined)
|
| | |
|
| | | const factoryList = ref([])
|
| | |
|
| | | watch(route, (newRoute) => {
|
| | | redirect.value = newRoute.query && newRoute.query.redirect
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | function getUserLoginFacotryList() {
|
| | | if(loginForm.value.username){
|
| | | userLoginFacotryList({userName:loginForm.value.username}).then(res => {
|
| | | console.log('res', res)
|
| | | factoryList.value = res.data
|
| | | })
|
| | | }else {
|
| | | factoryList.value = []
|
| | | }
|
| | | }
|
| | |
|
| | | getCode()
|
| | | getCookie()
|
| | | getUserLoginFacotryList()
|
| | | </script>
|
| | |
|
| | | <style lang='scss' scoped>
|
| | |
| | | <template> |
| | | <template xmlns=""> |
| | | <div class="app-container"> |
| | | <PageHeader content="产åç»æè¯¦æ
"> |
| | | <template #right-button> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | <div> |
| | | <el-button type="primary" @click="openCreateOrder">æ°å¢è®¢å</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain :disabled="selectedRows.length === 0" @click="handleBatchDelete">æ¹éå é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="pagination"> |
| | | <template #completionStatus="{ row }"> |
| | | <el-progress |
| | |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog v-model="orderFormVisible" |
| | | title="æ°å¢ç产订å" |
| | | width="520px" |
| | | @close="() => proxy?.resetForm?.('orderFormRef')"> |
| | | <el-form ref="orderFormRef" |
| | | :model="orderForm" |
| | | :rules="orderRules" |
| | | label-width="120px" |
| | | label-position="top"> |
| | | <el-form-item label="产å大类" prop="productId"> |
| | | <el-tree-select v-model="orderForm.productId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | check-strictly |
| | | :data="productOptions" |
| | | :render-after-expand="false" |
| | | style="width: 100%" |
| | | @change="getModels" /> |
| | | </el-form-item> |
| | | <el-form-item label="è§æ ¼åå·" prop="productModelId"> |
| | | <el-select v-model="orderForm.productModelId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="getProductModel"> |
| | | <el-option v-for="item in modelOptions" |
| | | :key="item.id" |
| | | :label="item.model" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åä½" prop="unit"> |
| | | <el-input v-model="orderForm.unit" |
| | | placeholder="请è¾å
¥" |
| | | clearable /> |
| | | </el-form-item> |
| | | <el-row :gutter="12"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ°é" prop="quantity"> |
| | | <el-input-number v-model="orderForm.quantity" |
| | | :step="0.1" |
| | | :min="0" |
| | | :precision="2" |
| | | placeholder="请è¾å
¥" |
| | | style="width: 100%" |
| | | @change="calculateFromQuantity" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" @click="submitCreateOrder">确 认</el-button> |
| | | <el-button @click="orderFormVisible = false">å æ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref } from "vue"; |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { useRouter } from "vue-router"; |
| | | import { |
| | | productOrderListPage, |
| | | addProductOrder, |
| | | listProcessRoute, |
| | | bindingRoute, |
| | | listProcessBom, |
| | | deleteProductOrder, |
| | | } from "@/api/productionManagement/productionOrder.js"; |
| | | import { productTreeList, modelList } from "@/api/basicData/product.js"; |
| | | import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | |
| | | width: '120px', |
| | | }, |
| | | { |
| | | label: "éå®ååå·", |
| | | prop: "salesContractNo", |
| | | width: '150px', |
| | | }, |
| | | { |
| | | label: "客æ·åç§°", |
| | | prop: "customerName", |
| | | width: '200px', |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | | width: '120px', |
| | | }, |
| | | { |
| | | label: "è§æ ¼", |
| | | label: "è§æ ¼åå·", |
| | | prop: "specificationModel", |
| | | width: '120px', |
| | | }, |
| | |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const selectedRows = ref([]); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | // æ°å¢è®¢åå¼¹æ¡æ°æ® |
| | | const orderFormVisible = ref(false); |
| | | const orderFormRef = ref(null); |
| | | const orderFormState = reactive({ |
| | | orderForm: { |
| | | productId: null, |
| | | productCategory: "", |
| | | productModelId: "", |
| | | specificationModel: "", |
| | | unit: "", |
| | | quantity: null, |
| | | }, |
| | | orderRules: { |
| | | productId: [{ required: true, message: "è¯·éæ©äº§å大类", trigger: "change" }], |
| | | productModelId: [{ required: true, message: "è¯·éæ©è§æ ¼åå·", trigger: "change" }], |
| | | specificationModel: [{ required: true, message: "è¯·éæ©è§æ ¼åå·", trigger: "change" }], |
| | | unit: [{ required: true, message: "请è¾å
¥åä½", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请è¾å
¥æ°é", trigger: "blur" }], |
| | | }, |
| | | }); |
| | | const { orderForm, orderRules } = toRefs(orderFormState); |
| | | const productOptions = ref([]); |
| | | const modelOptions = ref([]); |
| | | |
| | | const toProgressPercentage = val => { |
| | | const n = Number(val); |
| | |
| | | }); |
| | | }; |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection || []; |
| | | }; |
| | | |
| | | // æ¹éå é¤ |
| | | const handleBatchDelete = async () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | return; |
| | | } |
| | | const ids = selectedRows.value.map(item => item.productModelId).filter(Boolean); |
| | | if (ids.length === 0) { |
| | | proxy.$modal.msgWarning("é䏿°æ®ç¼ºå°IDï¼æ æ³å é¤"); |
| | | return; |
| | | } |
| | | try { |
| | | await ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }); |
| | | await deleteProductOrder(ids); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | selectedRows.value = []; |
| | | getList(); |
| | | } catch (e) { |
| | | // åæ¶æå¤±è´¥ |
| | | if (e !== 'cancel' && e !== 'close') { |
| | | console.error("æ¹éå é¤å¤±è´¥ï¼", e); |
| | | proxy.$modal.msgError("å é¤å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const handleConfirmRoute = () => {}; |
| | | |
| | | const openCreateOrder = async () => { |
| | | orderForm.value = { |
| | | productId: null, |
| | | productCategory: "", |
| | | productModelId: "", |
| | | specificationModel: "", |
| | | unit: "", |
| | | quantity: null, |
| | | }; |
| | | await loadProductOptions(); |
| | | orderFormVisible.value = true; |
| | | }; |
| | | |
| | | const loadProductOptions = async () => { |
| | | const tree = await productTreeList(); |
| | | productOptions.value = Array.isArray(tree?.data) ? convertIdToValue(tree.data) : convertIdToValue(tree || []); |
| | | }; |
| | | |
| | | const convertIdToValue = data => { |
| | | return (data || []).map(item => { |
| | | const { id, children, ...rest } = item; |
| | | const newItem = { ...rest, value: id }; |
| | | if (children && children.length > 0) { |
| | | newItem.children = convertIdToValue(children); |
| | | } |
| | | return newItem; |
| | | }); |
| | | }; |
| | | |
| | | const findNodeById = (nodes, productId) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === productId) { |
| | | return nodes[i].label; |
| | | } |
| | | if (nodes[i].children && nodes[i].children.length > 0) { |
| | | const foundNode = findNodeById(nodes[i].children, productId); |
| | | if (foundNode) { |
| | | return foundNode; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | }; |
| | | |
| | | const getModels = async value => { |
| | | orderForm.value.productId = value; |
| | | orderForm.value.productCategory = findNodeById(productOptions.value, value); |
| | | const res = await modelList({ id: value }); |
| | | modelOptions.value = res || []; |
| | | }; |
| | | |
| | | const getProductModel = value => { |
| | | const index = modelOptions.value.findIndex(item => item.id === value); |
| | | if (index !== -1) { |
| | | orderForm.value.specificationModel = modelOptions.value[index].model; |
| | | orderForm.value.unit = modelOptions.value[index].unit; |
| | | } else { |
| | | orderForm.value.specificationModel = null; |
| | | orderForm.value.unit = null; |
| | | } |
| | | }; |
| | | |
| | | const calculateFromQuantity = () => { |
| | | // å ä½ï¼æ°éåæ´æ¶å¯å¨æ¤æ©å±é»è¾ |
| | | }; |
| | | |
| | | const submitCreateOrder = async () => { |
| | | proxy.$refs["orderFormRef"]?.validate(async valid => { |
| | | if (!valid) return; |
| | | try { |
| | | await addProductOrder(orderForm.value); |
| | | proxy.$modal.msgSuccess("æ°å¢æå"); |
| | | orderFormVisible.value = false; |
| | | getList(); |
| | | } catch (e) { |
| | | console.error("æ°å¢ç产订å失败", e); |
| | | proxy.$modal.msgError("æ°å¢å¤±è´¥ï¼è¯·ç¨åéè¯"); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import { ref, getCurrentInstance } from 'vue' |
| | | import filePreview from '@/components/filePreview/index.vue' |
| | | |
| | | const dialogVisible = ref(false) |
| | |
| | | <el-tag v-if="scope.row.approveStatus === 4" type="danger">å®¡æ ¸å¤±è´¥</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å货车ç" minWidth="100px" align="center"> |
| | | <template #default="scope"> |
| | | <div> |
| | | <el-tag type="success" v-if="scope.row.shippingCarNumber">{{ scope.row.shippingCarNumber }}</el-tag> |
| | | <el-tag v-else type="info">æªåè´§</el-tag> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="åè´§æ¥æ" minWidth="100px" align="center"> |
| | | <template #default="scope"> |
| | | <div> |
| | | <div v-if="scope.row.shippingDate">{{ scope.row.shippingDate }}</div> |
| | | <el-tag v-else type="info">æªåè´§</el-tag> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æ°é" prop="quantity" /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" /> |
| | | <el-table-column label="å«ç¨åä»·(å
)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="å«ç¨æ»ä»·(å
)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="ä¸å«ç¨æ»ä»·(å
)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <!--æä½--> |
| | | <el-table-column Width="60px" label="æä½" align="center"> |
| | | <template #default="scope"> |
| | | <el-button :disabled="scope.row.approveStatus!==2 || scope.row.approveStatus!==5" link type="primary" size="small" @click="openDeliveryForm(scope.row)">åè´§</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-table-column label="å½å
¥äºº" prop="entryPersonName" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å½å
¥æ¥æ" prop="entryDate" width="120" show-overflow-tooltip /> |
| | | <el-table-column label="ç¾è®¢æ¥æ" prop="executionDate" width="120" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="æä½" min-width="100" align="center"> |
| | | <el-table-column label="å货车ç" prop="shippingCarNumber" width="140" align="center" show-overflow-tooltip /> |
| | | <el-table-column label="åè´§æ¥æ" prop="shippingDate" width="140" align="center" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="æä½" min-width="140" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row)">ç¼è¾</el-button> |
| | | <!-- <el-button link type="primary" size="small" @click="openForm('view', scope.row)">详æ
</el-button>--> |
| | | <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">éä»¶</el-button> |
| | | <!-- <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">åè´§</el-button>--> |
| | | <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">åè´§</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <el-form :model="deliveryForm" label-width="120px" label-position="top" :rules="deliveryRules" ref="deliveryFormRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åè´§ç±»åï¼" prop="shippingType"> |
| | | <el-select |
| | | v-model="deliveryForm.shippingType" |
| | | placeholder="è¯·éæ©åè´§ç±»å" |
| | | style="width: 100%" |
| | | @change="handleShippingTypeChange" |
| | | > |
| | | <el-option label="货车" value="truck" /> |
| | | <el-option label="å¿«é" value="express" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åè´§æ¥æï¼" prop="shippingDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-col :span="24" v-if="deliveryForm.shippingType === 'truck'"> |
| | | <el-form-item label="å货车çå·ï¼" prop="shippingCarNumber"> |
| | | <el-input |
| | | v-model="deliveryForm.shippingCarNumber" |
| | | placeholder="请è¾å
¥å货车çå·" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24" v-else> |
| | | <el-form-item label="å¿«éå
¬å¸ï¼" prop="expressCompany"> |
| | | <el-input |
| | | v-model="deliveryForm.expressCompany" |
| | | placeholder="请è¾å
¥å¿«éå
¬å¸" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | |
| | | import { UploadFilled } from "@element-plus/icons-vue"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import FileListDialog from '@/components/Dialog/FileListDialog.vue'; |
| | | import FileList from '@/views/salesManagement/salesLedger/fileList.vue'; |
| | | import FormDialog from '@/components/Dialog/FormDialog.vue'; |
| | | import { getQuotationList } from "@/api/salesManagement/salesQuotation.js"; |
| | | import { |
| | |
| | | const currentDeliveryRow = ref(null); |
| | | const deliveryFormData = reactive({ |
| | | deliveryForm: { |
| | | shippingType: "truck", // truck: 货车, express: å¿«é |
| | | shippingDate: "", |
| | | shippingCarNumber: "", |
| | | expressCompany: "", |
| | | }, |
| | | deliveryRules: { |
| | | shippingType: [ |
| | | { required: true, message: "è¯·éæ©åè´§ç±»å", trigger: "change" } |
| | | ], |
| | | shippingDate: [ |
| | | { required: true, message: "è¯·éæ©åè´§æ¥æ", trigger: "change" } |
| | | ], |
| | | shippingCarNumber: [ |
| | | { required: true, message: "请è¾å
¥å货车çå·", trigger: "blur" } |
| | | { validator: (_, value, callback) => validateShippingCarNumber(value, callback), trigger: "blur" } |
| | | ], |
| | | expressCompany: [ |
| | | { validator: (_, value, callback) => validateExpressCompany(value, callback), trigger: "blur" } |
| | | ], |
| | | }, |
| | | }); |
| | |
| | | return total.toFixed(2); |
| | | }; |
| | | |
| | | // åè´§ç±»åæ ¡éªï¼è´§è½¦æ¶è¦æ±è½¦çï¼å¿«éæ¶è¦æ±å¿«éå
¬å¸ |
| | | const validateShippingCarNumber = (value, callback) => { |
| | | if (deliveryForm.value.shippingType === "truck") { |
| | | if (!value) return callback(new Error("请è¾å
¥å货车çå·")); |
| | | } |
| | | callback(); |
| | | }; |
| | | const validateExpressCompany = (value, callback) => { |
| | | if (deliveryForm.value.shippingType === "express") { |
| | | if (!value) return callback(new Error("请è¾å
¥å¿«éå
¬å¸")); |
| | | } |
| | | callback(); |
| | | }; |
| | | |
| | | const mathNum = () => { |
| | | console.log("productForm.value", productForm.value); |
| | | if (!productForm.value.taxInclusiveUnitPrice) { |
| | |
| | | |
| | | // æå¼åè´§å¼¹æ¡ |
| | | const openDeliveryForm = (row) => { |
| | | getProductInventory({ salesLedgerId: row.id, type:1 }).then((res) => { |
| | | currentDeliveryRow.value = row; |
| | | deliveryForm.value = { |
| | | shippingDate: getCurrentDate(), |
| | | shippingCarNumber: "", |
| | | }; |
| | | deliveryFormVisible.value = true; |
| | | }).catch(err => { |
| | | ElMessage.error(err.msg); |
| | | }); |
| | | // getProductInventory({ salesLedgerId: row.id, type:1 }).then((res) => { |
| | | // currentDeliveryRow.value = row; |
| | | // deliveryForm.value = { |
| | | // shippingDate: getCurrentDate(), |
| | | // shippingCarNumber: "", |
| | | // }; |
| | | // deliveryFormVisible.value = true; |
| | | // }).catch(err => { |
| | | // ElMessage.error(err.msg); |
| | | // }); |
| | | currentDeliveryRow.value = row; |
| | | deliveryForm.value = { |
| | | shippingType: "truck", |
| | | shippingDate: getCurrentDate(), |
| | | shippingCarNumber: "", |
| | | expressCompany: "", |
| | | }; |
| | | deliveryFormVisible.value = true; |
| | | }; |
| | | |
| | | // æäº¤å货表å |
| | |
| | | if (valid) { |
| | | addShippingInfo({ |
| | | salesLedgerId: currentDeliveryRow.value.id, |
| | | shippingType: deliveryForm.value.shippingType, |
| | | shippingDate: deliveryForm.value.shippingDate, |
| | | shippingCarNumber: deliveryForm.value.shippingCarNumber, |
| | | shippingCarNumber: deliveryForm.value.shippingType === "truck" ? deliveryForm.value.shippingCarNumber : "", |
| | | expressCompany: deliveryForm.value.shippingType === "express" ? deliveryForm.value.expressCompany : "", |
| | | }) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("åè´§æå"); |
| | |
| | | currentDeliveryRow.value = null; |
| | | }; |
| | | |
| | | // åè´§ç±»ååæ¢æ¶æ¸
空对åºå段 |
| | | const handleShippingTypeChange = (val) => { |
| | | if (val === "truck") { |
| | | deliveryForm.value.expressCompany = ""; |
| | | } else { |
| | | deliveryForm.value.shippingCarNumber = ""; |
| | | } |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |