Merge branch 'dev_New' into dev_天津军泰伟业
| | |
| | | }) |
| | | } |
| | | |
| | | // å®åå¤ç-éä»¶å表 |
| | | export function afterSalesServiceFileListPage(query) { |
| | | return request({ |
| | | url: '/afterSalesService/file/listPage', |
| | | method: 'get', |
| | | params: query, |
| | | }) |
| | | } |
| | | // å®åå¤ç-éä»¶æ°å¢ |
| | | export function afterSalesServiceFileAdd(data) { |
| | | return request({ |
| | | url: '/afterSalesService/file/add', |
| | | method: 'post', |
| | | data, |
| | | }) |
| | | } |
| | | // å®åå¤ç-éä»¶å é¤ |
| | | export function afterSalesServiceFileDel(ids) { |
| | | return request({ |
| | | url: '/afterSalesService/file/del', |
| | | method: 'delete', |
| | | data: ids, |
| | | }) |
| | | } |
| | | |
| | | // å®åå¤ç-维修记å½å表 |
| | | export function afterSalesServiceRepairListPage(query) { |
| | | return request({ |
| | | url: '/afterSalesService/repair/listPage', |
| | | method: 'get', |
| | | params: query, |
| | | }) |
| | | } |
| | | |
| | | // 临æå®å管ç-å页æ¥è¯¢ |
| | | export function expiryAfterSalesListPage(query) { |
| | | return request({ |
| | |
| | | // é¦é¡µæ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å·¥åæ§è¡æçåæ |
| | | export const workOrderEfficiencyAnalysis = (query) => { |
| | | // å·¥åºæ°æ®ç产ç»è®¡æç» |
| | | export const processDataProductionStatistics = (params) => { |
| | | return request({ |
| | | url: "/home/workOrderEfficiencyAnalysis", |
| | | url: "/home/processDataProductionStatistics", |
| | | method: "get", |
| | | params: query, |
| | | params, |
| | | }); |
| | | }; |
| | | |
| | | // è´¨éç»è®¡ |
| | | export const qualityInspectionStatistics = (params) => { |
| | | return request({ |
| | | url: "/home/qualityInspectionStatistics", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | }; |
| | | |
| | |
| | | method: "get", |
| | | }); |
| | | }; |
| | | // è´¨æ£åæ |
| | | export const qualityStatistics = () => { |
| | | // è´¨æ£åæï¼å¯ä¼ dateType: 1å¨ 2æ 3å£åº¦ï¼ |
| | | export const qualityStatistics = (params) => { |
| | | return request({ |
| | | url: "/home/qualityStatistics", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | }; |
| | | |
| | | // å·¥åæ§è¡æçåæï¼dateType: 1å¨ 2æ 3å£åº¦ï¼ |
| | | export const workOrderEfficiencyAnalysis = (params) => { |
| | | return request({ |
| | | url: "/home/workOrderEfficiencyAnalysis", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | }; |
| | | |
| | | // çäº§æ ¸ç®åæ |
| | | export const productionAccountingAnalysis = (query) => { |
| | | return request({ |
| | |
| | | export const getProgressStatistics = () => { |
| | | return request({ |
| | | url: "/home/progressStatistics", |
| | | method: "get", |
| | | }); |
| | | }; |
| | | |
| | | // è®¢åæ°éç»è®¡ï¼çäº§è®¢åæ°ãå·²å®æè®¢åæ°ãå¾
çäº§è®¢åæ°ï¼ |
| | | export const orderCount = () => { |
| | | return request({ |
| | | url: "/home/orderCount", |
| | | method: "get", |
| | | }); |
| | | }; |
| | |
| | | }); |
| | | }; |
| | | |
| | | // å·¥åºäº§åºåæï¼dateType: 1å¨ 2æ 3å£åº¦ï¼ |
| | | export const processOutputAnalysis = (params) => { |
| | | return request({ |
| | | url: "/home/processOutputAnalysis", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | }; |
| | | |
| | | // åææéè´éé¢å æ¯ |
| | | export const rawMaterialPurchaseAmountRatio = () => { |
| | | return request({ |
| | |
| | | }); |
| | | }; |
| | | |
| | | // æå
¥äº§åºåæ |
| | | export const inputOutputAnalysis = (params) => { |
| | | return request({ |
| | | url: "/home/inputOutputAnalysis", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | }; |
| | | |
| | | // 产åå¨è½¬å¤©æ° |
| | | export const productTurnoverDays = () => { |
| | | return request({ |
| | |
| | | import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue' |
| | | import * as echarts from 'echarts' |
| | | |
| | | const emit = defineEmits(['finished']) |
| | | const emit = defineEmits(['finished', 'click']) |
| | | |
| | | // Props |
| | | const props = defineProps({ |
| | |
| | | }, |
| | | dataset: { |
| | | type: Object, |
| | | default: () => {} |
| | | default: () => { } |
| | | }, |
| | | xAxis: { |
| | | type: Array, |
| | |
| | | type: Object, |
| | | default: () => ({}) |
| | | }, |
| | | option: { |
| | | type: Object, |
| | | default: () => ({}) |
| | | }, |
| | | option: { |
| | | type: Object, |
| | | default: () => ({}) |
| | | }, |
| | | }) |
| | | |
| | | import { watch } from 'vue' |
| | |
| | | chartInstance = echarts.init(chartRef.value) |
| | | finishedHandler = () => emit('finished') |
| | | chartInstance.on('finished', finishedHandler) |
| | | chartInstance.on('click', (params) => { |
| | | emit('click', params) |
| | | }) |
| | | renderChart() |
| | | // setOption åè¡¥ä¸æ¬¡ resizeï¼ç¡®ä¿é¦å±å°ºå¯¸æ£ç¡® |
| | | nextTick(() => { |
| | |
| | | |
| | | // Methods |
| | | function generateChart(option) { |
| | | const copiedOption = option |
| | | |
| | | const copiedOption = option |
| | | |
| | | if (copiedOption.series && copiedOption.series.length > 0) { |
| | | copiedOption.series.forEach((s, index) => { |
| | | if (s.type === 'line' && props.lineColors.length) { |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | chartInstance.setOption(copiedOption) |
| | | } |
| | | |
| | |
| | | tooltip: props.tooltip, |
| | | visualMap: Object.keys(props.visualMap).length ? props.visualMap : undefined, |
| | | } |
| | | |
| | | |
| | | chartInstance.clear() |
| | | generateChart(option) |
| | | } |
| | |
| | | |
| | | // Watch all reactive props that affect the chart |
| | | watch( |
| | | () => [props.xAxis, props.yAxis, props.series, props.legend, props.tooltip, props.visualMap], |
| | | () => { |
| | | // 妿é¦å±è¿æ²¡åå§åæåï¼çå¾
å®¹å¨ ready å忏²æ |
| | | if (!chartInstance) { |
| | | initChartWhenReady() |
| | | return |
| | | } |
| | | renderChart() |
| | | // æ°æ®åååè¡¥ä¸æ¬¡ resizeï¼é¿å
å¸å±åå导è´çåç§» |
| | | nextTick(() => { |
| | | if (chartInstance) chartInstance.resize() |
| | | }) |
| | | }, |
| | | { deep: true, immediate: true } |
| | | () => [props.xAxis, props.yAxis, props.series, props.legend, props.tooltip, props.visualMap], |
| | | () => { |
| | | // 妿é¦å±è¿æ²¡åå§åæåï¼çå¾
å®¹å¨ ready å忏²æ |
| | | if (!chartInstance) { |
| | | initChartWhenReady() |
| | | return |
| | | } |
| | | renderChart() |
| | | // æ°æ®åååè¡¥ä¸æ¬¡ resizeï¼é¿å
å¸å±åå导è´çåç§» |
| | | nextTick(() => { |
| | | if (chartInstance) chartInstance.resize() |
| | | }) |
| | | }, |
| | | { deep: true, immediate: true } |
| | | ) |
| | | </script> |
| | |
| | | ></PIMTable> |
| | | </div> |
| | | <form-dia ref="formDia" @close="handleQuery"></form-dia> |
| | | <FileListDialog |
| | | ref="fileListRef" |
| | | v-model="fileListDialogVisible" |
| | | title="å®åéä»¶" |
| | | :show-upload-button="true" |
| | | :show-delete-button="true" |
| | | :upload-method="handleFileUpload" |
| | | :delete-method="handleFileDelete" |
| | | /> |
| | | <el-dialog |
| | | v-model="repairDialogVisible" |
| | | title="维修记å½" |
| | | width="700px" |
| | | destroy-on-close |
| | | @close="repairRecordList = []" |
| | | > |
| | | <el-table |
| | | :data="repairRecordList" |
| | | border |
| | | v-loading="repairRecordLoading" |
| | | max-height="400" |
| | | > |
| | | <el-table-column type="index" label="åºå·" width="55" align="center" /> |
| | | <el-table-column label="ç»´ä¿®æ¥æ" prop="maintenanceTime" min-width="120" show-overflow-tooltip> |
| | | <template #default="{ row }"> |
| | | {{ row.maintenanceTime || row.repairTime || '-' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="维修人" prop="maintenanceName" min-width="100" show-overflow-tooltip> |
| | | <template #default="{ row }"> |
| | | {{ row.maintenanceName || row.repairName || '-' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç»´ä¿®ç»æ" prop="maintenanceResult" min-width="180" show-overflow-tooltip /> |
| | | </el-table> |
| | | <template #footer> |
| | | <el-button @click="repairDialogVisible = false">å
³é</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {onMounted, ref, getCurrentInstance, nextTick} from "vue"; |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue"; |
| | | import FormDia from "@/views/customerService/afterSalesHandling/components/formDia.vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import {afterSalesServiceDelete, afterSalesServiceListPage} from "@/api/customerService/index.js"; |
| | | import FileListDialog from "@/components/Dialog/FileListDialog.vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import request from "@/utils/request"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { |
| | | afterSalesServiceDelete, |
| | | afterSalesServiceListPage, |
| | | afterSalesServiceFileListPage, |
| | | afterSalesServiceFileAdd, |
| | | afterSalesServiceFileDel, |
| | | afterSalesServiceRepairListPage, |
| | | } from "@/api/customerService/index.js"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore() |
| | |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: 'right', |
| | | width: 120, |
| | | width: 240, |
| | | operation: [ |
| | | { |
| | | name: "å¤ç", |
| | |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openForm("view", row); |
| | | }, |
| | | }, |
| | | // TODO ä¸ºåæ¥åæ·»å ç |
| | | { |
| | | name: "éä»¶", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openFilesFormDia(row); |
| | | }, |
| | | }, |
| | | // TODO ä¸ºåæ¥åæ·»å ç |
| | | { |
| | | name: "维修记å½", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openRepairDialog(row); |
| | | }, |
| | | }, |
| | | ], |
| | |
| | | selectedRows.value = selection; |
| | | }; |
| | | const formDia = ref() |
| | | const fileListRef = ref(null) |
| | | const fileListDialogVisible = ref(false) |
| | | const currentFileRow = ref(null) |
| | | const repairDialogVisible = ref(false) |
| | | const repairRecordList = ref([]) |
| | | const repairRecordLoading = ref(false) |
| | | |
| | | // æå¼ç»´ä¿®è®°å½å¼¹æ¡ |
| | | const openRepairDialog = async (row) => { |
| | | repairDialogVisible.value = true |
| | | repairRecordLoading.value = true |
| | | repairRecordList.value = [] |
| | | try { |
| | | const res = await afterSalesServiceRepairListPage({ |
| | | afterSalesServiceId: row.id, |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | if (res.code === 200 && res.data?.records) { |
| | | repairRecordList.value = res.data.records |
| | | } |
| | | } catch (error) { |
| | | proxy.$modal.msgError("è·å维修记å½å¤±è´¥") |
| | | } finally { |
| | | repairRecordLoading.value = false |
| | | } |
| | | } |
| | | |
| | | // æå¼éä»¶å¼¹æ¡----- TODOï¼æ¥å£æ¯æ²¡æå¯¹æ¥çï¼éè¦æ°å¢æ¥å£ï¼ä¸ºåæ¥åæ·»å ç |
| | | const openFilesFormDia = async (row) => { |
| | | currentFileRow.value = row |
| | | try { |
| | | const res = await afterSalesServiceFileListPage({ |
| | | afterSalesServiceId: row.id, |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | if (res.code === 200 && fileListRef.value) { |
| | | const fileList = (res.data?.records || []).map((item) => ({ |
| | | name: item.name || item.fileName, |
| | | url: item.url || item.fileUrl, |
| | | id: item.id, |
| | | ...item, |
| | | })) |
| | | fileListRef.value.open(fileList) |
| | | fileListDialogVisible.value = true |
| | | } else { |
| | | fileListRef.value?.open([]) |
| | | fileListDialogVisible.value = true |
| | | } |
| | | } catch (error) { |
| | | proxy.$modal.msgError("è·åéä»¶å表失败") |
| | | fileListRef.value?.open([]) |
| | | fileListDialogVisible.value = true |
| | | } |
| | | } |
| | | |
| | | // ä¸ä¼ éä»¶ |
| | | const handleFileUpload = async () => { |
| | | if (!currentFileRow.value) { |
| | | proxy.$modal.msgWarning("请å
éæ©æ°æ®") |
| | | return |
| | | } |
| | | return new Promise((resolve) => { |
| | | const input = document.createElement("input") |
| | | input.type = "file" |
| | | input.style.display = "none" |
| | | input.onchange = async (e) => { |
| | | const file = e.target.files[0] |
| | | if (!file) { |
| | | resolve(null) |
| | | return |
| | | } |
| | | try { |
| | | const formData = new FormData() |
| | | formData.append("file", file) |
| | | const uploadRes = await request({ |
| | | url: "/file/upload", |
| | | method: "post", |
| | | data: formData, |
| | | headers: { |
| | | "Content-Type": "multipart/form-data", |
| | | Authorization: `Bearer ${getToken()}`, |
| | | }, |
| | | }) |
| | | if (uploadRes.code === 200) { |
| | | const fileData = { |
| | | afterSalesServiceId: currentFileRow.value.id, |
| | | name: uploadRes.data?.originalName || file.name, |
| | | url: uploadRes.data?.tempPath || uploadRes.data?.url, |
| | | } |
| | | const saveRes = await afterSalesServiceFileAdd(fileData) |
| | | if (saveRes.code === 200) { |
| | | proxy.$modal.msgSuccess("æä»¶ä¸ä¼ æå") |
| | | const listRes = await afterSalesServiceFileListPage({ |
| | | afterSalesServiceId: currentFileRow.value.id, |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | if (listRes.code === 200 && fileListRef.value) { |
| | | const fileList = (listRes.data?.records || []).map((item) => ({ |
| | | name: item.name || item.fileName, |
| | | url: item.url || item.fileUrl, |
| | | id: item.id, |
| | | ...item, |
| | | })) |
| | | fileListRef.value.setList(fileList) |
| | | } |
| | | resolve({ name: fileData.name, url: fileData.url, id: saveRes.data?.id }) |
| | | } else { |
| | | proxy.$modal.msgError(saveRes.msg || "æä»¶ä¿å失败") |
| | | resolve(null) |
| | | } |
| | | } else { |
| | | proxy.$modal.msgError(uploadRes.msg || "æä»¶ä¸ä¼ 失败") |
| | | resolve(null) |
| | | } |
| | | } catch (err) { |
| | | proxy.$modal.msgError("æä»¶ä¸ä¼ 失败") |
| | | resolve(null) |
| | | } finally { |
| | | document.body.removeChild(input) |
| | | } |
| | | } |
| | | document.body.appendChild(input) |
| | | input.click() |
| | | }) |
| | | } |
| | | |
| | | // å é¤éä»¶ |
| | | const handleFileDelete = async (row) => { |
| | | try { |
| | | const res = await afterSalesServiceFileDel([row.id]) |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | if (currentFileRow.value && fileListRef.value) { |
| | | const listRes = await afterSalesServiceFileListPage({ |
| | | afterSalesServiceId: currentFileRow.value.id, |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | if (listRes.code === 200) { |
| | | const fileList = (listRes.data?.records || []).map((item) => ({ |
| | | name: item.name || item.fileName, |
| | | url: item.url || item.fileUrl, |
| | | id: item.id, |
| | | ...item, |
| | | })) |
| | | fileListRef.value.setList(fileList) |
| | | } |
| | | } |
| | | } else { |
| | | proxy.$modal.msgError(res.msg || "å é¤å¤±è´¥") |
| | | return false |
| | | } |
| | | } catch (error) { |
| | | proxy.$modal.msgError("å é¤å¤±è´¥") |
| | | return false |
| | | } |
| | | } |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- æå¡è¯ä»·æ¦è§ï¼æ¨¡æåå·¥ä¸ç»©è¯å --> |
| | | <el-row :gutter="16" class="mb16"> |
| | | <el-col :span="8"> |
| | | <el-card shadow="never"> |
| | | <div class="kpi-title">æ¬æå¹³åè¯å</div> |
| | | <div class="kpi-value"> |
| | | {{ overallAvgScore.toFixed(1) }} |
| | | <span class="kpi-unit">å</span> |
| | | </div> |
| | | <el-rate v-model="overallAvgScore" disabled show-score score-template="{value} / 5" /> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-card shadow="never"> |
| | | <div class="kpi-title">å·²è¯ä»·ç»´ä¿®å·¥å</div> |
| | | <div class="kpi-value"> |
| | | {{ ratedCount }} |
| | | <span class="kpi-unit">å</span> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-card shadow="never"> |
| | | <div class="kpi-title">å¾
è¯ä»·ç»´ä¿®å·¥å</div> |
| | | <div class="kpi-value kpi-warning"> |
| | | {{ pendingCount }} |
| | | <span class="kpi-unit">å</span> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- æ¥è¯¢æ¡ä»¶ï¼ç®¡çåæå·¥ç¨å¸ / å®¢æ· / æ¶é´è¿½æº¯è¯ä»· --> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">维修工ç¨å¸ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.engineerName" |
| | | placeholder="请è¾å
¥å·¥ç¨å¸å§å" |
| | | style="width: 180px" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | |
| | | <span class="search_title ml10">客æ·åç§°ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.customerName" |
| | | placeholder="请è¾å
¥å®¢æ·åç§°" |
| | | style="width: 180px" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | |
| | | <span class="search_title ml10">宿æ¶é´ï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.dateRange" |
| | | type="daterange" |
| | | range-separator="è³" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | /> |
| | | |
| | | <span class="search_title ml10">è¯ä»·ç¶æï¼</span> |
| | | <el-select |
| | | v-model="searchForm.status" |
| | | placeholder="è¯·éæ©" |
| | | style="width: 140px" |
| | | clearable |
| | | > |
| | | <el-option label="å¾
è¯ä»·" value="pending" /> |
| | | <el-option label="å·²è¯ä»·" value="rated" /> |
| | | </el-select> |
| | | |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button icon="Download" @click="handleExport"> |
| | | 导åºè¯ä»·ç»è®¡ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- ç»´ä¿®è¯ä»·åè¡¨ï¼æ¨¡æâç»´ä¿®å®æå触åè¯ä»·âåºæ¯ --> |
| | | <div class="table_list"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | style="width: 100%" |
| | | height="calc(100vh - 24em)" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | > |
| | | <el-table-column type="index" label="åºå·" width="60" align="center" /> |
| | | <el-table-column prop="orderNo" label="维修工åå·" width="160" show-overflow-tooltip /> |
| | | <el-table-column prop="deviceName" label="设å¤åç§°" width="160" show-overflow-tooltip /> |
| | | <el-table-column prop="customerName" label="客æ·åç§°" width="180" show-overflow-tooltip /> |
| | | <el-table-column prop="engineerName" label="维修工ç¨å¸" width="120" /> |
| | | <el-table-column prop="completeTime" label="ç»´ä¿®å®ææ¶é´" width="180" /> |
| | | <el-table-column prop="score" label="æçº§è¯å" width="140" align="center"> |
| | | <template #default="scope"> |
| | | <el-rate v-if="scope.row.score" v-model="scope.row.score" disabled /> |
| | | <span v-else>-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="status" label="è¯ä»·ç¶æ" width="100" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag |
| | | :type="scope.row.status === 'rated' ? 'success' : 'warning'" |
| | | size="small" |
| | | > |
| | | {{ scope.row.status === 'rated' ? 'å·²è¯ä»·' : 'å¾
è¯ä»·' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="feedback" label="客æ·åé¦" show-overflow-tooltip /> |
| | | <el-table-column label="æä½" width="160" align="center" fixed="right"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | v-if="scope.row.status === 'pending'" |
| | | type="primary" |
| | | link |
| | | size="small" |
| | | @click="openEvaluate(scope.row)" |
| | | > |
| | | å»è¯ä»· |
| | | </el-button> |
| | | <el-button |
| | | v-else |
| | | type="primary" |
| | | link |
| | | size="small" |
| | | @click="openEvaluate(scope.row)" |
| | | > |
| | | æ¥ç / ä¿®æ¹è¯ä»· |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- è¯ä»·å¼¹æ¡ï¼æ¨¡æâç»´ä¿®å®æåå¼¹åºå®¢æ·ç«¯è¯ä»·â --> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | :title="dialogTitle" |
| | | width="520px" |
| | | destroy-on-close |
| | | > |
| | | <div class="dialog-order-info" v-if="currentOrder"> |
| | | <div>维修工åï¼{{ currentOrder.orderNo }}</div> |
| | | <div>设å¤åç§°ï¼{{ currentOrder.deviceName }}</div> |
| | | <div>维修工ç¨å¸ï¼{{ currentOrder.engineerName }}</div> |
| | | </div> |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="100px" |
| | | > |
| | | <el-form-item label="æçº§è¯åï¼" prop="score"> |
| | | <el-rate v-model="form.score" :max="5" /> |
| | | </el-form-item> |
| | | <el-form-item label="æååé¦ï¼" prop="feedback"> |
| | | <el-input |
| | | v-model="form.feedback" |
| | | type="textarea" |
| | | :rows="4" |
| | | placeholder="请填åå¯¹æ¬æ¬¡ç»´ä¿®æå¡çè¯ä»·ï¼å¦ååºé度ãä¸ä¸ç¨åº¦ãæ²éä½éªç" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="handleSubmit">æ 交 è¯ ä»·</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed } from "vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | | // 模æç»´ä¿®å·¥å + 客æ·è¯ä»·æ°æ® |
| | | const rawOrders = ref([ |
| | | { |
| | | id: 1, |
| | | orderNo: "WX-2024-1201-001", |
| | | deviceName: "ç©ºåæº A1 å·", |
| | | customerName: "ååçµåç§ææéå
¬å¸", |
| | | engineerName: "çå¸å
", |
| | | completeTime: "2024-12-01 10:30:00", |
| | | completeDate: "2024-12-01", |
| | | status: "rated", |
| | | score: 5, |
| | | feedback: "ç»´ä¿®é常ä¸ä¸ï¼ååºé度快ï¼ç°åºè§£éä¹å¾æ¸
æ°ï¼æ»¡æã", |
| | | }, |
| | | { |
| | | id: 2, |
| | | orderNo: "WX-2024-1201-002", |
| | | deviceName: "æ³¨å¡æº B3 å·", |
| | | customerName: "åä¸ç²¾å¯å¶é æéå
¬å¸", |
| | | engineerName: "æå¸å
", |
| | | completeTime: "2024-12-01 15:20:00", |
| | | completeDate: "2024-12-01", |
| | | status: "rated", |
| | | score: 4, |
| | | feedback: "æ´ä½è¿ä¸éï¼å°±æ¯å°åºæ¶é´ç¨å¾®é¿äºä¸ç¹ï¼å¸æåé¢è½åå¿«ä¸äºã", |
| | | }, |
| | | { |
| | | id: 3, |
| | | orderNo: "WX-2024-1202-003", |
| | | deviceName: "çæ¥æºå¨äºº C2 å·", |
| | | customerName: "è¥¿åæ°è½æºç§æè¡ä»½", |
| | | engineerName: "å¼ å¸å
", |
| | | completeTime: "2024-12-02 11:05:00", |
| | | completeDate: "2024-12-02", |
| | | status: "pending", |
| | | score: null, |
| | | feedback: "", |
| | | }, |
| | | { |
| | | id: 4, |
| | | orderNo: "WX-2024-1203-005", |
| | | deviceName: "æµè¯å° D1 å·", |
| | | customerName: "åæ¹æ±½è½¦é¶é¨ä»¶æéå
¬å¸", |
| | | engineerName: "çå¸å
", |
| | | completeTime: "2024-12-03 09:50:00", |
| | | completeDate: "2024-12-03", |
| | | status: "pending", |
| | | score: null, |
| | | feedback: "", |
| | | }, |
| | | ]); |
| | | |
| | | // æ¥è¯¢è¡¨å |
| | | const searchForm = reactive({ |
| | | engineerName: "", |
| | | customerName: "", |
| | | dateRange: [], |
| | | status: "", |
| | | }); |
| | | |
| | | // åè¡¨æ°æ® |
| | | const tableData = ref([...rawOrders.value]); |
| | | |
| | | // ç»è®¡ï¼æ´ä½è¯åãå·²è¯ä»· / å¾
è¯ä»·æ°é |
| | | const ratedOrders = computed(() => |
| | | rawOrders.value.filter((o) => o.status === "rated" && o.score) |
| | | ); |
| | | |
| | | const overallAvgScore = computed(() => { |
| | | if (!ratedOrders.value.length) return 0; |
| | | const sum = ratedOrders.value.reduce((acc, cur) => acc + (cur.score || 0), 0); |
| | | return sum / ratedOrders.value.length; |
| | | }); |
| | | |
| | | const ratedCount = computed(() => ratedOrders.value.length); |
| | | const pendingCount = computed( |
| | | () => rawOrders.value.filter((o) => o.status === "pending").length |
| | | ); |
| | | |
| | | // æ¥è¯¢ / éç½® |
| | | const recomputeTable = () => { |
| | | const list = rawOrders.value.filter((item) => { |
| | | if ( |
| | | searchForm.engineerName && |
| | | !item.engineerName.includes(searchForm.engineerName.trim()) |
| | | ) { |
| | | return false; |
| | | } |
| | | if ( |
| | | searchForm.customerName && |
| | | !item.customerName.includes(searchForm.customerName.trim()) |
| | | ) { |
| | | return false; |
| | | } |
| | | if (searchForm.status && item.status !== searchForm.status) { |
| | | return false; |
| | | } |
| | | if (Array.isArray(searchForm.dateRange) && searchForm.dateRange.length === 2) { |
| | | const [start, end] = searchForm.dateRange; |
| | | if (item.completeDate < start || item.completeDate > end) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | }); |
| | | tableData.value = list; |
| | | }; |
| | | |
| | | const handleQuery = () => { |
| | | recomputeTable(); |
| | | }; |
| | | |
| | | const resetSearch = () => { |
| | | searchForm.engineerName = ""; |
| | | searchForm.customerName = ""; |
| | | searchForm.dateRange = []; |
| | | searchForm.status = ""; |
| | | recomputeTable(); |
| | | }; |
| | | |
| | | // 导åºï¼æ¼ç¤ºï¼ |
| | | const handleExport = () => { |
| | | ElMessage.success("å½å为æ¼ç¤ºé¡µé¢ï¼è¯ä»·å¯¼åºåè½æªå¯¹æ¥å®é
æ¥å£"); |
| | | }; |
| | | |
| | | // è¯ä»·å¼¹æ¡ |
| | | const dialogVisible = ref(false); |
| | | const dialogTitle = ref("ç»´ä¿®æå¡è¯ä»·"); |
| | | const currentOrder = ref(null); |
| | | const formRef = ref(null); |
| | | const form = reactive({ |
| | | score: 0, |
| | | feedback: "", |
| | | }); |
| | | |
| | | const rules = { |
| | | score: [{ required: true, message: "è¯·éæ©æçº§è¯å", trigger: "change" }], |
| | | feedback: [{ required: true, message: "请填åæååé¦", trigger: "blur" }], |
| | | }; |
| | | |
| | | // æå¼è¯ä»·ï¼æ¨¡æâç»´ä¿®å®æç¡®è®¤åå¼¹åºè¯ä»·å¼¹æ¡â |
| | | const openEvaluate = (row) => { |
| | | currentOrder.value = row; |
| | | dialogTitle.value = |
| | | row.status === "pending" ? "ç»´ä¿®æå¡è¯ä»·" : "æ¥ç / ä¿®æ¹è¯ä»·"; |
| | | form.score = row.score || 0; |
| | | form.feedback = row.feedback || ""; |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // æäº¤è¯ä»·ï¼åæ¥å°æ¬å°âåå·¥ä¸ç»©ç»è®¡â |
| | | const handleSubmit = () => { |
| | | if (!formRef.value) return; |
| | | formRef.value.validate((valid) => { |
| | | if (!valid || !currentOrder.value) return; |
| | | |
| | | const target = rawOrders.value.find((o) => o.id === currentOrder.value.id); |
| | | if (target) { |
| | | target.score = form.score; |
| | | target.feedback = form.feedback; |
| | | target.status = "rated"; |
| | | } |
| | | |
| | | ElMessage.success("è¯ä»·æäº¤æåï¼å·²åæ¥è³åå·¥ä¸ç»©ç»è®¡"); |
| | | dialogVisible.value = false; |
| | | recomputeTable(); |
| | | }); |
| | | }; |
| | | |
| | | // åå§åå表 |
| | | recomputeTable(); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .mb16 { |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .kpi-title { |
| | | font-size: 13px; |
| | | color: #909399; |
| | | } |
| | | |
| | | .kpi-value { |
| | | margin-top: 6px; |
| | | font-size: 24px; |
| | | font-weight: 600; |
| | | color: #303133; |
| | | } |
| | | |
| | | .kpi-unit { |
| | | font-size: 12px; |
| | | margin-left: 4px; |
| | | color: #909399; |
| | | } |
| | | |
| | | .kpi-warning { |
| | | color: #e6a23c; |
| | | } |
| | | |
| | | .dialog-order-info { |
| | | margin-bottom: 12px; |
| | | font-size: 13px; |
| | | color: #606266; |
| | | line-height: 1.8; |
| | | } |
| | | |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | </style> |
| | | |
| | |
| | | <template> |
| | | <div class="dashboard"> |
| | | <!-- 顶鍿¨ªå两æ --> |
| | | <div class="dashboard-top"> |
| | | <!-- å·¦ï¼ä¼ä¸ä¿¡æ¯+ä¸å¤§æ°æ®å¡çï¼ä¸ä¸æåï¼ --> |
| | | <div class="top-left"> |
| | | <div class="company-info"> |
| | | <div class="section-title">ç»éä¿¡æ¯</div> |
| | | <div style="display: flex;align-items: center;gap: 20px"> |
| | | <img :src="userStore.avatar" class="avatar" alt=""/> |
| | | <div class="company-card"> |
| | | <div class="company-name">{{userStore.name}}</div> |
| | | <div class="company-meta">{{userStore.roleName}}</div> |
| | | </div> |
| | | <div style="display: flex;align-items: center;gap: 8px"> |
| | | <el-icon color="#5053B5" size="22"><Clock /></el-icon> |
| | | <span>ç»éæ¥æï¼{{userStore.currentLoginTime}}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="data-cards"> |
| | | <div class="data-card sales"> |
| | | <div class="data-title">é宿°æ®</div> |
| | | <div class="data-num"> |
| | | <div> |
| | | <div class="data-desc">æ¬æéå®é¢/å
</div> |
| | | <div class="data-value">{{businessInfo.monthSaleMoney}}</div> |
| | | </div> |
| | | <div> |
| | | <div class="data-desc">æªå¼ç¥¨éé¢/å
</div> |
| | | <div class="data-value">{{businessInfo.monthSaleHaveMoney}}</div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="data-card purchase"> |
| | | <div class="data-title">éè´æ°æ®</div> |
| | | <div class="data-num"> |
| | | <div> |
| | | <div class="data-desc">æ¬æéè´é¢/å
</div> |
| | | <div class="data-value">{{businessInfo.monthPurchaseMoney}}</div> |
| | | </div> |
| | | <div> |
| | | <div class="data-desc">å¾
仿¬¾éé¢/å
</div> |
| | | <div class="data-value">{{businessInfo.monthPurchaseHaveMoney}}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="data-card inventory"> |
| | | <div class="data-title">åºåæ°æ®</div> |
| | | <div class="data-num"> |
| | | <div> |
| | | <div class="data-desc">å½ååºåæ»é/ä»¶</div> |
| | | <div class="data-value">{{businessInfo.inventoryNum}}</div> |
| | | </div> |
| | | <div> |
| | | <div class="data-desc">仿¥å
¥åº/ä»¶</div> |
| | | <div class="data-value">{{businessInfo.todayInventoryNum}}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- å³ï¼å¾
åäºé¡¹ --> |
| | | <div class="todo-panel"> |
| | | <div class="section-title">å¾
åäºé¡¹</div> |
| | | <ul class="todo-list" v-if="todoList.length > 0"> |
| | | <li v-for="item in todoList" :key="item.id"> |
| | | <div style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;gap: 20px"> |
| | | <div style="display: flex;justify-content: space-between;align-items: center;"> |
| | | <div class="todo-title">å¾
åç¼å·ï¼{{item.approveId}}</div> |
| | | <div class="todo-division">é¨é¨ï¼{{item.approveDeptName}}</div> |
| | | <div class="todo-time">{{item.approveTime}}</div> |
| | | </div> |
| | | <div class="todo-division">å¾
åäºç±ï¼{{item.approveReason}}</div> |
| | | </div> |
| | | </li> |
| | | </ul> |
| | | <div v-else style="text-align: center"> |
| | | ææ æ°æ® |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- ä¸é¨æ¨ªå两æ --> |
| | | <div class="dashboard-row"> |
| | | <div class="main-panel"> |
| | | <div class="section-title">客æ·ååéé¢åæ</div> |
| | | <div class="contract-summary"> |
| | | <div class="contract-info"> |
| | | <img src="../assets/images/khtitle.png" alt="" style="width: 42px"/> |
| | | <div class="contract-card"> |
| | | <div class="contract-name">æ»ååéé¢(å
)</div> |
| | | <div class="contract-meta"> |
| | | <div class="main-amount">{{sum}}</div> |
| | | <div>å¨åæ¯: <span class="up">{{yny}}% </span> æ¥ç¯æ¯: <span class="up">{{chain}}% </span></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div style="display: flex;align-items: center;gap: 20px;justify-content: space-evenly;height: 180px;margin-top: 20px"> |
| | | <div> |
| | | <Echarts ref="chart" :legend="pieLegend" :chartStyle="chartStylePie" |
| | | :series="materialPieSeries" |
| | | :tooltip="pieTooltip"></Echarts> |
| | | </div> |
| | | <ul class="contract-list"> |
| | | <li v-for="item in materialPieSeries[0].data" :key="item.name"> |
| | | <div style="display: flex;align-items: center;justify-content: space-between;width: 100%"> |
| | | <div class="line" :style="{color: item.itemStyle.color}">â{{item.name}}</div> |
| | | <div style="width: 70px">{{item.rate}}%</div> |
| | | <div>ï¿¥{{item.value}}</div> |
| | | </div> |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | <div class="main-panel"> |
| | | <div style="display: flex;justify-content: space-between;"> |
| | | <div class="section-title">åºæ¶åºä»ç»è®¡</div> |
| | | <!-- <el-radio-group v-model="radio1" size="large" @change="statisticsReceivable">--> |
| | | <!-- <el-radio-button label="æå¨" :value="1" />--> |
| | | <!-- <el-radio-button label="ææ" :value="2" />--> |
| | | <!-- <el-radio-button label="æå£åº¦" :value="3" />--> |
| | | <!-- </el-radio-group>--> |
| | | </div> |
| | | <Echarts ref="chart" |
| | | :color="barColors2" |
| | | :chartStyle="chartStyle" |
| | | :grid="grid" |
| | | :series="barSeries" |
| | | :tooltip="tooltip" |
| | | :xAxis="xAxis" |
| | | :yAxis="yAxis" |
| | | style="height: 260px"></Echarts> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- åºé¨æ¨ªå两æ --> |
| | | <div class="dashboard-row"> |
| | | <!-- <div class="main-panel">--> |
| | | <!-- <div class="section-title">è´¨éç»è®¡</div>--> |
| | | <!-- <div class="quality-cards">--> |
| | | <!-- <div class="quality-card one">åææå·²æ£æµæ° <span>{{qualityStatisticsObject.supplierNum}}ä»¶</span></div>--> |
| | | <!-- <div class="quality-card two">è¿ç¨æ£éªæ°é <span>{{qualityStatisticsObject.processNum}}ä»¶</span></div>--> |
| | | <!-- <div class="quality-card three">åºåå·²æ£æ°é <span>{{qualityStatisticsObject.factoryNum}}ä»¶</span></div>--> |
| | | <!-- </div>--> |
| | | <!-- <Echarts ref="chart"--> |
| | | <!-- :chartStyle="chartStyle"--> |
| | | <!-- :grid="grid"--> |
| | | <!-- :legend="barLegend"--> |
| | | <!-- :series="barSeries1"--> |
| | | <!-- :tooltip="tooltip"--> |
| | | <!-- :xAxis="xAxis1"--> |
| | | <!-- :yAxis="yAxis1"--> |
| | | <!-- style="height: 260px"></Echarts>--> |
| | | <!-- </div>--> |
| | | <div class="main-panel"> |
| | | <div class="section-title">忬¾ä¸å¼ç¥¨åæ</div> |
| | | <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="lineLegend" :series="lineSeries" |
| | | :tooltip="tooltipLine" :xAxis="xAxis2" :yAxis="yAxis2" style="height: 270px;"></Echarts> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="dashboard"> |
| | | <!-- 顶鍿¨ªå两æ --> |
| | | <div class="dashboard-top"> |
| | | <!-- å·¦ï¼ä¼ä¸ä¿¡æ¯+ä¸å¤§æ°æ®å¡çï¼ä¸ä¸æåï¼ --> |
| | | <div class="top-left"> |
| | | <div class="company-info"> |
| | | <!-- é¡¶é¨é®åæ¡ --> |
| | | <div class="welcome-banner"> |
| | | <div class="welcome-title"> |
| | | <span class="welcome-user">{{ userStore.roleName || 'ç³»ç»ç®¡çå' }}</span> |
| | | <span> æ¨å¥½ï¼ç¥æ¨å¼å¿æ¯ä¸å¤©</span> |
| | | </div> |
| | | <div class="welcome-time">ç»å½äº: {{ userStore.currentLoginTime }}</div> |
| | | </div> |
| | | |
| | | <!-- ç¨æ·ä¿¡æ¯å¡ç --> |
| | | <div class="user-card"> |
| | | <img :src="userStore.avatar" class="avatar" alt="" /> |
| | | <div class="user-card-main"> |
| | | <div class="user-name">{{ userStore.name }}</div> |
| | | <div class="user-role">{{ userStore.roleName }}</div> |
| | | <div class="user-meta"> |
| | | <span>{{ userStore.phoneNumber || '123456789' }}</span> |
| | | <span class="sep">|</span> |
| | | <span>{{ userStore.deptName || 'ç»ç»æ¶æ' }}</span> |
| | | <span class="sep">|</span> |
| | | <span>{{ userStore.postName || 'å²ä½å' }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="data-cards"> |
| | | <div class="data-card sales"> |
| | | <div class="data-title">é宿°æ®</div> |
| | | <div class="data-num"> |
| | | <div> |
| | | <div class="data-desc">æ¬æéå®é¢/å
</div> |
| | | <div class="data-value">{{ businessInfo.monthSaleMoney }}</div> |
| | | </div> |
| | | <div> |
| | | <div class="data-desc">æªå¼ç¥¨éé¢/å
</div> |
| | | <div class="data-value">{{ businessInfo.monthSaleHaveMoney }}</div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="data-card purchase"> |
| | | <div class="data-title">éè´æ°æ®</div> |
| | | <div class="data-num"> |
| | | <div> |
| | | <div class="data-desc">æ¬æéè´é¢/å
</div> |
| | | <div class="data-value">{{ businessInfo.monthPurchaseMoney }}</div> |
| | | </div> |
| | | <div> |
| | | <div class="data-desc">å¾
仿¬¾éé¢/å
</div> |
| | | <div class="data-value">{{ businessInfo.monthPurchaseHaveMoney }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="data-card inventory"> |
| | | <div class="data-title">åºåæ°æ®</div> |
| | | <div class="data-num"> |
| | | <div> |
| | | <div class="data-desc">å½ååºåæ»é/ä»¶</div> |
| | | <div class="data-value">{{ businessInfo.inventoryNum }}</div> |
| | | </div> |
| | | <div> |
| | | <div class="data-desc">仿¥å
¥åº/ä»¶</div> |
| | | <div class="data-value">{{ businessInfo.todayInventoryNum }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- å³ï¼å¾
åäºé¡¹ --> |
| | | <div class="todo-panel"> |
| | | <div class="section-title">å¾
åäºé¡¹</div> |
| | | <ul class="todo-list" v-if="todoList.length > 0"> |
| | | <li v-for="item in todoList" :key="item.id"> |
| | | <div style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;gap: 20px"> |
| | | <div style="display: flex;justify-content: space-between;align-items: center;"> |
| | | <div class="todo-title">å¾
åç¼å·ï¼{{ item.approveId }}</div> |
| | | <div class="todo-division">é¨é¨ï¼{{ item.approveDeptName }}</div> |
| | | <div class="todo-time">{{ item.approveTime }}</div> |
| | | </div> |
| | | <div class="todo-division">å¾
åäºç±ï¼{{ item.approveReason }}</div> |
| | | </div> |
| | | </li> |
| | | </ul> |
| | | <div v-else style="text-align: center"> |
| | | ææ æ°æ® |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="dashboard-row"> |
| | | <div class="main-panel process-panel"> |
| | | <div class="process-panel__header"> |
| | | <div class="section-title">å·¥åºæ°æ®ç产ç»è®¡æç»</div> |
| | | <div style="display: flex; gap: 10px; align-items: center;"> |
| | | <el-button type="primary" size="small" plain icon="Filter" @click="openProcessDialog">鿩工åº</el-button> |
| | | <el-button type="info" size="small" plain icon="Refresh" @click="resetProcessFilter">éç½®</el-button> |
| | | <el-radio-group v-model="processRange" size="small" @change="refreshProcessStats"> |
| | | <el-radio-button :value="1">æ¥</el-radio-button> |
| | | <el-radio-button :value="2">å¨</el-radio-button> |
| | | <el-radio-button :value="3">æ</el-radio-button> |
| | | </el-radio-group> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="process-panel__body"> |
| | | <div class="process-panel__chart"> |
| | | <Echarts :chartStyle="{ width: '100%', height: '100%' }" :grid="processGrid" :series="processSeries" |
| | | :tooltip="processTooltip" :xAxis="processXAxis" :yAxis="processYAxis" style="height: 100%" |
| | | @click="handleChartClick" /> |
| | | </div> |
| | | |
| | | <div class="process-panel__aside"> |
| | | <div class="process-legend"> |
| | | <div class="process-legend__item"> |
| | | <span class="dot dot-blue"></span><span>æå
¥é</span> |
| | | </div> |
| | | <div class="process-legend__item"> |
| | | <span class="dot dot-yellow"></span><span>æ¥åºé</span> |
| | | </div> |
| | | <div class="process-legend__item"> |
| | | <span class="dot dot-teal"></span><span>产åºé</span> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="process-card process-card--name">{{ processAside.processName }}</div> |
| | | |
| | | <div class="process-card"> |
| | | <div class="process-card__label">ç´¯è®¡æ»æå
¥</div> |
| | | <div class="process-card__value">{{ formatAmount(processAside.totalInput) }}<span class="unit">å
</span> |
| | | </div> |
| | | </div> |
| | | <div class="process-card"> |
| | | <div class="process-card__label">ç´¯è®¡æ»æ¥åº</div> |
| | | <div class="process-card__value">{{ formatAmount(processAside.totalScrap) }}<span class="unit">å
</span> |
| | | </div> |
| | | </div> |
| | | <div class="process-card"> |
| | | <div class="process-card__label">累计æ»äº§åº</div> |
| | | <div class="process-card__value">{{ formatAmount(processAside.totalOutput) }}<span class="unit">å
</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- å·¥åºéæ©å¼¹çª --> |
| | | <el-dialog v-model="processDialogVisible" title="鿩工åº" width="500px" append-to-body> |
| | | <div class="process-selection-wrapper"> |
| | | <el-checkbox-group v-model="tempProcessIds"> |
| | | <div class="process-grid"> |
| | | <el-checkbox v-for="item in processOptions" :key="item.id" :label="item.id" border> |
| | | {{ item.name }} |
| | | </el-checkbox> |
| | | </div> |
| | | </el-checkbox-group> |
| | | </div> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="processDialogVisible = false">åæ¶</el-button> |
| | | <el-button type="primary" @click="handleProcessDialogConfirm">确认</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- ä¸é¨æ¨ªå两æ --> |
| | | <div class="dashboard-row"> |
| | | <div class="main-panel"> |
| | | <div class="section-title">客æ·ååéé¢åæ</div> |
| | | <div class="contract-summary"> |
| | | <div class="contract-info"> |
| | | <img src="../assets/images/khtitle.png" alt="" style="width: 42px" /> |
| | | <div class="contract-card"> |
| | | <div class="contract-name">æ»ååéé¢(å
)</div> |
| | | <div class="contract-meta"> |
| | | <div class="main-amount">{{ sum }}</div> |
| | | <div>å¨åæ¯: <span class="up">{{ yny }}% </span> æ¥ç¯æ¯: <span class="up">{{ chain }}% </span></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div |
| | | style="display: flex;align-items: center;gap: 20px;justify-content: space-evenly;height: 180px;margin-top: 20px"> |
| | | <div> |
| | | <Echarts ref="chart" :legend="pieLegend" :chartStyle="chartStylePie" :series="materialPieSeries" |
| | | :tooltip="pieTooltip"></Echarts> |
| | | </div> |
| | | <ul class="contract-list"> |
| | | <li v-for="item in materialPieSeries[0].data" :key="item.name"> |
| | | <div style="display: flex;align-items: center;justify-content: space-between;width: 100%"> |
| | | <div class="line" :style="{ color: item.itemStyle.color }">â{{ item.name }}</div> |
| | | <div style="width: 70px">{{ item.rate }}%</div> |
| | | <div>ï¿¥{{ item.value }}</div> |
| | | </div> |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | <div class="main-panel"> |
| | | <div style="display: flex;justify-content: space-between;"> |
| | | <div class="section-title">åºæ¶åºä»ç»è®¡</div> |
| | | <!-- <el-radio-group v-model="radio1" size="large" @change="statisticsReceivable">--> |
| | | <!-- <el-radio-button label="æå¨" :value="1" />--> |
| | | <!-- <el-radio-button label="ææ" :value="2" />--> |
| | | <!-- <el-radio-button label="æå£åº¦" :value="3" />--> |
| | | <!-- </el-radio-group>--> |
| | | </div> |
| | | <Echarts ref="chart" :color="barColors2" :chartStyle="chartStyle" :grid="grid" :series="barSeries" |
| | | :tooltip="tooltip" :xAxis="xAxis" :yAxis="yAxis" style="height: 260px"></Echarts> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- åºé¨æ¨ªå两æ --> |
| | | <div class="dashboard-row"> |
| | | <div class="main-panel"> |
| | | <div style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;"> |
| | | <div class="section-title" style="margin-bottom: 0;">è´¨éç»è®¡</div> |
| | | <el-radio-group v-model="qualityRange" size="small" @change="qualityStatisticsInfo"> |
| | | <el-radio-button :value="1">å¨</el-radio-button> |
| | | <el-radio-button :value="2">æ</el-radio-button> |
| | | <el-radio-button :value="3">å£åº¦</el-radio-button> |
| | | </el-radio-group> |
| | | </div> |
| | | <div class="quality-cards"> |
| | | <div class="quality-card one">åææå·²æ£æµæ° <span>{{ qualityStatisticsObject.supplierNum }}ä»¶</span></div> |
| | | <div class="quality-card two">è¿ç¨æ£éªæ°é <span>{{ qualityStatisticsObject.processNum }}ä»¶</span></div> |
| | | <div class="quality-card three">åºåå·²æ£æ°é <span>{{ qualityStatisticsObject.factoryNum }}ä»¶</span></div> |
| | | </div> |
| | | <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="barLegend" :series="barSeries1" |
| | | :tooltip="tooltip" :xAxis="xAxis1" :yAxis="yAxis1" style="height: 260px"></Echarts> |
| | | </div> |
| | | |
| | | <div class="main-panel"> |
| | | <div class="section-title">忬¾ä¸å¼ç¥¨åæ</div> |
| | | <Echarts ref="invoiceChart" :chartStyle="chartStyle" :grid="grid" :legend="lineLegend" :series="lineSeries" |
| | | :tooltip="tooltipLine" :xAxis="xAxis2" :yAxis="yAxis2" style="height: 270px;" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, onMounted } from 'vue' |
| | | import { ref, onMounted, computed, reactive } from 'vue' |
| | | import Echarts from "@/components/Echarts/echarts.vue"; |
| | | import * as echarts from 'echarts'; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import { |
| | | analysisCustomerContractAmounts, getAmountHalfYear, |
| | | getBusiness, |
| | | homeTodos, |
| | | qualityStatistics, |
| | | statisticsReceivablePayable |
| | | analysisCustomerContractAmounts, getAmountHalfYear, |
| | | getBusiness, |
| | | homeTodos, |
| | | processDataProductionStatistics, |
| | | statisticsReceivablePayable, |
| | | qualityInspectionStatistics |
| | | } from "@/api/viewIndex.js"; |
| | | import { list } from '@/api/productionManagement/productionProcess'; |
| | | |
| | | |
| | | const userStore = useUserStore() |
| | | |
| | | const processOptions = ref([]) |
| | | const selectedProcessIds = ref([]) |
| | | const tempProcessIds = ref([]) |
| | | const processDialogVisible = ref(false) |
| | | const activeProcessIndex = ref(0) |
| | | |
| | | const businessInfo = ref({ |
| | | inventoryNum: 0, |
| | | monthPurchaseHaveMoney: 0, |
| | | monthPurchaseMoney: 0, |
| | | monthSaleHaveMoney: 0, |
| | | monthSaleMoney: 0, |
| | | todayInventoryNum: 0, |
| | | inventoryNum: 0, |
| | | monthPurchaseHaveMoney: 0, |
| | | monthPurchaseMoney: 0, |
| | | monthSaleHaveMoney: 0, |
| | | monthSaleMoney: 0, |
| | | todayInventoryNum: 0, |
| | | }) |
| | | const qualityStatisticsObject = ref({ |
| | | supplierNum: 0, |
| | | processNum: 0, |
| | | factoryNum: 0, |
| | | supplierNum: 0, |
| | | processNum: 0, |
| | | factoryNum: 0, |
| | | }) |
| | | const sum = ref(0) |
| | | const yny = ref(0) |
| | | const chain = ref(0) |
| | | |
| | | const pieLegend = reactive({ |
| | | show: false, |
| | | show: false, |
| | | }) |
| | | const barSeries = ref([ |
| | | { |
| | | type: 'bar', |
| | | data: [], |
| | | label: { |
| | | show: true, |
| | | } |
| | | }, |
| | | { |
| | | type: 'bar', |
| | | data: [], |
| | | label: { |
| | | show: true, |
| | | } |
| | | }, |
| | | ]) |
| | | |
| | | const barSeries1 = ref([ |
| | | { |
| | | name: 'åææä¸åæ ¼æ°', |
| | | type: 'bar', |
| | | barGap: 0, |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | data: [] |
| | | }, |
| | | { |
| | | name: 'è¿ç¨ä¸åæ ¼æ°', |
| | | type: 'bar', |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | data: [] |
| | | }, |
| | | { |
| | | name: 'åºåä¸åæ ¼æ°', |
| | | type: 'bar', |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | data: [] |
| | | }, |
| | | { |
| | | name: 'åææä¸åæ ¼æ°', |
| | | type: 'bar', |
| | | barGap: 0, |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | data: [] |
| | | }, |
| | | { |
| | | name: 'è¿ç¨ä¸åæ ¼æ°', |
| | | type: 'bar', |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | data: [] |
| | | }, |
| | | { |
| | | name: 'åºåä¸åæ ¼æ°', |
| | | type: 'bar', |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | data: [] |
| | | }, |
| | | ]) |
| | | const chartStyle = { |
| | | width: '100%', |
| | | height: '100%' // 设置å¾è¡¨å®¹å¨çé«åº¦ |
| | | width: '100%', |
| | | height: '100%' // 设置å¾è¡¨å®¹å¨çé«åº¦ |
| | | } |
| | | const chartStylePie = { |
| | | width: '140%', |
| | | height: '140%' // 设置å¾è¡¨å®¹å¨çé«åº¦ |
| | | width: '140%', |
| | | height: '140%' // 设置å¾è¡¨å®¹å¨çé«åº¦ |
| | | } |
| | | const grid = { |
| | | left: '3%', |
| | | right: '4%', |
| | | bottom: '3%', |
| | | containLabel: true |
| | | left: '3%', |
| | | right: '4%', |
| | | bottom: '3%', |
| | | containLabel: true |
| | | } |
| | | const barLegend = { |
| | | show: true, |
| | | data: ['åææä¸åæ ¼æ°', 'è¿ç¨ä¸åæ ¼æ°', 'åºåä¸åæ ¼æ°'] |
| | | show: true, |
| | | data: ['åææä¸åæ ¼æ°', 'è¿ç¨ä¸åæ ¼æ°', 'åºåä¸åæ ¼æ°'] |
| | | } |
| | | const barLegend1 = { |
| | | show: true, |
| | | data: ['é¢ä»è´¦æ¬¾', 'åºä»è´¦æ¬¾', '颿¶è´¦æ¬¾', 'åºæ¶è´¦æ¬¾'] |
| | | show: true, |
| | | data: ['é¢ä»è´¦æ¬¾', 'åºä»è´¦æ¬¾', '颿¶è´¦æ¬¾', 'åºæ¶è´¦æ¬¾'] |
| | | } |
| | | const lineLegend = { |
| | | show: true, |
| | | data: ['å¼ç¥¨', '忬¾'] |
| | | show: true, |
| | | data: ['å¼ç¥¨', '忬¾'] |
| | | } |
| | | const tooltip = { |
| | | trigger: 'axis', |
| | | axisPointer: { |
| | | type: 'shadow' |
| | | } |
| | | trigger: 'axis', |
| | | axisPointer: { |
| | | type: 'shadow' |
| | | } |
| | | } |
| | | const xAxis = [{ |
| | | type: 'value', |
| | | type: 'value', |
| | | }] |
| | | const xAxis1 = ref([{ |
| | | type: 'category', |
| | | axisTick: { show: false }, |
| | | data: [] |
| | | type: 'category', |
| | | axisTick: { show: false }, |
| | | data: [] |
| | | }]) |
| | | const yAxis = [{ |
| | | type: 'category', |
| | | data: [ 'åºä»è´¦æ¬¾', 'åºæ¶è´¦æ¬¾',] |
| | | type: 'category', |
| | | data: ['åºä»è´¦æ¬¾', 'åºæ¶è´¦æ¬¾',] |
| | | }] |
| | | const yAxis1 = [{ |
| | | type: 'value' |
| | | type: 'value' |
| | | }] |
| | | const pieTooltip = reactive({ |
| | | trigger: 'item', |
| | | formatter: function (params) { |
| | | // å¨æçææç¤ºä¿¡æ¯ï¼åºäºæ°æ®é¡¹ç name 屿§ |
| | | const description = params.name === 'æ¬æåæ¬¾éé¢' ? 'æ¬æåæ¬¾éé¢' : 'åºæ¶æ¬¾éé¢'; |
| | | return `${description} ${formatNumber(params.value)}å
${params.percent}%`; |
| | | }, |
| | | position: 'right' |
| | | trigger: 'item', |
| | | formatter: function (params) { |
| | | // å¨æçææç¤ºä¿¡æ¯ï¼åºäºæ°æ®é¡¹ç name 屿§ |
| | | const description = params.name === 'æ¬æåæ¬¾éé¢' ? 'æ¬æåæ¬¾éé¢' : 'åºæ¶æ¬¾éé¢'; |
| | | return `${description} ${formatNumber(params.value)}å
${params.percent}%`; |
| | | }, |
| | | position: 'right' |
| | | }) |
| | | const materialPieSeries = ref([ |
| | | { |
| | | type: 'pie', |
| | | radius: ['66%', '90%'], |
| | | avoidLabelOverlap: false, |
| | | itemStyle: { |
| | | borderColor: '#fff', |
| | | borderWidth: 2 |
| | | }, |
| | | label: { |
| | | show: false |
| | | }, |
| | | data: [] |
| | | } |
| | | { |
| | | type: 'pie', |
| | | radius: ['66%', '90%'], |
| | | avoidLabelOverlap: false, |
| | | itemStyle: { |
| | | borderColor: '#fff', |
| | | borderWidth: 2 |
| | | }, |
| | | label: { |
| | | show: false |
| | | }, |
| | | data: [] |
| | | } |
| | | ]) |
| | | const lineSeries = ref([ |
| | | { |
| | | type: 'line', |
| | | data: [], |
| | | label: { |
| | | show: true |
| | | }, |
| | | { |
| | | type: 'line', |
| | | data: [], |
| | | label: { |
| | | show: true |
| | | }, |
| | | showSymbol: true, // æ¾ç¤ºåç¹ |
| | | }, |
| | | }, |
| | | ]) |
| | | const tooltipLine = { |
| | | trigger: 'axis', |
| | | trigger: 'axis', |
| | | } |
| | | const yAxis2 = ref([ |
| | | { |
| | | type: 'value', |
| | | } |
| | | { |
| | | type: 'value', |
| | | } |
| | | ]) |
| | | const xAxis2 = ref([ |
| | | { |
| | | type: 'category', |
| | | data: [], |
| | | axisLabel: { |
| | | interval: 0, |
| | | formatter: function(value) { |
| | | return value.replace(/~/g, '\n'); |
| | | }, |
| | | } |
| | | } |
| | | { |
| | | type: 'category', |
| | | data: [], |
| | | axisLabel: { |
| | | interval: 0, |
| | | formatter: function (value) { |
| | | return value.replace(/~/g, '\n'); |
| | | }, |
| | | } |
| | | } |
| | | ]) |
| | | |
| | | // å¾
åäºé¡¹ |
| | | const todoList = ref([]) |
| | | const radio1 = ref(1) |
| | | const qualityRange = ref(1) |
| | | |
| | | // å¾è¡¨å¼ç¨ |
| | | const barChart = ref(null) |
| | |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getBusinessData() |
| | | analysisCustomer() |
| | | todoInfoS() |
| | | statisticsReceivable() |
| | | qualityStatisticsInfo() |
| | | getAmountHalfYearNum() |
| | | getBusinessData() |
| | | analysisCustomer() |
| | | todoInfoS() |
| | | statisticsReceivable() |
| | | qualityStatisticsInfo() |
| | | getAmountHalfYearNum() |
| | | getProcessList() |
| | | }) |
| | | // æ°æ®ç»è®¡ |
| | | const getBusinessData = () => { |
| | | getBusiness().then((res) => { |
| | | businessInfo.value = {...res.data} |
| | | }) |
| | | getBusiness().then((res) => { |
| | | businessInfo.value = { ...res.data } |
| | | }) |
| | | } |
| | | // ååéé¢ |
| | | const analysisCustomer = () => { |
| | | analysisCustomerContractAmounts().then((res) => { |
| | | sum.value = res.data.sum |
| | | yny.value = res.data.yny |
| | | chain.value = res.data.chain |
| | | analysisCustomerContractAmounts().then((res) => { |
| | | sum.value = res.data.sum |
| | | yny.value = res.data.yny |
| | | chain.value = res.data.chain |
| | | // 为æ¯ä¸ªæ°æ®é¡¹åé
éæºé¢è² |
| | | materialPieSeries.value[0].data = res.data.item.map(item => ({ |
| | | ...item, |
| | | itemStyle: { color: getRandomColor() } |
| | | })) |
| | | }) |
| | | }) |
| | | } |
| | | // å¾
åäºé¡¹ |
| | | const todoInfoS = () => { |
| | | homeTodos().then((res) => { |
| | | todoList.value = res.data |
| | | }) |
| | | homeTodos().then((res) => { |
| | | todoList.value = res.data |
| | | }) |
| | | } |
| | | // è·åå·¥åºå表 |
| | | const getProcessList = () => { |
| | | list().then(res => { |
| | | processOptions.value = res.data |
| | | }) |
| | | } |
| | | |
| | | const openProcessDialog = () => { |
| | | tempProcessIds.value = [...selectedProcessIds.value] |
| | | processDialogVisible.value = true |
| | | } |
| | | |
| | | const handleProcessDialogConfirm = () => { |
| | | selectedProcessIds.value = [...tempProcessIds.value] |
| | | processDialogVisible.value = false |
| | | refreshProcessStats() |
| | | } |
| | | |
| | | const resetProcessFilter = () => { |
| | | selectedProcessIds.value = [] |
| | | tempProcessIds.value = [] |
| | | refreshProcessStats() |
| | | } |
| | | |
| | | const handleChartClick = (params) => { |
| | | if (params && params.dataIndex !== undefined) { |
| | | activeProcessIndex.value = params.dataIndex |
| | | } |
| | | } |
| | | // åºä»åºæ¶ç»è®¡ |
| | | const statisticsReceivable = (type) => { |
| | | statisticsReceivablePayable({type: radio1.value}).then((res) => { |
| | | barSeries.value[0].data = [ |
| | | // { value: res.data.prepayMoney, itemStyle: { color: barColors2[0] } }, |
| | | { value: res.data.payableMoney, itemStyle: { color: barColors2[0] } }, |
| | | // { value: res.data.advanceMoney, itemStyle: { color: barColors2[2] } }, |
| | | { value: res.data.receivableMoney, itemStyle: { color: barColors2[1] } } |
| | | ] |
| | | }) |
| | | const statisticsReceivable = () => { |
| | | statisticsReceivablePayable({ type: radio1.value }).then((res) => { |
| | | barSeries.value[0].data = [ |
| | | // { value: res.data.prepayMoney, itemStyle: { color: barColors2[0] } }, |
| | | { value: res.data.payableMoney, itemStyle: { color: barColors2[0] } }, |
| | | // { value: res.data.advanceMoney, itemStyle: { color: barColors2[2] } }, |
| | | { value: res.data.receivableMoney, itemStyle: { color: barColors2[1] } } |
| | | ] |
| | | }) |
| | | } |
| | | // è´¨æ£ç»è®¡ |
| | | const qualityStatisticsInfo = () => { |
| | | qualityStatistics().then((res) => { |
| | | res.data.item.forEach(item => { |
| | | xAxis1.value[0].data.push(item.date) |
| | | barSeries1.value[0].data.push(item.supplierNum) |
| | | barSeries1.value[1].data.push(item.processNum) |
| | | barSeries1.value[2].data.push(item.factoryNum) |
| | | }) |
| | | qualityStatisticsObject.value.supplierNum = res.data.supplierNum |
| | | qualityStatisticsObject.value.processNum = res.data.processNum |
| | | qualityStatisticsObject.value.factoryNum = res.data.factoryNum |
| | | }) |
| | | qualityInspectionStatistics({ type: qualityRange.value }).then((res) => { |
| | | xAxis1.value[0].data = [] |
| | | barSeries1.value[0].data = [] |
| | | barSeries1.value[1].data = [] |
| | | barSeries1.value[2].data = [] |
| | | res.data.item.forEach(item => { |
| | | xAxis1.value[0].data.push(item.date) |
| | | barSeries1.value[0].data.push(item.supplierNum) |
| | | barSeries1.value[1].data.push(item.processNum) |
| | | barSeries1.value[2].data.push(item.factoryNum) |
| | | }) |
| | | qualityStatisticsObject.value.supplierNum = res.data.supplierNum |
| | | qualityStatisticsObject.value.processNum = res.data.processNum |
| | | qualityStatisticsObject.value.factoryNum = res.data.factoryNum |
| | | }) |
| | | } |
| | | const getAmountHalfYearNum = async () => { |
| | | const res = await getAmountHalfYear() |
| | | console.log(res) |
| | | const monthName = [] |
| | | const receiptAmount = [] |
| | | const invoiceAmount = [] |
| | | res.data.forEach(item => { |
| | | monthName.push(item.month) |
| | | receiptAmount.push(item.receiptAmount) |
| | | invoiceAmount.push(item.invoiceAmount) |
| | | }) |
| | | // æ£ç¡®ååºå¼èµå¼ï¼å建æ°ç xAxis å series 对象 |
| | | xAxis2.value[0].data = monthName |
| | | xAxis2.value[0].data = monthName.map(item => item.replace(/~/g, '\n~')); |
| | | lineSeries.value = [ |
| | | { |
| | | name: 'å¼ç¥¨', |
| | | type: 'line', |
| | | data: receiptAmount, |
| | | stack: 'Total', |
| | | areaStyle: { |
| | | color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ |
| | | { |
| | | offset: 0, |
| | | color: 'rgba(131, 207, 255, 1)' |
| | | }, |
| | | { |
| | | offset: 1, |
| | | color: 'rgba(186, 228, 255, 1)' |
| | | } |
| | | ]) |
| | | }, |
| | | itemStyle: { |
| | | color: '#2D99FF', |
| | | borderColor: '#2D99FF' |
| | | }, |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | lineStyle: { |
| | | width: 0 |
| | | }, |
| | | showSymbol: true, |
| | | }, |
| | | { |
| | | name: '忬¾', |
| | | type: 'line', |
| | | data: invoiceAmount, |
| | | stack: 'Total', |
| | | lineStyle: { |
| | | width: 0 |
| | | }, |
| | | itemStyle: { |
| | | color: '#83CFFF', |
| | | borderColor: '#83CFFF' |
| | | }, |
| | | showSymbol: true, |
| | | areaStyle: { |
| | | color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ |
| | | { |
| | | offset: 0, |
| | | color: 'rgba(54, 153, 255, 1)' |
| | | }, |
| | | { |
| | | offset: 1, |
| | | color: 'rgba(89, 169, 254, 1)' |
| | | } |
| | | ]) |
| | | }, |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | } |
| | | ] |
| | | const res = await getAmountHalfYear() |
| | | console.log(res) |
| | | const monthName = [] |
| | | const receiptAmount = [] |
| | | const invoiceAmount = [] |
| | | res.data.forEach(item => { |
| | | monthName.push(item.month) |
| | | receiptAmount.push(item.receiptAmount) |
| | | invoiceAmount.push(item.invoiceAmount) |
| | | }) |
| | | // æ£ç¡®ååºå¼èµå¼ï¼å建æ°ç xAxis å series 对象 |
| | | xAxis2.value[0].data = monthName |
| | | xAxis2.value[0].data = monthName.map(item => item.replace(/~/g, '\n~')); |
| | | lineSeries.value = [ |
| | | { |
| | | name: 'å¼ç¥¨', |
| | | type: 'line', |
| | | data: receiptAmount, |
| | | stack: 'Total', |
| | | areaStyle: { |
| | | color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ |
| | | { |
| | | offset: 0, |
| | | color: 'rgba(131, 207, 255, 1)' |
| | | }, |
| | | { |
| | | offset: 1, |
| | | color: 'rgba(186, 228, 255, 1)' |
| | | } |
| | | ]) |
| | | }, |
| | | itemStyle: { |
| | | color: '#2D99FF', |
| | | borderColor: '#2D99FF' |
| | | }, |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | lineStyle: { |
| | | width: 0 |
| | | }, |
| | | showSymbol: true, |
| | | }, |
| | | { |
| | | name: '忬¾', |
| | | type: 'line', |
| | | data: invoiceAmount, |
| | | stack: 'Total', |
| | | lineStyle: { |
| | | width: 0 |
| | | }, |
| | | itemStyle: { |
| | | color: '#83CFFF', |
| | | borderColor: '#83CFFF' |
| | | }, |
| | | showSymbol: true, |
| | | areaStyle: { |
| | | color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ |
| | | { |
| | | offset: 0, |
| | | color: 'rgba(54, 153, 255, 1)' |
| | | }, |
| | | { |
| | | offset: 1, |
| | | color: 'rgba(89, 169, 254, 1)' |
| | | } |
| | | ]) |
| | | }, |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | } |
| | | ] |
| | | } |
| | | |
| | | // å·¥åºæ°æ®ç产ç»è®¡æç»ï¼åæ°æ® + å¾è¡¨ï¼ |
| | | const processRange = ref(1) |
| | | const processChartData = ref([]) |
| | | |
| | | const processXAxis = ref([ |
| | | { |
| | | nameTextStyle: { color: 'rgba(0,0,0,0.35)', fontSize: 12 }, |
| | | axisLabel: { color: 'rgba(0,0,0,0.35)' }, |
| | | splitLine: { lineStyle: { color: 'rgba(0,0,0,0.06)', type: 'dashed' } }, |
| | | }, |
| | | ]) |
| | | |
| | | const processYAxis = ref([ |
| | | { |
| | | type: 'category', |
| | | axisTick: { show: false }, |
| | | axisLine: { show: false }, |
| | | axisLabel: { color: 'rgba(0,0,0,0.45)' }, |
| | | data: [], |
| | | }, |
| | | ]) |
| | | |
| | | const processGrid = reactive({ left: 0, right: 100, top: 30, bottom: 20, containLabel: true }) |
| | | |
| | | const processTooltip = reactive({ |
| | | trigger: 'axis', |
| | | axisPointer: { type: 'shadow' }, |
| | | formatter: (params) => { |
| | | const name = params?.[0]?.name ?? '' |
| | | const list = Array.isArray(params) ? params : [] |
| | | const lines = list |
| | | .map((p) => { |
| | | const colorBox = `<span style="display:inline-block;margin-right:6px;border-radius:2px;width:10px;height:10px;background:${p.color}"></span>` |
| | | return `${colorBox}${p.seriesName} <b style="float:right;">${Number(p.value || 0).toFixed(2)}</b>` |
| | | }) |
| | | .join('<br/>') |
| | | return `<div style="min-width:140px;"><div style="font-weight:700;margin-bottom:6px;">${name}</div>${lines}</div>` |
| | | }, |
| | | }) |
| | | |
| | | const processSeries = computed(() => { |
| | | const input = processChartData.value.map((i) => i.input) |
| | | const scrap = processChartData.value.map((i) => i.scrap) |
| | | const output = processChartData.value.map((i) => i.output) |
| | | |
| | | return [ |
| | | { |
| | | name: 'æå
¥é', |
| | | type: 'bar', |
| | | stack: 'total', |
| | | barWidth: 22, |
| | | itemStyle: { color: '#1E5BFF', borderRadius: [6, 0, 0, 6] }, |
| | | data: input, |
| | | }, |
| | | { |
| | | name: 'æ¥åºé', |
| | | type: 'bar', |
| | | stack: 'total', |
| | | barWidth: 22, |
| | | itemStyle: { color: '#F7B500' }, |
| | | data: scrap, |
| | | }, |
| | | { |
| | | name: '产åºé', |
| | | type: 'bar', |
| | | stack: 'total', |
| | | barWidth: 22, |
| | | itemStyle: { color: '#19C6C6', borderRadius: [0, 6, 6, 0] }, |
| | | data: output, |
| | | }, |
| | | ] |
| | | }) |
| | | |
| | | const processAside = computed(() => { |
| | | const list = processChartData.value |
| | | const item = list[activeProcessIndex.value] || {} |
| | | return { |
| | | processName: item.name || 'ææ æ°æ®', |
| | | totalInput: item.input || 0, |
| | | totalScrap: item.scrap || 0, |
| | | totalOutput: item.output || 0, |
| | | } |
| | | }) |
| | | |
| | | const formatAmount = (n) => { |
| | | const num = Number(n || 0) |
| | | return num.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) |
| | | } |
| | | |
| | | const refreshProcessStats = () => { |
| | | processDataProductionStatistics({ |
| | | type: processRange.value, |
| | | processIds: selectedProcessIds.value.length > 0 ? selectedProcessIds.value.join(',') : null |
| | | }).then(res => { |
| | | processChartData.value = res.data.map(item => ({ |
| | | name: item.processName, |
| | | input: item.totalInput, |
| | | scrap: item.totalScrap, |
| | | output: item.totalOutput |
| | | })) |
| | | processYAxis.value[0].data = processChartData.value.map((i) => i.name) |
| | | activeProcessIndex.value = 0 |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getBusinessData() |
| | | analysisCustomer() |
| | | todoInfoS() |
| | | statisticsReceivable() |
| | | qualityStatisticsInfo() |
| | | getAmountHalfYearNum() |
| | | refreshProcessStats() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .dashboard { |
| | | background: #f5f7fa; |
| | | min-height: 100vh; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | } |
| | | .dashboard-top { |
| | | display: flex; |
| | | gap: 20px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .company-info { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 8px; |
| | | padding: 20px; |
| | | min-width: 0; |
| | | background-color: #EFF2FB; /* ä½¿ç¨æå®çèæ¯é¢è² */ |
| | | background-image: url("../assets/images/denglu.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | border-radius: 12px; |
| | | height: 138px; |
| | | } |
| | | .avatar { |
| | | width: 60px; |
| | | height: 60px; |
| | | border-radius: 50%; |
| | | object-fit: contain; |
| | | background: #fff; |
| | | border: 1px solid #eee; |
| | | } |
| | | .company-card { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10px; |
| | | position: relative; |
| | | padding-right: 15px; |
| | | background: #f5f7fa; |
| | | min-height: 100vh; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .company-card::after { |
| | | content: ''; |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | bottom: 0; |
| | | width: 1px; |
| | | background-color: #C9C5C5; |
| | | border-radius: 2px; |
| | | .dashboard-top { |
| | | display: flex; |
| | | gap: 20px; |
| | | margin-bottom: 20px; |
| | | align-items: flex-start; |
| | | justify-content: space-evenly; |
| | | } |
| | | .company-name { |
| | | font-weight: 400; |
| | | font-size: 16px; |
| | | color: #161A9A; |
| | | |
| | | .company-info { |
| | | padding: 0; |
| | | overflow: hidden; |
| | | border-radius: 12px; |
| | | background: #fff; |
| | | height: 100%; |
| | | } |
| | | .company-meta { |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #818185; |
| | | |
| | | .welcome-banner { |
| | | padding: 10px 10px; |
| | | background: linear-gradient(135deg, rgba(229, 240, 255, 0.9), rgba(214, 232, 255, 0.7), rgba(207, 236, 255, 0.9)); |
| | | } |
| | | |
| | | .welcome-title { |
| | | font-size: 18px; |
| | | font-weight: 700; |
| | | color: #222; |
| | | line-height: 1.3; |
| | | } |
| | | |
| | | .welcome-user { |
| | | margin-right: 6px; |
| | | } |
| | | |
| | | .welcome-time { |
| | | margin-top: 10px; |
| | | font-size: 16px; |
| | | color: rgba(0, 0, 0, 0.55); |
| | | } |
| | | |
| | | .user-card { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 10px; |
| | | padding: 18px 22px; |
| | | } |
| | | |
| | | .user-card-main { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 5px; |
| | | min-width: 0; |
| | | } |
| | | |
| | | .user-name { |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | color: #111; |
| | | letter-spacing: 1px; |
| | | } |
| | | |
| | | .user-role { |
| | | display: inline-flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | height: 20px; |
| | | padding: 5px 10px; |
| | | background: rgba(245, 246, 248, 1); |
| | | color: #333; |
| | | width: fit-content; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .user-meta { |
| | | font-size: 12px; |
| | | color: rgba(0, 0, 0, 0.55); |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | } |
| | | |
| | | .user-meta .sep { |
| | | margin: 0 10px; |
| | | color: rgba(0, 0, 0, 0.25); |
| | | } |
| | | |
| | | .avatar { |
| | | width: 90px; |
| | | height: 90px; |
| | | border-radius: 50%; |
| | | object-fit: cover; |
| | | flex: 0 0 auto; |
| | | } |
| | | |
| | | .data-cards { |
| | | display: flex; |
| | | gap: 16px; |
| | | justify-content: flex-start; |
| | | background: #ffffff; |
| | | border-radius: 12px; |
| | | padding: 20px; |
| | | width: 50%; |
| | | display: flex; |
| | | gap: 16px; |
| | | justify-content: flex-start; |
| | | background: #ffffff; |
| | | border-radius: 12px; |
| | | padding: 20px; |
| | | } |
| | | |
| | | .data-title { |
| | | font-weight: 700; |
| | | font-size: 26px; |
| | | color: #FFFFFF; |
| | | font-weight: 700; |
| | | font-size: 26px; |
| | | color: #FFFFFF; |
| | | } |
| | | |
| | | .data-num { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | margin-top: 20px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .data-card { |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 14px 10px 10px 10px; |
| | | min-width: 160px; |
| | | box-shadow: 0 2px 8px #eee; |
| | | display: flex; |
| | | flex-direction: column; |
| | | width: 32%; |
| | | height: 140px; |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 14px 10px 10px 10px; |
| | | min-width: 160px; |
| | | box-shadow: 0 2px 8px #eee; |
| | | display: flex; |
| | | flex-direction: column; |
| | | width: 32%; |
| | | height: 140px; |
| | | } |
| | | |
| | | .data-card.sales { |
| | | background-image: url("../assets/images/xioashoushuju.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | background-image: url("../assets/images/xioashoushuju.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | } |
| | | |
| | | .data-card.purchase { |
| | | background-image: url("../assets/images/caigou.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | background-image: url("../assets/images/caigou.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | } |
| | | |
| | | .data-card.inventory { |
| | | background-image: url("../assets/images/kucun.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | background-image: url("../assets/images/kucun.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | } |
| | | |
| | | .data-desc { |
| | | font-weight: 500; |
| | | font-size: 13px; |
| | | color: #FFFFFF; |
| | | font-weight: 500; |
| | | font-size: 13px; |
| | | color: #FFFFFF; |
| | | } |
| | | |
| | | .data-value { |
| | | font-size: 18px; |
| | | font-weight: 500; |
| | | margin: 10px 0; |
| | | color: #FFFFFF; |
| | | font-size: 18px; |
| | | font-weight: 500; |
| | | margin: 10px 0; |
| | | color: #FFFFFF; |
| | | } |
| | | |
| | | .top-left { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 20px; |
| | | width: 50%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 20px; |
| | | height: 180px; |
| | | width: 20%; |
| | | } |
| | | |
| | | .todo-panel { |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 20px; |
| | | width: 50%; |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 20px; |
| | | height: 180px; |
| | | width: 30%; |
| | | } |
| | | |
| | | .todo-list { |
| | | list-style: none; |
| | | padding: 0; |
| | | margin: 0; |
| | | font-size: 15px; |
| | | overflow-y: auto; |
| | | height: 260px; |
| | | height: 100px; |
| | | list-style: none; |
| | | padding: 0; |
| | | margin: 0; |
| | | font-size: 15px; |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | .todo-list li { |
| | | border-radius: 8px; |
| | | margin-bottom: 12px; |
| | | padding: 8px 20px; |
| | | height: 74px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | background: rgba(225,227,250,0.62); |
| | | border-radius: 8px; |
| | | margin-bottom: 12px; |
| | | padding: 8px 20px; |
| | | height: 74px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | background: rgba(225, 227, 250, 0.62); |
| | | } |
| | | |
| | | .todo-title { |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #000000; |
| | | position: relative; |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #000000; |
| | | position: relative; |
| | | } |
| | | |
| | | .todo-title::before { |
| | | content: ''; /* å¿
éï¼è¡¨ç¤ºè¿éæä¸ä¸ªå
容 */ |
| | | position: absolute; |
| | | left: -10px; /* å®ä½å°å·¦ä¾§ */ |
| | | top: 50%; /* åç´å±
ä¸ */ |
| | | transform: translateY(-50%); /* å¾®è°åç´å±
ä¸ */ |
| | | width: 6px; /* åçç´å¾ */ |
| | | height: 6px; /* åçç´å¾ */ |
| | | background: #498CEB; |
| | | border-radius: 50%; /* 让å
¶åæåå½¢ */ |
| | | content: ''; |
| | | /* å¿
éï¼è¡¨ç¤ºè¿éæä¸ä¸ªå
容 */ |
| | | position: absolute; |
| | | left: -10px; |
| | | /* å®ä½å°å·¦ä¾§ */ |
| | | top: 50%; |
| | | /* åç´å±
ä¸ */ |
| | | transform: translateY(-50%); |
| | | /* å¾®è°åç´å±
ä¸ */ |
| | | width: 6px; |
| | | /* åçç´å¾ */ |
| | | height: 6px; |
| | | /* åçç´å¾ */ |
| | | background: #498CEB; |
| | | border-radius: 50%; |
| | | /* 让å
¶åæåå½¢ */ |
| | | } |
| | | |
| | | .todo-division { |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #000000; |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #000000; |
| | | } |
| | | |
| | | .todo-time { |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #000000; |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #000000; |
| | | } |
| | | |
| | | .todo-meta { |
| | | color: #888; |
| | | font-size: 13px; |
| | | color: #888; |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .dashboard-row { |
| | | display: flex; |
| | | gap: 20px; |
| | | margin-bottom: 20px; |
| | | display: flex; |
| | | gap: 20px; |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .main-panel { |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 20px; |
| | | flex: 1; |
| | | min-width: 0; |
| | | display: flex; |
| | | flex-direction: column; |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 20px; |
| | | flex: 1; |
| | | min-width: 0; |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .section-title { |
| | | position: relative; |
| | | font-size: 18px; |
| | | color: #333; |
| | | padding-left: 10px; |
| | | margin-bottom: 10px; |
| | | font-weight: 700; |
| | | position: relative; |
| | | font-size: 18px; |
| | | color: #333; |
| | | padding-left: 10px; |
| | | margin-bottom: 10px; |
| | | font-weight: 700; |
| | | } |
| | | |
| | | .section-title::before { |
| | | position: absolute; |
| | | left: 0; |
| | | top: 4px; |
| | | content: ''; |
| | | width: 4px; |
| | | height: 18px; |
| | | background-color: #002FA7; |
| | | border-radius: 2px; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 4px; |
| | | content: ''; |
| | | width: 4px; |
| | | height: 18px; |
| | | background-color: #002FA7; |
| | | border-radius: 2px; |
| | | } |
| | | |
| | | .contract-info { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 20px; |
| | | height: 90px; |
| | | background: rgba(245,245,245,0.59); |
| | | width: 100%; |
| | | border-radius: 10px; |
| | | padding: 10px 30px; |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 20px; |
| | | height: 90px; |
| | | background: rgba(245, 245, 245, 0.59); |
| | | width: 100%; |
| | | border-radius: 10px; |
| | | padding: 10px 30px; |
| | | } |
| | | |
| | | .contract-summary { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 30px; |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 30px; |
| | | } |
| | | |
| | | .contract-card { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10px; |
| | | } |
| | | |
| | | .contract-name { |
| | | font-weight: 400; |
| | | font-size: 14px; |
| | | color: #050505; |
| | | font-weight: 400; |
| | | font-size: 14px; |
| | | color: #050505; |
| | | } |
| | | |
| | | .contract-meta { |
| | | display: flex; |
| | | align-items: center; |
| | | width: 100%; |
| | | gap: 80px; |
| | | display: flex; |
| | | align-items: center; |
| | | width: 100%; |
| | | gap: 80px; |
| | | } |
| | | |
| | | .main-amount { |
| | | font-size: 24px; |
| | | color: rgba(51,50,50,0.85); |
| | | font-size: 24px; |
| | | color: rgba(51, 50, 50, 0.85); |
| | | } |
| | | .up { color: #e57373; } |
| | | |
| | | .up { |
| | | color: #e57373; |
| | | } |
| | | |
| | | .contract-list { |
| | | margin-top: 16px; |
| | | font-size: 14px; |
| | | color: #666; |
| | | list-style: none; |
| | | padding: 0; |
| | | height: 190px; |
| | | overflow-y: auto; |
| | | width: 460px; |
| | | margin-top: 16px; |
| | | font-size: 14px; |
| | | color: #666; |
| | | list-style: none; |
| | | padding: 0; |
| | | height: 190px; |
| | | overflow-y: auto; |
| | | width: 460px; |
| | | } |
| | | |
| | | .line { |
| | | position: relative; |
| | | width: 230px; |
| | | position: relative; |
| | | width: 230px; |
| | | } |
| | | |
| | | .line::after { |
| | | content: ''; |
| | | position: absolute; |
| | | right: 2px; |
| | | top: 0; |
| | | bottom: 0; |
| | | width: 1px; |
| | | background-color: #C9C5C5; |
| | | border-radius: 2px; |
| | | content: ''; |
| | | position: absolute; |
| | | right: 2px; |
| | | top: 0; |
| | | bottom: 0; |
| | | width: 1px; |
| | | background-color: #C9C5C5; |
| | | border-radius: 2px; |
| | | } |
| | | |
| | | .contract-list li { |
| | | margin-top: 10px; |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | .quality-cards { |
| | | display: flex; |
| | | gap: 12px; |
| | | margin-bottom: 12px; |
| | | display: flex; |
| | | gap: 12px; |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .quality-card { |
| | | border-radius: 8px; |
| | | padding: 15px 10px 10px 50px; |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: rgba(0,0,0,0.67); |
| | | width: 236px; |
| | | height: 49px; |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | border-radius: 8px; |
| | | padding: 15px 10px 10px 50px; |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: rgba(0, 0, 0, 0.67); |
| | | width: 236px; |
| | | height: 49px; |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | } |
| | | |
| | | .quality-card.one { |
| | | background-image: url("../assets/images/yuancailiao.png"); |
| | | background-image: url("../assets/images/yuancailiao.png"); |
| | | } |
| | | |
| | | .quality-card.two { |
| | | background-image: url("../assets/images/guocheng.png"); |
| | | background-image: url("../assets/images/guocheng.png"); |
| | | } |
| | | |
| | | .quality-card.three { |
| | | background-image: url("../assets/images/chuchang.png"); |
| | | |
| | | background-image: url("../assets/images/chuchang.png"); |
| | | |
| | | } |
| | | |
| | | .quality-card span { |
| | | color: #4fc3f7; |
| | | font-weight: bold; |
| | | margin-left: 6px; |
| | | color: #4fc3f7; |
| | | font-weight: bold; |
| | | margin-left: 6px; |
| | | } |
| | | |
| | | .chart { |
| | | width: 100%; |
| | | height: 220px; |
| | | margin-top: 10px; |
| | | width: 100%; |
| | | height: 220px; |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | .process-panel { |
| | | padding-bottom: 10px; |
| | | } |
| | | |
| | | .process-panel__header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | |
| | | .process-panel__body { |
| | | display: flex; |
| | | gap: 24px; |
| | | align-items: stretch; |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | .process-panel__chart { |
| | | flex: 1; |
| | | min-width: 0; |
| | | padding: 6px 0; |
| | | } |
| | | |
| | | .process-panel__aside { |
| | | width: 260px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 12px; |
| | | } |
| | | |
| | | .process-legend { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10px; |
| | | align-items: flex-start; |
| | | padding: 8px 6px; |
| | | } |
| | | |
| | | .process-legend__item { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8px; |
| | | font-size: 13px; |
| | | color: rgba(0, 0, 0, 0.55); |
| | | } |
| | | |
| | | .dot { |
| | | width: 10px; |
| | | height: 10px; |
| | | border-radius: 2px; |
| | | display: inline-block; |
| | | } |
| | | |
| | | .dot-blue { |
| | | background: #1E5BFF; |
| | | } |
| | | |
| | | .dot-yellow { |
| | | background: #F7B500; |
| | | } |
| | | |
| | | .dot-teal { |
| | | background: #19C6C6; |
| | | } |
| | | |
| | | .process-card { |
| | | background: rgba(245, 247, 250, 0.9); |
| | | border-radius: 10px; |
| | | padding: 16px 16px; |
| | | } |
| | | |
| | | .process-card--name { |
| | | background: rgba(235, 242, 255, 1); |
| | | color: #1E5BFF; |
| | | font-weight: 800; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .process-card__label { |
| | | font-size: 13px; |
| | | color: rgba(0, 0, 0, 0.55); |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .process-card__value { |
| | | font-size: 24px; |
| | | font-weight: 800; |
| | | color: rgba(0, 0, 0, 0.8); |
| | | } |
| | | |
| | | .process-card__value .unit { |
| | | font-size: 12px; |
| | | font-weight: 600; |
| | | color: rgba(0, 0, 0, 0.45); |
| | | margin-left: 6px; |
| | | } |
| | | |
| | | @media (max-width: 1200px) { |
| | | .process-panel__body { |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .process-panel__aside { |
| | | width: 100%; |
| | | flex-direction: row; |
| | | flex-wrap: wrap; |
| | | } |
| | | |
| | | .process-card { |
| | | flex: 1; |
| | | min-width: 220px; |
| | | } |
| | | } |
| | | |
| | | .process-selection-wrapper { |
| | | max-height: 400px; |
| | | overflow-y: auto; |
| | | padding: 10px; |
| | | } |
| | | |
| | | .process-grid { |
| | | display: grid; |
| | | grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); |
| | | gap: 12px; |
| | | } |
| | | |
| | | :deep(.el-checkbox.is-bordered) { |
| | | margin-left: 0 !important; |
| | | width: 100%; |
| | | } |
| | | </style> |
| | |
| | | const stockRecordTypeOptions = ref([]); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | size: 10, |
| | | }); |
| | | const total = ref(0); |
| | | |
| | |
| | | getStockInRecordListPage(params) |
| | | .then(res => { |
| | | tableData.value = res.data.records; |
| | | total.value = res.data.total || 0; |
| | | }).finally(() => { |
| | | tableLoading.value = false; |
| | | }) |
| | |
| | | style="width: 240px;" |
| | | /> |
| | | |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px"> |
| | | <el-button type="primary" @click="onSearch" style="margin-left: 10px"> |
| | | æ¥è¯¢ |
| | | </el-button> |
| | | <el-button @click="handleReset">éç½®</el-button> |
| | |
| | | show-overflow-tooltip |
| | | /> |
| | | </el-table> |
| | | <pagination |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" |
| | | /> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, nextTick } from 'vue' |
| | | import { ref, reactive, onMounted, nextTick, getCurrentInstance } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import * as echarts from 'echarts' |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { |
| | | getStockInventoryInAndOutReportList, |
| | | getStockInventoryReportList |
| | | } from "@/api/inventoryManagement/stockInventory.js"; |
| | | import { |
| | | findAllQualifiedStockInRecordTypeOptions, |
| | | findAllQualifiedStockInRecordTypeOptions,findAllUnQualifiedStockInRecordTypeOptions, |
| | | } from "@/api/basicData/enum.js"; |
| | | |
| | | |
| | |
| | | tableData: [] |
| | | }) |
| | | |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | }) |
| | | |
| | | const total = ref(0) |
| | | |
| | | const stockRecordTypeOptions = ref([]) |
| | | |
| | | const getRecordType = (recordType) => { |
| | |
| | | findAllQualifiedStockInRecordTypeOptions() |
| | | .then(res => { |
| | | stockRecordTypeOptions.value = res.data; |
| | | findAllUnQualifiedStockInRecordTypeOptions() |
| | | .then(res => { |
| | | stockRecordTypeOptions.value = [...stockRecordTypeOptions.value,...res.data]; |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | // æ¥è¡¨ç±»åæ¹å |
| | | const handleReportTypeChange = () => { |
| | | page.current = 1 |
| | | reportData.value = { |
| | | summary: null, |
| | | chartData: null, |
| | |
| | | |
| | | tableLoading.value = true |
| | | try { |
| | | const params = getQueryParams() |
| | | const baseParams = getQueryParams() |
| | | const params = { |
| | | ...baseParams, |
| | | current: page.current, |
| | | size: page.size, |
| | | } |
| | | let response |
| | | |
| | | if (searchForm.reportType === 'inout') { |
| | |
| | | response = await getStockInventoryReportList(params) |
| | | } |
| | | if (response.code === 200) { |
| | | reportData.value.tableData = response.data.records |
| | | reportData.value.tableData = response.data.records || [] |
| | | total.value = response.data.total || 0 |
| | | // reportData.value.summary = response.data.summary |
| | | // reportData.value.chartData = response.data.chartData |
| | | // nextTick(() => { |
| | |
| | | } finally { |
| | | tableLoading.value = false |
| | | } |
| | | } |
| | | |
| | | // æ¥è¯¢æé®ï¼éç½®å°ç¬¬ä¸é¡µå¹¶æ¥è¯¢ |
| | | const onSearch = () => { |
| | | page.current = 1 |
| | | handleQuery() |
| | | } |
| | | |
| | | // å页åå |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page |
| | | page.size = obj.limit |
| | | handleQuery() |
| | | } |
| | | // // çæåæ°æ® |
| | | // const generateMockData = () => { |
| | |
| | | ] |
| | | |
| | | fetchStockRecordTypeOptions() |
| | | // åå§åå è½½ä¸æ¬¡æ°æ® |
| | | handleQuery() |
| | | }) |
| | | </script> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- ç»è®¡æ¦è§ --> |
| | | <el-row :gutter="16" style="margin-bottom: 16px"> |
| | | <el-col :span="6"> |
| | | <el-card shadow="never"> |
| | | <div>æ»ä»»å¡æ°</div> |
| | | <div style="font-size: 22px; font-weight: 600; margin-top: 4px"> |
| | | {{ totalTasks }} |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-card shadow="never"> |
| | | <div>è¿è¡ä¸ä»»å¡</div> |
| | | <div style="font-size: 22px; font-weight: 600; margin-top: 4px"> |
| | | {{ runningTasks }} |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-card shadow="never"> |
| | | <div>已宿任å¡</div> |
| | | <div style="font-size: 22px; font-weight: 600; margin-top: 4px"> |
| | | {{ finishedTasks }} |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-card shadow="never"> |
| | | <div>宿ç</div> |
| | | <div style="font-size: 22px; font-weight: 600; margin-top: 4px"> |
| | | {{ completionRate }}% |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- æ¥è¯¢æ¡ä»¶ --> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">ä»»å¡ç¼å·ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.taskNo" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥ä»»å¡ç¼å·" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | |
| | | <span class="search_title ml10">车è¾ç¼å·ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.vehicleCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥è½¦è¾ç¼å·" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | |
| | | <span class="search_title ml10">任塿¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.dateRange" |
| | | type="daterange" |
| | | range-separator="è³" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | |
| | | <span class="search_title ml10">ç¶æï¼</span> |
| | | <el-select |
| | | v-model="searchForm.status" |
| | | style="width: 140px" |
| | | placeholder="è¯·éæ©ä»»å¡ç¶æ" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in statusOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" icon="Plus" @click="openAdd"> |
| | | æ°å»ºè¿è¾ä»»å¡ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- è¡¨æ ¼ --> |
| | | <div class="table_list"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | style="width: 100%" |
| | | height="calc(100vh - 22em)" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | :row-class-name="tableRowClassName" |
| | | > |
| | | <el-table-column type="index" label="åºå·" width="60" align="center" /> |
| | | <el-table-column |
| | | prop="taskNo" |
| | | label="ä»»å¡ç¼å·" |
| | | width="150" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="outboundOrderNo" |
| | | label="åºåºè®¢åå·" |
| | | width="180" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="vehicleCode" |
| | | label="车è¾ç¼å·" |
| | | width="130" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="plateNumber" |
| | | label="车çå·ç " |
| | | width="120" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="driverName" |
| | | label="叿º" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="loadAddress" |
| | | label="è£
è´§å°ç¹" |
| | | width="160" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="deliveryAddress" |
| | | label="éè´§å°ç¹" |
| | | width="160" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="loadTime" |
| | | label="è£
è´§æ¶é´" |
| | | width="160" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="deliveryTime" |
| | | label="éè´§æ¶é´" |
| | | width="160" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="signTime" |
| | | label="ç¾æ¶æ¶é´" |
| | | width="160" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column label="ç¶æ" width="110" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag :type="statusTagType(scope.row.status)"> |
| | | {{ scope.row.status }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="è¿åº¦" width="150" align="center"> |
| | | <template #default="scope"> |
| | | <el-progress |
| | | :percentage="scope.row.progress" |
| | | :status="scope.row.status === '已宿' ? 'success' : undefined" |
| | | :stroke-width="12" |
| | | :show-text="false" |
| | | /> |
| | | <div style="font-size: 12px; margin-top: 4px"> |
| | | {{ scope.row.progress }}% |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" fixed="right" width="160" align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | size="small" |
| | | @click="openEdit(scope.row)" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | link |
| | | size="small" |
| | | @click="removeRow(scope.row)" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¼¹çª --> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | :title="dialogTitle" |
| | | width="780px" |
| | | destroy-on-close |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="110px" |
| | | label-position="right" |
| | | > |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä»»å¡ç¼å·ï¼" prop="taskNo"> |
| | | <el-input |
| | | v-model="form.taskNo" |
| | | placeholder="请è¾å
¥ä»»å¡ç¼å·" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åºåºè®¢åå·ï¼" prop="outboundOrderNo"> |
| | | <el-input |
| | | v-model="form.outboundOrderNo" |
| | | placeholder="请è¾å
¥å
³èåºåºè®¢åå·" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="车è¾ç¼å·ï¼" prop="vehicleCode"> |
| | | <el-input |
| | | v-model="form.vehicleCode" |
| | | placeholder="请è¾å
¥è½¦è¾ç¼å·" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="车çå·ç ï¼" prop="plateNumber"> |
| | | <el-input |
| | | v-model="form.plateNumber" |
| | | placeholder="请è¾å
¥è½¦çå·ç " |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="叿ºï¼" prop="driverName"> |
| | | <el-input |
| | | v-model="form.driverName" |
| | | placeholder="请è¾å
¥å¸æºå§å" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="叿ºçµè¯ï¼" prop="driverPhone"> |
| | | <el-input |
| | | v-model="form.driverPhone" |
| | | placeholder="请è¾å
¥å¸æºèç³»çµè¯" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è£
è´§å°ç¹ï¼" prop="loadAddress"> |
| | | <el-input |
| | | v-model="form.loadAddress" |
| | | placeholder="请è¾å
¥è£
è´§å°ç¹" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éè´§å°ç¹ï¼" prop="deliveryAddress"> |
| | | <el-input |
| | | v-model="form.deliveryAddress" |
| | | placeholder="请è¾å
¥éè´§å°ç¹" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="è£
è´§æ¶é´ï¼" prop="loadTime"> |
| | | <el-date-picker |
| | | v-model="form.loadTime" |
| | | type="datetime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | format="YYYY-MM-DD HH:mm" |
| | | placeholder="è¯·éæ©è£
è´§æ¶é´" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="éè´§æ¶é´ï¼" prop="deliveryTime"> |
| | | <el-date-picker |
| | | v-model="form.deliveryTime" |
| | | type="datetime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | format="YYYY-MM-DD HH:mm" |
| | | placeholder="è¯·éæ©éè´§æ¶é´" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="ç¾æ¶æ¶é´ï¼" prop="signTime"> |
| | | <el-date-picker |
| | | v-model="form.signTime" |
| | | type="datetime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | format="YYYY-MM-DD HH:mm" |
| | | placeholder="è¯·éæ©ç¾æ¶æ¶é´" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¶æï¼" prop="status"> |
| | | <el-select v-model="form.status" placeholder="è¯·éæ©ä»»å¡ç¶æ"> |
| | | <el-option |
| | | v-for="item in statusOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è®¡åæ¥æï¼" prop="planDate"> |
| | | <el-date-picker |
| | | v-model="form.planDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©è®¡åæ¥æ" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="handleCancel">å æ¶</el-button> |
| | | <el-button type="primary" @click="handleSubmit">ä¿ å</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed, onMounted } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | |
| | | // 模æè¿è¾ä»»å¡æ°æ® |
| | | const rawTasks = ref([ |
| | | { |
| | | id: 1, |
| | | taskNo: "T2024-1201-001", |
| | | outboundOrderNo: "OUT-2024-1201-1001", |
| | | vehicleCode: "CL-202401", |
| | | plateNumber: "粤A12345", |
| | | driverName: "å¼ å¸å
", |
| | | driverPhone: "13800000001", |
| | | loadAddress: "æ·±å³ä»åºAåº", |
| | | deliveryAddress: "广å·å®¢æ·ä¸é¨", |
| | | planDate: "2024-12-01", |
| | | loadTime: "2024-12-01 09:00:00", |
| | | deliveryTime: "2024-12-01 14:30:00", |
| | | signTime: "2024-12-01 15:00:00", |
| | | status: "已宿", |
| | | }, |
| | | { |
| | | id: 2, |
| | | taskNo: "T2024-1201-002", |
| | | outboundOrderNo: "OUT-2024-1201-1002", |
| | | vehicleCode: "CL-202402", |
| | | plateNumber: "粤B67890", |
| | | driverName: "æå¸å
", |
| | | driverPhone: "13800000002", |
| | | loadAddress: "æ·±å³ä»åºBåº", |
| | | deliveryAddress: "ä¸è客æ·äºé¨", |
| | | planDate: "2024-12-01", |
| | | loadTime: "2024-12-01 10:00:00", |
| | | deliveryTime: "2024-12-01 13:00:00", |
| | | signTime: "", |
| | | status: "è¿è¾ä¸", |
| | | }, |
| | | { |
| | | id: 3, |
| | | taskNo: "T2024-1202-001", |
| | | outboundOrderNo: "OUT-2024-1202-1003", |
| | | vehicleCode: "CL-202401", |
| | | plateNumber: "粤A12345", |
| | | driverName: "å¼ å¸å
", |
| | | driverPhone: "13800000001", |
| | | loadAddress: "æ·±å³ä»åºAåº", |
| | | deliveryAddress: "ä½å±±å®¢æ·ä¸é¨", |
| | | planDate: "2024-12-02", |
| | | loadTime: "2024-12-02 08:30:00", |
| | | deliveryTime: "", |
| | | signTime: "", |
| | | status: "å¾
å车", |
| | | }, |
| | | { |
| | | id: 4, |
| | | taskNo: "T2024-1203-001", |
| | | outboundOrderNo: "OUT-2024-1203-1004", |
| | | vehicleCode: "CL-202403", |
| | | plateNumber: "粤C11223", |
| | | driverName: "çå¸å
", |
| | | driverPhone: "13800000003", |
| | | loadAddress: "æ·±å³ä»åºCåº", |
| | | deliveryAddress: "æ å·å®¢æ·åé¨", |
| | | planDate: "2024-12-03", |
| | | loadTime: "", |
| | | deliveryTime: "", |
| | | signTime: "", |
| | | status: "æªå¼å§", |
| | | }, |
| | | ]); |
| | | |
| | | // ç¶ææä¸¾ |
| | | const statusOptions = [ |
| | | { label: "æªå¼å§", value: "æªå¼å§" }, |
| | | { label: "å¾
å车", value: "å¾
å车" }, |
| | | { label: "è¿è¾ä¸", value: "è¿è¾ä¸" }, |
| | | { label: "å¾
ç¾æ¶", value: "å¾
ç¾æ¶" }, |
| | | { label: "已宿", value: "已宿" }, |
| | | ]; |
| | | |
| | | // æ¥è¯¢è¡¨å |
| | | const searchForm = reactive({ |
| | | taskNo: "", |
| | | vehicleCode: "", |
| | | dateRange: [], |
| | | status: "", |
| | | }); |
| | | |
| | | // è¡¨æ ¼æ°æ®ï¼å¸¦è¿åº¦ç计ç®åæ®µï¼ |
| | | const tableData = ref([]); |
| | | |
| | | // ç»è®¡ |
| | | const totalTasks = computed(() => rawTasks.value.length); |
| | | const finishedTasks = computed( |
| | | () => rawTasks.value.filter((t) => t.status === "已宿").length |
| | | ); |
| | | const runningTasks = computed( |
| | | () => |
| | | rawTasks.value.filter((t) => |
| | | ["å¾
å车", "è¿è¾ä¸", "å¾
ç¾æ¶"].includes(t.status) |
| | | ).length |
| | | ); |
| | | const completionRate = computed(() => { |
| | | if (!totalTasks.value) return 0; |
| | | return Math.round((finishedTasks.value / totalTasks.value) * 100); |
| | | }); |
| | | |
| | | // 计ç®åæ¡ä»»å¡è¿åº¦ |
| | | const computeProgress = (task) => { |
| | | if (task.status === "已宿" || task.signTime) return 100; |
| | | if (task.status === "å¾
ç¾æ¶" || task.deliveryTime) return 80; |
| | | if (task.status === "è¿è¾ä¸") return 60; |
| | | if (task.status === "å¾
å车" || task.loadTime) return 30; |
| | | if (task.status === "æªå¼å§") return 0; |
| | | return 0; |
| | | }; |
| | | |
| | | // ç¶æ tag æ ·å¼ |
| | | const statusTagType = (status) => { |
| | | if (status === "已宿") return "success"; |
| | | if (status === "è¿è¾ä¸") return "warning"; |
| | | if (status === "å¾
ç¾æ¶" || status === "å¾
å车") return "info"; |
| | | return "default"; |
| | | }; |
| | | |
| | | // éç®è¡¨æ ¼æ°æ® |
| | | const recomputeTable = () => { |
| | | const filtered = rawTasks.value |
| | | .filter((t) => { |
| | | if (searchForm.taskNo && !t.taskNo.includes(searchForm.taskNo.trim())) { |
| | | return false; |
| | | } |
| | | if ( |
| | | searchForm.vehicleCode && |
| | | !t.vehicleCode.includes(searchForm.vehicleCode.trim()) |
| | | ) { |
| | | return false; |
| | | } |
| | | if (searchForm.status && t.status !== searchForm.status) { |
| | | return false; |
| | | } |
| | | if (Array.isArray(searchForm.dateRange) && searchForm.dateRange.length === 2) { |
| | | const [start, end] = searchForm.dateRange; |
| | | if (!t.planDate || t.planDate < start || t.planDate > end) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | }) |
| | | .map((t) => ({ |
| | | ...t, |
| | | progress: computeProgress(t), |
| | | })); |
| | | |
| | | tableData.value = filtered; |
| | | }; |
| | | |
| | | // æ¥è¯¢ |
| | | const handleQuery = () => { |
| | | recomputeTable(); |
| | | }; |
| | | |
| | | const resetSearch = () => { |
| | | searchForm.taskNo = ""; |
| | | searchForm.vehicleCode = ""; |
| | | searchForm.dateRange = []; |
| | | searchForm.status = ""; |
| | | recomputeTable(); |
| | | }; |
| | | |
| | | // è¡æ ·å¼ |
| | | const tableRowClassName = ({ row }) => { |
| | | if (row.status === "已宿") { |
| | | return "row-finished"; |
| | | } |
| | | if (row.status === "è¿è¾ä¸") { |
| | | return "row-running"; |
| | | } |
| | | return ""; |
| | | }; |
| | | |
| | | // å¼¹çª & 表å |
| | | const dialogVisible = ref(false); |
| | | const dialogTitle = ref("æ°å»ºè¿è¾ä»»å¡"); |
| | | const isEdit = ref(false); |
| | | const formRef = ref(null); |
| | | const form = reactive({ |
| | | id: null, |
| | | taskNo: "", |
| | | outboundOrderNo: "", |
| | | vehicleCode: "", |
| | | plateNumber: "", |
| | | driverName: "", |
| | | driverPhone: "", |
| | | loadAddress: "", |
| | | deliveryAddress: "", |
| | | planDate: "", |
| | | loadTime: "", |
| | | deliveryTime: "", |
| | | signTime: "", |
| | | status: "æªå¼å§", |
| | | }); |
| | | |
| | | const rules = { |
| | | taskNo: [{ required: true, message: "请è¾å
¥ä»»å¡ç¼å·", trigger: "blur" }], |
| | | outboundOrderNo: [ |
| | | { required: true, message: "请è¾å
¥åºåºè®¢åå·", trigger: "blur" }, |
| | | ], |
| | | vehicleCode: [{ required: true, message: "请è¾å
¥è½¦è¾ç¼å·", trigger: "blur" }], |
| | | plateNumber: [{ required: true, message: "请è¾å
¥è½¦çå·ç ", trigger: "blur" }], |
| | | driverName: [{ required: true, message: "请è¾å
¥å¸æºå§å", trigger: "blur" }], |
| | | loadAddress: [{ required: true, message: "请è¾å
¥è£
è´§å°ç¹", trigger: "blur" }], |
| | | deliveryAddress: [ |
| | | { required: true, message: "请è¾å
¥éè´§å°ç¹", trigger: "blur" }, |
| | | ], |
| | | planDate: [{ required: true, message: "è¯·éæ©è®¡åæ¥æ", trigger: "change" }], |
| | | }; |
| | | |
| | | // æ°å»º |
| | | const openAdd = () => { |
| | | dialogTitle.value = "æ°å»ºè¿è¾ä»»å¡"; |
| | | isEdit.value = false; |
| | | Object.assign(form, { |
| | | id: null, |
| | | taskNo: "", |
| | | outboundOrderNo: "", |
| | | vehicleCode: "", |
| | | plateNumber: "", |
| | | driverName: "", |
| | | driverPhone: "", |
| | | loadAddress: "", |
| | | deliveryAddress: "", |
| | | planDate: "", |
| | | loadTime: "", |
| | | deliveryTime: "", |
| | | signTime: "", |
| | | status: "æªå¼å§", |
| | | }); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // ç¼è¾ |
| | | const openEdit = (row) => { |
| | | dialogTitle.value = "ç¼è¾è¿è¾ä»»å¡"; |
| | | isEdit.value = true; |
| | | Object.assign(form, row); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // ä¿å |
| | | const handleSubmit = () => { |
| | | if (!formRef.value) return; |
| | | formRef.value.validate((valid) => { |
| | | if (!valid) return; |
| | | |
| | | if (isEdit.value) { |
| | | const index = rawTasks.value.findIndex((t) => t.id === form.id); |
| | | if (index !== -1) { |
| | | rawTasks.value[index] = { ...form }; |
| | | } |
| | | ElMessage.success("è¿è¾ä»»å¡å·²æ´æ°"); |
| | | } else { |
| | | const newId = rawTasks.value.length |
| | | ? Math.max(...rawTasks.value.map((t) => t.id)) + 1 |
| | | : 1; |
| | | rawTasks.value.push({ ...form, id: newId }); |
| | | ElMessage.success("è¿è¾ä»»å¡å·²æ°å¢"); |
| | | } |
| | | dialogVisible.value = false; |
| | | recomputeTable(); |
| | | }); |
| | | }; |
| | | |
| | | const handleCancel = () => { |
| | | dialogVisible.value = false; |
| | | }; |
| | | |
| | | // å é¤ |
| | | const removeRow = (row) => { |
| | | ElMessageBox.confirm("æ¯å¦ç¡®è®¤å é¤è¯¥è¿è¾ä»»å¡ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | rawTasks.value = rawTasks.value.filter((t) => t.id !== row.id); |
| | | recomputeTable(); |
| | | ElMessage.success("å 餿å"); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | recomputeTable(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | |
| | | ::v-deep(.row-finished) { |
| | | background-color: #f6ffed; |
| | | } |
| | | |
| | | ::v-deep(.row-running) { |
| | | background-color: #fffbe6; |
| | | } |
| | | </style> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- æ¥è¯¢æ¡ä»¶ --> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">车è¾ç¼å·ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.vehicleCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥è½¦è¾ç¼å·" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | |
| | | <span class="search_title ml10">å æ²¹æ¶é´ï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.dateRange" |
| | | type="daterange" |
| | | range-separator="è³" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" icon="Plus" @click="openAdd"> |
| | | æ°å¢å æ²¹è®°å½ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- è¡¨æ ¼ --> |
| | | <div class="table_list"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | style="width: 100%" |
| | | height="calc(100vh - 18.5em)" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | :row-class-name="tableRowClassName" |
| | | > |
| | | <el-table-column type="index" label="åºå·" width="60" align="center" /> |
| | | <el-table-column |
| | | prop="vehicleCode" |
| | | label="车è¾ç¼å·" |
| | | width="130" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="plateNumber" |
| | | label="车çå·ç " |
| | | width="120" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="fuelDate" |
| | | label="å æ²¹æ¥æ" |
| | | width="120" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="gunNo" |
| | | label="æ²¹æªå·" |
| | | width="90" |
| | | align="center" |
| | | /> |
| | | <el-table-column |
| | | prop="amount" |
| | | label="éé¢(å
)" |
| | | width="100" |
| | | align="right" |
| | | > |
| | | <template #default="scope"> |
| | | <span>{{ scope.row.amount?.toFixed(2) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="liters" |
| | | label="åæ°(L)" |
| | | width="90" |
| | | align="right" |
| | | > |
| | | <template #default="scope"> |
| | | <span>{{ scope.row.liters?.toFixed(2) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="startMileage" |
| | | label="èµ·å§éç¨(km)" |
| | | width="120" |
| | | align="right" |
| | | /> |
| | | <el-table-column |
| | | prop="endMileage" |
| | | label="ç»æéç¨(km)" |
| | | width="120" |
| | | align="right" |
| | | /> |
| | | <el-table-column |
| | | prop="distance" |
| | | label="è¡é©¶éç¨(km)" |
| | | width="120" |
| | | align="right" |
| | | /> |
| | | <el-table-column |
| | | prop="fuelConsumption" |
| | | label="æ²¹è(L/100km)" |
| | | width="130" |
| | | align="center" |
| | | > |
| | | <template #default="scope"> |
| | | <span |
| | | :style="scope.row.isAbnormal ? 'color:#F56C6C;font-weight:600;' : ''" |
| | | > |
| | | {{ scope.row.fuelConsumption != null ? scope.row.fuelConsumption.toFixed(2) : '-' }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="avgConsumption" |
| | | label="车è¾å¹³åæ²¹è" |
| | | width="130" |
| | | align="center" |
| | | > |
| | | <template #default="scope"> |
| | | <span> |
| | | {{ scope.row.avgConsumption != null ? scope.row.avgConsumption.toFixed(2) : '-' }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å¼å¸¸é¢è¦" width="100" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag v-if="scope.row.isAbnormal" type="danger" size="small"> |
| | | å¼å¸¸ |
| | | </el-tag> |
| | | <span v-else>-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" fixed="right" width="140" align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | size="small" |
| | | @click="openEdit(scope.row)" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | link |
| | | size="small" |
| | | @click="removeRow(scope.row)" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¼¹çª --> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | :title="dialogTitle" |
| | | width="640px" |
| | | destroy-on-close |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="110px" |
| | | label-position="right" |
| | | > |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="车è¾ç¼å·ï¼" prop="vehicleCode"> |
| | | <el-input |
| | | v-model="form.vehicleCode" |
| | | placeholder="请è¾å
¥è½¦è¾ç¼å·" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="车çå·ç ï¼" prop="plateNumber"> |
| | | <el-input |
| | | v-model="form.plateNumber" |
| | | placeholder="请è¾å
¥è½¦çå·ç " |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å æ²¹æ¥æï¼" prop="fuelDate"> |
| | | <el-date-picker |
| | | v-model="form.fuelDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©å æ²¹æ¥æ" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ²¹æªå·ï¼" prop="gunNo"> |
| | | <el-input |
| | | v-model="form.gunNo" |
| | | placeholder="请è¾å
¥æ²¹æªå·" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éé¢(å
)ï¼" prop="amount"> |
| | | <el-input-number |
| | | v-model="form.amount" |
| | | :min="0" |
| | | :step="0.01" |
| | | :precision="2" |
| | | placeholder="请è¾å
¥éé¢" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åæ°(L)ï¼" prop="liters"> |
| | | <el-input-number |
| | | v-model="form.liters" |
| | | :min="0" |
| | | :step="0.01" |
| | | :precision="2" |
| | | placeholder="请è¾å
¥åæ°" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="èµ·å§éç¨(km)ï¼" prop="startMileage"> |
| | | <el-input-number |
| | | v-model="form.startMileage" |
| | | :min="0" |
| | | :step="1" |
| | | placeholder="请è¾å
¥èµ·å§éç¨" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»æéç¨(km)ï¼" prop="endMileage"> |
| | | <el-input-number |
| | | v-model="form.endMileage" |
| | | :min="0" |
| | | :step="1" |
| | | placeholder="请è¾å
¥ç»æéç¨" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="handleCancel">å æ¶</el-button> |
| | | <el-button type="primary" @click="handleSubmit">ä¿ å</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | |
| | | // 模æå æ²¹è®°å½æ°æ® |
| | | const rawRecords = ref([ |
| | | { |
| | | id: 1, |
| | | vehicleCode: "CL-202401", |
| | | plateNumber: "粤A12345", |
| | | fuelDate: "2024-12-01", |
| | | gunNo: "01", |
| | | amount: 500, |
| | | liters: 70, |
| | | startMileage: 12000, |
| | | endMileage: 12600, |
| | | }, |
| | | { |
| | | id: 2, |
| | | vehicleCode: "CL-202401", |
| | | plateNumber: "粤A12345", |
| | | fuelDate: "2024-12-15", |
| | | gunNo: "02", |
| | | amount: 520, |
| | | liters: 72, |
| | | startMileage: 12600, |
| | | endMileage: 13250, |
| | | }, |
| | | { |
| | | id: 3, |
| | | vehicleCode: "CL-202402", |
| | | plateNumber: "粤B67890", |
| | | fuelDate: "2024-12-05", |
| | | gunNo: "03", |
| | | amount: 430, |
| | | liters: 60, |
| | | startMileage: 8000, |
| | | endMileage: 8520, |
| | | }, |
| | | { |
| | | id: 4, |
| | | vehicleCode: "CL-202402", |
| | | plateNumber: "粤B67890", |
| | | fuelDate: "2024-12-20", |
| | | gunNo: "01", |
| | | amount: 450, |
| | | liters: 63, |
| | | startMileage: 8520, |
| | | endMileage: 9000, |
| | | }, |
| | | { |
| | | id: 5, |
| | | vehicleCode: "CL-202401", |
| | | plateNumber: "粤A12345", |
| | | fuelDate: "2025-01-05", |
| | | gunNo: "01", |
| | | amount: 700, |
| | | liters: 90, |
| | | startMileage: 13250, |
| | | endMileage: 13600, // ææ¾å¼å¸¸æ²¹è |
| | | }, |
| | | ]); |
| | | |
| | | // æ¥è¯¢è¡¨å |
| | | const searchForm = reactive({ |
| | | vehicleCode: "", |
| | | dateRange: [], |
| | | }); |
| | | |
| | | // è¡¨æ ¼æ°æ®ï¼å
å«è®¡ç®åæ®µï¼ |
| | | const tableData = ref([]); |
| | | |
| | | // å¼¹çª & 表å |
| | | const dialogVisible = ref(false); |
| | | const dialogTitle = ref("æ°å¢å 油记å½"); |
| | | const isEdit = ref(false); |
| | | const formRef = ref(null); |
| | | const form = reactive({ |
| | | id: null, |
| | | vehicleCode: "", |
| | | plateNumber: "", |
| | | fuelDate: "", |
| | | gunNo: "", |
| | | amount: null, |
| | | liters: null, |
| | | startMileage: null, |
| | | endMileage: null, |
| | | }); |
| | | |
| | | const rules = { |
| | | vehicleCode: [{ required: true, message: "请è¾å
¥è½¦è¾ç¼å·", trigger: "blur" }], |
| | | plateNumber: [{ required: true, message: "请è¾å
¥è½¦çå·ç ", trigger: "blur" }], |
| | | fuelDate: [{ required: true, message: "è¯·éæ©å æ²¹æ¥æ", trigger: "change" }], |
| | | gunNo: [{ required: true, message: "请è¾å
¥æ²¹æªå·", trigger: "blur" }], |
| | | amount: [{ required: true, message: "请è¾å
¥éé¢", trigger: "blur" }], |
| | | liters: [{ required: true, message: "请è¾å
¥åæ°", trigger: "blur" }], |
| | | startMileage: [{ required: true, message: "请è¾å
¥èµ·å§éç¨", trigger: "blur" }], |
| | | endMileage: [{ required: true, message: "请è¾å
¥ç»æéç¨", trigger: "blur" }], |
| | | }; |
| | | |
| | | // éæ°è®¡ç®æ²¹èã平忲¹èåå¼å¸¸é¢è¦ |
| | | const recomputeTable = () => { |
| | | const records = rawRecords.value; |
| | | |
| | | // 1. å
æè½¦è¾ç»è®¡å¹³åæ²¹è |
| | | const stats = {}; |
| | | records.forEach((r) => { |
| | | const distance = r.endMileage - r.startMileage; |
| | | if (distance <= 0 || !r.liters) return; |
| | | const cons = (r.liters / distance) * 100; // L/100km |
| | | if (!stats[r.vehicleCode]) { |
| | | stats[r.vehicleCode] = { totalCons: 0, count: 0 }; |
| | | } |
| | | stats[r.vehicleCode].totalCons += cons; |
| | | stats[r.vehicleCode].count += 1; |
| | | }); |
| | | |
| | | const avgMap = {}; |
| | | Object.keys(stats).forEach((key) => { |
| | | avgMap[key] = stats[key].totalCons / stats[key].count; |
| | | }); |
| | | |
| | | // 2. æçéæ¡ä»¶è¿æ»¤å¹¶è¡¥å
计ç®å段 |
| | | const filtered = records |
| | | .filter((r) => { |
| | | if ( |
| | | searchForm.vehicleCode && |
| | | !r.vehicleCode.includes(searchForm.vehicleCode.trim()) |
| | | ) { |
| | | return false; |
| | | } |
| | | if (Array.isArray(searchForm.dateRange) && searchForm.dateRange.length === 2) { |
| | | const [start, end] = searchForm.dateRange; |
| | | if (r.fuelDate < start || r.fuelDate > end) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | }) |
| | | .map((r) => { |
| | | const distance = r.endMileage - r.startMileage; |
| | | const fuelConsumption = |
| | | distance > 0 && r.liters |
| | | ? (r.liters / distance) * 100 |
| | | : null; |
| | | const avgConsumption = |
| | | avgMap[r.vehicleCode] != null ? avgMap[r.vehicleCode] : null; |
| | | const isAbnormal = |
| | | avgConsumption != null && |
| | | fuelConsumption != null && |
| | | fuelConsumption > avgConsumption * 1.2; |
| | | |
| | | return { |
| | | ...r, |
| | | distance, |
| | | fuelConsumption, |
| | | avgConsumption, |
| | | isAbnormal, |
| | | }; |
| | | }); |
| | | |
| | | tableData.value = filtered; |
| | | }; |
| | | |
| | | // æ¥è¯¢ |
| | | const handleQuery = () => { |
| | | recomputeTable(); |
| | | }; |
| | | |
| | | const resetSearch = () => { |
| | | searchForm.vehicleCode = ""; |
| | | searchForm.dateRange = []; |
| | | recomputeTable(); |
| | | }; |
| | | |
| | | // è¡æ ·å¼ï¼å¼å¸¸é«äº®ï¼ |
| | | const tableRowClassName = ({ row }) => { |
| | | if (row.isAbnormal) { |
| | | return "row-abnormal"; |
| | | } |
| | | return ""; |
| | | }; |
| | | |
| | | // æ°å¢ |
| | | const openAdd = () => { |
| | | dialogTitle.value = "æ°å¢å 油记å½"; |
| | | isEdit.value = false; |
| | | Object.assign(form, { |
| | | id: null, |
| | | vehicleCode: "", |
| | | plateNumber: "", |
| | | fuelDate: "", |
| | | gunNo: "", |
| | | amount: null, |
| | | liters: null, |
| | | startMileage: null, |
| | | endMileage: null, |
| | | }); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // ç¼è¾ |
| | | const openEdit = (row) => { |
| | | dialogTitle.value = "ç¼è¾å 油记å½"; |
| | | isEdit.value = true; |
| | | Object.assign(form, row); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // ä¿å |
| | | const handleSubmit = () => { |
| | | if (!formRef.value) return; |
| | | formRef.value.validate((valid) => { |
| | | if (!valid) return; |
| | | |
| | | if (form.endMileage <= form.startMileage) { |
| | | ElMessage.warning("ç»æéç¨å¿
须大äºèµ·å§éç¨"); |
| | | return; |
| | | } |
| | | |
| | | if (isEdit.value) { |
| | | const index = rawRecords.value.findIndex((r) => r.id === form.id); |
| | | if (index !== -1) { |
| | | rawRecords.value[index] = { ...form }; |
| | | } |
| | | ElMessage.success("å æ²¹è®°å½å·²æ´æ°"); |
| | | } else { |
| | | const newId = rawRecords.value.length |
| | | ? Math.max(...rawRecords.value.map((r) => r.id)) + 1 |
| | | : 1; |
| | | rawRecords.value.push({ ...form, id: newId }); |
| | | ElMessage.success("å æ²¹è®°å½å·²æ°å¢"); |
| | | } |
| | | dialogVisible.value = false; |
| | | recomputeTable(); |
| | | }); |
| | | }; |
| | | |
| | | const handleCancel = () => { |
| | | dialogVisible.value = false; |
| | | }; |
| | | |
| | | // å é¤ |
| | | const removeRow = (row) => { |
| | | ElMessageBox.confirm("æ¯å¦ç¡®è®¤å é¤è¯¥å 油记å½ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | rawRecords.value = rawRecords.value.filter((r) => r.id !== row.id); |
| | | recomputeTable(); |
| | | ElMessage.success("å 餿å"); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | recomputeTable(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | |
| | | ::v-deep(.row-abnormal) { |
| | | background-color: #fff5f5; |
| | | } |
| | | </style> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- æ¥è¯¢æ¡ä»¶ --> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">车çå·ç ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.plateNumber" |
| | | style="width: 180px" |
| | | placeholder="请è¾å
¥è½¦çå·ç " |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | |
| | | <span class="search_title ml10">车è¾ç±»åï¼</span> |
| | | <el-select |
| | | v-model="searchForm.vehicleType" |
| | | style="width: 160px" |
| | | placeholder="è¯·éæ©è½¦è¾ç±»å" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in vehicleTypeOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | |
| | | <span class="search_title ml10">æå±é¨é¨ï¼</span> |
| | | <el-select |
| | | v-model="searchForm.department" |
| | | style="width: 160px" |
| | | placeholder="è¯·éæ©æå±é¨é¨" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in departmentOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | |
| | | <span class="search_title ml10">ç¶æï¼</span> |
| | | <el-select |
| | | v-model="searchForm.status" |
| | | style="width: 140px" |
| | | placeholder="è¯·éæ©ç¶æ" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in statusOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | |
| | | <span class="search_title ml10">彿¡£ç¶æï¼</span> |
| | | <el-select |
| | | v-model="searchForm.archived" |
| | | style="width: 140px" |
| | | placeholder="è¯·éæ©å½æ¡£ç¶æ" |
| | | clearable |
| | | > |
| | | <el-option label="æªå½æ¡£" value="false" /> |
| | | <el-option label="已彿¡£" value="true" /> |
| | | </el-select> |
| | | |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" icon="Plus" @click="openAdd">æ°å¢è½¦è¾</el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- è¡¨æ ¼ --> |
| | | <div class="table_list"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | style="width: 100%" |
| | | height="calc(100vh - 18.5em)" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | > |
| | | <el-table-column type="index" label="åºå·" width="60" align="center" /> |
| | | <el-table-column |
| | | prop="vehicleCode" |
| | | label="车è¾ç¼å·" |
| | | width="140" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="plateNumber" |
| | | label="车çå·ç " |
| | | width="120" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="vehicleType" |
| | | label="车è¾ç±»å" |
| | | width="120" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="department" |
| | | label="æå±é¨é¨" |
| | | width="140" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="purchaseDate" |
| | | label="è´ç½®æ¥æ" |
| | | width="120" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="licenseNumber" |
| | | label="è¡é©¶è¯ç¼å·" |
| | | width="160" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="licenseIssueDate" |
| | | label="åè¯æ¥æ" |
| | | width="120" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="licenseExpireDate" |
| | | label="å°ææ¥æ" |
| | | width="120" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column label="ç¶æ" width="100" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag :type="statusTagType(scope.row.status)"> |
| | | {{ scope.row.status }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="彿¡£ç¶æ" width="100" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.archived ? 'info' : 'success'"> |
| | | {{ scope.row.archived ? '已彿¡£' : 'æªå½æ¡£' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" fixed="right" width="220" align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | size="small" |
| | | @click="openEdit(scope.row)" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | type="warning" |
| | | link |
| | | size="small" |
| | | :disabled="scope.row.archived" |
| | | @click="archiveRow(scope.row)" |
| | | > |
| | | 彿¡£ |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | link |
| | | size="small" |
| | | @click="removeRow(scope.row)" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¼¹çª --> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | :title="dialogTitle" |
| | | width="600px" |
| | | destroy-on-close |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="100px" |
| | | label-position="right" |
| | | > |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="车è¾ç¼å·ï¼" prop="vehicleCode"> |
| | | <el-input v-model="form.vehicleCode" placeholder="请è¾å
¥è½¦è¾ç¼å·" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="车çå·ç ï¼" prop="plateNumber"> |
| | | <el-input v-model="form.plateNumber" placeholder="请è¾å
¥è½¦çå·ç " /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="车è¾ç±»åï¼" prop="vehicleType"> |
| | | <el-select |
| | | v-model="form.vehicleType" |
| | | placeholder="è¯·éæ©è½¦è¾ç±»å" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in vehicleTypeOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æå±é¨é¨ï¼" prop="department"> |
| | | <el-select |
| | | v-model="form.department" |
| | | placeholder="è¯·éæ©æå±é¨é¨" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in departmentOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è´ç½®æ¥æï¼" prop="purchaseDate"> |
| | | <el-date-picker |
| | | v-model="form.purchaseDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©è´ç½®æ¥æ" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¶æï¼" prop="status"> |
| | | <el-select v-model="form.status" placeholder="è¯·éæ©ç¶æ"> |
| | | <el-option |
| | | v-for="item in statusOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è¡é©¶è¯ç¼å·ï¼" prop="licenseNumber"> |
| | | <el-input |
| | | v-model="form.licenseNumber" |
| | | placeholder="请è¾å
¥è¡é©¶è¯ç¼å·" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åè¯æ¥æï¼" prop="licenseIssueDate"> |
| | | <el-date-picker |
| | | v-model="form.licenseIssueDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©åè¯æ¥æ" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å°ææ¥æï¼" prop="licenseExpireDate"> |
| | | <el-date-picker |
| | | v-model="form.licenseExpireDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©å°ææ¥æ" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="handleCancel">å æ¶</el-button> |
| | | <el-button type="primary" @click="handleSubmit">ä¿ å</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | |
| | | // 模æè½¦è¾åºç¡æ°æ® |
| | | const allVehicles = ref([ |
| | | { |
| | | id: 1, |
| | | vehicleCode: "CL-202401", |
| | | plateNumber: "粤A12345", |
| | | vehicleType: "å¢å¼è´§è½¦", |
| | | department: "ç©æµä¸é¨", |
| | | purchaseDate: "2022-03-15", |
| | | licenseNumber: "4401-2022-0001", |
| | | licenseIssueDate: "2022-03-10", |
| | | licenseExpireDate: "2026-03-10", |
| | | status: "å¨ç¨", |
| | | archived: false, |
| | | }, |
| | | { |
| | | id: 2, |
| | | vehicleCode: "CL-202402", |
| | | plateNumber: "粤B67890", |
| | | vehicleType: "å·è车", |
| | | department: "ç©æµäºé¨", |
| | | purchaseDate: "2021-08-01", |
| | | licenseNumber: "4401-2021-0123", |
| | | licenseIssueDate: "2021-07-28", |
| | | licenseExpireDate: "2025-07-28", |
| | | status: "ç»´ä¿®", |
| | | archived: false, |
| | | }, |
| | | { |
| | | id: 3, |
| | | vehicleCode: "CL-202403", |
| | | plateNumber: "粤C11223", |
| | | vehicleType: "çµå¼è½¦", |
| | | department: "项ç®è¿è¾é¨", |
| | | purchaseDate: "2020-05-20", |
| | | licenseNumber: "4401-2020-0456", |
| | | licenseIssueDate: "2020-05-18", |
| | | licenseExpireDate: "2024-05-18", |
| | | status: "é²ç½®", |
| | | archived: false, |
| | | }, |
| | | { |
| | | id: 4, |
| | | vehicleCode: "CL-202404", |
| | | plateNumber: "粤D33445", |
| | | vehicleType: "å¢å¼è´§è½¦", |
| | | department: "èµäº§ç®¡çé¨", |
| | | purchaseDate: "2019-11-11", |
| | | licenseNumber: "4401-2019-0789", |
| | | licenseIssueDate: "2019-11-08", |
| | | licenseExpireDate: "2023-11-08", |
| | | status: "å¨ç¨", |
| | | archived: true, |
| | | }, |
| | | ]); |
| | | |
| | | // 䏿æä¸¾ |
| | | const vehicleTypeOptions = [ |
| | | { label: "å¢å¼è´§è½¦", value: "å¢å¼è´§è½¦" }, |
| | | { label: "å·è车", value: "å·è车" }, |
| | | { label: "çµå¼è½¦", value: "çµå¼è½¦" }, |
| | | { label: "å
¶ä»", value: "å
¶ä»" }, |
| | | ]; |
| | | |
| | | const departmentOptions = [ |
| | | { label: "ç©æµä¸é¨", value: "ç©æµä¸é¨" }, |
| | | { label: "ç©æµäºé¨", value: "ç©æµäºé¨" }, |
| | | { label: "项ç®è¿è¾é¨", value: "项ç®è¿è¾é¨" }, |
| | | { label: "èµäº§ç®¡çé¨", value: "èµäº§ç®¡çé¨" }, |
| | | ]; |
| | | |
| | | const statusOptions = [ |
| | | { label: "å¨ç¨", value: "å¨ç¨" }, |
| | | { label: "é²ç½®", value: "é²ç½®" }, |
| | | { label: "ç»´ä¿®", value: "ç»´ä¿®" }, |
| | | ]; |
| | | |
| | | // æ¥è¯¢è¡¨å |
| | | const searchForm = reactive({ |
| | | plateNumber: "", |
| | | vehicleType: "", |
| | | department: "", |
| | | status: "", |
| | | archived: "", |
| | | }); |
| | | |
| | | // è¡¨æ ¼æ°æ® |
| | | const tableData = ref([...allVehicles.value]); |
| | | |
| | | // å¼¹çª & 表å |
| | | const dialogVisible = ref(false); |
| | | const dialogTitle = ref("æ°å¢è½¦è¾"); |
| | | const isEdit = ref(false); |
| | | const formRef = ref(null); |
| | | const form = reactive({ |
| | | id: null, |
| | | vehicleCode: "", |
| | | plateNumber: "", |
| | | vehicleType: "", |
| | | department: "", |
| | | purchaseDate: "", |
| | | licenseNumber: "", |
| | | licenseIssueDate: "", |
| | | licenseExpireDate: "", |
| | | status: "å¨ç¨", |
| | | archived: false, |
| | | }); |
| | | |
| | | const rules = { |
| | | vehicleCode: [{ required: true, message: "请è¾å
¥è½¦è¾ç¼å·", trigger: "blur" }], |
| | | plateNumber: [{ required: true, message: "请è¾å
¥è½¦çå·ç ", trigger: "blur" }], |
| | | vehicleType: [{ required: true, message: "è¯·éæ©è½¦è¾ç±»å", trigger: "change" }], |
| | | department: [{ required: true, message: "è¯·éæ©æå±é¨é¨", trigger: "change" }], |
| | | purchaseDate: [{ required: true, message: "è¯·éæ©è´ç½®æ¥æ", trigger: "change" }], |
| | | status: [{ required: true, message: "è¯·éæ©ç¶æ", trigger: "change" }], |
| | | licenseNumber: [{ required: true, message: "请è¾å
¥è¡é©¶è¯ç¼å·", trigger: "blur" }], |
| | | licenseIssueDate: [{ required: true, message: "è¯·éæ©åè¯æ¥æ", trigger: "change" }], |
| | | }; |
| | | |
| | | // æ¥è¯¢ |
| | | const handleQuery = () => { |
| | | tableData.value = allVehicles.value.filter((item) => { |
| | | if ( |
| | | searchForm.plateNumber && |
| | | !item.plateNumber.includes(searchForm.plateNumber.trim()) |
| | | ) { |
| | | return false; |
| | | } |
| | | if (searchForm.vehicleType && item.vehicleType !== searchForm.vehicleType) { |
| | | return false; |
| | | } |
| | | if (searchForm.department && item.department !== searchForm.department) { |
| | | return false; |
| | | } |
| | | if (searchForm.status && item.status !== searchForm.status) { |
| | | return false; |
| | | } |
| | | if (searchForm.archived !== "") { |
| | | const targetArchived = searchForm.archived === "true"; |
| | | if (item.archived !== targetArchived) return false; |
| | | } |
| | | return true; |
| | | }); |
| | | }; |
| | | |
| | | const resetSearch = () => { |
| | | searchForm.plateNumber = ""; |
| | | searchForm.vehicleType = ""; |
| | | searchForm.department = ""; |
| | | searchForm.status = ""; |
| | | searchForm.archived = ""; |
| | | handleQuery(); |
| | | }; |
| | | |
| | | // æ°å¢ |
| | | const openAdd = () => { |
| | | dialogTitle.value = "æ°å¢è½¦è¾"; |
| | | isEdit.value = false; |
| | | Object.assign(form, { |
| | | id: null, |
| | | vehicleCode: "", |
| | | plateNumber: "", |
| | | vehicleType: "", |
| | | department: "", |
| | | purchaseDate: "", |
| | | licenseInfo: "", |
| | | status: "å¨ç¨", |
| | | archived: false, |
| | | }); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // ç¼è¾ |
| | | const openEdit = (row) => { |
| | | dialogTitle.value = "ç¼è¾è½¦è¾"; |
| | | isEdit.value = true; |
| | | Object.assign(form, row); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // ä¿å |
| | | const handleSubmit = () => { |
| | | if (!formRef.value) return; |
| | | formRef.value.validate((valid) => { |
| | | if (!valid) return; |
| | | if (isEdit.value) { |
| | | const index = allVehicles.value.findIndex((v) => v.id === form.id); |
| | | if (index !== -1) { |
| | | allVehicles.value[index] = { ...form }; |
| | | } |
| | | ElMessage.success("车è¾ä¿¡æ¯å·²æ´æ°"); |
| | | } else { |
| | | const newId = allVehicles.value.length |
| | | ? Math.max(...allVehicles.value.map((v) => v.id)) + 1 |
| | | : 1; |
| | | allVehicles.value.push({ ...form, id: newId }); |
| | | ElMessage.success("车è¾ä¿¡æ¯å·²æ°å¢"); |
| | | } |
| | | dialogVisible.value = false; |
| | | handleQuery(); |
| | | }); |
| | | }; |
| | | |
| | | const handleCancel = () => { |
| | | dialogVisible.value = false; |
| | | }; |
| | | |
| | | // 彿¡£ |
| | | const archiveRow = (row) => { |
| | | if (row.archived) return; |
| | | ElMessageBox.confirm( |
| | | "æ¯å¦ç¡®è®¤å°è¯¥è½¦è¾å½æ¡£ï¼å½æ¡£åä»
ä¿çæ¥è¯¢ï¼ä¸ååä¸è¿è¾ä»»å¡åé
ã", |
| | | "彿¡£æç¤º", |
| | | { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | } |
| | | ) |
| | | .then(() => { |
| | | row.archived = true; |
| | | if (row.status === "å¨ç¨") { |
| | | row.status = "é²ç½®"; |
| | | } |
| | | ElMessage.success("车è¾å·²å½æ¡£"); |
| | | handleQuery(); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // å é¤ |
| | | const removeRow = (row) => { |
| | | ElMessageBox.confirm("æ¯å¦ç¡®è®¤å é¤è¯¥è½¦è¾åºç¡ä¿¡æ¯ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | allVehicles.value = allVehicles.value.filter((v) => v.id !== row.id); |
| | | handleQuery(); |
| | | ElMessage.success("å 餿å"); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // ç¶ææ ·å¼ |
| | | const statusTagType = (status) => { |
| | | if (status === "å¨ç¨") return "success"; |
| | | if (status === "é²ç½®") return "info"; |
| | | if (status === "ç»´ä¿®") return "warning"; |
| | | return "default"; |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | </style> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- åå·¥æå¡åº --> |
| | | <el-card shadow="never" class="mb16"> |
| | | <div class="attendance-header"> |
| | | <div> |
| | | <div class="title">æå¡ç¾å°</div> |
| | | <div class="sub-title">æ¯æä¸é®æå¡ï¼èªå¨è®°å½ä¸ä¸çæ¶é´</div> |
| | | </div> |
| | | <div class="attendance-actions"> |
| | | <div class="time-block"> |
| | | <div class="label">å½åæ¶é´</div> |
| | | <div class="value">{{ nowTime }}</div> |
| | | </div> |
| | | <el-button type="primary" size="large" @click="handleCheckInOut"> |
| | | {{ checkInOutText }} |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <el-descriptions border :column="4" class="mt10"> |
| | | <el-descriptions-item label="åå·¥å§å"> |
| | | {{ currentUser.name }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="å·¥å·"> |
| | | {{ currentUser.no }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="æå±é¨é¨"> |
| | | {{ currentUser.dept }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="仿¥ç¶æ"> |
| | | <el-tag :type="todayStatusTag" size="small"> |
| | | {{ todayStatusText }} |
| | | </el-tag> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="ä¸çæ¶é´"> |
| | | {{ todayRecord?.checkInTime || '-' }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="ä¸çæ¶é´"> |
| | | {{ todayRecord?.checkOutTime || '-' }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="å·¥æ¶(å°æ¶)"> |
| | | {{ todayRecord?.workHours ?? '-' }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="å¼å¸¸æ è®°"> |
| | | <span v-if="todayRecord?.status === 'normal'">-</span> |
| | | <el-tag v-else type="danger" size="small"> |
| | | {{ todayRecord?.statusText }} |
| | | </el-tag> |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | </el-card> |
| | | |
| | | <!-- æ¥è¯¢æ¡ä»¶ï¼ç®¡çåè夿¥æ¥ï¼ --> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">é¨é¨ï¼</span> |
| | | <el-select |
| | | v-model="searchForm.dept" |
| | | placeholder="è¯·éæ©é¨é¨" |
| | | style="width: 180px" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in deptOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | |
| | | <span class="search_title ml10">æ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.date" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | clearable |
| | | /> |
| | | |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button icon="Download" @click="handleExport"> |
| | | 导åºè夿¥æ¥ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- è夿¥æ¥è¡¨æ ¼ --> |
| | | <div class="table_list"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | style="width: 100%" |
| | | height="calc(100vh - 24em)" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | :row-class-name="rowClassName" |
| | | > |
| | | <el-table-column type="index" label="åºå·" width="60" align="center" /> |
| | | <el-table-column |
| | | prop="date" |
| | | label="æ¥æ" |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="dept" |
| | | label="é¨é¨" |
| | | width="140" |
| | | /> |
| | | <el-table-column |
| | | prop="name" |
| | | label="å§å" |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="no" |
| | | label="å·¥å·" |
| | | width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="checkInTime" |
| | | label="ä¸çæ¶é´" |
| | | width="140" |
| | | /> |
| | | <el-table-column |
| | | prop="checkOutTime" |
| | | label="ä¸çæ¶é´" |
| | | width="140" |
| | | /> |
| | | <el-table-column |
| | | prop="workHours" |
| | | label="å·¥æ¶(å°æ¶)" |
| | | width="110" |
| | | align="center" |
| | | /> |
| | | <el-table-column |
| | | prop="statusText" |
| | | label="èå¤ç¶æ" |
| | | width="120" |
| | | align="center" |
| | | > |
| | | <template #default="scope"> |
| | | <el-tag |
| | | v-if="scope.row.status === 'normal'" |
| | | type="success" |
| | | size="small" |
| | | > |
| | | æ£å¸¸ |
| | | </el-tag> |
| | | <el-tag |
| | | v-else |
| | | type="danger" |
| | | size="small" |
| | | > |
| | | {{ scope.row.statusText }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="remark" |
| | | label="夿³¨" |
| | | show-overflow-tooltip |
| | | /> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed, onMounted, onBeforeUnmount } from "vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | | // 模æå½åç»å½åå·¥ |
| | | const currentUser = reactive({ |
| | | id: 1, |
| | | name: "å¼ ä¸", |
| | | no: "E10001", |
| | | dept: "ç产ä¸é¨", |
| | | }); |
| | | |
| | | // é¨é¨é项 |
| | | const deptOptions = [ |
| | | { label: "ç产ä¸é¨", value: "ç产ä¸é¨" }, |
| | | { label: "ç产äºé¨", value: "ç产äºé¨" }, |
| | | { label: "设å¤ç»´æ¤é¨", value: "设å¤ç»´æ¤é¨" }, |
| | | { label: "è´¨æ£é¨", value: "è´¨æ£é¨" }, |
| | | ]; |
| | | |
| | | // 模æèå¤åå§æ°æ® |
| | | const rawAttendance = ref([ |
| | | { |
| | | id: 1, |
| | | date: "2024-12-01", |
| | | userId: 1, |
| | | name: "å¼ ä¸", |
| | | no: "E10001", |
| | | dept: "ç产ä¸é¨", |
| | | checkInTime: "08:58", |
| | | checkOutTime: "18:10", |
| | | workHours: 9.2, |
| | | status: "normal", |
| | | statusText: "æ£å¸¸", |
| | | remark: "", |
| | | }, |
| | | { |
| | | id: 2, |
| | | date: "2024-12-01", |
| | | userId: 2, |
| | | name: "æå", |
| | | no: "E10002", |
| | | dept: "ç产ä¸é¨", |
| | | checkInTime: "09:15", |
| | | checkOutTime: "18:05", |
| | | workHours: 8.8, |
| | | status: "late", |
| | | statusText: "è¿å°", |
| | | remark: "å äº¤éæ¥å µè¿å°", |
| | | }, |
| | | { |
| | | id: 3, |
| | | date: "2024-12-01", |
| | | userId: 3, |
| | | name: "çäº", |
| | | no: "E20001", |
| | | dept: "设å¤ç»´æ¤é¨", |
| | | checkInTime: "08:50", |
| | | checkOutTime: "17:20", |
| | | workHours: 8.5, |
| | | status: "early", |
| | | statusText: "æ©é", |
| | | remark: "å¤åºå¤çç´§æ¥æ
é", |
| | | }, |
| | | { |
| | | id: 4, |
| | | date: "2024-12-02", |
| | | userId: 1, |
| | | name: "å¼ ä¸", |
| | | no: "E10001", |
| | | dept: "ç产ä¸é¨", |
| | | checkInTime: "08:45", |
| | | checkOutTime: "18:30", |
| | | workHours: 9.7, |
| | | status: "normal", |
| | | statusText: "æ£å¸¸", |
| | | remark: "å ç0.5å°æ¶", |
| | | }, |
| | | ]); |
| | | |
| | | // æ¥è¯¢è¡¨å |
| | | const searchForm = reactive({ |
| | | dept: "", |
| | | date: "", |
| | | }); |
| | | |
| | | // è¡¨æ ¼æ°æ® |
| | | const tableData = ref([]); |
| | | |
| | | // å½åæ¶é´å±ç¤º |
| | | const nowTime = ref(""); |
| | | let timer = null; |
| | | |
| | | const updateNowTime = () => { |
| | | const now = new Date(); |
| | | const Y = now.getFullYear(); |
| | | const M = String(now.getMonth() + 1).padStart(2, "0"); |
| | | const D = String(now.getDate()).padStart(2, "0"); |
| | | const h = String(now.getHours()).padStart(2, "0"); |
| | | const m = String(now.getMinutes()).padStart(2, "0"); |
| | | const s = String(now.getSeconds()).padStart(2, "0"); |
| | | nowTime.value = `${Y}-${M}-${D} ${h}:${m}:${s}`; |
| | | }; |
| | | |
| | | // 仿¥æ¥æ |
| | | const todayStr = computed(() => nowTime.value.slice(0, 10)); |
| | | |
| | | // 彿¥å½ååå·¥èå¤è®°å½ |
| | | const todayRecord = computed(() => |
| | | rawAttendance.value.find( |
| | | (item) => |
| | | item.userId === currentUser.id && item.date === todayStr.value |
| | | ) |
| | | ); |
| | | |
| | | // æå¡æé®ææ¬ |
| | | const checkInOutText = computed(() => { |
| | | if (!todayRecord.value || !todayRecord.value.checkInTime) { |
| | | return "ä¸çæå¡"; |
| | | } |
| | | if (!todayRecord.value.checkOutTime) { |
| | | return "ä¸çæå¡"; |
| | | } |
| | | return "仿¥å·²æå¡å®æ"; |
| | | }); |
| | | |
| | | // 仿¥ç¶æå±ç¤º |
| | | const todayStatusTag = computed(() => { |
| | | if (!todayRecord.value) return "info"; |
| | | if (todayRecord.value.status === "normal") return "success"; |
| | | return "danger"; |
| | | }); |
| | | |
| | | const todayStatusText = computed(() => { |
| | | if (!todayRecord.value) return "æªæå¡"; |
| | | return todayRecord.value.statusText || "æ£å¸¸"; |
| | | }); |
| | | |
| | | // è¡æ ·å¼ï¼å¼å¸¸é«äº® |
| | | const rowClassName = ({ row }) => { |
| | | if (row.status === "late" || row.status === "early") { |
| | | return "row-abnormal"; |
| | | } |
| | | return ""; |
| | | }; |
| | | |
| | | // æ¥è¯¢ |
| | | const recomputeTable = () => { |
| | | const list = rawAttendance.value.filter((item) => { |
| | | if (searchForm.dept && item.dept !== searchForm.dept) { |
| | | return false; |
| | | } |
| | | if (searchForm.date && item.date !== searchForm.date) { |
| | | return false; |
| | | } |
| | | return true; |
| | | }); |
| | | tableData.value = list; |
| | | }; |
| | | |
| | | const handleQuery = () => { |
| | | recomputeTable(); |
| | | }; |
| | | |
| | | const resetSearch = () => { |
| | | searchForm.dept = ""; |
| | | searchForm.date = ""; |
| | | recomputeTable(); |
| | | }; |
| | | |
| | | // 导åºï¼æ¼ç¤ºï¼ |
| | | const handleExport = () => { |
| | | ElMessage.success("å½å为æ¼ç¤ºé¡µé¢ï¼å¯¼åºåè½æªå¯¹æ¥å®é
æ¥å£"); |
| | | }; |
| | | |
| | | // æå¡é»è¾ï¼ä»
å端模æï¼ |
| | | const handleCheckInOut = () => { |
| | | const [dateStr, timeStr] = nowTime.value.split(" "); |
| | | if (!dateStr || !timeStr) return; |
| | | |
| | | // ä¸çæå¡ |
| | | if (!todayRecord.value) { |
| | | const newId = rawAttendance.value.length |
| | | ? Math.max(...rawAttendance.value.map((i) => i.id)) + 1 |
| | | : 1; |
| | | const status = |
| | | timeStr > "09:00:00" ? "late" : "normal"; |
| | | const statusText = status === "late" ? "è¿å°" : "æ£å¸¸"; |
| | | rawAttendance.value.push({ |
| | | id: newId, |
| | | date: dateStr, |
| | | userId: currentUser.id, |
| | | name: currentUser.name, |
| | | no: currentUser.no, |
| | | dept: currentUser.dept, |
| | | checkInTime: timeStr.slice(0, 5), |
| | | checkOutTime: "", |
| | | workHours: null, |
| | | status, |
| | | statusText, |
| | | remark: "", |
| | | }); |
| | | ElMessage.success("ä¸çæå¡æå"); |
| | | } else if (!todayRecord.value.checkOutTime) { |
| | | // ä¸çæå¡ |
| | | todayRecord.value.checkOutTime = timeStr.slice(0, 5); |
| | | // ç®åæ 9:00-18:00 计ç®å·¥æ¶ |
| | | const start = todayRecord.value.checkInTime || "09:00"; |
| | | const [sh, sm] = start.split(":").map((v) => parseInt(v, 10)); |
| | | const [eh, em] = todayRecord.value.checkOutTime |
| | | .split(":") |
| | | .map((v) => parseInt(v, 10)); |
| | | const diff = (eh * 60 + em - (sh * 60 + sm)) / 60; |
| | | todayRecord.value.workHours = Number(Math.max(diff, 0).toFixed(1)); |
| | | |
| | | // æ©é夿ï¼18:00 å离å¼è§ä¸ºæ©éï¼åªç¤ºæï¼ |
| | | if (timeStr < "18:00:00") { |
| | | todayRecord.value.status = "early"; |
| | | todayRecord.value.statusText = "æ©é"; |
| | | } else if (todayRecord.value.status === "normal") { |
| | | todayRecord.value.statusText = "æ£å¸¸"; |
| | | } |
| | | ElMessage.success("ä¸çæå¡æå"); |
| | | } else { |
| | | ElMessage.info("仿¥å·²å®æä¸ä¸çæå¡"); |
| | | } |
| | | |
| | | recomputeTable(); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | updateNowTime(); |
| | | timer = setInterval(updateNowTime, 1000); |
| | | // é»è®¤å±ç¤ºå½å¤©æ°æ® |
| | | const today = new Date(); |
| | | const Y = today.getFullYear(); |
| | | const M = String(today.getMonth() + 1).padStart(2, "0"); |
| | | const D = String(today.getDate()).padStart(2, "0"); |
| | | searchForm.date = `${Y}-${M}-${D}`; |
| | | recomputeTable(); |
| | | }); |
| | | |
| | | onBeforeUnmount(() => { |
| | | if (timer) { |
| | | clearInterval(timer); |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .mb16 { |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .attendance-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | |
| | | .attendance-header .title { |
| | | font-size: 18px; |
| | | font-weight: 600; |
| | | margin-bottom: 4px; |
| | | } |
| | | |
| | | .attendance-header .sub-title { |
| | | font-size: 13px; |
| | | color: #909399; |
| | | } |
| | | |
| | | .attendance-actions { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 16px; |
| | | } |
| | | |
| | | .time-block { |
| | | text-align: right; |
| | | } |
| | | |
| | | .time-block .label { |
| | | font-size: 12px; |
| | | color: #909399; |
| | | } |
| | | |
| | | .time-block .value { |
| | | font-size: 18px; |
| | | font-weight: 600; |
| | | color: #333; |
| | | } |
| | | |
| | | ::v-deep(.row-abnormal) { |
| | | background-color: #fff5f5; |
| | | } |
| | | </style> |
| | | |
| | |
| | | delProduct(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | closeProductDia(); |
| | | getSalesLedgerWithProducts({ id: currentId.value, type: 2 }).then( |
| | | getPurchaseById({ id: currentId.value, type: 2 }).then( |
| | | res => { |
| | | productData.value = res.productData; |
| | | } |
| | |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | // æ£æ¥æ¯å¦æä»äººç»´æ¤çæ°æ® |
| | | const unauthorizedData = selectedRows.value.filter( |
| | | item => item.recorderName !== userStore.nickName |
| | | ); |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®"); |
| | | return; |
| | | } |
| | | ids = selectedRows.value.map(item => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- æ¥è¯¢æ¡ä»¶ --> |
| | | <el-form |
| | | :model="queryParams" |
| | | ref="queryForm" |
| | | :inline="true" |
| | | v-show="showSearch" |
| | | label-width="90px" |
| | | > |
| | | <el-form-item label="产ååå·" prop="productModel"> |
| | | <el-input |
| | | v-model="queryParams.productModel" |
| | | placeholder="请è¾å
¥äº§ååå·" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="客æ·åç§°" prop="customerName"> |
| | | <el-input |
| | | v-model="queryParams.customerName" |
| | | placeholder="请è¾å
¥å®¢æ·åç§°" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="å馿¶é´" prop="feedbackRange"> |
| | | <el-date-picker |
| | | v-model="queryParams.feedbackRange" |
| | | type="daterange" |
| | | range-separator="è³" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="å¤çç¶æ" prop="status"> |
| | | <el-select |
| | | v-model="queryParams.status" |
| | | placeholder="è¯·éæ©å¤çç¶æ" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in statusOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- æä½åº --> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="3"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="Plus" |
| | | @click="handleAdd" |
| | | > |
| | | æ°å¢å®åè´¨éè®°å½ |
| | | </el-button> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="Edit" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | > |
| | | ä¿®æ¹ |
| | | </el-button> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="Delete" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="Download" |
| | | @click="handleExport" |
| | | > |
| | | å¯¼åº |
| | | </el-button> |
| | | </el-col> |
| | | <right-toolbar |
| | | v-model:showSearch="showSearch" |
| | | @queryTable="getList" |
| | | /> |
| | | </el-row> |
| | | |
| | | <!-- æ°æ®è¡¨ --> |
| | | <el-table |
| | | v-loading="loading" |
| | | :data="afterSalesList" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="åºå·" type="index" width="55" align="center" /> |
| | | <el-table-column label="éå®ååå·" prop="contractNo" width="160" /> |
| | | <el-table-column label="产åç¼å·" prop="productCode" width="140" /> |
| | | <el-table-column label="产ååå·" prop="productModel" width="140" /> |
| | | <el-table-column label="客æ·åç§°" prop="customerName" width="160" /> |
| | | <el-table-column label="èç³»æ¹å¼" prop="contact" width="140" /> |
| | | <el-table-column label="å馿¶é´" prop="feedbackTime" width="160"> |
| | | <template #default="scope"> |
| | | <span>{{ scope.row.feedbackTime }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="é®é¢æè¿°" prop="problemDesc" show-overflow-tooltip /> |
| | | <el-table-column label="ç»´ä¿®æ
åµ" prop="repairInfo" show-overflow-tooltip /> |
| | | <el-table-column label="å¤çç»æ" prop="result" show-overflow-tooltip /> |
| | | <el-table-column label="å¤çç¶æ" prop="status" width="120" align="center"> |
| | | <template #default="scope"> |
| | | <dict-tag |
| | | :options="statusOptions" |
| | | :value="scope.row.status" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width" width="160" fixed="right"> |
| | | <template #default="scope"> |
| | | <el-button size="small" type="text" icon="Edit" @click="handleUpdate(scope.row)"> |
| | | ä¿®æ¹ |
| | | </el-button> |
| | | <el-button size="small" type="text" icon="Delete" @click="handleDelete(scope.row)"> |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | |
| | | <!-- æ°å¢/ä¿®æ¹å¼¹çª --> |
| | | <el-dialog |
| | | :title="title" |
| | | v-model="open" |
| | | width="900px" |
| | | append-to-body |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="110px" |
| | | > |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éå®ååå·" prop="contractNo"> |
| | | <el-input |
| | | v-model="form.contractNo" |
| | | placeholder="è¯·éæ©å
³èéå®ååå·" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产åç¼å·" prop="productCode"> |
| | | <el-input |
| | | v-model="form.productCode" |
| | | placeholder="è¯·éæ©å
³è产åç¼å·" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产ååå·" prop="productModel"> |
| | | <el-input |
| | | v-model="form.productModel" |
| | | placeholder="请è¾å
¥äº§ååå·" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="客æ·åç§°" prop="customerName"> |
| | | <el-input |
| | | v-model="form.customerName" |
| | | placeholder="请è¾å
¥å®¢æ·åç§°" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="èç³»æ¹å¼" prop="contact"> |
| | | <el-input |
| | | v-model="form.contact" |
| | | placeholder="请è¾å
¥å®¢æ·èç³»æ¹å¼" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å馿¶é´" prop="feedbackTime"> |
| | | <el-date-picker |
| | | v-model="form.feedbackTime" |
| | | type="datetime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | format="YYYY-MM-DD HH:mm" |
| | | placeholder="è¯·éæ©å馿¶é´" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="客æ·åé¦é®é¢" prop="problemDesc"> |
| | | <el-input |
| | | v-model="form.problemDesc" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请详ç»è®°å½å®¢æ·åé¦é®é¢ãç°è±¡æè¿°çä¿¡æ¯" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´ä¿®æ
åµ" prop="repairInfo"> |
| | | <el-input |
| | | v-model="form.repairInfo" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="è®°å½ç»´ä¿®è¿ç¨ã使ç¨å¤ä»¶ãè¿ä¿®æ¬¡æ°ç" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¤çç»æ" prop="result"> |
| | | <el-input |
| | | v-model="form.result" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="è®°å½æç»å¤çç»æï¼å¦æ´æ¢ãéè´§ãå级ç" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¤çç¶æ" prop="status"> |
| | | <el-select |
| | | v-model="form.status" |
| | | placeholder="è¯·éæ©å¤çç¶æ" |
| | | > |
| | | <el-option |
| | | v-for="item in statusOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input |
| | | v-model="form.remark" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="å¯è®°å½åç»è·è¸ªæè§ãå¤çç»è®ºç" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="AfterSalesTraceability"> |
| | | import { ref, reactive, onMounted } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // ç¶æåå
¸ |
| | | const statusOptions = ref([ |
| | | { label: "å¾
å¤ç", value: "0" }, |
| | | { label: "å¤çä¸", value: "1" }, |
| | | { label: "已宿", value: "2" }, |
| | | { label: "å·²å
³é", value: "3" }, |
| | | ]); |
| | | |
| | | // 模æå®åè´¨éæ°æ® |
| | | const afterSalesList = ref([ |
| | | { |
| | | id: 1, |
| | | contractNo: "SC-2024-001", |
| | | productCode: "P-10001", |
| | | productModel: "XG-500A", |
| | | customerName: "ååçµåç§ææéå
¬å¸", |
| | | contact: "å¼ å·¥ / 13800000001", |
| | | feedbackTime: "2024-12-01 10:23:00", |
| | | problemDesc: "使ç¨ä¸ä¸ªæååºç°é´ææ§æçµï¼å½±å产线稳å®è¿è¡ã", |
| | | repairInfo: "宿工ç¨å¸ä¸é¨æ£ä¿®ï¼æ´æ¢çµæºæ¨¡åå¹¶å åºæ¥çº¿ç«¯åã", |
| | | result: "æ´æ¢çµæºæ»æï¼æ¢å¤æ£å¸¸ä½¿ç¨ï¼å»ºè®®å®¢æ·å¢å UPSä¿æ¤ã", |
| | | status: "2", |
| | | remark: "åå
¥éç¹è·è¸ªå®¢æ·ï¼åç»è§å¯ä¸ä¸ªå£åº¦ã", |
| | | }, |
| | | { |
| | | id: 2, |
| | | contractNo: "SC-2024-015", |
| | | productCode: "P-10045", |
| | | productModel: "XG-500B", |
| | | customerName: "åä¸ç²¾å¯å¶é æéå
¬å¸", |
| | | contact: "æå·¥ / 13800000002", |
| | | feedbackTime: "2024-12-05 15:40:00", |
| | | problemDesc: "é¨åæ¹æ¬¡åºç°å¤å£³å®è±ï¼å®¢æ·æè¯å¤è§è´¨éä¸è¾¾æ ã", |
| | | repairInfo: "ä¸ç产ç°åºæ ¸æ¥ï¼ç¡®è®¤æ¥ææ¬è¿åå
è£
ç¯èåå¨ç£ç¢°é£é©ã", |
| | | result: "对é®é¢æ¹æ¬¡éæ°è¿å·¥ï¼è¡¥åè¯åï¼å¹¶ä¼åå
è£
鲿¤æ¹æ¡ã", |
| | | status: "1", |
| | | remark: "éè·è¸ªåç»æ¹æ¬¡æè¯çååã", |
| | | }, |
| | | { |
| | | id: 3, |
| | | contractNo: "SC-2024-032", |
| | | productCode: "P-10110", |
| | | productModel: "XG-600C", |
| | | customerName: "è¥¿åæ°è½æºç§æè¡ä»½", |
| | | contact: "çå·¥ / 13800000003", |
| | | feedbackTime: "2024-11-28 09:15:00", |
| | | problemDesc: "ç°åºè°è¯æ¶åç°æ¥å£ä¸å
¼å®¹ï¼éè¦éé
å®¢æ·æ§çç³»ç»ã", |
| | | repairInfo: "è¿ç¨ææ¯æ¯æ+ç°åºå·¥ç¨å¸èåææ¥ï¼æä¾è¿æ¸¡éé
æ¹æ¡ã", |
| | | result: "éè¿æ´æ¢æ¥æä»¶å¹¶å级åºä»¶çæ¬è§£å³ã", |
| | | status: "0", |
| | | remark: "å»ºè®®ä¸æ¬¡åååç½®æ²éæ¥å£è§æ ¼ã", |
| | | }, |
| | | ]); |
| | | |
| | | const open = ref(false); |
| | | const loading = ref(false); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(3); |
| | | const title = ref("æ°å¢å®åè´¨éè®°å½"); |
| | | |
| | | const data = reactive({ |
| | | form: {}, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | productModel: null, |
| | | customerName: null, |
| | | feedbackRange: [], |
| | | status: null, |
| | | }, |
| | | rules: { |
| | | contractNo: [ |
| | | { required: true, message: "éå®ååå·ä¸è½ä¸ºç©º", trigger: "blur" }, |
| | | ], |
| | | productCode: [ |
| | | { required: true, message: "产åç¼å·ä¸è½ä¸ºç©º", trigger: "blur" }, |
| | | ], |
| | | productModel: [ |
| | | { required: true, message: "产ååå·ä¸è½ä¸ºç©º", trigger: "blur" }, |
| | | ], |
| | | customerName: [ |
| | | { required: true, message: "客æ·åç§°ä¸è½ä¸ºç©º", trigger: "blur" }, |
| | | ], |
| | | contact: [ |
| | | { required: true, message: "èç³»æ¹å¼ä¸è½ä¸ºç©º", trigger: "blur" }, |
| | | ], |
| | | feedbackTime: [ |
| | | { required: true, message: "å馿¶é´ä¸è½ä¸ºç©º", trigger: "change" }, |
| | | ], |
| | | problemDesc: [ |
| | | { required: true, message: "客æ·åé¦é®é¢ä¸è½ä¸ºç©º", trigger: "blur" }, |
| | | ], |
| | | status: [ |
| | | { required: true, message: "å¤çç¶æä¸è½ä¸ºç©º", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | |
| | | const { queryParams, form, rules } = toRefs(data); |
| | | |
| | | // æ¥è¯¢å表ï¼ä»
å端çéï¼ä¸è°æ¥å£ï¼ |
| | | function getList() { |
| | | loading.value = true; |
| | | const list = afterSalesList.value.filter((item) => { |
| | | if ( |
| | | queryParams.value.productModel && |
| | | !item.productModel |
| | | ?.toLowerCase() |
| | | .includes(queryParams.value.productModel.toLowerCase()) |
| | | ) { |
| | | return false; |
| | | } |
| | | if ( |
| | | queryParams.value.customerName && |
| | | !item.customerName |
| | | ?.toLowerCase() |
| | | .includes(queryParams.value.customerName.toLowerCase()) |
| | | ) { |
| | | return false; |
| | | } |
| | | if (queryParams.value.status && item.status !== queryParams.value.status) { |
| | | return false; |
| | | } |
| | | if ( |
| | | Array.isArray(queryParams.value.feedbackRange) && |
| | | queryParams.value.feedbackRange.length === 2 |
| | | ) { |
| | | const [start, end] = queryParams.value.feedbackRange; |
| | | const dateStr = item.feedbackTime?.slice(0, 10); |
| | | if (dateStr < start || dateStr > end) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | }); |
| | | total.value = list.length; |
| | | // æ¤å¤æªåå页ï¼ä»
模æå
¨éå±ç¤º |
| | | afterSalesList.value = list; |
| | | loading.value = false; |
| | | } |
| | | |
| | | // åæ¶ |
| | | function cancel() { |
| | | open.value = false; |
| | | reset(); |
| | | } |
| | | |
| | | // 表åéç½® |
| | | function reset() { |
| | | form.value = { |
| | | id: null, |
| | | contractNo: null, |
| | | productCode: null, |
| | | productModel: null, |
| | | customerName: null, |
| | | contact: null, |
| | | feedbackTime: null, |
| | | problemDesc: null, |
| | | repairInfo: null, |
| | | result: null, |
| | | status: "0", |
| | | remark: null, |
| | | }; |
| | | proxy.resetForm("formRef"); |
| | | } |
| | | |
| | | // æç´¢ |
| | | function handleQuery() { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | |
| | | // éç½® |
| | | function resetQuery() { |
| | | proxy.resetForm("queryForm"); |
| | | queryParams.value.feedbackRange = []; |
| | | handleQuery(); |
| | | } |
| | | |
| | | // å¤é |
| | | function handleSelectionChange(selection) { |
| | | ids.value = selection.map((item) => item.id); |
| | | single.value = selection.length !== 1; |
| | | multiple.value = !selection.length; |
| | | } |
| | | |
| | | // æ°å¢ |
| | | function handleAdd() { |
| | | reset(); |
| | | open.value = true; |
| | | title.value = "æ°å¢å®åè´¨éè®°å½"; |
| | | } |
| | | |
| | | // ä¿®æ¹ |
| | | function handleUpdate(row) { |
| | | reset(); |
| | | const current = row || afterSalesList.value.find((item) => item.id === ids.value[0]); |
| | | if (current) { |
| | | form.value = { ...current }; |
| | | open.value = true; |
| | | title.value = "ä¿®æ¹å®åè´¨éè®°å½"; |
| | | } |
| | | } |
| | | |
| | | // æäº¤ |
| | | function submitForm() { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (form.value.id != null) { |
| | | // ä¿®æ¹ï¼æ¿æ¢æ¬å°æ¨¡ææ°æ® |
| | | const index = afterSalesList.value.findIndex( |
| | | (item) => item.id === form.value.id |
| | | ); |
| | | if (index !== -1) { |
| | | afterSalesList.value.splice(index, 1, { ...form.value }); |
| | | } |
| | | proxy.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | } else { |
| | | // æ°å¢ï¼æå
¥æ¬å°æ¨¡ææ°æ® |
| | | const newId = |
| | | afterSalesList.value.length > 0 |
| | | ? Math.max(...afterSalesList.value.map((i) => i.id)) + 1 |
| | | : 1; |
| | | afterSalesList.value.push({ ...form.value, id: newId }); |
| | | proxy.$modal.msgSuccess("æ°å¢æå"); |
| | | } |
| | | open.value = false; |
| | | getList(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // å é¤ |
| | | function handleDelete(row) { |
| | | const deleteIds = row?.id ? [row.id] : ids.value; |
| | | if (!deleteIds || deleteIds.length === 0) { |
| | | proxy.$modal.msgWarning("请å
éæ©è¦å é¤çè®°å½"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | 'æ¯å¦ç¡®è®¤å é¤éä¸çå®åè´¨éè®°å½ï¼', |
| | | "è¦å", |
| | | { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | } |
| | | ) |
| | | .then(() => { |
| | | // å端å 餿¬å°æ¨¡ææ°æ® |
| | | afterSalesList.value = afterSalesList.value.filter( |
| | | (item) => !deleteIds.includes(item.id) |
| | | ); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .catch(() => {}); |
| | | } |
| | | |
| | | // å¯¼åº |
| | | function handleExport() { |
| | | proxy.$modal.msgSuccess("导åºåè½ä¸ºæ¼ç¤ºåè½ï¼å½åæªå¯¹æ¥å®é
å¯¼åºæ¥å£"); |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .mb8 { |
| | | margin-bottom: 8px; |
| | | } |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | </style> |
| | | |
| | |
| | | border: 1px solid #1a58b0; |
| | | padding: 18px; |
| | | width: 100%; |
| | | height: 428px; |
| | | height: 432px; |
| | | } |
| | | </style> |
| | | |
| | |
| | | import { ref, onMounted } from 'vue' |
| | | import * as echarts from 'echarts' |
| | | import Echarts from '@/components/Echarts/echarts.vue' |
| | | import { productInOutAnalysis } from '@/api/viewIndex.js' |
| | | import { inputOutputAnalysis } from '@/api/viewIndex.js' |
| | | |
| | | const chartStyle = { width: '100%', height: '100%' } |
| | | const grid = { |
| | |
| | | } |
| | | |
| | | const fetchData = () => { |
| | | productInOutAnalysis({ type: 1 }) |
| | | inputOutputAnalysis() |
| | | .then((res) => { |
| | | if (res.code === 200 && Array.isArray(res.data)) { |
| | | const list = res.data |
| | | xAxis1.value[0].data = list.map((d) => d.date) |
| | | lineSeries.value[0].data = list.map((d) => Number(d.outCount) || 0) |
| | | lineSeries.value[1].data = list.map((d) => Number(d.inCount) || 0) |
| | | lineSeries.value[0].data = list.map((d) => Number(d.outputSum) || 0) |
| | | lineSeries.value[1].data = list.map((d) => Number(d.inputSum) || 0) |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | |
| | | |
| | | <script setup> |
| | | import { ref, onMounted } from 'vue' |
| | | import { salesPurchaseStorageProductCount } from '@/api/viewIndex.js' |
| | | import { orderCount } from '@/api/viewIndex.js' |
| | | |
| | | const statItems = ref([]) |
| | | |
| | |
| | | const compareClass = (val) => (val >= 0 ? 'compare-up' : 'compare-down') |
| | | |
| | | const fetchData = () => { |
| | | salesPurchaseStorageProductCount() |
| | | orderCount() |
| | | .then((res) => { |
| | | if (res.code === 200 && Array.isArray(res.data)) { |
| | | statItems.value = res.data.map((item) => ({ |
| | |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | console.error('è·åéå®/éè´/å¨åäº§åæ°å¤±è´¥:', err) |
| | | console.error('è·åè®¢åæ°éç»è®¡å¤±è´¥:', err) |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | .card-label { |
| | | font-weight: 400; |
| | | font-size: 19px; |
| | | font-size: 16px; |
| | | color: rgba(208, 231, 255, 0.7); |
| | | } |
| | | |
| | |
| | | |
| | | <script setup> |
| | | import { ref, onMounted, onBeforeUnmount, computed } from 'vue' |
| | | import { productSalesAnalysis } from '@/api/viewIndex.js' |
| | | import { processOutputAnalysis } from '@/api/viewIndex.js' |
| | | import PanelHeader from './PanelHeader.vue' |
| | | import Echarts from '@/components/Echarts/echarts.vue' |
| | | import DateTypeSwitch from '@/views/reportAnalysis/financialAnalysis/components/DateTypeSwitch.vue' |
| | |
| | | formatter: function (name) { |
| | | const item = pieObjData.value[name] |
| | | if (!item) return name |
| | | return `{title|${name}}{value|${item.value}}{unit|å
}{percent|${item.rate}}{unit|%}` |
| | | return `{title|${name}}{value|${item.value}}{unit|ä»¶}{percent|${item.rate}}{unit|%}` |
| | | }, |
| | | textStyle: { |
| | | rich: { |
| | |
| | | |
| | | const pieTooltip = { |
| | | trigger: 'item', |
| | | formatter: '{a} <br/>{b} : {c}å
({d}%)', |
| | | formatter: '{a} <br/>{b} : {c}ä»¶ ({d}%)', |
| | | } |
| | | |
| | | const pieSeries = computed(() => [ |
| | | { |
| | | name: '产åéå®éé¢åæ', |
| | | name: 'å·¥åºäº§åºåæ', |
| | | type: 'pie', |
| | | radius: '60%', |
| | | center: ['25%', '50%'], |
| | |
| | | }) |
| | | |
| | | const fetchData = () => { |
| | | productSalesAnalysis() |
| | | processOutputAnalysis({ dateType: dateType.value }) |
| | | .then((res) => { |
| | | if (res.code === 200 && Array.isArray(res.data)) { |
| | | const items = res.data |
| | |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | console.error('è·å产åéå®éé¢åæå¤±è´¥:', err) |
| | | console.error('è·åå·¥åºäº§åºåæå¤±è´¥:', err) |
| | | }) |
| | | } |
| | | |
| | |
| | | import DateTypeSwitch from './DateTypeSwitch.vue' |
| | | import Echarts from '@/components/Echarts/echarts.vue' |
| | | |
| | | const dateType = ref(1) // 1=å¨ 2=æ 3=å£åº¦ |
| | | const dateType = ref(1) |
| | | |
| | | const chartStyle = { |
| | | width: '100%', |
| | | height: '140%', |
| | | } |
| | | |
| | | const grid = { left: '10%', right: '4%', bottom: '3%', top: '10%', containLabel: true } |
| | | const grid = { left: '3%', right: '4%', bottom: '3%', top: '10%', containLabel: true } |
| | | |
| | | const barLegend = { |
| | | show: true, |
| | | textStyle: { color: '#B8C8E0' }, |
| | | data: ['产é', 'å·¥èµ', 'åæ ¼ç'], |
| | | data: ['宿æ°é', 'å·¥èµéé¢', 'åæ ¼ç'], |
| | | } |
| | | |
| | | // æ±ç¶å¾ï¼äº§éãå·¥èµï¼æçº¿å¾ï¼åæ ¼çï¼ç»¿è²ï¼ |
| | | const chartSeries = ref([ |
| | | { |
| | | name: '产é', |
| | | name: '宿æ°é', |
| | | type: 'bar', |
| | | barWidth: 20, |
| | | barGap: '40%', |
| | | yAxisIndex: 0, |
| | | emphasis: { focus: 'series' }, |
| | | itemStyle: { |
| | | color: { |
| | |
| | | data: [], |
| | | }, |
| | | { |
| | | name: 'å·¥èµ', |
| | | name: 'å·¥èµéé¢', |
| | | type: 'bar', |
| | | barGap: '40%', |
| | | barWidth: 20, |
| | | yAxisIndex: 1, |
| | | emphasis: { focus: 'series' }, |
| | | itemStyle: { |
| | | color: { |
| | |
| | | { |
| | | name: 'åæ ¼ç', |
| | | type: 'line', |
| | | yAxisIndex: 2, |
| | | yAxisIndex: 1, |
| | | showSymbol: true, |
| | | symbol: 'circle', |
| | | symbolSize: 8, |
| | |
| | | }, |
| | | ]) |
| | | |
| | | const tooltip = { |
| | | trigger: 'axis', |
| | | axisPointer: { type: 'cross' }, |
| | | formatter(params) { |
| | | let result = params[0].axisValueLabel + '<br/>' |
| | | params.forEach((item) => { |
| | | let unit = 'ä»¶' |
| | | if (item.seriesName === 'åæ ¼ç') unit = '%' |
| | | else if (item.seriesName === 'å·¥èµ') unit = 'å
' |
| | | result += `<div>${item.marker} ${item.seriesName}: ${item.value}${unit}</div>` |
| | | }) |
| | | return result |
| | | }, |
| | | } |
| | | |
| | | const xAxis1 = ref([ |
| | | { type: 'category', axisTick: { show: false }, axisLabel: { color: '#B8C8E0' }, data: [] }, |
| | | ]) |
| | | |
| | | const yAxis1 = [ |
| | | { type: 'value', name: '产é(ä»¶)', position: 'left', axisLabel: { color: '#B8C8E0' }, nameTextStyle: { color: '#B8C8E0' } }, |
| | | { type: 'value', name: 'å·¥èµ(å
)', position: 'left', offset: 50, axisLabel: { color: '#B8C8E0' }, nameTextStyle: { color: '#B8C8E0' } }, |
| | | { |
| | | type: 'value', |
| | | name: 'æ°é/éé¢', |
| | | axisLabel: { color: '#B8C8E0' }, |
| | | nameTextStyle: { color: '#B8C8E0' }, |
| | | // splitLine: { lineStyle: { color: 'rgba(184, 200, 224, 0.2)' } }, |
| | | }, |
| | | { |
| | | type: 'value', |
| | | name: 'åæ ¼ç(%)', |
| | | position: 'right', |
| | | min: 0, |
| | | max: 100, |
| | | axisLabel: { color: '#B8C8E0', formatter: '{value}%' }, |
| | |
| | | }, |
| | | ] |
| | | |
| | | const tooltip = { |
| | | trigger: 'axis', |
| | | axisPointer: { type: 'cross' }, |
| | | formatter(params) { |
| | | let result = params[0].axisValueLabel + '<br/>' |
| | | params.forEach((item) => { |
| | | const unit = item.seriesName === 'åæ ¼ç' ? '%' : (item.seriesName === 'å·¥èµéé¢' ? ' å
' : ' 个') |
| | | result += `<div>${item.marker} ${item.seriesName}: ${item.value}${unit}</div>` |
| | | }) |
| | | return result |
| | | }, |
| | | } |
| | | |
| | | const handleDateTypeChange = () => { |
| | | fetchData() |
| | | } |
| | |
| | | const fetchData = () => { |
| | | productionAccountingAnalysis({ type: dateType.value }) |
| | | .then((res) => { |
| | | console.log('res ======> ', res) |
| | | if (res.code === 200 && Array.isArray(res.data)) { |
| | | const items = res.data |
| | | |
| | | if (!Array.isArray(res?.data)) return |
| | | |
| | | const items = res.data |
| | | |
| | | xAxis1.value[0].data = items.map(d => d.dateStr) |
| | | |
| | | // 产é |
| | | chartSeries.value[0].data = items.map(d => Number(d.numberOfCompleted) || 0) |
| | | |
| | | // å·¥èµ |
| | | chartSeries.value[1].data = items.map(d => Number(d.amount) || 0) |
| | | |
| | | // åæ ¼ç |
| | | chartSeries.value[2].data = items.map(d => Number(d.passRate) || 0) |
| | | xAxis1.value[0].data = items.map(item => item.dateStr) |
| | | chartSeries.value[0].data = items.map(item => Number(item.numberOfCompleted) || 0) |
| | | chartSeries.value[1].data = items.map(item => Number(item.amount) || 0) |
| | | chartSeries.value[2].data = items.map(item => Number(item.passRate) || 0) |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | console.error('è·å产éãå·¥èµä¸åæ ¼çæ°æ®å¤±è´¥:', err) |
| | | console.error('æ°æ®å 载失败', err) |
| | | }) |
| | | } |
| | | |
| | | |
| | | onMounted(() => { |
| | | fetchData() |
| | |
| | | padding: 18px; |
| | | width: 100%; |
| | | height: 449px; |
| | | box-sizing: border-box; |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <div> |
| | | <PanelHeader title="å·¥åæ§è¡æçåæ" /> |
| | | <div class="main-panel panel-item-customers"> |
| | | <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="barLegend" :series="chartSeries" |
| | | :tooltip="tooltip" :xAxis="xAxis1" :yAxis="yAxis1" |
| | | :options="{ backgroundColor: 'transparent', textStyle: { color: '#B8C8E0' } }" style="height: 260px" /> |
| | | <div class="filters-row"> |
| | | <DateTypeSwitch v-model="dateType" @change="handleDateTypeChange" /> |
| | | </div> |
| | | <Echarts |
| | | ref="chart" |
| | | :chartStyle="chartStyle" |
| | | :grid="grid" |
| | | :legend="barLegend" |
| | | :series="chartSeries" |
| | | :tooltip="tooltip" |
| | | :xAxis="xAxis1" |
| | | :yAxis="yAxis1" |
| | | :options="{ backgroundColor: 'transparent', textStyle: { color: '#B8C8E0' } }" |
| | | style="height: 260px" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | import { workOrderEfficiencyAnalysis } from '@/api/viewIndex.js' |
| | | import PanelHeader from './PanelHeader.vue' |
| | | import Echarts from '@/components/Echarts/echarts.vue' |
| | | import DateTypeSwitch from './DateTypeSwitch.vue' |
| | | |
| | | const dateType = ref(1) // 1=å¨ 2=æ 3=å£åº¦ |
| | | |
| | | const chartStyle = { |
| | | width: '100%', |
| | | height: '160%', |
| | | height: '140%', |
| | | } |
| | | |
| | | const grid = { left: '3%', right: '4%', bottom: '3%', top: '10%', containLabel: true } |
| | |
| | | }, |
| | | ] |
| | | |
| | | const handleDateTypeChange = () => { |
| | | fetchData() |
| | | } |
| | | |
| | | const fetchData = () => { |
| | | workOrderEfficiencyAnalysis() |
| | | workOrderEfficiencyAnalysis({ dateType: dateType.value }) |
| | | .then((res) => { |
| | | // æ ¹æ®ä½ çç»æï¼æ°æ®ç´æ¥å¨ res.data ä¸ |
| | | if (!res?.data || !Array.isArray(res.data)) return |
| | | |
| | | const list = res.data |
| | | |
| | | xAxis1.value[0].data = list.map((item) => item.date) |
| | | |
| | | chartSeries.value[0].data = list.map((item) => Number(item.startQuantity) || 0) |
| | | |
| | | chartSeries.value[1].data = list.map((item) => Number(item.finishQuantity) || 0) |
| | | |
| | | chartSeries.value[2].data = list.map((item) => Number(item.yieldRate) || 0) |
| | | if (res.code !== 200 || !Array.isArray(res.data)) return |
| | | const items = res.data |
| | | xAxis1.value[0].data = items.map((d) => d.date) |
| | | // å¼å·¥ |
| | | chartSeries.value[0].data = items.map((d) => Number(d.startQuantity) || 0) |
| | | // 宿 |
| | | chartSeries.value[1].data = items.map((d) => Number(d.finishQuantity) || 0) |
| | | // è¯åç |
| | | chartSeries.value[2].data = items.map((d) => Math.min(100, parseFloat(d.yieldRate) || 0)) |
| | | }) |
| | | .catch((err) => { |
| | | console.error('è·åå·¥åæçæ°æ®å¤±è´¥:', err) |
| | | console.error('è·åå·¥åæ§è¡æçåæå¤±è´¥:', err) |
| | | }) |
| | | } |
| | | |
| | |
| | | gap: 20px; |
| | | } |
| | | |
| | | .filters-row { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | align-items: center; |
| | | gap: 12px; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .panel-item-customers { |
| | | border: 1px solid #1a58b0; |
| | | padding: 18px; |
| | |
| | | <template> |
| | | <div> |
| | | <div class="chart-header"> |
| | | <PanelHeader title="宿æ£éªæ°" /> |
| | | <div class="chart-header-title"> |
| | | <PanelHeader title="宿æ£éªæ°" /> |
| | | </div> |
| | | <div class="warn-range" @click="handleRangeClick">è¿7天</div> |
| | | </div> |
| | | <div class="main-panel panel-item-customers"> |
| | | <Echarts |
| | | ref="chart" |
| | | :chartStyle="chartStyle" |
| | | :grid="grid" |
| | | :legend="barLegend" |
| | | :series="chartSeries" |
| | | :tooltip="tooltip" |
| | | :xAxis="xAxis1" |
| | | :yAxis="yAxis1" |
| | | :options="{ backgroundColor: 'transparent', textStyle: { color: '#B8C8E0' } }" |
| | | style="height: 260px" |
| | | ref="chart" |
| | | :chartStyle="chartStyle" |
| | | :grid="grid" |
| | | :legend="barLegend" |
| | | :series="chartSeries" |
| | | :tooltip="tooltip" |
| | | :xAxis="xAxis1" |
| | | :yAxis="yAxis1" |
| | | :options="{ backgroundColor: 'transparent', textStyle: { color: '#B8C8E0' } }" |
| | | style="height: 260px" |
| | | /> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | const chartStyle = { |
| | | width: '100%', |
| | | height: '135%', |
| | | height: '140%', |
| | | } |
| | | |
| | | const grid = { left: '8%', right: '8%', bottom: '8%', top: '15%', containLabel: true } |
| | | const grid = { left: '3%', right: '4%', bottom: '3%', top: '10%', containLabel: true } |
| | | |
| | | const barLegend = { |
| | | show: true, |
| | | top: '5%', |
| | | left: 'center', |
| | | textStyle: { color: '#B8C8E0', fontSize: 14 }, |
| | | itemGap: 30, |
| | | textStyle: { color: '#B8C8E0' }, |
| | | data: ['åæ ¼', 'ä¸åæ ¼', 'åæ ¼ç'], |
| | | } |
| | | |
| | | // æ±ç¶å¾ï¼åæ ¼ï¼é»è²ï¼ãä¸åæ ¼ï¼ç´«è²ï¼ï¼æçº¿å¾ï¼åæ ¼çï¼èè²ï¼ |
| | | const chartSeries = ref([ |
| | | { |
| | | name: 'åæ ¼', |
| | | type: 'bar', |
| | | barWidth: 20, |
| | | barGap: '20%', |
| | | yAxisIndex: 0, |
| | | barGap: '40%', |
| | | emphasis: { focus: 'series' }, |
| | | itemStyle: { |
| | | color: { |
| | |
| | | x2: 0, |
| | | y2: 1, |
| | | colorStops: [ |
| | | { offset: 0, color: 'rgba(255, 215, 0, 1)' }, // éé»è²é¡¶é¨ |
| | | { offset: 1, color: 'rgba(255, 215, 0, 0.5)' }, // åéæåºé¨ |
| | | { offset: 1, color: 'rgba(0, 164, 237, 0)' }, |
| | | { offset: 0, color: 'rgba(78, 228, 255, 1)' }, |
| | | ], |
| | | }, |
| | | }, |
| | |
| | | { |
| | | name: 'ä¸åæ ¼', |
| | | type: 'bar', |
| | | barGap: '20%', |
| | | barGap: '40%', |
| | | barWidth: 20, |
| | | yAxisIndex: 0, |
| | | emphasis: { focus: 'series' }, |
| | | itemStyle: { |
| | | color: { |
| | |
| | | x2: 0, |
| | | y2: 1, |
| | | colorStops: [ |
| | | { offset: 0, color: 'rgba(144, 97, 248, 1)' }, // ç´«è²é¡¶é¨ |
| | | { offset: 1, color: 'rgba(144, 97, 248, 0.6)' }, // åéæåºé¨ |
| | | { offset: 1, color: 'rgba(83, 126, 245, 0.19)' }, |
| | | { offset: 0, color: 'rgba(144, 97, 248, 1)' }, |
| | | ], |
| | | }, |
| | | }, |
| | |
| | | name: 'åæ ¼ç', |
| | | type: 'line', |
| | | yAxisIndex: 1, |
| | | smooth: true, |
| | | showSymbol: true, |
| | | symbol: 'circle', |
| | | symbolSize: 8, |
| | | lineStyle: { |
| | | color: 'rgba(78, 228, 255, 1)', // éè² |
| | | width: 2, |
| | | }, |
| | | itemStyle: { |
| | | color: 'rgba(78, 228, 255, 1)', |
| | | borderWidth: 2, |
| | | borderColor: '#fff', |
| | | }, |
| | | emphasis: { |
| | | focus: 'series', |
| | | itemStyle: { |
| | | shadowBlur: 10, |
| | | shadowColor: 'rgba(78, 228, 255, 0.8)', |
| | | }, |
| | | }, |
| | | lineStyle: { color: 'rgba(90, 216, 166, 1)', width: 2 }, |
| | | itemStyle: { color: 'rgba(90, 216, 166, 1)' }, |
| | | data: [], |
| | | emphasis: { focus: 'series' }, |
| | | }, |
| | | ]) |
| | | |
| | | const tooltip = { |
| | | trigger: 'axis', |
| | | axisPointer: { type: 'cross' }, |
| | | backgroundColor: 'rgba(0, 0, 0, 0.8)', |
| | | borderColor: 'rgba(78, 228, 255, 0.5)', |
| | | borderWidth: 1, |
| | | textStyle: { color: '#B8C8E0' }, |
| | | formatter(params) { |
| | | let result = params[0].axisValueLabel + '<br/>' |
| | | params.forEach((item) => { |
| | | let unit = '' |
| | | if (item.seriesName === 'åæ ¼ç') { |
| | | unit = '%' |
| | | } else { |
| | | unit = 'ä»¶' |
| | | } |
| | | result += `<div style="margin: 4px 0;">${item.marker} ${item.seriesName}: ${item.value}${unit}</div>` |
| | | const unit = item.seriesName === 'åæ ¼ç' ? '%' : 'ä»¶' |
| | | result += `<div>${item.marker} ${item.seriesName}: ${item.value}${unit}</div>` |
| | | }) |
| | | return result |
| | | }, |
| | | } |
| | | |
| | | const xAxis1 = ref([ |
| | | { |
| | | type: 'category', |
| | | axisTick: { show: false }, |
| | | axisLabel: { color: '#B8C8E0', fontSize: 12 }, |
| | | axisLine: { lineStyle: { color: 'rgba(184, 200, 224, 0.3)' } }, |
| | | data: [], |
| | | }, |
| | | { type: 'category', axisTick: { show: false }, axisLabel: { color: '#B8C8E0' }, data: [] }, |
| | | ]) |
| | | |
| | | const yAxis1 = [ |
| | | { type: 'value', name: 'ä»¶', axisLabel: { color: '#B8C8E0' }, nameTextStyle: { color: '#B8C8E0' } }, |
| | | { |
| | | type: 'value', |
| | | name: 'åä½: ä»¶', |
| | | nameLocation: 'start', |
| | | nameTextStyle: { color: '#B8C8E0', fontSize: 12, padding: [0, 0, 0, 10] }, |
| | | axisLabel: { color: '#B8C8E0', fontSize: 12 }, |
| | | axisLine: { show: false }, |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { color: 'rgba(184, 200, 224, 0.2)', type: 'dashed' }, |
| | | }, |
| | | }, |
| | | { |
| | | type: 'value', |
| | | name: 'åä½: %', |
| | | nameLocation: 'end', |
| | | nameTextStyle: { color: '#B8C8E0', fontSize: 12, padding: [0, 0, 0, 10] }, |
| | | name: 'åæ ¼ç(%)', |
| | | min: 0, |
| | | max: 100, |
| | | axisLabel: { color: '#B8C8E0', fontSize: 12, formatter: '{value}' }, |
| | | axisLine: { show: false }, |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { color: 'rgba(184, 200, 224, 0.2)', type: 'dashed' }, |
| | | }, |
| | | axisLabel: { color: '#B8C8E0', formatter: '{value}%' }, |
| | | nameTextStyle: { color: '#B8C8E0' }, |
| | | splitLine: { lineStyle: { color: 'rgba(184, 200, 224, 0.2)' } }, |
| | | }, |
| | | ] |
| | | |
| | |
| | | position: relative; |
| | | display: flex; |
| | | align-items: center; |
| | | width: 100%; |
| | | } |
| | | |
| | | .chart-header-title { |
| | | flex: 1; |
| | | min-width: 0; |
| | | width: 100%; |
| | | } |
| | | |
| | | .warn-range { |
| | |
| | | border: 1px solid #1a58b0; |
| | | padding: 18px; |
| | | width: 100%; |
| | | height: 449px; |
| | | position: relative; |
| | | background: radial-gradient(circle at 50% 50%, rgba(78, 228, 255, 0.05) 0%, rgba(0, 0, 0, 0) 70%); |
| | | height: 436px; |
| | | } |
| | | </style> |
| | |
| | | gap: 6px; |
| | | font-size: 15px; |
| | | color: #d0e7ff; |
| | | white-space: nowrap; |
| | | flex-wrap: nowrap; |
| | | } |
| | | |
| | | .card-compare>span:first-child { |
| | |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <style scoped lang="scss"> |
| | | .main-panel { |
| | | display: flex; |
| | | flex-direction: column; |
| | |
| | | border: 1px solid #1a58b0; |
| | | padding: 14px 18px; |
| | | width: 100%; |
| | | height: 960px; |
| | | height: 958px; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | |
| | | border: 1px solid #1a58b0; |
| | | padding: 18px; |
| | | width: 100%; |
| | | height: 420px; |
| | | height: 449px; |
| | | } |
| | | |
| | | .pie-chart-wrapper { |
| | |
| | | |
| | | <!-- 顶鍿 颿 --> |
| | | <div class="dashboard-header"> |
| | | <div class="factory-name">è¿éè´¨éç±»åæ</div> |
| | | <div class="factory-name">è´¨éæ°æ®åæ</div> |
| | | </div> |
| | | |
| | | <!-- 主è¦å
容åºå --> |
| | |
| | | <script setup> |
| | | import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue' |
| | | import autofit from 'autofit.js' |
| | | import LeftBottom from './components/left-bottom.vue' |
| | | import CenterCenter from './components/center-center.vue' |
| | | import RightTop from './components/right-top.vue' |
| | | import RightBottom from './components/right-bottom.vue' |
| | |
| | | </el-table>
|
| | |
|
| | | <!-- æ·»å æä¿®æ¹èåå¯¹è¯æ¡ -->
|
| | | <el-dialog :title="title" v-model="open" width="680px" append-to-body>
|
| | | <el-form ref="menuRef" :model="form" :rules="rules" label-width="100px">
|
| | | <el-dialog :title="title" v-model="open" width="880px" append-to-body>
|
| | | <el-form ref="menuRef" :model="form" :rules="rules" label-width="130px">
|
| | | <el-row>
|
| | | <el-col :span="24">
|
| | | <el-form-item label="ä¸çº§èå">
|
| | |
| | | </span>
|
| | | </template>
|
| | | <el-input v-model="form.component" placeholder="请è¾å
¥ç»ä»¶è·¯å¾" />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12" v-if="form.menuType == 'C'">
|
| | | <el-form-item prop="appComponent">
|
| | | <template #label>
|
| | | <span>
|
| | | <el-tooltip content="APP 端访é®çç»ä»¶è·¯å¾ï¼å¦ï¼`app/system/user/index`" placement="top">
|
| | | <el-icon><question-filled /></el-icon>
|
| | | </el-tooltip>
|
| | | APPç»ä»¶è·¯å¾
|
| | | </span>
|
| | | </template>
|
| | | <el-input v-model="form.appComponent" placeholder="请è¾å
¥ APP ç»ä»¶è·¯å¾ï¼å¯éï¼" />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12" v-if="form.menuType != 'M'">
|
| | |
| | | rules: {
|
| | | menuName: [{ required: true, message: "èååç§°ä¸è½ä¸ºç©º", trigger: "blur" }],
|
| | | orderNum: [{ required: true, message: "èå顺åºä¸è½ä¸ºç©º", trigger: "blur" }],
|
| | | path: [{ required: true, message: "è·¯ç±å°åä¸è½ä¸ºç©º", trigger: "blur" }]
|
| | | path: [{ required: true, message: "è·¯ç±å°åä¸è½ä¸ºç©º", trigger: "blur" }],
|
| | | appComponent: [{ required: false, message: "APPç»ä»¶è·¯å¾ä¸è½ä¸ºç©º", trigger: "blur" }]
|
| | | },
|
| | | })
|
| | |
|
| | |
| | | isFrame: "1",
|
| | | isCache: "0",
|
| | | visible: "0",
|
| | | status: "0"
|
| | | status: "0",
|
| | | appComponent: undefined
|
| | | }
|
| | | proxy.resetForm("menuRef")
|
| | | }
|