<template>
|
<view>
|
<view class="form">
|
<view class="form-item">
|
<view class="title"><text>*</text>条形码:</view>
|
<view class="right" style="width: 380rpx;">
|
<input v-model="hform.HBarCode" placeholder="请扫描条码" @blur="getHBarCodeData(hform.HBarCode)" />
|
</view>
|
<uni-icons type="scan"
|
style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
|
size="20" @click="toScanCode"></uni-icons>
|
</view>
|
<view class="form-item">
|
<view class="title">单据号:</view>
|
<view class="righton">
|
<input name="HBillNo" disabled v-model="hform.HBillNo" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">单据日期:</view>
|
<view class="right">
|
<picker mode="date" v-model="hform.HDate" @change="HDateChange">
|
<input disabled v-model="hform.HDate" placeholder="请选择日期" />
|
</picker>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>部门:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHDeptName" placeholder="请选择部门" v-model="hform.HDeptName"
|
@input="HDeptNameChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>操作员:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHEmpName" placeholder="请选择操作员" v-model="hform.HEmpName"
|
@input="HEmpNameChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>负责人:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHEmpName" placeholder="请选择负责人" v-model="hform.HMangerName"
|
@input="HManagerNameChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">生产资源:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHSourceName" placeholder="请选择生产资源" v-model="hform.HSourceName"
|
@input="HSourceNameChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">模具编码:</view>
|
<view class="righton">
|
<input name="HMouldNumber" v-model="hform.HMouldNumber" disabled placeholder="请输入器具编码" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">模具名称:</view>
|
<view class="righton">
|
<input name="HMouldName" v-model="hform.HMouldName" disabled placeholder="请输入器具名称" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">模具型号:</view>
|
<view class="righton">
|
<input name="HMouldModel" v-model="hform.HMouldModel" disabled placeholder="请输入器具型号" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">数量:</view>
|
<view class="righton">
|
<input name="HQty" v-model="hform.HQty" disabled placeholder="请输入数量" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">下模时间:</view>
|
<view class="righton">
|
<input name="HScanDate" disabled v-model="hform.HScanDate" placeholder="请选择" />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="title">生产订单:</view>
|
<view class="righton">
|
<input name="HICMOBillNo" disabled v-model="hform.HICMOBillNo" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">流转卡:</view>
|
<view class="righton">
|
<input disabled v-model="hform.HProcExchBillNo" />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="title">备注:</view>
|
<view class="right">
|
<textarea name="HRemark" v-model="hform.HRemark" auto-height placeholder="请输入备注"></textarea>
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view v-if="showmore">
|
<view class="form-item">
|
<view class="title">制单人:</view>
|
<view class="righton">
|
<input v-model="hform.HMaker" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">制单日期:</view>
|
<view class="righton">
|
<input v-if="hform.HMakeDate" v-model="hform.HMakeDate.substr(0,10)" disabled />
|
<input v-else v-model="hform.HMakeDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">修改人:</view>
|
<view class="righton">
|
<input v-model="hform.HUpDater" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">修改日期:</view>
|
<view class="righton">
|
<input v-if="hform.HUpDateDate" v-model="hform.HUpDateDate.substr(0,10)" disabled />
|
<input v-else v-model="hform.HUpDateDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">审核人:</view>
|
<view class="righton">
|
<input v-model="hform.HChecker" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">审核日期:</view>
|
<view class="righton">
|
<input v-if="hform.HCheckDate" v-model="hform.HCheckDate.substr(0,10)" disabled />
|
<input v-else v-model="hform.HCheckDate" disabled />
|
</view>
|
</view>
|
|
</view>
|
<view class="other">
|
<view v-if="!showmore" @tap="showmore = true">
|
展开其他信息<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="bottom"></uni-icons>
|
</view>
|
<view v-if="showmore" @tap="showmore = false">
|
折叠其他信息<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="top"></uni-icons>
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="bottom-btn">
|
<button v-if="btnType == 1 && !isEdit" class="btn-a" size="mini" @tap="submit">提交</button>
|
<button v-if="btnType != 1 && !isEdit" class="btn-a" size="mini" @tap="ifEdit">修改</button>
|
<button v-if="btnType != 1 && isEdit" class="btn-a" size="mini" @tap="submit">提交</button>
|
<button class="btn-c" size="mini" @tap="goBack">退出</button>
|
</view>
|
</view>
|
|
</view>
|
</template>
|
<script>
|
import getDateTime from '@/utils/getdateTime.js';
|
import {
|
getUserInfo
|
} from "@/utils/auth.js";
|
export default {
|
data() {
|
return {
|
userInfo: getUserInfo(),
|
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
|
linterid: '',
|
HBillNo: '',
|
btnType: 1, //1新增,3修改
|
showmore: false,
|
|
arrayHDeptName: [], //部门
|
HDeptNameList: [],
|
arrayHEmpName: [], //发现人/负责人
|
HEmpNameList: [],
|
arrayHSourceName: [], //生产资源
|
HSourceNameList: [],
|
|
|
isEdit: false,
|
hform: {
|
HInterID: '',
|
HBillNo: '',
|
HDate: getDateTime.dateTimeStr('y-m-d'),
|
HBarCode: '',
|
HDeptName: uni.getStorageSync('HDeptName'),
|
HDeptID: uni.getStorageSync('HDeptID'),
|
HEmpName: uni.getStorageSync('HEmpName'),
|
HEmpID: uni.getStorageSync('HEmpID'),
|
HMangerName: uni.getStorageSync('HMangerName'),
|
HMangerID: uni.getStorageSync('HMangerID'),
|
|
|
HSourceName: '',
|
HSourceID: '',
|
HMouldNumber: '',
|
HMouldID: '',
|
HMouldName: '',
|
HMouldModel: '',
|
HQty: '',
|
HScanDate: getDateTime.dateTimeStr('y-m-d h:i:s'),
|
HICMOBillNo: '',
|
HICMOInterID: '',
|
HICMOEntryID: '',
|
HProcExchBillNo: '',
|
HProcExchInterID: '',
|
HProcExchEntryID: '',
|
HOrgID: uni.getStorageSync('OrganizationID'),
|
|
HMaker: '',
|
HMakeDate: '',
|
HUpDater: '',
|
HUpDateDate: '',
|
HChecker: '',
|
HCheckDate: '',
|
HCloseMan: '',
|
HCloseDate: '',
|
HDeleteMan: '',
|
HDeleteDate: '',
|
|
eventType: 'Add'
|
}
|
}
|
},
|
onLoad(e) {
|
|
this.hform.HMaker = uni.getStorageSync('HUserName')
|
console.log(e, this.userInfo)
|
if (e.linterid) {
|
this.btnType = 3
|
this.linterid = e.linterid
|
this.HBillNo = e.HBillNo
|
this.getEditData(e.linterid, e.HBillNo)
|
} else {
|
this.getNewData()
|
}
|
|
this.getHDeptList()
|
this.getHEmpList()
|
this.getHSourceList()
|
},
|
methods: {
|
//扫码
|
toScanCode() {
|
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
mpaasScanModule.mpaasScan({
|
'hideAlbum': true,
|
'timeoutInterval': '10', //超时时间
|
'timeoutText': '未识别到二维码' //超时提醒
|
}, (ret) => {
|
console.log(ret.resp_result)
|
this.hform.HBarCode = ret.resp_result
|
this.getHBarCodeData(ret.resp_result)
|
})
|
},
|
//日期
|
HDateChange(e) {
|
console.log(e.detail.value)
|
this.hform.HDate = e.detail.value
|
},
|
getHBarCodeData(HBarCode) {
|
var sWhere = " and 条形码='" + this.hform.HBarCode + "' order by 制单日期 desc"
|
uni.request({
|
url: this.serverUrl + '/Sc_MouldLowerBill/Sc_MouldUpperBillList',
|
data: {
|
sWhere: sWhere
|
},
|
success: (res) => {
|
console.log(2, res.data);
|
if (res.data.code == 1) {
|
var data = res.data.data[0];
|
console.log(3, data);
|
this.hform.HProcExchBillNo = data.HProcExchBillNo;
|
this.hform.HProcExchInterID = data.HProcExchInterID;
|
this.hform.HProcExchEntryID = data.HProcExchEntryID;
|
this.hform.HICMOBillNo = data.HICMOBillNo;
|
this.hform.HICMOInterID = data.HICMOInterID;
|
this.hform.HICMOEntryID = data.HICMOEntryID;
|
this.hform.HSourceID = data.HSourceID;
|
this.hform.HSourceName = data.生产资源;
|
this.hform.HMouldID = data.HMouldID;
|
this.hform.HMouldNumber = data.模具编码;
|
this.hform.HMouldName = data.模具名称;
|
this.hform.HMouldModel = data.模具规格;
|
this.hform.HQty = 1;
|
|
if (data['负责人']) {
|
this.hform.HEmpName = data['负责人']
|
this.HEmpNameChange(data['负责人'])
|
// let index = this.arrayHEmpName.findIndex(item => item == data['负责人'])
|
|
}
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
//获取使用部门数据
|
getHDeptList() {
|
uni.request({
|
url: this.serverUrl + '/PublicPageMethod/DeptList',
|
data: {
|
sWhere: "where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + uni.getStorageSync(
|
'OrganizationID') + ""
|
},
|
success: (res) => {
|
if (res.data.count == 1) {
|
this.HDeptNameList = res.data.data
|
for (var i = 0; i < res.data.data.length; i++) {
|
this.arrayHDeptName[i] = res.data.data[i].HName
|
}
|
this.$forceUpdate();
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
//选择使用部门
|
HDeptNameChange(e) {
|
for (var i = 0; i < this.HDeptNameList.length; i++) {
|
if (this.HDeptNameList[i].HName == e) {
|
this.hform.HDeptID = this.HDeptNameList[i].HItemID
|
}
|
}
|
},
|
//操作员、负责人
|
getHEmpList() {
|
uni.request({
|
url: this.serverUrl + '/Web/GetEmployeeList_Json',
|
data: {
|
Employee: '',
|
HGroupID: 0,
|
HDeptID: getUserInfo()["HDeptID"] || -1
|
},
|
success: (res) => {
|
if (res.data.count == 1) {
|
this.HEmpNameList = res.data.data
|
for (var i = 0; i < res.data.data.length; i++) {
|
this.arrayHEmpName[i] = res.data.data[i].HName
|
}
|
this.$forceUpdate();
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
//选择操作员
|
HEmpNameChange(e) {
|
console.log('e: ', e);
|
for (var i = 0; i < this.HEmpNameList.length; i++) {
|
if (this.HEmpNameList[i].HName == e) {
|
this.hform.HEmpID = this.HEmpNameList[i].HItemID
|
}
|
}
|
},
|
//选择负责人
|
HManagerNameChange(e) {
|
for (var i = 0; i < this.HEmpNameList.length; i++) {
|
if (this.HEmpNameList[i].HName == e) {
|
this.hform.HMangerID = this.HEmpNameList[i].HItemID
|
}
|
}
|
},
|
//生产资源
|
getHSourceList() {
|
uni.request({
|
url: this.serverUrl + '/api/newBill/getSourceList',
|
data: {
|
sWhere: ''
|
},
|
success: (res) => {
|
if (res.data.code == 1) {
|
this.HSourceNameList = res.data.data.Gy_Source
|
for (var i = 0; i < res.data.data.Gy_Source.length; i++) {
|
this.arrayHSourceName[i] = res.data.data.Gy_Source[i].生产资源
|
}
|
this.$forceUpdate();
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
//选择生产资源
|
HSourceNameChange(e) {
|
for (var i = 0; i < this.HSourceNameList.length; i++) {
|
if (this.HSourceNameList[i].生产资源 == e) {
|
this.hform.HSourceID = this.HSourceNameList[i].HItemID
|
}
|
}
|
},
|
ifEdit() {
|
this.isEdit = true
|
this.hform.eventType = 'Modify'
|
},
|
//编辑回显
|
getEditData(linterid, HBillNo) {
|
//主表
|
var sWhere = " and hmainid='" + linterid + "'";
|
uni.request({
|
url: this.serverUrl + '/Sc_MouldUpperBill/Sc_MouldLowerBillList',
|
data: {
|
sWhere: sWhere,
|
user: uni.getStorageSync('HUserName')
|
},
|
success: (res) => {
|
console.log(1, res.data.data[0]);
|
if (res.data.code == 1) {
|
var data = res.data.data[0]
|
this.btnType = 3
|
this.hform.HInterID = data.hmainid
|
this.hform.HBillNo = data.单据号
|
this.hform.HBarCode = data.条形码
|
this.hform.HDeptID = data.HDeptID
|
this.hform.HDeptName = data.部门
|
this.hform.HEmpID = data.HEmpID
|
this.hform.HEmpName = data.操作员
|
this.hform.HMangerID = data.HMangerID
|
this.hform.HMangerName = data.负责人
|
this.hform.HRemark = data.表头备注
|
this.hform.HDate = data.日期.substr(0, 10)
|
|
this.hform.HSourceID = data.HSourceID,
|
this.hform.HSourceName = data.生产资源,
|
this.hform.HMouldID = data.HMouldID,
|
this.hform.HMouldNumber = data.模具编码,
|
this.hform.HMouldName = data.模具名称,
|
this.hform.HMouldModel = data.模具规格,
|
this.hform.HQty = data.数量,
|
this.hform.HScanDate = data.下模扫码时间,
|
this.hform.HICMOBillNo = data.HICMOBillNo,
|
this.hform.HICMOInterID = data.HICMOInterID,
|
this.hform.HICMOEntryID = data.HICMOEntryID,
|
this.hform.HProcExchBillNo = data.HProcExchBillNo,
|
this.hform.HProcExchInterID = data.HProcExchInterID,
|
this.hform.HProcExchEntryID = data.HProcExchEntryID,
|
this.hform.HOrgID = data.HOrgID,
|
|
this.hform.HMaker = data.制单人
|
this.hform.HMakeDate = data.制单日期
|
this.hform.HUpDater = data.修改人
|
this.hform.HUpDateDate = data.修改日期
|
this.hform.HChecker = data.审核人
|
this.hform.HCheckDate = data.审核日期
|
this.hform.HDeleteMan = data.作废人
|
this.hform.HDeleteDate = data.作废日期
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
//新增
|
getNewData() {
|
uni.request({
|
url: this.serverUrl + '/Web/GetMAXNum',
|
data: {
|
HBillType: '3847'
|
},
|
success: (res) => {
|
console.log(res.data)
|
if (res.data.count == 1) {
|
this.hform.HInterID = res.data.data[0].HInterID
|
this.hform.HBillNo = res.data.data[0].HBillNo
|
this.hform.HMakeDate = getDateTime.dateTimeStr('y-m-d')
|
this.btnType = 1
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
submit() {
|
if (!this.hform.HBarCode) {
|
uni.showToast({
|
title: '请扫描模具条形码',
|
icon: 'none'
|
})
|
} else if (!this.hform.HSourceName) {
|
uni.showToast({
|
title: '请选择生产资源',
|
icon: 'none'
|
})
|
} else if (!this.hform.HMouldName) {
|
uni.showToast({
|
title: '模具不能为空',
|
icon: 'none'
|
})
|
} else if (!this.hform.HEmpName) {
|
uni.showToast({
|
title: '请选择操作员',
|
icon: 'none'
|
})
|
} else if (!this.hform.HMangerName) {
|
uni.showToast({
|
title: '请选择负责人',
|
icon: 'none'
|
})
|
} else {
|
uni.showLoading({
|
title: '请稍候'
|
})
|
var sMainStr = JSON.stringify(this.hform);
|
var sMainSub = sMainStr + ";" + uni.getStorageSync('HUserName') + ";" + this.btnType;
|
console.log(sMainSub);
|
uni.request({
|
url: this.serverUrl + '/Sc_MouldUpperBill/AddSc_MouldLowerBill_PDA',
|
method: 'POST',
|
dataType: "json",
|
data: {
|
oMain: sMainSub
|
},
|
success: (res) => {
|
console.log(1, res);
|
uni.hideLoading()
|
if (res.data.count == 1) {
|
|
uni.showModal({
|
title: "提示",
|
content: res.data.Message + "。是否继续新增?",
|
success: (res) => {
|
if (res.confirm) {
|
console.log("用户点击确定");
|
uni.redirectTo({
|
url: "/pages/MJGL/xiamodan/MouldLowerBill",
|
});
|
} else if (res.cancel) {
|
console.log("用户点击取消");
|
setTimeout(() => {
|
uni.navigateBack();
|
}, 50)
|
}
|
},
|
});
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
}
|
},
|
goBack() {
|
uni.showModal({
|
title: '提示',
|
content: '确认要退出当前页面吗?',
|
success: (res) => {
|
if (res.confirm) {
|
console.log('用户点击确定');
|
uni.navigateBack()
|
} else if (res.cancel) {
|
console.log('用户点击取消');
|
}
|
}
|
});
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.form {
|
width: 668rpx;
|
margin: 20rpx auto;
|
padding-bottom: 240rpx;
|
}
|
|
.tab_area {
|
width: 100%;
|
height: 50rpx;
|
}
|
|
.other {
|
margin-top: 8rpx;
|
text-align: center;
|
font-size: 28rpx;
|
padding: 4rpx 18rpx;
|
color: #1890FF;
|
}
|
|
.form-item {
|
display: flex;
|
align-items: center;
|
font-size: 30rpx;
|
padding: 6rpx 0;
|
|
.title {
|
width: 208rpx;
|
|
text {
|
color: red;
|
font-weight: bold;
|
}
|
}
|
|
.right {
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
}
|
|
.righton {
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #e4e4e4;
|
background-color: #e4e4e4;
|
}
|
|
input {
|
width: 100%;
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
}
|
|
textarea {
|
width: 98%;
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
}
|
|
}
|
|
.bottom-btn {
|
width: 100%;
|
// height: 120rpx;
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
background-color: #fff;
|
box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4);
|
padding: 30rpx 40rpx 40rpx 40rpx;
|
|
button {
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
}
|
|
.btn-a {
|
background-color: #3A78FF;
|
color: #fff;
|
}
|
|
.btn-b {
|
background-color: #41a863;
|
color: #fff;
|
}
|
|
.btn-c {
|
background-color: #acacac;
|
color: #fff;
|
position: absolute;
|
right: 120rpx;
|
}
|
|
.btn-d {
|
background-color: #ff8901;
|
color: #fff;
|
}
|
}
|
</style>
|