This commit is contained in:
caoqianming 2024-12-17 17:33:10 +08:00
commit f231b2dc25
41 changed files with 7177 additions and 244 deletions

View File

@ -1045,6 +1045,16 @@ const routes = [
},
component: "enm_energy/water",
},
{
name: "air_consume",
path: "/enm_energy/",
meta: {
title: "压缩空气报表",
// icon: "el-icon-grid",
perms: ["air_base"],
},
component: "enm_energy/air_consume",
},
// {
// name: "ct_elec",
// path: "/enm_energy/ct_elec",

View File

@ -286,6 +286,11 @@ BABYLON.DracoCompression.Configuration.decoder.fallbackUrl =
import "babylonjs-loaders";
import "animate.css";
export default {
beforeRouteLeave(to, from, next) {
//
window.location.reload();
next();
},
components: { value },
data() {
return {
@ -428,21 +433,21 @@ export default {
new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgb(243, 84, 9)",
color: "rgb(246, 5, 213)",
},
{
offset: 1,
color: "rgb(191, 69, 12)",
color: "rgb(244, 130, 9 )",
},
]),
new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgb(213, 9, 241)",
color: "rgb(18, 6, 248)",
},
{
offset: 1,
color: "rgb(138, 34, 153)",
color: "rgb(6, 248, 80)",
},
]),
],
@ -641,11 +646,11 @@ export default {
[
{
offset: 0,
color: "rgb(223, 65, 19)",
color: "rgb(241, 56, 4)",
},
{
offset: 1,
color: "rgb(223, 20, 20)",
color: "rgb(12, 35, 196)",
},
]
),
@ -892,7 +897,7 @@ export default {
index2++;
} else {
index2 = 0;
clearInterval(intervalId);
// clearInterval(intervalId);
}
}, 1000);
});
@ -1093,7 +1098,7 @@ export default {
index3++;
} else {
index3 = 0;
clearInterval(intervalId);
// clearInterval(intervalId);
}
}, 1000);
});
@ -1190,7 +1195,6 @@ export default {
this.$API.enm.enstat.req(params).then((ress) => {
that.hotData.bz_elec_consume_unit =
ress[0].elec_consume_unit;
that.hotData.sn_cen_consume_unit = ress[0].cen_consume_unit;
});
});
},
@ -1376,7 +1380,7 @@ export default {
index3++;
} else {
index3 = 0;
clearInterval(intervalId);
// clearInterval(intervalId);
}
}, 1000);
});
@ -2026,9 +2030,9 @@ export default {
beforeUnmount() {
let that = this;
this.scene = null;
clearInterval(that.timerTime);
clearInterval(that.timerData);
clearInterval(that.qualityTimer);
// clearInterval(that.timerTime);
// clearInterval(that.timerData);
// clearInterval(that.qualityTimer);
that.timerTime = null;
that.timerData = null;
that.qualityTimer = null;
@ -2036,9 +2040,9 @@ export default {
beforeDestoryed() {
let that = this;
this.scene = null;
clearInterval(that.timerTime);
clearInterval(that.timerData);
clearInterval(that.qualityTimer);
// clearInterval(that.timerTime);
// clearInterval(that.timerData);
// clearInterval(that.qualityTimer);
that.timerTime = null;
that.timerData = null;
that.qualityTimer = null;

View File

@ -74,9 +74,9 @@
>
{{ item[5] }}
</td>
<td class="numCell">{{ item[6].toFixed(2) }}</td>
<td class="numCell">{{ item[6]}}</td>
<td class="numCell">{{ item[7] }}</td>
<td class="numCell">{{ item[8].toFixed(2) }}</td>
<td class="numCell">{{ item[8]}}</td>
<td class="numCell">{{ item[9] }}</td>
</tr>
</tbody>
@ -271,7 +271,7 @@ export default {
["运转时间", "运转时间h", "/", 0, 0, 0, 0, 0, 0, 0],
["运转时间", "运转率(%", "/", 0, 0, 0, 0, 0, 0, 0],
["能耗", "煤磨分布电耗KW·h/t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, 0, 0, 0, 0, 0]
["能耗", "总电耗KW·h", 0, 0, 0, 0, "/", "/", "/", "/"]
],
tableName: "生产报告",
modelValue: true,

View File

@ -0,0 +1,751 @@
<!-- 全厂水量统计 -->
<template>
<div class="app-container" id="app-container" style="height: 100%">
<el-header id="app-header">
<div class="left-panel">
<el-select
v-model="query.type"
placeholder="查询类型"
clearable
class="headerSearch"
@change="typeCange"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-date-picker
v-model="daterange"
type="datetimerange"
:shortcuts="shortcuts"
range-separator="To"
start-placeholder="Start date"
end-placeholder="End date"
placeholder="时间范围"
value-format="YYYY-MM-DD hh:mm:ss"
v-if="query.type==3"
style="margin-right: 6px"
@change="changeDate"
/>
<el-date-picker
v-model="query.day"
type="date"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
placeholder="天"
v-if="query.type==0"
style="margin-right: 6px"
/>
<el-date-picker
v-model="query.month"
type="month"
value-format="YYYY-MM"
format="YYYY-MM"
placeholder="查询月份"
v-if="query.type==1"
class="headerSearch"
/>
<el-date-picker
v-model="query.year"
type="year"
value-format="YYYY"
format="YYYY"
placeholder="查询年份"
v-if="query.type==2"
class="headerSearch"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="dateChange"
></el-button>
<el-button
type="primary"
@click="exportExcel()"
:loading="exportLoading"
v-auth="'export_excel'"
>导出xlsx
</el-button>
<el-button type="primary" @click="handlePrint">打印 </el-button>
</div>
</el-header>
<el-main>
<el-card>
<div>
<div ref="print" id="myReport" class="printContainer">
<el-table
v-if="query.type==0"
id="hourBaseTable"
:data="tableDatas2"
style="width: 100%"
border
:height="tableHeight"
@cell-click="handleCellClick"
>
<el-table-column
label="分类"
prop="nickname"
width="110"
fixed
>
</el-table-column>
<el-table-column label="单位" prop="unit" fixed>
</el-table-column>
<el-table-column
v-for="(item, index) in 24"
:key="item"
:label="index + '时'"
:prop="index + '时'"
width="120"
>
</el-table-column>
<el-table-column
label="合计"
prop="sum"
width="130"
fixed="right"
>
</el-table-column>
</el-table>
<el-table
v-if="query.type==1"
id="hourBaseTable"
:data="tableDatas_day"
style="width: 100%"
border
:height="tableHeight"
@cell-click="handleCellClick1"
>
<el-table-column
label="分类"
prop="nickname"
width="110"
fixed
>
</el-table-column>
<el-table-column label="单位" prop="unit" fixed>
</el-table-column>
<el-table-column
v-for="item in xAxisData_day"
:key="item"
:label="item"
:prop="item"
width="120"
>
</el-table-column>
<el-table-column
label="合计"
prop="sum"
width="130"
fixed="right"
>
</el-table-column>
</el-table>
<el-table
v-if="query.type==2"
id="hourBaseTable"
:data="tableDatas_month"
style="width: 100%"
border
:height="tableHeight"
@cell-click="handleCellClick_month"
>
<el-table-column
label="分类"
prop="nickname"
width="110"
fixed
>
</el-table-column>
<el-table-column label="单位" prop="unit" fixed>
</el-table-column>
<el-table-column
v-for="item in months"
:key="item"
:label="item + '月'"
:prop="item + '月'"
width="120"
>
</el-table-column>
<el-table-column
label="合计"
prop="sum"
width="130"
fixed="right"
>
</el-table-column>
</el-table>
<el-table
v-if="query.type==3"
id="hourBaseTable"
:data="tableDatas_range"
style="width: 100%"
border
:height="tableHeight"
@cell-click="handleCellClick_range"
>
<el-table-column
label="分类"
prop="mpoint__nickname"
fixed
align="center"
>
</el-table-column>
<el-table-column label="单位" prop="mpoint__unit" fixed align="center">
</el-table-column>
<el-table-column
label = "总用水量" prop="total_val" fixed align="center">
</el-table-column>
</el-table>
</div>
</div>
</el-card>
</el-main>
<el-dialog v-model="itemVisible" :title="itemChartTitle" width="1100px">
<scEcharts
height="400px"
width="1033px"
:option="option"
></scEcharts>
<template #footer>
<slot name="footer"></slot>
</template>
</el-dialog>
</div>
</template>
<script>
import scEcharts from "@/components/scEcharts";
export default {
components: {
scEcharts,
},
data() {
return {
days: 30,
day: "",
year: "",
month: "",
daterange:[],
search_date: "",
query:{
type:0,
day:'',
year:'',
month:'',
yearStart:'',
start_time:'',
end_time:'',
},
mgroupObj: {},
indexList: [],
mpointList: [],
tableDatas: [],
options: [
{id:0,name:'日统计'},
{id:1,name:'月统计'},
{id:2,name:'年统计'},
{id:3,name:'时间段'},
],
tableDatas2: [],
tableDatas_day:[],
tableDatas_range:[],
tableDatas_month:[],
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
hours: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24,
],
tableHeight: 600,
itemChartTitle: "",
itemChartData: [],
itemChartXData: [],
itemChartYData: [],
itemChartLegend: [],
itemChartSeries: [],
timeStamp: null,
itemVisible: false,
exportLoading: false,
tableName: "全厂电量小时统计",
sourceData: {},
option: {
title: {
// text: "",
x: "center",
},
grid: {
top: "20%",
left: "3%",
right: "10%",
bottom: "5%",
containLabel: true,
},
legend: {
orient: "horizontal",
x: "right",
y: "10",
data: [],
},
xAxis: {
type: "category",
data: [],
name: "时间",
nameTextStyle: {
fontWeight: 600,
fontSize: 14,
},
axisLine: {
lineStyle: {
color: "#3366CC",
},
},
axisLabel: {
rotate: 45,
interval: 0,
},
boundaryGap: false,
},
yAxis: {
type: "value",
name: "对象值",
nameTextStyle: {
fontWeight: 500,
fontSize: 14,
},
axisLine: {
lineStyle: {
color: "#3366CC",
},
},
},
tooltip: {
show: true,
trigger: "axis",
axisPointer: {
type: "cross",
axis: "auto",
snap: true,
},
showContent: true,
},
series: [
{
name: "",
data: [],
type: "line",
symbolSize: 8,
symbol: "circle",
smooth: 0.5,
itemStyle: {
normal: {
label: {
show: true,
},
lineStyle: {
width: 1,
type: "dotted",
color: "#3366CC",
},
},
},
},
],
},
xAxisData: [],
xAxisData_day: [],
xAxisData_month: [],
xTtimeRange: [],
};
},
mounted() {
let that = this;
var nowDate = new Date();
let year = nowDate.getFullYear();
let month = nowDate.getMonth() + 1;
let day = nowDate.getDate();
that.timeStamp = nowDate.getTime();
that.days = new Date(year, month, 0).getDate();
that.day = day;
that.year = year;
that.month = month;
for (let n = 0; n < 24; n++) {
that.xAxisData.push(n + "时");
}
that.timeStamp = nowDate.getTime();
that.headerLength = that.days + 4;
that.tableWidth = that.headerLength * 100 + "";
for (let n = 1; n < 13; n++) {
that.xAxisData_month.push(n + "月");
}
this.getMPoints();
let heightContainer =
document.getElementById("app-container").clientHeight;
let heightHeader = document.getElementById("app-header").clientHeight;
let heightTable = heightContainer - heightHeader - 35;
that.tableHeight = heightTable;
},
methods: {
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
let that = this;
if (columnIndex == 0) {
if (that.indexList.indexOf(rowIndex) > -1) {
let rowspans = that.mgroupObj[row.mgroupName];
return {
rowspan: rowspans,
colspan: 1,
};
} else {
return {
rowspan: 1,
colspan: 0,
};
}
}
},
changeDate(){
let obj = {};
obj.type = "hour";
obj.start_time = this.daterange[0];
obj.end_time = this.daterange[1];
obj.mpoint__in = "3632058107481669632,3632060127232065536,3658802207585144832";
obj.page = 0;
this.$API.enm.mpointstat.groupValues.req(obj).then((res) => {
//res total_val
res.forEach(item => {
item.total_val = Number(item.total_val).toFixed(2);
});
this.tableDatas_range = res;
});
},
dateChange() {
let that = this;
that.tableDatas = [];
let arr = [];
if(that.query.type==0){//
arr = that.query.day.split('-');
that.year = Number(arr[0]);
that.month = Number(arr[1]);
that.day = Number(arr[2]);
that.dataLoop();
}else if(that.query.type==1){//
let arr = that.query.month.split('-');
that.year = Number(arr[0]);
that.month = Number(arr[1]);
that.days = new Date(that.year, that.month, 0).getDate();
that.xAxisData_day = [];
for (let n = 1; n <= that.days; n++) {
that.xAxisData_day.push(n + "日");
}
that.dataLoop1();
}else if (that.query.type==2){
that.year = that.query.year;
that.dataLoop_month();
}else if(that.query.type==3){//
that.xTtimeRange.push("总计")
}
let nowDate = new Date();
that.timeStamp = nowDate.getTime();
// that.getLengthData();
},
getMPoints() {
let that = this;
that.$API.enm.mpoint.list
.req({
page: 0,
// enabled: 1,
// need_display: 1,
ordering: "report_sortstr",
code__in: "20240613_13536,ylcjyskq,20240613_13590",
query: "{ id, name, nickname, mgroup_name, unit, report_sortstr }",
})
.then((res) => {
// that.mpointList = that.mockDatas.filter((item) => {
that.mpointList = res
that.dataLoop();
});
},
getLengthData() {
let that = this;
let arrs = [];
that.mpointList.forEach((item, index) => {
if (arrs.indexOf(item.mgroup_name) == -1) {
arrs.push(item.mgroup_name);
}
});
},
dataLoop() {
let that = this;
that.tableDatas = [];
that.tableDatas2 = [];
let _mgroup = [],
_nameLength = [],
indexList = [];
let mgroupObj = {};
that.mpointList.forEach((item, index) => {
let indexs = _mgroup.indexOf(item.mgroup_name);
if (indexs > -1) {
_nameLength[indexs] += 1;
} else {
_mgroup.push(item.mgroup_name);
_nameLength.push(1);
indexList.push(index);
}
for (let i = 0; i < _mgroup.length; i++) {
mgroupObj[_mgroup[i]] = _nameLength[i];
}
let arr = [];
arr[0] =
item.mgroup_name != null ? item.mgroup_name : item.name;
arr[1] = item.nickname != null ? item.nickname : item.name;
arr[2] = item.unit;
for (let i = 0; i < 24; i++) {
arr[i + 3] = 0;
}
that.tableDatas.push(arr);
let obj = {};
obj.mgroupName =
item.mgroup_name != null ? item.mgroup_name : item.name;
obj.nickname =
item.nickname != null && item.nickname != ""
? item.nickname
: item.name;
obj.unit = item.unit;
that.tableDatas2.push(obj);
that.getData(item.id, index);
});
that.mgroupObj = mgroupObj;
that.indexList = indexList;
},
getData(id, index) {
let that = this;
let obj = {};
obj.type = "hour";
obj.year = that.year;
obj.month = that.month;
obj.day = that.day;
obj.mpoint = id;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
let sum = 0;
res.forEach((item) => {
let ind = item.hour + 3;
that.tableDatas[index][ind] = item.val;
sum += Number(item.val);
let keyName = item.hour + "时";
that.tableDatas2[index][keyName] = item.val;
});
sum = sum * 100;
sum = Math.round(sum);
sum = sum / 100;
that.tableDatas[index][27] = sum.toFixed(2);
that.tableDatas2[index].sum = sum.toFixed(2);
that.$forceUpdate();
});
},
dataLoop1() {
let that = this;
that.tableDatas = [];
that.tableDatas_day = [];
let _mgroup = [],
_nameLength = [],
indexList = [];
let mgroupObj = {};
that.mpointList.forEach((item, index) => {
let indexs = _mgroup.indexOf(item.mgroup_name);
if (indexs > -1) {
_nameLength[indexs] += 1;
} else {
_mgroup.push(item.mgroup_name);
_nameLength.push(1);
indexList.push(index);
}
for (let i = 0; i < _mgroup.length; i++) {
mgroupObj[_mgroup[i]] = _nameLength[i];
}
let arr = [];
arr[0] =
item.mgroup_name != null
? item.mgroup_name
: item.nickname != null
? item.nickname
: item.name;
arr[1] = item.nickname != null ? item.nickname : item.name;
arr[2] = item.unit;
for (let i = 0; i < that.days; i++) {
arr[i + 3] = 0;
}
that.tableDatas.push(arr);
let obj = {};
obj.mgroupName =
item.mgroup_name != null ? item.mgroup_name : item.name;
obj.nickname =
item.nickname != null && item.nickname != ""
? item.nickname
: item.name;
obj.unit = item.unit;
that.tableDatas_day.push(obj);
that.getData1(item.id, index);
});
that.mgroupObj = mgroupObj;
that.indexList = indexList;
},
getData1(id, index) {
let that = this;
let obj = {};
obj.type = "day";
obj.year = that.year;
obj.month = that.month;
obj.mpoint = id;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
let sum = 0;
res.forEach((item) => {
let ind = item.day + 2;
that.tableDatas[index][ind] = item.val;
sum += Number(item.val);
let keyName = item.day + "日";
that.tableDatas_day[index][keyName] = item.val;
});
sum = sum * 100;
sum = Math.round(sum);
sum = sum / 100;
let dayss = 0;
dayss = this.days + 3;
that.tableDatas[index][dayss] = sum.toFixed(2);
that.tableDatas_day[index].sum = sum.toFixed(2);
that.$forceUpdate();
});
},
dataLoop_month() {
let that = this;
that.tableDatas = [];
that.tableDatas_month = [];
let _mgroup = [],
_nameLength = [],
indexList = [];
let mgroupObj = {};
that.mpointList.forEach((item, index) => {
let indexs = _mgroup.indexOf(item.mgroup_name);
if (indexs > -1) {
_nameLength[indexs] += 1;
} else {
_mgroup.push(item.mgroup_name);
_nameLength.push(1);
indexList.push(index);
}
for (let i = 0; i < _mgroup.length; i++) {
mgroupObj[_mgroup[i]] = _nameLength[i];
}
let arr = [];
arr[0] =
item.mgroup_name != null ? item.mgroup_name : item.name;
arr[1] = item.nickname != null ? item.nickname : item.name;
arr[2] = item.unit;
for (let i = 0; i < 12; i++) {
arr[i + 3] = 0;
}
that.tableDatas.push(arr);
let obj = {};
obj.mgroupName =
item.mgroup_name != null ? item.mgroup_name : item.name;
obj.nickname =
item.nickname != null && item.nickname != ""
? item.nickname
: item.name;
obj.unit = item.unit;
that.tableDatas_month.push(obj);
that.getData_month(item.id, index);
});
that.mgroupObj = mgroupObj;
that.indexList = indexList;
},
getData_month(id, index) {
let that = this;
let obj = {};
obj.type = "month";
obj.year = that.year;
obj.mpoint = id;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
console.log(res);
let sum = 0;
res.forEach((item) => {
let ind = item.month + 2;
that.tableDatas[index][ind] = item.val;
sum += Number(item.val);
let keyName = item.month + "月";
that.tableDatas_month[index][keyName] = item.val;
});
sum = sum * 100;
sum = Math.round(sum);
sum = sum / 100;
that.tableDatas[index][15] = sum.toFixed(2);
that.tableDatas_month[index].sum = sum.toFixed(2);
that.$forceUpdate();
});
},
handleCellClick(row, column, cell, event) {
let that = this;
console.log("row", row);
console.log("column", column);
console.log("cell", cell);
let index = that.tableDatas2.indexOf(row);
console.log(index, "index");
let lineData = that.tableDatas[index].slice(2, 26);
that.option.xAxis.data = that.xAxisData;
that.option.series[0].data = lineData;
this.itemVisible = true;
},
handleCellClick1(row, column, cell, event) {
let that = this;
let index = that.tableDatas_day.indexOf(row);
console.log('row', row)
that.tableName = `${row.nickname}-电量日统计`
let lineData = that.tableDatas[index].slice(3, that.days + 3);
that.option.xAxis.data = that.xAxisData_day;
that.option.series[0].data = lineData;
this.itemVisible = true;
},
handleCellClick_month(row, column, cell, event) {
let that = this;
let index = that.tableDatas_month.indexOf(row);
that.tableName = `${row.nickname}-电量日统计`
//
let lineData = that.tableDatas[index].slice(2, 13);
that.option.xAxis.data = that.xAxisData_month;
that.option.series[0].data = lineData;
this.itemVisible = true;
},
handleCellClick_range(row, column, cell, event) {
let that = this;
let index = that.tableDatas_range.indexOf(row);
this.itemVisible = true;
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#hourBaseTable", this.tableName);
this.exportLoading = false;
},
handlePrint() {
this.$PRINT("#myReport");
},
},
};
</script>
<style scoped>
.printWrap {
width: 100%;
overflow-x: scroll;
}
.printContainer {
width: 100%;
}
</style>

