<template>
|
<view>
|
<view>
|
<u-table font-size="25">
|
<u-tr>
|
<u-td>
|
<xfl-select :list="UserArray" :initValue="this.$UserTool.UserInfo.userName" :clearable="false"
|
:disabled="true">
|
</xfl-select>
|
</u-td>
|
<u-td width="25%">现在时间:</u-td>
|
<u-td width="25%">{{date}}</u-td>
|
</u-tr>
|
</u-table>
|
</view>
|
|
<view style="padding: 0rpx 0rpx">
|
<u-table>
|
<u-tr>
|
<u-td width="30%">轮对条码</u-td>
|
<u-td>
|
<u-input v-model="barcode" :focus="qrcodeFocus" :border="true" placeholder="请扫描轮对条码"
|
@input="barcodeChange" />
|
</u-td>
|
</u-tr>
|
|
<u-tr>
|
<u-td width="30%">车型</u-td>
|
<u-td>
|
<xfl-select :list="CxTypes" :initValue="stateInitValueCarmodel" :clearable="false" @change="Get_VehicleType_Alls"
|
ref="Get_VehicleType_All" :key="CarmodelKey">
|
</xfl-select>
|
<!-- <u-input v-model="materiel" :border="true" placeholder="请手动输入车型" /> -->
|
</u-td>
|
</u-tr>
|
<u-tr>
|
<u-td width="30%">轴承类别:</u-td>
|
<u-td>
|
<xfl-select :list="StateArray" :initValue="'请选择'" :clearable="false" @change="StateChange"
|
ref="StateSelect">
|
</xfl-select>
|
</u-td>
|
</u-tr>
|
<u-tr>
|
<u-td width="30%">轴承品牌:</u-td>
|
<u-td>
|
<!-- <xfl-select :list="ManufacturerArray" :initValue="'请选择'" :clearable="false"
|
@change="ManufacturerChange" ref="ManufacturerSelect">
|
</xfl-select> -->
|
<u-td>
|
<u-input v-model="Manufacturer" :border="true" placeholder="请输入轴承品牌" />
|
</u-td>
|
</u-td>
|
</u-tr>
|
<u-tr>
|
<u-td width="30%">轴号端防尘板平均值</u-td>
|
<u-td>
|
<u-input v-model="zfcbAVG" :border="true" placeholder="请输入..." />
|
</u-td>
|
<u-td width="30%">非轴号端防尘板平均值</u-td>
|
<u-td>
|
<u-input v-model="yfcbAVG" :border="true" placeholder="请输入..." />
|
</u-td>
|
</u-tr>
|
<u-tr>
|
<u-td width="30%" height="50px;">轴号端轴颈平均值</u-td>
|
<u-td>
|
<u-input v-model="zzjAVG" :border="true" placeholder="请输入..." />
|
</u-td>
|
<u-td width="30%">非轴号端轴颈平均值</u-td>
|
<u-td>
|
<u-input v-model="yzjAVG" :border="true" placeholder="请输入..." />
|
</u-td>
|
</u-tr>
|
|
<!-- <u-tr>
|
<u-td width="30%">左挡油环平均值</u-td>
|
<u-td>
|
<u-input v-model="zydAVG" :border="true" placeholder="请输入..." />
|
</u-td>
|
<u-td width="30%">右挡油环平均值</u-td>
|
<u-td>
|
<u-input v-model="yydAVG" :border="true" placeholder="请输入..." />
|
</u-td>
|
</u-tr> -->
|
|
<u-tr>
|
<u-td width="30%">轴承编码</u-td>
|
<u-td>
|
<u-input v-model="Bearing_code" :border="true" placeholder="请扫描轴承编码"
|
@input="barcodeChange2" />
|
</u-td>
|
</u-tr>
|
|
<u-tr>
|
<u-td width="30%">后档内径平均值</u-td>
|
<u-td>
|
<u-input v-model="csize_four_3" :border="true" placeholder="请输入..." />
|
</u-td>
|
<u-td width="30%">后档内径结果</u-td>
|
<u-td>
|
<u-input v-model="csize_four_result" :border="true" placeholder="请输入..." />
|
</u-td>
|
</u-tr>
|
<u-tr>
|
<u-td width="30%">轴承内径值</u-td>
|
<u-td>
|
<u-input v-model="csize_in_value" :border="true" placeholder="请输入..." />
|
</u-td>
|
<u-td width="30%">轴承内径结果</u-td>
|
<u-td>
|
<u-input v-model="csize_in_result" :border="true" placeholder="请输入..." />
|
</u-td>
|
</u-tr>
|
|
|
|
|
|
<u-tr>
|
<u-td width="30%">轴承方向:</u-td>
|
<u-td>
|
<xfl-select :list="ZCdirectionArray" :initValue="'请选择'" :clearable="false"
|
@change="ZCdirectionChange">
|
</xfl-select>
|
</u-td>
|
</u-tr>
|
|
<u-tr>
|
<u-td width="30%">后档过盈量</u-td>
|
<u-td>
|
<u-input v-model="hdgyl" :border="true" placeholder="自动计算过盈量" />
|
</u-td>
|
</u-tr>
|
<u-tr>
|
<u-td width="30%">轴颈过盈量</u-td>
|
<u-td>
|
<u-input v-model="zjgyl" :border="true" placeholder="自动计算过盈量" />
|
</u-td>
|
</u-tr>
|
|
</u-table>
|
</view>
|
<view style="padding: 0rpx 0rpx;">
|
<u-table>
|
<u-tr>
|
<u-td>
|
<u-button style="width:100px" type="primary" @click="SaveInfomation">添加选配记录</u-button>
|
</u-td>
|
</u-tr>
|
</u-table>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
var _this;
|
var _user;
|
export default {
|
data() {
|
return {
|
CxTypes:[], //所有车型
|
stateInitValueCarmodel:'请选择', // 【车型】
|
CarmodelKey: 0, //【车型】
|
csize_four_result:'',
|
csize_four_3:'',
|
csize_in_value:'',
|
csize_in_result:'',
|
zjgyl:'',
|
hdgyl:'',
|
|
date: '',
|
CurrentUser: '', //当前用户
|
barcode: '',
|
zzjAVG: '',
|
yzjAVG: '',
|
zfcbAVG: '',
|
yfcbAVG: '',
|
zydAVG: '',
|
yydAVG: '',
|
Bearing_code:'', // 轴承编码
|
StateArray: [{
|
label: 'R0',
|
value: '新造'
|
},{
|
label: 'R1',
|
value: '检修'
|
}],
|
ManufacturerArray: [{
|
label: '1号厂家',
|
value: '1号厂家'
|
}],
|
StationArray: [{
|
label: '1号压装位',
|
value: '2线库压装台'
|
},
|
{
|
label: '2号压装位',
|
value: '3线库压装台'
|
}
|
],
|
ZCdirectionArray: [
|
// {
|
// label: 'all',
|
// value: '两侧'
|
// },
|
{
|
label: 'left',
|
value: '轴端'
|
},
|
{
|
label: 'right',
|
value: '非轴端'
|
}
|
],
|
zcState: '',
|
Manufacturer: '',
|
targetStation: '',
|
materiel: '',
|
//轴承方向
|
ZCdirection: '',
|
//轴承号
|
ldCode: '',
|
ortherData: '',
|
qrcodeFocus: false
|
}
|
},
|
methods: {
|
UserChange(value) {
|
|
},
|
setTimer() {
|
if (this.timer == null) {
|
this.timer = setInterval(() => {
|
this.date = this.$DateTool.getDate();
|
}, 1000)
|
}
|
},
|
ManufacturerChange(value) {
|
this.Manufacturer = value.orignItem.label;
|
},
|
StateChange(value) {
|
this.zcState = value.orignItem.label;
|
},
|
StationChange(value) {
|
this.targetStation = value.orignItem.label;
|
},
|
ZCdirectionChange(value) {
|
this.ZCdirection = value.orignItem.label;
|
var _this = this;
|
// 这里会选择轴承方向,会进行过盈量的计算
|
// if(value.orignItem.label == "left"){
|
// _this.hdgyl = _this.zfcbAVG - _this.csize_four_3
|
// _this.zjgyl = _this.zzjAVG - _this.csize_in_value
|
// }
|
|
// if(value.orignItem.label == "right"){
|
// _this.hdgyl = _this.yfcbAVG = _this.csize_four_3
|
// _this.zjgyl = _this.yzjAVG - _this.csize_in_value
|
// }
|
|
if(value.orignItem.label == "left"){
|
// 计算后保留三位小数
|
_this.hdgyl = (_this.zfcbAVG - _this.csize_four_3).toFixed(3);
|
_this.zjgyl = (_this.zzjAVG - _this.csize_in_value).toFixed(3);
|
// 可选:转成数字类型(toFixed返回字符串,如需数字则加Number())
|
// _this.hdgyl = Number((_this.zfcbAVG - _this.csize_four_3).toFixed(3));
|
// _this.zjgyl = Number((_this.zzjAVG - _this.csize_in_value).toFixed(3));
|
}
|
|
if(value.orignItem.label == "right"){
|
// 修复笔误:把 = 改成 -(你原本写的是 _this.yfcbAVG = _this.csize_four_3)
|
_this.hdgyl = (_this.yfcbAVG - _this.csize_four_3).toFixed(3);
|
_this.zjgyl = (_this.yzjAVG - _this.csize_in_value).toFixed(3);
|
// 可选转数字:
|
// _this.hdgyl = Number((_this.yfcbAVG - _this.csize_four_3).toFixed(3));
|
// _this.zjgyl = Number((_this.yzjAVG - _this.csize_in_value).toFixed(3));
|
}
|
},
|
barcodeChange() {
|
_this.initAVG();
|
if (_this.barcode == '' || _this.barcode == null) {
|
return;
|
}
|
let data = {
|
MainData: {
|
barcode: _this.barcode
|
},
|
};
|
// let data = {
|
// barcode: _this.barcode
|
// };
|
_this.$AjaxRequest.Params('post', 'ToMes/Mes_GetBearingNeckSizeInfo',
|
data, _user.token);
|
_this.$AjaxRequest.Request().then(function(result) {
|
//console.log(result);
|
if (result.data.status) {
|
let obj = JSON.parse(JSON.stringify(result.data.data));
|
_this.yfcbAVG = obj.yfcbAVG;
|
_this.zfcbAVG = obj.zfcbAVG;
|
//_this.zydAVG = obj.zydAVG;
|
// _this.yydAVG = obj.yydAVG;
|
_this.zzjAVG = obj.zzjAVG;
|
_this.yzjAVG = obj.yzjAVG;
|
//_this.materiel = obj.materiel;
|
_this.ldCode = obj.ldCode;
|
_this.ortherData = obj.ortherData;
|
if (null != obj.manufacturerArray)
|
obj.manufacturerArray.forEach(function(item, index, arr) {
|
_this.ManufacturerArray.push({
|
label: item,
|
value: item
|
})
|
});
|
if (null != obj.neworold)
|
obj.neworold.forEach(function(item, index, arr) {
|
let name = '检修';
|
if (item.indexOf('0') > -1) {
|
name = '新品';
|
}
|
|
if (null == _this.StateArray.find(r => r.value == name)) {
|
_this.StateArray.push({
|
label: item,
|
value: name
|
})
|
}
|
});
|
//console.log(obj);
|
} else {
|
uni.showToast({
|
icon: 'none',
|
title: "请求错误:" + result.data.message,
|
duration: 2000
|
});
|
_this.initAVG();
|
}
|
}).catch(function(err) {
|
uni.showToast({
|
icon: 'none',
|
title: "请求后台异常,错误信息." + err.errMsg,
|
duration: 2000
|
});
|
_this.initAVG();
|
});
|
},
|
barcodeChange2() {
|
if (_this.Bearing_code == '' || _this.Bearing_code == null) {
|
return;
|
}
|
if(this.Bearing_code.length > 20){
|
const rawStr = _this.Bearing_code;
|
// 2. 修复格式(单引号→双引号 + 删尾逗号)
|
const fixedStr = rawStr.replace(/'/g, '"').replace(/,\s*}/, '}');
|
console.log(fixedStr)
|
// 3. 解析为字典(对象)
|
const temp_dict = JSON.parse(fixedStr);
|
console.log(temp_dict)
|
// 4. 正确获取值
|
console.log(temp_dict['轴承条码']); // 输出:1(不再是undefined)
|
|
_this.Bearing_code = temp_dict['轴承条码'];
|
}
|
let data = {
|
MainData: {
|
Bearing_code: _this.Bearing_code
|
},
|
};
|
// let data = {
|
// barcode: _this.barcode
|
// };
|
_this.$AjaxRequest.Params('post', 'Dt_container_size_info_hty/Get_csize_Data',
|
data, _user.token);
|
_this.$AjaxRequest.Request().then(function(result) {
|
//console.log(result);
|
if (result.data.status) {
|
let obj = JSON.parse(JSON.stringify(result.data.data));
|
console.log(obj)
|
_this.csize_four_3 = obj.csize_four_3;
|
_this.csize_four_result = obj.csize_four_result;
|
_this.csize_in_value = obj.csize_in_value;
|
_this.csize_in_result = obj.csize_in_result;
|
} else {
|
uni.showToast({
|
icon: 'none',
|
title: "请求错误:" + result.data.message,
|
duration: 2000
|
});
|
}
|
}).catch(function(err) {
|
uni.showToast({
|
icon: 'none',
|
title: "请求后台异常,错误信息." + err.errMsg,
|
duration: 2000
|
});
|
});
|
},
|
initAVG() {
|
_this.csize_four_result = '';
|
_this.csize_four_3 = '';
|
_this.csize_in_value = '';
|
_this.csize_in_result = '';
|
_this.gyl = '';
|
|
_this.yfcbAVG = '';
|
_this.zfcbAVG = '';
|
// _this.zydAVG = '';
|
// _this.yydAVG = '';
|
_this.zzjAVG = '';
|
_this.yzjAVG = '';
|
_this.materiel = '';
|
_this.Manufacturer = '';
|
_this.zcState = '';
|
//_this.StateArray = [];
|
_this.ldCode = '';
|
_this.ortherData = '';
|
_this.ManufacturerArray = [];
|
_this.$refs.StateSelect.setInput("请选择");
|
_this.$refs.StateSelect.clearItemActive();
|
//_this.$refs.ManufacturerSelect.setInput("请选择");
|
//_this.$refs.ManufacturerSelect.clearItemActive();
|
},
|
SaveInfomation() {
|
if (_this.barcode == '' || _this.Manufacturer == '' ||
|
_this.zcState == '' || _this.materiel == '') {
|
uni.showToast({
|
title: "请选择厂家、工位或者选配标准信息.",
|
duration: 2000
|
});
|
alert(_this.barcode)
|
alert(_this.Manufacturer)
|
alert(_this.zcState)
|
alert(_this.targetStation)
|
alert(_this.barcode)
|
return;
|
}
|
if (_this.yfcbAVG == '' && _this.zfcbAVG == '' &&
|
_this.zydAVG == '' && _this.yydAVG == '' && _this.zzjAVG == '' &&
|
_this.yzjAVG == '') {
|
uni.showToast({
|
title: "请重新获取轮对选配信息.",
|
duration: 2000
|
});
|
return;
|
}
|
|
uni.showModal({
|
title: '提示',
|
content: '请核对轮对条码是否正确?',
|
success: function(res) {
|
if (res.confirm) {
|
let data = {
|
MainData: {
|
barcode: _this.barcode,
|
zcState: _this.zcState,
|
Manufacturer: _this.Manufacturer,
|
yfcbAVG: _this.yfcbAVG,
|
zfcbAVG: _this.zfcbAVG,
|
zydAVG: _this.zydAVG,
|
yydAVG: _this.yydAVG,
|
zzjAVG: _this.zzjAVG,
|
yzjAVG: _this.yzjAVG,
|
materiel: _this.materiel,
|
targetStation: _this.targetStation,
|
ZCdirection: _this.ZCdirection,
|
ldCode: _this.ldCode,
|
ortherData: _this.ortherData,
|
csize_four_3:_this.csize_four_3,
|
csize_four_result:_this.csize_four_result,
|
csize_in_value:_this.csize_in_value,
|
csize_in_result:_this.csize_in_result,
|
Bearing_code:_this.Bearing_code,
|
},
|
};
|
console.log("选好的数据",data)
|
_this.$AjaxRequest.Params('post', 'ToAPP/Manual_configuration',
|
data, _user.token);
|
_this.$AjaxRequest.Request().then(function(result) {
|
if (result.data.status) {
|
uni.showToast({
|
title: "创建选配出库成功!",
|
duration: 2000
|
});
|
_this.initAVG();
|
_this.qrcodeFocus = true;
|
} else {
|
uni.showToast({
|
icon: 'none',
|
title: "请求错误:" + result.data.message,
|
duration: 2000
|
});
|
}
|
}).catch(function(err) {
|
uni.showToast({
|
icon: 'none',
|
title: "请求后台异常,错误信息." + err.errMsg,
|
duration: 2000
|
});
|
});
|
} else if (res.cancel) {}
|
}
|
});
|
},
|
VehicleType(){
|
let data = {};
|
_this.$AjaxRequest.Params('post', 'Dt_materielinfo/Get_VehicleType_All',
|
data, _user.token);
|
_this.$AjaxRequest.Request().then(function(result) {
|
if (result.data.status) {
|
_this.CxTypes = result.data.data
|
} else {
|
uni.showToast({
|
icon: 'none',
|
title: "请求错误:" + result.data.message,
|
duration: 2000
|
});
|
}
|
console.log("车型的所有数据",result)
|
}).catch(function(err) {
|
uni.showToast({
|
icon: 'none',
|
title: "请求后台异常,错误信息." + err.errMsg,
|
duration: 2000
|
});
|
});
|
},
|
Get_VehicleType_Alls(value){
|
_this = this;
|
_this.materiel = value.orignItem; // 给车型赋值
|
console.log(_this.materiel)
|
},
|
},
|
created: function() {
|
// 每次进入界面时,先清除之前的所有定时器,然后启动新的定时器
|
clearInterval(this.timer)
|
this.timer = null;
|
this.setTimer();
|
_user = this.$UserTool.UserInfo;
|
this.CurrentUser = _user.userName;
|
this.UserArray = [this.$UserTool.AllUserInfo];
|
},
|
destroyed: function() {
|
// 每次离开当前界面时,清除定时器
|
clearInterval(this.timer);
|
this.timer = null;
|
},
|
mounted() {
|
_this = this;
|
_this.qrcodeFocus = true;
|
//_this.queryOrder();
|
this.VehicleType();
|
},
|
|
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.tdHeight {
|
height: 80rpx;
|
}
|
|
.loopView {
|
height: 160px;
|
background-color: #f0f0f0;
|
margin-top: 10px;
|
}
|
|
.loopItem {
|
margin-top: 5px;
|
margin-left: 15px;
|
|
}
|
|
.deleteBtn {
|
margin-top: 25px;
|
margin-left: 10px;
|
width: 120px;
|
background-color: orangered;
|
}
|
</style>
|