Merge remote-tracking branch 'origin/dev' into dev
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // é«çº§éè´ä»·æ ¼ç®¡çAPIæ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ä»·æ ¼å表 |
| | | export function getPriceList(query) { |
| | | return request({ |
| | | url: "/procurement/price/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // è·åä»·æ ¼è¯¦æ
|
| | | export function getPriceDetail(id) { |
| | | return request({ |
| | | url: `/procurement/price/detail/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢ä»·æ ¼ |
| | | export function addPrice(data) { |
| | | return request({ |
| | | url: "/procurement/price/add", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // æ´æ°ä»·æ ¼ |
| | | export function updatePrice(data) { |
| | | return request({ |
| | | url: "/procurement/price/update", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤ä»·æ ¼ |
| | | export function deletePrice(id) { |
| | | return request({ |
| | | url: `/procurement/price/delete/${id}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| | | |
| | | // æ¹éå é¤ä»·æ ¼ |
| | | export function batchDeletePrice(ids) { |
| | | return request({ |
| | | url: "/procurement/price/batchDelete", |
| | | method: "delete", |
| | | data: { ids }, |
| | | }); |
| | | } |
| | | |
| | | // å¤å¶ä»·æ ¼ |
| | | export function copyPrice(id) { |
| | | return request({ |
| | | url: `/procurement/price/copy/${id}`, |
| | | method: "post", |
| | | }); |
| | | } |
| | | |
| | | // åºç¨ä»·æ ¼ï¼å°å¾
çæç¶ææ¹ä¸ºææï¼ |
| | | export function applyPrice(id) { |
| | | return request({ |
| | | url: `/procurement/price/apply/${id}`, |
| | | method: "put", |
| | | }); |
| | | } |
| | | |
| | | // æåä»·æ ¼ |
| | | export function suspendPrice(id) { |
| | | return request({ |
| | | url: `/procurement/price/suspend/${id}`, |
| | | method: "put", |
| | | }); |
| | | } |
| | | |
| | | // æ¹éè®¾ç½®ææ£ |
| | | export function batchSetDiscount(data) { |
| | | return request({ |
| | | url: "/procurement/price/batchDiscount", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // è·åææ£é
ç½® |
| | | export function getDiscountConfig(id) { |
| | | return request({ |
| | | url: `/procurement/price/discount/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // 设置å个ååææ£ |
| | | export function setDiscount(data) { |
| | | return request({ |
| | | url: "/procurement/price/setDiscount", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // è·åé¶æ¢¯ææ£é
ç½® |
| | | export function getTieredDiscount(id) { |
| | | return request({ |
| | | url: `/procurement/price/tieredDiscount/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // è®¾ç½®é¶æ¢¯ææ£ |
| | | export function setTieredDiscount(data) { |
| | | return request({ |
| | | url: "/procurement/price/setTieredDiscount", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // è·åä»·æ ¼æ§å¶è®¾ç½® |
| | | export function getPriceControlConfig() { |
| | | return request({ |
| | | url: "/procurement/price/controlConfig", |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æ´æ°ä»·æ ¼æ§å¶è®¾ç½® |
| | | export function updatePriceControlConfig(data) { |
| | | return request({ |
| | | url: "/procurement/price/controlConfig", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // è·åä»·æ ¼é¢è¦å表 |
| | | export function getPriceWarnings(query) { |
| | | return request({ |
| | | url: "/procurement/price/warnings", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // å¤çä»·æ ¼é¢è¦ |
| | | export function handlePriceWarning(id, action) { |
| | | return request({ |
| | | url: `/procurement/price/warning/${id}`, |
| | | method: "put", |
| | | data: { action }, |
| | | }); |
| | | } |
| | | |
| | | // è·åä»·æ ¼åå²è®°å½ |
| | | export function getPriceHistory(id, query) { |
| | | return request({ |
| | | url: `/procurement/price/history/${id}`, |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // è·åä»·æ ¼ç»è®¡æ°æ® |
| | | export function getPriceStatistics(query) { |
| | | return request({ |
| | | url: "/procurement/price/statistics", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // 导åºä»·æ ¼æ°æ® |
| | | export function exportPriceData(query) { |
| | | return request({ |
| | | url: "/procurement/price/export", |
| | | method: "get", |
| | | params: query, |
| | | responseType: 'blob', |
| | | }); |
| | | } |
| | | |
| | | // 导å
¥ä»·æ ¼æ°æ® |
| | | export function importPriceData(file) { |
| | | const formData = new FormData(); |
| | | formData.append('file', file); |
| | | return request({ |
| | | url: "/procurement/price/import", |
| | | method: "post", |
| | | data: formData, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data', |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | // è·åä»·æ ¼æ¨¡æ¿ |
| | | export function downloadPriceTemplate() { |
| | | return request({ |
| | | url: "/procurement/price/template", |
| | | method: "get", |
| | | responseType: 'blob', |
| | | }); |
| | | } |
| | | |
| | | // ä»·æ ¼å®¡æ¹ |
| | | export function approvePrice(id, data) { |
| | | return request({ |
| | | url: `/procurement/price/approve/${id}`, |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ä»·æ ¼é©³å |
| | | export function rejectPrice(id, data) { |
| | | return request({ |
| | | url: `/procurement/price/reject/${id}`, |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // è·åä¾åºåå表ï¼ç¨äºä¸æéæ©ï¼ |
| | | export function getSupplierOptions() { |
| | | return request({ |
| | | url: "/procurement/price/suppliers", |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // è·åååå表ï¼ç¨äºä¸æéæ©ï¼ |
| | | export function getProductOptions(query) { |
| | | return request({ |
| | | url: "/procurement/price/products", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // è·ååå详ç»ä¿¡æ¯ |
| | | export function getProductInfo(productId) { |
| | | return request({ |
| | | url: `/procurement/price/productInfo/${productId}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // ä»·æ ¼æ¯è¾åæ |
| | | export function comparePrices(data) { |
| | | return request({ |
| | | url: "/procurement/price/compare", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // è·åä»·æ ¼è¶å¿æ°æ® |
| | | export function getPriceTrend(id, period) { |
| | | return request({ |
| | | url: `/procurement/price/trend/${id}`, |
| | | method: "get", |
| | | params: { period }, |
| | | }); |
| | | } |
| | | |
| | | // ä»·æ ¼é¢æµ |
| | | export function predictPrice(id, data) { |
| | | return request({ |
| | | url: `/procurement/price/predict/${id}`, |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // è·åå¸åºä»·æ ¼åè |
| | | export function getMarketPriceReference(productCode) { |
| | | return request({ |
| | | url: `/procurement/price/marketRef/${productCode}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // ä»·æ ¼åå¨éç¥è®¾ç½® |
| | | export function updateNotificationSettings(data) { |
| | | return request({ |
| | | url: "/procurement/price/notifications", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // è·åä»·æ ¼åå¨éç¥è®¾ç½® |
| | | export function getNotificationSettings() { |
| | | return request({ |
| | | url: "/procurement/price/notifications", |
| | | method: "get", |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // éå®å°è´¦é¡µé¢æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: "/inboundManagement/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | export function listPageCopy(query) { |
| | | return request({ |
| | | url: "/inboundManagement/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // æ°å¢ |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/inboundManagement/add", |
| | | method: "post", |
| | | data |
| | | }); |
| | | } |
| | | // ä¿®æ¹ |
| | | export function update(data) { |
| | | return request({ |
| | | url: "/inboundManagement/update", |
| | | method: "post", |
| | | data |
| | | }); |
| | | } |
| | | // å é¤éå®å°è´¦ |
| | | export function del(data) { |
| | | return request({ |
| | | url: "/inboundManagement/del", |
| | | method: "delete", |
| | | data |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢éè´è®¡åå表 |
| | | export function getProcurementPlanList(query) { |
| | | return request({ |
| | | url: "/procurement/plan/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢éè´è®¡å |
| | | export function addProcurementPlan(data) { |
| | | return request({ |
| | | url: "/procurement/plan/add", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹éè´è®¡å |
| | | export function updateProcurementPlan(data) { |
| | | return request({ |
| | | url: "/procurement/plan/update", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤éè´è®¡å |
| | | export function deleteProcurementPlan(ids) { |
| | | return request({ |
| | | url: "/procurement/plan/delete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®IDè·åéè´è®¡å详æ
|
| | | export function getProcurementPlanById(id) { |
| | | return request({ |
| | | url: `/procurement/plan/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æ§è¡éè´è®¡åè®¡ç® |
| | | export function calculateProcurementPlan(data) { |
| | | return request({ |
| | | url: "/procurement/plan/calculate", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | |
| | | // è·å产åç°æåºåä¿¡æ¯ |
| | | export function getProductExistingStock(productIds) { |
| | | return request({ |
| | | url: "/inventory/existingStock/productInfo", |
| | | method: "post", |
| | | data: productIds, |
| | | }); |
| | | } |
| | | |
| | | // è·å产åå®å
¨åºåä¿¡æ¯ |
| | | export function getProductSafetyStock(productIds) { |
| | | return request({ |
| | | url: "/inventory/safetyStock/productInfo", |
| | | method: "post", |
| | | data: productIds, |
| | | }); |
| | | } |
| | | |
| | | // è·å产åé¢è®¡åºåºä¿¡æ¯ |
| | | export function getProductExpectedOutbound(productIds) { |
| | | return request({ |
| | | url: "/inventory/expectedOutbound/productInfo", |
| | | method: "post", |
| | | data: productIds, |
| | | }); |
| | | } |
| | | |
| | | // è·å产åé¢è®¡å
¥åºä¿¡æ¯ |
| | | export function getProductExpectedInbound(productIds) { |
| | | return request({ |
| | | url: "/inventory/expectedInbound/productInfo", |
| | | method: "post", |
| | | data: productIds, |
| | | }); |
| | | } |
| | | |
| | | // 导åºéè´è®¡å |
| | | export function exportProcurementPlan(query) { |
| | | return request({ |
| | | url: "/procurement/plan/export", |
| | | method: "get", |
| | | params: query, |
| | | responseType: "blob", |
| | | }); |
| | | } |
| | | |
| | | // çæéè´è®¢å |
| | | export function generatePurchaseOrder(data) { |
| | | return request({ |
| | | url: "/procurement/plan/generateOrder", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // éªè¯è®¡ç®å
¬å¼ |
| | | export function validateFormula(formula) { |
| | | return request({ |
| | | url: "/procurement/plan/validateFormula", |
| | | method: "post", |
| | | data: { formula }, |
| | | }); |
| | | } |
| | | |
| | | // è·å计ç®å
¬å¼æ¨¡æ¿ |
| | | export function getFormulaTemplates() { |
| | | return request({ |
| | | url: "/procurement/plan/formulaTemplates", |
| | | method: "get", |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // éå®å°è´¦é¡µé¢æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: "/returnManagement/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // æ°å¢ |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/returnManagement/add", |
| | | method: "post", |
| | | data |
| | | }); |
| | | } |
| | | // ä¿®æ¹ |
| | | export function update(data) { |
| | | return request({ |
| | | url: "/returnManagement/update", |
| | | method: "post", |
| | | data |
| | | }); |
| | | } |
| | | // å é¤éå®å°è´¦ |
| | | export function del(data) { |
| | | return request({ |
| | | url: "/returnManagement/del", |
| | | method: "delete", |
| | | data |
| | | }); |
| | | } |
| | |
| | | import { getToken, setToken, removeToken } from '@/utils/auth'
|
| | | import { isHttp, isEmpty } from "@/utils/validate"
|
| | | import defAva from '@/assets/images/profile.jpg'
|
| | | import { defineStore } from 'pinia'
|
| | |
|
| | | const useUserStore = defineStore(
|
| | | 'user',
|
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog :title="operationType === 'add' ? 'æ°å¢å·¡æ£ä»»å¡' : 'ç¼è¾å·¡æ£ä»»å¡'" |
| | | v-model="dialogVisitable" width="800px" @close="cancel"> |
| | | <el-form :model="form" :rules="rules" ref="formRef" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä»»å¡åç§°" prop="taskName"> |
| | | <el-input v-model="form.taskName" placeholder="请è¾å
¥ä»»å¡åç§°" maxlength="30" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å°ç¹" prop="inspectionLocation"> |
| | | <el-input v-model="form.inspectionLocation" placeholder="请è¾å
¥å°ç¹" maxlength="30" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·¡æ£äºº" prop="inspector"> |
| | | <el-select v-model="form.inspector" placeholder="è¯·éæ©" multiple clearable> |
| | | <el-option v-for="item in userList" :label="item.nickName" :value="item.userId" :key="item.userId"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="夿³¨" prop="remarks"> |
| | | <el-input v-model="form.remarks" placeholder="请è¾å
¥å¤æ³¨" type="textarea" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä»»å¡é¢ç" prop="frequencyType"> |
| | | <el-select v-model="form.frequencyType" placeholder="è¯·éæ©" clearable> |
| | | <el-option label="æ¯æ¥" value="DAILY"/> |
| | | <el-option label="æ¯å¨" value="WEEKLY"/> |
| | | <el-option label="æ¯æ" value="MONTHLY"/> |
| | | <el-option label="å£åº¦" value="QUARTERLY"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" v-if="form.frequencyType === 'DAILY' && form.frequencyType"> |
| | | <el-form-item label="æ¥æ" prop="frequencyDetail"> |
| | | <el-time-picker v-model="form.frequencyDetail" placeholder="éæ©æ¶é´" format="HH:mm" |
| | | value-format="HH:mm" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" v-if="form.frequencyType === 'WEEKLY' && form.frequencyType"> |
| | | <el-form-item label="æ¥æ" prop="frequencyDetail"> |
| | | <el-select v-model="form.week" placeholder="è¯·éæ©" clearable style="width: 50%"> |
| | | <el-option label="å¨ä¸" value="MON"/> |
| | | <el-option label="å¨äº" value="TUE"/> |
| | | <el-option label="å¨ä¸" value="WED"/> |
| | | <el-option label="å¨å" value="THU"/> |
| | | <el-option label="å¨äº" value="FRI"/> |
| | | <el-option label="å¨å
" value="SAT"/> |
| | | <el-option label="卿¥" value="SUN"/> |
| | | </el-select> |
| | | <el-time-picker v-model="form.time" placeholder="éæ©æ¶é´" format="HH:mm" |
| | | value-format="HH:mm" style="width: 50%"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" v-if="form.frequencyType === 'MONTHLY' && form.frequencyType"> |
| | | <el-form-item label="æ¥æ" prop="frequencyDetail"> |
| | | <el-date-picker |
| | | v-model="form.frequencyDetail" |
| | | type="datetime" |
| | | clearable |
| | | placeholder="éæ©å¼å§æ¥æ" |
| | | format="DD,HH:mm" |
| | | value-format="DD,HH:mm" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" v-if="form.frequencyType === 'QUARTERLY' && form.frequencyType"> |
| | | <el-form-item label="æ¥æ" prop="frequencyDetail"> |
| | | <el-date-picker |
| | | v-model="form.frequencyDetail" |
| | | type="datetime" |
| | | clearable |
| | | placeholder="éæ©å¼å§æ¥æ" |
| | | format="MM,DD,HH:mm" |
| | | value-format="MM,DD,HH:mm" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="cancel">åæ¶</el-button> |
| | | <el-button type="primary" @click="submitForm">ä¿å</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {reactive, ref} from "vue"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import {addOrEditTimingTask} from "@/api/inspectionManagement/index.js"; |
| | | import {userListAll} from "@/api/publicApi/index.js"; |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | const emit = defineEmits() |
| | | const userStore = useUserStore() |
| | | const dialogVisitable = ref(false); |
| | | const operationType = ref('add'); |
| | | const data = reactive({ |
| | | form: { |
| | | taskName: '', |
| | | inspectionLocation: '', |
| | | inspector: '', |
| | | inspectorIds: '', |
| | | remarks: '', |
| | | frequencyType: '', |
| | | frequencyDetail: '', |
| | | }, |
| | | rules: { |
| | | taskName: [{ required: true, message: "请è¾å
¥ä»»å¡åç§°", trigger: "blur" },], |
| | | inspectionLocation: [{ required: true, message: "请è¾å
¥å°ç¹", trigger: "blur" },], |
| | | inspector: [{ required: true, message: "请è¾å
¥å·¡æ£äºº", trigger: "blur" },], |
| | | } |
| | | }) |
| | | const { form, rules } = toRefs(data) |
| | | const userList = ref([]) |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openDialog = async (type, row) => { |
| | | dialogVisitable.value = true |
| | | userListAll().then(res => { |
| | | userList.value = res.data |
| | | }) |
| | | if (type === 'edit') { |
| | | form.value = {...row} |
| | | form.value.inspector = form.value.inspectorIds.split(',').map(Number) |
| | | } |
| | | } |
| | | |
| | | // å
³éå并表å |
| | | const cancel = () => { |
| | | proxy.resetForm("formRef") |
| | | dialogVisitable.value = false |
| | | emit('closeDia') |
| | | } |
| | | |
| | | // æäº¤å并表å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(async valid => { |
| | | if (valid) { |
| | | form.value.inspectorIds = form.value.inspector.join(',') |
| | | delete form.value.inspector |
| | | if (form.value.frequencyType === 'WEEKLY') { |
| | | let frequencyDetail = '' |
| | | frequencyDetail = form.value.week + ',' + form.value.time |
| | | form.value.frequencyDetail = frequencyDetail |
| | | } |
| | | let res = await userStore.getInfo() |
| | | form.value.registrantId = res.user.userId |
| | | addOrEditTimingTask(form.value).then(() => { |
| | | cancel() |
| | | proxy.$modal.msgSuccess('æäº¤æå') |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | defineExpose({ openDialog }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog :title="operationType === 'add' ? 'æ°å¢äºç»´ç ' : 'ç¼è¾äºç»´ç '" |
| | | v-model="dialogVisitable" width="500px" @close="cancel"> |
| | | <el-form :model="form" :rules="rules" ref="formRef" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="设å¤åç§°" prop="deviceName"> |
| | | <el-input v-model="form.deviceName" placeholder="请è¾å
¥è®¾å¤åç§°" maxlength="30" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="æå¨ä½ç½®æè¿°" prop="location"> |
| | | <el-input v-model="form.location" placeholder="请è¾å
¥æå¨ä½ç½®æè¿°" maxlength="30"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <div> |
| | | <el-button type="primary" @click="submitForm">çæå¹¶æå°äºç»´ç </el-button> |
| | | </div> |
| | | <div v-if="isShowQrCode" class="print-section" ref="qrCodeContainer" id="qrCodeContainer"> |
| | | <vue-qrcode :value="qrCodeValue" :width="qrCodeSize"></vue-qrcode> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import {reactive, ref} from "vue"; |
| | | import printJS from 'print-js'; |
| | | import {addOrEditQrCode} from "@/api/inspectionUpload/index.js"; |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | const emit = defineEmits() |
| | | const userStore = useUserStore() |
| | | const dialogVisitable = ref(false); |
| | | const isShowQrCode = ref(false); |
| | | const operationType = ref('add'); |
| | | |
| | | const qrCodeValue = ref(''); |
| | | const qrCodeSize = ref(100); |
| | | const data = reactive({ |
| | | form: { |
| | | deviceName: '', |
| | | location: '', |
| | | qrCodeId: '', |
| | | id: '' |
| | | }, |
| | | rules: { |
| | | deviceName: [{ required: true, message: '请è¾å
¥è®¾å¤åç§°', trigger: 'blur' }], |
| | | location: [{ required: true, message: '请è¾å
¥å°ç¹', trigger: 'blur' }] |
| | | } |
| | | }) |
| | | const { form, rules } = toRefs(data) |
| | | |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openDialog = async (type, row) => { |
| | | dialogVisitable.value = true |
| | | qrCodeValue.value = '' |
| | | isShowQrCode.value = false; |
| | | if (type === 'edit') { |
| | | form.value.id = row.id |
| | | form.value.qrCodeId = row.id |
| | | form.value.deviceName = row.deviceName |
| | | form.value.location = row.location |
| | | // å°è¡¨åæ°æ®è½¬ä¸º JSON å符串ä½ä¸ºäºç»´ç å
容 |
| | | qrCodeValue.value = JSON.stringify(form.value); |
| | | isShowQrCode.value = true; |
| | | } |
| | | } |
| | | // æäº¤å并表å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | addOrEditQrCode(form.value).then((res) => { |
| | | form.value.qrCodeId = res.data |
| | | }) |
| | | // å°è¡¨åæ°æ®è½¬ä¸º JSON å符串ä½ä¸ºäºç»´ç å
容 |
| | | qrCodeValue.value = JSON.stringify(form.value); |
| | | isShowQrCode.value = true; |
| | | showQrCode() |
| | | } |
| | | }) |
| | | } |
| | | const showQrCode = () => { |
| | | // å»¶è¿æ§è¡æå°ï¼é¿å
DOM æ´æ°åå°±è°ç¨æå° |
| | | setTimeout(() => { |
| | | printJS({ |
| | | printable: 'qrCodeContainer',//é¡µé¢ |
| | | type: "html",//ææ¡£ç±»å |
| | | maxWidth: 360, |
| | | style: `@page { |
| | | margin:0; |
| | | size: 400px 75px collapse; |
| | | margin-top:3px; |
| | | &:first-of-type{ |
| | | margin-top:0 !important; |
| | | } |
| | | } |
| | | html{ |
| | | zoom:100%; |
| | | } |
| | | @media print{ |
| | | width: 400px; |
| | | height: 75px; |
| | | margin:0; |
| | | }`, |
| | | targetStyles: ["*"], // 使ç¨domçæææ ·å¼ï¼å¾éè¦ |
| | | font_size: '0.20cm', |
| | | }); |
| | | }, 300); |
| | | } |
| | | // å
³éå并表å |
| | | const cancel = () => { |
| | | proxy.resetForm("formRef") |
| | | dialogVisitable.value = false |
| | | emit('closeDia') |
| | | } |
| | | defineExpose({ openDialog }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .print-section { |
| | | text-align: center; |
| | | margin-top: 30px; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog title="æ¥çéä»¶" |
| | | v-model="dialogVisitable" width="800px" @close="cancel"> |
| | | <div class="upload-container"> |
| | | <!-- ç产å --> |
| | | <div class="form-container"> |
| | | <div class="title">ç产å</div> |
| | | |
| | | <!-- å¾çå表 --> |
| | | <div style="display: flex; flex-wrap: wrap;"> |
| | | <img v-for="(item, index) in beforeProductionImgs" :key="index" |
| | | @click="showMedia(beforeProductionImgs, index, 'image')" |
| | | :src="item" style="max-width: 100px; height: 100px; margin: 5px;" alt=""> |
| | | </div> |
| | | |
| | | <!-- è§é¢å表 --> |
| | | <div style="display: flex; flex-wrap: wrap;"> |
| | | <div |
| | | v-for="(videoUrl, index) in beforeProductionVideos" |
| | | :key="index" |
| | | @click="showMedia(beforeProductionVideos, index, 'video')" |
| | | style="position: relative; margin: 10px; cursor: pointer;" |
| | | > |
| | | <div style="width: 160px; height: 90px; background-color: #333; display: flex; align-items: center; justify-content: center;"> |
| | | <img src="@/assets/images/video.png" alt="ææ¾" style="width: 30px; height: 30px; opacity: 0.8;" /> |
| | | </div> |
| | | <div style="text-align: center; font-size: 12px; color: #666;">ç¹å»ææ¾</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- ç产å --> |
| | | <div class="form-container"> |
| | | <div class="title">ç产å</div> |
| | | |
| | | <!-- å¾çå表 --> |
| | | <div style="display: flex; flex-wrap: wrap;"> |
| | | <img v-for="(item, index) in afterProductionImgs" :key="index" |
| | | @click="showMedia(afterProductionImgs, index, 'image')" |
| | | :src="item" style="max-width: 100px; height: 100px; margin: 5px;" alt=""> |
| | | </div> |
| | | |
| | | <!-- è§é¢å表 --> |
| | | <div style="display: flex; flex-wrap: wrap;"> |
| | | <div |
| | | v-for="(videoUrl, index) in afterProductionVideos" |
| | | :key="index" |
| | | @click="showMedia(afterProductionVideos, index, 'video')" |
| | | style="position: relative; margin: 10px; cursor: pointer;" |
| | | > |
| | | <div style="width: 160px; height: 90px; background-color: #333; display: flex; align-items: center; justify-content: center;"> |
| | | <img src="@/assets/images/video.png" alt="ææ¾" style="width: 30px; height: 30px; opacity: 0.8;" /> |
| | | </div> |
| | | <div style="text-align: center; font-size: 12px; color: #666;">ç¹å»ææ¾</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- ç产é®é¢ --> |
| | | <div class="form-container"> |
| | | <div class="title">ç产é®é¢</div> |
| | | |
| | | <!-- å¾çå表 --> |
| | | <div style="display: flex; flex-wrap: wrap;"> |
| | | <img v-for="(item, index) in productionIssuesImgs" :key="index" |
| | | @click="showMedia(productionIssuesImgs, index, 'image')" |
| | | :src="item" style="max-width: 100px; height: 100px; margin: 5px;" alt=""> |
| | | </div> |
| | | |
| | | <!-- è§é¢å表 --> |
| | | <div style="display: flex; flex-wrap: wrap;"> |
| | | <div |
| | | v-for="(videoUrl, index) in productionIssuesVideos" |
| | | :key="index" |
| | | @click="showMedia(productionIssuesVideos, index, 'video')" |
| | | style="position: relative; margin: 10px; cursor: pointer;" |
| | | > |
| | | <div style="width: 160px; height: 90px; background-color: #333; display: flex; align-items: center; justify-content: center;"> |
| | | <img src="@/assets/images/video.png" alt="ææ¾" style="width: 30px; height: 30px; opacity: 0.8;" /> |
| | | </div> |
| | | <div style="text-align: center; font-size: 12px; color: #666;">ç¹å»ææ¾</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- ç»ä¸åªä½æ¥çå¨ --> |
| | | <div v-if="isMediaViewerVisible" class="media-viewer-overlay" @click.self="closeMediaViewer"> |
| | | <div class="media-viewer-content" @click.stop> |
| | | <!-- å¾ç --> |
| | | <vue-easy-lightbox |
| | | v-if="mediaType === 'image'" |
| | | :visible="isMediaViewerVisible" |
| | | :imgs="mediaList" |
| | | :index="currentMediaIndex" |
| | | @hide="closeMediaViewer" |
| | | ></vue-easy-lightbox> |
| | | |
| | | <!-- è§é¢ --> |
| | | <div v-else-if="mediaType === 'video'" style="position: relative;"> |
| | | <Video |
| | | :src="mediaList[currentMediaIndex]" |
| | | autoplay |
| | | controls |
| | | style="max-width: 90vw; max-height: 80vh;" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script setup> |
| | | import { ref } from 'vue'; |
| | | import VueEasyLightbox from 'vue-easy-lightbox'; |
| | | |
| | | // æ§å¶å¼¹çªæ¾ç¤º |
| | | const dialogVisitable = ref(false); |
| | | |
| | | // å¾çæ°ç» |
| | | const beforeProductionImgs = ref([]); |
| | | const afterProductionImgs = ref([]); |
| | | const productionIssuesImgs = ref([]); |
| | | |
| | | // è§é¢æ°ç» |
| | | const beforeProductionVideos = ref([]); |
| | | const afterProductionVideos = ref([]); |
| | | const productionIssuesVideos = ref([]); |
| | | |
| | | // åªä½æ¥çå¨ç¶æ |
| | | const isMediaViewerVisible = ref(false); |
| | | const currentMediaIndex = ref(0); |
| | | const mediaList = ref([]); // åå¨å½åè¦æ¥ççåªä½å表ï¼å«å¾çåè§é¢å¯¹è±¡ï¼ |
| | | const mediaType = ref('image'); // image | video |
| | | |
| | | // å¤çæ¯ä¸ç±»æ°æ®ï¼å离å¾çåè§é¢ |
| | | function processItems(items) { |
| | | const images = []; |
| | | const videos = []; |
| | | items.forEach(item => { |
| | | if (item.contentType?.startsWith('image/')) { |
| | | images.push(item.url); |
| | | } else if (item.contentType?.startsWith('video/')) { |
| | | videos.push(item.url); |
| | | } |
| | | }); |
| | | return { images, videos }; |
| | | } |
| | | |
| | | // æå¼å¼¹çªå¹¶å è½½æ°æ® |
| | | const openDialog = async (row) => { |
| | | const { images: beforeImgs, videos: beforeVids } = processItems(row.beforeProduction); |
| | | const { images: afterImgs, videos: afterVids } = processItems(row.afterProduction); |
| | | const { images: issueImgs, videos: issueVids } = processItems(row.productionIssues); |
| | | |
| | | beforeProductionImgs.value = beforeImgs; |
| | | beforeProductionVideos.value = beforeVids; |
| | | |
| | | afterProductionImgs.value = afterImgs; |
| | | afterProductionVideos.value = afterVids; |
| | | |
| | | productionIssuesImgs.value = issueImgs; |
| | | productionIssuesVideos.value = issueVids; |
| | | |
| | | dialogVisitable.value = true; |
| | | }; |
| | | |
| | | // æ¾ç¤ºåªä½ï¼å¾ç or è§é¢ï¼ |
| | | function showMedia(mediaArray, index, type) { |
| | | mediaList.value = mediaArray; |
| | | currentMediaIndex.value = index; |
| | | mediaType.value = type; |
| | | isMediaViewerVisible.value = true; |
| | | } |
| | | |
| | | // å
³éåªä½æ¥çå¨ |
| | | function closeMediaViewer() { |
| | | isMediaViewerVisible.value = false; |
| | | mediaList.value = []; |
| | | mediaType.value = 'image'; |
| | | } |
| | | |
| | | // 表åå
³éæ¹æ³ |
| | | const cancel = () => { |
| | | dialogVisitable.value = false; |
| | | }; |
| | | |
| | | defineExpose({ openDialog }); |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | .upload-container { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | padding: 20px; |
| | | border: 1px solid #dcdfe6; |
| | | box-sizing: border-box; |
| | | |
| | | .form-container { |
| | | flex: 1; |
| | | width: 100%; |
| | | margin-bottom: 20px; |
| | | } |
| | | } |
| | | |
| | | .title { |
| | | font-size: 14px; |
| | | color: #165dff; |
| | | line-height: 20px; |
| | | font-weight: 600; |
| | | padding-left: 10px; |
| | | position: relative; |
| | | margin: 6px 0; |
| | | |
| | | &::before { |
| | | content: ""; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 3px; |
| | | width: 4px; |
| | | height: 14px; |
| | | background-color: #165dff; |
| | | } |
| | | } |
| | | |
| | | .media-viewer-overlay { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | background-color: rgba(0, 0, 0, 0.8); |
| | | z-index: 9999; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .media-viewer-content { |
| | | position: relative; |
| | | max-width: 90vw; |
| | | max-height: 90vh; |
| | | overflow: hidden; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog title="æ¥çéä»¶" |
| | | v-model="dialogVisitable" width="800px" @close="cancel"> |
| | | <div class="upload-container"> |
| | | <div class="form-container"> |
| | | <div class="title">å·¡æ£éä»¶</div> |
| | | <!-- å¾çå表 --> |
| | | <div style="display: flex; flex-wrap: wrap;"> |
| | | <img v-for="(item, index) in beforeProductionImgs" :key="index" |
| | | @click="showMedia(beforeProductionImgs, index, 'image')" |
| | | :src="item" style="max-width: 100px; height: 100px; margin: 5px;" alt=""> |
| | | </div> |
| | | |
| | | <!-- è§é¢å表 --> |
| | | <div style="display: flex; flex-wrap: wrap;"> |
| | | <div |
| | | v-for="(videoUrl, index) in beforeProductionVideos" |
| | | :key="index" |
| | | @click="showMedia(beforeProductionVideos, index, 'video')" |
| | | style="position: relative; margin: 10px; cursor: pointer;" |
| | | > |
| | | <div style="width: 160px; height: 90px; background-color: #333; display: flex; align-items: center; justify-content: center;"> |
| | | <img src="@/assets/images/video.png" alt="ææ¾" style="width: 30px; height: 30px; opacity: 0.8;" /> |
| | | </div> |
| | | <div style="text-align: center; font-size: 12px; color: #666;">ç¹å»ææ¾</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </el-dialog> |
| | | <!-- ç»ä¸åªä½æ¥çå¨ --> |
| | | <div v-if="isMediaViewerVisible" class="media-viewer-overlay" @click.self="closeMediaViewer"> |
| | | <div class="media-viewer-content" @click.stop> |
| | | <!-- å¾ç --> |
| | | <vue-easy-lightbox |
| | | v-if="mediaType === 'image'" |
| | | :visible="isMediaViewerVisible" |
| | | :imgs="mediaList" |
| | | :index="currentMediaIndex" |
| | | @hide="closeMediaViewer" |
| | | ></vue-easy-lightbox> |
| | | |
| | | <!-- è§é¢ --> |
| | | <div v-else-if="mediaType === 'video'" style="position: relative;"> |
| | | <Video |
| | | :src="mediaList[currentMediaIndex]" |
| | | autoplay |
| | | controls |
| | | style="max-width: 90vw; max-height: 80vh;" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | // æ§å¶å¼¹çªæ¾ç¤º |
| | | import VueEasyLightbox from "vue-easy-lightbox"; |
| | | |
| | | const dialogVisitable = ref(false); |
| | | // å¾çæ°ç» |
| | | const beforeProductionImgs = ref([]); |
| | | // è§é¢æ°ç» |
| | | const beforeProductionVideos = ref([]); |
| | | // åªä½æ¥çå¨ç¶æ |
| | | const isMediaViewerVisible = ref(false); |
| | | const currentMediaIndex = ref(0); |
| | | const mediaList = ref([]); // åå¨å½åè¦æ¥ççåªä½å表ï¼å«å¾çåè§é¢å¯¹è±¡ï¼ |
| | | const mediaType = ref('image'); // image | video |
| | | |
| | | // æå¼å¼¹çªå¹¶å è½½æ°æ® |
| | | const openDialog = async (row) => { |
| | | const { images: beforeImgs, videos: beforeVids } = processItems(row.storageBlobDTO); |
| | | |
| | | beforeProductionImgs.value = beforeImgs; |
| | | beforeProductionVideos.value = beforeVids; |
| | | dialogVisitable.value = true; |
| | | }; |
| | | // æ¾ç¤ºåªä½ï¼å¾ç or è§é¢ï¼ |
| | | function showMedia(mediaArray, index, type) { |
| | | mediaList.value = mediaArray; |
| | | currentMediaIndex.value = index; |
| | | mediaType.value = type; |
| | | isMediaViewerVisible.value = true; |
| | | } |
| | | // å
³éåªä½æ¥çå¨ |
| | | function closeMediaViewer() { |
| | | isMediaViewerVisible.value = false; |
| | | mediaList.value = []; |
| | | mediaType.value = 'image'; |
| | | } |
| | | // 表åå
³éæ¹æ³ |
| | | const cancel = () => { |
| | | dialogVisitable.value = false; |
| | | }; |
| | | // å¤çæ¯ä¸ç±»æ°æ®ï¼å离å¾çåè§é¢ |
| | | function processItems(items) { |
| | | const images = []; |
| | | const videos = []; |
| | | items.forEach(item => { |
| | | if (item.contentType?.startsWith('image/')) { |
| | | images.push(item.url); |
| | | } else if (item.contentType?.startsWith('video/')) { |
| | | videos.push(item.url); |
| | | } |
| | | }); |
| | | return { images, videos }; |
| | | } |
| | | defineExpose({ openDialog }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .upload-container { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | padding: 20px; |
| | | border: 1px solid #dcdfe6; |
| | | box-sizing: border-box; |
| | | |
| | | .form-container { |
| | | flex: 1; |
| | | width: 100%; |
| | | margin-bottom: 20px; |
| | | } |
| | | } |
| | | |
| | | .title { |
| | | font-size: 14px; |
| | | color: #165dff; |
| | | line-height: 20px; |
| | | font-weight: 600; |
| | | padding-left: 10px; |
| | | position: relative; |
| | | margin: 6px 0; |
| | | |
| | | &::before { |
| | | content: ""; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 3px; |
| | | width: 4px; |
| | | height: 14px; |
| | | background-color: #165dff; |
| | | } |
| | | } |
| | | |
| | | .media-viewer-overlay { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | background-color: rgba(0, 0, 0, 0.8); |
| | | z-index: 9999; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .media-viewer-content { |
| | | position: relative; |
| | | max-width: 90vw; |
| | | max-height: 90vh; |
| | | overflow: hidden; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :inline="true" :model="queryParams" class="search-form"> |
| | | <el-form-item label="æç´¢"> |
| | | <el-input |
| | | v-model="queryParams.searchAll" |
| | | placeholder="请è¾å
¥å
³é®å" |
| | | clearable |
| | | :style="{ width: '100%' }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery">æ¥è¯¢</el-button> |
| | | <el-button @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-card> |
| | | <!-- æ ç¾é¡µ --> |
| | | <el-tabs |
| | | v-model="activeTab" |
| | | class="info-tabs" |
| | | @tab-click="handleTabClick" |
| | | > |
| | | <el-tab-pane |
| | | v-for="tab in tabs" |
| | | :key="tab.name" |
| | | :label="tab.label" |
| | | :name="tab.name" |
| | | /> |
| | | </el-tabs> |
| | | <div style="display: flex;flex-direction: row;justify-content: space-between;" v-if="tabName === 'task'"> |
| | | <el-radio-group v-model="activeRadio" @change="radioChange"> |
| | | <el-radio-button v-for="tab in radios" |
| | | :key="tab.name" |
| | | :label="tab.label" |
| | | :value="tab.name"/> |
| | | </el-radio-group> |
| | | <!-- æä½æé®åº --> |
| | | <el-space v-if="activeRadio !== 'task'"> |
| | | <el-button type="primary" :icon="Plus" @click="handleAdd(undefined)">æ°å»º</el-button> |
| | | <el-button type="danger" :icon="Delete" @click="handleDelete">å é¤</el-button> |
| | | <!-- <el-button type="info" plain :icon="Download">导åº</el-button> --> |
| | | </el-space> |
| | | </div> |
| | | <div> |
| | | <div> |
| | | <ETable :loading="tableLoading" |
| | | :table-data="tableData" |
| | | :columns="tableColumns" |
| | | @selection-change="handleSelectionChange" |
| | | :show-selection="true" |
| | | :border="true" |
| | | style="width: 100%;height: calc(100vh - 30em)" |
| | | operationsWidth="130" |
| | | :operations="operationsArr" |
| | | @edit="handleAdd" |
| | | @viewFile="viewFile" |
| | | v-if="tabName === 'task'" |
| | | > |
| | | <template #inspector="{ row }"> |
| | | <div class="person-tags"> |
| | | <!-- è°è¯ä¿¡æ¯ï¼ä¸çº¿æ¶å é¤ --> |
| | | <!-- {{ console.log('inspector data:', row.inspector) }} --> |
| | | <template v-if="row.inspector && row.inspector.length > 0"> |
| | | <el-tag |
| | | v-for="(person, index) in row.inspector" |
| | | :key="index" |
| | | size="small" |
| | | type="primary" |
| | | class="person-tag" |
| | | > |
| | | {{ person }} |
| | | </el-tag> |
| | | </template> |
| | | <span v-else class="no-data">--</span> |
| | | </div> |
| | | </template> |
| | | </ETable> |
| | | <el-table ref="table" :data="tableData" height="480" v-loading="tableLoading" border v-else style="width: 100%;height: calc(100vh - 25em)"> |
| | | <el-table-column label="åºå·" type="index" width="60" align="center" /> |
| | | <el-table-column prop="deviceName" label="设å¤åç§°" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | {{scope.row.qrCode.deviceName}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="location" label="æå¨ä½ç½®æè¿°" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | {{scope.row.qrCode.location}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="scanner" label="å·¡æ£äºº"></el-table-column> |
| | | <el-table-column prop="scanTime" label="å·¡æ£æ¶é´"></el-table-column> |
| | | <el-table-column fixed="right" label="æä½"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="handleAdd(scope.row)">æ¥çéä»¶</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <pagination |
| | | v-if="total>0" |
| | | :page="pageNum" |
| | | :limit="pageSize" |
| | | :total="total" |
| | | @pagination="handlePagination" |
| | | :layout="'total, prev, pager, next, jumper'" |
| | | /> |
| | | </div> |
| | | </el-card> |
| | | <form-dia ref="formDia" @closeDia="handleQuery"></form-dia> |
| | | <qr-code-dia ref="qrCodeDia" @closeDia="handleQuery"></qr-code-dia> |
| | | <view-files ref="viewFiles"></view-files> |
| | | <view-qr-code-files ref="viewQrCodeFiles"></view-qr-code-files> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { Delete, Plus } from "@element-plus/icons-vue"; |
| | | import { onMounted, ref, reactive, getCurrentInstance, nextTick } from "vue"; |
| | | |
| | | // ç»ä»¶å¼å
¥ |
| | | import Pagination from "@/components/Pagination/index.vue"; |
| | | import ETable from "@/components/Table/ETable.vue"; |
| | | import FormDia from "@/views/inspectionManagement/components/formDia.vue"; |
| | | import QrCodeDia from "@/views/inspectionManagement/components/qrCodeDia.vue"; |
| | | import ViewFiles from "@/views/inspectionManagement/components/viewFiles.vue"; |
| | | import ViewQrCodeFiles from "@/views/inspectionManagement/components/viewQrCodeFiles.vue"; |
| | | |
| | | // æ¥å£å¼å
¥ |
| | | import { |
| | | delTimingTask, |
| | | inspectionTaskList, |
| | | timingTaskList |
| | | } from "@/api/inspectionManagement/index.js"; |
| | | import { |
| | | delQrCode, |
| | | qrCodeList, |
| | | qrCodeScanRecordList |
| | | } from "@/api/inspectionUpload/index.js"; |
| | | |
| | | // å
¨å±åé |
| | | const { proxy } = getCurrentInstance(); |
| | | const formDia = ref(); |
| | | const qrCodeDia = ref(); |
| | | const viewFiles = ref(); |
| | | const viewQrCodeFiles = ref(); |
| | | |
| | | // æ¥è¯¢åæ° |
| | | const queryParams = reactive({ |
| | | searchAll: "", |
| | | }); |
| | | |
| | | // æ ç¾é¡µé
ç½® |
| | | const activeTab = ref("task"); |
| | | const tabName = ref("task"); |
| | | const tabs = reactive([ |
| | | { name: "task", label: "ç产巡æ£" }, |
| | | { name: "qrCodeScanRecord", label: "ç°åºå·¡æ£è®°å½" }, |
| | | ]); |
| | | |
| | | // åéæ¡é
ç½® |
| | | const activeRadio = ref("taskManage"); |
| | | const radios = reactive([ |
| | | { name: "taskManage", label: "宿¶ä»»å¡ç®¡ç" }, |
| | | { name: "task", label: "宿¶ä»»å¡è®°å½" }, |
| | | { name: "qrCode", label: "äºç»´ç 管ç" }, |
| | | ]); |
| | | |
| | | // è¡¨æ ¼æ°æ® |
| | | const selectedRows = ref([]); |
| | | const tableData = ref([]); |
| | | const operationsArr = ref([]); |
| | | const tableColumns = ref([]); |
| | | const tableLoading = ref(false); |
| | | const total = ref(0); |
| | | const pageNum = ref(1); |
| | | const pageSize = ref(10); |
| | | |
| | | // åé
ç½® |
| | | const columns = ref([ |
| | | { prop: "taskName", label: "å·¡æ£ä»»å¡åç§°", minWidth: 160 }, |
| | | { prop: "inspectionLocation", label: "å°ç¹", minWidth: 120 }, |
| | | { prop: "remarks", label: "夿³¨", minWidth: 150 }, |
| | | { prop: "inspector", label: "æ§è¡å·¡æ£äºº", minWidth: 150, slot: "inspector" }, |
| | | { |
| | | prop: "frequencyType", |
| | | label: "颿¬¡", |
| | | minWidth: 150, |
| | | formatter: (_, __, val) => ({ |
| | | DAILY: "æ¯æ¥", |
| | | WEEKLY: "æ¯å¨", |
| | | MONTHLY: "æ¯æ", |
| | | QUARTERLY: "å£åº¦" |
| | | }[val] || "") |
| | | }, |
| | | { |
| | | prop: "frequencyDetail", |
| | | label: "å¼å§æ¥æä¸æ¶é´", |
| | | minWidth: 150, |
| | | formatter: (row, column, cellValue) => { |
| | | // å
夿æ¯å¦æ¯å符串 |
| | | if (typeof cellValue !== 'string') return ''; |
| | | let val = cellValue; |
| | | const replacements = { |
| | | MON: 'å¨ä¸', |
| | | TUE: 'å¨äº', |
| | | WED: 'å¨ä¸', |
| | | THU: 'å¨å', |
| | | FRI: 'å¨äº', |
| | | SAT: 'å¨å
', |
| | | SUN: '卿¥' |
| | | }; |
| | | // ä½¿ç¨æ£å䏿¬¡æ§æ¿æ¢ææå¹é
项 |
| | | return val.replace(/MON|TUE|WED|THU|FRI|SAT|SUN/g, match => replacements[match]); |
| | | } |
| | | }, |
| | | { prop: "registrant", label: "ç»è®°äºº", minWidth: 100 }, |
| | | { prop: "createTime", label: "ç»è®°æ¥æ", minWidth: 100 }, |
| | | ]); |
| | | |
| | | const columns1 = ref([ |
| | | { prop: "deviceName", label: "设å¤åç§°", minWidth: 160 }, |
| | | { prop: "location", label: "æå¨ä½ç½®æè¿°", minWidth: 120 }, |
| | | { prop: "createBy", label: "å建è
", minWidth: 100 }, |
| | | { prop: "createTime", label: "å建æ¶é´", minWidth: 100 }, |
| | | ]); |
| | | |
| | | onMounted(() => { |
| | | radioChange('taskManage'); |
| | | }); |
| | | |
| | | // æ ç¾é¡µç¹å»äºä»¶ |
| | | const handleTabClick = (tab) => { |
| | | tabName.value = tab.props.name; |
| | | tableData.value = []; |
| | | getList(); |
| | | }; |
| | | |
| | | // åéåå |
| | | const radioChange = (value) => { |
| | | if (value === "taskManage") { |
| | | tableColumns.value = columns.value; |
| | | operationsArr.value = ['edit']; |
| | | } else if (value === "task") { |
| | | tableColumns.value = columns.value; |
| | | operationsArr.value = ['viewFile']; |
| | | } else { |
| | | tableColumns.value = columns1.value; |
| | | operationsArr.value = ['edit']; |
| | | } |
| | | pageNum.value = 1; |
| | | pageSize.value = 10; |
| | | getList(); |
| | | }; |
| | | |
| | | // æ¥è¯¢æä½ |
| | | const handleQuery = () => { |
| | | pageNum.value = 1; |
| | | pageSize.value = 10; |
| | | getList(); |
| | | }; |
| | | // å页å¤ç |
| | | const handlePagination = (val) => { |
| | | pageNum.value = val.page; |
| | | pageSize.value = val.limit; |
| | | getList(); |
| | | }; |
| | | // è·ååè¡¨æ°æ® |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | |
| | | const params = { ...queryParams, size: pageSize.value, current: pageNum.value }; |
| | | |
| | | let apiCall; |
| | | if (tabName.value === 'task') { |
| | | switch (activeRadio.value) { |
| | | case "task": |
| | | apiCall = inspectionTaskList(params); |
| | | break; |
| | | case "qrCode": |
| | | apiCall = qrCodeList(params); |
| | | break; |
| | | default: |
| | | apiCall = timingTaskList(params); |
| | | } |
| | | } else { |
| | | apiCall = qrCodeScanRecordList(params); |
| | | } |
| | | |
| | | apiCall.then(res => { |
| | | const rawData = res.data.records || []; |
| | | // å¤ç inspector åæ®µï¼å°å符串转æ¢ä¸ºæ°ç»ï¼éç¨äºæææ
åµï¼ |
| | | tableData.value = rawData.map(item => { |
| | | const processedItem = { ...item }; |
| | | |
| | | // å¤ç inspector åæ®µ |
| | | if (processedItem.inspector) { |
| | | if (typeof processedItem.inspector === 'string') { |
| | | // å符串æéå·åå² |
| | | processedItem.inspector = processedItem.inspector.split(',').map(s => s.trim()).filter(s => s); |
| | | } else if (!Array.isArray(processedItem.inspector)) { |
| | | // éæ°ç»è½¬ä¸ºæ°ç» |
| | | processedItem.inspector = [processedItem.inspector]; |
| | | } |
| | | } else { |
| | | // 空å¼è®¾ä¸ºç©ºæ°ç» |
| | | processedItem.inspector = []; |
| | | } |
| | | |
| | | return processedItem; |
| | | }); |
| | | total.value = res.data.total || 0; |
| | | }).finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // éç½®æ¥è¯¢ |
| | | const resetQuery = () => { |
| | | for (const key in queryParams) { |
| | | if (!["pageNum", "pageSize"].includes(key)) { |
| | | queryParams[key] = ""; |
| | | } |
| | | } |
| | | handleQuery(); |
| | | }; |
| | | |
| | | // æ°å¢ / ç¼è¾ |
| | | const handleAdd = (row) => { |
| | | const type = row ? 'edit' : 'add'; |
| | | nextTick(() => { |
| | | if (tabName.value === 'task') { |
| | | if (activeRadio.value === "taskManage") { |
| | | formDia.value?.openDialog(type, row); |
| | | } else if (activeRadio.value === "qrCode") { |
| | | qrCodeDia.value?.openDialog(type, row); |
| | | } |
| | | } else { |
| | | viewQrCodeFiles.value?.openDialog(row); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // æ¥çéä»¶ |
| | | const viewFile = (row) => { |
| | | nextTick(() => { |
| | | viewFiles.value?.openDialog(row); |
| | | }); |
| | | }; |
| | | |
| | | // å é¤æä½ |
| | | const handleDelete = () => { |
| | | if (!selectedRows.value.length) { |
| | | proxy.$modal.msgWarning("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | return; |
| | | } |
| | | |
| | | const deleteIds = selectedRows.value.map(item => item.id); |
| | | const api = activeRadio.value === "taskManage" ? delTimingTask : delQrCode; |
| | | |
| | | proxy.$modal.confirm('æ¯å¦ç¡®è®¤å 餿鿰æ®é¡¹ï¼').then(() => { |
| | | return api(deleteIds); |
| | | }).then(() => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | handleQuery(); |
| | | }).catch(() => {}); |
| | | }; |
| | | |
| | | // å¤éåæ´ |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .person-tags { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 4px; |
| | | } |
| | | |
| | | .person-tag { |
| | | margin-right: 4px; |
| | | margin-bottom: 2px; |
| | | } |
| | | |
| | | .no-data { |
| | | color: #909399; |
| | | font-size: 14px; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- æç´¢åºå --> |
| | | <el-card class="search-card" shadow="never"> |
| | | <el-form :model="searchForm" :inline="true" label-width="100px"> |
| | | <el-form-item label="åååç§°ï¼"> |
| | | <el-input v-model="searchForm.productName" placeholder="请è¾å
¥åååç§°" clearable style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="ä¾åºåï¼"> |
| | | <el-select v-model="searchForm.supplierId" placeholder="è¯·éæ©ä¾åºå" clearable style="width: 200px"> |
| | | <el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.name" :value="supplier.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ä»·æ ¼ç¶æï¼"> |
| | | <el-select v-model="searchForm.priceStatus" placeholder="è¯·éæ©ç¶æ" clearable style="width: 150px"> |
| | | <el-option label="ææ" value="active" /> |
| | | <el-option label="å¾
çæ" value="pending" /> |
| | | <el-option label="å·²è¿æ" value="expired" /> |
| | | <el-option label="å·²æå" value="suspended" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch" :loading="loading"> |
| | | <el-icon><Search /></el-icon> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button @click="resetSearch"> |
| | | <el-icon><Refresh /></el-icon> |
| | | éç½® |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <!-- åè½æé®åºå --> |
| | | <el-card class="action-card" shadow="never"> |
| | | <div class="action-buttons"> |
| | | <el-button type="primary" @click="openDialog('add')"> |
| | | <el-icon><Plus /></el-icon> |
| | | æ°å¢ä»·æ ¼ |
| | | </el-button> |
| | | <el-button type="success" @click="openBatchDiscountDialog"> |
| | | <el-icon><Discount /></el-icon> |
| | | æ¹éææ£ |
| | | </el-button> |
| | | <el-button type="warning" @click="openPriceControlDialog"> |
| | | <el-icon><Setting /></el-icon> |
| | | ä»·æ ¼æ§å¶ |
| | | </el-button> |
| | | <el-button type="info" @click="exportData"> |
| | | <el-icon><Download /></el-icon> |
| | | å¯¼åºæ°æ® |
| | | </el-button> |
| | | <el-button type="danger" @click="handleBatchDelete" :disabled="selectedRows.length === 0"> |
| | | <el-icon><Delete /></el-icon> |
| | | æ¹éå é¤ |
| | | </el-button> |
| | | </div> |
| | | </el-card> |
| | | |
| | | |
| | | <!-- ä¸»è¡¨æ ¼ --> |
| | | <el-card class="table-card" shadow="never"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="loading" |
| | | @selection-change="handleSelectionChange" |
| | | :default-sort="{ prop: 'updateTime', order: 'descending' }" |
| | | > |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="ååä¿¡æ¯" min-width="200"> |
| | | <template #default="{ row }"> |
| | | <div class="product-info"> |
| | | <div class="product-name">{{ row.productName }}</div> |
| | | <div class="product-spec">{{ row.specification }}</div> |
| | | <div class="product-code">ç¼ç : {{ row.productCode }}</div> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ä¾åºå" prop="supplierName" width="150" /> |
| | | <el-table-column label="åºç¡ä»·æ ¼" width="120" align="right"> |
| | | <template #default="{ row }"> |
| | | <span class="price-text">Â¥{{ row.basePrice.toFixed(2) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ææ£ä¿¡æ¯" width="150"> |
| | | <template #default="{ row }"> |
| | | <div v-if="row.discountType"> |
| | | <el-tag :type="getDiscountTagType(row.discountType)" size="small"> |
| | | {{ getDiscountText(row.discountType) }} |
| | | </el-tag> |
| | | <div class="discount-value">{{ row.discountValue }}{{ row.discountType === 'percentage' ? '%' : 'å
' }}</div> |
| | | </div> |
| | | <span v-else class="no-discount">æ ææ£</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å®é
ä»·æ ¼" width="120" align="right"> |
| | | <template #default="{ row }"> |
| | | <span class="final-price">Â¥{{ calculateFinalPrice(row).toFixed(2) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ä»·æ ¼æ§å¶" width="120"> |
| | | <template #default="{ row }"> |
| | | <div class="price-control"> |
| | | <div v-if="row.priceControl?.minPrice" class="control-item"> |
| | | æä½: Â¥{{ row.priceControl.minPrice.toFixed(2) }} |
| | | </div> |
| | | <div v-if="row.priceControl?.maxPrice" class="control-item"> |
| | | æé«: Â¥{{ row.priceControl.maxPrice.toFixed(2) }} |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç¶æ" width="100" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag> |
| | | <div v-if="isPriceWarning(row)" class="warning-indicator"> |
| | | <el-icon color="#F56C6C"><Warning /></el-icon> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="çææ¶é´" prop="effectiveTime" width="180" /> |
| | | <el-table-column label="æ´æ°æ¶é´" prop="updateTime" width="180" sortable /> |
| | | <el-table-column label="æä½" width="250" align="center" fixed="right"> |
| | | <template #default="{ row }"> |
| | | <el-button type="primary" link @click="openDialog('edit', row)"> |
| | | <el-icon><Edit /></el-icon> |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button type="success" link @click="openDiscountDialog(row)"> |
| | | <el-icon><Discount /></el-icon> |
| | | ææ£ |
| | | </el-button> |
| | | <el-button type="danger" link @click="handleDelete(row)"> |
| | | <el-icon><Delete /></el-icon> |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- å页 --> |
| | | <div class="pagination-wrapper"> |
| | | <el-pagination |
| | | v-model:current-page="pagination.currentPage" |
| | | v-model:page-size="pagination.pageSize" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | :total="pagination.total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | </el-card> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="dialogVisible" :title="dialogType === 'add' ? 'æ°å¢ä»·æ ¼' : 'ç¼è¾ä»·æ ¼'" width="800px"> |
| | | <el-form :model="formData" :rules="formRules" ref="formRef" label-width="120px"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åååç§°" prop="productName"> |
| | | <el-select v-model="formData.productName" placeholder="è¯·éæ©åå" style="width: 100%" filterable> |
| | | <el-option v-for="product in productList" :key="product.id" :label="product.name" :value="product.name" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ååç¼ç " prop="productCode"> |
| | | <el-input v-model="formData.productCode" placeholder="请è¾å
¥ååç¼ç " /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è§æ ¼åå·" prop="specification"> |
| | | <el-input v-model="formData.specification" placeholder="请è¾å
¥è§æ ¼åå·" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¾åºå" prop="supplierName"> |
| | | <el-select v-model="formData.supplierName" placeholder="è¯·éæ©ä¾åºå" style="width: 100%"> |
| | | <el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.name" :value="supplier.name" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åºç¡ä»·æ ¼" prop="basePrice"> |
| | | <el-input-number v-model="formData.basePrice" :min="0" :precision="2" placeholder="请è¾å
¥åºç¡ä»·æ ¼" style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åä½"> |
| | | <el-input v-model="formData.unit" placeholder="请è¾å
¥åä½" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- ææ£è®¾ç½® --> |
| | | <el-divider content-position="left">ææ£è®¾ç½®</el-divider> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="ææ£ç±»å"> |
| | | <el-select v-model="formData.discountType" placeholder="è¯·éæ©ææ£ç±»å" style="width: 100%"> |
| | | <el-option label="æ ææ£" value="" /> |
| | | <el-option label="ç¾åæ¯ææ£" value="percentage" /> |
| | | <el-option label="åºå®éé¢" value="fixed" /> |
| | | <el-option label="é¶æ¢¯ææ£" value="tiered" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="ææ£å¼" v-if="formData.discountType && formData.discountType !== 'tiered'"> |
| | | <el-input-number |
| | | v-model="formData.discountValue" |
| | | :min="0" |
| | | :max="formData.discountType === 'percentage' ? 100 : undefined" |
| | | :precision="2" |
| | | placeholder="请è¾å
¥ææ£å¼" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="ææ£æææ"> |
| | | <el-date-picker |
| | | v-model="formData.discountEndTime" |
| | | type="datetime" |
| | | placeholder="éæ©ç»ææ¶é´" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- é¶æ¢¯ææ£è®¾ç½® --> |
| | | <div v-if="formData.discountType === 'tiered'"> |
| | | <el-form-item label="é¶æ¢¯ææ£"> |
| | | <el-table :data="formData.tieredDiscount" border size="small"> |
| | | <el-table-column label="æå°æ°é" width="120"> |
| | | <template #default="{ row, $index }"> |
| | | <el-input-number v-model="row.minQty" :min="0" size="small" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æå¤§æ°é" width="120"> |
| | | <template #default="{ row, $index }"> |
| | | <el-input-number v-model="row.maxQty" :min="0" size="small" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ææ£ç(%)" width="120"> |
| | | <template #default="{ row, $index }"> |
| | | <el-input-number v-model="row.discount" :min="0" :max="100" :precision="2" size="small" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="80"> |
| | | <template #default="{ row, $index }"> |
| | | <el-button type="danger" link @click="removeTieredRow($index)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-button type="primary" link @click="addTieredRow" class="mt-2">æ·»å é¶æ¢¯</el-button> |
| | | </el-form-item> |
| | | </div> |
| | | |
| | | <!-- ä»·æ ¼æ§å¶ --> |
| | | <el-divider content-position="left">ä»·æ ¼æ§å¶</el-divider> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="æä½ä»·æ ¼"> |
| | | <el-input-number v-model="formData.minPrice" :min="0" :precision="2" placeholder="æä½ä»·æ ¼" style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="æé«ä»·æ ¼"> |
| | | <el-input-number v-model="formData.maxPrice" :min="0" :precision="2" placeholder="æé«ä»·æ ¼" style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="é¢è¦éå¼(%)"> |
| | | <el-input-number v-model="formData.warningThreshold" :min="0" :max="100" :precision="1" placeholder="é¢è¦éå¼" style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="çææ¶é´" prop="effectiveTime"> |
| | | <el-date-picker v-model="formData.effectiveTime" type="datetime" placeholder="éæ©çææ¶é´" style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¤±ææ¶é´"> |
| | | <el-date-picker v-model="formData.expireTime" type="datetime" placeholder="éæ©å¤±ææ¶é´" style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-form-item label="è°ä»·åå " prop="reason"> |
| | | <el-select v-model="formData.reason" placeholder="è¯·éæ©è°ä»·åå " style="width: 100%"> |
| | | <el-option label="å¸åºä»·æ ¼åå¨" value="market" /> |
| | | <el-option label="ææ¬åå" value="cost" /> |
| | | <el-option label="ä¾åºåè°æ´" value="supplier" /> |
| | | <el-option label="å£èæ§è°æ´" value="seasonal" /> |
| | | <el-option label="ä¿éæ´»å¨" value="promotion" /> |
| | | <el-option label="å
¶ä»åå " value="other" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="夿³¨"> |
| | | <el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="请è¾å
¥å¤æ³¨ä¿¡æ¯" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button @click="dialogVisible = false">åæ¶</el-button> |
| | | <el-button type="primary" @click="handleSubmit" :loading="submitLoading">ç¡®å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- æ¹éææ£å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="batchDiscountVisible" title="æ¹éè®¾ç½®ææ£" width="600px"> |
| | | <el-form :model="batchDiscountForm" label-width="120px"> |
| | | <el-form-item label="ææ£ç±»å"> |
| | | <el-select v-model="batchDiscountForm.discountType" placeholder="è¯·éæ©ææ£ç±»å" style="width: 100%"> |
| | | <el-option label="ç¾åæ¯ææ£" value="percentage" /> |
| | | <el-option label="åºå®éé¢" value="fixed" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ææ£å¼"> |
| | | <el-input-number |
| | | v-model="batchDiscountForm.discountValue" |
| | | :min="0" |
| | | :max="batchDiscountForm.discountType === 'percentage' ? 100 : undefined" |
| | | :precision="2" |
| | | placeholder="请è¾å
¥ææ£å¼" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="çææ¶é´"> |
| | | <el-date-picker v-model="batchDiscountForm.effectiveTime" type="datetime" placeholder="éæ©çææ¶é´" style="width: 100%" /> |
| | | </el-form-item> |
| | | <el-form-item label="å¤±ææ¶é´"> |
| | | <el-date-picker v-model="batchDiscountForm.expireTime" type="datetime" placeholder="éæ©å¤±ææ¶é´" style="width: 100%" /> |
| | | </el-form-item> |
| | | <el-form-item label="éç¨åå"> |
| | | <div class="selected-items"> |
| | | 已鿩 {{ selectedRows.length }} 个åå |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button @click="batchDiscountVisible = false">åæ¶</el-button> |
| | | <el-button type="primary" @click="handleBatchDiscount">ç¡®å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- ä»·æ ¼æ§å¶å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="priceControlVisible" title="ä»·æ ¼æ§å¶è®¾ç½®" width="700px"> |
| | | <el-form :model="priceControlForm" label-width="120px"> |
| | | <el-form-item label="é»è®¤æä½ä»·æ ¼"> |
| | | <el-input-number v-model="priceControlForm.defaultMinPrice" :min="0" :precision="2" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="é»è®¤æé«ä»·æ ¼"> |
| | | <el-input-number v-model="priceControlForm.defaultMaxPrice" :min="0" :precision="2" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="ä»·æ ¼åå¨éå¼"> |
| | | <el-input-number v-model="priceControlForm.changeThreshold" :min="0" :max="100" :precision="1" style="width: 200px" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button @click="priceControlVisible = false">åæ¶</el-button> |
| | | <el-button type="primary" @click="handlePriceControl">ä¿å设置</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed, onMounted } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { |
| | | Search, Refresh, Plus, Discount, Setting, Download, Delete, Edit, |
| | | Warning |
| | | } from '@element-plus/icons-vue' |
| | | |
| | | // ååºå¼æ°æ® |
| | | const loading = ref(false) |
| | | const submitLoading = ref(false) |
| | | const dialogVisible = ref(false) |
| | | const batchDiscountVisible = ref(false) |
| | | const priceControlVisible = ref(false) |
| | | const dialogType = ref('add') |
| | | const selectedRows = ref([]) |
| | | const formRef = ref() |
| | | |
| | | // æç´¢è¡¨å |
| | | const searchForm = reactive({ |
| | | productName: '', |
| | | supplierId: '', |
| | | priceStatus: '' |
| | | }) |
| | | |
| | | // å页 |
| | | const pagination = reactive({ |
| | | currentPage: 1, |
| | | pageSize: 20, |
| | | total: 0 |
| | | }) |
| | | |
| | | |
| | | // è¡¨åæ°æ® |
| | | const formData = reactive({ |
| | | productName: '', |
| | | productCode: '', |
| | | specification: '', |
| | | supplierName: '', |
| | | basePrice: 0, |
| | | unit: '', |
| | | discountType: '', |
| | | discountValue: 0, |
| | | discountEndTime: '', |
| | | tieredDiscount: [], |
| | | minPrice: null, |
| | | maxPrice: null, |
| | | warningThreshold: 10, |
| | | effectiveTime: '', |
| | | expireTime: '', |
| | | reason: '', |
| | | remark: '' |
| | | }) |
| | | |
| | | // æ¹éææ£è¡¨å |
| | | const batchDiscountForm = reactive({ |
| | | discountType: 'percentage', |
| | | discountValue: 0, |
| | | effectiveTime: '', |
| | | expireTime: '' |
| | | }) |
| | | |
| | | // ä»·æ ¼æ§å¶è¡¨å |
| | | const priceControlForm = reactive({ |
| | | defaultMinPrice: 0, |
| | | defaultMaxPrice: 0, |
| | | changeThreshold: 10, |
| | | }) |
| | | |
| | | // 表åéªè¯è§å |
| | | const formRules = { |
| | | productName: [{ required: true, message: 'è¯·éæ©åååç§°', trigger: 'change' }], |
| | | productCode: [{ required: true, message: '请è¾å
¥ååç¼ç ', trigger: 'blur' }], |
| | | supplierName: [{ required: true, message: 'è¯·éæ©ä¾åºå', trigger: 'change' }], |
| | | basePrice: [{ required: true, message: '请è¾å
¥åºç¡ä»·æ ¼', trigger: 'blur' }], |
| | | effectiveTime: [{ required: true, message: 'è¯·éæ©çææ¶é´', trigger: 'change' }], |
| | | reason: [{ required: true, message: 'è¯·éæ©è°ä»·åå ', trigger: 'change' }] |
| | | } |
| | | |
| | | // æ¨¡ææ°æ® |
| | | const tableData = ref([ |
| | | { |
| | | id: 1, |
| | | productName: 'é«å¼ºåº¦èºæ ', |
| | | productCode: 'HQ001', |
| | | specification: 'M12Ã80', |
| | | supplierName: 'ä¼è´¨äºéä¾åºå', |
| | | basePrice: 2.50, |
| | | discountType: 'percentage', |
| | | discountValue: 10, |
| | | priceControl: { minPrice: 2.00, maxPrice: 3.00 }, |
| | | status: 'active', |
| | | effectiveTime: '2025-01-01 00:00:00', |
| | | updateTime: '2025-09-17 10:30:00', |
| | | unit: '个', |
| | | reason: 'market', |
| | | remark: 'å¸åºä»·æ ¼è°æ´' |
| | | }, |
| | | { |
| | | id: 2, |
| | | productName: 'ä¸éé¢ç®¡', |
| | | productCode: 'BXG002', |
| | | specification: 'Φ25Ã2.0', |
| | | supplierName: 'é¢æè´¸æå
¬å¸', |
| | | basePrice: 45.80, |
| | | discountType: 'fixed', |
| | | discountValue: 5, |
| | | priceControl: { minPrice: 40.00, maxPrice: 50.00 }, |
| | | status: 'pending', |
| | | effectiveTime: '2025-10-01 00:00:00', |
| | | updateTime: '2025-09-16 14:20:00', |
| | | unit: 'ç±³', |
| | | reason: 'cost', |
| | | remark: 'åææææ¬ä¸æ¶¨' |
| | | } |
| | | ]) |
| | | |
| | | const supplierList = ref([ |
| | | { id: 1, name: 'ä¼è´¨äºéä¾åºå' }, |
| | | { id: 2, name: 'é¢æè´¸æå
¬å¸' }, |
| | | { id: 3, name: 'å»ºææ¹åå' } |
| | | ]) |
| | | |
| | | const productList = ref([ |
| | | { id: 1, name: 'é«å¼ºåº¦èºæ ' }, |
| | | { id: 2, name: 'ä¸éé¢ç®¡' }, |
| | | { id: 3, name: 'éåéåæ' } |
| | | ]) |
| | | |
| | | |
| | | // 计ç®å±æ§ |
| | | const finalTableData = computed(() => { |
| | | return tableData.value.filter(item => { |
| | | if (searchForm.productName && !item.productName.includes(searchForm.productName)) return false |
| | | if (searchForm.supplierId && item.supplierId !== searchForm.supplierId) return false |
| | | if (searchForm.priceStatus && item.status !== searchForm.priceStatus) return false |
| | | |
| | | return true |
| | | }) |
| | | }) |
| | | |
| | | // æ¹æ³ |
| | | const calculateFinalPrice = (row) => { |
| | | let finalPrice = row.basePrice |
| | | if (row.discountType === 'percentage') { |
| | | finalPrice = row.basePrice * (1 - row.discountValue / 100) |
| | | } else if (row.discountType === 'fixed') { |
| | | finalPrice = row.basePrice - row.discountValue |
| | | } |
| | | return Math.max(finalPrice, 0) |
| | | } |
| | | |
| | | const getDiscountTagType = (discountType) => { |
| | | const typeMap = { |
| | | percentage: 'success', |
| | | fixed: 'warning', |
| | | tiered: 'info' |
| | | } |
| | | return typeMap[discountType] || 'info' |
| | | } |
| | | |
| | | const getDiscountText = (discountType) => { |
| | | const textMap = { |
| | | percentage: 'ç¾åæ¯', |
| | | fixed: 'åºå®éé¢', |
| | | tiered: 'é¶æ¢¯ææ£' |
| | | } |
| | | return textMap[discountType] || 'æªç¥' |
| | | } |
| | | |
| | | const getStatusType = (status) => { |
| | | const statusMap = { |
| | | active: 'success', |
| | | pending: 'warning', |
| | | expired: 'info', |
| | | suspended: 'danger' |
| | | } |
| | | return statusMap[status] || 'info' |
| | | } |
| | | |
| | | const getStatusText = (status) => { |
| | | const statusMap = { |
| | | active: 'ææ', |
| | | pending: 'å¾
çæ', |
| | | expired: 'å·²è¿æ', |
| | | suspended: 'å·²æå' |
| | | } |
| | | return statusMap[status] || 'æªç¥' |
| | | } |
| | | |
| | | const isPriceWarning = (row) => { |
| | | if (!row.priceControl) return false |
| | | const finalPrice = calculateFinalPrice(row) |
| | | return finalPrice < row.priceControl.minPrice || finalPrice > row.priceControl.maxPrice |
| | | } |
| | | |
| | | |
| | | const handleSearch = () => { |
| | | loading.value = true |
| | | // 模æAPIè°ç¨ |
| | | setTimeout(() => { |
| | | loading.value = false |
| | | }, 500) |
| | | } |
| | | |
| | | const resetSearch = () => { |
| | | Object.assign(searchForm, { |
| | | productName: '', |
| | | supplierId: '', |
| | | priceStatus: '' |
| | | }) |
| | | handleSearch() |
| | | } |
| | | |
| | | |
| | | const openDialog = (type, row = {}) => { |
| | | dialogType.value = type |
| | | if (type === 'edit' && row.id) { |
| | | Object.assign(formData, { |
| | | ...row, |
| | | minPrice: row.priceControl?.minPrice, |
| | | maxPrice: row.priceControl?.maxPrice, |
| | | tieredDiscount: row.tieredDiscount || [] |
| | | }) |
| | | } else { |
| | | resetFormData() |
| | | } |
| | | dialogVisible.value = true |
| | | } |
| | | |
| | | const resetFormData = () => { |
| | | Object.assign(formData, { |
| | | productName: '', |
| | | productCode: '', |
| | | specification: '', |
| | | supplierName: '', |
| | | basePrice: 0, |
| | | unit: '', |
| | | discountType: '', |
| | | discountValue: 0, |
| | | discountEndTime: '', |
| | | tieredDiscount: [], |
| | | minPrice: null, |
| | | maxPrice: null, |
| | | warningThreshold: 10, |
| | | effectiveTime: '', |
| | | expireTime: '', |
| | | reason: '', |
| | | remark: '' |
| | | }) |
| | | } |
| | | |
| | | const addTieredRow = () => { |
| | | formData.tieredDiscount.push({ |
| | | minQty: 0, |
| | | maxQty: 0, |
| | | discount: 0 |
| | | }) |
| | | } |
| | | |
| | | const removeTieredRow = (index) => { |
| | | formData.tieredDiscount.splice(index, 1) |
| | | } |
| | | |
| | | const handleSubmit = async () => { |
| | | if (!formRef.value) return |
| | | |
| | | try { |
| | | await formRef.value.validate() |
| | | submitLoading.value = true |
| | | |
| | | // 模æAPIè°ç¨ |
| | | setTimeout(() => { |
| | | if (dialogType.value === 'add') { |
| | | const newItem = { |
| | | id: Date.now(), |
| | | ...formData, |
| | | priceControl: { |
| | | minPrice: formData.minPrice, |
| | | maxPrice: formData.maxPrice |
| | | }, |
| | | status: 'pending', |
| | | updateTime: new Date().toLocaleString() |
| | | } |
| | | tableData.value.unshift(newItem) |
| | | ElMessage.success('æ°å¢æå') |
| | | } else { |
| | | // ç¼è¾é»è¾ |
| | | ElMessage.success('ç¼è¾æå') |
| | | } |
| | | |
| | | dialogVisible.value = false |
| | | submitLoading.value = false |
| | | }, 1000) |
| | | } catch (error) { |
| | | console.error('表åéªè¯å¤±è´¥:', error) |
| | | } |
| | | } |
| | | |
| | | const openBatchDiscountDialog = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | ElMessage.warning('请å
éæ©è¦è®¾ç½®ææ£çåå') |
| | | return |
| | | } |
| | | batchDiscountVisible.value = true |
| | | } |
| | | |
| | | const handleBatchDiscount = () => { |
| | | // æ¹éè®¾ç½®ææ£é»è¾ |
| | | selectedRows.value.forEach(row => { |
| | | row.discountType = batchDiscountForm.discountType |
| | | row.discountValue = batchDiscountForm.discountValue |
| | | }) |
| | | |
| | | ElMessage.success(`已为 ${selectedRows.value.length} 个ååè®¾ç½®ææ£`) |
| | | batchDiscountVisible.value = false |
| | | } |
| | | |
| | | const openPriceControlDialog = () => { |
| | | priceControlVisible.value = true |
| | | } |
| | | |
| | | const handlePriceControl = () => { |
| | | ElMessage.success('ä»·æ ¼æ§å¶è®¾ç½®å·²ä¿å') |
| | | priceControlVisible.value = false |
| | | } |
| | | |
| | | const openDiscountDialog = (row) => { |
| | | // å个ååææ£è®¾ç½® |
| | | openDialog('edit', row) |
| | | } |
| | | |
| | | |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm('ç¡®å®è¦å é¤è¿æ¡è®°å½åï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id) |
| | | if (index !== -1) { |
| | | tableData.value.splice(index, 1) |
| | | ElMessage.success('å 餿å') |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleBatchDelete = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | ElMessage.warning('请å
éæ©è¦å é¤çè®°å½') |
| | | return |
| | | } |
| | | |
| | | ElMessageBox.confirm(`ç¡®å®è¦å é¤éä¸ç ${selectedRows.value.length} æ¡è®°å½åï¼`, 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | selectedRows.value.forEach(row => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id) |
| | | if (index !== -1) { |
| | | tableData.value.splice(index, 1) |
| | | } |
| | | }) |
| | | ElMessage.success('æ¹éå 餿å') |
| | | selectedRows.value = [] |
| | | }) |
| | | } |
| | | |
| | | const handleSelectionChange = (rows) => { |
| | | selectedRows.value = rows |
| | | } |
| | | |
| | | const handleSizeChange = (size) => { |
| | | pagination.pageSize = size |
| | | handleSearch() |
| | | } |
| | | |
| | | const handleCurrentChange = (page) => { |
| | | pagination.currentPage = page |
| | | handleSearch() |
| | | } |
| | | |
| | | const exportData = () => { |
| | | ElMessage.success('æ°æ®å¯¼åºåè½å¼åä¸...') |
| | | } |
| | | |
| | | // çå½å¨æ |
| | | onMounted(() => { |
| | | handleSearch() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .app-container { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .search-card, .action-card, .table-card { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .action-buttons { |
| | | display: flex; |
| | | gap: 10px; |
| | | flex-wrap: wrap; |
| | | } |
| | | |
| | | |
| | | .product-info { |
| | | line-height: 1.4; |
| | | } |
| | | |
| | | .product-name { |
| | | font-weight: bold; |
| | | color: #303133; |
| | | } |
| | | |
| | | .product-spec, .product-code { |
| | | font-size: 12px; |
| | | color: #909399; |
| | | } |
| | | |
| | | .price-text { |
| | | font-weight: bold; |
| | | color: #409EFF; |
| | | } |
| | | |
| | | .final-price { |
| | | font-weight: bold; |
| | | color: #67C23A; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | .discount-value { |
| | | font-size: 12px; |
| | | color: #E6A23C; |
| | | margin-top: 2px; |
| | | } |
| | | |
| | | .no-discount { |
| | | color: #C0C4CC; |
| | | font-size: 12px; |
| | | } |
| | | |
| | | .price-control { |
| | | font-size: 12px; |
| | | line-height: 1.3; |
| | | } |
| | | |
| | | .control-item { |
| | | color: #909399; |
| | | } |
| | | |
| | | .warning-indicator { |
| | | margin-top: 2px; |
| | | } |
| | | |
| | | .pagination-wrapper { |
| | | display: flex; |
| | | justify-content: end; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .selected-items { |
| | | color: #409EFF; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | |
| | | .mt-2 { |
| | | margin-top: 8px; |
| | | } |
| | | |
| | | .ml-2 { |
| | | margin-left: 8px; |
| | | } |
| | | |
| | | :deep(.el-table) { |
| | | font-size: 13px; |
| | | } |
| | | |
| | | :deep(.el-table th) { |
| | | background-color: #fafafa; |
| | | } |
| | | |
| | | :deep(.el-card__body) { |
| | | padding: 15px; |
| | | } |
| | | |
| | | :deep(.el-divider__text) { |
| | | font-weight: bold; |
| | | color: #409EFF; |
| | | } |
| | | </style> |
| | |
| | | <el-card class="table-card" shadow="never"> |
| | | <div class="table-header"> |
| | | <el-button type="primary" @click="openDialog('add')">æ°å¢å°è´§</el-button> |
| | | <el-button type="success" @click="handleBatchReceive">æ¹éæ¶è´§</el-button> |
| | | <el-button type="danger" @click="handleBatchDelete">æ¹éå é¤</el-button> |
| | | </div> |
| | | |
| | |
| | | <el-table-column label="æä½" width="200" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-button type="primary" link @click="openDialog('edit', row)">ç¼è¾</el-button> |
| | | <el-button type="success" link @click="handleReceive(row)">æ¶è´§</el-button> |
| | | <el-button type="success" v-if="row.status === 'pending'" link @click="handleReceive(row)">æ¶è´§</el-button> |
| | | <el-button type="danger" link @click="handleDelete(row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- å页 --> |
| | | <pagination |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="pagination.current" |
| | | :limit="pagination.size" |
| | | @pagination="handleCurrentChange" |
| | | /> |
| | | </el-card> |
| | | |
| | | <el-dialog v-model="dialogVisible" :title="dialogType === 'add' ? 'æ°å¢å°è´§' : 'ç¼è¾å°è´§'" width="600px"> |
| | | <el-form :model="formData" label-width="120px"> |
| | | <el-form-item label="å°è´§åå·"> |
| | | <el-input v-model="formData.arrivalNo" placeholder="å°è´§åå·" /> |
| | | </el-form-item> |
| | | <el-form-item label="éè´è®¢åå·"> |
| | | <el-select v-model="formData.orderNo" placeholder="è¯·éæ©éè´è®¢å" style="width: 100%"> |
| | | <el-option label="PO20241201001" value="PO20241201001" /> |
| | | <el-option label="PO20241201002" value="PO20241201002" /> |
| | | </el-select> |
| | | <el-input v-model="formData.orderNo" placeholder="éè´è®¢åå·" /> |
| | | </el-form-item> |
| | | <el-form-item label="ä¾åºååç§°"> |
| | | <el-input v-model="formData.supplierName" placeholder="ä¾åºååç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="å°è´§æ°é"> |
| | | <el-input-number :min="0" v-model="formData.arrivalQuantity" placeholder="å°è´§æ°é" /> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨"> |
| | | <el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="请è¾å
¥å¤æ³¨ä¿¡æ¯" /> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive } from 'vue' |
| | | import { ref, reactive,onMounted } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import {listPage,add,update,del} from "@/api/procurementManagement/arrivalManagement.js" |
| | | import Pagination from '@/components/PIMTable/Pagination.vue' |
| | | |
| | | onMounted(() => { |
| | | getList() |
| | | }) |
| | | |
| | | const tableData = ref([]) |
| | | |
| | | const getList = () => { |
| | | loading.value = true |
| | | listPage({...searchForm,...pagination}).then(res =>{ |
| | | if(res.code === 200){ |
| | | tableData.value = res.data.records |
| | | total.value = res.data.total |
| | | loading.value = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const pagination = reactive({ |
| | | current: 1, |
| | | size: 10 |
| | | }) |
| | | |
| | | const total = ref(0) |
| | | |
| | | const handleCurrentChange = (val) => { |
| | | pagination.current = val.page |
| | | pagination.size = val.limit |
| | | getList() |
| | | } |
| | | |
| | | const loading = ref(false) |
| | | const dialogVisible = ref(false) |
| | |
| | | }) |
| | | |
| | | const formData = reactive({ |
| | | arrivalNo: '', |
| | | arrivalQuantity: 0, |
| | | orderNo: '', |
| | | supplierName: '', |
| | | remark: '' |
| | | remark: '', |
| | | status: 'pending' |
| | | }) |
| | | |
| | | const mockData = [ |
| | | { |
| | | id: 1, |
| | | arrivalNo: 'AR20241201001', |
| | | orderNo: 'PO20241201001', |
| | | supplierName: 'ä¾åºåA', |
| | | status: 'received', |
| | | arrivalQuantity: 250, |
| | | arrivalTime: '2025-12-01 15:30:00', |
| | | remark: 'æ£å¸¸å°è´§' |
| | | } |
| | | ] |
| | | |
| | | const tableData = ref([...mockData]) |
| | | |
| | | const getStatusType = (status) => { |
| | | const statusMap = { pending: 'warning', received: 'success', stored: 'info' } |
| | |
| | | |
| | | const handleSearch = () => { |
| | | loading.value = true |
| | | setTimeout(() => { loading.value = false }, 500) |
| | | getList() |
| | | } |
| | | |
| | | const resetSearch = () => { |
| | |
| | | const openDialog = (type, row = {}) => { |
| | | dialogType.value = type |
| | | if (type === 'edit' && row.id) { |
| | | Object.assign(formData, { orderNo: row.orderNo, supplierName: row.supplierName, remark: row.remark }) |
| | | obj.id = row.id |
| | | Object.assign(formData, { orderNo: row.orderNo, supplierName: row.supplierName, remark: row.remark, arrivalQuantity: row.arrivalQuantity,arrivalNo: row.arrivalNo }) |
| | | } else { |
| | | Object.assign(formData, { orderNo: '', supplierName: '', remark: '' }) |
| | | Object.assign(formData, { orderNo: '', supplierName: '', remark: '',arrivalQuantity: 0,arrivalNo: '' }) |
| | | } |
| | | dialogVisible.value = true |
| | | } |
| | | |
| | | const obj = reactive({ |
| | | id:'' |
| | | }) |
| | | |
| | | const handleSubmit = () => { |
| | | if (dialogType.value === 'add') { |
| | | const newArrival = { |
| | | id: Date.now(), |
| | | arrivalNo: `AR${Date.now()}`, |
| | | orderNo: formData.orderNo, |
| | | supplierName: formData.supplierName, |
| | | status: 'pending', |
| | | arrivalQuantity: 0, |
| | | arrivalTime: new Date().toLocaleString(), |
| | | remark: formData.remark |
| | | } |
| | | tableData.value.unshift(newArrival) |
| | | ElMessage.success('æ°å¢æå') |
| | | add(formData).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('æ°å¢æå') |
| | | getList() |
| | | } |
| | | }) |
| | | }else{ |
| | | update({...formData, ...obj}).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('ç¼è¾æå') |
| | | getList() |
| | | } |
| | | }) |
| | | } |
| | | dialogVisible.value = false |
| | | } |
| | | |
| | | const handleReceive = (row) => { |
| | | row.status = 'received' |
| | | ElMessage.success('æ¶è´§æå') |
| | | update(row).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('æ¶è´§æå') |
| | | getList() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleDelete = (row) => { |
| | |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id) |
| | | if (index !== -1) { |
| | | tableData.value.splice(index, 1) |
| | | ElMessage.success('å 餿å') |
| | | } |
| | | let ids = [row.id] |
| | | del(ids).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('å 餿å') |
| | | getList() |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | const handleBatchReceive = () => { |
| | | ElMessage.success('æ¹éæ¶è´§æå') |
| | | } |
| | | |
| | | const handleBatchDelete = () => { |
| | | ElMessage.success('æ¹éå 餿å') |
| | | ElMessageBox.confirm('ç¡®å®è¦å é¤éä¸çè®°å½åï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | let ids = selectedRows.value.map(item => item.id) |
| | | del(ids).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('å 餿å') |
| | | getList() |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | const handleSelectionChange = (rows) => { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- æç´¢åºå --> |
| | | <el-card class="search-card" shadow="never"> |
| | | <el-form :model="searchForm" :inline="true" class="search-form"> |
| | | <el-form-item label="计ååç§°"> |
| | | <el-input v-model="searchForm.planName" placeholder="请è¾å
¥è®¡ååç§°" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ"> |
| | | <el-select v-model="searchForm.status" placeholder="è¯·éæ©ç¶æ" clearable style="width: 150px"> |
| | | <el-option label="å¯ç¨" value="active" /> |
| | | <el-option label="ç¦ç¨" value="inactive" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch"> |
| | | <el-icon><Search /></el-icon> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button @click="handleReset"> |
| | | <el-icon><Refresh /></el-icon> |
| | | éç½® |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <!-- æä½æé® --> |
| | | <el-card class="table-card" shadow="never"> |
| | | <div class="table-header"> |
| | | <div class="table-title">éè´è®¡åå表</div> |
| | | <div class="table-actions"> |
| | | <el-button type="primary" @click="handleAdd"> |
| | | <el-icon><Plus /></el-icon> |
| | | æ°å¢è®¡å |
| | | </el-button> |
| | | <el-button type="info" @click="handleExport"> |
| | | <el-icon><Download /></el-icon> |
| | | å¯¼åº |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- æ°æ®è¡¨æ ¼ --> |
| | | <el-table |
| | | v-loading="loading" |
| | | :data="tableData" |
| | | stripe |
| | | border |
| | | style="width: 100%" |
| | | > |
| | | <el-table-column prop="planName" label="计ååç§°" min-width="150" /> |
| | | <el-table-column prop="description" label="æè¿°" min-width="200" show-overflow-tooltip /> |
| | | <el-table-column prop="formula" label="计ç®å
¬å¼" min-width="200" show-overflow-tooltip> |
| | | <template #default="{ row }"> |
| | | <el-tag type="info" size="small">{{ row.formula }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="status" label="ç¶æ" width="80" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="row.status === 'active' ? 'success' : 'info'" size="small"> |
| | | {{ row.status === 'active' ? 'å¯ç¨' : 'ç¦ç¨' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="lastCalculateTime" label="æåè®¡ç®æ¶é´" width="160" /> |
| | | <el-table-column label="æä½" width="200" fixed="right" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-button type="primary" link @click="handleEdit(row)">ç¼è¾</el-button> |
| | | <el-button type="success" link @click="handleCalculate(row)">计ç®</el-button> |
| | | <el-button type="danger" link @click="handleDelete(row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- å页 --> |
| | | <div class="pagination-container"> |
| | | <el-pagination |
| | | v-model:current-page="pagination.current" |
| | | v-model:page-size="pagination.size" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | :total="pagination.total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | </el-card> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¯¹è¯æ¡ --> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | :title="dialogType === 'add' ? 'æ°å¢éè´è®¡å' : 'ç¼è¾éè´è®¡å'" |
| | | width="1000px" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <div class="form-container"> |
| | | <!-- åºæ¬ä¿¡æ¯ --> |
| | | <div class="form-section"> |
| | | <div class="section-title">åºæ¬ä¿¡æ¯</div> |
| | | <el-form |
| | | ref="formRef" |
| | | :model="formData" |
| | | :rules="formRules" |
| | | label-width="120px" |
| | | > |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¼ç " prop="code"> |
| | | <el-input v-model="formData.code" placeholder="ç³»ç»èªå¨çæ" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åç§°" prop="planName" required> |
| | | <el-input v-model="formData.planName" placeholder="请è¾å
¥è®¡ååç§°" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-form-item label="æè¿°" prop="description"> |
| | | <el-input |
| | | v-model="formData.description" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥è®¡åæè¿°" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ°æ®ç¶æ" prop="dataStatus"> |
| | | <el-select v-model="formData.dataStatus" placeholder="è¯·éæ©ç¶æ" style="width: 100%"> |
| | | <el-option label="è稿" value="draft" /> |
| | | <el-option label="å·²å®¡æ ¸" value="approved" /> |
| | | <el-option label="å·²ç¦ç¨" value="disabled" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¯å¦ç³»ç»é¢ç½®"> |
| | | <el-checkbox v-model="formData.isSystemPreset">æ¯</el-checkbox> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <!-- 计ç®åæ° --> |
| | | <div class="form-section"> |
| | | <div class="section-title">计ç®åæ°</div> |
| | | <el-tabs v-model="activeTab" class="param-tabs"> |
| | | <el-tab-pane label="鿱忰" name="demand"> |
| | | <div class="checkbox-group"> |
| | | <el-checkbox v-model="formData.considerExistingStock">èèç°æåºå</el-checkbox> |
| | | <el-checkbox v-model="formData.warehouseMRPControl">ä»åºè¿è¡MRPçæ§å¶</el-checkbox> |
| | | <el-checkbox v-model="formData.calculateTotalDemand">è®¡ç®æ»éæ±</el-checkbox> |
| | | <el-checkbox v-model="formData.considerSafetyStock">èèå®å
¨åºå</el-checkbox> |
| | | <el-checkbox v-model="formData.considerLockedStock">èèéåº</el-checkbox> |
| | | <el-checkbox v-model="formData.notConsiderMaterialAux">ä¸èèç©æè¾
å©å±æ§</el-checkbox> |
| | | <el-checkbox v-model="formData.negativeStockAsDemand">è´åºåä½ä¸ºéæ±</el-checkbox> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="计ç®åæ°" name="calculation"> |
| | | <div class="checkbox-group"> |
| | | <el-checkbox v-model="formData.considerExistingStock">èèç°æåºå</el-checkbox> |
| | | <el-checkbox v-model="formData.warehouseMRPControl">ä»åºè¿è¡MRPçæ§å¶</el-checkbox> |
| | | <el-checkbox v-model="formData.calculateTotalDemand">è®¡ç®æ»éæ±</el-checkbox> |
| | | <el-checkbox v-model="formData.considerSafetyStock">èèå®å
¨åºå</el-checkbox> |
| | | <el-checkbox v-model="formData.considerLockedStock">èèéåº</el-checkbox> |
| | | <el-checkbox v-model="formData.notConsiderMaterialAux">ä¸èèç©æè¾
å©å±æ§</el-checkbox> |
| | | <el-checkbox v-model="formData.negativeStockAsDemand">è´åºåä½ä¸ºéæ±</el-checkbox> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | | |
| | | <!-- æ±æ»åå¹¶é项 --> |
| | | <div class="form-section"> |
| | | <div class="section-title">æ±æ»åå¹¶é项</div> |
| | | <div class="checkbox-group"> |
| | | <el-checkbox v-model="formData.summaryMaterial">ç©æ</el-checkbox> |
| | | <el-checkbox v-model="formData.summaryAuxAttributes">è¾
å©å±æ§</el-checkbox> |
| | | <el-checkbox v-model="formData.summaryDemandDate">éæ±æ¥æ</el-checkbox> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 计ç®å
¬å¼ --> |
| | | <div class="form-section"> |
| | | <div class="section-title">计ç®å
¬å¼</div> |
| | | <div class="formula-input-section"> |
| | | <el-form-item label="计ç®å
¬å¼" prop="formula" required> |
| | | <el-input |
| | | v-model="formData.formula" |
| | | placeholder="ä¾å¦: é¢è®¡åºåºæ°é - ç°æåºå + å®å
¨åºå - é¢è®¡å
¥åºæ°é" |
| | | @input="validateFormula" |
| | | /> |
| | | </el-form-item> |
| | | <div class="formula-help"> |
| | | <el-text type="info" size="small"> |
| | | æ¯æåéï¼é¢è®¡åºåºæ°éãç°æåºåãå®å
¨åºåãé¢è®¡å
¥åºæ°é |
| | | </el-text> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">åæ¶</el-button> |
| | | <el-button type="primary" @click="handleSubmit" :loading="submitLoading">ç¡®å®</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- 产åéæ©å¯¹è¯æ¡ --> |
| | | <el-dialog |
| | | v-model="productSelectDialogVisible" |
| | | title="éæ©äº§å" |
| | | width="800px" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <div class="product-select"> |
| | | <el-alert |
| | | title="è¯·éæ©è¦è®¡ç®ç产å" |
| | | type="info" |
| | | :closable="false" |
| | | show-icon |
| | | > |
| | | <template #default> |
| | | <p>éæ©äº§ååï¼ç³»ç»å°æ ¹æ®å½å计ç®å
¬å¼å产ååºåæ
åµè¿è¡è®¡ç®ã</p> |
| | | </template> |
| | | </el-alert> |
| | | |
| | | <el-table |
| | | v-loading="productLoading" |
| | | :data="productList" |
| | | @selection-change="handleProductSelectionChange" |
| | | stripe |
| | | border |
| | | style="width: 100%; margin-top: 20px;" |
| | | > |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="productName" label="产ååç§°" min-width="150" /> |
| | | <el-table-column prop="productCode" label="产åç¼ç " width="120" /> |
| | | <el-table-column prop="existingStock" label="ç°æåºå" width="100" align="right" /> |
| | | <el-table-column prop="safetyStock" label="å®å
¨åºå" width="100" align="right" /> |
| | | <el-table-column prop="expectedOutbound" label="é¢è®¡åºåº" width="100" align="right" /> |
| | | <el-table-column prop="expectedInbound" label="é¢è®¡å
¥åº" width="100" align="right" /> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="productSelectDialogVisible = false">åæ¶</el-button> |
| | | <el-button type="primary" @click="handleConfirmProductSelection" :disabled="selectedProducts.length === 0"> |
| | | ç¡®è®¤è®¡ç® |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- 计ç®ç»æå¯¹è¯æ¡ --> |
| | | <el-dialog |
| | | v-model="calculateDialogVisible" |
| | | title="éè´è®¡ç®ç»æ" |
| | | width="1000px" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <div class="calculate-result"> |
| | | <el-alert |
| | | title="计ç®ç»æ" |
| | | type="success" |
| | | :closable="false" |
| | | show-icon |
| | | > |
| | | <template #default> |
| | | <p>åºäºå½åé
ç½®ç计ç®å
¬å¼ååºåæ
åµï¼ç³»ç»å·²è®¡ç®åºå产åçéè´éæ±ã</p> |
| | | </template> |
| | | </el-alert> |
| | | |
| | | <el-table :data="calculateResult" stripe border style="width: 100%; margin-top: 20px;"> |
| | | <el-table-column prop="productName" label="产ååç§°" min-width="150" /> |
| | | <el-table-column prop="productCode" label="产åç¼ç " width="120" /> |
| | | <el-table-column prop="existingStock" label="ç°æåºå" width="100" align="right" /> |
| | | <el-table-column prop="safetyStock" label="å®å
¨åºå" width="100" align="right" /> |
| | | <el-table-column prop="expectedOutbound" label="é¢è®¡åºåºæ°é" width="120" align="right" /> |
| | | <el-table-column prop="expectedInbound" label="é¢è®¡å
¥åºæ°é" width="120" align="right" /> |
| | | <el-table-column prop="weeklyNetDemand" label="æå¨åéæ±" width="120" align="right"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="row.weeklyNetDemand > 0 ? 'warning' : 'success'" size="small"> |
| | | {{ row.weeklyNetDemand }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="suggestedPurchase" label="建议éè´" width="100" align="right"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="row.suggestedPurchase > 0 ? 'danger' : 'success'" size="small"> |
| | | {{ row.suggestedPurchase }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="calculateDialogVisible = false">å
³é</el-button> |
| | | <el-button type="primary" @click="handleCreatePurchaseOrder">çæéè´è®¢å</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { Search, Refresh, Plus, Download } from '@element-plus/icons-vue' |
| | | |
| | | // ååºå¼æ°æ® |
| | | const loading = ref(false) |
| | | const submitLoading = ref(false) |
| | | const dialogVisible = ref(false) |
| | | const productSelectDialogVisible = ref(false) |
| | | const calculateDialogVisible = ref(false) |
| | | const dialogType = ref('add') |
| | | const productLoading = ref(false) |
| | | const selectedProducts = ref([]) |
| | | const currentPlan = ref(null) |
| | | |
| | | // æç´¢è¡¨å |
| | | const searchForm = reactive({ |
| | | planName: '', |
| | | status: '' |
| | | }) |
| | | |
| | | // åé¡µæ°æ® |
| | | const pagination = reactive({ |
| | | current: 1, |
| | | size: 20, |
| | | total: 0 |
| | | }) |
| | | |
| | | // è¡¨åæ°æ® |
| | | const formData = reactive({ |
| | | code: '', |
| | | planName: '', |
| | | description: '', |
| | | dataStatus: '', |
| | | isSystemPreset: false, |
| | | formula: '', |
| | | // 计ç®åæ° |
| | | considerExistingStock: false, |
| | | warehouseMRPControl: false, |
| | | calculateTotalDemand: false, |
| | | considerSafetyStock: false, |
| | | considerLockedStock: false, |
| | | notConsiderMaterialAux: false, |
| | | negativeStockAsDemand: false, |
| | | // æ±æ»åå¹¶é项 |
| | | summaryMaterial: false, |
| | | summaryAuxAttributes: false, |
| | | summaryDemandDate: false |
| | | }) |
| | | |
| | | // å½åæ¿æ´»çæ ç¾é¡µ |
| | | const activeTab = ref('demand') |
| | | |
| | | // 表åéªè¯è§å |
| | | const formRules = { |
| | | planName: [ |
| | | { required: true, message: '请è¾å
¥è®¡ååç§°', trigger: 'blur' } |
| | | ], |
| | | dataStatus: [ |
| | | { required: true, message: 'è¯·éæ©æ°æ®ç¶æ', trigger: 'change' } |
| | | ], |
| | | formula: [ |
| | | { required: true, message: '请è¾å
¥è®¡ç®å
¬å¼', trigger: 'blur' } |
| | | ] |
| | | } |
| | | |
| | | // è¡¨æ ¼æ°æ® |
| | | const tableData = ref([ |
| | | { |
| | | id: 1, |
| | | planName: '常è§äº§åéè´è®¡å', |
| | | description: 'åºäºåå²é宿°æ®ç常è§äº§åéè´è®¡å', |
| | | formula: 'é¢è®¡åºåºæ°é - ç°æåºå + å®å
¨åºå - é¢è®¡å
¥åºæ°é', |
| | | status: 'active', |
| | | lastCalculateTime: '2024-12-01 10:30:00', |
| | | remark: 'éç¨äºå¸¸è§äº§å' |
| | | }, |
| | | { |
| | | id: 2, |
| | | planName: 'å£èæ§äº§åéè´è®¡å', |
| | | description: 'èèå£èå ç´ çå£èæ§äº§åéè´è®¡å', |
| | | formula: 'é¢è®¡åºåºæ°é - ç°æåºå + å®å
¨åºå * 1.2 - é¢è®¡å
¥åºæ°é', |
| | | status: 'active', |
| | | lastCalculateTime: '2024-11-28 15:20:00', |
| | | remark: 'éç¨äºå£èæ§äº§å' |
| | | } |
| | | ]) |
| | | |
| | | // 产ååè¡¨æ°æ® |
| | | const productList = ref([ |
| | | { |
| | | id: 1, |
| | | productName: '产åA', |
| | | productCode: 'PA001', |
| | | existingStock: 100, |
| | | safetyStock: 50, |
| | | expectedOutbound: 200, |
| | | expectedInbound: 30 |
| | | }, |
| | | { |
| | | id: 2, |
| | | productName: '产åB', |
| | | productCode: 'PB002', |
| | | existingStock: 80, |
| | | safetyStock: 30, |
| | | expectedOutbound: 150, |
| | | expectedInbound: 20 |
| | | }, |
| | | { |
| | | id: 3, |
| | | productName: '产åC', |
| | | productCode: 'PC003', |
| | | existingStock: 120, |
| | | safetyStock: 60, |
| | | expectedOutbound: 180, |
| | | expectedInbound: 25 |
| | | }, |
| | | { |
| | | id: 4, |
| | | productName: '产åD', |
| | | productCode: 'PD004', |
| | | existingStock: 90, |
| | | safetyStock: 40, |
| | | expectedOutbound: 160, |
| | | expectedInbound: 35 |
| | | } |
| | | ]) |
| | | |
| | | // 计ç®ç»ææ°æ® |
| | | const calculateResult = ref([ |
| | | { |
| | | productName: '产åA', |
| | | existingStock: 100, |
| | | safetyStock: 50, |
| | | expectedOutbound: 200, |
| | | expectedInbound: 30, |
| | | weeklyNetDemand: 120, |
| | | suggestedPurchase: 150 |
| | | }, |
| | | { |
| | | productName: '产åB', |
| | | existingStock: 80, |
| | | safetyStock: 30, |
| | | expectedOutbound: 150, |
| | | expectedInbound: 20, |
| | | weeklyNetDemand: 100, |
| | | suggestedPurchase: 120 |
| | | } |
| | | ]) |
| | | |
| | | // æ¹æ³ |
| | | const handleSearch = () => { |
| | | pagination.current = 1 |
| | | loadData() |
| | | } |
| | | |
| | | const handleReset = () => { |
| | | Object.assign(searchForm, { |
| | | planName: '', |
| | | status: '' |
| | | }) |
| | | handleSearch() |
| | | } |
| | | |
| | | const loadData = () => { |
| | | loading.value = true |
| | | // 模æAPIè°ç¨ |
| | | setTimeout(() => { |
| | | pagination.total = tableData.value.length |
| | | loading.value = false |
| | | }, 500) |
| | | } |
| | | |
| | | const handleAdd = () => { |
| | | dialogType.value = 'add' |
| | | resetForm() |
| | | // èªå¨çæç¼ç |
| | | formData.code = 'CGJH' + String(Date.now()).slice(-4) |
| | | dialogVisible.value = true |
| | | } |
| | | |
| | | const handleEdit = (row) => { |
| | | dialogType.value = 'edit' |
| | | Object.assign(formData, row) |
| | | dialogVisible.value = true |
| | | } |
| | | |
| | | const handleDelete = async (row) => { |
| | | try { |
| | | await ElMessageBox.confirm('ç¡®å®è¦å é¤è¿ä¸ªéè´è®¡ååï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }) |
| | | |
| | | const index = tableData.value.findIndex(item => item.id === row.id) |
| | | if (index > -1) { |
| | | tableData.value.splice(index, 1) |
| | | ElMessage.success('å 餿å') |
| | | loadData() |
| | | } |
| | | } catch { |
| | | // ç¨æ·åæ¶å é¤ |
| | | } |
| | | } |
| | | |
| | | const handleSubmit = async () => { |
| | | try { |
| | | // 表åéªè¯ |
| | | if (!formData.planName || !formData.formula) { |
| | | ElMessage.error('请填åå¿
填项') |
| | | return |
| | | } |
| | | |
| | | submitLoading.value = true |
| | | |
| | | if (dialogType.value === 'add') { |
| | | // æ°å¢ |
| | | const newItem = { |
| | | ...formData, |
| | | id: Date.now(), |
| | | lastCalculateTime: '-' |
| | | } |
| | | tableData.value.unshift(newItem) |
| | | ElMessage.success('æ°å¢æå') |
| | | } else { |
| | | // ç¼è¾ |
| | | const index = tableData.value.findIndex(item => item.id === formData.id) |
| | | if (index > -1) { |
| | | tableData.value[index] = { ...formData } |
| | | ElMessage.success('ç¼è¾æå') |
| | | } |
| | | } |
| | | |
| | | dialogVisible.value = false |
| | | loadData() |
| | | } catch (error) { |
| | | ElMessage.error('æä½å¤±è´¥') |
| | | } finally { |
| | | submitLoading.value = false |
| | | } |
| | | } |
| | | |
| | | const resetForm = () => { |
| | | Object.assign(formData, { |
| | | code: '', |
| | | planName: '', |
| | | description: '', |
| | | dataStatus: '', |
| | | isSystemPreset: false, |
| | | formula: '', |
| | | // 计ç®åæ° |
| | | considerExistingStock: false, |
| | | warehouseMRPControl: false, |
| | | calculateTotalDemand: false, |
| | | considerSafetyStock: false, |
| | | considerLockedStock: false, |
| | | notConsiderMaterialAux: false, |
| | | negativeStockAsDemand: false, |
| | | // æ±æ»åå¹¶é项 |
| | | summaryMaterial: false, |
| | | summaryAuxAttributes: false, |
| | | summaryDemandDate: false |
| | | }) |
| | | activeTab.value = 'demand' |
| | | } |
| | | |
| | | const validateFormula = () => { |
| | | // ç®åçå
¬å¼éªè¯ |
| | | const formula = formData.formula |
| | | if (formula && !/^[a-zA-Z\u4e00-\u9fa5\s\*\+\-\/\(\)\d\.]+$/.test(formula)) { |
| | | ElMessage.warning('å
¬å¼æ ¼å¼å¯è½ä¸æ£ç¡®ï¼è¯·æ£æ¥') |
| | | } |
| | | } |
| | | |
| | | const handleCalculate = (row) => { |
| | | currentPlan.value = row |
| | | productSelectDialogVisible.value = true |
| | | loadProductList() |
| | | } |
| | | |
| | | const loadProductList = () => { |
| | | productLoading.value = true |
| | | // 模æå è½½äº§åæ°æ® |
| | | setTimeout(() => { |
| | | productLoading.value = false |
| | | }, 500) |
| | | } |
| | | |
| | | const handleProductSelectionChange = (selection) => { |
| | | selectedProducts.value = selection |
| | | } |
| | | |
| | | const handleConfirmProductSelection = () => { |
| | | if (selectedProducts.value.length === 0) { |
| | | ElMessage.warning('è¯·éæ©è¦è®¡ç®ç产å') |
| | | return |
| | | } |
| | | |
| | | ElMessage.success(`æ£å¨è®¡ç® ${currentPlan.value.planName} çéè´éæ±...`) |
| | | productSelectDialogVisible.value = false |
| | | |
| | | // æ ¹æ®éæ©ç产åå计ç®å
¬å¼è¿è¡è®¡ç® |
| | | calculateWithSelectedProducts() |
| | | } |
| | | |
| | | const calculateWithSelectedProducts = () => { |
| | | // 模æè®¡ç®è¿ç¨ |
| | | setTimeout(() => { |
| | | // æ ¹æ®éæ©çäº§åæ´æ°è®¡ç®ç»æ |
| | | const result = selectedProducts.value.map(product => { |
| | | // è¿éåºè¯¥æ ¹æ®å®é
ç计ç®å
¬å¼è¿è¡è®¡ç® |
| | | // 示ä¾ï¼é¢è®¡åºåºæ°é - ç°æåºå + å®å
¨åºå - é¢è®¡å
¥åºæ°é |
| | | const weeklyNetDemand = product.expectedOutbound - product.existingStock + product.safetyStock - product.expectedInbound |
| | | const suggestedPurchase = Math.max(0, weeklyNetDemand) |
| | | |
| | | return { |
| | | productName: product.productName, |
| | | productCode: product.productCode, |
| | | existingStock: product.existingStock, |
| | | safetyStock: product.safetyStock, |
| | | expectedOutbound: product.expectedOutbound, |
| | | expectedInbound: product.expectedInbound, |
| | | weeklyNetDemand: weeklyNetDemand, |
| | | suggestedPurchase: suggestedPurchase |
| | | } |
| | | }) |
| | | |
| | | calculateResult.value = result |
| | | calculateDialogVisible.value = true |
| | | }, 1000) |
| | | } |
| | | |
| | | |
| | | const handleCreatePurchaseOrder = () => { |
| | | ElMessage.success('æ£å¨çæéè´è®¢å...') |
| | | calculateDialogVisible.value = false |
| | | } |
| | | |
| | | const handleExport = () => { |
| | | ElMessage.success('æ£å¨å¯¼åºæ°æ®...') |
| | | } |
| | | |
| | | |
| | | const handleSizeChange = (size) => { |
| | | pagination.size = size |
| | | loadData() |
| | | } |
| | | |
| | | const handleCurrentChange = (current) => { |
| | | pagination.current = current |
| | | loadData() |
| | | } |
| | | |
| | | // çå½å¨æ |
| | | onMounted(() => { |
| | | loadData() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .app-container { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .page-header { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .page-header h2 { |
| | | margin: 0 0 8px 0; |
| | | color: #303133; |
| | | font-size: 24px; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .page-header p { |
| | | margin: 0; |
| | | color: #909399; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .search-card { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .search-form { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .table-card { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .table-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .table-title { |
| | | font-size: 16px; |
| | | font-weight: 600; |
| | | color: #303133; |
| | | } |
| | | |
| | | .table-actions { |
| | | display: flex; |
| | | gap: 10px; |
| | | } |
| | | |
| | | .pagination-container { |
| | | margin-top: 20px; |
| | | display: flex; |
| | | justify-content: end; |
| | | } |
| | | |
| | | .form-container { |
| | | padding: 0 20px; |
| | | } |
| | | |
| | | .formula-help { |
| | | margin-top: 5px; |
| | | } |
| | | |
| | | .calculate-result { |
| | | padding: 20px 0; |
| | | } |
| | | |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | |
| | | :deep(.el-card__body) { |
| | | padding: 20px; |
| | | } |
| | | |
| | | :deep(.el-table) { |
| | | font-size: 14px; |
| | | } |
| | | |
| | | :deep(.el-form-item__label) { |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .form-container { |
| | | padding: 0; |
| | | } |
| | | |
| | | .form-section { |
| | | margin-bottom: 24px; |
| | | border: 1px solid #e4e7ed; |
| | | border-radius: 6px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .section-title { |
| | | background-color: #f5f7fa; |
| | | padding: 12px 16px; |
| | | font-weight: 600; |
| | | color: #303133; |
| | | border-bottom: 1px solid #e4e7ed; |
| | | } |
| | | |
| | | .form-section .el-form { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .param-tabs { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .param-tabs :deep(.el-tabs__header) { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .param-tabs :deep(.el-tabs__item.is-active) { |
| | | color: #f56c6c; |
| | | border-bottom-color: #f56c6c; |
| | | } |
| | | |
| | | .checkbox-group { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 16px; |
| | | } |
| | | |
| | | .checkbox-group .el-checkbox { |
| | | margin-right: 0; |
| | | margin-bottom: 8px; |
| | | } |
| | | |
| | | .formula-input-section { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .formula-input-section .el-form-item { |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .formula-help { |
| | | text-align: center; |
| | | margin-top: 8px; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- æ¥è¡¨éæ©å¨ --> |
| | | <el-card class="report-selector" shadow="never"> |
| | | <el-tabs v-model="activeReport" @tab-change="handleReportChange"> |
| | | <el-tab-pane label="éè´è®¢åæ§è¡æ±æ»è¡¨" name="orderSummary"> |
| | | <template #label> |
| | | <span class="tab-label"> |
| | | <el-icon><Document /></el-icon> |
| | | éè´è®¢åæ§è¡æ±æ»è¡¨ |
| | | </span> |
| | | </template> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="éè´è®¢åæ§è¡æç»è¡¨" name="orderDetail"> |
| | | <template #label> |
| | | <span class="tab-label"> |
| | | <el-icon><List /></el-icon> |
| | | éè´è®¢åæ§è¡æç»è¡¨ |
| | | </span> |
| | | </template> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="éè´ä¸å¡æ±æ»è¡¨" name="businessSummary"> |
| | | <template #label> |
| | | <span class="tab-label"> |
| | | <el-icon><TrendCharts /></el-icon> |
| | | éè´ä¸å¡æ±æ»è¡¨ |
| | | </span> |
| | | </template> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="ä¾åºåä¾è´§æ±æ»è¡¨" name="supplierSummary"> |
| | | <template #label> |
| | | <span class="tab-label"> |
| | | <el-icon><Shop /></el-icon> |
| | | ä¾åºåä¾è´§æ±æ»è¡¨ |
| | | </span> |
| | | </template> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </el-card> |
| | | |
| | | <!-- æ¥è¯¢æ¡ä»¶ --> |
| | | <el-card class="search-card" shadow="never"> |
| | | <el-form :model="searchForm" :inline="true" class="search-form"> |
| | | <el-form-item label="æ¶é´èå´ï¼"> |
| | | <el-date-picker |
| | | v-model="searchForm.dateRange" |
| | | type="daterange" |
| | | range-separator="è³" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ä¾åºåï¼" v-if="activeReport === 'supplierSummary'"> |
| | | <el-select v-model="searchForm.supplierId" placeholder="è¯·éæ©ä¾åºå" clearable style="width: 200px"> |
| | | <el-option |
| | | v-for="supplier in supplierList" |
| | | :key="supplier.id" |
| | | :label="supplier.name" |
| | | :value="supplier.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ååç±»å«ï¼" v-if="activeReport === 'businessSummary'"> |
| | | <el-select v-model="searchForm.categoryId" placeholder="è¯·éæ©ååç±»å«" clearable style="width: 200px"> |
| | | <el-option |
| | | v-for="category in categoryList" |
| | | :key="category.id" |
| | | :label="category.name" |
| | | :value="category.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch" :loading="loading"> |
| | | <el-icon><Search /></el-icon> |
| | | æ¥è¯¢ |
| | | </el-button> |
| | | <el-button @click="resetSearch"> |
| | | <el-icon><Refresh /></el-icon> |
| | | éç½® |
| | | </el-button> |
| | | <el-button type="success" @click="exportReport"> |
| | | <el-icon><Download /></el-icon> |
| | | å¯¼åº |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <!-- æ¥è¡¨å
容 --> |
| | | <el-card class="report-content" shadow="never"> |
| | | <!-- éè´è®¢åæ§è¡æ±æ»è¡¨ --> |
| | | <div v-if="activeReport === 'orderSummary'" class="report-section"> |
| | | <div class="section-header"> |
| | | <h3>éè´è®¢åæ§è¡æ±æ»è¡¨</h3> |
| | | <div class="summary-stats"> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">æ»è®¢åæ°ï¼</span> |
| | | <span class="stat-value">{{ orderSummaryStats.totalOrders }}</span> |
| | | </div> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">æ»éé¢ï¼</span> |
| | | <span class="stat-value">Â¥{{ orderSummaryStats.totalAmount.toLocaleString() }}</span> |
| | | </div> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">宿çï¼</span> |
| | | <span class="stat-value">{{ orderSummaryStats.completionRate }}%</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <el-table :data="orderSummaryData" border v-loading="loading" stripe> |
| | | <el-table-column label="订åç¼å·" prop="orderNo" width="180" fixed="left" /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" width="150" /> |
| | | <el-table-column label="è®¢åæ¥æ" prop="orderDate" width="120" /> |
| | | <el-table-column label="计å交æ" prop="plannedDelivery" width="120" /> |
| | | <el-table-column label="å®é
交æ" prop="actualDelivery" width="120" /> |
| | | <el-table-column label="订åéé¢" prop="orderAmount" width="120"> |
| | | <template #default="{ row }">Â¥{{ row.orderAmount.toLocaleString() }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="å·²ä»éé¢" prop="paidAmount" width="120"> |
| | | <template #default="{ row }">Â¥{{ row.paidAmount.toLocaleString() }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="å®æç¶æ" prop="status" width="100"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="宿ç" prop="completionRate" width="100"> |
| | | <template #default="{ row }">{{ row.completionRate }}%</template> |
| | | </el-table-column> |
| | | <el-table-column label="å»¶è¿å¤©æ°" prop="delayDays" width="100"> |
| | | <template #default="{ row }"> |
| | | <span :class="{ 'delay-text': row.delayDays > 0 }">{{ row.delayDays }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- éè´è®¢åæ§è¡æç»è¡¨ --> |
| | | <div v-if="activeReport === 'orderDetail'" class="report-section"> |
| | | <div class="section-header"> |
| | | <h3>éè´è®¢åæ§è¡æç»è¡¨</h3> |
| | | <div class="summary-stats"> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">æç»æ¡æ°ï¼</span> |
| | | <span class="stat-value">{{ orderDetailStats.totalItems }}</span> |
| | | </div> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">å·²æ¶è´§ï¼</span> |
| | | <span class="stat-value">{{ orderDetailStats.receivedItems }}</span> |
| | | </div> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">å¾
æ¶è´§ï¼</span> |
| | | <span class="stat-value">{{ orderDetailStats.pendingItems }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <el-table :data="orderDetailData" border v-loading="loading" stripe> |
| | | <el-table-column label="订åç¼å·" prop="orderNo" width="150" fixed="left" /> |
| | | <el-table-column label="ååç¼ç " prop="productCode" width="120" /> |
| | | <el-table-column label="åååç§°" prop="productName" width="200" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specification" width="150" /> |
| | | <el-table-column label="åä½" prop="unit" width="80" /> |
| | | <el-table-column label="è®¡åæ°é" prop="plannedQuantity" width="100" /> |
| | | <el-table-column label="å·²æ¶è´§æ°é" prop="receivedQuantity" width="120" /> |
| | | <el-table-column label="å¾
æ¶è´§æ°é" prop="pendingQuantity" width="120" /> |
| | | <el-table-column label="åä»·" prop="unitPrice" width="100"> |
| | | <template #default="{ row }">Â¥{{ row.unitPrice.toFixed(2) }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="å°è®¡" prop="subtotal" width="120"> |
| | | <template #default="{ row }">Â¥{{ row.subtotal.toLocaleString() }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="æ¶è´§ç¶æ" prop="status" width="100"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="getReceiptStatusType(row.status)">{{ getReceiptStatusText(row.status) }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æåæ¶è´§æ¥æ" prop="lastReceiptDate" width="120" /> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- éè´ä¸å¡æ±æ»è¡¨ --> |
| | | <div v-if="activeReport === 'businessSummary'" class="report-section"> |
| | | <div class="section-header"> |
| | | <h3>éè´ä¸å¡æ±æ»è¡¨</h3> |
| | | <div class="summary-stats"> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">éè´æ»é¢ï¼</span> |
| | | <span class="stat-value">Â¥{{ businessSummaryStats.totalAmount.toLocaleString() }}</span> |
| | | </div> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">ååç§ç±»ï¼</span> |
| | | <span class="stat-value">{{ businessSummaryStats.productTypes }}</span> |
| | | </div> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">ä¾åºåæ°ï¼</span> |
| | | <span class="stat-value">{{ businessSummaryStats.supplierCount }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <el-table :data="businessSummaryData" border v-loading="loading" stripe> |
| | | <el-table-column label="ååç±»å«" prop="category" width="150" fixed="left" /> |
| | | <el-table-column label="ååç¼ç " prop="productCode" width="120" /> |
| | | <el-table-column label="åååç§°" prop="productName" width="200" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specification" width="150" /> |
| | | <el-table-column label="éè´æ°é" prop="purchaseQuantity" width="120" /> |
| | | <el-table-column label="éè´éé¢" prop="purchaseAmount" width="120"> |
| | | <template #default="{ row }">Â¥{{ row.purchaseAmount.toLocaleString() }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="å¹³ååä»·" prop="avgPrice" width="100"> |
| | | <template #default="{ row }">Â¥{{ row.avgPrice.toFixed(2) }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="éè´æ¬¡æ°" prop="purchaseCount" width="100" /> |
| | | <el-table-column label="主è¦ä¾åºå" prop="mainSupplier" width="150" /> |
| | | <el-table-column label="æåéè´æ¥æ" prop="lastPurchaseDate" width="120" /> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- ä¾åºåä¾è´§æ±æ»è¡¨ --> |
| | | <div v-if="activeReport === 'supplierSummary'" class="report-section"> |
| | | <div class="section-header"> |
| | | <h3>ä¾åºåä¾è´§æ±æ»è¡¨</h3> |
| | | <div class="summary-stats"> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">ä¾åºåæ»æ°ï¼</span> |
| | | <span class="stat-value">{{ supplierSummaryStats.totalSuppliers }}</span> |
| | | </div> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">ä¾è´§æ»é¢ï¼</span> |
| | | <span class="stat-value">Â¥{{ supplierSummaryStats.totalAmount.toLocaleString() }}</span> |
| | | </div> |
| | | <div class="stat-item"> |
| | | <span class="stat-label">å¹³åè¯åï¼</span> |
| | | <span class="stat-value">{{ supplierSummaryStats.avgRating.toFixed(1) }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <el-table :data="supplierSummaryData" border v-loading="loading" stripe> |
| | | <el-table-column label="ä¾åºåç¼ç " prop="supplierCode" width="120" fixed="left" /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" width="200" /> |
| | | <el-table-column label="è系人" prop="contactPerson" width="120" /> |
| | | <el-table-column label="èç³»çµè¯" prop="phone" width="130" /> |
| | | <el-table-column label="ä¾è´§è®¢åæ°" prop="orderCount" width="120" /> |
| | | <el-table-column label="ä¾è´§éé¢" prop="supplyAmount" width="120"> |
| | | <template #default="{ row }">Â¥{{ row.supplyAmount.toLocaleString() }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="å·²ä»éé¢" prop="paidAmount" width="120"> |
| | | <template #default="{ row }">Â¥{{ row.paidAmount.toLocaleString() }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="æªä»éé¢" prop="unpaidAmount" width="120"> |
| | | <template #default="{ row }">Â¥{{ row.unpaidAmount.toLocaleString() }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="ææ¶äº¤è´§ç" prop="onTimeRate" width="120"> |
| | | <template #default="{ row }">{{ row.onTimeRate }}%</template> |
| | | </el-table-column> |
| | | <el-table-column label="è´¨éè¯å" prop="qualityRating" width="100"> |
| | | <template #default="{ row }"> |
| | | <el-rate v-model="row.qualityRating" disabled show-score text-color="#ff9900" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="åä½ç¶æ" prop="status" width="100"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="getSupplierStatusType(row.status)">{{ getSupplierStatusText(row.status) }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import { Document, List, TrendCharts, Shop, Search, Refresh, Download } from '@element-plus/icons-vue' |
| | | |
| | | // ååºå¼æ°æ® |
| | | const loading = ref(false) |
| | | const activeReport = ref('orderSummary') |
| | | |
| | | // æç´¢è¡¨å |
| | | const searchForm = reactive({ |
| | | dateRange: [], |
| | | supplierId: '', |
| | | categoryId: '' |
| | | }) |
| | | |
| | | // ä¾åºåå表 |
| | | const supplierList = ref([ |
| | | { id: 1, name: 'æ±èåèçµåç§ææéå
¬å¸' }, |
| | | { id: 2, name: '䏿µ·ç²¾å¯æºæ¢°å¶é æéå
¬å¸' }, |
| | | { id: 3, name: 'æ·±å³æºè½è®¾å¤æéå
¬å¸' }, |
| | | { id: 4, name: 'åäº¬æ°ææç§ææéå
¬å¸' }, |
| | | { id: 5, name: '广å·çµåå
å¨ä»¶æéå
¬å¸' } |
| | | ]) |
| | | |
| | | // ååç±»å«å表 |
| | | const categoryList = ref([ |
| | | { id: 1, name: 'çµåå
å¨ä»¶' }, |
| | | { id: 2, name: 'æºæ¢°è®¾å¤' }, |
| | | { id: 3, name: 'åææ' }, |
| | | { id: 4, name: 'åå
¬ç¨å' }, |
| | | { id: 5, name: 'å
è£
ææ' } |
| | | ]) |
| | | |
| | | // ç»è®¡æ°æ® |
| | | const orderSummaryStats = ref({ |
| | | totalOrders: 156, |
| | | totalAmount: 2580000, |
| | | completionRate: 87.5 |
| | | }) |
| | | |
| | | const orderDetailStats = ref({ |
| | | totalItems: 1248, |
| | | receivedItems: 1089, |
| | | pendingItems: 159 |
| | | }) |
| | | |
| | | const businessSummaryStats = ref({ |
| | | totalAmount: 2580000, |
| | | productTypes: 89, |
| | | supplierCount: 25 |
| | | }) |
| | | |
| | | const supplierSummaryStats = ref({ |
| | | totalSuppliers: 25, |
| | | totalAmount: 2580000, |
| | | avgRating: 4.2 |
| | | }) |
| | | |
| | | // éè´è®¢åæ§è¡æ±æ»è¡¨æ°æ® |
| | | const orderSummaryData = ref([ |
| | | { |
| | | orderNo: 'PO20241201001', |
| | | supplierName: 'æ±èåèçµåç§ææéå
¬å¸', |
| | | orderDate: '2024-12-01', |
| | | plannedDelivery: '2024-12-15', |
| | | actualDelivery: '2024-12-14', |
| | | orderAmount: 125000, |
| | | paidAmount: 100000, |
| | | status: 'completed', |
| | | completionRate: 100, |
| | | delayDays: -1 |
| | | }, |
| | | { |
| | | orderNo: 'PO20241201002', |
| | | supplierName: '䏿µ·ç²¾å¯æºæ¢°å¶é æéå
¬å¸', |
| | | orderDate: '2024-12-02', |
| | | plannedDelivery: '2024-12-20', |
| | | actualDelivery: '2024-12-22', |
| | | orderAmount: 280000, |
| | | paidAmount: 140000, |
| | | status: 'partial', |
| | | completionRate: 75, |
| | | delayDays: 2 |
| | | }, |
| | | { |
| | | orderNo: 'PO20241201003', |
| | | supplierName: 'æ·±å³æºè½è®¾å¤æéå
¬å¸', |
| | | orderDate: '2024-12-03', |
| | | plannedDelivery: '2024-12-25', |
| | | actualDelivery: '', |
| | | orderAmount: 180000, |
| | | paidAmount: 0, |
| | | status: 'pending', |
| | | completionRate: 0, |
| | | delayDays: 0 |
| | | }, |
| | | { |
| | | orderNo: 'PO20241201004', |
| | | supplierName: 'åäº¬æ°ææç§ææéå
¬å¸', |
| | | orderDate: '2024-12-04', |
| | | plannedDelivery: '2024-12-18', |
| | | actualDelivery: '2024-12-18', |
| | | orderAmount: 95000, |
| | | paidAmount: 95000, |
| | | status: 'completed', |
| | | completionRate: 100, |
| | | delayDays: 0 |
| | | }, |
| | | { |
| | | orderNo: 'PO20241201005', |
| | | supplierName: '广å·çµåå
å¨ä»¶æéå
¬å¸', |
| | | orderDate: '2024-12-05', |
| | | plannedDelivery: '2024-12-28', |
| | | actualDelivery: '', |
| | | orderAmount: 220000, |
| | | paidAmount: 0, |
| | | status: 'pending', |
| | | completionRate: 0, |
| | | delayDays: 0 |
| | | } |
| | | ]) |
| | | |
| | | // éè´è®¢åæ§è¡æç»è¡¨æ°æ® |
| | | const orderDetailData = ref([ |
| | | { |
| | | orderNo: 'PO20241201001', |
| | | productCode: 'EL001', |
| | | productName: 'çµé»å¨ 1KΩ ±5%', |
| | | specification: '1/4W 碳èçµé»', |
| | | unit: '个', |
| | | plannedQuantity: 1000, |
| | | receivedQuantity: 1000, |
| | | pendingQuantity: 0, |
| | | unitPrice: 0.15, |
| | | subtotal: 150, |
| | | status: 'completed', |
| | | lastReceiptDate: '2024-12-14' |
| | | }, |
| | | { |
| | | orderNo: 'PO20241201001', |
| | | productCode: 'EL002', |
| | | productName: 'çµå®¹å¨ 100μF', |
| | | specification: '25V éçµè§£çµå®¹', |
| | | unit: '个', |
| | | plannedQuantity: 500, |
| | | receivedQuantity: 500, |
| | | pendingQuantity: 0, |
| | | unitPrice: 0.85, |
| | | subtotal: 425, |
| | | status: 'completed', |
| | | lastReceiptDate: '2024-12-14' |
| | | }, |
| | | { |
| | | orderNo: 'PO20241201002', |
| | | productCode: 'ME001', |
| | | productName: 'ç²¾å¯è½´æ¿', |
| | | specification: '6205-2RS æ·±æ²çè½´æ¿', |
| | | unit: '个', |
| | | plannedQuantity: 200, |
| | | receivedQuantity: 150, |
| | | pendingQuantity: 50, |
| | | unitPrice: 25.5, |
| | | subtotal: 5100, |
| | | status: 'partial', |
| | | lastReceiptDate: '2024-12-20' |
| | | }, |
| | | { |
| | | orderNo: 'PO20241201002', |
| | | productCode: 'ME002', |
| | | productName: 'ä¸éé¢èºä¸', |
| | | specification: 'M8Ã20 304ä¸éé¢', |
| | | unit: '个', |
| | | plannedQuantity: 1000, |
| | | receivedQuantity: 1000, |
| | | pendingQuantity: 0, |
| | | unitPrice: 0.8, |
| | | subtotal: 800, |
| | | status: 'completed', |
| | | lastReceiptDate: '2024-12-20' |
| | | }, |
| | | { |
| | | orderNo: 'PO20241201003', |
| | | productCode: 'SM001', |
| | | productName: 'æºè½ä¼ æå¨', |
| | | specification: 'æ¸©åº¦ä¼ æå¨ DS18B20', |
| | | unit: '个', |
| | | plannedQuantity: 300, |
| | | receivedQuantity: 0, |
| | | pendingQuantity: 300, |
| | | unitPrice: 12.5, |
| | | subtotal: 3750, |
| | | status: 'pending', |
| | | lastReceiptDate: '' |
| | | } |
| | | ]) |
| | | |
| | | // éè´ä¸å¡æ±æ»è¡¨æ°æ® |
| | | const businessSummaryData = ref([ |
| | | { |
| | | category: 'çµåå
å¨ä»¶', |
| | | productCode: 'EL001', |
| | | productName: 'çµé»å¨ 1KΩ ±5%', |
| | | specification: '1/4W 碳èçµé»', |
| | | purchaseQuantity: 5000, |
| | | purchaseAmount: 750, |
| | | avgPrice: 0.15, |
| | | purchaseCount: 8, |
| | | mainSupplier: 'æ±èåèçµåç§ææéå
¬å¸', |
| | | lastPurchaseDate: '2024-12-01' |
| | | }, |
| | | { |
| | | category: 'çµåå
å¨ä»¶', |
| | | productCode: 'EL002', |
| | | productName: 'çµå®¹å¨ 100μF', |
| | | specification: '25V éçµè§£çµå®¹', |
| | | purchaseQuantity: 2500, |
| | | purchaseAmount: 2125, |
| | | avgPrice: 0.85, |
| | | purchaseCount: 6, |
| | | mainSupplier: 'æ±èåèçµåç§ææéå
¬å¸', |
| | | lastPurchaseDate: '2024-12-01' |
| | | }, |
| | | { |
| | | category: 'æºæ¢°è®¾å¤', |
| | | productCode: 'ME001', |
| | | productName: 'ç²¾å¯è½´æ¿', |
| | | specification: '6205-2RS æ·±æ²çè½´æ¿', |
| | | purchaseQuantity: 800, |
| | | purchaseAmount: 20400, |
| | | avgPrice: 25.5, |
| | | purchaseCount: 4, |
| | | mainSupplier: '䏿µ·ç²¾å¯æºæ¢°å¶é æéå
¬å¸', |
| | | lastPurchaseDate: '2024-12-02' |
| | | }, |
| | | { |
| | | category: 'æºæ¢°è®¾å¤', |
| | | productCode: 'ME002', |
| | | productName: 'ä¸éé¢èºä¸', |
| | | specification: 'M8Ã20 304ä¸éé¢', |
| | | purchaseQuantity: 5000, |
| | | purchaseAmount: 4000, |
| | | avgPrice: 0.8, |
| | | purchaseCount: 12, |
| | | mainSupplier: '䏿µ·ç²¾å¯æºæ¢°å¶é æéå
¬å¸', |
| | | lastPurchaseDate: '2024-12-02' |
| | | }, |
| | | { |
| | | category: 'æºè½è®¾å¤', |
| | | productCode: 'SM001', |
| | | productName: 'æºè½ä¼ æå¨', |
| | | specification: 'æ¸©åº¦ä¼ æå¨ DS18B20', |
| | | purchaseQuantity: 1200, |
| | | purchaseAmount: 15000, |
| | | avgPrice: 12.5, |
| | | purchaseCount: 5, |
| | | mainSupplier: 'æ·±å³æºè½è®¾å¤æéå
¬å¸', |
| | | lastPurchaseDate: '2024-12-03' |
| | | } |
| | | ]) |
| | | |
| | | // ä¾åºåä¾è´§æ±æ»è¡¨æ°æ® |
| | | const supplierSummaryData = ref([ |
| | | { |
| | | supplierCode: 'SUP001', |
| | | supplierName: 'æ±èåèçµåç§ææéå
¬å¸', |
| | | contactPerson: 'å¼ ç»ç', |
| | | phone: '0512-88888888', |
| | | orderCount: 45, |
| | | supplyAmount: 850000, |
| | | paidAmount: 680000, |
| | | unpaidAmount: 170000, |
| | | onTimeRate: 95, |
| | | qualityRating: 4.5, |
| | | status: 'active' |
| | | }, |
| | | { |
| | | supplierCode: 'SUP002', |
| | | supplierName: '䏿µ·ç²¾å¯æºæ¢°å¶é æéå
¬å¸', |
| | | contactPerson: 'ææ»', |
| | | phone: '021-66666666', |
| | | orderCount: 32, |
| | | supplyAmount: 1200000, |
| | | paidAmount: 900000, |
| | | unpaidAmount: 300000, |
| | | onTimeRate: 88, |
| | | qualityRating: 4.2, |
| | | status: 'active' |
| | | }, |
| | | { |
| | | supplierCode: 'SUP003', |
| | | supplierName: 'æ·±å³æºè½è®¾å¤æéå
¬å¸', |
| | | contactPerson: 'çå·¥ç¨å¸', |
| | | phone: '0755-77777777', |
| | | orderCount: 28, |
| | | supplyAmount: 680000, |
| | | paidAmount: 400000, |
| | | unpaidAmount: 280000, |
| | | onTimeRate: 92, |
| | | qualityRating: 4.3, |
| | | status: 'active' |
| | | }, |
| | | { |
| | | supplierCode: 'SUP004', |
| | | supplierName: 'åäº¬æ°ææç§ææéå
¬å¸', |
| | | contactPerson: 'éå士', |
| | | phone: '010-55555555', |
| | | orderCount: 18, |
| | | supplyAmount: 320000, |
| | | paidAmount: 250000, |
| | | unpaidAmount: 70000, |
| | | onTimeRate: 85, |
| | | qualityRating: 4.0, |
| | | status: 'active' |
| | | }, |
| | | { |
| | | supplierCode: 'SUP005', |
| | | supplierName: '广å·çµåå
å¨ä»¶æéå
¬å¸', |
| | | contactPerson: 'åç»ç', |
| | | phone: '020-44444444', |
| | | orderCount: 22, |
| | | supplyAmount: 480000, |
| | | paidAmount: 200000, |
| | | unpaidAmount: 280000, |
| | | onTimeRate: 78, |
| | | qualityRating: 3.8, |
| | | status: 'warning' |
| | | } |
| | | ]) |
| | | |
| | | // æ¹æ³ |
| | | const handleReportChange = (tabName) => { |
| | | activeReport.value = tabName |
| | | handleSearch() |
| | | } |
| | | |
| | | const handleSearch = () => { |
| | | loading.value = true |
| | | // 模æAPIè°ç¨ |
| | | setTimeout(() => { |
| | | loading.value = false |
| | | ElMessage.success('æ¥è¯¢å®æ') |
| | | }, 1000) |
| | | } |
| | | |
| | | const resetSearch = () => { |
| | | Object.assign(searchForm, { |
| | | dateRange: [], |
| | | supplierId: '', |
| | | categoryId: '' |
| | | }) |
| | | handleSearch() |
| | | } |
| | | |
| | | const exportReport = () => { |
| | | ElMessage.success('导åºåè½å¼åä¸...') |
| | | } |
| | | |
| | | // ç¶æç¸å
³æ¹æ³ |
| | | const getStatusType = (status) => { |
| | | const statusMap = { |
| | | completed: 'success', |
| | | partial: 'warning', |
| | | pending: 'info' |
| | | } |
| | | return statusMap[status] || 'info' |
| | | } |
| | | |
| | | const getStatusText = (status) => { |
| | | const statusMap = { |
| | | completed: '已宿', |
| | | partial: 'é¨å宿', |
| | | pending: 'å¾
æ§è¡' |
| | | } |
| | | return statusMap[status] || 'æªç¥' |
| | | } |
| | | |
| | | const getReceiptStatusType = (status) => { |
| | | const statusMap = { |
| | | completed: 'success', |
| | | partial: 'warning', |
| | | pending: 'info' |
| | | } |
| | | return statusMap[status] || 'info' |
| | | } |
| | | |
| | | const getReceiptStatusText = (status) => { |
| | | const statusMap = { |
| | | completed: 'å·²æ¶è´§', |
| | | partial: 'é¨åæ¶è´§', |
| | | pending: 'å¾
æ¶è´§' |
| | | } |
| | | return statusMap[status] || 'æªç¥' |
| | | } |
| | | |
| | | const getSupplierStatusType = (status) => { |
| | | const statusMap = { |
| | | active: 'success', |
| | | warning: 'warning', |
| | | inactive: 'info' |
| | | } |
| | | return statusMap[status] || 'info' |
| | | } |
| | | |
| | | const getSupplierStatusText = (status) => { |
| | | const statusMap = { |
| | | active: 'æ£å¸¸åä½', |
| | | warning: 'éå
³æ³¨', |
| | | inactive: 'æååä½' |
| | | } |
| | | return statusMap[status] || 'æªç¥' |
| | | } |
| | | |
| | | onMounted(() => { |
| | | // 设置é»è®¤æ¶é´èå´ä¸ºæè¿30天 |
| | | const endDate = new Date() |
| | | const startDate = new Date() |
| | | startDate.setDate(startDate.getDate() - 30) |
| | | |
| | | searchForm.dateRange = [ |
| | | startDate.toISOString().split('T')[0], |
| | | endDate.toISOString().split('T')[0] |
| | | ] |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .app-container { |
| | | padding: 20px; |
| | | background-color: #f5f7fa; |
| | | min-height: 100vh; |
| | | } |
| | | |
| | | .page-header { |
| | | text-align: center; |
| | | margin-bottom: 20px; |
| | | padding: 20px; |
| | | background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| | | border-radius: 10px; |
| | | color: white; |
| | | } |
| | | |
| | | .page-header h2 { |
| | | margin: 0 0 10px 0; |
| | | font-size: 28px; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .page-header p { |
| | | margin: 0; |
| | | font-size: 16px; |
| | | opacity: 0.9; |
| | | } |
| | | |
| | | .report-selector { |
| | | margin-bottom: 20px; |
| | | border-radius: 8px; |
| | | } |
| | | |
| | | .tab-label { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8px; |
| | | } |
| | | |
| | | .search-card { |
| | | margin-bottom: 20px; |
| | | border-radius: 8px; |
| | | } |
| | | |
| | | .search-form { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .report-content { |
| | | border-radius: 8px; |
| | | } |
| | | |
| | | .report-section { |
| | | min-height: 400px; |
| | | } |
| | | |
| | | .section-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | padding-bottom: 15px; |
| | | border-bottom: 2px solid #e4e7ed; |
| | | } |
| | | |
| | | .section-header h3 { |
| | | margin: 0; |
| | | font-size: 20px; |
| | | font-weight: 600; |
| | | color: #303133; |
| | | } |
| | | |
| | | .summary-stats { |
| | | display: flex; |
| | | gap: 30px; |
| | | } |
| | | |
| | | .stat-item { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | } |
| | | |
| | | .stat-label { |
| | | font-size: 14px; |
| | | color: #606266; |
| | | margin-bottom: 5px; |
| | | } |
| | | |
| | | .stat-value { |
| | | font-size: 18px; |
| | | font-weight: 600; |
| | | color: #409EFF; |
| | | } |
| | | |
| | | .delay-text { |
| | | color: #F56C6C; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | :deep(.el-table) { |
| | | border-radius: 8px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | :deep(.el-table th) { |
| | | background-color: #f8f9fa; |
| | | color: #606266; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | :deep(.el-table--striped .el-table__body tr.el-table__row--striped td) { |
| | | background-color: #fafafa; |
| | | } |
| | | |
| | | :deep(.el-tabs__header) { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | :deep(.el-tabs__nav-wrap) { |
| | | padding: 0 20px; |
| | | } |
| | | |
| | | :deep(.el-tabs__item) { |
| | | font-size: 16px; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | :deep(.el-tabs__item.is-active) { |
| | | color: #409EFF; |
| | | } |
| | | |
| | | :deep(.el-rate) { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | :deep(.el-rate__text) { |
| | | margin-left: 8px; |
| | | font-size: 14px; |
| | | color: #606266; |
| | | } |
| | | </style> |
| | |
| | | <el-card class="table-card" shadow="never"> |
| | | <div class="table-header"> |
| | | <el-button type="primary" @click="openDialog('add')">æ°å¢éè´§å</el-button> |
| | | <el-button type="success" @click="handleBatchApprove">æ¹éå®¡æ ¸</el-button> |
| | | <el-button type="danger" @click="handleBatchDelete">æ¹éå é¤</el-button> |
| | | </div> |
| | | |
| | |
| | | <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="éè´§éé¢" prop="returnAmount" width="120"> |
| | | <template #default="{ row }">Â¥{{ row.returnAmount.toFixed(2) }}</template> |
| | | </el-table-column> |
| | | <el-table-column label="å建æ¶é´" prop="createTime" width="180" /> |
| | | <el-table-column label="æä½" width="200" align="center"> |
| | | <template #default="{ row }"> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- å页 --> |
| | | <pagination |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="pagination.current" |
| | | :limit="pagination.size" |
| | | @pagination="handleCurrentChange" |
| | | /> |
| | | </el-card> |
| | | |
| | | <el-dialog v-model="dialogVisible" :title="dialogType === 'add' ? 'æ°å¢éè´§å' : 'ç¼è¾éè´§å'" width="600px"> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å
³èåå·"> |
| | | <el-input v-model="formData.relatedNo" placeholder="请è¾å
¥å
³èåå·" /> |
| | | <el-select v-model="formData.relatedNo" placeholder="è¯·éæ©å
³èåå·" style="width: 100%"> |
| | | <el-option v-for="item in onList" :key="item.arrivalNo" :label="item.arrivalNo" :value="item.arrivalNo" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ä¾åºååç§°"> |
| | | <el-input v-model="formData.supplierName" placeholder="请è¾å
¥ä¾åºååç§°" /> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive } from 'vue' |
| | | import { ref, reactive,onMounted } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import Pagination from '@/components/PIMTable/Pagination.vue' |
| | | import {listPage,add,update,del} from "@/api/procurementManagement/returnManagement.js" |
| | | import {listPageCopy} from "@/api/procurementManagement/arrivalManagement.js" |
| | | |
| | | onMounted(() => { |
| | | getList() |
| | | list() |
| | | }) |
| | | const onList = ref([]) |
| | | const list = () =>{ |
| | | listPageCopy({current:-1}).then(res=>{ |
| | | if(res.code === 200){ |
| | | onList.value = res.data.records |
| | | } |
| | | }) |
| | | } |
| | | const tableData = ref([]) |
| | | const getList = () => { |
| | | loading.value = true |
| | | listPage({...searchForm,...pagination}).then(res =>{ |
| | | if(res.code === 200){ |
| | | tableData.value = res.data.records |
| | | console.log(tableData.value) |
| | | total.value = res.data.total |
| | | loading.value = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const loading = ref(false) |
| | | const dialogVisible = ref(false) |
| | | const dialogType = ref('add') |
| | | const selectedRows = ref([]) |
| | | |
| | | |
| | | const pagination = reactive({ |
| | | current: 1, |
| | | size: 10 |
| | | }) |
| | | |
| | | const total = ref(0) |
| | | |
| | | const searchForm = reactive({ |
| | | returnNo: '', |
| | |
| | | relatedNo: '', |
| | | supplierName: '', |
| | | returnReason: '', |
| | | remark: '' |
| | | remark: '', |
| | | status: '' |
| | | }) |
| | | |
| | | const mockData = [ |
| | | { |
| | | id: 1, |
| | | returnNo: 'RT20241201001', |
| | | relatedNo: 'PO20241201001', |
| | | returnType: 'purchase', |
| | | supplierName: 'ä¾åºåA', |
| | | status: 'approved', |
| | | returnAmount: 500.00, |
| | | createTime: '2025-12-01 17:30:00', |
| | | returnReason: 'è´¨éé®é¢', |
| | | remark: 'åååå¨è´¨éé®é¢' |
| | | } |
| | | ] |
| | | |
| | | const tableData = ref([...mockData]) |
| | | |
| | | const getReturnTypeText = (type) => { |
| | | const typeMap = { purchase: 'éè´éè´§', quality: 'è´¨æ£éè´§' } |
| | |
| | | |
| | | const handleSearch = () => { |
| | | loading.value = true |
| | | setTimeout(() => { loading.value = false }, 500) |
| | | getList() |
| | | } |
| | | |
| | | const resetSearch = () => { |
| | |
| | | |
| | | const openDialog = (type, row = {}) => { |
| | | dialogType.value = type |
| | | obj.id = row.id |
| | | if (type === 'edit' && row.id) { |
| | | Object.assign(formData, { |
| | | returnType: row.returnType, |
| | | relatedNo: row.relatedNo, |
| | | supplierName: row.supplierName, |
| | | returnReason: row.returnReason, |
| | | remark: row.remark |
| | | remark: row.remark, |
| | | status: row.status |
| | | }) |
| | | } else { |
| | | Object.assign(formData, { |
| | |
| | | relatedNo: '', |
| | | supplierName: '', |
| | | returnReason: '', |
| | | remark: '' |
| | | remark: '', |
| | | status: 'pending' |
| | | }) |
| | | } |
| | | dialogVisible.value = true |
| | | } |
| | | |
| | | const obj = reactive({ |
| | | id: '' |
| | | }) |
| | | const handleSubmit = () => { |
| | | if (dialogType.value === 'add') { |
| | | const newReturn = { |
| | | id: Date.now(), |
| | | returnNo: `RT${Date.now()}`, |
| | | relatedNo: formData.relatedNo, |
| | | returnType: formData.returnType, |
| | | supplierName: formData.supplierName, |
| | | status: 'pending', |
| | | returnAmount: 0, |
| | | createTime: new Date().toLocaleString(), |
| | | returnReason: formData.returnReason, |
| | | remark: formData.remark |
| | | formData.status = 'pending' |
| | | add(formData).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('æ°å¢æå') |
| | | getList() |
| | | } |
| | | tableData.value.unshift(newReturn) |
| | | ElMessage.success('æ°å¢æå') |
| | | }) |
| | | }else{ |
| | | update({...formData,...obj}).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('ä¿®æ¹æå') |
| | | getList() |
| | | } |
| | | }) |
| | | } |
| | | dialogVisible.value = false |
| | | } |
| | | |
| | | const handleApprove = (row) => { |
| | | row.status = 'approved' |
| | | ElMessage.success('å®¡æ ¸éè¿') |
| | | update(row).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('å®¡æ ¸æå') |
| | | getList() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleDelete = (row) => { |
| | |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id) |
| | | if (index !== -1) { |
| | | tableData.value.splice(index, 1) |
| | | ElMessage.success('å 餿å') |
| | | } |
| | | let ids = [row.id] |
| | | del(ids).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('å 餿å') |
| | | getList() |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | const handleBatchApprove = () => { |
| | | ElMessage.success('æ¹éå®¡æ ¸æå') |
| | | } |
| | | |
| | | const handleBatchDelete = () => { |
| | | ElMessage.success('æ¹éå 餿å') |
| | | let ids = selectedRows.value.map(item => item.id) |
| | | del(ids).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('æ¹éå 餿å') |
| | | getList() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleSelectionChange = (rows) => { |
| | |
| | | |
| | | <!-- 顶鍿 颿 --> |
| | | <div class="dashboard-header"> |
| | | <div class="factory-name">{{ userStore.currentFactoryName }}</div> |
| | | </div> |
| | | |
| | | <!-- 主è¦å
容åºå --> |
| | |
| | | import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue' |
| | | import autofit from 'autofit.js' |
| | | import Echarts from "@/components/Echarts/echarts.vue"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import { |
| | | analysisCustomerContractAmounts, getAmountHalfYear, |
| | | homeTodos, |
| | |
| | | |
| | | // å
¨å±ç¸å
³ç¶æ |
| | | const isFullscreen = ref(false); |
| | | |
| | | // ç¨æ·store |
| | | const userStore = useUserStore() |
| | | |
| | | // ååºå¼æ°æ® |
| | | const currentTime = ref('') |
| | |
| | | // 使ç¨nextTickç¡®ä¿DOMå®å
¨æ¸²æåååå§åå¾è¡¨ |
| | | nextTick(() => { |
| | | // åå§åautofitèªéåº |
| | | autofit.init({ dh: 1440, dw: 2560, el: '.data-dashboard', resize: true }, false) |
| | | autofit.init({ dh: 1080, dw: 1920, el: '.data-dashboard', resize: true }, false) |
| | | |
| | | // æ·»å èªå¨æ»å¨å¨ç»ææ - 客æ·ä¿¡æ¯å表 |
| | | const contractList = refContractList.value |
| | |
| | | position: relative; |
| | | width: 100%; |
| | | height: 100%; |
| | | overflow: hidden; |
| | | background-image: url("@/assets/BI/backImage@2x.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .factory-name { |
| | | font-weight: 600; |
| | | font-size: 52px; |
| | | color: #FFFFFF; |
| | | top: 32px; |
| | | position: absolute; |
| | | } |
| | | |
| | | .fullscreen-btn { |
| | |
| | | <pagination |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="pagination.currentPage" |
| | | :limit="pagination.pageSize" |
| | | :page="pagination.current" |
| | | :limit="pagination.size" |
| | | @pagination="handleCurrentChange" |
| | | /> |
| | | </el-card> |
| | |
| | | } |
| | | |
| | | const handleCurrentChange = (val) => { |
| | | pagination.currentPage = val.page |
| | | pagination.pageSize = val.limit |
| | | pagination.current = val.page |
| | | pagination.size = val.limit |
| | | } |
| | | </script> |
| | | |