View File

@ -54,7 +54,7 @@
:loading="exportLoading"
>导出xlsx
</el-button>
<el-button type="primary" @click="handlePrint">打印 </el-button>
<!-- <el-button type="primary" @click="handlePrint">打印 </el-button> -->
</div>
</el-header>
<el-card style="margin-top:5px">
@ -82,9 +82,11 @@
</table>
</div>
</el-card>
<div id="barChart" style="width: 100%; height: 400px;"></div>
</div>
</template>
<script>
import * as echarts from 'echarts';
export default {
data() {
return {
@ -124,7 +126,9 @@
month = '0'+month;
}
this.query.month = myDate.getFullYear()+'-'+month;
// this.getMgroup();
this.query.day = myDate.getFullYear()+'-'+(myDate.getMonth()+1)+'-'+myDate.getDate();
this.query.year = myDate.getFullYear();
this.dateChange();
},
methods: {
@ -171,6 +175,7 @@
obj.mpoint__in = that.mpointList[0];
this.$API.enm.mpointstat.groupValues.req(obj)
.then((res) => {
let chartData = {};
res.forEach(item => {
//
const colIndex = this.mpoint_name.indexOf(item.mpoint__name) + 2;
@ -178,36 +183,89 @@
if (rowIndex > -1 && colIndex > 1) {
this.tableData[rowIndex][colIndex] = (item.total_val).toFixed(2);
}
});
//
if (!chartData[item.mpoint__name]) {
chartData[item.mpoint__name] = [];
}
chartData[item.mpoint__name].push({
level: item.val_level,
total_val: item.total_val
});
});
//
console.log('chartData',chartData);
that.createBarChart(chartData);
})
.catch((error) => {
console.error("API 请求错误: ", error);
});
},
// let that = this;
// let params = {page:0};
// let arr = [];
// if(that.query.type==0){//
// params.type='day_s';
// arr = that.query.month.split('-');
// params.year_s = Number(arr[0]);
// params.month_s = Number(arr[1]);
// params.day = Number(arr[2]);
// }else if(that.query.type==1){//
// params.type='month_s';
// params.year_s = Number(that.query.year);
// }else if (that.query.type==2){
// params.type='year_s';
// params.year_s = Number(that.query.yearStart);
// }
// },
getTableData(){
this.getData();
},
//
createBarChart(chartData) {
//
let chartDom = document.getElementById('barChart');
let myChart = echarts.init(chartDom);
//
let seriesData = [];
let categories = this.mpoint_name; //
let rowList = this.row_list; // ['peak', 'high', 'low', 'deep', 'flat']
// 'peak', 'high', 'low', 'deep', 'flat'
rowList.forEach(level => {
let data = categories.map(device => {
//
let deviceData = chartData[device]?.find(item => item.level === level);
return deviceData ? Math.round(deviceData.total_val) : ''; // 0
});
seriesData.push({
name: level, // peakhigh
type: 'bar',
data: data, //
label: {
show: true,
position: 'top',
formatter: '{c}' //
}
});
});
//
let option = {
title: {
text: '电量统计柱状图',
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' } //
},
legend: {
data: rowList, // 'peak', 'high'
top: '10%'
},
xAxis: {
type: 'category',
data: this.headers, //
axisLabel: {
rotate: 45 //
}
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value} kWh' // kWh
}
},
series: seriesData
};
//
myChart.setOption(option);
},
handlePrint() {
this.$PRINT('#myReport');
},

View File

