Merge branch 'master' of http://gitea.xxhhcty.xyz:8080/zcdsj/factory_web
This commit is contained in:
commit
041b1108ec
|
|
@ -45,6 +45,14 @@
|
|||
</el-button>
|
||||
<el-button v-if="!hideRefresh" @click="reload" icon="el-icon-refresh-right" circle style="margin-left: 15px">
|
||||
</el-button>
|
||||
<el-popover v-if="!hideExport" placement="top" trigger="click" :hide-after="0">
|
||||
<template #reference>
|
||||
<el-button icon="el-icon-download" circle style="margin-left: 15px"></el-button>
|
||||
</template>
|
||||
<div><el-button type="primary" size="small" @click="exportExcel(0)">1导出本页数据</el-button></div>
|
||||
<div style="margin-top: 2px;" v-if="hExportCols"><el-button type="primary" size="small" @click="exportExcel(1)">2导出本页数据</el-button></div>
|
||||
<div style="margin-top: 2px;" v-if="hExportCols"><el-button type="primary" size="small" @click="exportExcel(2)">3导出全部数据</el-button></div>
|
||||
</el-popover>
|
||||
<el-popover v-if="column" placement="top" title="列设置" :width="500" trigger="click" :hide-after="0"
|
||||
@show="customColumnShow = true" @after-leave="customColumnShow = false">
|
||||
|
||||
|
|
@ -82,7 +90,7 @@
|
|||
import config from "@/config/table";
|
||||
import columnSetting from "./columnSetting";
|
||||
import { genTree } from "@/utils/verificate";
|
||||
|
||||
import { domToExcel, dataToExcel } from "@/utils/exportExcel";
|
||||
export default {
|
||||
name: "scTable",
|
||||
components: {
|
||||
|
|
@ -115,6 +123,9 @@ export default {
|
|||
hideDo: { type: Boolean, default: false },
|
||||
hideRefresh: { type: Boolean, default: false },
|
||||
hideSetting: { type: Boolean, default: false },
|
||||
hideExport: { type: Boolean, default: false },
|
||||
hExportCols: { type: Array, default: null },
|
||||
hExportName: { type: String, default: null },
|
||||
paginationLayout: { type: String, default: config.paginationLayout },
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -299,6 +310,46 @@ export default {
|
|||
this.getData();
|
||||
this.$emit("resetQuery");
|
||||
},
|
||||
//导出
|
||||
exportExcel(type=0) {
|
||||
if (type === 0) {
|
||||
try {
|
||||
domToExcel(this.$refs.scTable.$el, "表格数据");
|
||||
} catch (error) {
|
||||
console.error('导出失败:', error);
|
||||
this.$message.error("导出失败");
|
||||
}
|
||||
}
|
||||
else if (type === 1) {
|
||||
dataToExcel(this.hExportCols, this.tableData, this.hExportName?this.hExportName:'表格数据')
|
||||
}else if (type === 2) {
|
||||
const extractHeaderKeys = (columns) =>{
|
||||
const keys = columns.map(item => {
|
||||
// 如果key中包含点号,只取点号前面的部分
|
||||
return item.key.split('.')[0];
|
||||
});
|
||||
|
||||
// 去重并转回字符串
|
||||
return [...new Set(keys)].join(',');
|
||||
}
|
||||
var c = Object.assign({}, this.query, this.tableParams, {[this.orderStr]: this.order}, {page: 0},
|
||||
{query: "{" + extractHeaderKeys(this.hExportCols) + "}"}
|
||||
)
|
||||
let ElLoading = this.$loading({
|
||||
lock: true,
|
||||
text: '数据请求中,请稍后...',
|
||||
background: 'rgba(0, 0, 0, 0)',
|
||||
})
|
||||
this.apiObj.req(c).then(res=>{
|
||||
ElLoading.close();
|
||||
dataToExcel(this.hExportCols, res, this.hExportName?this.hExportName:'表格数据')
|
||||
}).catch(err=>{
|
||||
ElLoading.close();
|
||||
console.log(err)
|
||||
this.$message.error("导出失败");
|
||||
})
|
||||
}
|
||||
},
|
||||
//自定义变化事件
|
||||
columnSettingChange(userColumn) {
|
||||
this.userColumn = userColumn;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
import * as XLSX from 'xlsx';
|
||||
|
||||
export const domToExcel = (dom, name="data") => {
|
||||
const worksheet = XLSX.utils.table_to_sheet(dom);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet);
|
||||
XLSX.writeFile(workbook, `${name}.xlsx`);
|
||||
}
|
||||
/**
|
||||
* eg: .columns = [
|
||||
* { header: 'Id', key: 'id', wpx: 10 },
|
||||
|
|
@ -10,35 +17,83 @@ import * as XLSX from 'xlsx';
|
|||
* @param data 数据
|
||||
* @param name 文件名
|
||||
*/
|
||||
export const generateExcel = (columns = [], data = [], name = '') => {
|
||||
export const dataToExcel = (columns = [], data = [], name = 'data') => {
|
||||
const headers = columns.map((item) => item.header);
|
||||
const otherConfigs = columns.map(({ key, header, ...item }) => item);
|
||||
const dataList = data.map((item) => {
|
||||
let obj = {};
|
||||
columns.forEach((col) => {
|
||||
obj[col.header] = item[col.key];
|
||||
columns.forEach(col => {
|
||||
obj[col.header] = getNestedValue(item, col.key) ?? '';
|
||||
});
|
||||
return obj;
|
||||
});
|
||||
const workbook = XLSX.utils.book_new();
|
||||
workbook.SheetNames.push(name);
|
||||
// workbook.SheetNames.push(name);
|
||||
const worksheet = XLSX.utils.json_to_sheet(dataList, {
|
||||
header: headers,
|
||||
});
|
||||
worksheet['!cols'] = otherConfigs;
|
||||
workbook.Sheets[name] = worksheet;
|
||||
// 生成Blob数据
|
||||
const excelData = XLSX.write(workbook, { type: 'array', bookType: 'xlsx' });
|
||||
const blobData = new Blob([excelData], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
// 创建Blob URL
|
||||
const blobUrl = URL.createObjectURL(blobData);
|
||||
// 创建一个隐藏的<a>标签并设置href属性为Blob URL
|
||||
const link = document.createElement('a');
|
||||
link.href = blobUrl;
|
||||
link.target = '_blank';
|
||||
link.download = `${name}.xlsx`;
|
||||
// 触发点击操作,开始下载文件
|
||||
link.click();
|
||||
// 释放Blob URL
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
// 自动计算列宽
|
||||
worksheet['!cols'] = calculateColumnWidths(columns, dataList);
|
||||
// const otherConfigs = columns.map(({ key, header, ...item }) => item);
|
||||
// worksheet['!cols'] = otherConfigs;
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet);
|
||||
XLSX.writeFile(workbook, `${name}.xlsx`);
|
||||
// workbook.Sheets[name] = worksheet;
|
||||
// // 生成Blob数据
|
||||
// const excelData = XLSX.write(workbook, { type: 'array', bookType: 'xlsx' });
|
||||
// const blobData = new Blob([excelData], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
// // 创建Blob URL
|
||||
// const blobUrl = URL.createObjectURL(blobData);
|
||||
// // 创建一个隐藏的<a>标签并设置href属性为Blob URL
|
||||
// const link = document.createElement('a');
|
||||
// link.href = blobUrl;
|
||||
// link.target = '_blank';
|
||||
// link.download = `${name}.xlsx`;
|
||||
// // 触发点击操作,开始下载文件
|
||||
// link.click();
|
||||
// // 释放Blob URL
|
||||
// URL.revokeObjectURL(blobUrl);
|
||||
};
|
||||
|
||||
const getNestedValue = (obj, path, defaultValue = '') => {
|
||||
if (!obj || !path) return defaultValue;
|
||||
|
||||
const keys = path.split('.');
|
||||
let result = obj;
|
||||
|
||||
for (const key of keys) {
|
||||
if (result === null || result === undefined) {
|
||||
return defaultValue;
|
||||
}
|
||||
result = result[key];
|
||||
}
|
||||
|
||||
return result !== undefined ? result : defaultValue;
|
||||
};
|
||||
const calculateColumnWidths = (columns, dataList) => {
|
||||
// 确保 dataList 有数据
|
||||
if (!dataList || dataList.length === 0) {
|
||||
return columns.map(col => ({ wch: 15 })); // 返回默认宽度
|
||||
}
|
||||
|
||||
return columns.map(col => {
|
||||
// 固定宽度优先
|
||||
if (col.wpx) return { wpx: col.wpx };
|
||||
if (col.wch) return { wch: col.wch };
|
||||
if (col.width) return { wch: col.width };
|
||||
|
||||
const header = col.header || '';
|
||||
let maxWidth = header.length;
|
||||
|
||||
// 遍历数据计算最大宽度
|
||||
for (let i = 0; i < Math.min(dataList.length, 100); i++) {
|
||||
const item = dataList[i];
|
||||
// 确保使用正确的键名
|
||||
const value = item[header] !== undefined ? String(item[header]) : '';
|
||||
if (value.length > maxWidth) {
|
||||
maxWidth = value.length;
|
||||
}
|
||||
}
|
||||
|
||||
return { wch: Math.min(Math.max(maxWidth + 2, 8), 50) };
|
||||
});
|
||||
};
|
||||
|
|
@ -6,100 +6,53 @@
|
|||
</el-header>
|
||||
<el-main>
|
||||
<!-- 减薄 -->
|
||||
<el-row style="height: 30%" :gutter="10">
|
||||
<!-- 设备状态 -->
|
||||
<el-col :span="10" style="height: 100%">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">
|
||||
设备状态
|
||||
<el-row style="height: 60%" :gutter="10">
|
||||
<el-col :span="12" style="height: 100%">
|
||||
<!-- 设备状态 -->
|
||||
<el-col style="height: 50%">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">
|
||||
设备状态
|
||||
</div>
|
||||
<div class="boxlabel">
|
||||
<span class="stateIcon yxicon"></span>
|
||||
<span>运行中</span>
|
||||
<span class="eqNum">{{hh.yx}}台</span>
|
||||
</div>
|
||||
<div class="boxlabel">
|
||||
<span class="stateIcon wyxIcon"></span>
|
||||
<span>未运行</span>
|
||||
<span class="eqNum">{{hh.wyx}}台</span>
|
||||
</div>
|
||||
<div class="boxlabel">
|
||||
<span class="stateIcon gzIcon"></span>
|
||||
<span>故障</span>
|
||||
<span class="eqNum">{{hh.gz}}台</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxlabel">
|
||||
<span class="stateIcon yxicon"></span>
|
||||
<span>运行中</span>
|
||||
<span class="eqNum">{{hh.yx}}台</span>
|
||||
</div>
|
||||
<div class="boxlabel">
|
||||
<span class="stateIcon wyxIcon"></span>
|
||||
<span>未运行</span>
|
||||
<span class="eqNum">{{hh.wyx}}台</span>
|
||||
</div>
|
||||
<div class="boxlabel">
|
||||
<span class="stateIcon gzIcon"></span>
|
||||
<span>故障</span>
|
||||
<span class="eqNum">{{hh.gz}}台</span>
|
||||
<div style="height: 2px"></div>
|
||||
<div class="boxmain" id="scrollContainer">
|
||||
<dv-scroll-board :config="configDataEq" style="width:98%;margin:auto" />
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 2px"></div>
|
||||
<div class="boxmain" id="scrollContainer">
|
||||
<dv-scroll-board :config="configDataEq" style="width:98%;margin:auto" />
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<!-- 任务列表 -->
|
||||
<el-col :span="14" style="height: 100%">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">减薄任务列表</div>
|
||||
</div>
|
||||
<div style="height: 2px"></div>
|
||||
<div class="boxmain" id="scrollContainer">
|
||||
<dv-scroll-board :config="configDataTask" style="width:98%;margin:auto" />
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div style="height: 0.3%"></div>
|
||||
<el-row style="height: 30%" :gutter="10">
|
||||
<!-- 库存 -->
|
||||
<el-col :span="10" style="height: 100%">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">
|
||||
减薄车间库存
|
||||
</el-col>
|
||||
<!-- 库存 -->
|
||||
<el-col style="height: 50%">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">
|
||||
减薄车间库存
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 2px"></div>
|
||||
<div class="boxmain" id="scrollContainer">
|
||||
<dv-scroll-board :config="configDataInm" style="width:98%;margin:auto" />
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 2px"></div>
|
||||
<div class="boxmain" id="scrollContainer">
|
||||
<dv-scroll-board :config="configDataInm" style="width:98%;margin:auto" />
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<!-- 交接 -->
|
||||
<el-col :span="14" style="height: 100%">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">减薄交接</div>
|
||||
</div>
|
||||
<div style="height: 2px"></div>
|
||||
<div class="boxmain" id="scrollContainer">
|
||||
<dv-scroll-board :config="configDataHandover" style="width:98%;margin:auto" />
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 生产统计 分析 -->
|
||||
<div style="height: 0.3%"></div>
|
||||
<el-row style="height: 39%" :gutter="10">
|
||||
<!-- 折线图 日加工数、日合格数、日合格率,近七天数据 -->
|
||||
<el-col :xs="8" :md="8" style="height: 100%;">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">合格数统计</div>
|
||||
</div>
|
||||
<div class="boxmain boxmainbottom" id="chart1"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
<!-- 饼状图 各不合格品 原因占比 -->
|
||||
<el-col :xs="8" :md="8" style="height: 100%;">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">不合格占比统计</div>
|
||||
</div>
|
||||
<div class="boxmain boxmainbottom" id="chart2"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="8" :md="8" style="height: 100%;">
|
||||
<el-col :span="12" style="height: 100%">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">生产数统计</div>
|
||||
|
|
@ -118,7 +71,30 @@
|
|||
<span class="totalStaticItem totalStaticItemNum">{{ sctj.rhgs }}</span>
|
||||
<span class="totalStaticItem totalStaticItemNum">{{ sctj.rbhgs }}</span>
|
||||
</div>
|
||||
<dv-scroll-board :config="configDatas" class="boxmain boxmainbottom" style="width:98%;margin:auto" />
|
||||
<dv-scroll-board :config="configDatas" class="boxmain boxmainTopRight" style="width:98%;margin:auto" />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div style="height: 0.3%"></div>
|
||||
<!-- 生产统计 分析 -->
|
||||
<div style="height: 0.3%"></div>
|
||||
<el-row style="height: 39%" :gutter="10">
|
||||
<!-- 折线图 日加工数、日合格数、日合格率,近七天数据 -->
|
||||
<el-col :span="12" style="height: 100%;">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">合格数统计</div>
|
||||
</div>
|
||||
<div class="boxmain boxmainbottom" id="chart1"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
<!-- 饼状图 各不合格品 原因占比 -->
|
||||
<el-col :span="12" style="height: 100%;">
|
||||
<div class="box">
|
||||
<div class="boxtitle">
|
||||
<div class="boxlabel">不合格占比统计</div>
|
||||
</div>
|
||||
<div class="boxmain boxmainbottom" id="chart2"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -264,7 +240,6 @@ export default {
|
|||
wyx:0,
|
||||
gz:0,
|
||||
},
|
||||
|
||||
sctj:{
|
||||
rtcs:0,
|
||||
rjgs:0,
|
||||
|
|
@ -277,7 +252,7 @@ export default {
|
|||
chartInterval2: null,
|
||||
//库存
|
||||
configDataInm:{
|
||||
header:['物料名称','批次号','数量','生产中数量'],
|
||||
header:['物料名称','批次号','数量','生产中'],
|
||||
headerBGC:'#0a3f44',
|
||||
headerHeight:40,
|
||||
align:'center',
|
||||
|
|
@ -312,6 +287,7 @@ export default {
|
|||
headerHeight:40,
|
||||
data:[]
|
||||
},
|
||||
page:1,
|
||||
currentTime: "",
|
||||
currentDay: "",
|
||||
today: "",
|
||||
|
|
@ -323,6 +299,8 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
that.page = 1;
|
||||
that.configDataInm.data = [];
|
||||
//表格table的高度
|
||||
this.tableHeight = document.getElementById("scrollContainer").clientHeight;
|
||||
this.showTime();
|
||||
|
|
@ -340,7 +318,6 @@ export default {
|
|||
let dayitem = Number(dates[2]);
|
||||
that.daysList.push(dayitem);
|
||||
})
|
||||
console.log('that.daysList',that.daysList);
|
||||
that.today = new Date().toISOString().split('T')[0]
|
||||
// console.log('new Date', new Date().toISOString().split('T'))
|
||||
this.xAxisData = xAxisData;
|
||||
|
|
@ -359,13 +336,14 @@ export default {
|
|||
//设备数据
|
||||
that.getEqState(item.id);
|
||||
//库存统计
|
||||
this.getMaterials(item.id);
|
||||
// this.getMaterials(item.id);
|
||||
//交接列表
|
||||
this.getHandover(item.id);
|
||||
// this.getHandover(item.id);
|
||||
})
|
||||
})
|
||||
this.getMaterials(that.page);
|
||||
//任务进度
|
||||
this.getMtask();
|
||||
// this.getMtask();
|
||||
//投产/生产分析
|
||||
this.getProductLine();
|
||||
this.getCountnotok();
|
||||
|
|
@ -618,19 +596,22 @@ export default {
|
|||
});
|
||||
},
|
||||
//库存统计列表
|
||||
getMaterials() {
|
||||
getMaterials(page) {
|
||||
let that = this;
|
||||
that.$API.wpm.wmaterial.list.req({ page: 0,mgroup__name__in:'减薄A,减薄B' }).then((res) => {
|
||||
that.configDataInm.data = [];
|
||||
if(res.length>0){
|
||||
res.forEach((item) => {
|
||||
that.$API.wpm.wmaterial.list.req({ page: page,page_size:500,mgroup__name__in:'减薄A,减薄B' }).then((res) => {
|
||||
if(res.results.length>0){
|
||||
res.results.forEach((item) => {
|
||||
let arr = [];
|
||||
arr[0] = item.material_name;
|
||||
arr[1] = item.batch;
|
||||
arr[2] = item.count;
|
||||
arr[2] = item.count_working;
|
||||
that.configDataInm.data .push(arr);
|
||||
arr[3] = item.count_working;
|
||||
that.configDataInm.data.push(arr);
|
||||
})
|
||||
if(res.count>that.configDataInm.data.length){
|
||||
that.page++;
|
||||
that.getMaterials(that.page);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
@ -730,6 +711,9 @@ export default {
|
|||
.boxmain.boxmainbottom{
|
||||
height: calc(100% - 38px);
|
||||
}
|
||||
.boxmain.boxmainTopRight{
|
||||
height: calc(100% - 120px);
|
||||
}
|
||||
.lineDiv {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@
|
|||
row-key="id"
|
||||
stripe
|
||||
:params="params"
|
||||
:hExportCols = "hExportCols"
|
||||
:hExportName="'仓库成品库存'"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="批次" prop="batch">
|
||||
|
|
@ -101,6 +103,8 @@
|
|||
row-key="id"
|
||||
:params="paramsWm"
|
||||
stripe
|
||||
:hExportCols = "hExportCols2"
|
||||
:hExportName="'车间成品库存'"
|
||||
>
|
||||
<el-table-column label="批次" prop="batch">
|
||||
</el-table-column>
|
||||
|
|
@ -180,6 +184,58 @@ export default {
|
|||
apiObjPrint:this.$API.cm.labelmat.fromMb,
|
||||
wmId:'',
|
||||
showBatch: "",
|
||||
hExportCols:[{
|
||||
header: "批次",
|
||||
key: "batch"
|
||||
}, {
|
||||
header: "物料名",
|
||||
key: "material_.name"
|
||||
}, {
|
||||
header: "规格",
|
||||
key: "material_.specification"
|
||||
}, {
|
||||
header: "型号",
|
||||
key: "material_.model"
|
||||
}, {
|
||||
header: "已完成工序",
|
||||
key: "material_.process_name"
|
||||
}, {
|
||||
header: "所在仓库",
|
||||
key: "warehouse_name"
|
||||
}, {
|
||||
header: "存量",
|
||||
key: "count"
|
||||
}, {
|
||||
header: "更新时间",
|
||||
key: "update_time"
|
||||
}
|
||||
],
|
||||
hExportCols2:[{
|
||||
header: "批次",
|
||||
key: "batch"
|
||||
}, {
|
||||
header: "物料名",
|
||||
key: "material_.name"
|
||||
}, {
|
||||
header: "规格",
|
||||
key: "material_.specification"
|
||||
}, {
|
||||
header: "型号",
|
||||
key: "material_.model"
|
||||
}, {
|
||||
header: "已完成工序",
|
||||
key: "material_.process_name"
|
||||
}, {
|
||||
header: "所在车间",
|
||||
key: "belong_dept_name"
|
||||
}, {
|
||||
header: "存量",
|
||||
key: "count"
|
||||
}, {
|
||||
header: "更新时间",
|
||||
key: "update_time"
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@
|
|||
row-key="id"
|
||||
hideDo
|
||||
stripe
|
||||
hidePagination
|
||||
>
|
||||
<el-table-column label="排序" prop="sort" width="50">
|
||||
</el-table-column>
|
||||
|
|
@ -150,7 +151,7 @@
|
|||
label="操作"
|
||||
fixed="right"
|
||||
align="center"
|
||||
width="200"
|
||||
width="140"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
|
|
|
|||
|
|
@ -0,0 +1,181 @@
|
|||
<template>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel"></div>
|
||||
<div class="right-panel">
|
||||
<el-select v-model="query.mgroup_name" placeholder="工段" clearable style="width: 150px">
|
||||
<el-option v-for="item in mgroups" :key="item.id" :label="item.name" :value="item.name"></el-option>
|
||||
</el-select>
|
||||
<el-date-picker
|
||||
v-model="query.start_date"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="开始时间"
|
||||
style="width: 150px"
|
||||
/>
|
||||
<el-date-picker
|
||||
v-model="query.end_date"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="结束时间"
|
||||
style="margin-left: 2px; width: 150px"
|
||||
/>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleQuery"
|
||||
></el-button>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main class="nopadding">
|
||||
<scTable
|
||||
ref="table"
|
||||
:data="tableData"
|
||||
id="exportDiv"
|
||||
stripe
|
||||
>
|
||||
<el-table-column type="index" width="50" fixed="left"/>
|
||||
<el-table-column label="工段">{{ query.mgroup_name }}
|
||||
</el-table-column>
|
||||
<el-table-column label="员工" prop="员工">
|
||||
</el-table-column>
|
||||
<el-table-column label="总数">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.总生产数">{{ scope.row.总生产数 }}</span>
|
||||
<span v-if="scope.row.总切片数">{{ scope.row.总切片数 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="剪切">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.剪切合格">{{((scope.row.剪切合格/scope.row.总切片数)*100).toFixed(2) }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="剪切加功率">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row['剪切¢18.3mm不合格']">{{ (((scope.row.总切片数-scope.row['剪切¢18.3mm不合格'])/scope.row.总切片数)*100).toFixed(2) }}%</span>
|
||||
<span v-else>100%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="暗点">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.暗点合格">{{((scope.row.暗点合格/scope.row.总切片数)*100).toFixed(2) }}%</span>
|
||||
<span v-else>0%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="长点率">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.暗点不合格">{{((scope.row.暗点不合格/scope.row.总切片数)*100).toFixed(2) }}%</span>
|
||||
<span v-else>0%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="加功率">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.可加工数">{{((scope.row.可加工数/scope.row.总切片数)*100).toFixed(2) }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="不合格数">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.不合格数">{{((scope.row.不合格数/scope.row.总切片数)*100).toFixed(2) }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合格率" prop="合格率">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row['剪切¢18.3mm可加工']">{{ scope.row['剪切¢18.3mm不合格']?scope.row.总切片数 - scope.row['剪切¢18.3mm可加工']- scope.row['剪切¢18.3mm不合格']+scope.row.暗点合格:scope.row.总切片数 - scope.row['剪切¢18.3mm可加工']+scope.row.暗点合格}}</span>
|
||||
<span v-else>{{ scope.row['剪切¢18.3mm不合格']?scope.row.总切片数 - scope.row['剪切¢18.3mm不合格']+scope.row.暗点合格:scope.row.总切片数}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { genTree } from "@/utils/verificate";
|
||||
export default {
|
||||
name: "workerTimes",
|
||||
data() {
|
||||
return {
|
||||
query:{
|
||||
end_date:'',
|
||||
mgroup_name:'',
|
||||
start_date:'',
|
||||
},
|
||||
mgroups: [],
|
||||
tableData:[],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
let date = new Date();
|
||||
that.query.start_date = that.query.end_date = that.$TOOL.dateFormat2(date);
|
||||
that.getData();
|
||||
this.deptMgroup();
|
||||
},
|
||||
methods: {
|
||||
deptMgroup() {
|
||||
this.$API.mtm.mgroup.list.req({ page: 0 }).then(res => {
|
||||
this.mgroups = res;
|
||||
});
|
||||
},
|
||||
getData(){
|
||||
let that = this;
|
||||
let params = {};
|
||||
params.query = that.query;
|
||||
that.$API.bi.dataset.exec.req('prodect_defect', params).then((res) => {
|
||||
let data = res.data2.ds0;
|
||||
data.forEach(item=>{
|
||||
if(item.缺陷分布!==null){
|
||||
let defect = JSON.parse(item.缺陷分布);
|
||||
for(let key in defect){
|
||||
item[key]=defect[key];
|
||||
}
|
||||
}
|
||||
item.不合格数 = 0;
|
||||
item.可加工数 = 0;
|
||||
if(item['剪切¢18.3mm不合格']){
|
||||
if(item['剪切¢18.3mm可加工']){
|
||||
item.剪切合格 = item.总切片数 - item['剪切¢18.3mm可加工']- item['剪切¢18.3mm不合格'];
|
||||
}else{
|
||||
item.剪切合格 = item.总切片数 - item['剪切¢18.3mm不合格'];
|
||||
}
|
||||
if(item.暗点不合格){
|
||||
item.不合格数 = item['剪切¢18.3mm不合格'] + item.暗点不合格;
|
||||
item.可加工数 = item.总切片数 - item['剪切¢18.3mm不合格'] - item.暗点不合格;
|
||||
}else{
|
||||
item.不合格数 = item['剪切¢18.3mm不合格'];
|
||||
item.可加工数 = item.总切片数 - item['剪切¢18.3mm不合格'];
|
||||
}
|
||||
}else{
|
||||
if(item['剪切¢18.3mm可加工']){
|
||||
item.剪切合格 = item.总切片数 - item['剪切¢18.3mm可加工'];
|
||||
}else{
|
||||
item.剪切合格 = item.总切片数;
|
||||
}
|
||||
if(item.暗点不合格){
|
||||
item.不合格数 = item.暗点不合格;
|
||||
item.可加工数 = item.总切片数 - item.暗点不合格;
|
||||
}else{
|
||||
item.不合格数 = 0;
|
||||
item.可加工数 = item.总切片数;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
console.log('data',data)
|
||||
that.tableData = data;
|
||||
});
|
||||
},
|
||||
deptChange(){
|
||||
this.getData();
|
||||
},
|
||||
handleQuery(){
|
||||
let that = this;
|
||||
console.log('that.query',that.query)
|
||||
that.getData();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
|
|
@ -296,7 +296,7 @@ export default {
|
|||
}else if(index==9){
|
||||
values = data.map((item) =>!item.data[propert]&&!item.data['毛坯检测_缺陷项_剪切¢18.3mm可加工']?1:0);
|
||||
}else if(index==13){
|
||||
values = data.map((item) =>!item.data[propert]&&!item.data['毛坯检测_检测项_暗点不合格']?1:0);
|
||||
values = data.map((item) =>!item.data[propert]&&!item.data['毛坯检测_缺陷项_暗点不合格']?1:0);
|
||||
}else{
|
||||
values = data.map((item) =>item.data[propert]&&item.data[propert]!==undefined?Number(item.data[propert]):0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,10 +78,10 @@
|
|||
v-else
|
||||
ref="tables11"
|
||||
:data="tableData11"
|
||||
id="exportDiv11"
|
||||
id="exportDiv1"
|
||||
stripe
|
||||
hideDo
|
||||
:pageSize="500"
|
||||
hidePagination
|
||||
:summary-method="getSummaries2"
|
||||
show-summary
|
||||
>
|
||||
|
|
@ -241,7 +241,7 @@ export default {
|
|||
mioTypeEnum,
|
||||
apiObj: this.$API.mtm.material.list,
|
||||
materialType: "",
|
||||
params: { is_hidden: false, type: 10, count__gte: 1 },
|
||||
params: { is_hidden: false, type: 10, count__gte: 1,page:0 },
|
||||
query: {
|
||||
material: "",
|
||||
mio_type: mioTypeEnum.values[0].key,
|
||||
|
|
@ -370,9 +370,9 @@ export default {
|
|||
that.params.name = that.material_name;
|
||||
}
|
||||
this.$API.mtm.material.list.req(that.params).then((res) => {
|
||||
that.tableData11 = res.results;
|
||||
if(res.results.length>0){
|
||||
res.results.forEach((ite) =>{
|
||||
that.tableData11 = res;
|
||||
if(res.length>0){
|
||||
res.forEach((ite) =>{
|
||||
if (nameList.indexOf(ite.name) > -1) {} else {
|
||||
nameList.push(ite.name);
|
||||
let obj = {};
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@
|
|||
</el-container>
|
||||
</template>
|
||||
<script>
|
||||
import { generateExcel } from "@/utils/exportExcel.js";
|
||||
import { dataToExcel } from "@/utils/exportExcel.js";
|
||||
import saveDialog from "./worktask_form.vue";
|
||||
import handoverDialog from "./handover_form.vue";
|
||||
import GanttComponent from "@/components/GanttComponent.vue";
|
||||
|
|
@ -880,7 +880,7 @@ export default {
|
|||
// handleQuery() {
|
||||
// // this.$refs.table.queryData(this.query)
|
||||
// debugger;
|
||||
// generateExcel(this.columns, this.flogsData, '测试')
|
||||
// dataToExcel(this.columns, this.flogsData, '测试')
|
||||
// },
|
||||
resetQuery() {
|
||||
this.query = {};
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
<el-table-column prop="mlogb__batch" label="物料批次" fixed min-width="80px"></el-table-column>
|
||||
<el-table-column prop="number" label="物料编号" fixed min-width="80px">
|
||||
<template #default="scope">
|
||||
<el-input v-if="route_code=='paiban'&&scope.row.isEdit" v-model="scope.row.number" placeholder="物料编号"></el-input>
|
||||
<el-input v-if="(route_code=='paiban'||route_code=='paiyicibang')&&scope.row.isEdit" v-model="scope.row.number" placeholder="物料编号"></el-input>
|
||||
<span v-else>{{ scope.row.number }}</span>
|
||||
<span v-if="scope.row.wpr_number_out!==null&&scope.row.wpr_number_out!==undefined">——{{ scope.row.wpr_number_out }}</span>
|
||||
</template>
|
||||
|
|
@ -990,18 +990,22 @@ export default {
|
|||
that.$refs.dialogForm.validate((valid) => {
|
||||
if (valid) {
|
||||
that.selectWpr.forEach(item => {
|
||||
item.ftest.ftestdefects.forEach(defect => {
|
||||
let defectindex = that.setForm.defectids.indexOf(defect.defect);
|
||||
if(defectindex > -1){
|
||||
defect.has = that.defectlists[defectindex].value;
|
||||
}
|
||||
})
|
||||
item.ftest.ftestitems.forEach(testitem => {
|
||||
let testitemindex = that.setForm.testitemids.indexOf(testitem.testitem);
|
||||
if( testitemindex > -1){
|
||||
testitem.test_val_json = that.testitemlists[testitemindex].value;
|
||||
}
|
||||
})
|
||||
item.ftest.ftestdefects = [];
|
||||
if(that.defectlists.length>0){
|
||||
that.defectlists.forEach((item1) => {
|
||||
let obj = {};
|
||||
obj.defect = item1.defect;
|
||||
obj.has = item1.value;
|
||||
item.ftest.ftestdefects.push(obj);
|
||||
})
|
||||
}
|
||||
|
||||
// item.ftest.ftestdefects.forEach(defect => {
|
||||
// let defectindex = that.setForm.defectids.indexOf(defect.defect);
|
||||
// if(defectindex > -1){
|
||||
// defect.has = that.defectlists[defectindex].value;
|
||||
// }
|
||||
// })
|
||||
});
|
||||
that.$API.wpm.mlogbw.update.req("bulk",that.selectWpr).then((res) => {
|
||||
that.setVisible = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue