From 8dfd0949932015627838054c708c2d053117b705 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 12 一月 2026 17:58:14 +0800
Subject: [PATCH] 1.12bug修改
---
src/views/qualityManagement/processInspection/components/formDia.vue | 3
src/views/inventoryManagement/issueManagement/index.vue | 800 ++++++-----
src/views/qualityManagement/rawMaterialInspection/index.vue | 2
src/views/qualityManagement/finalInspection/index.vue | 2
src/views/qualityManagement/processInspection/index.vue | 2
src/views/qualityManagement/finalInspection/components/filesDia.vue | 317 ++--
src/views/qualityManagement/nonconformingManagement/components/formDia.vue | 382 +++--
src/views/inventoryManagement/receiptManagement/index.vue | 674 ++++++----
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue | 1
src/views/qualityManagement/processInspection/components/filesDia.vue | 325 ++--
src/views/inventoryManagement/stockManagement/index.vue | 1013 ++++++++------
src/views/tool/gen/importTable.vue | 33
src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue | 403 +++--
13 files changed, 2,179 insertions(+), 1,778 deletions(-)
diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue
index 3df20a8..719f072 100644
--- a/src/views/inventoryManagement/issueManagement/index.vue
+++ b/src/views/inventoryManagement/issueManagement/index.vue
@@ -1,104 +1,206 @@
<template>
<div class="app-container">
- <el-tabs v-model="activeTab" @tab-change="handleTabChange">
- <el-tab-pane label="鎴愬搧鍑哄簱" name="production">
+ <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>
+ <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">
+ <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 link type="primary" size="small" @click="openForm(scope.row);">鍙戣揣</el-button>
+ <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" />
+ <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>
+ <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 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-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-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="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 :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="getPersonLabel()" prop="entryPerson">
- <el-select v-model="form.nickName" filterable
+ <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" />
+ :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>
@@ -107,298 +209,304 @@
</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 {
- getStockInPage,
- getStockInPageByProduction,
-} 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,
+ } 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 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 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
- 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
- let apiCall
- if (activeTab.value === 'production') {
- apiCall = getStockInPageByProduction(params)
- } else {
- apiCall = getStockInPage(params)
- }
- apiCall.then(res => {
- tableLoading.value = false
- tableData.value = res.data.records
- 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()
-}
-
-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 {
+ apiCall = getStockInPage(params);
}
- }
- return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
-};
-// 琛ㄦ牸閫夋嫨鏁版嵁
-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) // 鏂板锛氬瓨鍌ㄥ綋鍓嶆搷浣滅殑琛孖D
-
-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 typeMap = { production: 2, purchase: 1 }
- 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
- }
- 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(() => {
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
- let exportUrl = "/stockin/export"
- if (activeTab.value === 'production') {
- exportUrl = "/stockin/exportOne"
+ 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; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ }
+ }
}
- 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()
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+ };
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ 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); // 鏂板锛氬瓨鍌ㄥ綋鍓嶆搷浣滅殑琛孖D
+
+ 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 typeMap = { production: 2, purchase: 1 };
+ 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
+ };
+ 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("宸插彇娑�")
- })
-}
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� 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: '鏂板棰嗙敤'
+ .then(() => {
+ // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
+ let exportUrl = "/stockin/export";
+ if (activeTab.value === "production") {
+ exportUrl = "/stockin/exportOne";
+ }
+ proxy.download(exportUrl, {}, "鍏ュ簱鍙拌处.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
};
- return titleMap[activeTab.value] || '鏂板鍑哄簱';
-};
-
-// 鏍规嵁tab绫诲瀷鑾峰彇鍙嚭搴撴暟閲忔枃鏈�
-const getAvailableQuantityText = () => {
- const textMap = {
- production: '鍙彂璐ф暟閲�',
- purchase: '鍙鐢ㄦ暟閲�'
+ // 鍒犻櫎
+ 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("宸插彇娑�");
+ });
};
- return textMap[activeTab.value] || '鍙嚭搴撴暟閲�';
-};
+ // 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� 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 getQuantityLabel = () => {
- const labelMap = {
- production: '鍙戣揣鏁伴噺锛�',
- purchase: '棰嗙敤鏁伴噺锛�'
+ // 鏍规嵁tab绫诲瀷鑾峰彇寮规鏍囬
+ const getDialogTitle = () => {
+ const titleMap = {
+ production: "鏂板鍙戣揣",
+ purchase: "鏂板棰嗙敤",
+ };
+ return titleMap[activeTab.value] || "鏂板鍑哄簱";
};
- return labelMap[activeTab.value] || '鍑哄簱鏁伴噺锛�';
-};
-// 鏍规嵁tab绫诲瀷鑾峰彇鏃ユ湡瀛楁鏍囩
-const getDateLabel = () => {
- const labelMap = {
- production: '鍙戣揣鏃ユ湡锛�',
- purchase: '棰嗙敤鏃ユ湡锛�'
+ // 鏍规嵁tab绫诲瀷鑾峰彇鍙嚭搴撴暟閲忔枃鏈�
+ const getAvailableQuantityText = () => {
+ const textMap = {
+ production: "鍙彂璐ф暟閲�",
+ purchase: "鍙鐢ㄦ暟閲�",
+ };
+ return textMap[activeTab.value] || "鍙嚭搴撴暟閲�";
};
- return labelMap[activeTab.value] || '鍑哄簱鏃ユ湡锛�';
-};
-// 鏍规嵁tab绫诲瀷鑾峰彇浜哄憳瀛楁鏍囩
-const getPersonLabel = () => {
- const labelMap = {
- production: '鍙戣揣浜猴細',
- purchase: '棰嗙敤浜猴細'
+ // 鏍规嵁tab绫诲瀷鑾峰彇鏁伴噺瀛楁鏍囩
+ const getQuantityLabel = () => {
+ const labelMap = {
+ production: "鍙戣揣鏁伴噺锛�",
+ purchase: "棰嗙敤鏁伴噺锛�",
+ };
+ return labelMap[activeTab.value] || "鍑哄簱鏁伴噺锛�";
};
- return labelMap[activeTab.value] || '鍑哄簱浜猴細';
-};
-onMounted(() => {
- getList()
-})
+ // 鏍规嵁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>
diff --git a/src/views/inventoryManagement/receiptManagement/index.vue b/src/views/inventoryManagement/receiptManagement/index.vue
index a0f6e2b..663d00c 100644
--- a/src/views/inventoryManagement/receiptManagement/index.vue
+++ b/src/views/inventoryManagement/receiptManagement/index.vue
@@ -1,314 +1,432 @@
<template>
<div class="app-container">
- <el-tabs v-model="activeTab" @tab-change="handleTabChange">
- <el-tab-pane label="鎴愬搧鍏ュ簱" name="production">
+ <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"
- />
+ <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>
+ <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="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" 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="70" 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 fixed="right" label="鎿嶄綔" min-width="60" align="center">
+ <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"
+ 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="70"
+ 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 fixed="right"
+ label="鎿嶄綔"
+ min-width="60"
+ align="center">
<template #default="scope">
- <el-button link type="primary" size="small" @click="openForm('edit', scope.row, 'production');">缂栬緫</el-button>
+ <el-button link
+ type="primary"
+ size="small"
+ @click="openForm('edit', scope.row, 'production');">缂栬緫</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 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="purchaseContractNumber"
+ width="180"
+ show-overflow-tooltip />
+ <el-table-column label="渚涘簲鍟嗗悕绉�"
+ prop="supplierName"
+ width="240"
+ 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="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-column fixed="right"
+ label="鎿嶄綔"
+ min-width="60"
+ align="center">
+ <template #default="scope">
+ <el-button link
+ :disabled="scope.row.type == 1"
+ type="primary"
+ size="small"
+ @click="openForm('edit', scope.row, 'purchase');">缂栬緫</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" />
+ <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 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="purchaseContractNumber" width="180" show-overflow-tooltip />
-<el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" 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="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-column fixed="right" label="鎿嶄綔" min-width="60" align="center">
- <template #default="scope">
- <el-button link type="primary" size="small" @click="openForm('edit', scope.row, 'purchase');">缂栬緫</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>
-
- <form-dia ref="formDia" @close="handleQuery" @success="handleQuery"></form-dia>
- <form-dia-product ref="formDiaProduct" @close="handleQuery" @success="handleQuery"></form-dia-product>
+ <form-dia ref="formDia"
+ @close="handleQuery"
+ @success="handleQuery"></form-dia>
+ <form-dia-product ref="formDiaProduct"
+ @close="handleQuery"
+ @success="handleQuery"></form-dia-product>
</div>
</template>
<script setup>
-import pagination from '@/components/PIMTable/Pagination.vue'
-import { ref, reactive, toRefs, onMounted, getCurrentInstance, nextTick } from 'vue'
-import { ElMessageBox } from "element-plus";
-import useUserStore from '@/store/modules/user'
-import dayjs from 'dayjs'
-import {
- getStockInPage,
- getStockInPageByProduction,
- delStockIn,
-} from "@/api/inventoryManagement/stockIn.js";
-import FormDia from './components/formDia.vue'
-import FormDiaProduct from './components/formDiaProduct.vue'
+ import pagination from "@/components/PIMTable/Pagination.vue";
+ import {
+ ref,
+ reactive,
+ toRefs,
+ onMounted,
+ getCurrentInstance,
+ nextTick,
+ } from "vue";
+ import { ElMessageBox } from "element-plus";
+ import useUserStore from "@/store/modules/user";
+ import dayjs from "dayjs";
+ import {
+ getStockInPage,
+ getStockInPageByProduction,
+ delStockIn,
+ } from "@/api/inventoryManagement/stockIn.js";
+ import FormDia from "./components/formDia.vue";
+ import FormDiaProduct from "./components/formDiaProduct.vue";
-// 鑾峰彇褰撳墠鏃ユ湡
-function getCurrentDate() {
- return dayjs().format('YYYY-MM-DD')
-}
-
-const { proxy } = getCurrentInstance()
-
-const tableData = ref([])
-const selectedRows = ref([])
-const tableLoading = ref(false)
-const formDia = ref()
-const formDiaProduct = ref()
-const activeTab = ref('production') // 褰撳墠婵�娲荤殑 tab
-
-const page = reactive({
- current: 1,
- size: 100,
-})
-const total = ref(0)
-
-const data = reactive({
- searchForm: {
- supplierName: '',
- customerName: '',
- productCategory:'',
- timeStr: '',
- },
-})
-const { searchForm } = 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
- const params = { ...page }
-
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷浼犻�掍笉鍚岀殑鏌ヨ鍙傛暟
- 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
+ // 鑾峰彇褰撳墠鏃ユ湡
+ function getCurrentDate() {
+ return dayjs().format("YYYY-MM-DD");
}
- params.productCategory = searchForm.value.productCategory
-
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勬帴鍙�
- const apiCall = activeTab.value === 'production'
- ? getStockInPageByProduction(params)
- : getStockInPage(params)
-
- apiCall.then(res => {
- tableLoading.value = false
- tableData.value = res.data.records
-
- // 鍓嶇璁$畻鎬讳环锛氭�讳环 = unitPrice * inboundNum
- tableData.value = tableData.value.map(item => {
- // 浣跨敤鍏ュ簱鏁伴噺璁$畻鎬讳环
- const inboundNum = Number(item.inboundNum) || 0
- const unitPrice = Number(item.unitPrice) || 0
- const taxInclusiveUnitPrice = Number(item.taxInclusiveUnitPrice) || 0
-
- // 鏍规嵁鏍囩椤电被鍨嬭绠椾笉鍚岀殑鎬讳环
- if (activeTab.value === 'production') {
- // 鎴愬搧搴撳瓨锛氭�讳环 = unitPrice * 鍏ュ簱鏁伴噺
- item.totalPrice = (unitPrice * inboundNum).toFixed(2)
- } else {
- // 鍘熸枡鍜屾潗鏂欏簱瀛橈細鍚◣鎬讳环 = taxInclusiveUnitPrice * 鍏ュ簱鏁伴噺
- item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * inboundNum).toFixed(2)
- }
-
- return item
- })
-
- total.value = res.data.total
- }).catch(() => {
- tableLoading.value = false
- })
-}
-// 鍒囨崲 tab
-const handleTabChange = (tabName) => {
- page.current = 1
- // 鍒囨崲 tab 鏃舵竻绌烘悳绱㈡潯浠�
- searchForm.value.supplierName = ''
- searchForm.value.customerName = ''
- searchForm.value.timeStr = ''
- searchForm.value.productCategory = ''
- getList()
-}
+ const { proxy } = getCurrentInstance();
-// 鎵撳紑寮规
-const openForm = async (type, row, tabType) => {
- const currentTab = tabType || activeTab.value
- await nextTick(() => {
- if (currentTab === 'production') {
- formDiaProduct.value?.openDialog(type, row)
- }else {
- formDia.value?.openDialog(type, row)
- }
- })
-}
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const tableLoading = ref(false);
+ const formDia = ref();
+ const formDiaProduct = ref();
+ const activeTab = ref("production"); // 褰撳墠婵�娲荤殑 tab
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
- selectedRows.value = selection.filter(item => item.id)
-}
+ const page = reactive({
+ current: 1,
+ size: 100,
+ });
+ const total = ref(0);
-const expandedRowKeys = ref([])
+ const data = reactive({
+ searchForm: {
+ supplierName: "",
+ customerName: "",
+ productCategory: "",
+ timeStr: "",
+ },
+ });
+ const { searchForm } = 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;
+ const params = { ...page };
-// 涓昏〃鍚堣鏂规硶
-const summarizeMainTable = (param) => {
- return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice'])
-}
-
-// 瀵煎嚭
-const handleOut = () => {
- ElMessageBox.confirm('鏄惁纭瀵煎嚭锛�', '瀵煎嚭', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }).then(() => {
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
- let exportUrl = "/stockin/export"
- if (activeTab.value === 'production') {
- exportUrl = "/stockin/exportOne"
- }
- proxy.download(exportUrl, {}, '鍏ュ簱鍙拌处.xlsx')
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�")
- })
-}
-
-// 鍒犻櫎
-const handleDelete = () => {
- if (selectedRows.value.length === 0) {
- proxy.$modal.msgWarning('璇烽�夋嫨鏁版嵁')
- return
- }
- const ids = selectedRows.value.map(item => item.id)
-
- ElMessageBox.confirm('閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', '鍒犻櫎', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }).then(() => {
- // 鏍规嵁褰撳墠 tab 绫诲瀷閫夋嫨涓嶅悓鐨勫垹闄ゆ帴鍙e拰type鍙傛暟
- let deleteApi, deleteParams
-
- if (activeTab.value === 'production') {
- // 鎴愬搧鍒犻櫎锛宼ype浼�2
- deleteApi = delStockIn
- deleteParams = { ids, type: 2 }
+ // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷浼犻�掍笉鍚岀殑鏌ヨ鍙傛暟
+ if (activeTab.value === "production") {
+ params.customerName = searchForm.value.customerName;
+ params.timeStr = searchForm.value.timeStr;
} else {
- // 鍘熸枡鍒犻櫎锛宼ype浼�1
- deleteApi = delStockIn
- deleteParams = { ids, type: 1 }
+ params.supplierName = searchForm.value.supplierName;
+ params.timeStr = searchForm.value.timeStr;
}
-
- deleteApi(deleteParams).then(() => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
- getList()
- }).catch(() => {
- proxy.$modal.msgError("鍒犻櫎澶辫触")
- })
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�")
- })
-}
+ params.productCategory = searchForm.value.productCategory;
-onMounted(() => {
- getList()
-})
+ // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勬帴鍙�
+ const apiCall =
+ activeTab.value === "production"
+ ? getStockInPageByProduction(params)
+ : getStockInPage(params);
+
+ apiCall
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+
+ // 鍓嶇璁$畻鎬讳环锛氭�讳环 = unitPrice * inboundNum
+ tableData.value = tableData.value.map(item => {
+ // 浣跨敤鍏ュ簱鏁伴噺璁$畻鎬讳环
+ const inboundNum = Number(item.inboundNum) || 0;
+ const unitPrice = Number(item.unitPrice) || 0;
+ const taxInclusiveUnitPrice = Number(item.taxInclusiveUnitPrice) || 0;
+
+ // 鏍规嵁鏍囩椤电被鍨嬭绠椾笉鍚岀殑鎬讳环
+ if (activeTab.value === "production") {
+ // 鎴愬搧搴撳瓨锛氭�讳环 = unitPrice * 鍏ュ簱鏁伴噺
+ item.totalPrice = (unitPrice * inboundNum).toFixed(2);
+ } else {
+ // 鍘熸枡鍜屾潗鏂欏簱瀛橈細鍚◣鎬讳环 = taxInclusiveUnitPrice * 鍏ュ簱鏁伴噺
+ item.taxInclusiveTotalPrice = (
+ taxInclusiveUnitPrice * inboundNum
+ ).toFixed(2);
+ }
+
+ return item;
+ });
+
+ total.value = res.data.total;
+ })
+ .catch(() => {
+ tableLoading.value = false;
+ });
+ };
+
+ // 鍒囨崲 tab
+ const handleTabChange = tabName => {
+ page.current = 1;
+ // 鍒囨崲 tab 鏃舵竻绌烘悳绱㈡潯浠�
+ searchForm.value.supplierName = "";
+ searchForm.value.customerName = "";
+ searchForm.value.timeStr = "";
+ searchForm.value.productCategory = "";
+ getList();
+ };
+
+ // 鎵撳紑寮规
+ const openForm = async (type, row, tabType) => {
+ const currentTab = tabType || activeTab.value;
+ await nextTick(() => {
+ if (currentTab === "production") {
+ formDiaProduct.value?.openDialog(type, row);
+ } else {
+ formDia.value?.openDialog(type, row);
+ }
+ });
+ };
+
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection.filter(item => item.id);
+ };
+
+ const expandedRowKeys = ref([]);
+
+ // 涓昏〃鍚堣鏂规硶
+ const summarizeMainTable = param => {
+ return proxy.summarizeTable(param, [
+ "contractAmount",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ ]);
+ };
+
+ // 瀵煎嚭
+ const handleOut = () => {
+ ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
+ let exportUrl = "/stockin/export";
+ if (activeTab.value === "production") {
+ exportUrl = "/stockin/exportOne";
+ }
+ proxy.download(exportUrl, {}, "鍏ュ簱鍙拌处.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ // 鍒犻櫎
+ const handleDelete = () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const ids = selectedRows.value.map(item => item.id);
+
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // 鏍规嵁褰撳墠 tab 绫诲瀷閫夋嫨涓嶅悓鐨勫垹闄ゆ帴鍙e拰type鍙傛暟
+ let deleteApi, deleteParams;
+
+ if (activeTab.value === "production") {
+ // 鎴愬搧鍒犻櫎锛宼ype浼�2
+ deleteApi = delStockIn;
+ deleteParams = { ids, type: 2 };
+ } else {
+ // 鍘熸枡鍒犻櫎锛宼ype浼�1
+ deleteApi = delStockIn;
+ deleteParams = { ids, type: 1 };
+ }
+
+ deleteApi(deleteParams)
+ .then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ proxy.$modal.msgError("鍒犻櫎澶辫触");
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ onMounted(() => {
+ getList();
+ });
</script>
<style scoped lang="scss"></style>
diff --git a/src/views/inventoryManagement/stockManagement/index.vue b/src/views/inventoryManagement/stockManagement/index.vue
index 88d1292..e6fb48d 100644
--- a/src/views/inventoryManagement/stockManagement/index.vue
+++ b/src/views/inventoryManagement/stockManagement/index.vue
@@ -1,498 +1,595 @@
<template>
<div class="app-container">
- <el-tabs v-model="activeTab" @tab-change="handleTabChange">
- <el-tab-pane label="鎴愬搧搴撳瓨" name="production">
+ <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>
+ <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="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="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="totalInboundNum" width="100" show-overflow-tooltip />
- <el-table-column label="鍓╀綑搴撳瓨" prop="inboundNum0" 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 fixed="right" label="鎿嶄綔" min-width="60" align="center">
+ <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="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="totalInboundNum"
+ width="100"
+ show-overflow-tooltip />
+ <el-table-column label="鍓╀綑搴撳瓨"
+ prop="inboundNum0"
+ 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 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-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" />
+ <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="100" 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="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 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="100"
+ 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="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"
- />
-
+ <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"
- />
+ <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 {
- getStockManagePage,
- getStockManagePageByProduction,
- delStockManage,
-} from "@/api/inventoryManagement/stockManage.js";
-import {
- updateManagement, updateManagementByCustom, 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,
+ } 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'
+ // 瀵煎叆涓や釜鐙珛鐨勫脊妗嗙粍浠�
+ 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 activeTab = ref("production");
-// 寮规鏄剧ず鐘舵��
-const productionDialogVisible = ref(false)
-const purchaseDialogVisible = ref(false)
+ // 寮规鏄剧ず鐘舵��
+ const productionDialogVisible = ref(false);
+ const purchaseDialogVisible = ref(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 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 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
-}
-
-const getList = () => {
- tableLoading.value = true
- const params = buildQueryParams()
- const apiCall = activeTab.value === 'production'
- ? getStockManagePageByProduction(params)
- : getStockManagePage(params)
- apiCall.then(res => {
- tableLoading.value = false
- tableData.value = res.data.records
-
- // 涓鸿〃鏍兼暟鎹嚜鍔ㄨ绠楁�讳环
- 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
- })
-
- total.value = res.data.total
- // 鏁版嵁鍔犺浇瀹屾垚鍚庢鏌ュ簱瀛�
- // checkStockAndCreatePurchase();
- }).catch(() => {
- tableLoading.value = false
- })
-}
-
-// 鍒囨崲 tab
-const handleTabChange = () => {
- page.current = 1
- // searchForm.value.supplierName = ''
- searchForm.value.customerName = ''
- searchForm.value.timeStr = ''
- selectedRows.value = []
- searchForm.value.productCategory = ''
- 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)
-
- // 浣跨敤瀛愮粍浠舵彁浜ょ殑鏁版嵁锛岃�屼笉鏄埗缁勪欢鐨刦orm瀵硅薄
- 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();
- }).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(() => {
- const exportParams = buildQueryParams()
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
- let exportUrl = "/stockin/exportCopy"
- if (activeTab.value === 'production') {
- exportUrl = "/stockin/exportCopyOne"
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ 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
}
- 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()
+ return params;
+ };
+
+ const getList = () => {
+ tableLoading.value = true;
+ const params = buildQueryParams();
+ const apiCall =
+ activeTab.value === "production"
+ ? getStockManagePageByProduction(params)
+ : getStockManagePage(params);
+ apiCall
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+
+ // 涓鸿〃鏍兼暟鎹嚜鍔ㄨ绠楁�讳环
+ 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;
+ });
+
+ total.value = res.data.total;
+ // 鏁版嵁鍔犺浇瀹屾垚鍚庢鏌ュ簱瀛�
+ // checkStockAndCreatePurchase();
+ })
+ .catch(() => {
+ tableLoading.value = false;
+ });
+ };
+
+ // 鍒囨崲 tab
+ const handleTabChange = () => {
+ page.current = 1;
+ // searchForm.value.supplierName = ''
+ searchForm.value.customerName = "";
+ searchForm.value.timeStr = "";
+ selectedRows.value = [];
+ searchForm.value.productCategory = "";
+ 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);
+
+ // 浣跨敤瀛愮粍浠舵彁浜ょ殑鏁版嵁锛岃�屼笉鏄埗缁勪欢鐨刦orm瀵硅薄
+ 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();
+ })
+ .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",
})
- }).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();
+ .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;
-}
+ :deep(.row-low-stock:hover > td) {
+ background-color: #fcd4d4;
+ }
</style>
\ No newline at end of file
diff --git a/src/views/qualityManagement/finalInspection/components/filesDia.vue b/src/views/qualityManagement/finalInspection/components/filesDia.vue
index 7fe250a..edd9ac5 100644
--- a/src/views/qualityManagement/finalInspection/components/filesDia.vue
+++ b/src/views/qualityManagement/finalInspection/components/filesDia.vue
@@ -1,38 +1,34 @@
<template>
<div>
- <el-dialog
- v-model="dialogFormVisible"
- title="涓婁紶闄勪欢"
- width="50%"
- @close="closeDia"
- >
+ <el-dialog v-model="dialogFormVisible"
+ title="涓婁紶闄勪欢"
+ width="50%"
+ @close="closeDia">
<div style="margin-bottom: 10px;text-align: right">
- <el-upload
- v-model:file-list="fileList"
- class="upload-demo"
- :action="uploadUrl"
- :on-success="handleUploadSuccess"
- :on-error="handleUploadError"
- name="file"
- :show-file-list="false"
- :headers="headers"
- style="display: inline;margin-right: 10px"
- >
+ <el-upload v-model:file-list="fileList"
+ class="upload-demo"
+ :action="uploadUrl"
+ :on-success="handleUploadSuccess"
+ :on-error="handleUploadError"
+ name="file"
+ :show-file-list="false"
+ :headers="headers"
+ style="display: inline;margin-right: 10px">
<el-button type="primary">涓婁紶闄勪欢</el-button>
</el-upload>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎</el-button>
</div>
- <PIMTable
- rowKey="id"
- :column="tableColumn"
- :tableData="tableData"
- :tableLoading="tableLoading"
- :isSelection="true"
- @selection-change="handleSelectionChange"
- height="500"
- :page="page"
- @pagination="pagination"
- >
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :tableLoading="tableLoading"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ height="500"
+ :page="page"
+ @pagination="pagination">
</PIMTable>
<template #footer>
<div class="dialog-footer">
@@ -44,142 +40,149 @@
</template>
<script setup>
-import {ref} from "vue";
-import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js";
-import {Search} from "@element-plus/icons-vue";
-import {
- qualityInspectParamDel,
- qualityInspectParamInfo,
- qualityInspectParamUpdate
-} from "@/api/qualityManagement/qualityInspectParam.js";
-import {ElMessageBox} from "element-plus";
-import {getToken} from "@/utils/auth.js";
-import {
- qualityInspectFileAdd,
- qualityInspectFileDel,
- qualityInspectFileListPage
-} from "@/api/qualityManagement/qualityInspectFile.js";
-import Pagination from "@/components/PIMTable/Pagination.vue";
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['close'])
+ import { ref } from "vue";
+ import {
+ getStaffJoinInfo,
+ staffJoinAdd,
+ staffJoinUpdate,
+ } from "@/api/personnelManagement/onboarding.js";
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ qualityInspectParamDel,
+ qualityInspectParamInfo,
+ qualityInspectParamUpdate,
+ } from "@/api/qualityManagement/qualityInspectParam.js";
+ import { ElMessageBox } from "element-plus";
+ import { getToken } from "@/utils/auth.js";
+ import {
+ qualityInspectFileAdd,
+ qualityInspectFileDel,
+ qualityInspectFileListPage,
+ } from "@/api/qualityManagement/qualityInspectFile.js";
+ import Pagination from "@/components/PIMTable/Pagination.vue";
+ const { proxy } = getCurrentInstance();
+ const emit = defineEmits(["close"]);
-const dialogFormVisible = ref(false);
-const currentId = ref('')
-const selectedRows = ref([]);
-const tableColumn = ref([
- {
- label: "鏂囦欢鍚嶇О",
- prop: "name",
- },
- {
- dataType: "action",
- label: "鎿嶄綔",
- align: "center",
- operation: [
- {
- name: "涓嬭浇",
- type: "text",
- clickFun: (row) => {
- downLoadFile(row);
+ const dialogFormVisible = ref(false);
+ const currentId = ref("");
+ const selectedRows = ref([]);
+ const tableColumn = ref([
+ {
+ label: "鏂囦欢鍚嶇О",
+ prop: "name",
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ operation: [
+ {
+ name: "涓嬭浇",
+ type: "text",
+ clickFun: row => {
+ downLoadFile(row);
+ },
},
- }
- ],
- },
-]);
-const page = reactive({
- current: 1,
- size: 100,
- total: 0
-});
-const total = ref(0);
-const tableData = ref([]);
-const fileList = ref([]);
-const tableLoading = ref(false);
-const headers = ref({
- Authorization: "Bearer " + getToken(),
-});
-const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/file/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃
+ ],
+ },
+ ]);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const total = ref(0);
+ const tableData = ref([]);
+ const fileList = ref([]);
+ const tableLoading = ref(false);
+ const headers = ref({
+ Authorization: "Bearer " + getToken(),
+ });
+ const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/file/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃
-// 鎵撳紑寮规
-const openDialog = (row) => {
- dialogFormVisible.value = true;
- currentId.value = row.id;
- getList()
-}
-const pagination = (obj) => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
-};
-const getList = () => {
- qualityInspectFileListPage({inspectId: currentId.value}).then(res => {
- tableData.value = res.data.records;
- page.total = res.data.total;
- })
-}
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
- selectedRows.value = selection;
-};
-// 涓嬭浇闄勪欢
-const downLoadFile = (row) => {
- proxy.$download.name(row.url);
-}
-// 鍏抽棴寮规
-const closeDia = () => {
- dialogFormVisible.value = false;
- emit('close')
-};
-// 涓婁紶鎴愬姛澶勭悊
-function handleUploadSuccess(res, file) {
- // 濡傛灉涓婁紶鎴愬姛
- if (res.code == 200) {
- const fileRow = {}
- fileRow.name = res.data.originalName
- fileRow.url = res.data.tempPath
- uploadFile(fileRow)
- } else {
- proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ // 鎵撳紑寮规
+ const openDialog = row => {
+ dialogFormVisible.value = true;
+ currentId.value = row.id;
+ getList();
+ };
+ const pagination = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const getList = () => {
+ qualityInspectFileListPage({ inspectId: currentId.value, ...page }).then(
+ res => {
+ tableData.value = res.data.records;
+ page.total = res.data.total;
+ }
+ );
+ };
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ };
+ // 涓嬭浇闄勪欢
+ const downLoadFile = row => {
+ proxy.$download.name(row.url);
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ dialogFormVisible.value = false;
+ emit("close");
+ };
+ // 涓婁紶鎴愬姛澶勭悊
+ function handleUploadSuccess(res, file) {
+ // 濡傛灉涓婁紶鎴愬姛
+ if (res.code == 200) {
+ const fileRow = {};
+ fileRow.name = res.data.originalName;
+ fileRow.url = res.data.tempPath;
+ uploadFile(fileRow);
+ } else {
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ }
}
-}
-function uploadFile(file) {
- file.inspectId = currentId.value;
- qualityInspectFileAdd(file).then(res => {
- proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
- getList()
- })
-}
-// 涓婁紶澶辫触澶勭悊
-function handleUploadError() {
- proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
-}
-// 鍒犻櫎
-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(() => {
- qualityInspectFileDel(ids).then((res) => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ function uploadFile(file) {
+ file.inspectId = currentId.value;
+ qualityInspectFileAdd(file).then(res => {
+ proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
getList();
});
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�");
+ }
+ // 涓婁紶澶辫触澶勭悊
+ function handleUploadError() {
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ }
+ // 鍒犻櫎
+ 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(() => {
+ qualityInspectFileDel(ids).then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+ defineExpose({
+ openDialog,
});
-};
-defineExpose({
- openDialog,
-});
</script>
<style scoped>
-
</style>
\ No newline at end of file
diff --git a/src/views/qualityManagement/finalInspection/index.vue b/src/views/qualityManagement/finalInspection/index.vue
index 83d45b0..cdfd829 100644
--- a/src/views/qualityManagement/finalInspection/index.vue
+++ b/src/views/qualityManagement/finalInspection/index.vue
@@ -202,7 +202,7 @@
submit(row.id);
},
disabled: row => {
- return row.inspectState == 1;
+ return row.inspectState == 1 || !row.checkResult;
},
},
{
diff --git a/src/views/qualityManagement/nonconformingManagement/components/formDia.vue b/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
index 13a231d..ea92d7b 100644
--- a/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
+++ b/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
@@ -1,120 +1,152 @@
<template>
<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-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="inspectState">
+ <el-form-item label="鐘舵�侊細"
+ prop="inspectState">
<el-select v-model="form.inspectState">
- <el-option label="寰呭鐞�" :value="0" />
- <el-option label="宸插鐞�" :value="1" />
+ <el-option label="寰呭鐞�"
+ :value="0" />
+ <el-option label="宸插鐞�"
+ :value="1" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="绫诲埆锛�" prop="inspectType">
+ <el-form-item label="绫诲埆锛�"
+ prop="inspectType">
<el-select v-model="form.inspectType">
- <el-option label="鍘熸潗鏂欐楠�" :value="0" />
- <el-option label="杩囩▼妫�楠�" :value="1" />
- <el-option label="鍑哄巶妫�楠�" :value="2" />
+ <el-option label="鍘熸潗鏂欐楠�"
+ :value="0" />
+ <el-option label="杩囩▼妫�楠�"
+ :value="1" />
+ <el-option label="鍑哄巶妫�楠�"
+ :value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="浜у搧鍚嶇О锛�" prop="productId">
- <el-tree-select
- v-model="form.productId"
- placeholder="璇烽�夋嫨"
- clearable
- check-strictly
- @change="getModels"
- :data="productOptions"
- :render-after-expand="false"
- style="width: 100%"
- />
+ <el-form-item label="浜у搧鍚嶇О锛�"
+ prop="productId">
+ <el-tree-select v-model="form.productId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ check-strictly
+ @change="getModels"
+ :data="productOptions"
+ :render-after-expand="false"
+ style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model">
- <el-input v-model="form.model" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="瑙勬牸鍨嬪彿锛�"
+ prop="model">
+ <el-input v-model="form.model"
+ 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 v-model="form.unit" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="鍗曚綅锛�"
+ prop="unit">
+ <el-input v-model="form.unit"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏁伴噺锛�" prop="quantity">
- <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏�" clearable :precision="2"/>
+ <el-form-item label="鏁伴噺锛�"
+ prop="quantity">
+ <el-input-number :step="0.01"
+ :min="0"
+ style="width: 100%"
+ v-model="form.quantity"
+ placeholder="璇疯緭鍏�"
+ clearable
+ :precision="2" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="妫�楠屽憳锛�" prop="checkName">
- <el-input v-model="form.checkName" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="妫�楠屽憳锛�"
+ prop="checkName">
+ <el-input v-model="form.checkName"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="妫�娴嬫棩鏈燂細" prop="checkTime">
- <el-date-picker
- v-model="form.checkTime"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- style="width: 100%"
- />
+ <el-form-item label="妫�娴嬫棩鏈燂細"
+ prop="checkTime">
+ <el-date-picker v-model="form.checkTime"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="涓嶅悎鏍肩幇璞★細" prop="defectivePhenomena">
- <el-input v-model="form.defectivePhenomena" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="涓嶅悎鏍肩幇璞★細"
+ prop="defectivePhenomena">
+ <el-input v-model="form.defectivePhenomena"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="澶勭悊缁撴灉锛�" prop="dealResult">
- <el-input v-model="form.dealResult" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="澶勭悊缁撴灉锛�"
+ prop="dealResult">
+ <el-input v-model="form.dealResult"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="澶勭悊浜猴細" prop="dealName">
- <el-input v-model="form.dealName" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="澶勭悊浜猴細"
+ prop="dealName">
+ <el-input v-model="form.dealName"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="澶勭悊鏃ユ湡锛�" prop="dealTime">
- <el-date-picker
- v-model="form.dealTime"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- style="width: 100%"
- />
+ <el-form-item label="澶勭悊鏃ユ湡锛�"
+ prop="dealTime">
+ <el-date-picker v-model="form.dealTime"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%" />
</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 type="primary"
+ @click="submitForm">纭</el-button>
<el-button @click="closeDia">鍙栨秷</el-button>
</div>
</template>
@@ -123,127 +155,129 @@
</template>
<script setup>
-import {ref} from "vue";
-import {productTreeList} from "@/api/basicData/product.js";
-import {
- getQualityUnqualifiedInfo,
- qualityUnqualifiedAdd,
- qualityUnqualifiedUpdate
-} from "@/api/qualityManagement/nonconformingManagement.js";
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['close'])
+ import { ref } from "vue";
+ import { productTreeList } from "@/api/basicData/product.js";
+ import {
+ getQualityUnqualifiedInfo,
+ qualityUnqualifiedAdd,
+ qualityUnqualifiedUpdate,
+ } from "@/api/qualityManagement/nonconformingManagement.js";
+ const { proxy } = getCurrentInstance();
+ const emit = defineEmits(["close"]);
-const dialogFormVisible = ref(false);
-const operationType = ref('')
-const data = reactive({
- form: {
- checkTime: "",
- process: "",
- checkName: "",
- productName: "",
- productId: "",
- model: "",
- unit: "",
- quantity: "",
- checkCompany: "",
- checkResult: "",
- inspectState: '',
- inspectType: '',
- defectivePhenomena: '',
- dealResult: '',
- },
- rules: {
- checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" },],
- process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- },
-});
-const { form, rules } = toRefs(data);
-const productOptions = ref([]);
-
-// 鎵撳紑寮规
-const openDialog = (type, row) => {
- operationType.value = type;
- dialogFormVisible.value = true;
- form.value = {}
- getProductOptions();
- if (operationType.value === 'edit') {
- getQualityUnqualifiedInfo(row.id).then(res => {
- form.value = {...res.data}
- })
- }
-}
-const getProductOptions = () => {
- productTreeList().then((res) => {
- productOptions.value = convertIdToValue(res);
+ const dialogFormVisible = ref(false);
+ const operationType = ref("");
+ const data = reactive({
+ form: {
+ checkTime: "",
+ process: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ model: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ inspectState: "",
+ inspectType: "",
+ defectivePhenomena: "",
+ dealResult: "",
+ },
+ rules: {
+ checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ defectivePhenomena: [
+ { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ ],
+ },
});
-};
-const getModels = (value) => {
- form.value.productName = findNodeById(productOptions.value, value);
-};
-const findNodeById = (nodes, productId) => {
- for (let i = 0; i < nodes.length; i++) {
- if (nodes[i].value === productId) {
- return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+ const { form, rules } = toRefs(data);
+ const productOptions = ref([]);
+
+ // 鎵撳紑寮规
+ const openDialog = (type, row) => {
+ operationType.value = type;
+ dialogFormVisible.value = true;
+ form.value = {};
+ getProductOptions();
+ if (operationType.value === "edit") {
+ getQualityUnqualifiedInfo(row.id).then(res => {
+ form.value = { ...res.data };
+ });
}
- if (nodes[i].children && nodes[i].children.length > 0) {
- const foundNode = findNodeById(nodes[i].children, productId);
- if (foundNode) {
- return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ };
+ const getProductOptions = () => {
+ productTreeList().then(res => {
+ productOptions.value = convertIdToValue(res);
+ });
+ };
+ const getModels = value => {
+ form.value.productName = findNodeById(productOptions.value, value);
+ };
+ 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; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
-};
-function convertIdToValue(data) {
- return data.map((item) => {
- const { id, children, ...rest } = item;
- const newItem = {
- ...rest,
- value: id, // 灏� id 鏀逛负 value
- };
- if (children && children.length > 0) {
- newItem.children = convertIdToValue(children);
- }
-
- return newItem;
- });
-}
-// 鎻愪氦浜у搧琛ㄥ崟
-const submitForm = () => {
- proxy.$refs.formRef.validate(valid => {
- if (valid) {
- if (operationType.value === "add") {
- qualityUnqualifiedAdd(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- })
- } else {
- qualityUnqualifiedUpdate(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- })
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+ };
+ function convertIdToValue(data) {
+ return data.map(item => {
+ const { id, children, ...rest } = item;
+ const newItem = {
+ ...rest,
+ value: id, // 灏� id 鏀逛负 value
+ };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
}
- }
- })
-}
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef");
- dialogFormVisible.value = false;
- emit('close')
-};
-defineExpose({
- openDialog,
-});
+
+ return newItem;
+ });
+ }
+ // 鎻愪氦浜у搧琛ㄥ崟
+ const submitForm = () => {
+ proxy.$refs.formRef.validate(valid => {
+ if (valid) {
+ if (operationType.value === "add") {
+ qualityUnqualifiedAdd(form.value).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ });
+ } else {
+ qualityUnqualifiedUpdate(form.value).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ });
+ }
+ }
+ });
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ emit("close");
+ };
+ defineExpose({
+ openDialog,
+ });
</script>
<style scoped>
-
</style>
\ No newline at end of file
diff --git a/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue b/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue
index 196eda0..d6e7937 100644
--- a/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue
+++ b/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue
@@ -1,122 +1,155 @@
<template>
<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-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="inspectState">
+ <el-form-item label="鐘舵�侊細"
+ prop="inspectState">
<el-select v-model="form.inspectState">
- <el-option label="寰呭鐞�" :value="0" />
- <el-option label="宸插鐞�" :value="1" />
+ <el-option label="寰呭鐞�"
+ :value="0" />
+ <el-option label="宸插鐞�"
+ :value="1" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="绫诲埆锛�" prop="inspectType">
- <el-select v-model="form.inspectType" disabled>
- <el-option label="鍘熸潗鏂欐楠�" :value="0" />
- <el-option label="杩囩▼妫�楠�" :value="1" />
- <el-option label="鍑哄巶妫�楠�" :value="2" />
+ <el-form-item label="绫诲埆锛�"
+ prop="inspectType">
+ <el-select v-model="form.inspectType"
+ disabled>
+ <el-option label="鍘熸潗鏂欐楠�"
+ :value="0" />
+ <el-option label="杩囩▼妫�楠�"
+ :value="1" />
+ <el-option label="鍑哄巶妫�楠�"
+ :value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="浜у搧鍚嶇О锛�" prop="productId">
- <el-tree-select
- v-model="form.productId"
- placeholder="璇烽�夋嫨"
- clearable
- disabled
- check-strictly
- @change="getModels"
- :data="productOptions"
- :render-after-expand="false"
- style="width: 100%"
- />
+ <el-form-item label="浜у搧鍚嶇О锛�"
+ prop="productId">
+ <el-tree-select v-model="form.productId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ disabled
+ check-strictly
+ @change="getModels"
+ :data="productOptions"
+ :render-after-expand="false"
+ style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model">
- <el-input v-model="form.model" placeholder="璇疯緭鍏�" clearable disabled/>
+ <el-form-item label="瑙勬牸鍨嬪彿锛�"
+ prop="model">
+ <el-input v-model="form.model"
+ placeholder="璇疯緭鍏�"
+ clearable
+ disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="鍗曚綅锛�" prop="unit">
- <el-input v-model="form.unit" placeholder="璇疯緭鍏�" clearable disabled/>
+ <el-form-item label="鍗曚綅锛�"
+ prop="unit">
+ <el-input v-model="form.unit"
+ placeholder="璇疯緭鍏�"
+ clearable
+ disabled />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏁伴噺锛�" prop="quantity">
- <el-input v-model="form.quantity" placeholder="璇疯緭鍏�" clearable disabled/>
+ <el-form-item label="鏁伴噺锛�"
+ prop="quantity">
+ <el-input v-model="form.quantity"
+ placeholder="璇疯緭鍏�"
+ clearable
+ disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="妫�楠屽憳锛�" prop="checkName">
- <el-input v-model="form.checkName" placeholder="璇疯緭鍏�" clearable disabled/>
+ <el-form-item label="妫�楠屽憳锛�"
+ prop="checkName">
+ <el-input v-model="form.checkName"
+ placeholder="璇疯緭鍏�"
+ clearable
+ disabled />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="妫�娴嬫棩鏈燂細" prop="checkTime">
- <el-date-picker
- v-model="form.checkTime"
- type="date"
- disabled
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- style="width: 100%"
- />
+ <el-form-item label="妫�娴嬫棩鏈燂細"
+ prop="checkTime">
+ <el-date-picker v-model="form.checkTime"
+ type="date"
+ disabled
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="涓嶅悎鏍肩幇璞★細" prop="defectivePhenomena">
- <el-input v-model="form.defectivePhenomena" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="涓嶅悎鏍肩幇璞★細"
+ prop="defectivePhenomena">
+ <el-input v-model="form.defectivePhenomena"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="澶勭悊缁撴灉锛�" prop="dealResult">
- <el-input v-model="form.dealResult" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="澶勭悊缁撴灉锛�"
+ prop="dealResult">
+ <el-input v-model="form.dealResult"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="澶勭悊浜猴細" prop="dealName">
- <el-input v-model="form.dealName" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="澶勭悊浜猴細"
+ prop="dealName">
+ <el-input v-model="form.dealName"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="澶勭悊鏃ユ湡锛�" prop="dealTime">
- <el-date-picker
- v-model="form.dealTime"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- style="width: 100%"
- />
+ <el-form-item label="澶勭悊鏃ユ湡锛�"
+ prop="dealTime">
+ <el-date-picker v-model="form.dealTime"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%" />
</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 type="primary"
+ @click="submitForm">纭</el-button>
<el-button @click="closeDia">鍙栨秷</el-button>
</div>
</template>
@@ -125,133 +158,137 @@
</template>
<script setup>
-import {ref} from "vue";
-import {productTreeList} from "@/api/basicData/product.js";
-import {
- getQualityUnqualifiedInfo,
- qualityUnqualifiedAdd,
- qualityUnqualifiedUpdate
-} from "@/api/qualityManagement/nonconformingManagement.js";
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['close'])
+ import { ref } from "vue";
+ import { productTreeList } from "@/api/basicData/product.js";
+ import {
+ getQualityUnqualifiedInfo,
+ qualityUnqualifiedAdd,
+ qualityUnqualifiedUpdate,
+ } from "@/api/qualityManagement/nonconformingManagement.js";
+ const { proxy } = getCurrentInstance();
+ const emit = defineEmits(["close"]);
-const dialogFormVisible = ref(false);
-const operationType = ref('')
-const data = reactive({
- form: {
- checkTime: "",
- process: "",
- checkName: "",
- productName: "",
- productId: "",
- model: "",
- unit: "",
- quantity: "",
- checkCompany: "",
- checkResult: "",
- inspectState: '',
- inspectType: '',
- defectivePhenomena: '',
- dealResult: '',
- dealName: '',
- dealTime: '',
- },
- rules: {
- checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" },],
- process: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- productId: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- quantity: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- defectivePhenomena: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- dealResult: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- dealName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- dealTime: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
- },
-});
-const { form, rules } = toRefs(data);
-const productOptions = ref([]);
-
-// 鎵撳紑寮规
-const openDialog = (type, row) => {
- operationType.value = type;
- dialogFormVisible.value = true;
- form.value = {}
- getProductOptions();
- if (operationType.value === 'edit') {
- getQualityUnqualifiedInfo(row.id).then(res => {
- form.value = {...res.data}
- })
- }
-}
-const getProductOptions = () => {
- productTreeList().then((res) => {
- productOptions.value = convertIdToValue(res);
+ const dialogFormVisible = ref(false);
+ const operationType = ref("");
+ const data = reactive({
+ form: {
+ checkTime: "",
+ process: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ model: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ inspectState: "",
+ inspectType: "",
+ defectivePhenomena: "",
+ dealResult: "",
+ dealName: "",
+ dealTime: "",
+ },
+ rules: {
+ checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ process: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ productId: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ quantity: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ defectivePhenomena: [
+ { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ ],
+ dealResult: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ dealName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ dealTime: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
+ defectivePhenomena: [
+ { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ ],
+ },
});
-};
-const getModels = (value) => {
- form.value.productName = findNodeById(productOptions.value, value);
-};
-const findNodeById = (nodes, productId) => {
- for (let i = 0; i < nodes.length; i++) {
- if (nodes[i].value === productId) {
- return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+ const { form, rules } = toRefs(data);
+ const productOptions = ref([]);
+
+ // 鎵撳紑寮规
+ const openDialog = (type, row) => {
+ operationType.value = type;
+ dialogFormVisible.value = true;
+ form.value = {};
+ getProductOptions();
+ if (operationType.value === "edit") {
+ getQualityUnqualifiedInfo(row.id).then(res => {
+ form.value = { ...res.data };
+ });
}
- if (nodes[i].children && nodes[i].children.length > 0) {
- const foundNode = findNodeById(nodes[i].children, productId);
- if (foundNode) {
- return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ };
+ const getProductOptions = () => {
+ productTreeList().then(res => {
+ productOptions.value = convertIdToValue(res);
+ });
+ };
+ const getModels = value => {
+ form.value.productName = findNodeById(productOptions.value, value);
+ };
+ 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; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
-};
-function convertIdToValue(data) {
- return data.map((item) => {
- const { id, children, ...rest } = item;
- const newItem = {
- ...rest,
- value: id, // 灏� id 鏀逛负 value
- };
- if (children && children.length > 0) {
- newItem.children = convertIdToValue(children);
- }
-
- return newItem;
- });
-}
-// 鎻愪氦浜у搧琛ㄥ崟
-const submitForm = () => {
- proxy.$refs.formRef.validate(valid => {
- if (valid) {
- if (operationType.value === "add") {
- qualityUnqualifiedAdd(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- })
- } else {
- qualityUnqualifiedUpdate(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- })
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+ };
+ function convertIdToValue(data) {
+ return data.map(item => {
+ const { id, children, ...rest } = item;
+ const newItem = {
+ ...rest,
+ value: id, // 灏� id 鏀逛负 value
+ };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
}
- }
- })
-}
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef");
- dialogFormVisible.value = false;
- emit('close')
-};
-defineExpose({
- openDialog,
-});
+
+ return newItem;
+ });
+ }
+ // 鎻愪氦浜у搧琛ㄥ崟
+ const submitForm = () => {
+ proxy.$refs.formRef.validate(valid => {
+ if (valid) {
+ if (operationType.value === "add") {
+ qualityUnqualifiedAdd(form.value).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ });
+ } else {
+ qualityUnqualifiedUpdate(form.value).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ });
+ }
+ }
+ });
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ emit("close");
+ };
+ defineExpose({
+ openDialog,
+ });
</script>
<style scoped>
-
</style>
\ No newline at end of file
diff --git a/src/views/qualityManagement/processInspection/components/filesDia.vue b/src/views/qualityManagement/processInspection/components/filesDia.vue
index 768ea5b..0b73263 100644
--- a/src/views/qualityManagement/processInspection/components/filesDia.vue
+++ b/src/views/qualityManagement/processInspection/components/filesDia.vue
@@ -1,38 +1,34 @@
<template>
<div>
- <el-dialog
- v-model="dialogFormVisible"
- title="涓婁紶闄勪欢"
- width="50%"
- @close="closeDia"
- >
+ <el-dialog v-model="dialogFormVisible"
+ title="涓婁紶闄勪欢"
+ width="50%"
+ @close="closeDia">
<div style="margin-bottom: 10px;text-align: right">
- <el-upload
- v-model:file-list="fileList"
- class="upload-demo"
- :action="uploadUrl"
- :on-success="handleUploadSuccess"
- :on-error="handleUploadError"
- name="file"
- :show-file-list="false"
- :headers="headers"
- style="display: inline;margin-right: 10px"
- >
+ <el-upload v-model:file-list="fileList"
+ class="upload-demo"
+ :action="uploadUrl"
+ :on-success="handleUploadSuccess"
+ :on-error="handleUploadError"
+ name="file"
+ :show-file-list="false"
+ :headers="headers"
+ style="display: inline;margin-right: 10px">
<el-button type="primary">涓婁紶闄勪欢</el-button>
</el-upload>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎</el-button>
</div>
- <PIMTable
- rowKey="id"
- :column="tableColumn"
- :tableData="tableData"
- :tableLoading="tableLoading"
- :isSelection="true"
- @selection-change="handleSelectionChange"
- height="500"
- :page="page"
- @pagination="pagination"
- >
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :tableLoading="tableLoading"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ height="500"
+ :page="page"
+ @pagination="pagination">
</PIMTable>
<template #footer>
<div class="dialog-footer">
@@ -40,153 +36,156 @@
</div>
</template>
</el-dialog>
- <filePreview ref="filePreviewRef" />
+ <filePreview ref="filePreviewRef" />
</div>
</template>
<script setup>
-import {ref} from "vue";
-import filePreview from '@/components/filePreview/index.vue'
-import {ElMessageBox} from "element-plus";
-import {getToken} from "@/utils/auth.js";
-import {
- qualityInspectFileAdd,
- qualityInspectFileDel,
- qualityInspectFileListPage
-} from "@/api/qualityManagement/qualityInspectFile.js";
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['close'])
+ import { ref } from "vue";
+ import filePreview from "@/components/filePreview/index.vue";
+ import { ElMessageBox } from "element-plus";
+ import { getToken } from "@/utils/auth.js";
+ import {
+ qualityInspectFileAdd,
+ qualityInspectFileDel,
+ qualityInspectFileListPage,
+ } from "@/api/qualityManagement/qualityInspectFile.js";
+ const { proxy } = getCurrentInstance();
+ const emit = defineEmits(["close"]);
-const dialogFormVisible = ref(false);
-const currentId = ref('')
-const selectedRows = ref([]);
-const filePreviewRef = ref()
-const tableColumn = ref([
- {
- label: "鏂囦欢鍚嶇О",
- prop: "name",
- },
- {
- dataType: "action",
- label: "鎿嶄綔",
- align: "center",
- operation: [
- {
- name: "涓嬭浇",
- type: "text",
- clickFun: (row) => {
- downLoadFile(row);
+ const dialogFormVisible = ref(false);
+ const currentId = ref("");
+ const selectedRows = ref([]);
+ const filePreviewRef = ref();
+ const tableColumn = ref([
+ {
+ label: "鏂囦欢鍚嶇О",
+ prop: "name",
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ operation: [
+ {
+ name: "涓嬭浇",
+ type: "text",
+ clickFun: row => {
+ downLoadFile(row);
+ },
},
- },
- {
- name: "棰勮",
- type: "text",
- clickFun: (row) => {
- lookFile(row);
- },
- }
- ],
- },
-]);
-const page = reactive({
- current: 1,
- size: 100,
- total: 0
-});
-const total = ref(0);
-const tableData = ref([]);
-const fileList = ref([]);
-const tableLoading = ref(false);
-const headers = ref({
- Authorization: "Bearer " + getToken(),
-});
-const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/file/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃
+ {
+ name: "棰勮",
+ type: "text",
+ clickFun: row => {
+ lookFile(row);
+ },
+ },
+ ],
+ },
+ ]);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const total = ref(0);
+ const tableData = ref([]);
+ const fileList = ref([]);
+ const tableLoading = ref(false);
+ const headers = ref({
+ Authorization: "Bearer " + getToken(),
+ });
+ const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/file/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃
-// 鎵撳紑寮规
-const openDialog = (row) => {
- dialogFormVisible.value = true;
- currentId.value = row.id;
- getList()
-}
+ // 鎵撳紑寮规
+ const openDialog = row => {
+ dialogFormVisible.value = true;
+ currentId.value = row.id;
+ getList();
+ };
-const getList = () => {
- qualityInspectFileListPage({inspectId: currentId.value}).then(res => {
- tableData.value = res.data.records;
- page.total = res.data.total;
- })
-}
-const pagination = (obj) => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
-};
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
- selectedRows.value = selection;
-};
-// 涓嬭浇闄勪欢
-const downLoadFile = (row) => {
- proxy.$download.name(row.url);
-}
-// 鍏抽棴寮规
-const closeDia = () => {
- dialogFormVisible.value = false;
- emit('close')
-};
-// 涓婁紶鎴愬姛澶勭悊
-function handleUploadSuccess(res, file) {
- // 濡傛灉涓婁紶鎴愬姛
- if (res.code == 200) {
- const fileRow = {}
- fileRow.name = res.data.originalName
- fileRow.url = res.data.tempPath
- uploadFile(fileRow)
- } else {
- proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ const getList = () => {
+ qualityInspectFileListPage({ inspectId: currentId.value, ...page }).then(
+ res => {
+ tableData.value = res.data.records;
+ page.total = res.data.total;
+ }
+ );
+ };
+ const pagination = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ };
+ // 涓嬭浇闄勪欢
+ const downLoadFile = row => {
+ proxy.$download.name(row.url);
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ dialogFormVisible.value = false;
+ emit("close");
+ };
+ // 涓婁紶鎴愬姛澶勭悊
+ function handleUploadSuccess(res, file) {
+ // 濡傛灉涓婁紶鎴愬姛
+ if (res.code == 200) {
+ const fileRow = {};
+ fileRow.name = res.data.originalName;
+ fileRow.url = res.data.tempPath;
+ uploadFile(fileRow);
+ } else {
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ }
}
-}
-function uploadFile(file) {
- file.inspectId = currentId.value;
- qualityInspectFileAdd(file).then(res => {
- proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
- getList()
- })
-}
-// 涓婁紶澶辫触澶勭悊
-function handleUploadError() {
- proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
-}
-// 棰勮闄勪欢
-const lookFile = (row) => {
- filePreviewRef.value.open(row.url)
-}
-// 鍒犻櫎
-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(() => {
- qualityInspectFileDel(ids).then((res) => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ function uploadFile(file) {
+ file.inspectId = currentId.value;
+ qualityInspectFileAdd(file).then(res => {
+ proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
getList();
});
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�");
+ }
+ // 涓婁紶澶辫触澶勭悊
+ function handleUploadError() {
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ }
+ // 棰勮闄勪欢
+ const lookFile = row => {
+ filePreviewRef.value.open(row.url);
+ };
+ // 鍒犻櫎
+ 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(() => {
+ qualityInspectFileDel(ids).then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+ defineExpose({
+ openDialog,
});
-};
-defineExpose({
- openDialog,
-});
</script>
<style scoped>
-
</style>
\ No newline at end of file
diff --git a/src/views/qualityManagement/processInspection/components/formDia.vue b/src/views/qualityManagement/processInspection/components/formDia.vue
index a4baa95..c5cd6ad 100644
--- a/src/views/qualityManagement/processInspection/components/formDia.vue
+++ b/src/views/qualityManagement/processInspection/components/formDia.vue
@@ -193,6 +193,9 @@
quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
checkResult: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
+ defectivePhenomena: [
+ { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ ],
},
});
const userList = ref([]);
diff --git a/src/views/qualityManagement/processInspection/index.vue b/src/views/qualityManagement/processInspection/index.vue
index 1508cdc..6206552 100644
--- a/src/views/qualityManagement/processInspection/index.vue
+++ b/src/views/qualityManagement/processInspection/index.vue
@@ -207,7 +207,7 @@
submit(row.id);
},
disabled: row => {
- return row.inspectState == 1;
+ return row.inspectState == 1 || !row.checkResult;
},
},
{
diff --git a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
index cd9160c..66746d4 100644
--- a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
@@ -67,7 +67,6 @@
<el-form-item label="鏁伴噺锛�"
prop="quantity">
<el-input-number :step="0.01"
- readonly
:min="0"
:disabled="operationType === 'edit'"
style="width: 100%"
diff --git a/src/views/qualityManagement/rawMaterialInspection/index.vue b/src/views/qualityManagement/rawMaterialInspection/index.vue
index d4735ae..20a7d5c 100644
--- a/src/views/qualityManagement/rawMaterialInspection/index.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -208,7 +208,7 @@
submit(row.id);
},
disabled: row => {
- return row.inspectState == 1;
+ return row.inspectState == 1 || !row.checkResult;
},
},
{
diff --git a/src/views/tool/gen/importTable.vue b/src/views/tool/gen/importTable.vue
index 00fc7fc..21b1afe 100644
--- a/src/views/tool/gen/importTable.vue
+++ b/src/views/tool/gen/importTable.vue
@@ -68,21 +68,24 @@
</template>
<script setup>
- import { listDbTable, importTable } from "@/api/tool/gen";
-
- const total = ref(0);
- const visible = ref(false);
- const tables = ref([]);
- const dbTableList = ref([]);
- const { proxy } = getCurrentInstance();
-
- // 鏍煎紡鍖栨棩鏈熶负 YYYY-MM-DD
- const formatDate = (row, column, cellValue) => {
- if (cellValue) {
- const date = new Date(cellValue);
- return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
- }
- return "";
+ import { listDbTable, importTable } from "@/api/tool/gen";
+
+ const total = ref(0);
+ const visible = ref(false);
+ const tables = ref([]);
+ const dbTableList = ref([]);
+ const { proxy } = getCurrentInstance();
+
+ // 鏍煎紡鍖栨棩鏈熶负 YYYY-MM-DD
+ const formatDate = (row, column, cellValue) => {
+ if (cellValue) {
+ const date = new Date(cellValue);
+ return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
+ 2,
+ "0"
+ )}-${String(date.getDate()).padStart(2, "0")}`;
+ }
+ return "";
};
const queryParams = reactive({
--
Gitblit v1.9.3