@ -288,7 +288,7 @@ export default {
let arr = [];
let obj = {};
if (that.queryset.type == 0) {
if (that.query.type == 0) {
arr = e.split('-');
that.year = Number(arr[0]);
that.month = Number(arr[1]);

View File

@ -108,7 +108,7 @@
{index:2,name:'熟料单位产品综合能耗(kgce/t)',value:0,note:''},
{index:3,name:'熟料单位产品综合电耗(kw.h/t)',value:0,note:''},
{index:4,name:'熟料单位产品综合煤耗(kgce/t)',value:0,note:''},
{index:5,name:'水泥单位产品分布能耗(kgce/t)',value:0,note:''},
{index:5,name:'水泥单位产品分布电耗(kw.h/t)',value:0,note:''},
],
};
@ -142,8 +142,11 @@
arr = that.query.searchMonth.split('-');
year_s = Number(arr[0]);
month_s = Number(arr[1]);
day_s = null;
}else if (that.query.type==2){
type='year_s';
day_s = null;
month_s = null;
year_s = Number(that.query.searchYear);
}
let params1 = {

View File

@ -2,80 +2,109 @@
<el-container>
<el-main style="background: #fff;">
<div class="pictureContainer">
<img src="/media/elec_flow.png" class="flowImg" >
<!-- <img src="/img/energy.png" class="flowImg" /> -->
<!-- <img src="/media/elec_flow.png" class="flowImg" > -->
<img src="/img/energy.png" class="flowImg" />
<div class="pictureHeader" style="top: 35px;">
本日数据 时间段 00:00--24:00
</div>
<div class="energyNumber energyNumberLeft" style="top: 187px;">
<img v-if="dataObj.全厂电量_电" class="iconImg" src="img/elec.png">{{ dataObj.全厂电量_电 }} kWh
<!-- <img v-if="dataObj.全厂电量_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.全厂电量_电 }} kWh
</div>
<div class="energyNumber energyNumberLeft2" style="top: 91px;">
<img v-if="dataObj.电石渣配电室用电_电" class="iconImg" src="img/elec.png">{{ dataObj.电石渣配电室用电_电 }} kWh
<!-- <img v-if="dataObj.电石渣配电室用电_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.电石渣配电室用电_电 }} kWh
</div>
<!-- 窑头配电室用电_电 -->
<div class="energyNumber energyNumberLeft2" style="top: 188px;">
<img v-if="dataObj.回转窑_电" class="iconImg" src="img/elec.png">{{ dataObj.回转窑_电 }} kWh
<!-- <img v-if="dataObj.回转窑_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.回转窑_电 }} kWh
</div>
<div class="energyNumber energyNumberLeft2" style="top: 335px;">
<img v-if="dataObj.水泥配电室用电_电" class="iconImg" src="img/elec.png">{{ dataObj.水泥配电室用电_电 }} kWh
<!-- <img v-if="dataObj.水泥配电室用电_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.水泥配电室用电_电 }} kWh
</div>
<div class="energyNumber" style="top: 84px;">
<img v-if="dataObj.烘干破碎机_电" class="iconImg" src="img/elec.png"> {{ dataObj.烘干破碎机_电 }} kWh
<!-- <img v-if="dataObj.烘干破碎机_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.烘干破碎机_电 }} kWh
</div>
<div class="energyNumber" style="top: 138px;">
<img v-if="dataObj.辅材立磨_电" class="iconImg" src="img/elec.png">{{ dataObj.辅材立磨_电 }}
<!-- <img v-if="dataObj.原料立磨主电机" class="iconImg" src="img/elec.png"> -->
{{ dataObj.原料立磨主电机 }}kWh
</div>
<div class="energyNumber" style="top: 181px;">
<img v-if="dataObj.生粉制备_循环风机_电" class="iconImg" src="img/elec.png">{{ dataObj.生粉制备_循环风机_电 }} kWh
<!-- <img v-if="dataObj.生粉制备_循环风机_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.生粉制备_循环风机_电 }} kWh
</div>
<div class="energyNumber" style="top: 225px;">
<img v-if="dataObj.生粉制备_选粉机_电" class="iconImg" src="img/elec.png">{{ dataObj.生粉制备_选粉机_电 }} kWh
<!-- <img v-if="dataObj.生粉制备_选粉机_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.生粉制备_选粉机_电 }}
<span v-if="dataObj.生粉制备_选粉机_电">kWh</span>
</div>
<div class="energyNumber" style="top: 275px;">
<img v-if="dataObj.高温风机_电" class="iconImg" src="img/elec.png">{{ dataObj.高温风机_电 }} kWh
<!-- <img v-if="dataObj.高温风机_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.高温风机_电 }} kWh
</div>
<div class="energyNumber" style="top: 330px;">
<img v-if="dataObj.尾排风机_电" class="iconImg" src="img/elec.png">{{ dataObj.尾排风机_电 }} kWh
<!-- <img v-if="dataObj.尾排风机_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.尾排风机_电 }} kWh
</div>
<div class="energyNumber" style="top: 383px;">
<img v-if="dataObj.回转窑_电" class="iconImg" src="img/elec.png">{{ dataObj.回转窑_电 }} kWh
<!-- <img v-if="dataObj.回转窑_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.回转窑_电 }} kWh
</div>
<div class="energyNumber" style="top: 433px;">
<img v-if="dataObj.原料立磨主电机" class="iconImg" src="img/elec.png">{{ dataObj.原料立磨主电机}} kWh
<!-- <img v-if="dataObj.原料立磨主电机" class="iconImg" src="img/elec.png"> -->
{{ dataObj.原料立磨主电机}} kWh
</div>
<div class="energyNumber" style="top: 490px;">
<img v-if="dataObj.煤磨排风机_电" class="iconImg" src="img/elec.png">{{ dataObj.煤磨排风机_电 }} kWh
<!-- <img v-if="dataObj.煤磨排风机_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.煤磨排风机_电 }} kWh
</div>
<div class="energyNumber" style="top: 539px;">
<img v-if="dataObj.窑头排风机_电" class="iconImg" src="img/elec.png">{{ dataObj.窑头排风机_电 }} kWh
<!-- <img v-if="dataObj.窑头排风机_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.窑头排风机_电 }} kWh
</div>
<div class="energyNumber" style="top: 609px;">
<img v-if="dataObj.水泥磨_电" class="iconImg" src="img/elec.png">{{ dataObj.水泥磨_电 }} kWh
<!-- <img v-if="dataObj.水泥磨_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.水泥磨_电 }} kWh
</div>
<div class="energyNumber" style="top: 665px;">
<img v-if="dataObj.辊压机动_电||dataObj.辊压机定_电" class="iconImg" src="img/elec.png">{{ (Number(dataObj.辊压机动_电) + Number(dataObj.辊压机定_电)).toFixed(2) }} kWh
<!-- <img v-if="dataObj.辊压机动_电||dataObj.辊压机定_电" class="iconImg" src="img/elec.png"> -->
{{ (Number(dataObj.辊压机动_电) + Number(dataObj.辊压机定_电)).toFixed(2) }} kWh
</div>
<div class="energyNumber" style="top: 720px;">
<img v-if="dataObj.系统风机_电" class="iconImg" src="img/elec.png">{{ dataObj.系统风机_电 }} kWh
<!-- <img v-if="dataObj.系统风机_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.系统风机_电 }} kWh
</div>
<div class="energyNumber" style="top: 775px;">
<img v-if="dataObj.水泥磨_选粉机_电" class="iconImg" src="img/elec.png">{{ dataObj.水泥磨_选粉机_电 }} kWh
<!-- <img v-if="dataObj.水泥磨_选粉机_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.水泥磨_选粉机_电 }} kWh
</div>
<div class="energyNumber" style="top: 831px;">
<img v-if="dataObj.水泥磨_循环风机_电" class="iconImg" src="img/elec.png">{{ dataObj.水泥磨_循环风机_电 }} kWh
<!-- <img v-if="dataObj.水泥磨_循环风机_电" class="iconImg" src="img/elec.png"> -->
{{ dataObj.水泥磨_循环风机_电 }} kWh
</div>
<!-- -->
<div class="energyNumberLeft coalNumber" style="top: 460px;">
<img v-if="dataObj.原煤累计量" class="iconImg" src="img/coal.png">{{ dataObj.原煤累计量 }} t
<!-- <img v-if="dataObj.原煤累计量" class="iconImg" src="img/coal.png"> -->
{{ dataObj.原煤累计量 }} t
</div>
<!-- 头煤 -->
<div class="energyNumberRight coalNumber" style="top: 463px;">
<img v-if="dataObj.头煤_煤" class="iconImg" src="img/coal.png">{{ dataObj.头煤_煤 }} t
<!-- <img v-if="dataObj.头煤_煤" class="iconImg" src="img/coal.png"> -->
{{ dataObj.头煤_煤 }} t
</div>
<!-- 尾煤 -->
<div class="energyNumberRight coalNumber" style="top: 552px;">
<img v-if="dataObj.尾煤_煤" class="iconImg" src="img/coal.png">{{ dataObj.尾煤_煤 }} t
<!-- <img v-if="dataObj.尾煤_煤" class="iconImg" src="img/coal.png"> -->
{{ dataObj.尾煤_煤 }} t
</div>
<!-- 工业水 -->
<div class="energyNumberLeft waterNumber" style="top: 638px;">
<!-- <img v-if="dataObj.尾煤_煤" class="iconImg" src="img/coal.png"> -->
{{ dataObj.工业水 }} t
</div>
</div>
</el-main>
@ -102,7 +131,7 @@
day: day,
type: 'day',
page:0,
mpoint__material__code__in:'elec,coal,pcoal'
mpoint__material__code__in:'elec,coal,pcoal,water'
};
this.$API.enm.mpoint.stat.req(obj).then(res => {
res.forEach(item => {
@ -136,15 +165,21 @@
.energyNumber{
position: absolute;
right: 10px;
color: rgb(20, 244, 23);
font-size: 15px;
color: rgb(212, 35, 122);
font-size: 14px;
font-weight: bold;
}
.coalNumber{
position: absolute;
right: 10px;
color: rgb(212, 35, 122);
font-size: 15px;
color: rgb(223, 213, 22);
font-size: 14px;
font-weight: bold;
}
.waterNumber{
position: absolute;
color: rgb(43, 43, 223);
font-size: 14px;
font-weight: bold;
}
.energyNumberLeft{

View File

@ -530,7 +530,6 @@ export default {
obj.mpoint = id;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
// console.log(res);
let sum = 0;
res.forEach((item) => {
let ind = item.hour + 3;

View File

@ -92,9 +92,9 @@
>
{{ item[5] }}
</td>
<td class="numCell">{{ item[6].toFixed(2) }}</td>
<td class="numCell">{{ item[6]}}</td>
<td class="numCell">{{ item[7] }}</td>
<td class="numCell">{{ item[8].toFixed(2) }}</td>
<td class="numCell">{{ item[8]}}</td>
<td class="numCell">{{ item[9] }}</td>
</tr>
</tbody>
@ -444,10 +444,10 @@ export default {
["能耗", "单位产品综合电耗KW·h/t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "单位产品标煤耗kgce/t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "单位产品综合能耗kgce/t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, 0, "/", "/", "/", "/"],
["成本", "单位产品成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0],
["氨水", "氨水消耗量(t)", 0, 0, 0, 0, 0, 0, 0, 0],
["氨水", "单位氨水消耗量(kg/t)", 0, 0, 0, 0, 0, 0, 0, 0],
["氨水", "氨水消耗量(t)", 0, 0, 0, 0, "/", "/", "/", "/"],
["氨水", "单位氨水消耗量(kg/t)", 0, 0, 0, 0, "/", "/", "/", "/"],
],
tableName: "生产报告",
modelValue: true,

View File

@ -81,9 +81,9 @@
>
{{ item[5] }}
</td>
<td class="numCell">{{ item[6].toFixed(2) }}</td>
<td class="numCell">{{ item[7] }}</td>
<td class="numCell">{{ item[8].toFixed(2) }}</td>
<td class="numCell">{{ item[6]}}</td>
<td class="numCell">{{ item[7]}}</td>
<td class="numCell">{{ item[8]}}</td>
<td class="numCell">{{ item[9] }}</td>
</tr>
</tbody>
@ -408,7 +408,7 @@ export default {
["运转时间", "运转率(%", "/", 0, 0, 0, 0, 0, 0, 0],
["能耗", "单位产品分布电耗KW·h/t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "单位产品综合能耗KW·h/t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, 0, "/", "/", "/", "/"],
["成本", "单位产品成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0],
],
tableName: "生产报告",
@ -857,7 +857,6 @@ export default {
query.type = "hour_s";
query.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query).then((response) => {
// debugger;
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],

View File

@ -143,7 +143,7 @@ export default {
data() {
return {
apiObj: null,
mgroup_name :["电石渣", "回转窑", "水泥磨"],
mgroup_name :["电石渣", "回转窑", "水泥磨","原料磨"],
query: {
date: "",
fee: "",
@ -173,7 +173,7 @@ export default {
this.$API.mtm.mgroup.list.req({ page: 0, cate:"section"}).then((res) => {
//res.name=options
res.forEach(element => {
if(['煤磨','原料磨','水泥包装'].includes(element.name)){
if(['煤磨','水泥包装'].includes(element.name)){
return;
}
this.options.push(element);

View File

@ -341,7 +341,7 @@ export default {
["出厂水泥", "出厂水泥合计t", 0, 0, 0, 0, 0, 0, 0],
["出厂熟料", "熟料t", 0, 0, 0, "/", "/", "/","/"],
["能耗", "单位产品分布电耗KW·h/t", 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, "/", "/", "/","/"],
],
tableName: "生产报告",

View File

@ -156,7 +156,12 @@ export default {
if (!month_obj[item.month_s]) {
month_obj[item.month_s] = [];
}
month_obj[item.month_s].push({team:item.team_name, value: item.elec_consume_unit});
month_obj[item.month_s].push(
{
team:item.team_name,
value: item.elec_consume_unit,
elec_consume:item.elec_consume
});
});
data.forEach((item) => {
@ -223,14 +228,28 @@ export default {
const sortedData = monthData.sort((a, b) => parseFloat(b.value) - parseFloat(a.value));
const index = sortedData.findIndex(obj => parseFloat(obj.value) === parseFloat(itemValue));
if (index === 0){
arr[10] = 100;
arr[10] = 50;
} else if (index === 1) {
arr[10] = 80;
arr[10] = 40;
} else if (index === 2) {
arr[10] = 70;
arr[10] = 30;
} else if (index === 3) {
arr[10] = 0;
arr[10] = 20;
}
const total_elec_consume = item.elec_consume;
const sortedTotalData = monthData.sort((a, b) => parseFloat(b.elec_consume) - parseFloat(a.elec_consume));
const totalIndex = sortedTotalData.findIndex(obj => parseFloat(obj.elec_consume) === parseFloat(total_elec_consume));
let total_elec_consume_score = 0;
if (totalIndex === 0){
total_elec_consume_score = 50;
} else if (totalIndex === 1) {
total_elec_consume_score = 40;
} else if (totalIndex === 2) {
total_elec_consume_score = 30;
} else if (totalIndex === 3) {
total_elec_consume_score = 20;
}
arr[10] += total_elec_consume_score; //
}
wrapArr.push(arr);
// console.log(wrapArr);

View File

@ -3,21 +3,27 @@
<el-container class="app-container">
<el-header>
<div>
<el-select v-model="query.mgroup" placeholder="工段" clearable @change="mgroupChange" class="headerSearch">
<el-select v-model="query.mgroup" placeholder="工段" clearable class="headerSearch">
<el-option v-for="item in mgroupOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-select v-model="query.type" placeholder="查询类型" clearable class="headerSearch" @change="typeCange">
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-date-picker
v-model="query.shift"
type="datetime"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
placeholder="班次"
class="headerSearch"
v-if="query.type == 0"
/>
<el-select
v-model="query.sflogs__team"
placeholder="班组"
clearable
style="margin-left: 2px; width: 120px"
class="headerSearch"
@change="teamChange"
>
<el-option
v-for="item in teams"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-date-picker
v-model="value1"
type="datetimerange"
@ -119,7 +125,7 @@
对应值班记录
</el-header>
<el-main class="nopadding">
<scTable
<scTable
ref="expTable"
:data="sflogexpList"
row-key="id"
@ -185,7 +191,11 @@ export default {
mgroup: '',
start_time__gt: '',
start_time__lt: '',
start_time__month: '',
sflogs__team: '',
start_time__year: '',
shift: '',
team: null,
},
params:{
mgroup: "",
@ -195,6 +205,7 @@ export default {
value1:[],
materialList: [],
sflogexpList: [],
teams: [],
mgroupOptions: [],
tableName: '班组成本计算',
options: [
@ -217,6 +228,7 @@ export default {
}
this.getShift();
this.getMgroup();
this.getTeams();
},
methods: {
@ -227,13 +239,23 @@ export default {
this.mgroupOptions.push(item);
})
this.mgroupOptions = this.mgroupOptions.reverse();
// this.query.mgroup = this.mgroupOptions[0].id;
// this.params.mgroup = this.mgroupOptions[0].id;
this.apiObjStlog = this.$API.wpm.stlog.list;
this.tableName = this.mgroupOptions[0].name;
this.getTableData();
// this.getMgroup1(this.mgroupOptions[0].name);
})
},
//
getTeams() {
let form = {};
form.page = 0;
this.teams = [];
this.$API.mtm.team.list.req(form).then((res) => {
this.teams = res;
});
},
//
getShift() {
this.$API.mtm.shift.list.req({ page: 0 }).then(res => {

View File

@ -79,9 +79,9 @@
>
{{ item[5] }}
</td>
<td class="numCell">{{ item[6].toFixed(2) }}</td>
<td class="numCell">{{ item[6]}}</td>
<td class="numCell">{{ item[7] }}</td>
<td class="numCell">{{ item[8].toFixed(2) }}</td>
<td class="numCell">{{ item[8]}}</td>
<td class="numCell">{{ item[9] }}</td>
</tr>
</tbody>
@ -408,7 +408,7 @@ export default {
["运转时间", "运转时间h", "/", 0, 0, 0, 0, 0, 0, 0],
["运转时间", "运转率(%", "/", 0, 0, 0, 0, 0, 0, 0],
["能耗", "生料分布电耗KW·h/t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, 0, "/", "/", "/","/"],
["成本", "生料成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0],
],
tableName: "生产报告",

View File

@ -70,9 +70,9 @@
>
{{ item[4] }}
</td>
<td class="numCell">{{ item[5].toFixed(2) }}</td>
<td class="numCell">{{ item[5]}}</td>
<td class="numCell">{{ item[6] }}</td>
<td class="numCell">{{ item[7].toFixed(2) }}</td>
<td class="numCell">{{ item[7]}}</td>
<td class="numCell">{{ item[8] }}</td>
</tr>
</tbody>
@ -398,10 +398,10 @@ export default {
tableDatas: [
["产量", "总产量t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "单位产品分布电耗KW·h/t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电耗KW·h", 0, 0, 0, "/", "/", "/", "/", "/"],
["成本", "电石渣成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0],
["湿电石渣", "消耗", 0, 0, 0, 0, 0, 0, 0, 0],
["湿电石渣", "进厂", 0, 0, 0, 0, 0, 0, 0, 0],
["湿电石渣", "消耗", 0, 0, 0, "/", "/", "/", "/", "/"],
["湿电石渣", "进厂", 0, 0, 0, "/", "/", "/", "/", "/"],
],
cate: "",
apiObj: this.$API.enm.enstat,
@ -681,9 +681,9 @@ export default {
if (data2.imaterial_data.length > 0) {
data2.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][3] = item.amount_consume;
that.tableDatas[4][3] = (item.amount_consume).toFixed(2);
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][3] = item.amount_consume;
that.tableDatas[5][3] = (item.amount_consume).toFixed(2);
}
});
}

View File

@ -168,7 +168,13 @@ export default {
if (!month_obj[item.month_s]) {
month_obj[item.month_s] = [];
}
month_obj[item.month_s].push({team:item.team_name, value: item.elec_consume_unit});
month_obj[item.month_s].push(
{
team:item.team_name,
value: item.elec_consume_unit,
elec_consume: item.elec_consume
}
);
// month_list.push(month_obj)
});
data.forEach((item) => {
@ -234,14 +240,28 @@ export default {
const sortedData = monthData.sort((a, b) => parseFloat(b.value) - parseFloat(a.value));
const index = sortedData.findIndex(obj => parseFloat(obj.value) === parseFloat(itemValue));
if (index === 0){
arr[11] = 100;
arr[11] = 50;
} else if (index === 1) {
arr[11] = 80;
arr[11] = 40;
} else if (index === 2) {
arr[11] = 70;
arr[11] = 30;
} else if (index === 3) {
arr[11] = 0;
arr[11] = 20;
}
const total_elec_consume = item.elec_consume;
const sortedTotalData = monthData.sort((a, b) => parseFloat(b.elec_consume) - parseFloat(a.elec_consume));
const totalIndex = sortedTotalData.findIndex(obj => parseFloat(obj.elec_consume) === parseFloat(total_elec_consume));
let total_elec_consume_score = 0;
if (totalIndex === 0){
total_elec_consume_score = 50;
} else if (totalIndex === 1) {
total_elec_consume_score = 40;
} else if (totalIndex === 2) {
total_elec_consume_score = 30;
} else if (totalIndex === 3) {
total_elec_consume_score = 20;
}
arr[11] += total_elec_consume_score; //
}
wrapArr.push(arr);
});

View File

@ -16,6 +16,11 @@
<el-form-item label="系统简称">
<el-input v-model="form.base_name_short"></el-input>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="大屏标题">
<el-input v-model="form.bigScreen_name"></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="系统logo">
@ -46,7 +51,8 @@ export default {
base_logo: "/media/default/logo.png",
base_logo_side: "/media/default/logo_side.jpg",
base_name: "托克逊能源管理平台",
base_name_short: "托克逊能管"
base_name_short: "托克逊能管",
bigScreen_name:''
},
};
},

View File

@ -0,0 +1,107 @@
<template>
<el-drawer
v-model="visible"
title="检验记录"
:size="'90%'"
destroy-on-close
@closed="$emit('closed')"
>
<el-container>
<el-main>
<scTable
ref="drawer_table"
:apiObj="apiObj"
row-key="id"
stripe
:params="paramsObj"
>
<!-- <el-table-column type="index" width="50" /> -->
<el-table-column label="检验类型">
<template #default="scope">
<el-tag v-if="scope.row.type2 == 10">
{{ type2_[scope.row.type2] }}
</el-tag>
<el-tag v-else type="success">
{{ type2_[scope.row.type2] }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="物料批次" prop="batch">
</el-table-column>
<el-table-column label="总数" prop="count">
</el-table-column>
<el-table-column label="检验数">
<template #default="scope">
<span v-if="scope.row.type2 == 10">{{ scope.row.count_sampling }}</span>
<span v-else>{{ scope.row.count }}</span>
</template>
</el-table-column>
<el-table-column label="合格数">
<template #default="scope">
<span v-if="scope.row.type2 == 10">{{ scope.row.count_sampling_ok }}</span>
<span v-else>{{ scope.row.count_ok }}</span>
</template>
</el-table-column>
<el-table-column label="不合格数" prop="count_notok">
</el-table-column>
<el-table-column label="合格率">
<template #default="scope">
<span v-if="scope.row.type2 == 10">{{ scope.row.count_sampling_ok/scope.row.count_sampling*100 }}%</span>
<span v-else>{{ scope.row.count_ok/scope.row.count*100 }}%</span>
</template>
</el-table-column>
<el-table-column label="检验日期" prop="test_date">
</el-table-column>
<el-table-column label="检验人" prop="test_user_name">
</el-table-column>
<!-- <el-table-column label="操作" fixed="right" width="60">
<template #default="scope">
<el-button
link
type="primary"
v-auth="'ftestwork.update'"
@click="table_del(scope.row)"
>删除
</el-button>
</template>
</el-table-column> -->
</scTable>
</el-main>
</el-container>
</el-drawer>
</template>
<script>
export default {
emits: ["closed"],
props: {
wm: { type: String, default: "" },
},
data() {
return {
visible: false,
apiObj: null,
paramsObj: {},
form: {},
type2_: {
10: "抽检",
20: "全检",
},
isSaveing: false,
};
},
mounted() {},
methods: {
open() {
this.visible = true;
this.paramsObj.wm = this.wm;
this.apiObj = this.$API.qm.ftestwork.list;
return this;
},
table_del(row){
this.$API.qm.ftestwork.delete.req(row.id).then((res) => {
this.$refs.drawer_table.fetch();
});
},
},
};
</script>

View File

@ -0,0 +1,743 @@
<template>
<el-dialog
:title="modeTitle"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="120px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="检验类型">
<el-select
v-model="form.type2"
placeholder="检验类型"
style="width: 100%"
>
<el-option
v-for="item in typeOption"
:key="item.value"
:label="item.name"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="物料批次" prop="batch">
<el-input v-model="form.batch" disabled></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="总数">
<el-input
v-model="batchCount"
disabled
></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.type2==20">
<el-form-item label="检验数量">
<el-input-number
:max="batchCount"
controls-position="right"
v-model="form.count"
style="width: 100%"
precision="0"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.type2==20">
<el-form-item label="合格数量">
<el-input v-model="form.count_ok" disabled></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.type2==10">
<el-form-item label="抽检数量">
<el-input-number
:max="batchCount"
controls-position="right"
v-model="form.count_sampling"
style="width: 100%"
precision="0"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.type2==10">
<el-form-item label="抽检合格数">
<el-input-number
controls-position="right"
v-model="form.count_sampling_ok"
style="width: 100%"
disabled
precision="0"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="不合格数量">
<el-input-number
controls-position="right"
v-model="form.count_notok"
style="width: 100%"
precision="0"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="合格率">
<el-input-number
controls-position="right"
v-model="count_ok_rate"
style="width: 100%"
precision="0"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="检验日期" prop="test_date">
<el-date-picker
v-model="form.test_date"
type="date"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="检验人" prop="test_user">
<el-select
v-model="form.test_user"
placeholder="检验人"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-divider style="margin-top:0"></el-divider>
<!-- 尺寸检验 -->
<el-row v-if="mgroupName=='size'">
<el-col :md="12" :sm="24">
<el-form-item label="黑圈内径">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hqnj"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="黑圈内径圆度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hqnjyd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="黑圈外径">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hqwj"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="黑圈外径圆度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hqwjyd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="产品外径">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_wj"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="产品圆度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_yd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="产品同心度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_txd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="厚度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="准合格">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_zhg"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="圆准">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_yz"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
</el-row>
<!-- 外观检验 -->
<el-row v-else-if="mgroupName=='facade'">
<el-col :md="12" :sm="24">
<el-form-item label="脏">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_z"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="气泡">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_qp"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="水纹">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_swen"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="崩边">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_bb"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="棕边">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_zb"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="棕圈">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_zq"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="划伤">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hs"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="麻点">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_md"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="黑圈变形">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hqbx"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="倒角">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_dj"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="破损">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_ps"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="蓝圈">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_lq"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
</el-row>
<!-- 过程检验 -->
<el-row v-else>
<el-col :md="12" :sm="24">
<el-form-item label="厚度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="产品外径">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_wj"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="产品圆度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_yd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="产品同心度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_txd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="气泡">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_qp"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="水纹">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_swen"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="崩边">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_bb"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="小崩边">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_xbb"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="划伤">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hs"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="麻点">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_md"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="破损">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_ps"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="其他">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_qt"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>提交</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
props: {
mgroup: {
type: String,
default: "",
},
mgroupName:{
type: String,
default: "",
},
itemObj:{
type: Object,
default: null,
}
},
data() {
return {
mode:'',
modeTitle: '',
loading: false,
form: {
type:'process',
type2:10,
test_date: "",
batch: "",
count: null,
count_ok: 0,
count_sampling_ok:'',
count_notok: 0,
count_notok_json:{}
},
count_ok_rate:100,
count_notok_json:{
//
count_n_wj: 0,
count_n_yd: 0,
count_n_txd: 0,
count_n_hd: 0,
//
count_n_qp: 0,
count_n_swen: 0,
count_n_hs: 0,
count_n_md: 0,
count_n_bb:0,
count_n_xbb:0,
count_n_ps: 0,
count_n_qt:0,
},
rules: {
test_date: [{required: true,message: "请选择检验日期",trigger: "blur"}],
batch: [{required: true,message: "请选择物料批次",trigger: "blur"}],
test_user: [{required: true,message: "请选择物料批次",trigger: "blur"}],
},
options: [],
userList : [],
typeOption:[
{name:'全检',value:20},
{name:'抽检',value:10},
],
selectionFilters: [],
batchCount:null,
formCount:null,
visible: false,
supplier:null,
isSaveing: false,
setFiltersVisible: false,
};
},
mounted() {
this.batchCount = this.itemObj.count_cando;
this.form.batch = this.itemObj.batch;
this.form.wm = this.itemObj.id;
this.form.count = this.itemObj.count_cando;
this.form.supplier = this.itemObj.supplier;
this.deptID = this.$TOOL.data.get('gx_deptID');
this.getUsers();
},
methods: {
//
open(mode = "抽检") {
this.mode = mode;
this.modeTitle = mode+'抽检';
this.visible = true;
return this;
},
getUsers(){
let that = this;
let userList = [];
that.$API.system.user.list
.req({ page: 0, posts__code__contains: "check" })
.then((res) => {
userList = res;
that.$API.system.user.list.req({ depts: that.deptID, page: 0 })
.then((res2) => {
res2.forEach((item) => {
userList.push(item);
});
that.userList = userList ;
});
});
},
handleCountChange(type){
this.form.count_notok =
this.count_notok_json.count_n_wj+
this.count_notok_json.count_n_yd+
this.count_notok_json.count_n_txd+
this.count_notok_json.count_n_hd+
this.count_notok_json.count_n_qp+
this.count_notok_json.count_n_swen+
this.count_notok_json.count_n_hs+
this.count_notok_json.count_n_bb+
this.count_notok_json.count_n_xbb+
this.count_notok_json.count_n_md+
this.count_notok_json.count_n_ps+
this.count_notok_json.count_n_qt;
this.handleCountNotokChange();
},
handleCountNotokChange(){
if(this.form.type2==10){//
this.form.count_sampling_ok = this.form.count_sampling - this.form.count_notok;
this.count_ok_rate = ((this.form.count_sampling_ok/this.form.count_sampling)*100).toFixed(2);
}else if(this.form.type2==20){//
this.form.count_ok = this.form.count - this.form.count_notok;
this.count_ok_rate = ((this.form.count_ok/this.form.count)*100).toFixed(2);
}
},
//
getMaterialBatch() {
let that = this;
let obj = {page: 0, count__gte: 0, count_xtest__gte: 0};
//
obj.mgroupx = that.mgroup;
that.$API.wpm.wmaterial.list
.req(obj)
.then((res) => {
that.options = res;
});
},
//
submit() {
let that = this;
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let count_notok =
this.count_notok_json.count_n_wj+
this.count_notok_json.count_n_yd+
this.count_notok_json.count_n_txd+
this.count_notok_json.count_n_hd+
this.count_notok_json.count_n_qp+
this.count_notok_json.count_n_swen+
this.count_notok_json.count_n_hs+
this.count_notok_json.count_n_bb+
this.count_notok_json.count_n_xbb+
this.count_notok_json.count_n_md+
this.count_notok_json.count_n_ps+
this.count_notok_json.count_n_qt;
if(count_notok>that.form.count_notok){
that.$notify.error("不合格数量有问题");
that.isSaveing = false;
}else{
if(count_notok<that.form.count_notok){
that.count_notok_json.count_n_qt = that.form.count_notok-count_notok;
}
if(that.supplier!== null&&that.form.type2==10){
that.form.need_update_wm = false;
}
// that.form.count_ok = that.form.count-that.form.count_notok;
if(that.form.type2==10){//
that.form.count_sampling_ok = that.form.count_sampling - that.form.count_notok;
}else{//
that.form.count_ok = that.form.count - that.form.count_notok;
}
that.form.count_notok_json = that.count_notok_json;
console.log('that.form',that.form)
that.$API.qm.ftestwork.create.req(that.form)
.then((res) => {
that.$API.qm.ftestwork.submit.req(res.id)
.then((res) => {
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("操作成功");
})
}).catch( err=>{
//
that.isSaveing = false;
})
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
this.formCount = this.form.count;
// this.form.test_group = this.form.split(",");
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

View File

@ -0,0 +1,450 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button
type="primary"
icon="el-icon-plus"
@click="table_add(10)"
v-auth="'handover.create'"
>新增</el-button
>
<el-button
type="primary"
icon="el-icon-plus"
@click="table_add(20)"
v-auth="'handover.create'"
v-if="mgroup_name!=='切片'&&mgroup_name!=='拉单丝'&&mgroup_name!=='一次复丝'&&mgroup_name!=='二次复丝'&&mgroup_name!=='切丝排版'"
>返工</el-button
>
<el-button
type="primary"
@click="printSetting"
>打印机</el-button
>
<el-button
type="primary"
icon="el-icon-plus"
@click="table_add(30)"
v-auth="'handover.create'"
v-if="mgroup_name=='一次超洗'||mgroup_name=='二次超洗'"
>检验</el-button
>
</div>
<div class="right-panel">
<el-select
v-model="searchType"
placeholder="交接类型"
clearable
@change="searchTypeQuery"
style="width: 150px"
>
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
<el-input
style="width: 180px; margin-right: 5px"
v-model="query.search"
placeholder="批次号/关键字/id"
clearable
@keydown.enter="handleQuery"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params"
:query="query"
>
<el-table-column
label="#"
type="index"
width="50"
></el-table-column>
<el-table-column type="expand">
<template #default="props">
<div style="padding-left: 50px">
<template v-for="item in props.row.handoverb" :key="item.id">
<el-descriptions :column="3">
<el-descriptions-item label="批次">
{{item.batch}}
</el-descriptions-item>
<el-descriptions-item label="数量">
{{item.count}}
</el-descriptions-item>
<el-descriptions-item label="不合格标记" v-if="item.notok_sign_name!==null">
{{item.notok_sign_name}}
</el-descriptions-item>
</el-descriptions>
</template>
</div>
</template>
</el-table-column>
<el-table-column
label="物料"
prop="material_name"
min-width="140"
></el-table-column>
<el-table-column label="批次" prop="batch" min-width="140">
<template #default="scope">
<el-text v-if="scope.row.handoverb.length>0" type="primary">{{scope.row.handoverb.length}}</el-text>
</template>
</el-table-column>
<el-table-column label="数量" prop="count" width="80"></el-table-column>
<el-table-column label="交接类型" prop="type" width="100">
<template #default="scope" v-if="mgroup_name=='size'||mgroup_name=='facade'">
<el-text v-if="scope.row.send_dept == deptId" type="primary">交送</el-text>
<el-text v-if="scope.row.recive_dept == deptId" type="success">接收</el-text>
</template>
<template #default="scope" v-else>
<el-text v-if="scope.row.send_mgroup == mgroupId" type="primary">交送</el-text>
<el-text v-if="scope.row.recive_mgroup == mgroupId" type="success">接收</el-text>
</template>
</el-table-column>
<el-table-column label="交接类别" prop="type" width="80">
<template #default="scope">
<el-tag v-if="scope.row.type == 10" type="success"
>正常</el-tag
>
<el-tag v-if="scope.row.type == 20" type="warning"
>返工</el-tag
>
<el-tag v-if="scope.row.type == 30" type="primary"
>检验</el-tag
>
<el-tag v-if="scope.row.type == 40" type="danger"
>报废</el-tag
>
</template>
</el-table-column>
<el-table-column
label="交送人"
prop="send_user_name"
width="80"
></el-table-column>
<el-table-column
label="接收人"
prop="recive_user_name"
width="80"
></el-table-column>
<el-table-column
label="交接日期"
prop="send_date"
width="120"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="140"
>
<template #default="scope">
<el-button
link
size="small"
v-if="scope.row.send_mgroup == mgroupId||deptId==scope.row.send_dept"
@click="table_print(scope.row)"
type="success"
>打印</el-button
>
<el-button
link
size="small"
@click="table_receive(scope.row)"
type="success"
v-if="(scope.row.recive_mgroup == mgroupId||scope.row.recive_dept == deptId)&&scope.row.submit_time == null"
>接收</el-button>
<el-button
link
size="small"
@click="table_show(scope.row)"
type="success"
>查看</el-button>
<el-button
link
size="small"
@click="table_edit(scope.row)"
v-auth="'handover.update'"
type="primary"
v-if="
(scope.row.send_mgroup == mgroupId||deptId==scope.row.send_dept)&&
scope.row.submit_time == null
"
>编辑</el-button
>
<el-popconfirm
title="确定删除吗?"
v-if="
(scope.row.send_mgroup == mgroupId||deptId==scope.row.send_dept)&&
scope.row.submit_time == null
"
@confirm="table_del(scope.row, scope.$index)"
>
<template #reference>
<el-button
link
size="small"
v-auth="'handover.delete'"
type="danger"
>删除</el-button
>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:type="type"
:mgroupName="mgroup_name"
:mgroupId="mgroupId"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
<el-dialog title="打印机设置" v-model="setNameVisible" width="600px">
<el-form label-width="100px">
<el-form-item label="打印机名称">
<el-input v-model="printer_name"></el-input>
</el-form-item>
</el-form>
<el-footer>
<el-button type="primary" @click="savePrinter">保存</el-button>
</el-footer>
</el-dialog>
<el-dialog v-model="printVisible" width="1200px">
<print :baseData="handoverItem" :tableData="handoverItem.handoverb" :type="'handover'" @closePrint="printVisible=false"/>
</el-dialog>
</template>
<script>
import saveDialog from "./handover_form.vue";
import print from "./../setting/print/A4.vue";
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
name: "handover",
components: {
saveDialog,print
},
data() {
return {
apiObj: null,
dialog: {
save: false,
permission: false,
},
params: {
// count_xtest__gte: 0,
},
query: {
send_mgroup: "",
recive_mgroup: "",
},
typeOptions: [
{ name: "交送", value: "send" },
{ name: "接收", value: "recive" },
],
searchType: "",
options: ["交送", "接收"],
tableData: [],
selection: [],
handoverItem:{},
values: "交送",
deptId:'',
mtask: "",
mlogId: "",
mgroupId: "",
processId: "",
processCate: "",
printer_name: "",
printVisible:false,
setNameVisible: false,
mgroup_name:'',
};
},
watch: {
mgroupName: {
handler: function (newval,odlval) {
let that = this;
that.params.dept = "";
that.params.mgroup = "";
that.apiObj = null;
that.mgroup_name = newval;
that.getMgroupInfo();
},
},
},
mounted() {
// this.getMgroupInfo();
},
methods: {
getMgroupInfo(){
let that = this;
console.log('that.mgroup_name',that.mgroup_name);
if(that.mgroup_name=="size"){//
// that.params.material__process__name="";
that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => {
if(res.length>0){
that.deptId = res[0].id;
that.params.dept=res[0].id;
}
that.apiObj = that.$API.wpm.handover.list;
that.$refs.table.refresh();
})
}else if(that.mgroup_name=="facade"){//
// that.params.material__process__name="";
that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => {
if(res.length>0){
that.deptId = res[0].id;
that.params.dept=res[0].id;
}
that.apiObj = that.$API.wpm.handover.list;
that.$refs.table.refresh();
})
}else{//
that.printer_name = localStorage.getItem("printer_name");
that.$API.mtm.mgroup.list
.req({ page: 0, name: that.mgroup_name })
.then((res) => {
if (res.length < 1) {
that.$message.error("获取工段错误");
return;
}
that.$TOOL.data.set('gx_deptID',res[0].belong_dept)
that.mgroupId = res[0].id;
that.processId = res[0].process;
that.processCate = res[0].process_cate;
that.params.mgroup = that.mgroupId;
that.apiObj = that.$API.wpm.handover.list;
that.$refs.table.refresh();
});
}
},
printSetting(){
this.setNameVisible = true;
},
//
table_add(type) {
this.dialog.save = true;
this.type = type;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.type=row.type;
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
table_show(row){
this.type=row.type;
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
async table_del(row) {
var id = row.id;
var res = await this.$API.wpm.handover.delete.req(id);
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
}
},
//
selectionChange(selection) {
this.selection = selection;
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
searchTypeQuery() {
let that = this;
if (that.searchType == "send") {
if(that.mgroup_name=="size"||that.mgroup_name=="facade"){
that.query.send_dept = that.deptId;
that.query.recive_dept = "";
}else{
that.query.send_mgroup = that.mgroupId;
that.query.recive_mgroup = "";
}
} else if (that.searchType == "recive") {
if(that.mgroup_name=="size"||that.mgroup_name=="facade"){
that.query.send_dept = "";
that.query.recive_dept =that.deptId;
}else{
that.query.recive_mgroup = that.mgroupId;
that.query.send_mgroup = "";
}
} else {
that.query.send_mgroup = "";
that.query.recive_mgroup = "";
that.query.recive_dept = "";
that.query.send_dept = "";
}
console.log(that.query);
this.$refs.table.queryData(that.query);
},
table_receive(row) {
//
let that = this;
that.$API.wpm.handover.submit.req(row.id).then((res) => {
that.$refs.table.queryData(that.query);
});
},
table_print(row) {
let that = this;
that.handoverItem = row;
that.printVisible = true;
},
savePrinter() {
let that = this;
localStorage.setItem("printer_name", that.printer_name);
that.setNameVisible = false;
that.$message.success("打印机设置成功,请重新进行打印操作。");
},
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.$refs.table.refresh();
},
},
};
</script>
<style scoped>
.treeMain {
width: 100%;
height: 280px;
overflow: auto;
border: 1px solid #dcdfe6;
margin-bottom: 10px;
}
</style>

View File

@ -0,0 +1,616 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
width="1000px"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="80px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="交送日期" prop="send_date">
<el-date-picker
v-model="form.send_date"
type="date"
placeholder="选择时间"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
<!-- <el-col :md="12" :sm="24">
<el-form-item label="交接数量" width="100">
<el-input-number
v-model="form.count"
controls-position="right"
:min="0"
step="1"
:step-strictly="true"
style="width: 100%"
placeholder="交接数量"
>
</el-input-number>
</el-form-item>
</el-col> -->
<el-col :md="12" :sm="24">
<el-form-item label="交送人" prop="send_user">
<el-select
v-model="form.send_user"
placeholder="交送人"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="type==30">
<el-form-item label="接收部门" prop="recive_dept">
<el-select
v-model="form.recive_dept"
placeholder="接收部门"
clearable
style="width: 100%"
@change="getUserList3"
>
<el-option
v-for="item in deptOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-else>
<el-form-item label="接收工段" prop="recive_mgroup">
<el-select
v-model="form.recive_mgroup"
placeholder="接收工段"
clearable
style="width: 100%"
:disabled="type==40"
@change="getUserList2"
>
<el-option
v-for="item in mgroupOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="接收人" prop="recive_user">
<el-select
v-model="form.recive_user"
placeholder="接收人"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in userList2"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="处理备注">
<el-input v-model="form.note" placeholder="处理备注"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-form-item label="交接物料">
<el-button type="primary" @click="addMaterial" v-if="mode!=='show'">手动添加</el-button>
<scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog>
</el-form-item>
</el-row>
<el-row v-show="addShow">
<el-col>
<el-form-item label="交接物料">
<el-select
v-model="selectItems"
placeholder="交接物料"
filterable
multiple
clearable
@change="materialChange"
style="width: 100%"
>
<el-option
v-for="item in materialOptions"
:key="item.id"
:label="item.batch"
:value="item.id"
>
<span>{{ item.batch }}</span>
<div style="float: right">
<span>{{ item.count }}</span>
<span v-if="item.notok_sign_name !== null" style="color: #aaaaaa">
({{ item.notok_sign_name }})
</span>
</div>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="10">
<el-form-item label="交接物料">
<el-input v-model="listItem.batch" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="总数量">
<span>{{ listItem.count_cando }}</span>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="交接数量">
<el-input-number
v-model="listItem.count"
controls-position="right"
:min="0"
step="1"
:max="listItem.count_cando"
:disabled="mode==='show'"
:step-strictly="true"
style="width: 100%"
placeholder="交接数量"
@change="countChange"
>
</el-input-number>
</el-form-item>
</el-col>
<el-col :span="2" v-if="mode!=='show'">
<el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
</el-col>
</el-row>
<el-row>
<div class="total-count">总计{{ totalCount }}</div>
</el-row>
</el-form>
<el-footer v-if="mode!=='show'">
<el-button type="primary" v-loading="isSaveing" @click="submit">确定</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-dialog>
</template>
<script>
import scanDialog from "./../template/scan.vue";
export default {
emits: ["success", "closed"],
props: {
type: {
type: Number,
default: 10,
},
mgroupId: {
type: String,
default: "",
},
mgroupName: {
type: String,
default: "",
},
},
components: {
scanDialog
},
data() {
return {
selectItems:[],
yseorno: ["是", "否"],
loading: false,
mode: "add",
titleMap: {
add: "新增交接记录",
edit: "编辑交接记录",
show: "查看交接记录",
},
lists:[],//
handle_user: [],
form: {
send_date: null,
send_user: null,
send_mgroup: null,
recive_user: null,
recive_mgroup: null,
handoverb:[],
},
rules: {
batch: [
{
required: true,
message: "请输入批次号",
trigger: "blur",
},
],
wm: {
required: true,
message: "请选择物料",
trigger: "blur",
},
send_date: [
{
required: true,
message: "请选择送料日期",
trigger: "blur",
},
],
send_user: [
{
required: true,
message: "请选择交送人",
trigger: "blur",
},
],
send_mgroup: [
{
required: true,
message: "请选择交送工段",
trigger: "blur",
},
],
recive_user: [
{
required: true,
message: "请选择接收人",
trigger: "blur",
},
],
recive_mgroup: [
{
required: true,
message: "请选择接收工段",
trigger: "blur",
},
],
},
listParams:{
},
totalCount: 0,
deptID:'',
userList: [],
userList2: [],
deptOptions:[],
mgroupOptions: [],
materialOptions: [],
addShow: false,
visible: false,
scanVisible:false,
isSaveing: false,
setFiltersVisible: false,
};
},
mounted() {
let that = this;
that.form.type = that.type;
let materialObj = that.$TOOL.data.get("MATERIAL_OBJECT");
that.materialObj = materialObj;
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
that.form.handle_date = year + "-" + month + "-" + day;
that.form.send_mgroup = that.mgroupId;
if(that.mgroupName=="size"||that.mgroupName=="facade"){//
that.$API.system.user.list
.req({ page: 0, posts__code__contains: "check" })
.then((res) => {
that.userList = res;
});
}else if(that.type==20&&that.mgroupName=='废品库'){//
that.getCkUserList();
}else{
that.deptID = that.$TOOL.data.get('gx_deptID');
that.getUserList();
}
if((that.type==20&&that.mgroupName!=='废品库')||that.type==40){
that.getMaterialNotok();
}else if(that.type==20&&that.mgroupName=='废品库'){
that.getMaterialFP();
}else{
that.getMaterial();
}
that.getDeptOptions();
that.getMgroupOptions();
},
methods: {
//
getDeptOptions() {
this.$API.system.dept.list
.req({ page: 0, type: "dept" })
.then((res) => {
this.deptOptions = res;
});
},
//
getMgroupOptions() {
let that = this;
that.$API.mtm.mgroup.list.req({ page: 0}).then((res) => {
that.mgroupOptions = res;
if(that.type==40){
res.forEach(item=>{
if(item.name=="废品库"){
that.form.recive_mgroup = item.id;
}
})
that.getCkUserList();//
}
});
},
//
getMaterial() {
let that = this;
var req = {
page: 0,
notok_sign__isnull : 1,
count_xtest__isnull:1
};
that.materialOptions = [];
if(that.mgroupName=="size"){
that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => {
if(res.length>0){
req.belong_dept=res[0].id;
that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
that.materialOptions = res;
});
}
})
}else if(that.mgroupName=="facade"){
that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => {
if(res.length>0){
req.belong_dept=res[0].id;
that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
that.materialOptions = res;
});
}
})
}else{
req.mgroupx = that.mgroupId;
that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
that.materialOptions = res;
});
}
},
//
getMaterialNotok() {
let that = this;
that.materialOptions = [];
var req = {
mgroupx: that.mgroupId,
page: 0,
notok_sign__isnull : 0,
count_xtest__isnull:1
};
that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
that.materialOptions = res;
});
},
//
getMaterialFP() {
let that = this;
that.materialOptions = [];
var obj = {
page: 0,
state : 50,
state_all: 1
};
that.$API.wpm.wmaterial.list.req(obj).then((res) => {
that.materialOptions = res;
});
},
//
getUserList() {
let that = this;
this.$API.system.user.list.req({ depts: that.deptID, page: 0 }).then((res) => {
that.userList = res;
});
},
//
getCkUserList() {
let that = this;
this.$API.system.user.list.req({ page: 0, posts__code: "inm&check" })
.then((res) => {
if(that.type==40){
that.userList2 = [];
that.userList2 = res;
}else if(that.type==20&&that.mgroupName=='废品库'){
that.userList = [];
that.userList = res;
}
});
},
//
getUserList2() {
let that = this;
let deptID = '';
this.mgroupOptions.forEach(item => {
if(item.id==that.form.recive_mgroup){
deptID = item.belong_dept;
this.$API.system.user.list.req({ depts: deptID, page: 0 }).then((res) => {
that.userList2 = res;
});
}
});
},
//
getUserList3() {
let that = this;
this.$API.system.user.list
.req({ depts: that.form.recive_dept, page: 0 })
.then((res) => {
that.userList2 = res;
});
},
addMaterial(){
this.addShow = true;
},
delMaterial(index){
this.form.handoverb.splice(index,1);
this.countChange();
},
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
materialChange() {
let that = this;
let totalCount = 0;
let data = that.materialOptions.filter((item) => {
return that.selectItems.indexOf(item.id)>-1;
});
data.forEach(item=>{
item.wm = item.id;
item.count = item.count_cando;
totalCount += item.count_cando;
})
that.totalCount = totalCount;
that.form.handoverb = data;
},
countChange(){
let that = this;
let totalCount = 0;
if(this.form.handoverb.length>0){
this.form.handoverb.forEach(item=>{
totalCount += item.count;
})
that.totalCount = totalCount;
}
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
if (that.mode == "add") {
that.$API.wpm.handover.create.req(that.form).then((res) => {
if(that.type==40){
//
that.$API.wpm.handover.submit.req(res.id).then((res1) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
});
}else{
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}
}).catch((err) => {
//
that.isSaveing = false;
return err;
});
} else if (that.mode == "edit") {
that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => {
that.isSaveing = false;
that.$emit("success", that.form, that.mode);
that.visible = false;
that.$message.success("操作成功");
})
.catch((err) => {
//
that.isSaveing = false;
return err;
});
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
console.log('this.form',this.form);
if(data.type==30){
this.getUserList3();
}else{
this.getUserList2();
}
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
//
scanCode(){
let that = this;
that.scanVisible = true;
},
scanClose(data){
if(data==''||data==undefined||data==null){
return;
}
let that = this;
let id = data.split('#')[1];
console.log('id',id);
this.$API.cm.labelmat.item.req(id).then((res) => {
let arr = that.form.handoverb.filter((item) => {
return item.batch == res.batch;
})
if(arr.length>0){
that.$message.error("该批次已存在")
}else{
that.materialOptions.forEach((item) => {
if(item.batch == res.batch){
let obj = {};
obj.wm = item.id;
obj.batch = item.batch;
obj.counts = item.count;
obj.count = item.count;
that.form.handoverb.push(obj)
that.$refs.scanDialog.closed();
}
})
}
})
//
this.scanVisible = false;
},
},
};
</script>
<style scoped>
.formTitle {
margin-bottom: 10px;
font-weight: 600;
}
.total-count{
width: 100%;
text-align: right;
height: 50px;
line-height: 50px;
}
</style>

387
src/views/wpm_bx/inm.vue Normal file
View File

@ -0,0 +1,387 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" @click="tomio('do_out')" v-auth="'mio.do'"
v-if="mgroupName!=='size'&&mgroupName!=='facade'"
>领料</el-button
>
<el-button type="primary" @click="tomio('do_in')" v-auth="'mio.do'"
>入库</el-button
>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">
报废</el-button>
</div>
<div class="right-panel">
<el-select
v-model="query.state"
placeholder="物料状态"
clearable
@change="searchStateChange"
style="width: 250px"
>
<el-option
v-for="item in stateOptions"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
<el-input
style="margin-right: 5px"
v-model="query.search"
placeholder="名称"
clearable
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params"
:query="query"
>
<el-table-column label="状态" prop="state" width="100" >
<template #default="scope">
<el-tag :type="wmState[scope.row.state]?.type">
{{wmState[scope.row.state]?.text}}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="物料名称"
prop="material_name"
min-width="150"
>
<template #default="scope">
{{ scope.row.material_name }}
<span v-if="scope.row.material_origin != null"
>{{ scope.row.material_origin_name }}</span
>
</template>
</el-table-column>
<el-table-column
label="批次号"
prop="batch"
min-width="120"
></el-table-column>
<el-table-column
label="部门/工段"
prop="belong_dept_name"
>
<template #default="scope">
{{scope.row.belong_dept_name}}/{{scope.row.mgroup_name}}
</template>
</el-table-column>
<el-table-column
label="数量"
prop="count"
min-width="80"
></el-table-column>
<el-table-column
label="生产中"
prop="count_working"
min-width="80"
></el-table-column>
<el-table-column
label="不合格标记"
prop="notok_sign_name"
></el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
width="150"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120"
>
<template #default="scope">
<el-button
link size="small"
@click="table_Check(scope.row)"
v-auth="'ftestwork.create'"
type="primary"
v-if="scope.row.notok_sign_name == null"
>检验
</el-button>
<!-- v-if="mgroupName!=='size'&&mgroupName!=='facade'&&scope.row.notok_sign_name == null" -->
<el-button
link size="small"
type="warning"
@click="tableCheckList(scope.row)"
v-if="scope.row.notok_sign_name == null"
>检验记录
</el-button>
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
</template>
</el-table-column>
</scTable>
</el-main>
<el-dialog title="选择物料" v-model="materialsVisible" width="90%">
<materials
style="height: 500px"
:materialType="materialType"
ref="materialsChose"
@choseChange="choseChange"
></materials>
</el-dialog>
<check-dialog
v-if="dialog.save"
ref="saveDialog"
:mgroup="mgroupId"
:mgroupName="mgroup_name"
:itemObj = "checkItem"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</check-dialog>
<scrap-dialog
v-if="dialog.scrap"
ref="scrapDialog"
:type="type"
:mgroupName="mgroup_name"
:mgroupId="mgroupId"
@success="handleScrapSuccess"
@closed="dialog.scrap = false"
>
</scrap-dialog>
<showDrawer
ref="showDrawer"
v-if="visibleDrawer"
:wm="wm"
@closed="visibleDrawer = false"
>
</showDrawer>
<save-dialog
v-if="dialog.inmRecord"
ref="inmRecordDialog"
:cate = "cate_type"
:process = "process"
:mgroupId = "params.mgroupx"
:deptId = " params.belong_dept"
@success="handleinmSuccess"
>
</save-dialog>
<print-dialog
v-if="dialog.print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-container>
</template>
<script>
import { wmState } from "@/utils/enum.js";
import materials from "./../mtm/materials.vue";
import printDialog from "./../template/printmaterial.vue";
import checkDialog from "./check_form.vue";
import showDrawer from "./check_drawer.vue";
import scrapDialog from "./handover_form.vue";
import saveDialog from "./inm_record.vue";
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
components: {
saveDialog,
materials,
checkDialog,
showDrawer,
scrapDialog,
printDialog
},
name: "wmaterial",
data() {
return {
wmState,
apiObj: null,
params: {
mgroupx: "",
belong_dept:''
},
wmtype:0,
query: {
search: "",
state: null,
},
dialog: {
save: false,
scrap: false,
permission: false,
inmRecord:false,
print_m:false
},
tableData: [],
selection: [],
stateOptions:[
{ value: 10, name: "合格"},
{ value: 20, name: "不合格"},
{ value: 30, name: "返修"},
// { value: 40, name: ""},
// { value: 50, name: ""},
],
queryWm: {
search: "",
material: "",
},
cate_type:'',
process:'',
materialType: "wm",
materialsVisible:false,
visibleDrawer: false,
apiObjPrint:this.$API.cm.labelmat.fromWm,
wmId:'',
mgroup_name:''
};
},
mounted() {},
watch: {
mgroupName: {
handler: function (newval,odlval) {
let that = this;
that.params.mgroupx = "";
that.apiObj = null;
that.mgroup_name = newval;
that.getMgroupInfo();
},
},
},
methods: {
getMgroupInfo(){
let that = this;
console.log(that.mgroupName);
if(that.mgroupName=="size"){
// that.params.material__process__name = "";
that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => {
if(res.length>0){
that.params.mgroupx = null;
that.params.belong_dept=res[0].id;
}
that.apiObj = that.$API.wpm.wmaterial.list;
that.$refs.table.refresh();
})
}else if(that.mgroupName=="facade"){
// that.params.material__process__name = "";
that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => {
if(res.length>0){
that.params.mgroupx = null;
that.params.belong_dept=res[0].id;
}
that.apiObj = that.$API.wpm.wmaterial.list;
that.$refs.table.refresh();
})
}else{
that.$API.mtm.mgroup.list
.req({ page: 0, name: that.mgroupName })
.then((res) => {
if (res.length < 1) {
that.$message.error("获取工段错误");
return;
}
that.mgroupId = res[0].id;
that.$TOOL.data.set('gx_deptID',res[0].belong_dept)
that.process = res[0].process;
that.params.mgroupx = res[0].id;
that.params.belong_dept = res[0].belong_dept;
that.apiObj = that.$API.wpm.wmaterial.list;
that.$refs.table.refresh();
});
}
},
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
materialsChoses(str) {
this.materialType = str;
this.materialsVisible = true;
},
choseChange(data) {
this.queryWm.material = data;
this.$refs.table_wm.queryData(this.queryWm);
this.materialsVisible = false;
},
tomio(type) {
let that = this;
that.cate_type=type;
that.dialog.inmRecord = true;
that.$nextTick(() => {
that.$refs.inmRecordDialog.open("add");
});
// this.$router.push({ name: "halfgood_mio" });
},
table_Check(row){
this.checkItem = row;
let mode = this.mgroupName;
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open(mode);
});
},
//
tableCheckList(row){
this.wm = row.id;
this.visibleDrawer = true;
this.$nextTick(() => {
this.$refs.showDrawer.open();
});
},
//
selectionChange(selection) {
this.selection = selection;
},
//
table_add(type) {
this.dialog.scrap = true;
this.type = type;
this.$nextTick(() => {
this.$refs.scrapDialog.open("add");
});
},
handleScrapSuccess(){
this.dialog.scrap = false;
this.$refs.table.refresh();
},
//
handleinmSuccess(){
this.$refs.table.refresh();
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
//
handleSaveSuccess(data, mode) {
this.dialog.save = false;
this.$refs.table.refresh();
},
//
printMaterial(row){
let that = this;
that.wmId = row.id;
that.wmtype = row.material_.type;
that.dialog.print_m = true;
this.$nextTick(() => {
this.$refs.printmaterial.open();
})
},
},
};
</script>
<style scoped></style>

View File

@ -0,0 +1,506 @@
<template>
<el-drawer
:title="titleMap[mode]"
v-model="visible"
:size="'80%'"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-if="mode != 'show'">
<el-header>
<el-steps
:active="active"
style="width: 100%"
:align-center="true"
finish-status="success"
>
<el-step
v-for="(item, index) of stepes"
:key="index"
:title="item"
@click="handleStep(index)"
>
</el-step>
</el-steps>
</el-header>
<!--基本信息!-->
<el-main class="nopadding" v-if="active === 0">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="110px"
style="margin: 40px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="编号" prop="number">
<el-input v-model="form.number" placeholder="编号" />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="出入库日期">
<el-date-picker
v-model="form.inout_date"
type="date"
placeholder="出入库日期"
value-format="YYYY-MM-DD"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="执行部门">
<el-select
v-model="form.belong_dept"
clearable
style="width: 100%"
disabled
>
<el-option
v-for="item in deptOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="工段">
<el-select
v-model="form.mgroup"
clearable
style="width: 100%"
placeholder="工段"
disabled
>
<el-option
v-for="item in mgroupOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="部门执行人">
<el-select v-model="form.do_user" clearable style="width: 100%">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="仓库执行人">
<el-select
v-model="form.mio_user"
clearable
style="width: 100%"
>
<el-option
v-for="item in userOption"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item>
<el-button
style="margin-top: 20px"
type="primary"
:loading="isSaveing"
:disabled="isSaveing"
@click="handleNextStep"
>下一步
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<!--mioitem-->
<el-main class="nopadding" v-if="active === 1">
<el-container>
<el-header>
<div class="left-panel" style="margin: 10px">
<el-button
type="primary"
icon="el-icon-plus"
@click="table_add"
></el-button>
</div>
</el-header>
<el-main>
<scTable
ref="tables"
:apiObj="apiObj"
:params="query"
row-key="id"
hidePagination
hideDo
stripe
>
<el-table-column type="index" width="50" />
<el-table-column
label="物料"
prop="material"
show-overflow-tooltip
>
<template #default="scope"
>{{ scope.row.material_name }}
</template>
</el-table-column>
<el-table-column label="批次号" prop="batch">
</el-table-column>
<el-table-column label="仓库" prop="warehouse_name">
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
</scTable>
</el-main>
</el-container>
</el-main>
<el-footer v-if="active === 1" style="text-align: center">
<el-button @click="handleLastStep" style="margin-right: 4px">上一步</el-button>
<el-button @click="table_submit" type="warning">提交</el-button>
</el-footer>
</el-container>
<el-card v-else shadow="never" style="height: 100%;">
<el-button type="primary" @click="handlePrint" style="position: absolute;right: 20px;">打印</el-button>
<el-descriptions title="基本信息" :column="3" style="width: 100%">
<el-descriptions-item label="编号">
{{form.number}}
</el-descriptions-item>
<el-descriptions-item label="出入库类型">
{{typeDict[form.type]}}
</el-descriptions-item>
<el-descriptions-item label="状态">
{{stateDict[form.state]}}
</el-descriptions-item>
<el-descriptions-item label="部门/车间">
{{form.belong_dept_name}}-{{ form.mgroup_name }}
</el-descriptions-item>
<el-descriptions-item label="执行人">
{{form.do_user_name}}
</el-descriptions-item>
<el-descriptions-item label="创建时间">
{{form.create_time}}
</el-descriptions-item>
</el-descriptions>
<div style="height: 8px"></div>
<scTable
ref="table"
:data="tableData"
row-key="id"
stripe
hidePagination
hideDo
>
<el-table-column type="index" width="50" />
<el-table-column
label="物料"
prop="material"
show-overflow-tooltip
>
<template #default="scope"
>{{ scope.row.material_name }}
</template>
</el-table-column>
<el-table-column label="批次号" prop="batch">
</el-table-column>
<el-table-column label="仓库" prop="warehouse_name">
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
<el-table-column
label="组合件信息"
v-if="cate == 'good'"
width="300"
>
<template #default="scope">
<div v-if="scope.row.assemb.length > 0">
<div
v-for="item in scope.row.assemb"
:key="item.id"
>
<div>
{{ item.material_name }}
<span
style="
color: gray;
font-size: 12px;
"
>:</span
>{{ item.batch }}
<span
style="
color: gray;
font-size: 12px;
"
>:</span
>{{ item.rate }}
</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="不合格数量" prop="count_notok">
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
show-overflow-tooltip
>
</el-table-column>
<el-table-column width="90">
<template #default="scope">
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:cate = "cate"
:mgroupId = 'mgroupId'
:mioId = 'mioId'
:process="process"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
<el-dialog v-model="printVisible" width="1200px">
<print :baseData="form" :tableData="tableData" :type="form.type" mtype="20" @closePrint="printVisible=false"/>
</el-dialog>
<print-dialog
v-if="dialog.print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-drawer>
</template>
<script>
import saveDialog from "./inm_record_form.vue";
import print from "./../setting/print/A4.vue";
import printDialog from "./../template/printmaterial.vue";
export default {
name: "inm_record",
components: { saveDialog,print,printDialog },
props: {
cate: { type: String, default: "" },
deptId: { type: String, default: "" },
mgroupId: { type: String, default: "" },
process: { type: String, default: "" },
},
data() {
return {
active: 0,
stepSuc: [0],
stepes: ["基本信息", "详情"],
titleMap: { add: "新增出入库", edit: "编辑出入库",show:"出入库详情" },
mode: "add",
isSaveing: false, //
search: {
keyword: null,
},
dialogTitle: "新增",
visible: false,
printVisible:false,
dialog: {
save: false,
print_m:false,
},
form: {
number: "",
inout_date: "",
belong_dept: "",
mgroup: "",
do_user: "",
mio_user: "",
},
stateDict: {10: "创建中",20: "已提交",},
typeDict:{'do_in':'生产入库','do_out':'生产领料'},
apiworkerObj: null,
materials: [],
apiObj: null,
query: {
mio: "",
},
rules: {
name: [{ required: true, message: "请输入" }],
},
mioId:null,
routepack: "",
tableData:[],
userOption: [],//
userOptions: [],//
deptOptions: [],
mgroupOptions: [],
wmId:'',
wmtype:'',
batchContains:'',
apiObjPrint:this.$API.cm.labelmat.fromWm,
};
},
mounted() {
this.isSaveing = false;
this.form.mgroup = this.mgroupId;
this.form.type = this.cate;
this.form.belong_dept = this.deptId;
this.$nextTick(() => {
this.getDeptOptions();
this.getmgroupOptions();
this.getDeptUsers();//
this.getDeptUser();//
})
},
methods: {
open(mode) {
this.mode = mode;
this.visible = true;
return this;
},
setData(data,type) {
console.log('data',data)
this.mioId = data.id;
if(type){
this.getTableData();
}
Object.assign(this.form, data);
},
getTableData() {
let that = this;
let obj = {};
obj.mio = that.mioId;
obj.page = 0;
that.$API.inm.mioitem.list.req(obj).then((res) => {
that.tableData = res;
});
},
//
getmgroupOptions() {
this.$API.mtm.mgroup.list.req({page: 0}).then(res=>{
this.mgroupOptions = res;
})
},
//
getDeptOptions() {
this.$API.system.dept.list.req({ page: 0, type__in: "dept" }).then((res) => {
this.deptOptions = res;
});
},
//
getDeptUsers() {
let that = this;
that.$API.system.user.list.req({ depts: that.deptId, page: 0 }).then((res) => {
that.userOptions = res;
});
},
//
getDeptUser() {
let that = this;
this.$API.system.user.list.req({ page: 0, posts__code__contains: "inm" }).then((res) => {
that.userOption = res;
});
},
//
getMaterials() {
let that = this;
that.$API.mtm.material.list.req({ page: 0, type__in: "10,20", is_hidden: false }).then((res) => {
that.materials = res;
});
},
//
getwMaterials() {
let that = this;
that.$API.wpm.wmaterial.list.req({ page: 0, belong_dept: that.deptId }).then((res) => {
that.materials = res;
});
},
handleStep(val) {
//
if (this.stepSuc.includes(val) === true) {
this.active = val;
}
},
//
handleLastStep() {
this.active = 0;
},
//
handleNextStep() {
let that = this;
if(that.mioId==null){
that.$API.inm.mio.create.req(that.form).then((res) => {
that.mioId = res.id;
that.form.mio = res.id;
that.query.mio = res.id;
that.apiObj = that.$API.inm.mioitem.list;
that.active = 1;
});
}else{
that.$API.inm.mio.update.req(that.mioId,that.form).then((res) => {
that.query.mio = that.mioId;
that.apiObj = that.$API.inm.mioitem.list;
that.active = 1;
});
}
},
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
table_submit() {
let that = this;
that.$API.inm.mio.submit.req(that.mioId).then((res) => {
that.$message.success("提交成功");
that.visible = false;
// that.$emit("closed");
});
},
submitOut() {},
//
handlePrint(){
this.printVisible = true;
},
//
printMaterial(row){
let that = this;
that.wmId = row.id;
that.wmtype = row.material_.type;
that.dialog.print_m = true;
that.$nextTick(() => {
that.$refs.printmaterial.open();
})
},
//
handleSaveSuccess() {
this.$refs.tables.refresh();
},
},
};
</script>

View File

@ -0,0 +1,302 @@
<template>
<el-dialog
:title="titleMap[form.type]"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="120px"
>
<el-form-item label="物料" v-if="cate == 'do_out'">
<el-select
v-model="form.material"
value-key="id"
clearable
filterable
style="width: 100%"
@change="selectMaterialChange"
>
<el-option
v-for="item in materialOptions"
:key="item.id"
:label="item.full_name"
:value="item.id"
>
<span style="float: left">{{ item.full_name }}</span>
<span
style="
float: right;
color: '#E6A23C';
font-size: 13px;
"
v-if="item.is_hidden"
></span
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="物料批次" v-else>
<el-select
v-model="form.batch"
filterable
@change="selectwmChange"
>
<el-option
v-for="item in wbatchOptions"
:key="item.id"
:value="item.batch"
>
<span style="display:inline-block;float: left;">{{item.material_.name}}|{{ item.batch }}</span>
<span
style="
float: right;
color: var(--el-text-color-secondary);
font-size: 13px;
"
>{{ item.count }}</span
>
</el-option>
</el-select>
<scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog>
</el-form-item>
<el-form-item label="批次" v-if="cate == 'do_out'">
<el-select
v-model="selectBatch"
value-key="id"
clearable
@change="selectBatchChange"
@clear="selectBatchClear"
>
<el-option
v-for="item in batchOptions"
:key="item.id"
:label="item.batch"
:value="item"
>
<span style="float: left">{{ item.batch }}</span>
<span
style="
float: right;
color: var(--el-text-color-secondary);
font-size: 13px;
"
>{{ item.count }} -- {{ item.warehouse_name }}</span
>
</el-option>
</el-select>
<scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog>
</el-form-item>
<el-form-item label="仓库">
<el-select
v-model="form.warehouse"
clearable
style="width: 100%"
>
<el-option
v-for="item in warehouseOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="数量">
<el-input-number
v-model="form.count"
:min="0"
:precision="0"
style="width: 100%"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" :loading="isSaveing" @click="submit">
保存
</el-button>
<el-button @click="visible = false">取消</el-button>
</template>
</el-dialog>
</template>
<script>
import scanDialog from "./../template/scan.vue";
export default {
emits: ["success", "closed"],
props: {
cate: { type: String, default: "" },
mioId: { type: String, default: "" },
mgroupId: { type: String, default: "" },
process: { type: String, default: "" },
},
components: {
scanDialog
},
data() {
return {
type: "do_in",
loading: false,
mode: "add",
titleMap: {
do_out: "生产领料",
do_in: "生产入库",
},
form: {},
rules: {
material: [{required: true,message: "请选择物料",trigger: "blur",},],
},
visible: false,
isSaveing: false,
materialOptions: [],
batchOptions: [],
inputBatchDisable: false,
setFiltersVisible: false,
warehouseOptions: [],
selectBatchDisable: false,
selectMaterial: null,
selectBatch: null,
wbatchOptions: [],//
};
},
mounted() {
this.form.type = this.cate ;
this.form.mio = this.mioId ;
if(this.cate == 'do_out'){//---
this.inputBatchDisable = true;
this.getMaterialOptions();
this.getBatchOptions();
}else{//----
this.getMgroupWmaterial();
}
this.getWarehouseOptions();
},
methods: {
//
getWarehouseOptions() {
this.$API.inm.warehouse.list.req({ page: 0 }).then((res) => {
this.warehouseOptions = res;
});
},
//
getMaterialOptions() {
let that = this;
var cate = this.cate;
var query = {};
// 'do_out': '',
// 'do_in': '',
//(10, ''), (20, ''), (30, ''),
console.log('this.cate',cate);
if (cate == "do_out") {
query = {page: 0,type__in: '20,30',is_hidden: false,is_assemb: false};
} else if (cate == "do_in") {
query = { page: 0, type__in: '10,20' };
}
that.$API.mtm.material.list.req(query).then((res) => {
that.materialOptions = res;
});
},
//
getMgroupWmaterial() {
let that = this;
let obj = {};
obj.state = 10;
obj.page= 0;
obj.mgroupx= that.mgroupId;
obj.material__process= that.process;
if (that.mgroupId != null &&that.mgroupId != undefined &&that.mgroupId != "") {
that.$API.wpm.wmaterial.list.req(obj).then((res) => {
that.wbatchOptions = res;
});
}
},
//
getBatchOptions() {
let that = this;
let obj = {};
obj.page = 0;
obj.material = that.form.material;
this.$API.inm.warehouse.batch.req(obj).then((res) => {
this.batchOptions = res;
});
},
scanClose(data){
let that = this;
let id = data.split('#')[1];
console.log('id',id);
that.form.batch = id;
},
selectMaterialChange() {
this.getBatchOptions();
},
getItem(options, id) {
for (var i = 0; i < options.length; i++) {
if (options[i].id == id) {
return options[i];
}
}
},
selectBatchChange(item) {
this.form.batch = item.batch;
this.form.warehouse = item.warehouse;
},
//
selectwmChange(val){
let that = this;
that.wbatchOptions.forEach((item) => {
if (item.batch == val) {
that.form.material = item.material;
}
})
},
selectBatchClear() {
this.form.batch = "";
this.form.warehouse = "";
},
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
submit() {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
this.form.mio = this.mioId;
try {
var res;
if (this.mode == "add") {
res = await this.$API.inm.mioitem.create.req(this.form);
} else if (this.mode == "edit") {
res = await this.$API.inm.mioitem.update.req(this.form.id,this.form);
}
this.isSaveing = false;
this.$emit("success");
this.visible = false;
this.$message.success("操作成功");
} catch (err) {
//
this.isSaveing = false;
return err;
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

View File

@ -0,0 +1,116 @@
<template>
<el-container>
<el-aside style="width: 100px;background: #ffffff;">
<ul style="padding-left: 7px;">
<li
v-for="(item,index) in mgroups"
:key="item.id"
:class="['mgroupItem',selectedIndex === index?'mgroupItemActive':'']"
@click="changeMgroup(item.id,index)"
>{{item.name}}</li>
</ul>
</el-aside>
<el-main>
<el-container>
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-main id="elMain" class="nopadding">
<!-- 日志 -->
<mlogs
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 60%"
></mlogs>
<mtask
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 40%"
></mtask>
<!-- 交接记录 -->
<handover
v-else-if="values == '交接记录'"
:mgroupName="mgroupName"
></handover>
<!-- 库存 -->
<inm v-else-if="values == '库存'" :mgroupName="mgroupName"></inm>
</el-main>
</el-container>
</el-main>
</el-container>
</template>
<script>
import inm from "./inm.vue";
import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue";
import handover from "./handover.vue";
export default {
name: "bx",
components: { inm, mlogs, mtask, handover },
data() {
return {
mgroups:[],
tableHieght: 200,
options: ["日志", "交接记录", "库存"],
values: "日志",
mgroupName: "",
mgroupId: "",
selectedIndex:0,
};
},
created() {
let that = this;
that.getMgroups();
},
mounted() {
let that = this;
let height = document.getElementById("elMain").clintHeight / 2;
that.tableHieght = height;
},
methods: {
handleChange(value) {
this.value = value;
console.log("Selected value:", value);
},
getMgroups(){
let that = this;
that.$API.mtm.mgroup.list.req({page:0}).then((res) => {
that.mgroups = res;
that.mgroupName = res[0].name;
});
},
changeMgroup(id,index){
let that = this;
that.selectedIndex = index;
console.log(that.selectedIndex);
that.mgroupId = id;
that.mgroupName = that.mgroups[index].name;
},
},
};
</script>
<style scoped>
.countBlock {
width: 80px;
color: #ffffff;
text-align: center;
}
.mgroupItem{
height: 35px;
width: 80px;
line-height: 35px;
margin: 5px 0;
text-align: center;
color: #6e80ff;
}
.mgroupItem:hover,.mgroupItemActive{
color: #6e80ff;
background: rgba(83, 109, 254, 0.2);
}
</style>

View File

@ -0,0 +1,730 @@
<template>
<el-drawer
title="日志详情"
v-model="visible"
:size="'90%'"
destroy-on-close
@closed="$emit('closed')"
>
<div>
<el-card style="width: 100%" header="基本信息" shadow="never">
<el-button type="primary" @click="handlePrint" style="position: absolute;right: 20px;">打印</el-button>
<el-descriptions>
<el-descriptions-item label="工艺路线">{{
mlogItem.routepack_name
}}</el-descriptions-item>
<el-descriptions-item label="输入物料">{{
mlogItem.material_in_name
}}</el-descriptions-item>
<el-descriptions-item label="输出物料">{{
mlogItem.material_out_name
}}</el-descriptions-item>
<el-descriptions-item label="工段名称">{{
mlogItem.mgroup_name
}}</el-descriptions-item>
<el-descriptions-item label="生产设备">{{
mlogItem.equipment_name
}}</el-descriptions-item>
<el-descriptions-item label="预计工时">{{
mlogItem.hour_work
}}</el-descriptions-item>
<el-descriptions-item label="部门/车间">{{
mlogItem.belong_dept_name
}}</el-descriptions-item>
<el-descriptions-item label="处理人">{{
mlogItem.handle_user_name
}}</el-descriptions-item>
<el-descriptions-item label="开始时间">{{
mlogItem.work_start_time
}}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{
mlogItem.create_time
}}</el-descriptions-item>
<el-descriptions-item label="工单状态" v-if="mlogItem.mgroup_name=='退火'">
<el-tag v-if="mlogItem.ticket_">{{act_states[mlogItem.ticket_.act_state]}}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="检验表单" v-if="mlogItem.mgroup_name=='退火'||mlogItem.mgroup_name=='黑化'">
<el-link :href="mlogItem.test_file" target="_blank" type="primary" :underline="false">{{mlogItem.test_file}}</el-link>
</el-descriptions-item>
</el-descriptions>
<div style="padding: 5px 10px;display: flex;justify-content: end;">
<el-button
type="primary"
v-if="mlogItem.submit_time == null&&(mlogItem.ticket==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type==1))"
@click="mlogUpdate"
style="margin-right: 10px;"
v-auth="'mlog.update'"
>
编辑
</el-button>
<el-button
type="primary"
v-if="mlogItem.mgroup_name!='退火'&&mlogItem.submit_time == null"
:loading="isSaveing"
@click="mlogSubmit"
>提交</el-button
>
<!-- 退火-->
<el-button
type="primary"
v-if="mlogItem.mgroup_name=='退火'&&(mlogItem.ticket==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type==1))"
:loading="isSaveing"
@click="createTicket"
>放行审批</el-button>
</div>
</el-card>
<!-- 输入物料 -->
<el-card
style="width: 100%; margin: 1vh 0"
header="输入物料"
shadow="never"
>
<div>
<el-button
type="primary"
v-if="mlogItem.submit_time == null&&(mlogItem.ticket==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type==1))"
icon="el-icon-plus"
@click="table_add"
>新增</el-button
>
</div>
<div style="height: 4px"></div>
<scTable
ref="tableIn"
:apiObj="apiObj"
row-key="id"
stripe
:params="paramsIn"
hidePagination
>
<el-table-column type="index" width="50" />
<el-table-column
label="物料"
prop="material_in_name"
show-overflow-tooltip
></el-table-column>
<el-table-column label="批次号" prop="batch">
</el-table-column>
<el-table-column label="领用数量" prop="count_use">
</el-table-column>
<el-table-column label="加工前不良" prop="count_pn_jgqbl">
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="100px"
>
<template #default="scope">
<el-button
link
type="primary"
@click="table_in_edit(scope.row)"
:disabled="mlogItem.submit_time !== null||mlogItem.ticket!==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type==1)"
>
编辑
</el-button>
<el-button
link
:disabled="mlogItem.submit_time !== null||mlogItem.ticket!==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type==1)"
type="danger"
@click="table_in_del(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<!-- 输入物料编辑 -->
<el-dialog v-model="saveInDialog" title="编辑">
<el-form
:model="saveInForm"
:rules="rules"
label-width="100px"
ref="saveInForm"
>
<el-row>
<el-col :span="23">
<el-form-item label="领取数量" prop="count_use">
<el-input-number
v-model="saveInForm.count_use"
:min="1"
style="width: 100%"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :span="23">
<el-form-item label="加工前不良" prop="count_pn_jgqbl">
<el-input-number
v-model="saveInForm.count_pn_jgqbl"
:min="0"
style="width: 100%"
controls-position="right"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button
type="primary"
:loading="isSaveing"
@click="saveInSubmit()"
> </el-button
>
</template>
</el-dialog>
<!-- 输出物料 -->
<el-card style="width: 100%" header="输出物料" shadow="never">
<scTable
ref="tableOut"
:apiObj="apiObj"
row-key="id"
stripe
:params="paramsOut"
hidePagination
>
<el-table-column type="index" width="50" />
<el-table-column type="expand">
<template #default="props">
<div style="padding-left: 50px" v-if="props.row.count_notok_json.length>0">
<el-descriptions :column="4" v-for="item in props.row.count_notok_json" :key="item">
<el-descriptions-item label="层数">
{{item.floor}}
</el-descriptions-item>
<el-descriptions-item label="抽检数">
{{item.count_sampling}}
</el-descriptions-item>
<el-descriptions-item label="总数">
{{item.count}}
</el-descriptions-item>
</el-descriptions>
</div>
<div style="padding-left: 50px" v-else>
<el-descriptions :column="4">
<el-descriptions-item label="划伤">{{
props.row.count_n_hs
}}</el-descriptions-item>
<el-descriptions-item label="气泡">{{
props.row.count_n_qp
}}</el-descriptions-item>
<el-descriptions-item label="水纹">{{
props.row.count_n_swen
}}</el-descriptions-item>
<el-descriptions-item label="崩边">{{
props.row.count_n_bb
}}</el-descriptions-item>
<el-descriptions-item label="小崩边">{{
props.row.count_n_xbb
}}</el-descriptions-item>
<el-descriptions-item label="雾面">{{
props.row.count_n_wm
}}</el-descriptions-item>
<el-descriptions-item label="麻点">{{
props.row.count_n_md
}}</el-descriptions-item>
<el-descriptions-item label="线痕">{{
props.row.count_n_xh
}}</el-descriptions-item>
</el-descriptions>
</div>
</template>
</el-table-column>
<el-table-column
label="产出物料"
prop="material_out_name"
show-overflow-tooltip
></el-table-column>
<el-table-column label="批次号" prop="batch">
</el-table-column>
<el-table-column label="数量" prop="count_real">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
<el-table-column label="不合格数量" prop="count_notok">
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="100px"
>
<template #default="scope">
<el-button
link
type="primary"
:disabled="mlogItem.submit_time !== null||mlogItem.ticket!==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type==1)"
@click="table_out_check(scope.row)"
>
检验
</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<!-- 工段物料库存 -->
<el-card style="width: 100%" header="工段物料列表" shadow="never">
<scTable
ref="tableWm"
:apiObj="apiObjWm"
:params="paramsWm"
stripe
hidePagination
>
<el-table-column label="物料名称" prop="material_name" show-overflow-tooltip>
</el-table-column>
<el-table-column label="批次号" prop="batch">
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
<el-table-column label="不合格标记" prop="notok_sign_name">
</el-table-column>
<el-table-column width="100">
<template #default="scope">
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:mlog="mlogId"
:mgroup="mgroup"
:materialIn="materialIn"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
<check-dialog
v-if="dialog.check"
ref="checkDialog"
@success="handleCheckSuccess"
@closed="dialog.check = false"
>
</check-dialog>
<edit-dialog
v-if="dialog.edit"
ref="editDialog"
:dept="deptId"
:mgroupName= "mlogItem.mgroup_name"
@success="handleEditSuccess"
@closed="dialog.edit = false"
>
</edit-dialog>
<!-- 退火放行通知单 -->
<el-dialog v-model="ticketDialog" title="退火放行通知单">
<el-form
:model="saveInForm"
:rules="rules"
label-width="100px"
ref="saveInForm"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="退火炉号">
<el-input v-model="oinfo_json.退火炉号"/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="退火时间">
<el-input-number
v-model="oinfo_json.退火时间"
:min="1"
controls-position="right"
/>min
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="退火温度">
<el-input-number
v-model="oinfo_json.退火温度"
:min="1"
style="width: 100%"
controls-position="right"
/>
<span style="position: absolute;right: -17px;">°C</span>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="抽检结果">
<el-input v-model="oinfo_json.抽检结果"/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="抽检数">
<el-input-number
v-model="oinfo_json.抽检数"
:precision="0"
:min="1"
style="width: 100%"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="强度落球">
<el-input v-model="oinfo_json.强度落球"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-form-item label="放行标准">退火后直径23.5±0.2黑圈内径5.9±0.1外径7.6-7.77</el-form-item>
</el-row>
<el-form-item label="检验附件">
<sc-upload-file
v-model="fileList"
:multiple="false"
:limit="1"
:accept="['.xlsx', '.xls']"
@success = "fileUPSuccess"
>
<el-button type="primary" icon="el-icon-upload"> </el-button>
</sc-upload-file>
</el-form-item>
</el-form>
<template #footer>
<el-button
v-for="item in initForm.transitions"
:key="item.id"
type="primary"
:loading="isSaveing"
:disabled="isSaveing"
@click="submitTicketCreate(item.id)"
style="margin-right: 4px"
>{{ item.name }}</el-button
>
</template>
</el-dialog>
<el-dialog v-model="printVisible" width="1200px">
<print :baseData="mlogItem" :tableData="tableData" :tableData2="tableData2" type="102" @closePrint="printVisible=false"/>
</el-dialog>
<print-dialog
v-if="dialog.print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</div>
</el-drawer>
</template>
<script>
import editDialog from "./mlog_form.vue";
import saveDialog from "./mlogb_form.vue";
import checkDialog from "./mlogb_check.vue";
import print from "./../setting/print/A4.vue";
import printDialog from "./../template/printmaterial.vue";
export default {
props: {
mlogId: {
type: String,
default: "",
},
},
components: {
editDialog,
saveDialog,
checkDialog,
print,
printDialog
},
emits: ["success", "closed"],
data() {
return {
loading: false,
//
form: {},
dialog: {
save: false,
edit: false,
check: false,
print_m:false,
},
apiObj: null,
apiObjWm:null,
paramsWm: {
page: 0,
search:'',
mgroup:''
},
paramsIn: {
page: 0,
mlog: "",
material_in__isnull: 0,
},
paramsOut: {
page: 0,
mlog: "",
material_out__isnull: 0,
},
mgroup: "",
mlogItem: {},
saveInForm: {
count_use: 0,
count_pn_jgqbl: 0,
},
oinfo_json:{
退火炉号:'',
退火时间:'',
退火温度:'',
抽检结果:'',
抽检数:'',
强度落球:'',
},
act_states: {
0: "草稿中",
1: "进行中",
2: "被退回",
3: "被撤回",
4: "已完成",
5: "已关闭",
},
fileList:[],
tableDataWm:[],
test_file:'',
deptId: "",
visible: false,
isSaveing: false,
options: [],
tableData:[],
tableData2:[],
saveInDialog: false,
ticketDialog:false,
printVisible:false,
setFiltersVisible: false,
rules: {
count_use: [
{
required: true,
message: "请输入领取数量",
trigger: "blur",
},
],
},
wmId:'',
wmtype:'',
batchContains:'',
apiObjPrint:this.$API.cm.labelmat.fromWm,
};
},
mounted() {
console.log('this.mlogId',this.mlogId);
let that = this;
this.paramsIn.mlog = this.mlogId;
this.paramsOut.mlog = this.mlogId;
this.apiObj = this.$API.wpm.mlogb.list;
this.getInit();
that.$API.wpm.mlogb.list.req(that.paramsIn).then((res) => {
that.tableData = res;
})
that.getMlogItem();
},
methods: {
open() {
this.visible = true;
},
getMlogItem() {
let that = this;
that.$API.wpm.mlog.item.req(that.mlogId).then((res) => {
that.mlogItem = res;
if(res.test_file!==null){
that.fileList = [{name:res.test_file,url:res.test_file}];
that.form.test_file = res.test_file;
}
that.mgroup = res.mgroup;
that.paramsWm.mgroup = res.mgroup;
that.materialIn = res.material_in;
that.deptId = res.belong_dept;
that.$API.wpm.mlogb.list.req(that.paramsOut).then((res) => {
that.tableData2 = res;
if(res.length>0){
res.forEach((item) => {
that.batchContains+= item.batch + " ";
})
that.paramsWm.search = that.batchContains;
that.apiObjWm = that.$API.wpm.wmaterial.list;
}
})
});
},
//
setData(data) {
Object.assign(this.form, data);
this.getRoute(data.id);
},
//
mlogUpdate() {
this.dialog.edit = true;
this.$nextTick(() => {
this.$refs.editDialog.open("edit").setData(this.mlogItem);
});
},
// mlogUpdate(data) {
// this.$refs.editDialog.open().setData(data);
// },
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open();
});
},
//
table_in_edit(row) {
this.saveInForm = row;
this.saveInDialog = true;
},
//
saveInSubmit() {
let that = this;
that.$refs.saveInForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let obj = {};
obj.count_use = that.saveInForm.count_use;
obj.count_pn_jgqbl = that.saveInForm.count_pn_jgqbl;
that.$API.wpm.mlogb.updateIn
.req(that.saveInForm.id, obj)
.then((res) => {
that.isSaveing = false;
that.$message.success("操作成功");
that.saveInDialog = false;
that.$refs.tableIn.refresh();
that.$refs.tableOut.refresh();
})
.catch(() => {
that.isSaveing = false;
});
}
});
},
table_in_del(row) {
let that = this;
that.$confirm("确定删除吗?").then(() => {
that.$API.wpm.mlogb.delIn.req(row.id).then((res) => {
that.$message.success("操作成功");
that.$refs.tableIn.refresh();
that.$refs.tableOut.refresh();
//inout
});
});
},
table_out_check(row) {
this.dialog.check = true;
let obj = {};
Object.assign(obj, row);
obj.mgroup_name = this.mlogItem.mgroup_name;
this.$nextTick(() => {
this.$refs.checkDialog.open(obj);
});
},
//
mlogSubmit() {
let that = this;
that.$API.wpm.mlog.submit.req(that.mlogItem.id).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
});
},
//
getInit() {
let that = this;
that.$API.wf.workflow.initkey.req(" backfire").then((res) => {
that.initForm = res;
});
},
//退
createTicket(){
if(this.mlogItem.work_end_time==null){
this.$message.error("请先编辑日志并选择结束时间");
}else{
let sum = 0;
this.mlogItem.reminder_interval_list.forEach(item => {
sum+=item;
});
this.oinfo_json.退火时间 = sum;
this.oinfo_json.退火炉号 =this.mlogItem.equipment_name!==null?this.mlogItem.equipment_name.split("|")[0]:'';
this.ticketDialog = true;
}
},
//退,
submitTicketCreate(id) {
let that = this;
let obj = {};
obj.oinfo_json = that.oinfo_json;
obj.test_file = that.test_file;
that.$API.wpm.mlog.change.req(that.mlogItem.id, obj).then((res) => {
let ticket = {};
that.isSaveing = true;
ticket.title = '退火放行审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: that.mlogItem.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaveing = false;
that.ticketDialog = false;
that.visible = false;
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
});
});
},
handleSaveSuccess() {
this.$refs.tableIn.refresh();
this.$refs.tableOut.refresh();
},
handleCheckSuccess() {
this.$refs.tableOut.refresh();
},
fileUPSuccess(res) {
let that = this;
console.log('res',res);
this.test_file = res.path;
},
//
handleEditSuccess() {
this.getMlogItem();
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
handlePrint(){
let that = this;
that.printVisible = true;
},
//
printMaterial(row){
let that = this;
that.wmId = row.id;
that.wmtype = row.material_.type;
that.dialog.print_m = true;
this.$nextTick(() => {
this.$refs.printmaterial.open();
})
},
},
};
</script>
<style></style>

View File

@ -0,0 +1,425 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-position="right"
label-width="80px"
style="padding: 0 10px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="生产类型" prop="mtype">
<el-select
v-model="form.mtype"
placeholder="生产类型"
clearable
:disabled="mode == 'edit'"
style="width: 100%"
>
<el-option
v-for="item in typeOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.mtype == 20">
<el-form-item
label="外协单位"
prop="supplier"
v-if="form.mtype == 20"
>
<el-select
v-model="form.supplier"
placeholder="外协单位"
clearable
:disabled="mode == 'edit'"
style="width: 100%"
>
<el-option
v-for="item in supplierOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="工艺路线" prop="route">
<el-select
v-model="form.route"
placeholder="工艺路线"
clearable
filterable
style="width: 100%"
:disabled="mode == 'edit'"
>
<el-option
v-for="item in routeOptions"
:key="item.id"
:label="item.routepack_name"
:value="item.id"
>
<span
>{{ item.routepack_name }}-{{
item.process_name
}}</span
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="生产设备">
<el-select
v-model="form.equipment"
placeholder="生产设备"
clearable
filterable
:disabled="mode == 'edit'"
style="width: 100%"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.label"
:value="item.id"
>
<span style="float:left">{{item.name}}</span>
<span style="float:right">{{item.number}}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mgroup_name=='磨抛一次抛'">
<el-form-item label="批次序号">
<el-input-number
v-model="form.index"
:min="0"
:max="99"
placeholder="第几炉,追加到批次"
style="width: 100%"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="开始时间"
prop="work_start_time"
>
<el-date-picker
:disabled="mode == 'edit'"
v-model="form.work_start_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="结束时间" prop="work_end_time">
<el-date-picker
v-model="form.work_end_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
:disabledDate="disabledDateFn"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mgroup_name=='黑化'||mgroup_name=='退火'">
<el-form-item label="保温时间" required>
<el-input-number
v-model="form.reminder_interval_list[0]"
:min="0"
controls-position="right"
/>(min)
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mgroup_name=='黑化'||mgroup_name=='退火'">
<el-form-item label="冷却时间" required>
<el-input-number
v-model="form.reminder_interval_list[1]"
:min="0"
controls-position="right"
/>(min)
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="操作人">
<ehsSelect
v-model="form.handle_user"
:showName="form.handle_user_name"
:apiObj="this.$API.system.user.list"
:params="{ depts: dept }"
></ehsSelect>
</el-form-item>
</el-col>
<!-- 黑化 -->
<el-col :md="12" :sm="24" v-if="mgroup_name=='黑化'">
<el-form-item label="检验文件">
<sc-upload-file
v-model="fileList"
:multiple="false"
:limit="1"
:accept="['.xlsx', '.xls']"
@success = "fileUPSuccess"
>
<el-button type="primary" icon="el-icon-upload"> </el-button>
</sc-upload-file>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="备注">
<el-input
v-model="form.note"
clearable
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
const defaultForm = {
mtype: "",
supplier:'',
route: "",
equipment: "",
handle_user: null,
work_start_time: "",
work_end_time:null,
note:'',
mgroup:'',
reminder_interval_list: [0,0],
};
export default {
props: {
process: {
type: String,
default: "",
},
mgroup_name:{
type: String,
default: "",
},
mgroup: {
type: String,
default: "",
},
dept: {
type: String,
default: "",
},
},
computed: {
title() {
return this.titleMap[this.mode];
},
},
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增日志",
edit: "编辑日志",
show: "查看日志",
},
test_file:'',
fileList:[],
//
form: Object.assign({}, defaultForm),
//
rules: {
supplier: [
{
required: true,
message: "请选择供应商",
trigger: "blur",
},
],
work_start_time: [
{
required: true,
message: "请选择生产开始时间",
trigger: "blur",
},
],
route: [
{
required: true,
message: "请选择工艺路线",
trigger: "blur",
},
],
mtype: [
{
required: true,
message: "请选择生产类型",
trigger: "blur",
},
],
},
typeOptions: [
{ id: 10, name: "自产" },
{ id: 20, name: "外协" },
],
visible: false,
isSaveing: false,
options: [],
routeOptions: [],
userOptions: [],
supplierOptions: [],
setFiltersVisible: false,
};
},
mounted() {
this.getRoute();
this.getUser();
this.getSupplier();
this.getEquipment();
console.log("this.mgroup",this.mgroup);
console.log("this.mgroup_name",this.mgroup_name);
console.log("this.dept",this.dept);
console.log("this.process",this.process);
},
methods: {
disabledDateFn(time) {
return time.getTime() > new Date().getTime();
},
//
getUser() {
this.$API.system.user.list.req({ depts: this.dept }).then((res) => {
this.userOptions = res.results;
});
},
getEquipment() {
let that = this;
this.$API.em.equipment.list.req({ page: 0, type: 10,mgroup:that.mgroup}).then((res) => {
res.forEach((item) => {
let obj = {};
Object.assign(obj, item);
obj.label = item.name+'-'+item.number;
that.options.push(obj);
});
});
},
getSupplier() {
let that = this;
let obj = {};
obj.page = 0;
obj.can_outsource = true;
that.$API.pum.supplier.list.req(obj).then((res) => {
that.supplierOptions = res;
});
},
getRoute(id) {
let that = this;
that.$API.mtm.route.list
.req({ process: that.process, page: 0, routepack__state: 30 })
.then((res) => {
that.routeOptions = res;
});
},
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
setData(data) {
console.log("data", data);
Object.assign(this.form, data);
if(data.test_file!==null){
this.form.test_file = data.test_file;
this.fileList = [{name:data.test_file,url:data.test_file}];
}
this.getRoute(data.id);
},
fileUPSuccess(res) {
let that = this;
console.log('res',res);
this.test_file = res.path;
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
that.form.mgroup = that.mgroup;
if (that.mode === "add") {
that.$API.wpm.mlog.init.req(that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch(()=>{
that.isSaveing = false;
});
} else {
let obj = {};
obj.work_end_time = that.form.work_end_time;
obj.handle_user = that.form.handle_user;
obj.note = that.form.note;
if(that.mgroup_name=='黑化'){
that.form.test_file = that.test_file;
}
that.$API.wpm.mlog.change.req(that.form.id, that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch(()=>{
that.isSaveing = false;
});
}
}
});
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style>
.form_unit {
position: absolute;
right: -25px;
}
</style>

View File

@ -0,0 +1,445 @@
<template>
<el-dialog
title="过程检验"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-position="right"
label-width="100px"
style="padding: 0 10px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="批次号" prop="batch">
<el-input
v-model="form.batch"
:disabled="batchDisabled"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="实际生产数">
<el-input-number
v-model="form.count_real"
:min="0"
class="width-100"
controls-position="right"
@change="countChanges"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="合格数量">
<el-input-number
v-model="form.count_ok"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="不合格数量">
<el-input-number
v-model="form.count_notok"
:min="0"
class="width-100"
@change="countChanges"
controls-position="right"
/>
</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-col :span="24">
<el-form-item label="不合格统计">
<el-button
type="primary"
icon="el-icon-plus"
@click="notok_add"
></el-button>
</el-form-item>
</el-col>
</el-row>
<template v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-row style="margin-bottom:10px" v-for="(item, $index) in count_notok_json" :key="item">
<el-col :span="7">
<el-input-number
style="width:90%"
v-model="item.floor"
:min="0"
class="width-100"
placeholder="层数"
controls-position="right"
/>
</el-col>
<el-col :span="7">
<el-input-number
style="width:90%"
v-model="item.count_sampling"
:min="0"
class="width-100"
placeholder="抽检数"
controls-position="right"
/>
</el-col>
<el-col :span="7">
<el-input-number
style="width:90%"
v-model="item.count"
:min="0"
class="width-100"
placeholder="总数"
controls-position="right"
/>
</el-col>
<el-col :span="2">
<el-button
type="danger"
icon="el-icon-delete"
@click="notok_del( $index)"
></el-button>
</el-col>
</el-row>
</template>
<el-row v-else>
<el-col :md="12" :sm="24">
<el-form-item label="划伤">
<el-input-number
v-model="form.count_n_hs"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="气泡">
<el-input-number
v-model="form.count_n_qp"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="水纹">
<el-input-number
v-model="form.count_n_swen"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="崩边">
<el-input-number
v-model="form.count_n_bb"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="雾面">
<el-input-number
v-model="form.count_n_wm"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="小崩边">
<el-input-number
v-model="form.count_n_xbb"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="麻点">
<el-input-number
v-model="form.count_n_md"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="线痕">
<el-input-number
v-model="form.count_n_xh"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="破损">
<el-input-number
v-model="form.count_n_ps"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<!-- <el-col :md="12" :sm="24">
<el-form-item label="棕圈">
<el-input-number
v-model="form.count_n_zq"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col> -->
<el-col :md="12" :sm="24">
<el-form-item label="其他">
<el-input-number
v-model="form.count_n_qt"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>
<el-col :span="24">
<el-form-item label="前道不良">
<el-button
type="primary"
icon="el-icon-plus"
@click="notok_add"
></el-button>
</el-form-item>
</el-col>
</el-row>
<el-row style="margin-bottom:10px" v-for="(item, $index) in notokList" :key="item">
<el-col :span="10">
<el-select v-model="item.file"
style="width:90%"
placeholder="请选择不合格项">
<el-option
v-for="notok in notokOptions"
:key="notok.value"
:label="notok.name"
:value="notok.value"
>
</el-option>
</el-select>
</el-col>
<el-col :span="12">
<el-input-number
style="width:90%"
v-model="item.value"
:min="0"
class="width-100"
controls-position="right"
@change="countChange"
/>
</el-col>
<el-col :span="2">
<el-button
type="danger"
icon="el-icon-delete"
@click="notok_del( $index)"
></el-button>
</el-col>
</el-row> -->
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
data() {
return {
loading: false,
//
form: {
batch: null,
count_real: 0,
count_ok: 0,
count_notok: 0,
count_n_hs: 0,
count_n_qp: 0,
count_n_swen: 0,
count_n_bb: 0,
count_n_xbb:0,
count_n_md: 0,
count_n_xh: 0,
count_n_ps: 0,
count_n_qt: 0,
count_n_wm: 0,
count_n_zq:0
},
notokOptions:[
{name:"划伤",value:'count_n_hs'},
{name:"气泡",value:'count_n_qp'},
{name:"水纹",value:'count_n_swen'},
{name:"崩边",value:'count_n_bb'},
{name:"小崩边",value:'count_n_xbb'},
{name:"麻点",value:'count_n_md'},
{name:"划伤",value:'count_n_xh'},
{name:"破损",value:'count_n_ps'},
{name:"其他",value:'count_n_qt'},
{name:"雾面",value:'count_n_wm'},
{name:"棕圈",value:'count_n_zq'},
],
//
rules: {
batch: [
{
required: true,
message: "请填写批次号",
trigger: "blur",
},
],
count_use: [
{
required: true,
message: "请填写领用数量",
trigger: "blur",
},
],
},
options: [],
count_notok_json:[],
materialOptions: [],
visible: false,
isSaveing: false,
batchDisabled: false,
};
},
mounted() {
if (this.form.batch != null) {
this.batchDisabled = true;
}
},
methods: {
open(data) {
this.visible = true;
Object.assign(this.form, data);
this.mgroupName = data.mgroup_name;
console.log(this.form);
},
notok_add(){
this.count_notok_json.push({notok:'qt',count:null,floor:null,count_sampling:null});
},
notok_del(index){
this.count_notok_json.splice(index, 1)
},
countChange() {
this.form.count_notok =
this.form.count_n_hs +
this.form.count_n_qp +
this.form.count_n_swen +
this.form.count_n_bb +
this.form.count_n_xbb +
this.form.count_n_md +
this.form.count_n_xh +
this.form.count_n_ps +
this.form.count_n_zq +
this.form.count_n_qt +
this.form.count_n_wm;
this.form.count_ok = this.form.count_real - this.form.count_notok;
},
countChanges(){
this.form.count_ok = this.form.count_real - this.form.count_notok;
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
that.form.mlog = that.mlog;
let sum = 0;
if(that.mgroupName=='黑化'||that.mgroupName=='退火'){
let total = 0;
that.count_notok_json.forEach(item => {
total+=item.count;
});
this.form.count_notok = total;
this.form.count_notok_json = this.count_notok_json;
}else{
this.form.count_notok =
this.form.count_n_hs +
this.form.count_n_qp +
this.form.count_n_swen +
this.form.count_n_bb +
this.form.count_n_xbb +
this.form.count_n_md +
this.form.count_n_xh +
this.form.count_n_ps +
this.form.count_n_zq +
this.form.count_n_qt +
this.form.count_n_wm;
}
sum = this.form.count_ok + this.form.count_notok;
if (sum - this.form.count_real == 0) {
that.$API.wpm.mlogb.updateOut
.req(that.form.id, that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
})
.catch((err) => {
that.isSaveing = false;
});
} else {
this.$message.error("使用数量与合格数不合格数数量不对等");
}
}
});
},
},
};
</script>
<style scoped>
.width-100 {
width: 100%;
}
</style>

