代码提交1111

This commit is contained in:
luoshiwen 2024-11-11 09:48:26 +08:00
parent e9ad90c9bd
commit 4a10ebd599
19 changed files with 439 additions and 192 deletions

View File

@ -5,4 +5,6 @@ VITE_APP_TITLE = 烟厂
VITE_APP_ENV = 'development' VITE_APP_ENV = 'development'
#开发环境 #开发环境
VITE_APP_BASE_API = '/dev-api' VITE_APP_BASE_API = ''
VITE_PREVIEW_URL = '/preview'

View File

@ -7,5 +7,8 @@ VITE_APP_ENV = 'production'
#生产环境 #生产环境
VITE_APP_BASE_API = '' VITE_APP_BASE_API = ''
#文件地址
VITE_PREVIEW_URL = '/preview'
# 是否在打包时开启压缩,支持 gzip 和 brotli # 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip VITE_BUILD_COMPRESS = gzip

BIN
dist.rar Normal file

Binary file not shown.

BIN
dist.zip

Binary file not shown.

Binary file not shown.

View File

@ -1,89 +1,97 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | U3D_TobaccoWarehouseISMDTSystem</title> <title>Unity WebGL Player | U3D_TobaccoWarehouseISMDTSystem</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico"> <link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css"> <link rel="stylesheet" href="TemplateData/style.css">
<style> </head>
body,html{ <style>
body,html{
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
} }
</style> </style>
</head> <body>
<body> <div id="unity-container" class="unity-desktop" style="width: 100%;height:100%">
<div id="unity-container" class="unity-desktop" style="width: 100%;height: 100%;"> <canvas id="unity-canvas" style="width: 100%;height:100%" tabindex="-1"></canvas>
<canvas id="unity-canvas" style="width: 100%;height: 100%;" tabindex="-1"></canvas> <div id="unity-loading-bar">
<div id="unity-loading-bar">
<div id="unity-logo"></div> <div id="unity-logo"></div>
<div id="unity-progress-bar-empty"> <div id="unity-progress-bar-empty">
<div id="unity-progress-bar-full"></div> <div id="unity-progress-bar-full"></div>
</div> </div>
</div> </div>
<div id="unity-warning"> </div> <div id="unity-warning"></div>
<div id="unity-footer"> <div id="unity-footer">
<div id="unity-webgl-logo"></div> <div id="unity-webgl-logo"></div>
<div id="unity-fullscreen-button"></div> <div id="unity-fullscreen-button"></div>
<div id="unity-build-title">U3D_TobaccoWarehouseISMDTSystem</div> <div id="unity-build-title">U3D_TobaccoWarehouseISMDTSystem</div>
</div>
</div> </div>
<script> </div>
var container = document.querySelector("#unity-container"); <button onclick="OpenHtmlMQTT()">Connect</button>
var canvas = document.querySelector("#unity-canvas"); <button onclick="publishMessage()">Publish</button>
var loadingBar = document.querySelector("#unity-loading-bar"); <button onclick="disconnectMQTT()">Disconnect</button>
var progressBarFull = document.querySelector("#unity-progress-bar-full"); <script src="./js/mqtt.min.js"></script>
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
var warningBanner = document.querySelector("#unity-warning");
// Shows a temporary message banner/ribbon for a few seconds, or
// a permanent error message on top of the canvas if type=='error'. <script>
// If type=='warning', a yellow highlight color is used.
// Modify or remove this function to customize the visually presented var container = document.querySelector("#unity-container");
// way that non-critical warnings and error messages are presented to the var canvas = document.querySelector("#unity-canvas");
// user. var loadingBar = document.querySelector("#unity-loading-bar");
function unityShowBanner(msg, type) { var progressBarFull = document.querySelector("#unity-progress-bar-full");
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
var warningBanner = document.querySelector("#unity-warning");
// Shows a temporary message banner/ribbon for a few seconds, or
// a permanent error message on top of the canvas if type=='error'.
// If type=='warning', a yellow highlight color is used.
// Modify or remove this function to customize the visually presented
// way that non-critical warnings and error messages are presented to the
// user.
function unityShowBanner(msg, type) {
function updateBannerVisibility() { function updateBannerVisibility() {
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none'; warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
} }
var div = document.createElement('div'); var div = document.createElement('div');
div.innerHTML = msg; div.innerHTML = msg;
warningBanner.appendChild(div); warningBanner.appendChild(div);
if (type == 'error') div.style = 'background: red; padding: 10px;'; if (type == 'error') div.style = 'background: red; padding: 10px;';
else { else {
if (type == 'warning') div.style = 'background: yellow; padding: 10px;'; if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
setTimeout(function() { setTimeout(function () {
warningBanner.removeChild(div); warningBanner.removeChild(div);
updateBannerVisibility(); updateBannerVisibility();
}, 5000); }, 5000);
} }
updateBannerVisibility(); updateBannerVisibility();
} }
var buildUrl = "Build"; var buildUrl = "Build";
var loaderUrl = buildUrl + "/延安烟厂.loader.js"; var loaderUrl = buildUrl + "/webgl.loader.js";
var config = { var config = {
dataUrl: buildUrl + "/延安烟厂.data.unityweb", dataUrl: buildUrl + "/webgl.data.unityweb",
frameworkUrl: buildUrl + "/延安烟厂.framework.js.unityweb", frameworkUrl: buildUrl + "/webgl.framework.js.unityweb",
codeUrl: buildUrl + "/延安烟厂.wasm.unityweb", codeUrl: buildUrl + "/webgl.wasm.unityweb",
streamingAssetsUrl: "StreamingAssets", streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany", companyName: "DefaultCompany",
productName: "U3D_TobaccoWarehouseISMDTSystem", productName: "U3D_TobaccoWarehouseISMDTSystem",
productVersion: "0.1", productVersion: "0.1",
showBanner: unityShowBanner, showBanner: unityShowBanner,
}; };
// By default, Unity keeps WebGL canvas render target size matched with // By default, Unity keeps WebGL canvas render target size matched with
// the DOM size of the canvas element (scaled by window.devicePixelRatio) // the DOM size of the canvas element (scaled by window.devicePixelRatio)
// Set this to false if you want to decouple this synchronization from // Set this to false if you want to decouple this synchronization from
// happening inside the engine, and you would instead like to size up // happening inside the engine, and you would instead like to size up
// the canvas DOM size and WebGL render target sizes yourself. // the canvas DOM size and WebGL render target sizes yourself.
// config.matchWebGLToCanvasSize = false; // config.matchWebGLToCanvasSize = false;
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) { if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas: // Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta'); var meta = document.createElement('meta');
@ -98,32 +106,112 @@
// config.devicePixelRatio = 1; // config.devicePixelRatio = 1;
} else { } else {
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen: // Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
// canvas.style.width = "1920px"; // canvas.style.width = "960px";
// canvas.style.height = "1080px"; // canvas.style.height = "600px";
} }
loadingBar.style.display = "block";
var script = document.createElement("script"); //----------------------------------------------------------------------------------MQTT-----------------------------------------------------------------------------
script.src = loaderUrl; let client;
script.onload = () => {
function OpenHtmlMQTT() {
client = mqtt.connect('ws://172.16.1.106:8083/mqtt');
client.on('connect', () => {
console.log('连接...');
const devices = [
Array.from({length: 10}, (_, i) => `car${i + 1}`),//小车
"cm1",//去加盖机
Array.from({length: 7}, (_, i) => `convoyor510${i + 1}`),//输送机
Array.from({length: 51}, (_, i) => `convoyor52${String(i + 1).padStart(2, '0')}`),//输送机
Array.from({length: 30}, (_, i) => `convoyor54${String(i + 1).padStart(2, '0')}`),//输送机
Array.from({length: 4}, (_, i) => `dpm${i + 1}`),//拆码垛机
Array.from({length: 7}, (_, i) => `elv${i + 1}`),//提升机
"fe1",//落地时提升机
Array.from({length: 2}, (_, i) => `qcbd${i + 1}`)//快换电池装置
];
devices.forEach(device => {
console.log(device);
client.subscribe(device, {
onSuccess: () => {
console.log(`已订阅: ${device}`);
},
onFailure: (err) => {
console.error(`订阅失败: ${device}:`, err);
}
});
});
// client.subscribe('car1', (err) => {
// if (!err) {
// console.log('Subscribed to car1');
// }
// });
//
});
client.on('message', (topic, message) => {
const mes = JSON.stringify({device: topic, message: message.toString()});
// console.log(mes);
unityInstance.SendMessage('APP', 'Message', mes)
});
client.on('error', (err) => {
console.error('Connection error: ', err);
});
}
function publishMessage() {
if (client) {
client.publish('car1', 'Hello');
}
}
function disconnectMQTT() {
if (client) {
client.end(() => {
console.log('关闭连接');
});
}
}
//----------------------------------------------------------------------------------MQTT-----------------------------------------------------------------------------
loadingBar.style.display = "block";
var script = document.createElement("script");
script.src = loaderUrl;
script.onload = () => {
createUnityInstance(canvas, config, (progress) => { createUnityInstance(canvas, config, (progress) => {
progressBarFull.style.width = 100 * progress + "%"; progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => { }).then((unityInstance) => {
loadingBar.style.display = "none"; loadingBar.style.display = "none";
fullscreenButton.onclick = () => {
unityInstance.SetFullscreen(1); // 为window添加unityInstance对象
}; window.unityInstance = unityInstance
}).catch((message) => {
alert(message); fullscreenButton.onclick = () => {
}); unityInstance.SetFullscreen(1);
}; };
}).catch((message) => {
alert(message);
});
};
document.body.appendChild(script); document.body.appendChild(script);
</script> </script>
</body> </body>
</html> </html>

10
public/model/js/mqtt.min.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
src/assets/images/close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -341,8 +341,18 @@ onMounted(() => {
) )
1 1; 1 1;
box-sizing: border-box; box-sizing: border-box;
}
}
:deep(.el-select .el-input){
width: vw(212);
height: vh(36);
line-height: vh(36);
}
:deep(.el-input .el-input__inner){
line-height: vh(36) !important;
height: vh(36) !important;
}
:deep(.el-select:hover:not(.el-select--disabled) .el-input__wrapper), :deep(.el-select:hover:not(.el-select--disabled) .el-input__wrapper),
:deep(.el-select .el-input.is-focus .el-input__wrapper) { :deep(.el-select .el-input.is-focus .el-input__wrapper) {
box-shadow: none !important; box-shadow: none !important;

View File

@ -45,31 +45,38 @@
</li> </li>
</ul> </ul>
<div style="float: right"> <div style="float: right">
<el-pagination <el-pagination
v-model:current-page="params1.pageIndex" v-model:current-page="params1.pageIndex"
:page-size="params1.pageSize" :page-size="params1.pageSize"
:size="params1.pageSize" :size="params1.pageSize"
:pager-count='5' :pager-count="5"
layout="total, prev, pager, next" layout="total, prev, pager, next"
:total="total" :total="total"
prev-text="上一页" prev-text="上一页"
next-text="下一页" next-text="下一页"
@current-change="GetPageGuideDocsData" @current-change="GetPageGuideDocsData"
> >
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="el-overlay" v-show="pdfShow">
<div class="pdf">
<div class="pdf-nav">
{{ pdfTitle }} <span @click="pdfShow=false"></span>
</div>
<iframe :src="pdfUrl"></iframe>
</div>
</div>
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
import { import {
getDocsIdentity, getDocsIdentity,
GetPageGuideDocs, GetPageGuideDocs,
} from "@/api/equipmentManagement/index"; } from "@/api/equipmentManagement/index";
import {downloadPdf} from "@/api/operation/index" import { downloadPdf } from "@/api/operation/index";
import { onMounted } from "vue"; import { onMounted } from "vue";
const emit = defineEmits(["closeGuidance"]); const emit = defineEmits(["closeGuidance"]);
const allName = ref([]); const allName = ref([]);
@ -89,25 +96,32 @@ const params1 = {
// //
async function download(item) { async function download(item) {
const response = await downloadPdf(item.filePath); const response = await downloadPdf(
import.meta.env.VITE_PREVIEW_URL + "/" + item.filePath
);
const url = window.URL.createObjectURL(new Blob([response])); const url = window.URL.createObjectURL(new Blob([response]));
const link = document.createElement("a"); const link = document.createElement("a");
link.href = url; link.href = url;
link.setAttribute("download", "file.pdf"); link.setAttribute("download", item.fileName);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
} }
const pdfShow = ref(false);
const pdfUrl = ref("");
const pdfTitle = ref("");
function previewFile(item) { function previewFile(item) {
window.open(import.meta.env.VITE_APP_BASE_API + item.filePath); // window.open(import.meta.env.VITE_PREVIEW_URL+item.filePath);
pdfTitle.value = item.fileName;
pdfShow.value = true;
pdfUrl.value = import.meta.env.VITE_PREVIEW_URL + item.filePath;
} }
const total = ref(0);
const total = ref(0)
// //
function GetPageGuideDocsData(item) { function GetPageGuideDocsData(item) {
GetPageGuideDocs(params1).then((res) => { GetPageGuideDocs(params1).then((res) => {
total.value = res.result.totalNum total.value = res.result.totalNum;
fileList.value = res.result.data; fileList.value = res.result.data;
}); });
} }
@ -121,6 +135,41 @@ onMounted(() => {
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.pdf {
overflow: hidden;
width: vw(950);
height: 100%;
left: 0;
right: 0;
bottom: 0;
top: 0;
margin: auto;
position: absolute;
iframe {
width: 100%;
height: 96%;
}
&-nav {
width: 100%;
font-size: 1rem;
color: #000;
background-color: #fff;
height: 4%;
// line-height: 4%;
display: flex;
align-items: center;
justify-content: center;
span{
display: inline-block;
width: vw(20);
height:vh(20);
background-image: url('@/assets/images/close.png');
background-size: 100% 100%;
margin-left: vw(10);
cursor: pointer;
}
}
}
.box { .box {
width: vw(1088); width: vw(1088);
height: vh(636); height: vh(636);
@ -221,7 +270,7 @@ onMounted(() => {
height: vh(440); height: vh(440);
} }
} }
ul::-webkit-scrollbar{ ul::-webkit-scrollbar {
display: none; display: none;
} }
ul { ul {
@ -243,9 +292,11 @@ onMounted(() => {
// font-size: 1rem; // font-size: 1rem;
color: rgba(25, 174, 250, 1); color: rgba(25, 174, 250, 1);
margin-right: vw(24); margin-right: vw(24);
font-size: 0.875rem;
} }
.download { .download {
color: rgba(28, 238, 251, 1); color: rgba(28, 238, 251, 1);
font-size: 0.875rem;
} }
} }
} }

View File

@ -127,7 +127,7 @@ const getRowClassName = ({ row, rowIndex }) => {
}; };
function rowClick(row) { function rowClick(row) {
tableRowIndex.value = row.index; tableRowIndex.value = row.index;
options.src = import.meta.env.VITE_APP_BASE_API + tableList.value[row.index].videoPath options.src = import.meta.env.VITE_PREVIEW_URL + tableList.value[row.index].videoPath
console.log(options.src); console.log(options.src);
} }
const equipmentCode = ref(""); const equipmentCode = ref("");
@ -143,7 +143,7 @@ function getPageGuideVideosData(item) {
GetPageGuideVideos(params1).then((res) => { GetPageGuideVideos(params1).then((res) => {
tableList.value = res.result.data; tableList.value = res.result.data;
total.value = res.result.totalNum total.value = res.result.totalNum
options.src = import.meta.env.VITE_APP_BASE_API + tableList.value[0].videoPath options.src = import.meta.env.VITE_PREVIEW_URL + tableList.value[0].videoPath
}); });
} }
onMounted(() => { onMounted(() => {

View File

@ -14,7 +14,10 @@
v-for="(item, index) in Math.ceil(chartList.length / 8)" v-for="(item, index) in Math.ceil(chartList.length / 8)"
:key="item.id" :key="item.id"
> >
<div v-if="index == chartIndex" style="display: flex;width: 100%;" > <div
v-if="index == chartIndex"
style="display: flex; width: 100%"
>
<div <div
class="box-content-chart-item" class="box-content-chart-item"
v-for="item in chartList.slice(index * 8, 8 * (index + 1))" v-for="item in chartList.slice(index * 8, 8 * (index + 1))"
@ -33,7 +36,7 @@
</div> </div>
<div class="box-content-inBound"> <div class="box-content-inBound">
<div class="box-content-inBound-title"> <div class="box-content-inBound-title">
<span> 入库信息统计 </span> <span> {{props.title==='入库信息'?'入库信息统计':'出库信息统计'}} </span>
<div> <div>
<ul v-if="storeList"> <ul v-if="storeList">
<li><span>单位</span><span>公斤</span></li> <li><span>单位</span><span>公斤</span></li>
@ -53,9 +56,7 @@
v-model="params.year" v-model="params.year"
type="year" type="year"
placeholder="请选择年份" placeholder="请选择年份"
@change=" @change="getBrandChart(true)"
getBrandChart(true);
"
/> />
</section> </section>
<section> <section>
@ -75,7 +76,7 @@
@change="getBrandChart()" @change="getBrandChart()"
> >
<el-option <el-option
v-for="(item,index) in options" v-for="(item, index) in options"
:key="'key' + index" :key="'key' + index"
:label="item" :label="item"
:value="item" :value="item"
@ -90,10 +91,14 @@
<el-collapse-item title="品牌" name="1"> <el-collapse-item title="品牌" name="1">
<div class="brand"> <div class="brand">
<div <div
v-for="(item,index) in brandList" v-for="(item, index) in brandList"
:key="item" :key="item"
@click="selectBrand(item,index)" @click="selectBrand(item, index)"
:class="index==brandIndex?'num-select brand-item':'brand-item'" :class="
index == brandIndex
? 'num-select brand-item'
: 'brand-item'
"
> >
<span>{{ item.slice(0, 2) }}</span> <span>{{ item.slice(0, 2) }}</span>
<span>{{ item.slice(2) }}</span> <span>{{ item.slice(2) }}</span>
@ -127,8 +132,21 @@ const props = defineProps({
title: String, title: String,
}); });
// //
const brandIndex = ref(0) const brandIndex = ref(0);
const options = ref(['1','2','3','4','5','6','7','8','9','10','11','12']) const options = ref([
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
]);
const activeNames = ref(["1"]); const activeNames = ref(["1"]);
const emit = defineEmits(["closeBoundMsg"]); const emit = defineEmits(["closeBoundMsg"]);
const chartIndex = ref(0); const chartIndex = ref(0);
@ -182,7 +200,6 @@ const chartList = ref([
// type: "()", // type: "()",
// value: 20, // value: 20,
// }, // },
// { // {
// id: 19, // id: 19,
// name: "", // name: "",
@ -200,25 +217,25 @@ const chartList = ref([
function getChartList() { function getChartList() {
if (props.title === "入库信息") { if (props.title === "入库信息") {
getBrandPercent().then((res) => { getBrandPercent().then((res) => {
chartList.value = res.result.columnDatas.map((ele,index) => { chartList.value = res.result.columnDatas.map((ele, index) => {
return { return {
id:index++, id: index++,
kg:ele.number + '箱', kg: ele.number + "箱",
name: ele.name, name: ele.name,
value: (ele.percentage * 100).toFixed(2), value: (ele.percentage * 100).toFixed(2),
msg:true, msg: true,
}; };
}); });
}); });
} else { } else {
getOutBrandPercent().then((res) => { getOutBrandPercent().then((res) => {
chartList.value = res.result.columnDatas.map((ele,index) => { chartList.value = res.result.columnDatas.map((ele, index) => {
return { return {
id:index++, id: index++,
kg:ele.number + '箱', kg: ele.number + "箱",
name: ele.name, name: ele.name,
value: (ele.percentage * 100).toFixed(2), value: (ele.percentage * 100).toFixed(2),
msg:true, msg: true,
}; };
}); });
}); });
@ -249,8 +266,8 @@ const params = reactive({
function getAllBrandName(boolean) { function getAllBrandName(boolean) {
if (boolean) { if (boolean) {
params.year = params.year.getFullYear().toString(); params.year = params.year.getFullYear().toString();
} else{ } else {
console.log(params.month.slice(0,-2)); console.log(params.month.slice(0, -2));
// params.month = params.month.slice(-2) // params.month = params.month.slice(-2)
} }
if (props.title === "入库信息") { if (props.title === "入库信息") {
@ -268,17 +285,17 @@ function getAllBrandName(boolean) {
} }
} }
// //
function selectBrand(item,index){ function selectBrand(item, index) {
brandIndex.value = index brandIndex.value = index;
params.brandName = item params.brandName = item;
getBrandChart() getBrandChart();
} }
// chart // chart
function getBrandChart(boolean) { function getBrandChart(boolean) {
if (boolean) { if (boolean) {
params.year = params.year.getFullYear().toString(); params.year = params.year.getFullYear().toString();
} else{ } else {
console.log(params.month.slice(0,-2)); console.log(params.month.slice(0, -2));
// params.month = params.month.slice(-2) // params.month = params.month.slice(-2)
} }
if (props.title === "入库信息") { if (props.title === "入库信息") {
@ -337,8 +354,17 @@ function drawBarChart(res) {
right: "2%", right: "2%",
top: "15%", top: "15%",
}, },
tooltip:{ tooltip: {
show:true show: true,
formatter: function (data) {
// 1000
console.log(data,'xxxxxxxxxx');
if(params.month){
return params.year +'-'+ params.month +'-'+ data.name+ ' : ' + `<span style='color:rgba(28, 238, 251, 1)'>${data.value}</span>` + '公斤'
}else{
return params.year +'-'+ data.name+ ' : ' + `<span style='color:rgba(28, 238, 251, 1)'>${data.value}</span>` + '公斤'
}
},
}, },
xAxis: { xAxis: {
data: res.map((ele, index) => { data: res.map((ele, index) => {
@ -351,7 +377,7 @@ function drawBarChart(res) {
}, },
axisLabel: { axisLabel: {
color: "#fff", color: "#fff",
fontSize: '0.875rem', fontSize: "0.875rem",
}, },
}, },
yAxis: { yAxis: {
@ -369,6 +395,16 @@ function drawBarChart(res) {
axisLabel: { axisLabel: {
color: "#fff", color: "#fff",
fontSize: "0.875rem", fontSize: "0.875rem",
formatter: function (value) {
// 1000
if (value >= 1000) {
return value / 10000 + "万";
} else if (value >= 10000000) {
return value / 100000000 + "亿";
} else {
return value;
}
},
}, },
splitLine: { splitLine: {
show: true, show: true,
@ -425,7 +461,7 @@ onMounted(() => {
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.num-select{ .num-select {
background-image: url("@/assets/images/dialog/num-select.png") !important; background-image: url("@/assets/images/dialog/num-select.png") !important;
} }
.swiper { .swiper {

View File

@ -103,19 +103,20 @@
<span class="name">品牌</span> <span class="name">品牌</span>
<span>{{ item.itemDesc }}</span> <span>{{ item.itemDesc }}</span>
</li> </li>
<li>
<span class="name">工单开始时间</span>
<span>{{ item.creatTime }}</span>
</li>
<li>
<span class="name">剩余箱数</span>
<span>{{ item.leftNum }}</span>
</li>
<li> <li>
<span class="name">剩余投料量</span> <span class="name">剩余投料量</span>
<span>{{ item.remainWeight }}公斤</span> <span>{{ item.remainWeight }}公斤</span>
</li> </li>
<!-- <li>
<span class="name">工单开始时间</span>
<span>{{ item.creatTime }}</span>
</li> -->
<li>
<span class="name">剩余箱数</span>
<span>{{ item.leftNum }}</span>
</li>
<li style="opacity:0"></li>
<li style="opacity:0"></li> <li style="opacity:0"></li>
</ul> </ul>
</div> </div>

View File

@ -1,7 +1,7 @@
<template> <template>
<Nav /> <Nav />
<div class="unity"> <div class="unity">
<iframe src="model/index.html" frameborder="0"></iframe> <!-- <iframe src="model/index.html" frameborder="0"></iframe> -->
</div> </div>
<div class="home"> <div class="home">
<div class="home-left"> <div class="home-left">
@ -425,8 +425,9 @@ const searchData = ref();
// echarts // echarts
function drawInventoryNewsEcahrt(result) { function drawInventoryNewsEcahrt(result) {
// result. = 400
// result. = 300
let myChart = echarts.init(document.getElementById("inventoryNews")); let myChart = echarts.init(document.getElementById("inventoryNews"));
console.log(result,'xxxxxxxxxxx');
var scaleData = [ var scaleData = [
// { // {
// name: "", // name: "",
@ -444,24 +445,51 @@ function drawInventoryNewsEcahrt(result) {
// radius1: ["67%", "68%"], // radius1: ["67%", "68%"],
// }, // },
]; ];
let index = 0 let index = 0;
for(let key in result){ for (let key in result) {
scaleData.push({ scaleData.push({
name:key, name: key,
value:result[key], value: result[key],
radius1:[51+index*8 + '%' + '', 53+index*8 + '%' + '']
}) });
index ++ index++;
} }
console.log(scaleData,'xxxxxxxxx'); // let box = {
// name:'',
// value:,
// }
// //
scaleData.forEach((el) => {
for (let key in result) { // scaleData.forEach((el,index) => {
if (el.name === key) { // console.log(el);
el.value = result[key];
} // });
let box = {
name:'特殊箱子',
value:0,
}
for(let i = 0;i<scaleData.length;i++){
if(scaleData[i].name==='特殊空箱子'){
box.value = box.value + scaleData[i].value
scaleData.splice(i,1)
i--
} }
}); if(scaleData[i].name==='特殊实箱子'){
box.value = box.value + scaleData[i].value
scaleData.splice(i,1)
i--
}
}
// console.log(scaleData);
// box.radius1 = [43 + (scaleData.length-1) * 8 + "%" + "", 45 + (scaleData.length-1) * 8 + "%" + ""]
if(box.value != 0){
scaleData.push(box)
}
scaleData.forEach((el,index)=>{
el.radius1 = [43 + index * 8 + "%" + "", 45 + index * 8 + "%" + ""]
})
var placeHolderStyle = { var placeHolderStyle = {
label: { label: {
show: false, show: false,
@ -476,11 +504,16 @@ function drawInventoryNewsEcahrt(result) {
var seriesObj = []; var seriesObj = [];
var color = [ var color = [
"rgba(23, 151, 217, 1)", "rgba(23, 151, 217, 1)",
// "rgba(28, 238, 251, 1)",
"rgba(255, 215, 0,1)",
// "rgba(0, 245, 194, 1)",
"rgba(255, 255, 224,1)",
// "rgba(0, 245, 194, 1)",
"rgba(28, 238, 251, 1)", "rgba(28, 238, 251, 1)",
"rgba(0, 245, 194, 1)", "rgba(255, 192, 203,1)",
]; ];
for (var i = 0; i < scaleData.length; i++) { for (var i = 0; i < scaleData.length; i++) {
console.log(scaleData[i].name);
seriesObj.push({ seriesObj.push({
name: "", name: "",
type: "pie", type: "pie",
@ -545,9 +578,12 @@ function drawInventoryNewsEcahrt(result) {
itemWidth: fontSize(0.1), itemWidth: fontSize(0.1),
itemHeight: fontSize(0.1), itemHeight: fontSize(0.1),
itemGap: fontSize(0.2), itemGap: fontSize(0.2),
data: scaleData.map((el) => { data: scaleData.map((el,index) => {
return el.name; return el.name;
}), }),
// itemStyle:{
// color:color
// },
show: true, show: true,
textStyle: { textStyle: {
color: "#fff", color: "#fff",
@ -562,7 +598,7 @@ function drawInventoryNewsEcahrt(result) {
textAlign: "right", textAlign: "right",
// width: "40", // width: "40",
padding: [0, 0, 0, 10], padding: [0, 0, 0, 10],
color: color[i], // color: color,
}, },
}, },
}, },
@ -605,44 +641,44 @@ function drawInventoryNewsEcahrt(result) {
], ],
}, },
legend: { legend: {
icon: "circle", icon: "circle",
orient: "vertical", orient: "vertical",
x: "60%", x: "60%",
y: "center", y: "center",
itemWidth: fontSize(0.1), itemWidth: fontSize(0.1),
itemHeight: fontSize(0.1), itemHeight: fontSize(0.1),
itemGap: fontSize(0.2), itemGap: fontSize(0.2),
data: scaleData.map((el) => { data: scaleData.map((el) => {
return el.name; return el.name;
}), }),
show: true, show: true,
textStyle: { textStyle: {
color: "#fff", color: "#fff",
fontSize: "0.875rem", fontSize: "0.875rem",
rich: { rich: {
name: { name: {
color: "#fff", color: "#fff",
fontSize: "0.875rem", fontSize: "0.875rem",
}, },
val: { val: {
fontSize: ".875rem", fontSize: ".875rem",
textAlign: "right", textAlign: "right",
// width: "40", // width: "40",
color: color[i], color: color[i],
},
}, },
}, },
}, formatter: function (name) {
formatter: function (name) { let total = 0;
let total = 0; for (var i = 0; i < scaleData.length; i++) {
for (var i = 0; i < scaleData.length; i++) { if (scaleData[i].name === name) {
if (scaleData[i].name === name) { total = scaleData[i].value;
total = scaleData[i].value; }
} }
} return `{name|${name}} {val|${total}}`;
return `{name|${name}} {val|${total}}`; },
}, },
},
}); });
}); });
} }

View File

@ -26,6 +26,16 @@ export default defineConfig({
target: 'http://172.16.1.106:5005/', target: 'http://172.16.1.106:5005/',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '') rewrite: (p) => p.replace(/^\/dev-api/, '')
},
'/api': {
target: 'http://172.16.1.106:5005/api',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, '')
},
'/preview': {
target: 'http://172.16.1.106:5005/',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/preview/, '')
} }
} }
}, },