This commit is contained in:
caoqianming 2025-02-05 15:50:22 +08:00
commit 9a7dea317b
28 changed files with 1307 additions and 806 deletions

View File

@ -34,6 +34,7 @@
"html2canvas": "^1.4.1",
"json-editor-vue3": "^1.0.6",
"jspdf": "^2.5.1",
"moment": "^2.30.1",
"node-polyfill-webpack-plugin": "^4.0.0",
"nprogress": "0.2.0",
"print-js": "^1.6.0",

View File

@ -130,7 +130,9 @@ export default {
font-weight: bold;
color: #008000;
}
#mlogbwList .el-table--default .cell{
padding: 0 5px !important;
}
#table1.el-table,
#table1.el-table tr,
#table1.el-table .el-table__body-wrapper,

View File

@ -26,6 +26,13 @@ export default {
return await http.post(this.url, data);
},
},
updateQuastatGoal: {
url: `${config.API_URL}/qm/quastat/update_rate_pass_t/`,
name: "更新合格率目标值",
post: async function (data = {}) {
return await http.post(this.url, data);
},
},
//质检项目
getTestItem: {
url: `${config.API_URL}/qm/testitem/`,

View File

@ -460,8 +460,8 @@ export default {
prints: {
name: "打印",
req: async function (data) {
// return await http.post(`${config.API_URL}/prints/`, data);
return await http.post("http://localhost:8080/prints/", data);
// return await http.post("http://127.0.0.1:8080/prints/", data);
},
},
ana:{

View File

@ -91,7 +91,7 @@ export default {
mounted(){
let that = this;
let host = window.location.host;
let jsUrl = host.indexOf('localhost')>-1?'http://222.222.144.147:6013/jsmap/jsmap.js':window.location.protocol + "//" + host+'/jsmap/jsmap.js';
let jsUrl = host.indexOf('localhost')>-1?'http://111.11.19.54:6013/jsmap/jsmap.js':window.location.protocol + "//" + host+'/jsmap/jsmap.js';
console.log(jsUrl)
that.loadScript('mapId',jsUrl, () => {
that.canUseMap = true;

View File

@ -154,7 +154,7 @@ export default {
this.getArea();
let that = this;
let host = window.location.host;
let jsUrl = host.indexOf('localhost') > -1 ? 'http://222.222.144.147:6013/jsmap/jsmap.js' : window.location.protocol + "//" + host+'/jsmap/jsmap.js';
let jsUrl = host.indexOf('localhost') > -1 ? 'http://111.11.19.54:6013/jsmap/jsmap.js' : window.location.protocol + "//" + host+'/jsmap/jsmap.js';
that.loadScript('mapId', jsUrl, () => {
that.canUseMap = true;
})

View File

@ -101,13 +101,13 @@
width="120"
>
</el-table-column>
<el-table-column
<!-- <el-table-column
label="合计"
prop="sum"
width="130"
fixed="right"
>
</el-table-column>
</el-table-column> -->
</el-table>
<el-table
v-if="query.type==1"
@ -116,7 +116,7 @@
style="width: 100%"
border
:height="tableHeight"
@cell-click="handleCellClick1"
>
<el-table-column
label="分类"
@ -135,13 +135,13 @@
width="120"
>
</el-table-column>
<el-table-column
<!-- <el-table-column
label="合计"
prop="sum"
width="130"
fixed="right"
>
</el-table-column>
</el-table-column> -->
</el-table>
<el-table
v-if="query.type==2"
@ -150,7 +150,7 @@
style="width: 100%"
border
:height="tableHeight"
@cell-click="handleCellClick_month"
>
<el-table-column
label="分类"
@ -169,13 +169,13 @@
width="120"
>
</el-table-column>
<el-table-column
<!-- <el-table-column
label="合计"
prop="sum"
width="130"
fixed="right"
>
</el-table-column>
</el-table-column> -->
</el-table>
<el-table
v-if="query.type==3"
@ -184,7 +184,7 @@
style="width: 100%"
border
:height="tableHeight"
@cell-click="handleCellClick_range"
>
<el-table-column
label="分类"
@ -242,9 +242,49 @@
<script>
let legend = {
top: "2%",
data: ["碳排放量(t)"],
data: ["碳排放量(t)", "碳排放强度(t/t)"],
};
let colors = ["##36492E", "#4BA328", "#C6F47D"];
let grid = {
right: "11%",
left: "11%",
top: "27%",
};
let colors = ["#518A3A", "#2DAEEF", "#C6F47D"];
let yAxis = [
{
type: "value",
name: "碳排放量(t)",
position: "left",
alignTicks: true,
nameRotate: 50,
axisLine: {
show: true,
lineStyle: {
color: colors[0],
},
},
axisLabel: {
formatter: "{value}",
},
},
{
type: "value",
name: "碳排放强度(t/t)",
position: "right",
alignTicks: true,
nameRotate: 50,
axisLine: {
show: true,
lineStyle: {
color: colors[1],
},
},
axisLabel: {
formatter: "{value}",
},
}
];
import scEcharts from "@/components/scEcharts";
export default {
components: {
@ -278,7 +318,6 @@ export default {
{id:0,name:'日统计'},
{id:1,name:'月统计'},
{id:2,name:'年统计'},
{id:3,name:'时间段'},
],
tableDatas2: [],
tableDatas_day:[],
@ -389,13 +428,14 @@ export default {
xAxisData_month: [],
xTtimeRange: [],
gyhourlyData : [],
lvhourlyData : [],
mpointList_code:"3750125939653558272,3759456603624382464,3636975194725527552",
StrengthData : [],
shhourlyData : [], //
gyhourlyData_month : [],
lvhourlyData_month : [],
shhourlyData_month : [], //
StrengthData_month : [],
ProductionData_month : [], //
gyhourlyData_year : [],
lvhourlyData_year : [],
StrengthData_year : [],
shhourlyData_year : [], //
};
},
@ -450,10 +490,10 @@ export default {
},
changeDate(){
let obj = {};
obj.type = "day";
obj.type = "hour";
obj.start_time = this.daterange[0];
obj.end_time = this.daterange[1];
obj.mpoint__in = "3750125939653558272";
obj.mpoint__in = '3750125939653558272,3759456603624382464';
obj.page = 0;
this.$API.enm.mpointstat.groupValues.req(obj).then((res) => {
//res total_val
@ -501,7 +541,7 @@ export default {
// enabled: 1,
// need_display: 1,
ordering: "report_sortstr",
code__in: "tpfl",
code__in: "tanpfqd, tpfl",
query: "{ id, name, nickname, mgroup_name, unit, report_sortstr }",
})
.then((res) => {
@ -518,6 +558,7 @@ export default {
_nameLength = [],
indexList = [];
let mgroupObj = {};
console.log(that.mpointList);
that.mpointList.forEach((item, index) => {
let indexs = _mgroup.indexOf(item.mgroup_name);
if (indexs > -1) {
@ -551,12 +592,14 @@ export default {
that.tableDatas2.push(obj);
that.getData(item.id, index);
});
that.updateChart(that.gyhourlyData, that.shhourlyData, that.lvhourlyData);
that.updateChart(that.gyhourlyData, that.StrengthData);
that.mgroupObj = mgroupObj;
that.indexList = indexList;
},
getData(id, index) {
let that = this;
that.StrengthData = [];
that.gyhourlyData = [];
let obj = {};
obj.type = "hour";
obj.year = that.year;
@ -574,6 +617,10 @@ export default {
that.tableDatas2[index][keyName] = item.val;
if (item.mpoint_nickname == "碳排放量"){
that.gyhourlyData[item.hour] = item.val;
}else if(
item.mpoint_nickname == "碳排放强度"
){
that.StrengthData[item.hour] = item.val;
}
});
sum = sum * 100;
@ -585,11 +632,12 @@ export default {
that.$forceUpdate();
});
},
updateChart(gyhourlyData, shhourlyData, lvhourlyData) {
updateChart(gyhourlyData, StrengthData) {
let that = this;
// ECharts
let option = {
legend: legend,
grid: grid,
tooltip: {
trigger: 'axis',
axisPointer: {
@ -600,80 +648,84 @@ export default {
type: 'category',
data: ['0时', '1时', '2时', '3时', '4时', '5时', '6时', '7时', '8时', '9时', '10时', '11时', '12时', '13时', '14时', '15时', '16时', '17时', '18时', '19时', '20时', '21时', '22时', '23时'],
},
yAxis: {
type: 'value',
name: ''
},
yAxis: yAxis,
series: [{
name: '碳排放量(t)', //
type: 'bar',
data: gyhourlyData, //
data: gyhourlyData,
yAxisIndex: 0,
itemStyle: {
color: '#518A3A',
},
},
{
name: '碳排放强度(t/t)',
type: 'bar',
data: StrengthData,
yAxisIndex: 1,
itemStyle: {
color: colors[1],
},
},
]
};
that.optionHour = option;
},
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);
}
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 + 2] = 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;
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 + 2] = 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);
// getData1(index)
that.getData1(index);
});
that.updateMonthChart(that.gyhourlyData_month, that.StrengthData_month, that.ProductionData_month);
that.mgroupObj = mgroupObj;
that.indexList = indexList;
},
that.tableDatas_day.push(obj);
that.getData1(item.id, index);
});
that.updateMonthChart(that.gyhourlyData_month);
that.mgroupObj = mgroupObj;
that.indexList = indexList;
},
updateMonthChart(gyhourlyData) {
updateMonthChart(gyhourlyData, StrengthData, ) {
let that = this;
// ECharts
let option1 = {
legend: legend,
grid: grid,
tooltip: {
trigger: 'axis',
axisPointer: {
@ -684,55 +736,90 @@ export default {
type: 'category',
data: [],
},
yAxis: {
type: 'value',
name: ''
},
yAxis: yAxis,
series: [{
name: '碳排放量(t)', //
name: '碳排放量(t)',
type: 'bar',
data: gyhourlyData, //
data: gyhourlyData,
yAxisIndex: 0,
itemStyle: {
color: '#518A3A',
},
},
{
name: '碳排放强度(t/t)',
type: 'bar',
data: StrengthData,
yAxisIndex: 1,
itemStyle: {
color: colors[1],
},
},
]
};
option1.xAxis.data = that.xAxisData_day;
that.optionDay = option1;
},
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;
if (item.mpoint_nickname == "碳排放量"){
that.gyhourlyData_month[item.day-1] = 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();
});
},
getData1(index) {
let that = this;
that.StrengthData_month = [];
that.gyhourlyData_month = [];
let carbonEmission = []; //
let outputKiln = []; //
let emissionIntensity = []; //
let obj = {};
obj.type = "day";
obj.year = that.year;
obj.month = that.month;
obj.mpoint__in = this.mpointList_code;
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);
if (item.mpoint_nickname === "碳排放量") {
carbonEmission[item.day - 1] = item.val; //
} else if (item.mpoint_nickname === "出窑熟料产量") {
outputKiln[item.day - 1] = item.val; //
}
if(item.mpoint_nickname == "碳排放强度"){
return;
}
// that.tableDatas_day[index][keyName] = item.val;
if (item.mpoint_nickname == "碳排放量"){
that.gyhourlyData_month[item.day - 1] = item.val;
} else if(item.mpoint_nickname == "出窑熟料产量"){
that.ProductionData_month[item.day - 1] = item.val;
}
});
// /
for (let i = 0; i < carbonEmission.length; i++) {
let keyName = i + 1 + "日";
if(index==1 && carbonEmission[i] && outputKiln[i]){
emissionIntensity[i] = carbonEmission[i] / outputKiln[i]; //
that.StrengthData_month[i] = emissionIntensity[i].toFixed(2); // StrengthData_month
that.tableDatas_day[index][keyName] = emissionIntensity[i].toFixed(2); // tableDatas_day
} else if(index==0 && carbonEmission[i]){
that.tableDatas_day[index][keyName] = carbonEmission[i];
}
}
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 = [];
@ -772,16 +859,17 @@ export default {
: item.name;
obj.unit = item.unit;
that.tableDatas_month.push(obj);
that.getData_month(item.id, index);
that.getData_month(index);
});
that.updateMonthChart_month(that.gyhourlyData_year, that.shhourlyData_year, that.lvhourlyData_year);
that.updateMonthChart_month(that.gyhourlyData_year, that.StrengthData_year);
that.mgroupObj = mgroupObj;
that.indexList = indexList;
},
updateMonthChart_month(gyhourlyData) {
updateMonthChart_month(gyhourlyData_year, StrengthData_year) {
let that = this;
let option2 = {
legend: legend,
grid: grid,
tooltip: {
trigger: 'axis',
axisPointer: {
@ -792,30 +880,42 @@ export default {
type: 'category',
data: [],
},
yAxis: {
type: 'value',
name: ''
},
yAxis: yAxis,
series: [{
name: '工业水', //
name: '碳排放量(t)',
type: 'bar',
data: gyhourlyData, //
data: gyhourlyData_year,
yAxisIndex: 0,
itemStyle: {
color: '#518A3A',
},
},
{
name: '碳排放强度(t/t)',
type: 'bar',
data: StrengthData_year,
yAxisIndex: 1,
itemStyle: {
color: colors[1],
},
}
]
};
option2.xAxis.data = that.xAxisData_month;
that.optionMonth = option2;
},
getData_month(id, index) {
getData_month(index) {
let that = this;
that.StrengthData_year = [];
that.gyhourlyData_year = [];
let carbonEmission = []; //
let outputKiln = []; //
let emissionIntensity = []; //
let obj = {};
obj.type = "month";
obj.year = that.year;
obj.mpoint = id;
obj.mpoint__in = that.mpointList_code;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
let sum = 0;
@ -824,11 +924,34 @@ export default {
that.tableDatas[index][ind] = item.val;
sum += Number(item.val);
let keyName = item.month + "月";
that.tableDatas_month[index][keyName] = item.val;
// that.tableDatas_month[index][keyName] = item.val;
if (item.mpoint_nickname === "碳排放量") {
carbonEmission[item.month - 1] = item.val; //
} else if (item.mpoint_nickname === "出窑熟料产量") {
outputKiln[item.month - 1] = item.val; //
}
if(item.mpoint_nickname == "碳排放强度"){
return;
}
if (item.mpoint_nickname == "碳排放量"){
that.gyhourlyData_year[item.month-1] = item.val;
}else if(item.mpoint_nickname == "碳排放强度"){
that.StrengthData_year[item.month-1] = item.val;
}
});
// /
for (let i = 0; i < carbonEmission.length; i++) {
let keyName = i + 1 + "月";
if(index==1 && carbonEmission[i] && outputKiln[i]){
emissionIntensity[i] = carbonEmission[i] / outputKiln[i]; //
that.StrengthData_year[i] = emissionIntensity[i].toFixed(2); // StrengthData_month
that.tableDatas_month[index][keyName] = emissionIntensity[i].toFixed(2); // tableDatas_day
} else if(index==0 && carbonEmission[i]){
that.tableDatas_month[index][keyName] = carbonEmission[i];
}
}
sum = sum * 100;
sum = Math.round(sum);
sum = sum / 100;
@ -853,9 +976,10 @@ export default {
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);
console.log("row", row, that.tableDatas_day, index);
that.tableName = `${row.nickname}`
console.log("tableDatas", that.tableDatas);
let lineData = that.tableDatas_day[index].slice(2, 13);
that.option.xAxis.data = that.xAxisData_day;
that.option.series[0].data = lineData;
this.itemVisible = true;
@ -863,7 +987,7 @@ export default {
handleCellClick_month(row, column, cell, event) {
let that = this;
let index = that.tableDatas_month.indexOf(row);
that.tableName = `${row.nickname}-电量日统计`
that.tableName = `${row.nickname}`
//
let lineData = that.tableDatas[index].slice(2, 13);
that.option.xAxis.data = that.xAxisData_month;

View File

@ -338,6 +338,7 @@
</template>
<script>
const colors = ["#5b9bd5", "#ed7d31", "#70ad47", "#ffc000", "#5f6694", "#cb9bff", "#7DDA58"];
const colors_hour = ["#5b9bd5", "#ffc000", "#5f6694", "#cb9bff", "#7DDA58"];
// /////
let tooltip = {
show: true,
@ -723,7 +724,7 @@ export default {
{id:2,name:'年统计'}
],
option1: {
color: colors,
color: colors_hour,
tooltip: tooltip,
grid: grid,
toolbox: toolbox,

View File

@ -201,7 +201,7 @@ export default {
production_cost_unit:item.production_cost_unit,
CaO:item.出窑熟料_fCaO_rate_pass,
coal_consume_unit:item.coal_consume_unit,
Fe2o3:item.入窑生料_Fe2O3_rate_pass,
lisz:item.出窑熟料_立升重_rate_pass,
elec:item.elec_consume_unit,
}
);
@ -411,20 +411,20 @@ export default {
}
arr[29] += production_hour_score;
// const production_cost_unit_itemValue = item.production_cost_unit; //
// const production_cost_unit_sortedData = monthData.sort((a, b) => parseFloat(b.production_cost_unit) - parseFloat(a.production_cost_unit));
// const production_cost_unit_index = production_cost_unit_sortedData.findIndex(obj => parseFloat(obj.production_cost_unit) === parseFloat(production_cost_unit_itemValue));
// let production_cost_unit_score = 0;
// if (production_cost_unit_index === 0){
// production_cost_unit_score= 10;
// } else if (production_cost_unit_index === 1) {
// production_cost_unit_score= 7;
// } else if (production_cost_unit_index === 2) {
// production_cost_unit_score= 3;
// } else if (production_cost_unit_index === 3) {
// production_cost_unit_score= 0;
// }
// arr[29] += production_cost_unit_score;
const lisz_itemValue = item.出窑熟料_立升重_rate_pass; //
const lisz_sortedData = monthData.sort((a, b) => parseFloat(b.lisz) - parseFloat(a.lisz));
const lisz_index = lisz_sortedData.findIndex(obj => parseFloat(obj.lisz) === parseFloat(lisz_itemValue));
let production_cost_unit_score = 0;
if (lisz_index === 0){
production_cost_unit_score= 7;
} else if (lisz_index === 1) {
production_cost_unit_score= 4;
} else if (lisz_index === 2) {
production_cost_unit_score= 3;
} else if (lisz_index === 3) {
production_cost_unit_score= 2;
}
arr[29] += production_cost_unit_score;
const CaO_itemValue = item.出窑熟料_fCaO_rate_pass; // CaO
const CaO_sortedData = monthData.sort((a, b) => parseFloat(b.CaO) - parseFloat(a.CaO));

View File

@ -290,7 +290,8 @@
</div>
</template>
<script>
const colors = ["#5b9bd5", "#cbd3fe", "#91CC75", "#EE6666", "#CC00CC", "#7DDA58", "#BCB69D"];
const colors = ["#5b9bd5", "#cbd3fe", "#B79C2C", "#EE6666", "#CC00CC", "#7DDA58", "#BCB69D","#0AF2FA", "#48D311"];
const colors1 = ["#5b9bd5", "#cbd3fe", "#B79C2C", "#EE6666", "#CC00CC", "#726691", "#48D311"];
let tooltip = {
show: true,
trigger: "axis",
@ -337,7 +338,7 @@ let yAxis = [
axisLine: {
show: true,
lineStyle: {
color: colors[0],
color: colors[7],
},
},
axisLabel: {
@ -353,7 +354,7 @@ let yAxis = [
axisLine: {
show: true,
lineStyle: {
color: colors[1],
color: colors[8],
},
},
axisLabel: {
@ -478,12 +479,18 @@ export default {
yAxisIndex: 0,
data: [],
},
{
name: "分布电耗",
type: "bar",
yAxisIndex: 1,
data: [],
},
],
},
option2: {
color: colors,
color: colors1,
tooltip: tooltip,
legend: Object.assign(legend, {data:["袋装合计", "散装合计", "熟料出厂合计", "出厂水泥合计", "复合水泥合计", "分布电耗目标值","分布电耗"]}),
grid: grid,
@ -550,7 +557,7 @@ export default {
{
name: "分布电耗",
type: "bar",
yAxisIndex: 0,
yAxisIndex: 1,
data: [],
},
],
@ -878,7 +885,8 @@ export default {
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [];
seriesData5 = [],
seriesData6 = [];
let data = response;
data.forEach((item) => {
let ind = item.day_s - 1;
@ -892,6 +900,8 @@ export default {
seriesData4[ind] = item.val;
}else if (item.mpoint_name == "复合水泥合计" || item.mpoint_name == "复合硅酸盐水泥;42.5R;袋装水泥") {
seriesData5[ind] = item.val;
}else if(item.mpoint_name == "包装进线"){
seriesData6[ind] = item.elec_consume_unit;
}
});
@ -901,6 +911,7 @@ export default {
options.series[2].data = seriesData3;
options.series[3].data = seriesData4;
options.series[4].data = seriesData5;
options.series[5].data = seriesData6;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let item = i + "日";

View File

@ -70,16 +70,6 @@
</el-header>
<el-card style="margin-top:5px">
<div class="tableContainer">
<!-- <div>
<label for="threshold">输入合格率阈值</label>
<input
type="text"
id="threshold"
v-model="currentThreshold"
placeholder="例如80%"
@input="updateThreshold"
/>
</div> -->
<table border="1" cellspacing="0" :key="timeStamp" id="myTable" class="myTable">
<thead class="myTableHead">
<tr>
@ -113,7 +103,6 @@
title="设置合格率的阈值"
v-model="dialogVisible"
width="30%"
@close="resetDialog"
>
<div>
<label>当前阈值:</label>
@ -144,34 +133,11 @@
],
titleLength:1,
mgroupOptions:[],
threshold: 80, //
currentThreshold: "80%", //
currentThreshold: 80, //
tableTime:'',
deptName:'',
typeName:'质检日报表',
tableName:'',
tableDatas:[
['原料车间','辅料','细度', , , , , , ],
['原料车间','辅料','Fe2O3', , , , , , ],
['原料车间','辅料','水分', , , , , , ],
['原料车间','干混生料','细度', , , , , , ],
['原料车间','干混生料','Fe2O3', , , , , , ],
['原料车间','干混生料','水分', , , , , , ],
['原料车间','干混生料','CaO', , , , , , ],
['烧成车间','入窑生料','CaO', , , , , , ],
['烧成车间','入窑生料','Fe2O3', , , , , , ],
['烧成车间','入窑生料','细度'],
['烧成车间','入窑生料','水分'],
['烧成车间','熟料','立升重'],
['烧成车间','熟料','f-CaO'],
['烧成车间','煤粉','细度'],
['烧成车间','煤粉','水分'],
['水泥车间','出磨水泥','比表面积'],
['水泥车间','出磨水泥','SO3'],
['水泥车间','出磨水泥','掺量'],
],
tableDatas3:[],
exportLoading:false,
header2:[],
@ -181,17 +147,14 @@
header2Obj:[],
deptOptions:[],
dialogVisible: false, //
currentColumnIndex: null, //
thresholds: {}, // key
// thresholds: {}, // key
thresholdobj:{},
materialTestItemMap:{},
currentMaterialName: null, //
currentTestItemName: null, //
};
},
watch: {
header3: {
handler(newV, OldV) {
this.header3 = newV;
}
}
},
mounted() {
var myDate = new Date();
let month = myDate.getMonth()+1;
@ -211,37 +174,78 @@
let that = this;
if(value==1){
this.typeName = '质检日报表'
}else if(value==1){
}else if(value==0){
this.typeName = '质检月报表'
}
that.tableName = that.deptName+that.typeName;
},
updateThreshold() {
const num = parseFloat(this.currentThreshold.replace("%", ""));
if (!isNaN(num)) {
//
this.thresholds[this.currentColumnIndex] = num;
this.dialogVisible = false; //
} else {
this.$message.error("请输入有效的阈值例如80%");
}
let that = this;
const num = parseFloat(that.currentThreshold);
if (!isNaN(num)){
const key = `${that.currentMaterialName}-${that.currentTestItemName}`;
const mapEntry = that.materialTestItemMap[key];
if (!mapEntry) {
return;
}
const payload = {
material_id: mapEntry.material_id,
testitem_id: mapEntry.testitem_id,
rate_pass_t: num,
month_s: mapEntry.month_s,
};
that.$API.qm.updateQuastatGoal.post(payload)
.then((res) => {
that.$message.success("阈值更新成功");
// this.thresholds[this.currentColumnIndex] = res.rate_pass_t; //
that.dialogVisible = false; //
})
.catch((error) => {
that.$message.error("阈值更新失败:" + error.message);
});
}else {
that.$message.error("请输入有效的阈值例如80%");
}
},
//
resetDialog() {
this.currentColumnIndex = null;
this.currentThreshold = "";
},
// resetDialog() {
// this.currentThreshold = "";
// },
//
getCellClass(cell, cellIndex) {
if (cellIndex > 0 && ((cellIndex - 1) % 4 === 3)) {
let that = this;
if (typeof cell === 'string' && cell.includes('%')) {
//
const cellValue = String(cell);
const value = parseFloat(cellValue.replace("%", ""));
const threshold = this.thresholds[cellIndex] || 0; //
if (!isNaN(value)) {
return value > threshold ? "green-text" : "red-text";
const header4Index = cellIndex - 1; // 0
const header3Index = Math.floor(header4Index / 4);
let cumulativeLength = 0;
let header2Index = -1;
for (let i = 0; i < that.header2Obj.length; i++) {
cumulativeLength += that.header2Obj[i].lengths * 4;
if (header4Index < cumulativeLength) {
header2Index = i;
break;
}
}
let currentMaterialNameClass = ''
let currentTestItemNameClass = ''
if (header2Index !== -1 && header3Index !== -1){
currentMaterialNameClass = that.header2Obj[header2Index].name; // header2Obj
currentTestItemNameClass = that.header3[header3Index]; // header3
}else {
currentMaterialNameClass = '';
currentTestItemNameClass = '';
}
const keyName = `${currentMaterialNameClass}-${currentTestItemNameClass}`;
const rate_g = that.thresholdobj[keyName] || 0;
if (rate_g >= value) {
return 'red-text';
} else {
return 'green-text';
}
}
return "";
},
deptChange(e){
@ -264,43 +268,67 @@
});
},
handleCellClick(cell, rowIndex, cellIndex){
if ((cellIndex - 1) % 4 === 3) { //
this.currentColumnIndex = cellIndex; //
this.currentThreshold = this.thresholds[cellIndex] || ""; //
this.dialogVisible = true; //
let that = this;
const header4Index_hd = cellIndex - 1 ; // 0
const header3Index_hd = Math.floor(header4Index_hd / 4) ;
let cumulativeLength = 0;
let header2Index = -1;
//
for (let i = 0; i < this.header2Obj.length; i++) {
cumulativeLength += this.header2Obj[i].lengths * 4;
if (header4Index_hd < cumulativeLength) {
header2Index = i;
break;
}
}
if (header2Index !== -1 && header3Index_hd !== -1){
that.currentMaterialName = this.header2Obj[header2Index].name; // header2Obj
that.currentTestItemName = this.header3[header3Index_hd]; // header3
}else {
that.currentMaterialName = '';
that.currentTestItemName = '';
}
const keyName = `${that.currentMaterialName}-${that.currentTestItemName}`;
that.currentThreshold = that.thresholdobj[keyName] || 0;
that.dialogVisible = true;
},
getTableData(){
let that = this;
that.tableDatas3 = [];
that.materialTestItemMap = {};
that.thresholdobj = {};
that.header3 = [];
let arr = [];
let update_start_time = '';
let update_end_time = '';
if(that.deptName=='原料车间'){
that.header2Obj=[{name:'辅料',lengths:3},{name:'干混生料',lengths:4}];
that.header2 = ['辅料','干混生料'];//
// that.header3 = ['','Fe2O3','','','Fe2O3','','CaO'];//
that.header4 = ['平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率'];//
}else if(that.deptName=='烧成车间'){
that.header2Obj=[{name:'入窑生料',lengths:4},{name:'熟料',lengths:4}];
that.header2 = ['入窑生料','熟料'];//
// that.header3 = ['CaO','Fe2O3','','','','f-CaO','',''];//
that.header4 = ['平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率'];//
that.header2Obj=[{name:'出窑熟料',lengths:4},{name:'熟料',lengths:4}];
that.header2 = ['出窑熟料','熟料'];//
}else{
that.header2Obj=[{name:'出磨水泥',lengths:3}];
that.header2 = ['出磨水泥'];//
// that.header3 = ['','SO3',''];//
that.header4 = ['平均值','检次','合次','合格率','平均值','检次','合次','合格率','平均值','检次','合次','合格率'];//
}
let params = {page: 0};
let arr = [];
if(that.query.type==0){//
arr = that.query.month.split('-');
params.year_s = arr[0];
params.month_s = arr[1];
params.month_s = parseInt(arr[1]);
params.type = 'day_s'
// const updateStartDate = new Date(params.year_s, params.month_s - 1, 1); // 0
// const updateEndDate = new Date(params.year_s, params.month_s, 0);
// update_start_time = updateStartDate.toISOString().split('T')[0]; // 'YYYY-MM-DD'
// update_end_time = updateEndDate.toISOString().split('T')[0]; //
}else if(that.query.type==1){//
params.type = 'month_s'
params.year_s = that.query.year;
// const updateStartDate = new Date(params.year_s, 0, 1); // 1 1
// const updateEndDate = new Date(params.year_s, 11, 31); // 12 31
// update_start_time = updateStartDate.toISOString().split('T')[0]; // 'YYYY-MM-DD'
// update_end_time = updateEndDate.toISOString().split('T')[0];
}
params.mgroup__belong_dept = that.query.belong_dept;
this.$API.enm.enstat.req(params).then((res) => {
@ -321,24 +349,27 @@
wrapArr[ind] = [];
}
if(that.deptName=='原料车间'){
wrapArr[ind].push(item)
if (item.mgroup_name=='生料工序(二次配料)'){
wrapArr[ind][0]=item
}else if(item.mgroup_name=='原料磨'){
wrapArr[ind][1]=item
}
}else if(that.deptName=='烧成车间'){
if(item.mgroup_name=='回转窑'){
wrapArr[ind][1]=item
}else{
}else if(item.mgroup_name=='煤磨'){
wrapArr[ind][0]=item
}
}else{
wrapArr[ind].push(item)
}
});
wrapArr = wrapArr.filter(item=>{
return item
})
wrapArr = wrapArr.filter(item => item && item.length > 0);
console.log(wrapArr, "-------------wrapArr")
wrapArr.forEach((item1,index1)=>{
if(item1!=undefined){//
let itemArr = [];
// _
let header2tem=[],header2Objtem=[],header3tem=[],header4tem=[];
let time =item1[0].day_s!=null? item1[0].year_s+'.'+item1[0].month_s+'.'+item1[0].day_s:item1[0].year_s+'.'+item1[0].month_s;
itemArr.push(time)
@ -348,6 +379,15 @@
//
data2.forEach((item3,index3)=>{
//item3
let key = `${item3.material_name}-${item3.testitem_name}`;
if (!that.materialTestItemMap[key]) {
that.materialTestItemMap[key] = {
material_id: item3.material,
testitem_id: item3.testitem,
month_s:params.month_s,
// end_time:update_end_time
};
}
if(header2tem.indexOf(item3.material_name)>-1){
let indexObj = header2tem.indexOf(item3.material_name);
header2Objtem[indexObj].lengths = header2Objtem[indexObj].lengths+1;
@ -369,7 +409,6 @@
}else{
itemArr[ind] = 0;
}
// itemArr[ind] = (item3.val_avg).toFixed(2);
itemArr.push(item3.num_test)
itemArr.push(item3.num_ok)
let pass = 0;
@ -380,15 +419,18 @@
pass = Number(item3.rate_pass).toFixed(2) + '%';
itemArr.push(pass)
}
// pass= pass+'%';
if(!that.thresholdobj[item3.material_name+"-"+item3.testitem_name]){
that.thresholdobj[item3.material_name+"-"+item3.testitem_name] = item3.rate_g;
}
}else{
itemArr.push(Number(item3.val_avg).toFixed(2));
itemArr.push(item3.num_test);
itemArr.push(item3.num_ok)
let pass = Number(item3.rate_pass).toFixed(2);
pass= pass+'%';
if(!that.thresholdobj[item3.material_name+"-"+item3.testitem_name]){
that.thresholdobj[item3.material_name+"-"+item3.testitem_name] = item3.rate_g;
}
itemArr.push(pass)
}
that.titleLength =itemArr.length;
@ -419,7 +461,6 @@
if(header4.length>0){
that.header4 = header4;
}
this.$forceUpdate();
innerArr.forEach(item=>{
if(item.length>1){
that.tableDatas3.push(item)

View File

@ -691,7 +691,6 @@ export default {
let form = this.$TOOL.data.get("sflogItem");
this.form = JSON.parse(form);
console.log('----------------',this.form);
this.querystlog.mgroup = this.mgroupId;
this.querystlog.sflogs = this.form.id;
this.apiObjStlog = this.$API.wpm.stlog.list;
@ -903,7 +902,6 @@ export default {
},
//stlogsflogexp
stlogRowClick(row) {
console.log(row);
this.clickItem = row;
this.getSflogexp(row.id);
},

View File

@ -1164,7 +1164,7 @@ export default {
);
that.tableDatas[6][5] =
data1.production_cost_unit;
that.tableDatas[6][9] = precen(
that.tableDatas[6][9] = consume_precen(
(that.tableDatas[6][8] - that.tableDatas[6][5]),
that.tableDatas[6][8]
);

View File

@ -0,0 +1,352 @@
<template>
<el-drawer
v-model="visible"
title="检验"
:size="'90%'"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="formbw"
:rules="rules"
label-width="140px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="检验时间" prop="test_date">
<el-date-picker
v-model="formbw.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="formbw.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-col :md="12" :sm="24">
<el-form-item label="备注">
<el-input v-model="formbw.note"> </el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 检测项 -->
<el-row>
<el-col>检测项</el-col>
<el-col v-for="(item) in qct_testitems" :key="item.id" :md="12" :sm="24">
<el-form-item :label="item.testitem_name">
<el-input-number
v-if="item.testitem_field_type=='input-number'"
v-model="formbw[item.testitem_name]"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun"
>
</el-input-number>
<el-input-number
v-if="item.testitem_field_type=='input-int'"
v-model="formbw[item.testitem_name]"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun"
>
</el-input-number>
<el-input
v-if="item.testitem_field_type=='input-text'"
v-model="formbw[item.testitem_name]"
class="width-100"
@change="defectCountSun"
>
</el-input>
<el-select
v-if="item.testitem_field_type=='select-text'"
v-model="formbw[item.testitem_name]"
clearable
class="width-100"
@change="defectCountSun"
>
<el-option
v-for="item0 in item.testitem_choices"
:key="item0"
:label="item0"
:value="item0"
>
</el-option>
</el-select>
<el-select
v-if="item.testitem_field_type=='selects-text'"
v-model="formbw[item.testitem_name]"
clearable
multiple
class="width-100"
@change="defectCountSun"
>
<el-option
v-for="item1 in item.testitem_choices"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- 缺陷项 -->
<el-row>
<el-col>缺陷项</el-col>
<el-col v-for="item in qct_defects" :key="item.id" :md="12" :sm="24">
<el-form-item :label="item.defect_name">
<el-switch v-model="formbw[item.defect_name]" style="--el-switch-on-color: #FF0000; --el-switch-off-color: green;"></el-switch>
<span v-if="item.note!==null&&item.note!==''" style="font-size: 12px; color: #a9a7a7;">({{ item.note }})</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer v-if="mode == 'add'">
<el-button type="primary" :loading="isSaveing" @click="submit">提交</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-drawer>
</template>
<script>
export default {
emits: ["success", "closed"],
props: {
material: { type: String, default: "" },
mioitemw: { type: Object, default: () => {} },
},
data() {
return {
loading: false,
form: {
weight_kgs: [],
ftestitems: [],
},
rules: {
test_date: [
{
required: true,
message: "请选择检验日期",
trigger: "blur",
},
],
test_time: [
{
required: true,
message: "请选择检验时间",
trigger: "blur",
},
],
test_user: [
{
required: true,
message: "请选择检验人",
trigger: "blur",
},
],
},
formbw:{
number:'',
note:'',
mioitem:'',
test_date:'',
test_user:'',
},
project_code: null,
mioItem: {},
visible: false,
isSaveing: false,
userList: [],
qct_testitems:[],
qct_defects:[],
qctId:'',
mioitemwId:'',
};
},
watch: {
qct_testitems: {
handler() {
//
this.qct_testitems.forEach(item => {
if (!(item.testitem_name in this.form)) {
this.form[item.testitem_name] = ''
}
});
},
immediate: true
},
qct_defects: {
handler() {
this.qct_defects.forEach(item => {
if (!(item.defect_name in this.form)) {
this.form[item.defect_name] = false;
// let str = item.rule_expression.replace(/`/g, '');
// this.form[item.defect_name] = str.replace(/\${(.*?)}/g, 'this.form.\$1')?'':'';
}
});
},
immediate: true
}
},
mounted() {
let that = this;
let config_base = that.$TOOL.data.get("BASE_INFO").base;
that.project_code = config_base.base_code;
that.getUserList();
that.mioitemwId = that.mioitemw.id;
that.formbw.number = that.mioitemw.number;
that.formbw.mioitem = that.mioitemw.mioitem;
this.getQctDetail();
},
methods: {
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
getQctDetail(){
let that = this;
that.$API.qm.qct.list.req({ qctmat__material: that.material,page:0 }).then((res) => {
if(res.length>0){
that.qctId = res[0].id;
that.$API.qm.qct.item.req(that.qctId).then((res0) => {
//testitemdefectitem
that.qct_defects = [];
that.qct_testitems = [];
if(res0.qct_defects.length>0){
res0.qct_defects.forEach((item1) => {
let obj = Object.assign({}, item1);
obj.value = '';
that.qct_defects.push(obj);
})
}else{
that.qct_defects = [];
}
if(res0.qct_testitems.length>0){
res0.qct_testitems.forEach((item2) => {
let obj2 = Object.assign({}, item2);
obj2.value = '';
if(obj2.testitem_field_type=='select-text'||obj2.testitem_field_type=='selects-text'){
let str = obj2.testitem_choices.replace(/'/g, '"');
let arr = JSON.parse(str);
obj2.testitem_choices = arr;
}
that.qct_testitems.push(obj2);
})
}else{
that.qct_testitems = [];
}
that.defectCountSun();
})
}
});
},
//
getUserList() {
let that = this;
this.$API.system.user.list
.req({ page: 0, posts__code__contains: "check" })
.then((res) => {
that.userList = res;
});
},
defectCountSun(){
let that = this;
that.qct_defects.forEach(item => {
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
let str = item.rule_expression.replace(/`/g, '');
str = str.replace(/\${(.*?)}/g, 'this.formbw.\$1');
let judge = eval(str);
that.formbw[item.defect_name] = judge;
}else{
that.formbw[item.defect_name] = false;
}
});
},
//
submit() {
let that = this;
let ftestdefects = [],ftestitems = [];
that.qct_testitems.forEach((item) => {
let obj0 = {};
obj0.testitem = item.testitem;
obj0.test_user = that.formbw.test_user;
obj0.testitem_name = item.testitem_name;
obj0.test_val_json = that.formbw[item.testitem_name];
ftestitems.push(obj0);
})
that.qct_defects.forEach((item1) => {
let obj1 = {};
obj1.defect = item1.defect;
obj1.test_user = that.formbw.test_user;
obj1.defect_name = item1.defect_name;
obj1.has = that.formbw[item1.defect_name];
ftestdefects.push(obj1);
})
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let obj = {};
obj.ftest = {};
obj.note = that.formbw.note;
obj.number = that.formbw.number;
obj.mioitem = that.formbw.mioitem;
obj.ftest.qct = that.qctId;
obj.ftest.test_user = that.formbw.test_user;
obj.ftest.test_date = that.formbw.test_date;
obj.ftest.ftestitems = ftestitems;
obj.ftest.ftestdefects = ftestdefects;
that.$API.inm.mioitemw.update.req(that.mioitemwId,obj).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch((err) => {
that.isSaveing = false;
})
}
})
},
//
setData(data) {
let that = this;
Object.assign(that.formbw, data);
data.ftestitems.forEach((item) => {
that.formbw[item.testitem_name] = item.test_val_json;
})
},
},
};
</script>
<style>
.width-100{
width: 100%;
}
</style>

View File

@ -751,159 +751,56 @@
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="140px"
>
<!-- 入厂检验 -->
<el-row v-if="type == 'pur_in'">
<el-col :md="12" :sm="24">
<el-form-item label="产品名称:">
{{ objitem.material_name }}
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="入厂批次号:">
{{ objitem.batch }}
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="检验时间" prop="test_time">
<el-date-picker
v-model="form.test_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="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-col :md="12" :sm="24">
<el-form-item label="检验合格" prop="is_testok">
<el-select
v-model="form.is_testok"
placeholder="检验合格"
clearable
style="width: 100%"
>
<el-option label="是" :value="true" />
<el-option label="否" :value="false" />
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="备注">
<el-input v-model="form.test_note"> </el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 检测项 -->
<el-row>
<el-col>检测项</el-col>
<el-col v-for="(item) in qct_testitems" :key="item.id" :md="12" :sm="24">
<el-form-item :label="item.testitem_name">
<el-input-number
v-if="item.testitem_field_type=='input-number'"
v-model="form[item.testitem_name]"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun"
>
</el-input-number>
<el-input-number
v-if="item.testitem_field_type=='input-int'"
v-model="form[item.testitem_name]"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun"
>
</el-input-number>
<el-input
v-if="item.testitem_field_type=='input-text'"
v-model="form[item.testitem_name]"
class="width-100"
@change="defectCountSun"
>
</el-input>
<el-select
v-if="item.testitem_field_type=='select-text'"
v-model="form[item.testitem_name]"
clearable
class="width-100"
@change="defectCountSun"
>
<el-option
v-for="item0 in item.testitem_choices"
:key="item0"
:label="item0"
:value="item0"
>
</el-option>
</el-select>
<el-select
v-if="item.testitem_field_type=='selects-text'"
v-model="form[item.testitem_name]"
clearable
multiple
class="width-100"
@change="defectCountSun"
>
<el-option
v-for="item1 in item.testitem_choices"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- 缺陷项 -->
<el-row>
<el-col>缺陷项</el-col>
<el-col v-for="item in qct_defects" :key="item.id" :md="12" :sm="24">
<el-form-item :label="item.defect_name">
<span v-if="form[item.defect_name]" style="background: red;width: 10px;height: 10px;border-radius: 5px;"></span>
<span v-else style="background: green;width: 10px;height: 10px;border-radius: 5px;"></span>
<!-- <el-input v-model="form[item.defect_name]" class="width-100"></el-input> -->
<span v-if="item.note!==null&&item.note!==''" style="font-size: 12px; color: #a9a7a7;">({{ item.note }})</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table :data="mioitemwList" border>
<el-table-column label="物料编号" prop="number">
</el-table-column>
<el-table-column label="操作" fixed="right" width="130">
<template #default="scope">
<el-button @click="changeCheckItem(scope.row)" type="text">检验</el-button>
<el-button @click="changeCheckRecord(scope.row)" type="text">检验记录</el-button>
</template>
</el-table-column>
</el-table>
<scTable v-if="checkRecordShow" :data="recordList" row-key="id" height="300px" stripe>
<el-table-column type="index" width="50" />
<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="是否合格" prop="is_ok">
<template #default="scope">
<el-tag v-if="scope.row.is_ok" type="success">合格</el-tag>
<el-tag v-else type="warning">不合格</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="80">
<template #default="scope">
<el-button @click="checkFormDetail(scope.row)" type="text">查看</el-button>
</template>
</el-table-column>
</scTable>
</el-main>
<el-footer v-if="mode == 'add'">
<!-- <el-footer v-if="mode == 'add'">
<el-button type="primary" :loading="isSaveing" @click="submit">提交</el-button>
<el-button @click="visibleDrawer = false">取消</el-button>
</el-footer>
</el-footer> -->
</el-container>
</el-drawer>
<checkform-dialog
v-if="checkShow"
ref="checkFormDialog"
:material="objitem.material"
:mioitemw="mioitemw"
@success="checkFormSuccess"
@closed="checkShow= false"
>
</checkform-dialog>
</template>
<script>
import checkformDialog from "./mioitemCheckForm.vue";
export default {
emits: ["success", "closed"],
components: {
checkformDialog
},
props: {
mioitemId: { type: String, default: "" },
type: { type: String, default: "" },
@ -912,13 +809,7 @@ export default {
},
data() {
return {
addTemplate: {
name: "",
sort: "",
user: "",
post: "",
dept: "",
},
tableData:[],
loading: false,
form: {
weight_kgs: [],
@ -947,12 +838,23 @@ export default {
},
],
},
formbw:{
number:'',
note:'',
mioitem:'',
test_date:'',
test_user:'',
},
project_code: null,
mioItem: {},
weight_kgs: [{ value: 0 }],
checkShow:false,
checkShowsss:false,
visible: false,
visibleDrawer:false,
isSaveing: false,
checkRecordShow:false,
recordList:[],
userList: [],
processOptions: [],
deptOptions: [],
@ -960,46 +862,21 @@ export default {
setFiltersVisible: false,
belong_dept_options: [],
group: [],
qct_testitems:[],
qct_defects:[],
mioitemwList:[],
qctId:'',
wproductId:'',
mioitemwId:'',
};
},
watch: {
qct_testitems: {
handler() {
//
this.qct_testitems.forEach(item => {
if (!(item.testitem_name in this.form)) {
this.form[item.testitem_name] = ''
}
});
},
immediate: true
},
qct_defects: {
handler() {
this.qct_defects.forEach(item => {
if (!(item.defect_name in this.form)) {
this.form[item.defect_name] = false;
// let str = item.rule_expression.replace(/`/g, '');
// this.form[item.defect_name] = str.replace(/\${(.*?)}/g, 'this.form.\$1')?'':'';
}
});
},
immediate: true
}
},
mounted() {
let that = this;
let config_base = that.$TOOL.data.get("BASE_INFO").base;
that.project_code = config_base.base_code;
that.getUserList();
if(that.project_code=='bxerp'){
that.wproductId = that.objitem.mioitemw[0].wpr;
// that.wproductId = that.objitem.wproducts[0].id;
this.getQctDetail();
that.mioitemwId = that.objitem.mioitemw[0].id;
that.formbw.number = that.objitem.mioitemw[0].number;
that.formbw.mioitem = that.objitem.mioitemw[0].mioitem;
this.getMioitemw();
}else{
if (that.type == "pur_in") {
console.log("objitem", that.objitem);
@ -1066,42 +943,37 @@ export default {
}
return this;
},
//
getQctDetail(){
changeCheckItem(row){
let that = this;
that.$API.qm.qct.list.req({ qctmat__material: that.objitem.material,page:0 }).then((res) => {
if(res.length>0){
that.qctId = res[0].id;
that.$API.qm.qct.item.req(that.qctId).then((res0) => {
//testitemdefectitem
that.qct_defects = [];
that.qct_testitems = [];
if(res0.qct_defects.length>0){
res0.qct_defects.forEach((item1) => {
let obj = Object.assign({}, item1);
obj.value = '';
that.qct_defects.push(obj);
})
}else{
that.qct_defects = [];
}
if(res0.qct_testitems.length>0){
res0.qct_testitems.forEach((item2) => {
let obj2 = Object.assign({}, item2);
obj2.value = '';
if(obj2.testitem_field_type=='select-text'||obj2.testitem_field_type=='selects-text'){
let str = obj2.testitem_choices.replace(/'/g, '"');
let arr = JSON.parse(str);
obj2.testitem_choices = arr;
}
that.qct_testitems.push(obj2);
})
}else{
that.qct_testitems = [];
}
that.defectCountSun();
})
}
that.mioitemw = row;
that.checkShow = true;
console.log("row",row);
console.log("checkFormDialog");
that.$nextTick(() => {
that.$refs.checkFormDialog.open("add");
})
},
checkFormDetail(row){
let that = this;
that.mioitemw = row;
that.checkShow = true;
that.$nextTick(() => {
that.$refs.checkFormDialog.open("show").setData(row);
})
},
changeCheckRecord(row){
let that = this;
this.mioitemwWpr = row.wpr;
that.$API.qm.ftest.list.req({ mioitemw_ftest__wpr: row.wpr,page:0 }).then((res) => {
that.recordList = res;
})
that.checkShow = false;
that.checkRecordShow = true;
},
getMioitemw(){
let that = this;
that.$API.inm.mioitemw.list.req({ mioitem: that.mioitemId,page:0 }).then((res) => {
that.mioitemwList = res;
});
},
//
@ -1121,18 +993,6 @@ export default {
this.weight_kgs.splice(index, 1);
this.form.count_sampling = this.weight_kgs.length;
},
defectCountSun(){
let that = this;
that.qct_defects.forEach(item => {
console.log(item.defect_name,':',item.rule_expression);
let str = item.rule_expression.replace(/`/g, '');
str = str.replace(/\${(.*?)}/g, 'this.form.\$1')
console.log(item.defect_name,':',str);
let judge = eval(str);
console.log(item.defect_name,':',judge);
that.form[item.defect_name] = judge;
});
},
countSun() {
let that = this;
let sum = 0;
@ -1195,125 +1055,88 @@ export default {
//
submit() {
let that = this;
if(that.project_code=='bxerp'){
let defect_json = [],test_json = {};
that.qct_testitems.forEach((item) => {
let val = that.form[item.testitem_name];
let obj0 = {};
obj0.testitem_name = item.testitem_name;
obj0.val = val;
test_json[item.id] =obj0;
})
that.qct_defects.forEach((item) => {
if(that.form[item.defect_name]){
defect_json.push(item.id);
}
})
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let obj = {};
obj.test_user = that.form.test_user;
obj.test_time = that.form.test_time;
obj.is_testok = that.form.is_testok;
obj.qct = that.qctId;
obj.note = that.form.test_note;
obj.test_json = test_json;//
obj.defect_json = defect_json;//defecttrueid
that.$API.inm.mioitem.wtest.req(that.wproductId,obj).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch((err) => {
that.isSaveing = false;
})
}
})
}else{
if (
(that.type == "do_in" && that.cate == "halfgood") ||
that.type == "other_in"
) {
this.form.count_notok =
this.form.count_n_zw +
this.form.count_n_tw +
this.form.count_n_qp +
this.form.count_n_wq +
this.form.count_n_dl +
this.form.count_n_pb +
this.form.count_n_dxt +
this.form.count_n_js +
this.form.count_n_qx +
this.form.count_n_hs +
this.form.count_n_ysq +
this.form.count_n_zz +
this.form.count_n_b +
this.form.count_n_qt;
}
if (that.type == "do_in" && that.cate == "good") {
this.form.count_notok =
this.form.count_n_hs +
this.form.count_n_cs +
this.form.count_n_zz +
this.form.count_n_tw +
this.form.count_n_d +
this.form.count_n_zdd +
this.form.count_n_zw +
this.form.count_n_dl +
//
this.form.count_n_qp +
this.form.count_n_bl +
this.form.count_n_hw +
this.form.count_n_yp +
this.form.count_n_bp +
this.form.count_n_sc +
//
this.form.count_n_qx +
this.form.count_n_js +
this.form.count_n_tydd +
this.form.count_n_sw +
this.form.count_n_bhpcd +
this.form.count_n_wq;
}
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
try {
if (that.type == "pur_in") {
console.log(that.form);
let arr = [];
that.weight_kgs.forEach((item) => {
arr.push(item.value);
});
that.form.weight_kgs = arr;
console.log('that.form',that.form);
that.$API.inm.mioitem.testpurin
.req(that.mioitemId, that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
});
} else {
that.$API.inm.mioitem.test
.req(that.mioitemId, that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
});
}
} catch (err) {
//
this.isSaveing = false;
return err;
}
}
});
if (
(that.type == "do_in" && that.cate == "halfgood") ||
that.type == "other_in"
) {
this.form.count_notok =
this.form.count_n_zw +
this.form.count_n_tw +
this.form.count_n_qp +
this.form.count_n_wq +
this.form.count_n_dl +
this.form.count_n_pb +
this.form.count_n_dxt +
this.form.count_n_js +
this.form.count_n_qx +
this.form.count_n_hs +
this.form.count_n_ysq +
this.form.count_n_zz +
this.form.count_n_b +
this.form.count_n_qt;
}
if (that.type == "do_in" && that.cate == "good") {
this.form.count_notok =
this.form.count_n_hs +
this.form.count_n_cs +
this.form.count_n_zz +
this.form.count_n_tw +
this.form.count_n_d +
this.form.count_n_zdd +
this.form.count_n_zw +
this.form.count_n_dl +
//
this.form.count_n_qp +
this.form.count_n_bl +
this.form.count_n_hw +
this.form.count_n_yp +
this.form.count_n_bp +
this.form.count_n_sc +
//
this.form.count_n_qx +
this.form.count_n_js +
this.form.count_n_tydd +
this.form.count_n_sw +
this.form.count_n_bhpcd +
this.form.count_n_wq;
}
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
try {
if (that.type == "pur_in") {
console.log(that.form);
let arr = [];
that.weight_kgs.forEach((item) => {
arr.push(item.value);
});
that.form.weight_kgs = arr;
console.log('that.form',that.form);
that.$API.inm.mioitem.testpurin
.req(that.mioitemId, that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
});
} else {
that.$API.inm.mioitem.test
.req(that.mioitemId, that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
});
}
} catch (err) {
//
this.isSaveing = false;
return err;
}
}
});
},
//
setData(data) {
@ -1334,6 +1157,7 @@ export default {
(sum / data.weight_kgs.length) * data.count_bag;
}
},
checkFormSuccess(){},
//
setFilters(filters) {
this.selectionFilters = filters;

View File

@ -127,9 +127,9 @@ export default {
showWechatLogin: false,
isWechatLoginResult: false,
showApp: false,
appUrl: 'http://222.222.144.147:6013/media/zc_ehs.apk',
appUrl: 'http://111.11.19.54:6013/media/zc_ehs.apk',
showH5: false,
h5Url: 'http://222.222.144.147:6013/h5/',
h5Url: 'http://111.11.19.54:6013/h5/',
loginType:'password',
loginTypeOptions: [
{label: "账号登录", value: "password"},

View File

@ -107,6 +107,12 @@
width="80"
>
</el-table-column>
<el-table-column label="追踪方式" prop="tracking" v-if="project_code=='bxerp'">
<template #default="scope">
<el-tag v-if="scope.row.tracking == 10">批次</el-tag>
<el-tag v-else>单个</el-tag>
</template>
</el-table-column>
<el-table-column label="总库存" prop="count">
</el-table-column>
<el-table-column label="安全库存" prop="count_safe">
@ -216,6 +222,7 @@ export default {
30: "主要原料",
40: "辅助材料",
},
project_code:"",
materialId: "",
materialName: "",
showHidden: false,
@ -226,6 +233,7 @@ export default {
this.apiObj = this.$API.mtm.material.list;
this.$refs.table.queryData(this.query);
this.materialTemplate = this.materialTemplate+"?t=" + new Date().getTime();
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
},
methods: {
rowClick(row) {

View File

@ -86,6 +86,14 @@
<el-button link type="info" v-else disabled
>编辑
</el-button>
<el-button
link
type="danger"
v-auth="'mtask.delete'"
v-if="scope.row.state == 10"
@click="table_delete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</scTable>
@ -174,6 +182,13 @@ export default {
this.form = Object.assign(item, this.form);
this.dialogVisible = true;
},
table_delete(row){
let that = this;
that.$API.pm.mtask.delete.req(row.id).then((res) => {
that.$message.success("删除成功");
that.$refs.drawer_table.refresh();
})
},
updateMtaskSubmit() {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {

View File

@ -87,7 +87,7 @@
code: "",
cate: "尺寸",
note: "",
okcate:10,
okcate:20,
};
export default {
name: 'dept',
@ -112,7 +112,7 @@
],
cateOptions: ['尺寸', '外观','内质'],
okcate_: {
10: '合格',
// 10: '',
20: 'B类合格',
30: '不合格',
},
@ -151,7 +151,7 @@
this.addForm.code="";
this.addForm.note="";
this.addForm.cate="尺寸";
this.addForm.okcate=10;
this.addForm.okcate=20;
this.limitedVisible = true;
//
// this.$refs.addForm.clearValidate();

View File

@ -127,6 +127,14 @@
</xtSelect>
</template>
</el-table-column>
<el-table-column prop="addto_wpr" label="加入物料信息">
<template #default="scope">
<el-switch
:disabled="!scope.row.isEdit"
v-model="scope.row.addto_wpr"
></el-switch>
</template>
</el-table-column>
<el-table-column prop="type" label="备注">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.note }}</span>
@ -290,14 +298,15 @@ export default {
tracing: "",
qct: this.qctId,
material: "",
edit: false,
isEdit: true,
},
defectaddTemplate:{
qct: this.qctId,
defect: "",
note:'',
sort:'',
edit: false,
isEdit: true,
addto_wpr:false,
rule_expression:'',
},
testitemaddTemplate:{
@ -305,7 +314,7 @@ export default {
note:'',
sort:'',
testitem:'',
edit: false,
isEdit: true,
},
defectrow:{},
testitemrow:{},

View File

@ -618,7 +618,7 @@ export default {
this.getRoutePack();
} else if (this.cateType === "backfire") {
// 退
} else {
} else if (this.cateType === "opl") {
this.getOpl();
}
this.getticketItem();

View File

@ -31,8 +31,13 @@
</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="count_notok">
<el-table-column v-for="item in qct_defects" :label="item.defect_name" :key="item.id">
<template #default="scope">
{{ scope.row.}}
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="检验日期" prop="test_date">
</el-table-column>
<el-table-column label="检验人" prop="test_user_name">
@ -47,6 +52,7 @@ export default {
emits: ["closed"],
props: {
wm: { type: String, default: "" },
material: { type: String, default: "" },
},
data() {
return {
@ -58,17 +64,32 @@ export default {
10: "抽检",
20: "全检",
},
qct_defects:[],
isSaveing: false,
};
},
mounted() {},
mounted() {
},
methods: {
open() {
this.visible = true;
this.paramsObj.wm = this.wm;
this.apiObj = this.$API.qm.ftestwork.list;
this.getdefects();
return this;
},
//
getdefects(){
let that = this;
that.$API.qm.qct.list.req({ page: 0, qctmat__material: that.material }).then((res) => {
if(res.length>0){
that.$API.qm.qct.item.req(res[0].id).then((res) => {
that.qct_defects = res;
})
}
});
},
table_del(row){
this.$API.qm.ftestwork.delete.req(row.id).then((res) => {
this.$refs.drawer_table.fetch();

View File

@ -180,14 +180,17 @@
</el-col>
<el-col :span="7" >
<el-form-item label="" style="position: relative;">
<div style="position: absolute;
<el-link
:underline="false"
style="position: absolute;
top: 0;
left: -80px;
width: 80px;
height: 32px;
color: #0052d9;
line-height: 32px;"
@click="showbw($index)"
>交接数量</div>
>交接数量</el-link>
<el-input-number
v-model="listItem.count"
controls-position="right"
@ -503,20 +506,36 @@ export default {
this.visible = true;
return this;
},
materialChange() {
materialChange() {
let that = this;
let totalCount = 0;
let data = that.materialOptions.filter((item) => {
return that.selectItems.indexOf(item.id)>-1;
});
data.forEach(item=>{
data.forEach((item,index)=>{
item.wm = item.id;
item.count = item.count_cando;
totalCount += item.count_cando;
item.handoverbw = [];
that.getWprList(item.id,index);
})
that.totalCount = totalCount;
that.form.handoverb = data;
},
getWprList(id,index){
console.log('id',id,'index',index);
let that = this;
let handoverbw = [];
that.$API.wpm.wpr.list.req({wm:id,page:0}).then((res) => {
res.forEach(wpritem=>{
let obj = {};
obj.wpr = wpritem.id;
obj.number = wpritem.number;
handoverbw.push(obj);
})
that.form.handoverb[index].handoverbw = handoverbw;
})
},
countChange(){
let that = this;
let totalCount = 0;
@ -530,7 +549,7 @@ export default {
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
if (that.mode == "add") {
that.$API.wpm.handover.create.req(that.form).then((res) => {
@ -571,7 +590,7 @@ export default {
},
//
setData(data) {
this.totalCount = data.count;
this.totalCount = data.count?data.count:data.handoverb.count;
Object.assign(this.form, data);
if(data.type==30){
this.getUserList3();
@ -670,15 +689,24 @@ export default {
obj.batch = item.batch;
obj.count_cando = item.count;
obj.count = item.count;
that.form.handoverb.push(obj);
// console.log('4',that.form);
obj.handoverbw = [];
that.$API.wpm.wpr.list.req({wm:item.id}).then((res) => {
let handoverbw = [];
let list = res.results;
list.forEach(item1=>{
let obj1 = {};
obj1.wpr = item1.id;
obj1.number = item1.number;
handoverbw.push(obj1);
})
obj.handoverbw = handoverbw;
that.form.handoverb.push(obj);
})
}
})
}
})
}
//
// this.scanVisible = false;
},
},
};

View File

@ -154,6 +154,7 @@
ref="showDrawer"
v-if="visibleDrawer"
:wm="wm"
:material="wmMaterial"
@closed="visibleDrawer = false"
>
</showDrawer>
@ -172,8 +173,16 @@
<h4>关联产品</h4>
</template>
<template #default>
<scTable ref="wprTable" :apiObj="wprApiObj" :params="wprParams">
<scTable ref="wprTable" :data="wprList">
<el-table-column label="产品编号" prop="number"></el-table-column>
<el-table-column label="记录数据" prop="oinfo">
<template #default="scope">
<div v-for="(item,index) in scope.row.oinfo" :key="item.id">
{{ item.name }}:{{ item.val}}
<span v-if="index<(scope.row.oinfo.length-1)">,</span>
</div>
</template>
</el-table-column>
<el-table-column label="缺陷项">
<template #default="scope">
<span v-for="item in scope.row.wprdefect" :key="item.id">
@ -273,6 +282,7 @@ export default {
wprParams:{
wm: ""
},
wmMaterial:'',
cate_type:'',
process:'',
materialType: "wm",
@ -345,6 +355,7 @@ export default {
//
tableCheckList(row){
this.wm = row.id;
this.wmMaterial = row.material;
this.visibleDrawer = true;
this.$nextTick(() => {
this.$refs.showDrawer.open();
@ -376,9 +387,11 @@ export default {
},
showWpr(row){
let that = this;
that.wprParams.wm='';
that.wprParams.wm = row.id;
that.wprVisibleDrawer = true;
this.$API.wpm.wpr.list.req(that.wprParams).then((res) => {
that.wprList = res.results;
})
},
//
handleSaveSuccess(data, mode) {

View File

@ -340,7 +340,7 @@
:tracking="tracking"
:materialIn="materialIn"
@success="handleSaveSuccess"
@closed="dialog.save = false"
@closed="saveMlogbInClose"
>
</save-dialog>
<check-dialog
@ -636,12 +636,20 @@ export default {
handleCheckSuccess() {
this.$refs.tableOut.refresh();
},
handlesCheckSuccess(){},
handlesCheckSuccess(){
this.$refs.tableIn.refresh();
this.$refs.tableOut.refresh();
},
fileUPSuccess(res) {
let that = this;
console.log('res',res);
this.test_file = res.path;
},
saveMlogbInClose(){
this.dialog.save = false;
this.$refs.tableIn.refresh();
this.$refs.tableOut.refresh();
},
//
handleEditSuccess() {
this.getMlogItem();

View File

@ -127,6 +127,7 @@ export default {
materialOptions: [],
mgroup_code:'',
mlogbInId:'',
mlogbInCount:0,
hasMlogbIn:false,
visible: false,
isSaveing: false,
@ -196,7 +197,6 @@ export default {
},
//
formWminChange(code){
console.log('code',code)
let that = this,codeId='',keys="",arr=[];
if(code.indexOf("#")>-1){
let arrs = code.split("#");
@ -204,6 +204,8 @@ export default {
codeId = arrs[1];
that.scanKyes = keys;
if(keys=='wpr'){//
console.log('wpr',codeId)
that.form.parent = '';
that.$API.wpm.wpr.item.req(codeId).then((res) => {
if(res){
let bwitem = {};
@ -216,18 +218,15 @@ export default {
if (arr.length > 0) {//
let batch = arr[0].batch;
that.wm_in = arr[0].batch;
that.form.count_use =1;
console.log('batch',batch);
that.mlogbInCount = arr[0].count;//
//
let arr0= that.mlogbIns.filter((item)=>{
return item.batch == batch;
})
console.log('arr0',arr0)
if (arr0.length > 0) {
that.hasMlogbIn = true;
that.form.count_use = 1;
bwitem.mlogb = arr0[0].id;
that.form.parent = '';
console.log('bwitem',bwitem)
}else{
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
@ -306,7 +305,8 @@ export default {
that.form.batch = '';
that.form.parent = '';
that.form.count_use = 0;
if(that.scanKyes=='wpr'){
if(that.scanKyes=='wpr'&&that.mlogbInCount>1){
//1
that.bwItemForm.mlogb = res.id;
that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => {})
}

View File

@ -2,144 +2,163 @@
<el-drawer
:title="headTitle[mode]"
v-model="visible"
:size="'80%'"
:size="'90%'"
destroy-on-close
@closed="$emit('closed')"
>
<sc-form-table
hideDelete
:tableHeight="500"
v-model="mlogbwlist"
:addTemplate="addTemplate"
placeholder="暂无数据"
>
<el-table-column prop="number" label="物料编号">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.number }}</span>
<el-input v-if="scope.row.isEdit&&mode == 'outs'" v-model="scope.row.number" placeholder="物料编号"></el-input>
<el-select
v-if="scope.row.isEdit&&mode == 'ins'"
v-model="scope.row.wpr"
placeholder="动态成品"
clearable
style="width: 100%"
@change="optionChange(scope.row)"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.number"
:value="item.id"
<el-container>
<el-main id="mlogbwMain">
<sc-form-table
hideDelete
id="mlogbwlist"
:tableHeight="tableHeight"
v-model="mlogbwlist"
:addTemplate="addTemplate"
placeholder="暂无数据"
>
<el-table-column prop="number" label="物料编号">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.number }}</span>
<el-input v-if="scope.row.isEdit&&mode == 'outs'" v-model="scope.row.number" placeholder="物料编号"></el-input>
<el-select
v-if="scope.row.isEdit&&mode == 'ins'"
v-model="scope.row.wpr"
placeholder="动态成品"
clearable
style="width: 100%"
@change="optionChange(scope.row)"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="note" :label="item.testitem_name" v-for="item in qct_testitems" :key="item.id">
<template #default="scope">
<el-input-number
v-if="item.testitem_field_type=='input-number'"
v-model="scope.row[item.testitem_name]"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
>
</el-input-number>
<el-input-number
v-if="item.testitem_field_type=='input-int'"
v-model="scope.row[item.testitem_name]"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
>
</el-input-number>
<el-input
v-if="item.testitem_field_type=='input-text'"
v-model="scope.row[item.testitem_name]"
class="width-100"
@change="defectCountSun(scope.row)"
>
</el-input>
<el-select
v-if="item.testitem_field_type=='select-text'"
v-model="scope.row[item.testitem_name]"
clearable
class="width-100"
@change="defectCountSun(scope.row)"
>
<el-option
v-for="item0 in item.testitem_choices"
:key="item0"
:label="item0"
:value="item0"
<el-option
v-for="item in options"
:key="item.id"
:label="item.number"
:value="item.id"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="note" :label="item.testitem_name" v-for="item in qct_testitems" :key="item.id">
<template #default="scope">
<el-input-number
v-if="item.testitem_field_type=='input-number'"
v-model="scope.row[item.testitem_name]"
:min="0"
:disabled="!scope.row.isEdit"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
>
</el-option>
</el-select>
<el-select
v-if="item.testitem_field_type=='selects-text'"
v-model="scope.row[item.testitem_name]"
clearable
multiple
class="width-100"
@change="defectCountSun(scope.row)"
>
<el-option
v-for="item1 in item.testitem_choices"
:key="item1"
:label="item1"
:value="item1"
</el-input-number>
<el-input-number
v-if="item.testitem_field_type=='input-int'"
v-model="scope.row[item.testitem_name]"
:min="0"
:disabled="!scope.row.isEdit"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="note" :label="item.defect_name" v-for="item in qct_defects" :key="item.id">
<template #default="scope">
<el-switch
:disabled="!scope.row.isEdit"
v-model="scope.row[item.defect_name]"
style="--el-switch-on-color: red"
@change="switchChange(scope.row, item)"
></el-switch>
</template>
</el-table-column>
<el-table-column prop="note" label="备注">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.note }}</span>
<el-input v-else v-model="scope.row.note" placeholder="备注"></el-input>
</template>
</el-table-column>
<el-table-column prop="open" label="操作" width="120" align="center">
<template #default="scope">
<el-button
v-if="scope.row.isEdit"
text
type="primary"
size="small"
@click="formTableSave(scope.row)"
>保存</el-button
>
<el-button
v-else
text
type="primary"
size="small"
@click="formTableEdit(scope.row)"
>编辑</el-button
>
<el-button
v-if="!scope.row.isEdit"
text
type="danger"
size="small"
@click="formTableDel(scope.row.id)"
>删除</el-button
>
</template>
</el-table-column>
</sc-form-table>
</el-input-number>
<el-input
v-if="item.testitem_field_type=='input-text'"
v-model="scope.row[item.testitem_name]"
class="width-100"
:disabled="!scope.row.isEdit"
@change="defectCountSun(scope.row)"
>
</el-input>
<el-select
v-if="item.testitem_field_type=='select-text'"
v-model="scope.row[item.testitem_name]"
clearable
class="width-100"
:disabled="!scope.row.isEdit"
@change="defectCountSun(scope.row)"
>
<el-option
v-for="item0 in item.testitem_choices"
:key="item0"
:label="item0"
:value="item0"
>
</el-option>
</el-select>
<el-select
v-if="item.testitem_field_type=='selects-text'"
v-model="scope.row[item.testitem_name]"
clearable
multiple
class="width-100"
:disabled="!scope.row.isEdit"
@change="defectCountSun(scope.row)"
>
<el-option
v-for="item1 in item.testitem_choices"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="note" :label="item.defect_name" v-for="item in qct_defects" :key="item.id" width="70px">
<template #default="scope">
<el-switch
:disabled="!scope.row.isEdit"
v-model="scope.row[item.defect_name]"
style="--el-switch-on-color: red"
@change="switchChange(scope.row, item)"
></el-switch>
</template>
</el-table-column>
<el-table-column prop="note" label="备注" width="80px">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.note }}</span>
<el-input v-else v-model="scope.row.note" placeholder="备注"></el-input>
</template>
</el-table-column>
<el-table-column prop="open" label="操作" width="60" align="center">
<template #default="scope">
<el-button
v-if="scope.row.isEdit"
text
type="primary"
size="small"
@click="formTableSave(scope.row)"
>保存</el-button
>
<el-button
v-if="scope.row.isEdit"
text
type="primary"
size="small"
@click="formTableCancel(scope.row)"
>取消</el-button
>
<el-button
v-else
text
type="primary"
size="small"
@click="formTableEdit(scope.row)"
>编辑</el-button
>
<el-button
v-if="!scope.row.isEdit"
text
type="danger"
size="small"
@click="formTableDel(scope.row.id)"
>删除</el-button
>
</template>
</el-table-column>
</sc-form-table>
</el-main>
</el-container>
</el-drawer>
</template>
<script>
@ -191,6 +210,7 @@ export default {
note: "",
isEdit: true,
},
tableHeight:500,
apiObjPrint:this.$API.cm.labelmat.fromWm,
printer_name:localStorage.getItem("printer_name")
};
@ -198,7 +218,6 @@ export default {
mounted() {
let that = this;
that.params.mlogb = that.addTemplate.mlogb = that.mlogb;
that.getList();
that.getOptions();
that.getdefects();
},
@ -207,6 +226,10 @@ export default {
this.mode = mode;
console.log(this.mode);
this.visible = true;
setTimeout(() => {
this.tableHeight = document.getElementById('mlogbwMain').clientHeight-20;
},500)
},
getdefects(){
let that = this;
@ -219,17 +242,25 @@ export default {
that.qct_defects = res.qct_defects;
that.qct_testitems = [];
res.qct_testitems.forEach((item2) => {
that.addTemplate[item2.testitem_name] = '';
let obj2 = Object.assign({}, item2);
obj2.value = '';
if(obj2.testitem_field_type=='select-text'||obj2.testitem_field_type=='selects-text'){
obj2.addto_wpr = item2.addto_wpr;
if(item2.testitem_field_type=='input-number'||item2.testitem_field_type=='input-int'){
obj2.value = 0;
that.addTemplate[item2.testitem_name] = 0;
}
if(item2.testitem_field_type=='select-text'||item2.testitem_field_type=='selects-text'){
let str = obj2.testitem_choices.replace(/'/g, '"');
let arr = JSON.parse(str);
obj2.testitem_choices = arr;
that.addTemplate[item2.testitem_name] = '';
}
that.qct_testitems.push(obj2);
})
that.getList();
})
}else{
that.getList();
}
},
getOptions(){
@ -251,35 +282,39 @@ export default {
},
getList(){
let that = this;
that.mlogbwlist = [];
that.$API.wpm.mlogbw.list.req(that.params).then((res) => {
if(res.length>0){
that.mlogbwlist = [];
res.forEach((item) => {
let obj = Object.assign({},item);
let obj = {};
obj = Object.assign({},item);
obj.isEdit = false;
if(that.qct!==null&&that.qct!==''){
if(item.ftest&&item.ftest.ftestdefects&&item.ftest.ftestdefects.length>0){
if(that.qct!=null&&that.qct!=''&&item.ftest!=null){
if(item.ftest.ftestdefects!==undefined&&item.ftest.ftestdefects!==''&&item.ftest.ftestdefects!==null&&item.ftest.ftestdefects.length>0){
item.ftest.ftestdefects.forEach((item1) => {
obj[item1.defect_name] = item1.has;
})
}else{
that.qct_defects.forEach((item1) => {
obj[item1.defect_name] = false;
})
}
if(item.ftest&&item.ftest.ftestitems&&item.ftest.ftestitems.length>0){
if(item.ftest.ftestitems!==undefined&&item.ftest.ftestitems!==''&&item.ftest.ftestitems!==null&&item.ftest.ftestitems.length>0){
item.ftest.ftestitems.forEach((item2) => {
obj[item2.testitem_name] = item2.test_val_json;
})
}else{
that.qct_testitems.forEach((item2) => {
obj[item2.testitem_name] = "";
})
}
}else{
that.qct_defects.forEach((item1) => {
obj[item1.defect_name] = false;
})
that.qct_testitems.forEach((item2) => {
if(item2.testitem_field_type=='input-number'||item.testitem_field_type=='input-int'){
obj[item2.testitem_name] = 0;
}else{
obj[item2.testitem_name] = "";
}
})
}
that.mlogbwlist.push(obj);
})
console.log('mlogbwlistmlogbwlist',that.mlogbwlist);
}
})
},
@ -291,35 +326,24 @@ export default {
obj.mlogb = row.mlogb;
obj.wpr = row.wpr;
obj.note = row.note;
//qct
if(that.qct!==null&&that.qct!==''){
obj.ftest = {};
obj.ftest.ftestitems = [];
obj.ftest.ftestdefects = [];
if(row.ftest&&row.ftest.id){
obj.ftest.id =row.ftest.id;
}
// obj.ftest.id = (row.ftest&&row.ftest.id)?row.ftest.id:'';
if(row.id!=''&&row.id!==undefined&&row.id!==null&&row.ftest&&row.ftest.ftestdefects){
obj.ftest.qct = row.ftest.qct;
obj.ftest.test_date = row.ftest.test_date;
obj.ftest.test_user = row.ftest.test_user;
row.ftest.ftestdefects.forEach((item) => {
let itemObj = {};
itemObj.id = item.id;
itemObj.defect = item.defect;
itemObj.test_user = item.test_user;
itemObj.has = row[item.defect_name]?row[item.defect_name]:false;
obj.ftest.ftestdefects.push(itemObj);
//
if(row.ftest!==null&&row.ftest!==undefined&&row.ftest!==''){
console.log('已填过');
obj.ftest =row.ftest;
obj.ftest.ftestdefects.forEach((item) => {
item.has = row[item.defect_name];
})
row.ftest.ftestitems.forEach((item1) => {
let itemObj1 = {};
itemObj1.id = item1.id;
itemObj1.testitem = item1.testitem;
itemObj1.test_user = item1.test_user;
itemObj1.test_val_json = row[item1.testitem_name];
obj.ftest.ftestitems.push(itemObj1);
item1.test_val_json = row[item1.testitem_name];
})
}else{
console.log('obj',obj);
}else{//
console.log('未填过');
obj.ftest = {};
obj.ftest.ftestitems = [];
obj.ftest.ftestdefects = [];
obj.ftest.qct = that.qct;
obj.ftest.test_date = that.handle_date;
obj.ftest.test_user = that.handle_user;
@ -334,10 +358,11 @@ export default {
let itemObj1 = {};
itemObj1.testitem = item1.testitem;
itemObj1.test_user = that.handle_user;
itemObj1.addto_wpr = item1.addto_wpr;
itemObj1.test_val_json = row[item1.testitem_name];
obj.ftest.ftestitems.push(itemObj1);
})
}
}
}
if(row.id!==''&&row.id!==undefined&&row.id!==null){
obj.id = row.id;
@ -358,6 +383,13 @@ export default {
});
}
},
formTableCancel(row){
this.mlogbwlist.forEach((item, index) => {
if (item.id == row.id) {
this.mlogbwlist[index].isEdit = false;
}
});
},
formTableEdit(row) {
this.mlogbwlist.forEach((item, index) => {
if (item.id == row.id) {
@ -405,10 +437,15 @@ export default {
let that = this;
let index = that.mlogbwlist.indexOf(row);
that.qct_defects.forEach(item => {
let str = item.rule_expression.replace(/`/g, '');
str = str.replace(/\${(.*?)}/g, 'row.\$1')
let judge = eval(str);
that.mlogbwlist[index][item.defect_name] = judge;
console.log('item.rule_expression',item.rule_expression);
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
let str = item.rule_expression.replace(/`/g, '');
str = str.replace(/\${(.*?)}/g, 'row.\$1')
let judge = eval(str);
that.mlogbwlist[index][item.defect_name] = judge;
}else{
that.mlogbwlist[index][item.defect_name] = false;
}
});
},
//

View File

@ -59,7 +59,8 @@ export default {
formData.append("printer_name", "GP-3150TN"); //
// POST
http.post("http://localhost:8080/prints/", formData)
that.$API.wpm.prints.req(formData)
// http.post("http://localhost:8080/prints/", formData)
.then((response) => {
console.log("postRes", response);
})
@ -103,8 +104,8 @@ export default {
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)
that.$API.wpm.prints.req(obj)
// http.post("http://localhost:8080/prints/", obj)
.then((response) => {
console.log("postRes", response);
})