View File

@ -0,0 +1,201 @@
<template>
<el-dialog
title="添加日志详情"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-position="right"
label-width="80px"
style="padding: 0 10px"
>
<el-form-item label="关联任务">
<el-select
v-model="form.mtask"
placeholder="关联任务"
clearable
style="width: 100%"
@change="getMaterial"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.number"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="批次号" prop="wm_in">
<el-select
v-model="form.wm_in"
placeholder="交接物料"
clearable
style="width: 100%"
>
<el-option
v-for="item in materialOptions"
:key="item.id"
:label="item.batch"
:value="item.id"
>
<div
style="
display: flex;
justify-content: space-between;
"
>
<span>{{ item.batch }}</span
><span>{{ item.count }}</span>
</div>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="领用数量">
<el-input-number
v-model="form.count_use"
:min="1"
controls-position="right"
/>
</el-form-item>
<el-form-item label="所在层数">
<el-input v-model="form.note"/>
</el-form-item>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
const defaultForm = {
mlog: "",
mtask: "",
batch: "",
count_use: "",
};
export default {
props: {
mlog: {
type: String,
default: "",
},
mgroup: {
type: String,
default: "",
},
materialIn: {
type: String,
default: "",
},
},
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增",
edit: "编辑",
},
//
form: defaultForm,
//
rules: {
wm_in: [
{
required: true,
message: "请填写批次号",
trigger: "blur",
},
],
count_use: [
{
required: true,
message: "请填写领用数量",
trigger: "blur",
},
],
},
options: [],
materialOptions: [],
visible: false,
isSaveing: false,
setFiltersVisible: false,
};
},
mounted() {
this.getMtask();
this.getMaterial();
},
methods: {
open() {
this.visible = true;
},
getMtask() {
let that = this;
this.$API.pm.mtask.list
.req({ page: 0, mgroup: that.mgroup, state: 20 })
.then((res) => {
that.options = res;
});
},
//
getMaterial() {
let that = this;
this.$API.wpm.wmaterial.list
.req({
mtaskx: that.form.mtask,
mgroupx: that.mgroup,
material: that.materialIn,
page: 0,
})
.then((res) => {
that.materialOptions = res;
});
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
that.form.mlog = that.mlog;
that.$API.wpm.mlogb.in
.req(that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
})
.catch((err) => {
that.isSaveing = false;
});
}
});
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

386
src/views/wpm_bx/mlogs.vue Normal file
View File

@ -0,0 +1,386 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button
type="primary"
icon="el-icon-plus"
@click="table_add"
v-auth="'mlog.create'"
>新增</el-button
>
</div>
<div class="right-panel">
<el-input
style="margin-right: 5px"
v-model="query.search"
placeholder="名称"
clearable
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main>
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params"
:query="params"
@row-click="table_detail"
>
<el-table-column
label="#"
type="index"
width="50"
></el-table-column>
<el-table-column
label="工艺路线"
prop="material_out_name"
min-width="130"
>
</el-table-column>
<el-table-column
label="预计工时"
prop="hour_work"
width="80"
></el-table-column>
<el-table-column
label="生产设备"
prop="equipment_name"
min-width="150"
></el-table-column>
<el-table-column label="进度" prop="belong_dept_name" v-if="mgroup_name=='黑化'||mgroup_name=='退火'">
<template #default="scope">
<el-progress id="progressbwlq" :percentage="customMethod(scope.row,1)" :stroke-width="20" :color="customMethod(scope.row,2)" :text-inside="true"><span>{{customMethod(scope.row,3)}}</span></el-progress>
</template>
</el-table-column>
<el-table-column
label="部门/工段"
prop="belong_dept_name"
>
<template #default="scope">
{{scope.row.belong_dept_name}}/{{scope.row.mgroup_name}}
</template>
</el-table-column>
<el-table-column
label="处理人"
prop="handle_user_name"
width="80"
></el-table-column>
<el-table-column label="保温剩余时间" v-if="mgroup_name=='黑化'||mgroup_name=='退火'">
<template #default="scope">
{{ getRemaTime(scope.row) }}
</template>
</el-table-column>
<el-table-column
label="开始时间"
prop="work_start_time"
></el-table-column>
<el-table-column
label="结束时间"
prop="work_end_time"
></el-table-column>
<el-table-column label="是否提交">
<template #default="scope">
<el-icon v-if="scope.row.submit_time != null" color="green">
<CircleCheckFilled />
</el-icon>
</template>
</el-table-column>
<el-table-column
label="提交时间"
prop="submit_time"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="150"
>
<template #default="scope">
<!-- <el-button
link
size="small"
v-auth="'mlog.update'"
v-if="scope.row.submit_time == null"
type="primary"
@click.stop="table_edit(scope.row)"
>编辑</el-button
> -->
<el-button
link
size="small"
@click="table_detail(scope.row)"
type="primary"
>详情</el-button
>
<el-button
link
size="small"
v-auth="'mlog.delete'"
type="danger"
v-if="scope.row.submit_time == null"
@click.stop="table_del(scope.row, scope.$index)"
>删除</el-button
>
<el-button
link
v-else
size="small"
type="danger"
@click.stop="mlogRevert(scope.row)"
>撤回</el-button
>
</template>
</el-table-column>
</scTable>
</el-main>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:process="processId"
:mgroup="mgroupId"
:dept="deptId"
:mgroup_name = "mgroup_name"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
<detail-drawer
v-if="dialog.detail"
ref="detailDialog"
:mlogId="mlogId"
:mtask="mtask"
@closed="detailClose"
>
</detail-drawer>
</el-container>
</template>
<script>
import saveDialog from "./mlog_form.vue";
import detailDrawer from "./mlog_detail.vue";
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
name: "mlog",
components: {
saveDialog,
detailDrawer,
},
data() {
return {
apiObj: null,
params: { mgroup: "" },
query: {},
dialog: {
save: false,
detail: false,
},
tableData: [],
selection: [],
mtask: "",
mlogId: "",
deptId: null,
processId: "",
processCate: "",
mgroup_name:''
};
},
watch: {
mgroupName: {
handler: function (newval,odlval) {
let that = this;
that.params.mgroup = "";
that.apiObj = null;
that.mgroup_name = newval;
console.log("mgroup_name",this.mgroup_name);
console.log("newval",newval);
console.log("odlval",odlval);
that.getMgroupInfo();
},
},
},
mounted() {
this.mgroup_name = this.mgroupName;
this.getMgroupInfo();
console.log("mgroupName",this.mgroupName);
},
methods: {
getMgroupInfo(){
let that = this;
that.$API.mtm.mgroup.list.req({ page: 0, name: that.mgroup_name }).then((res) => {
if (res.length < 1) {
that.$message.error("获取工段错误");
return;
}
that.mgroupId = res[1].id;
that.deptId = res[1].belong_dept;
that.processId = res[1].process;
that.processCate = res[1].process_cate;
that.params.mgroup = res[1].id;
that.apiObj = that.$API.wpm.mlog.list;
that.$refs.table.refresh();
});
},
getRemaTime(row){
if(row.work_start_time !== null){
let times = 0;
let nowTime = new Date().getTime();
let startTiem = new Date(row.work_start_time).getTime();
console.log('nowTime',nowTime)
console.log('startTiem',startTiem)
let remaTime = nowTime - startTiem;
console.log('remaTime',remaTime)
let temp = Math.floor(remaTime/1000*60);
console.log('temp',temp)
if(remaTime>0&&row.reminder_interval_list[0]){
if(temp<row.reminder_interval_list[0]){
times = row.reminder_interval_list[0]-temp;
}else{
return '/';
}
return times
}else{
return '/';
}
}
},
detailClose() {
this.dialog.detail = false;
this.$refs.table.refresh();
},
//
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
table_detail(row) {
this.mlogId = row.id;
this.dialog.detail = true;
this.$nextTick(() => {
this.$refs.detailDialog.open();
});
},
//
table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
var id = row.id;
this.$API.wpm.mlog.delete.req(id).then((res) => {
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
}
});
});
},
//
mlogRevert(row) {
this.$confirm(`确定撤回该日志吗?`, "提示", {
type: "warning",
}).then(() => {
var id = row.id;
this.$API.wpm.mlog.revert.req(id).then((res) => {
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("撤回成功");
}
});
});
},
customMethod(row,index){
let color = '',context = '';
let percent = 0;
if(row.reminder_interval_list.length>0){
let data = new Date();
//
let currentTime = data.getTime();
//
let startTime = new Date(row.work_start_time).getTime();
//
let endTime = new Date(row.work_end_time).getTime();
//
let times = (currentTime-startTime)/1000/60;
//
let sum = row.reminder_interval_list[0]+row.reminder_interval_list[1];
if(endTime!==0&&(currentTime>endTime)){
percent = 100;
color = row.mstate_json[1].color;
context = '已完成';
}else{
if(times>0){
percent = Math.round((times/sum)*100);
}else{
percent = 0;
}
if(times>0){
if(times>row.reminder_interval_list[0]){//
color = row.mstate_json[1].color;
context = row.mstate_json[1].name;
}else if(times>row.reminder_interval_list[1]){//
color = row.mstate_json[1].color;
context = '已完成';
}else{//
color = row.mstate_json[0].color;
context = row.mstate_json[0].name;
}
}else{
color = "#ffffff";
}
}
if(index==1){
return percent
}else if(index==2){
return color
}else{
return context
}
}
},
//
selectionChange(selection) {
this.selection = selection;
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.$refs.table.refresh();
},
},
};
</script>
<style scoped>
</style>

227
src/views/wpm_bx/mtask.vue Normal file
View File

@ -0,0 +1,227 @@
<template>
<el-container>
<el-main>
<scTable
ref="table"
:apiObj="apiObj"
:query="params"
row-key="id"
:params="params"
>
<el-table-column label="任务列表" type="index" width="80"></el-table-column>
<el-table-column label="产品名" prop="material_out_name" show-overflow-tooltip>
</el-table-column>
<el-table-column label="任务编号" prop="number" width="140" show-overflow-tooltip>
</el-table-column>
<el-table-column label="任务量" prop="count"> </el-table-column>
<el-table-column label="开始时间" prop="start_date">
</el-table-column>
<el-table-column label="结束时间" prop="end_date">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
<el-table-column label="分配人数" prop="mtaskb">
<template #default="scope">
<span v-if="scope.row.mtaskb.length>0">
{{scope.row.mtaskb.length}}
</span>
</template>
</el-table-column>
<el-table-column label="可用批" v-if="mgroup_name!='切片'">
<template #default="scope">
<el-button
link
size="small"
type="primary"
v-if="scope.row.state == 20"
@click="viewBatches(scope.row)">
查看
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="90">
<template #default="scope">
<el-button
link
size="small"
v-auth="'mtask.submit'"
type="primary"
v-if="scope.row.state == 20 "
@click="mtask_submit(scope.row)"
>提交
</el-button>
<el-button
link
size="small"
v-auth="'mtask.submit'"
type="primary"
v-if="scope.row.state == 20 "
@click="mtask_deliver(scope.row)"
>分配
</el-button>
</template>
</el-table-column>
</scTable>
</el-main>
<deliver-drawer
v-if="deliverShow"
ref="detailDialog"
:mgroup="mgroupId"
:dept="deptId"
@success = "refreshMtask"
@closed="detailClose"
>
</deliver-drawer>
<el-dialog v-model="dialogVisible">
<scTable hidePagination hideDo :apiObj="m_apiObj" :query="m_query" ref="mTable">
<el-table-column
label="物料名称"
prop="material_name"
min-width="150"
>
<template #default="scope">
{{ scope.row.material_name }}
<span v-if="scope.row.material_origin != null"
>{{ scope.row.material_origin_name }}</span
>
</template>
</el-table-column>
<el-table-column
label="批次号"
prop="batch"
min-width="120"
></el-table-column>
</scTable>
</el-dialog>
</el-container>
</template>
<script>
import deliverDrawer from "./mtask_deliver.vue";
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
components: {
deliverDrawer,
},
name: "mtask",
data() {
return {
dialogVisible: false,
m_apiObj: null,
m_query: null,
apiObj: null,
params: { mgroup: "",state:20 },
query: {},
tableData: [],
selection: [],
cates_: {
section: "工序",
other: "其他",
},
type_: {
10: "primary",
20: "primary",
30: "primary",
34: "danger",
40: "success",
},
// state_: {
// 10: "",
// 20: "",
// 30: "",
// 34: "",
// 40: "",
// },
deptId: null,
mgroup_name:'',
deliverShow:false,
};
},
watch: {
mgroupName: {
handler: function (newval,odlval) {
let that = this;
that.params.mgroup = "";
that.apiObj = null;
that.mgroup_name = newval;
that.getMgroupInfo();
},
},
},
mounted() {
this.getMgroupInfo();
},
methods: {
getMgroupInfo(){
let that = this;
that.$API.mtm.mgroup.list
.req({ page: 0, name: that.mgroup_name })
.then((res) => {
if(res.length>0){
that.mgroupId = res[0].id;
that.deptId = res[0].belong_dept;
that.processId = res[0].process;
that.processCate = res[0].process_cate;
that.params.mgroup = res[0].id;
that.apiObj = this.$API.pm.mtask.list;
that.$refs.table.refresh();
}else{
that.$message.error("获取工段错误");
return;
}
});
},
viewBatches(row){
this.dialogVisible = true;
this.$nextTick(() => {
this.m_query = {mtaskx: row.id};
this.m_apiObj = this.$API.wpm.wmaterial.list;
this.$refs.mTable.queryData(this.m_query);
});
},
elTagType(state) {
return this.type_[state];
},
mtask_submit(row){
this.$confirm('确定提交该任务吗?提交后不可更改相关信息', "提示", {
type: "warning",
}).then(() => {
this.$API.pm.mtask.submit.req(row.id).then((res) => {
this.$message.success("操作成功");
this.$refs.table.refresh();
this.mtaskClick(this.currentMtask);
}).catch((err) => {});
});
},
mtask_deliver(row){
this.deliverShow = true;
this.$nextTick(() => {
this.$refs.detailDialog.open(row);
});
},
refreshMtask(){
this.$refs.table.refresh();
},
//
selectionChange(selection) {
this.selection = selection;
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.$refs.table.refresh();
},
},
};
</script>
<style scoped></style>

View File

@ -0,0 +1,213 @@
<template>
<el-drawer
title="任务分配"
v-model="visible"
:size="'90%'"
destroy-on-close
@closed="$emit('closed')"
>
<div>
<el-button type="primary" @click="handlePrint" style="position: absolute;right: 20px;">打印</el-button>
<el-card style="width: 100%" header="基本信息" shadow="never">
<el-descriptions>
<el-descriptions-item label="名称">{{
mtaskObj.material_out_name
}}</el-descriptions-item>
<el-descriptions-item label="任务编号">{{
mtaskObj.number
}}</el-descriptions-item>
<el-descriptions-item label="任务量">{{
mtaskObj.count
}}</el-descriptions-item>
<el-descriptions-item label="开始时间">{{
mtaskObj.start_date
}}</el-descriptions-item>
<el-descriptions-item label="结束时间">{{
mtaskObj.end_date
}}</el-descriptions-item>
</el-descriptions>
</el-card>
<!-- 选择人员 -->
<el-form
:model="form"
:rules="rules"
label-width="100px"
ref="form"
style="margin-top: 10px;margin-bottom:50px"
>
<el-row>
<el-col :span="24">
<el-form-item label="操作人员">
<el-checkbox-group
v-model="choose_user"
@change="userChange"
>
<el-checkbox class="checkboxItem" v-for="item in userList" :key="item.id" :label="item.name" :value="item.id">
{{ item.name }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-col>
</el-row>
<el-divider style="margin-top:0"></el-divider>
<el-row>
<el-col :md="6" :sm="8" v-for="item in cUserList" :key="item.id">
<el-form-item :label="item.handle_user_name">
<el-input-number
v-model="item.count"
:precision="0"
:min="1"
style="width: 90%"
controls-position="right"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="footer">
<el-button type="primary" @click="mtaskb_submit">提交</el-button>
</div>
</div>
<el-dialog v-model="printVisible" width="1200px">
<print :baseData="mtaskObj" type="mtask" @closePrint="printVisible=false"/>
</el-dialog>
</el-drawer>
</template>
<script>
import print from "./../setting/print/A4.vue";
export default {
components: { print },
props: {
mgroup: {
type: String,
default: "",
},
dept: {
type: String,
default: "",
},
},
emits: ["success", "closed"],
data() {
return {
form: {},
apiObj: null,
loading: false,
visible: false,
isSaveing: false,
printVisible:false,
mtaskObj:{},
userList:[],
cUserList:[],//
choose_user:[],//id
rules: {
count_use: [
{
required: true,
message: "请输入领取数量",
trigger: "blur",
},
],
},
};
},
mounted() {
this.$nextTick(() => {
this.getUsers();
})
},
methods: {
open(data) {
let that = this;
this.visible = true;
this.mtaskObj = data;
that.cUserList = data.mtaskb;
that.choose_user = [];
if(that.cUserList.length>0){
that.cUserList.forEach(item=>{
that.choose_user.push(item.handle_user);
})
}
},
getUsers() {
let that = this;
that.$API.system.user.list.req({ belong_dept: that.dept, page: 0 }).then(res => {
// that.$API.system.user.list.req({ page:1,page_size:60}).then(res => {
that.userList = res;
})
},
userChange(){
let that = this;
let average = Math.floor( that.mtaskObj.count/that.choose_user.length);
let remainder = that.mtaskObj.count%that.choose_user.length;//
that.cUserList = [];
console.log('that.choose_user',that.choose_user);
that.userList.forEach(item=>{
if(that.choose_user.indexOf(item.id)>-1){
let obj = {};
obj.handle_user_name = item.name;
obj.handle_user = item.id;
obj.count = average;
that.cUserList.push(obj);
}
})
console.log('that.cUserList',that.cUserList);
for(let i=0;i<remainder;i++){
that.cUserList[i].count += 1;
}
},
mtaskb_submit() {
let that = this;
console.log(that.cUserList);
let sum = 0;
that.cUserList.forEach(item => {
sum+=item.count;
});
console.log(sum-that.mtaskObj.count)
if(sum-that.mtaskObj.count==0){
that.isSaveing = true;
that.$API.pm.mtaskbAdd.req(that.mtaskObj.id,that.cUserList).then((res) => {
that.isSaveing = false;
that.visible = false;
this.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
});
}else{
that.$message.error("分配数量与任务总数不匹配,请确认后再提交");
}
},
handleEditSuccess() {},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
//
handlePrint(){
this.printVisible = true;
},
},
};
</script>
<style scoped>
.checkboxItem{
width:80px;
}
.footer{
position: absolute;
bottom: 0px;
width: 100%;
z-index: 10;
text-align: center;
background: #ffffff;
height: 40px;
}
</style>

140
src/views/wpm_bx/print.vue Normal file
View File

@ -0,0 +1,140 @@
<template>
<div>
<div id="pdfDom" class="container" ref="pdfContent">
<div class="title">
<span>光芯科技</span>
<span>交接单</span>
</div>
<canvas id="barcode"></canvas>
<p class="lineStyle">物料{{ name }}</p>
<p class="lineStyle">批次号{{ batch }}</p>
<p class="lineStyle">数量{{ count }}</p>
</div>
<el-button type="primary" @click="toGetPdf1">打印 </el-button>
</div>
</template>
<script>
import axios from "axios";
import config from "@/config";
import http from "@/utils/request";
import getPdf from "@/utils/htmlToPdf";
import PdfLoader from "@/utils/html2pdf";
import html2canvas from "html2canvas";
export default {
data() {
return {
material_name: "玻璃片",
batch: "20240723_001",
count: "1000",
date: "2023-01-01",
sender: "切片-石小静",
resave: "活化-白海军",
visible: false,
};
},
mounted() {
var canvas = document.getElementById("barcode");
var context = canvas.getContext("2d");
context.clearRect(0, 0, 210, 270);
JsBarcode("#barcode", "9780199532179", {
format: "CODE128",
displayValue: true,
fontSize: 24,
lineColor: "#000000",
});
},
methods: {
toGetPdf(val = false, download = false) {
let that = this;
this.$nextTick(() => {
setTimeout(() => {
let title = "交接单";
getPdf(title, download).then((res) => {
console.log("res", res);
// FormData
let formData = new FormData();
formData.append("file", res, "document.pdf"); // FormData
formData.append("printer_name", "GP-3150TN"); //
// POST
http.post("http://localhost:8080/prints/", formData)
.then((response) => {
console.log("postRes", response);
})
.catch((error) => {
console.error("postError", error);
});
});
}, 1000);
});
},
/* 将base64转换为文件,接收2个参数第一是base64第二个是文件名字 最后返回文件对象 */
dataURLtoFile(dataurl, filename) {
var arr = dataurl.split(","),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, { type: mime });
},
toGetPdf1() {
let str = [
"SIZE 70 mm,90 mm",
"GAP 2 mm,0 mm",
"CLS",
"WINTEXT 100,80,36,0,0,0,Simhei,光芯科技——交接单",
'BARCODE 100,140,"128",108,0,0,2,4,"' + this.batch + '"',
"WINTEXT 100,280,36,0,0,0,Simhei,物料:" + this.material_name,
"WINTEXT 100,340,36,0,0,0,Simhei,批次:" + this.batch,
"WINTEXT 100,400,36,0,0,0,Simhei,数量:" + this.count,
"WINTEXT 100,460,36,0,0,0,Simhei,日期:" + this.date,
"WINTEXT 100,520,36,0,0,0,Simhei,送料:" + this.sender,
"WINTEXT 100,580,36,0,0,0,Simhei,收料:" + this.resave,
"PRINT 1",
];
// -
// -
let obj = {};
obj.printer_commands = str;
obj.printer_name = "GP-3150TNS";
http.post("http://localhost:8080/prints/", obj)
// http.post("http://192.168.1.242:8080/prints/", obj)
.then((response) => {
console.log("postRes", response);
})
.catch((error) => {
console.error("postError", error);
});
},
},
};
</script>
<style scoped>
.container {
width: 210px;
height: 270px;
padding: 10px 5px;
border: 1px solid #dddddd;
background-color: #ffffff;
}
.title {
/* display: flex;
justify-content: space-between; */
font-size: 18px;
}
#barcode {
/* position: absolute; */
width: 200px;
height: 100px;
}
.lineStyle {
font-size: 14px;
margin-bottom: 5px;
}
</style>

View File

@ -51,7 +51,7 @@
controls-position="right"
v-model="form.count"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
@ -68,7 +68,7 @@
controls-position="right"
v-model="form.count_sampling"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
@ -80,7 +80,7 @@
v-model="form.count_sampling_ok"
style="width: 100%"
disabled
precision="0"
:precision="0"
></el-input-number>
</el-form-item>
</el-col>
@ -90,7 +90,7 @@
controls-position="right"
v-model="form.count_notok"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
@ -101,7 +101,7 @@
controls-position="right"
v-model="count_ok_rate"
style="width: 100%"
precision="0"
:precision="0"
></el-input-number>
</el-form-item>
</el-col>
@ -143,7 +143,7 @@
controls-position="right"
v-model="count_notok_json.count_n_hqnj"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -154,7 +154,7 @@
controls-position="right"
v-model="count_notok_json.count_n_hqnjyd"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -165,7 +165,7 @@
controls-position="right"
v-model="count_notok_json.count_n_hqwj"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -176,7 +176,7 @@
controls-position="right"
v-model="count_notok_json.count_n_hqwjyd"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -187,7 +187,7 @@
controls-position="right"
v-model="count_notok_json.count_n_wj"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -198,7 +198,7 @@
controls-position="right"
v-model="count_notok_json.count_n_yd"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -209,7 +209,7 @@
controls-position="right"
v-model="count_notok_json.count_n_txd"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -220,7 +220,7 @@
controls-position="right"
v-model="count_notok_json.count_n_hd"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -231,7 +231,7 @@
controls-position="right"
v-model="count_notok_json.count_n_zhg"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -242,7 +242,7 @@
controls-position="right"
v-model="count_notok_json.count_n_yz"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -256,7 +256,7 @@
controls-position="right"
v-model="count_notok_json.count_n_z"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -267,7 +267,7 @@
controls-position="right"
v-model="count_notok_json.count_n_qp"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -278,7 +278,7 @@
controls-position="right"
v-model="count_notok_json.count_n_swen"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -289,7 +289,7 @@
controls-position="right"
v-model="count_notok_json.count_n_bb"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -300,7 +300,7 @@
controls-position="right"
v-model="count_notok_json.count_n_zb"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -311,7 +311,7 @@
controls-position="right"
v-model="count_notok_json.count_n_zq"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -322,7 +322,7 @@
controls-position="right"
v-model="count_notok_json.count_n_hs"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -333,7 +333,7 @@
controls-position="right"
v-model="count_notok_json.count_n_md"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -344,7 +344,7 @@
controls-position="right"
v-model="count_notok_json.count_n_hqbx"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -355,7 +355,7 @@
controls-position="right"
v-model="count_notok_json.count_n_dj"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
@ -367,7 +367,7 @@
controls-position="right"
v-model="count_notok_json.count_n_ps"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -378,7 +378,7 @@
controls-position="right"
v-model="count_notok_json.count_n_lq"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -392,7 +392,7 @@
controls-position="right"
v-model="count_notok_json.count_n_hd"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -403,7 +403,7 @@
controls-position="right"
v-model="count_notok_json.count_n_wj"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -414,7 +414,7 @@
controls-position="right"
v-model="count_notok_json.count_n_yd"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -425,7 +425,7 @@
controls-position="right"
v-model="count_notok_json.count_n_txd"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -436,7 +436,7 @@
controls-position="right"
v-model="count_notok_json.count_n_qp"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -447,7 +447,7 @@
controls-position="right"
v-model="count_notok_json.count_n_swen"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -458,7 +458,7 @@
controls-position="right"
v-model="count_notok_json.count_n_bb"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -469,7 +469,7 @@
controls-position="right"
v-model="count_notok_json.count_n_xbb"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -480,7 +480,7 @@
controls-position="right"
v-model="count_notok_json.count_n_hs"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -491,7 +491,7 @@
controls-position="right"
v-model="count_notok_json.count_n_md"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -503,7 +503,7 @@
controls-position="right"
v-model="count_notok_json.count_n_ps"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -514,7 +514,7 @@
controls-position="right"
v-model="count_notok_json.count_n_qt"
style="width: 100%"
precision="0"
:precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -522,8 +522,23 @@
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
<el-footer v-if="mgroupName=='白片抛'">
<el-button
v-for="item in initForm.transitions"
:key="item.id"
type="primary"
:loading="isSaveing"
:disabled="isSaveing"
@click="submitTicketCreate(item.id)"
style="margin-right: 4px"
>{{ item.name }}</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
<el-footer v-else>
<el-button type="primary"
:loading="isSaveing"
@click="submit"
>提交</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
@ -559,7 +574,8 @@ export default {
batch: "",
count: null,
count_ok: 0,
count_sampling_ok:'',
count_sampling_ok:0,
count_sampling:0,
count_notok: 0,
count_notok_json:{}
},
@ -591,6 +607,7 @@ export default {
{name:'全检',value:20},
{name:'抽检',value:10},
],
initForm: {},
selectionFilters: [],
batchCount:null,
formCount:null,
@ -601,6 +618,7 @@ export default {
};
},
mounted() {
console.log('mgroupName',this.mgroupName);
this.batchCount = this.itemObj.count_cando;
this.form.batch = this.itemObj.batch;
this.form.wm = this.itemObj.id;
@ -608,6 +626,7 @@ export default {
this.form.supplier = this.itemObj.supplier;
this.deptID = this.$TOOL.data.get('gx_deptID');
this.getUsers();
this.getInit();
},
methods: {
//
@ -633,6 +652,14 @@ export default {
});
});
},
//
getInit() {
let that = this;
that.$API.wf.workflow.initkey.req("baipaopiantest").then((res) => {
that.initForm = res;
console.log('that.initForm',that.initForm);
});
},
handleCountChange(type){
this.form.count_notok =
this.count_notok_json.count_n_wj+
@ -664,11 +691,29 @@ export default {
let obj = {page: 0, count__gte: 0, count_xtest__gte: 0};
//
obj.mgroupx = that.mgroup;
that.$API.wpm.wmaterial.list
.req(obj)
.then((res) => {
that.options = res;
});
that.$API.wpm.wmaterial.list.req(obj).then((res) => {
that.options = res;
});
},
//,
submitTicketCreate(id) {
this.transition = id;
this.submit();
// let that = this;
// let ticket = {};
// that.isSaveing = true;
// ticket.title = '';
// ticket.workflow = that.initForm.workflow;
// ticket.ticket_data = {t_id: that.mlogItem.id};
// ticket.transition = id;
// that.$API.wf.ticket.create.req(ticket).then((res) => {
// that.isSaveing = false;
// that.ticketDialog = false;
// that.visible = false;
// that.$message.success("");
// }).catch((e) => {
// that.isSaveing = false;
// });
},
//
submit() {
@ -707,15 +752,30 @@ export default {
}
that.form.count_notok_json = that.count_notok_json;
console.log('that.form',that.form)
that.$API.qm.ftestwork.create.req(that.form)
.then((res) => {
that.$API.qm.ftestwork.submit.req(res.id)
.then((res) => {
that.$API.qm.ftestwork.create.req(that.form).then((res) => {
if(that.mgroupName=='白片抛'){
let ticket = {};
that.isSaveing = true;
ticket.title = '白片抛抽检审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = that.transition;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaveing = false;
that.ticketDialog = false;
that.visible = false;
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
});
}else{
that.$API.qm.ftestwork.submit.req(res.id).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("操作成功");
})
}
}).catch( err=>{
//
that.isSaveing = false;

View File

@ -14,7 +14,7 @@
icon="el-icon-plus"
@click="table_add(20)"
v-auth="'handover.create'"
v-if="mgroup_name!=='切片'&&mgroup_name!=='拉单丝'&&mgroup_name!=='一次复丝'&&mgroup_name!=='二次复丝'&&mgroup_name!=='切丝排版'"
v-if="mgroupName!=='切片'"
>返工</el-button
>
<el-button
@ -27,7 +27,7 @@
icon="el-icon-plus"
@click="table_add(30)"
v-auth="'handover.create'"
v-if="mgroup_name=='一次超洗'||mgroup_name=='二次超洗'"
v-if="mgroupName=='一次超洗'||mgroupName=='二次超洗'"
>检验</el-button
>
</div>
@ -104,7 +104,7 @@
</el-table-column>
<el-table-column label="数量" prop="count" width="80"></el-table-column>
<el-table-column label="交接类型" prop="type" width="100">
<template #default="scope" v-if="mgroup_name=='size'||mgroup_name=='facade'">
<template #default="scope" v-if="mgroupName=='size'||mgroupName=='facade'">
<el-text v-if="scope.row.send_dept == deptId" type="primary">交送</el-text>
<el-text v-if="scope.row.recive_dept == deptId" type="success">接收</el-text>
</template>
@ -211,7 +211,7 @@
v-if="dialog.save"
ref="saveDialog"
:type="type"
:mgroupName="mgroup_name"
:mgroupName="mgroupName"
:mgroupId="mgroupId"
@success="handleSaveSuccess"
@closed="dialog.save = false"
@ -279,29 +279,15 @@ export default {
printer_name: "",
printVisible:false,
setNameVisible: false,
mgroup_name:'',
};
},
watch: {
mgroupName: {
handler: function (newval,odlval) {
let that = this;
that.params.dept = "";
that.params.mgroup = "";
that.apiObj = null;
that.mgroup_name = newval;
that.getMgroupInfo();
},
},
},
mounted() {
// this.getMgroupInfo();
this.getMgroupInfo();
},
methods: {
getMgroupInfo(){
let that = this;
console.log('that.mgroup_name',that.mgroup_name);
if(that.mgroup_name=="size"){//
if(that.mgroupName=="size"){//
// that.params.material__process__name="";
that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => {
if(res.length>0){
@ -311,7 +297,7 @@ export default {
that.apiObj = that.$API.wpm.handover.list;
that.$refs.table.refresh();
})
}else if(that.mgroup_name=="facade"){//
}else if(that.mgroupName=="facade"){//
// that.params.material__process__name="";
that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => {
if(res.length>0){
@ -324,7 +310,7 @@ export default {
}else{//
that.printer_name = localStorage.getItem("printer_name");
that.$API.mtm.mgroup.list
.req({ page: 0, name: that.mgroup_name })
.req({ page: 0, name: that.mgroupName })
.then((res) => {
if (res.length < 1) {
that.$message.error("获取工段错误");
@ -388,7 +374,7 @@ export default {
searchTypeQuery() {
let that = this;
if (that.searchType == "send") {
if(that.mgroup_name=="size"||that.mgroup_name=="facade"){
if(that.mgroupName=="size"||that.mgroupName=="facade"){
that.query.send_dept = that.deptId;
that.query.recive_dept = "";
}else{
@ -396,7 +382,7 @@ export default {
that.query.recive_mgroup = "";
}
} else if (that.searchType == "recive") {
if(that.mgroup_name=="size"||that.mgroup_name=="facade"){
if(that.mgroupName=="size"||that.mgroupName=="facade"){
that.query.send_dept = "";
that.query.recive_dept =that.deptId;
}else{

View File

@ -139,7 +139,7 @@
v-if="dialog.save"
ref="saveDialog"
:mgroup="mgroupId"
:mgroupName="mgroup_name"
:mgroupName="mgroupName"
:itemObj = "checkItem"
@success="handleSaveSuccess"
@closed="dialog.save = false"
@ -149,7 +149,7 @@
v-if="dialog.scrap"
ref="scrapDialog"
:type="type"
:mgroupName="mgroup_name"
:mgroupName="mgroupName"
:mgroupId="mgroupId"
@success="handleScrapSuccess"
@closed="dialog.scrap = false"
@ -245,20 +245,10 @@ export default {
visibleDrawer: false,
apiObjPrint:this.$API.cm.labelmat.fromWm,
wmId:'',
mgroup_name:''
};
},
mounted() {},
watch: {
mgroupName: {
handler: function (newval,odlval) {
let that = this;
that.params.mgroupx = "";
that.apiObj = null;
that.mgroup_name = newval;
that.getMgroupInfo();
},
},
mounted() {
this.getMgroupInfo();
},
methods: {
getMgroupInfo(){

View File

@ -216,6 +216,7 @@ const defaultForm = {
work_start_time: "",
work_end_time:null,
note:'',
mgroup:'',
reminder_interval_list: [0,0],
};

View File

@ -54,7 +54,7 @@
prop="equipment_name"
min-width="150"
></el-table-column>
<el-table-column label="进度" prop="belong_dept_name" v-if="mgroup_name=='黑化'||mgroup_name=='退火'">
<el-table-column label="进度" prop="belong_dept_name" v-if="mgroupName=='黑化'||mgroupName=='退火'">
<template #default="scope">
<el-progress id="progressbwlq" :percentage="customMethod(scope.row,1)" :stroke-width="20" :color="customMethod(scope.row,2)" :text-inside="true"><span>{{customMethod(scope.row,3)}}</span></el-progress>
</template>
@ -72,7 +72,7 @@
prop="handle_user_name"
width="80"
></el-table-column>
<el-table-column label="保温剩余时间" v-if="mgroup_name=='黑化'||mgroup_name=='退火'">
<el-table-column label="保温剩余时间" v-if="mgroupName=='黑化'||mgroupName=='退火'">
<template #default="scope">
{{ getRemaTime(scope.row) }}
</template>
@ -146,7 +146,7 @@
:process="processId"
:mgroup="mgroupId"
:dept="deptId"
:mgroup_name = "mgroup_name"
:mgroupName = "mgroupName"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
@ -193,27 +193,15 @@ export default {
deptId: null,
processId: "",
processCate: "",
mgroup_name:''
};
},
watch: {
mgroupName: {
handler: function (newval,odlval) {
let that = this;
that.params.mgroup = "";
that.apiObj = null;
that.mgroup_name = newval;
that.getMgroupInfo();
},
},
},
mounted() {
// this.getMgroupInfo();
this.getMgroupInfo();
},
methods: {
getMgroupInfo(){
let that = this;
that.$API.mtm.mgroup.list.req({ page: 0, name: that.mgroup_name }).then((res) => {
that.$API.mtm.mgroup.list.req({ page: 0, name: that.mgroupName }).then((res) => {
if (res.length < 1) {
that.$message.error("获取工段错误");
return;

View File

@ -27,7 +27,7 @@
</span>
</template>
</el-table-column>
<el-table-column label="可用批" v-if="mgroup_name!='切片'">
<el-table-column label="可用批" v-if="mgroupName!='切片'">
<template #default="scope">
<el-button
link
@ -138,21 +138,9 @@ export default {
// 40: "",
// },
deptId: null,
mgroup_name:'',
deliverShow:false,
};
},
watch: {
mgroupName: {
handler: function (newval,odlval) {
let that = this;
that.params.mgroup = "";
that.apiObj = null;
that.mgroup_name = newval;
that.getMgroupInfo();
},
},
},
mounted() {
this.getMgroupInfo();
},
@ -160,7 +148,7 @@ export default {
getMgroupInfo(){
let that = this;
that.$API.mtm.mgroup.list
.req({ page: 0, name: that.mgroup_name })
.req({ page: 0, name: that.mgroupName })
.then((res) => {
if(res.length>0){
that.mgroupId = res[0].id;