<template>
|
<view>
|
<view class="form">
|
<view class="form-item">
|
<view class="title">单据号:</view>
|
<view class="righton">
|
<input name="HBillNo" disabled v-model="hform.HBillNo" placeholder="请输入单据号" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">单据日期:</view>
|
<view class="righton">
|
<input name="HDate" disabled v-model="hform.HDate" placeholder="请选择" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">出厂编号:</view>
|
<view class="right">
|
<input name="HOutComNo" v-model="hform.HOutComNo" placeholder="请输入出厂编号" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>条形码:</view>
|
<view class="right" style="width: 380rpx;">
|
<input name="HBarCode" v-model="hform.HBarCode" disabled placeholder="请扫描条码"/>
|
</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="tab_area"></view>
|
|
<view class="form-item">
|
<view class="title"><text>*</text>设备编号:</view>
|
<view class="right">
|
<input name="HEquipFileNo" v-model="hform.HEquipFileNo" placeholder="请输入设备编号" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>设备名称:</view>
|
<view class="right">
|
<input name="HName" v-model="hform.HName" placeholder="请输入设备名称" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>设备规格:</view>
|
<view class="right">
|
<input name="HModel" v-model="hform.HModel" placeholder="请输入设备规格" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">设备型号:</view>
|
<view class="right">
|
<input name="HModel2" v-model="hform.HModel2" placeholder="请输入设备型号" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>设备代码:</view>
|
<view class="right">
|
<input name="HEquipFileNumber" v-model="hform.HEquipFileNumber" placeholder="请输入设备代码" />
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item">
|
<view class="title">默认保养规程:</view>
|
<!-- <view class="right" style="width: 380rpx;">
|
<picker :range="arrayHEquipMaintainRuleInterName" v-model="hform.HEquipMaintainRuleInterName" @change="HEquipMaintainRuleInterNameChange">
|
<input name="HEquipMaintainRuleInterName" disabled v-model="hform.HEquipMaintainRuleInterName" placeholder="请选择默认保养规程" />
|
</picker>
|
</view>
|
<picker :range="arrayHEquipMaintainRuleInterName" v-model="hform.HEquipMaintainRuleInterName" @change="HEquipMaintainRuleInterNameChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
<view class="right">
|
<uni-combox :candidates="arrayHEquipMaintainRuleInterName" placeholder="请选择保养规程" v-model="hform.HEquipMaintainRuleInterName" @input="HEquipMaintainRuleInterNameChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">默认点检规程:</view>
|
<!-- <view class="right" style="width: 380rpx;">
|
<picker :range="arrayHEquipDotCheckRuleInterName" v-model="hform.HEquipDotCheckRuleInterName" @change="HEquipDotCheckRuleInterNameChange">
|
<input name="HEquipDotCheckRuleInterName" disabled v-model="hform.HEquipDotCheckRuleInterName" placeholder="请选择默认点检规程" />
|
</picker>
|
</view>
|
<picker :range="arrayHEquipDotCheckRuleInterName" v-model="hform.HEquipDotCheckRuleInterName" @change="HEquipDotCheckRuleInterNameChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
<view class="right">
|
<uni-combox :candidates="arrayHEquipDotCheckRuleInterName" placeholder="请选择点检规程" v-model="hform.HEquipDotCheckRuleInterName" @input="HEquipDotCheckRuleInterNameChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">生产资源:</view>
|
<!-- <view class="right" style="width: 380rpx;">
|
<picker :range="arrayHSourceName" v-model="hform.HSourceName" @change="HSourceNameChange">
|
<input name="HSourceName" disabled v-model="hform.HSourceName" placeholder="请选择生产资源" />
|
</picker>
|
</view>
|
<picker :range="arrayHSourceName" v-model="hform.HSourceName" @change="HSourceNameChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
<view class="right">
|
<uni-combox :candidates="arrayHSourceName" placeholder="请选择生产资源" v-model="hform.HSourceName" @input="HSourceNameChange"></uni-combox>
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item">
|
<view class="title"><text>*</text>对应ERP物料:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHMaterNumber" placeholder="请选择对应ERP物料" v-model="hform.HName" @input="HMaterNumberChange"></uni-combox>
|
</view>
|
<!-- <picker :range="arrayHMaterNumber" v-model="hform.HMaterNumber" @change="HMaterNumberChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>设备分类:</view>
|
<!-- <view class="right" style="width: 380rpx;">
|
<picker :range="arrayHEquipFileTypeName" v-model="hform.HEquipFileTypeName" @change="HEquipFileTypeNameChange">
|
<input name="HEquipFileTypeName" disabled v-model="hform.HEquipFileTypeName" placeholder="请选择设备分类" />
|
</picker>
|
</view>
|
<picker :range="arrayHEquipFileTypeName" v-model="hform.HEquipFileTypeName" @change="HEquipFileTypeNameChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
<view class="right">
|
<uni-combox :candidates="arrayHEquipFileTypeName" placeholder="请选择设备分类" v-model="hform.HEquipFileTypeName" @input="HEquipFileTypeNameChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>单位:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHUnitName" placeholder="请选择单位" v-model="hform.HUnitName" @input="HUnitNameChange"></uni-combox>
|
</view>
|
<!-- <picker :range="arrayHUnitName" v-model="hform.HUnitName" @change="HUnitNameChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>供应商:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHSellSupName" placeholder="请选择供应商" v-model="hform.HSellSupName" @input="HSellSupNameChange"></uni-combox>
|
</view>
|
<!-- <picker :range="arrayHSellSupName" v-model="hform.HSellSupName" @change="HSellSupNameChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
</view>
|
|
<view class="tab_area"></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>
|
<!-- <picker :range="arrayHDeptName" v-model="hform.HDeptName" @change="HDeptNameChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>使用负责人:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayEmpName" placeholder="请选择使用负责人" v-model="hform.HUseEmpName" @input="HUseEmpNameChange"></uni-combox>
|
</view>
|
<!-- <picker :range="arrayHUseEmpName" v-model="hform.HUseEmpName" @change="HUseEmpNameChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>维护负责人:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayEmpName" placeholder="请选择维护负责人" v-model="hform.HRepairEmpName" @input="HRepairEmpNameChange"></uni-combox>
|
</view>
|
<!-- <picker :range="arrayHRepairEmpName" v-model="hform.HRepairEmpName" @change="HRepairEmpNameChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
</view>
|
<view class="form-item">
|
<view class="title">制造商:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHSellSupName" placeholder="请选择制造商" v-model="hform.HMakeSupName" @input="HMakeSupNameChange"></uni-combox>
|
</view>
|
<!-- <picker :range="arrayHMakeSupName" v-model="hform.HMakeSupName" @change="HMakeSupNameChange">
|
<uni-icons type="list" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"></uni-icons>
|
</picker> -->
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item">
|
<view class="title">出厂日期:</view>
|
<view class="right">
|
<picker mode="date" v-model="hform.HOutComDate" @change="HOutComDateChange">
|
<input name="HOutComDate" disabled v-model="hform.HOutComDate" placeholder="请选择" />
|
<!-- <uni-icons type="calendar-filled" style="position: absolute;right: 10rpx;top: 6rpx;color: #3A78FF;" size="22"></uni-icons> -->
|
</picker>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">安装地点:</view>
|
<view class="right">
|
<input name="HAddress" v-model="hform.HAddress" placeholder="请输入安装地点" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">安装日期:</view>
|
<view class="right">
|
<picker mode="date" v-model="hform.HSetupDate" @change="HSetupDateChange">
|
<input name="HSetupDate" disabled v-model="hform.HSetupDate" placeholder="请选择" />
|
<!-- <uni-icons type="calendar-filled" style="position: absolute;right: 10rpx;top: 6rpx;color: #3A78FF;" size="22"></uni-icons> -->
|
</picker>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">运行开始日期:</view>
|
<view class="right">
|
<picker mode="date" v-model="hform.HStartupDate" @change="HStartupDateChange">
|
<input name="HStartupDate" disabled v-model="hform.HStartupDate" placeholder="请选择" />
|
<!-- <uni-icons type="calendar-filled" style="position: absolute;right: 10rpx;top: 6rpx;color: #3A78FF;" size="22"></uni-icons> -->
|
</picker>
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item">
|
<view class="title">工程编号:</view>
|
<view class="right">
|
<input name="HProNum" v-model="hform.HProNum" placeholder="请输入工程编号" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">产地:</view>
|
<view class="right">
|
<input name="HWorkArea" v-model="hform.HWorkArea" placeholder="请输入产地" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">品牌:</view>
|
<view class="right">
|
<input name="HLogo" v-model="hform.HLogo" placeholder="请输入品牌" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>设备状态:</view>
|
<view class="right">
|
<picker :range="arrayHStatus" v-model="hform.HStatus" @change="HStatusChange">
|
<input name="HStatus" disabled v-model="hform.HStatus" placeholder="请选择设备状态" />
|
</picker>
|
</view>
|
</view>
|
|
<view class="bottom-btn">
|
<button class="btn-a" size="mini" @tap="submit">提交</button>
|
<!-- <button class="btn-b" size="mini" @tap="showMask = true">新增</button> -->
|
<button class="btn-c" size="mini" @tap="goBack">退出</button>
|
</view>
|
</view>
|
</view>
|
</template>
|
<script>
|
import getDateTime from '@/utils/getdateTime.js';
|
export default {
|
data() {
|
return {
|
serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
|
arrayHEquipMaintainRuleInterName:[],//保养规程
|
HEquipMaintainRuleInterNameList:[],
|
arrayHEquipDotCheckRuleInterName:[],//点检
|
HEquipDotCheckRuleInterNameList:[],
|
arrayHSourceName:[],//生产资源
|
HSourceNameList:[],
|
|
arrayHMaterNumber:[],//ERP
|
HMaterNumberList:[],
|
arrayHEquipFileTypeName:[],//设备分类
|
HEquipFileTypeNameList:[],
|
arrayHUnitName:[],//单位
|
HUnitNameList:[],
|
arrayHSellSupName:[],//供应商
|
HSellSupNameList:[],
|
|
arrayHDeptName:[],//部门
|
HDeptNameList:[],
|
arrayEmpName:[],//使用/维护负责人
|
EmpNameList:[],
|
arrayHMakeSupName:[],
|
|
arrayHStatus:['空闲','占用','加工','关机','异常停机'],
|
|
isEdit: false,
|
hform:{
|
HBillNo:'',
|
HDate:getDateTime.dateTimeStr('y-m-d'),
|
HOutComNo:'',
|
HBarCode:'',
|
|
HEquipFileNumber:'',
|
HEquipFileNo:'',
|
HName:'',
|
HModel:'',
|
HModel2:'',
|
|
HEquipMaintainRuleInterName:'',
|
HEquipMaintainRuleInterID:0,
|
HEquipDotCheckRuleInterName:'',
|
HEquipDotCheckRuleInterID:0,
|
HSourceName:'',
|
HSourceID:'',
|
|
HMaterNumber:'',
|
HMaterID:'',
|
HEquipFileTypeName:'',
|
HEquipFileTypeID:'',
|
HUnitName:'',
|
HUnitID:'',
|
HSellSupName:'',
|
HSellSupID:'',
|
|
HDeptName:'',
|
HDeptID:'',
|
HUseEmpName:'',
|
HUseEmpID:'',
|
HRepairEmpName:'',
|
HRepairEmpID:'',
|
HMakeSupName:'',
|
HMakeSupID:'',
|
|
HOutComDate:'',
|
HAddress:'',
|
HSetupDate:'',
|
HStartupDate:'',
|
|
HProNum:'',
|
HWorkArea:'',
|
HLogo:'',
|
HStatus:'空闲',
|
}
|
}
|
},
|
onLoad(e) {
|
// this.getEditData(58)
|
if(e.hmainid){
|
this.isEdit = true
|
this.getEditData(e.hmainid)
|
}else{
|
this.getNewData()
|
}
|
this.getHEquipMaintainRuleInterList()
|
this.getHEquipDotCheckRuleInterList()
|
this.getHSourceList()
|
|
this.getHMaterList()
|
this.getHEquipFileTypeList()
|
this.getHUnitList()
|
this.getHSellSupList()
|
|
this.getHDeptList()
|
this.getEmpList()
|
},
|
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
|
// uni.request({
|
// url: this.serverUrl + '/Gy_EquipFileMain/Gy_MouldFileBillBarCodeInfo',
|
// data: { HBarCode: ret.resp_result },
|
// success: (res) => {
|
// console.log(res.data);
|
// var data = res.data.list[0][0]
|
// if(res.data.count == 1){
|
// this.hform.HEquipID = data.hmainid
|
// this.hform.HEquipName = data.设备名称
|
// }
|
// uni.showToast({
|
// title:res.data.Message,
|
// icon:'none'
|
// })
|
// },
|
// fail: (res) => {
|
// console.log(res);
|
// uni.showToast({
|
// title:'接口请求失败',
|
// icon:'none'
|
// })
|
// },
|
// });
|
})
|
},
|
// upCode(){
|
// uni.request({
|
// url: this.serverUrl + '/Sb_PDA_EqpRepairWorkBill/txtHBarCode_KeyDown',
|
// data: { HBarCode: this.hform.HBarCode },
|
// success: (res) => {
|
// if(res.data.count == 1){
|
// var data = res.data.data[0]
|
// this.hform.HEquipID = data.HItemID
|
// this.hform.HBarName = data.HName
|
// this.hform.HBarSpec = data.HModel
|
// this.hform.HBarModel = data.HModel2
|
// }else{
|
// uni.showToast({
|
// title:res.data.Message,
|
// icon:'none'
|
// })
|
// }
|
// },
|
// fail: (res) => {
|
// console.log(res);
|
// uni.showToast({
|
// title:'接口请求失败',
|
// icon:'none'
|
// })
|
// },
|
// });
|
// },
|
|
//选择单据日期
|
HDateChange(e){
|
console.log(e.detail.value)
|
this.hform.HDate = e.detail.value
|
},
|
//选择出厂日期
|
HOutComDateChange(e){
|
console.log(e.detail.value)
|
this.hform.HOutComDate = e.detail.value
|
},
|
//选择出厂日期
|
HSetupDateChange(e){
|
console.log(e.detail.value)
|
this.hform.HSetupDate = e.detail.value
|
},
|
//选择出厂日期
|
HStartupDateChange(e){
|
console.log(e.detail.value)
|
this.hform.HStartupDate = e.detail.value
|
},
|
|
//获取保养规程数据
|
getHEquipMaintainRuleInterList(){
|
uni.request({
|
url: this.serverUrl + '/Sb_EquipMaintainRuleBill/GetEquipMaintainRuleList',
|
data: { sWhere: '', user: uni.getStorageSync('HUserName') },
|
success: (res) => {
|
if(res.data.count == 1){
|
this.HEquipMaintainRuleInterNameList = res.data.data
|
for(var i=0;i<res.data.data.length;i++){
|
this.arrayHEquipMaintainRuleInterName[i] = res.data.data[i].单据号
|
}
|
this.$forceUpdate();
|
}else{
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
//选择保养规程
|
HEquipMaintainRuleInterNameChange(e){
|
for(var i=0;i<this.HEquipMaintainRuleInterNameList.length;i++){
|
if(this.HEquipMaintainRuleInterNameList[i].单据号 == e){
|
this.hform.HEquipMaintainRuleInterID = this.HEquipMaintainRuleInterNameList[i].hmainid
|
}
|
}
|
},
|
//获取点检规程数据
|
getHEquipDotCheckRuleInterList(){
|
uni.request({
|
url: this.serverUrl + '/Sb_EquipDotCheckRuleBill/GetEquipDotCheckRuleList',
|
data: { sWhere: '', user: uni.getStorageSync('HUserName') },
|
success: (res) => {
|
if(res.data.count == 1){
|
this.HEquipDotCheckRuleInterNameList = res.data.data
|
for(var i=0;i<res.data.data.length;i++){
|
this.arrayHEquipDotCheckRuleInterName[i] = res.data.data[i].单据号
|
}
|
this.$forceUpdate();
|
}else{
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
//选择点检规程
|
HEquipDotCheckRuleInterNameChange(e){
|
for(var i=0;i<this.HEquipDotCheckRuleInterNameList.length;i++){
|
if(this.HEquipDotCheckRuleInterNameList[i].单据号 == e){
|
this.hform.HEquipDotCheckRuleInterID = this.HEquipDotCheckRuleInterNameList[i].hmainid
|
}
|
}
|
},
|
//获取生产资源数据
|
getHSourceList(){
|
uni.request({
|
url: this.serverUrl + '/Gy_Source/list',
|
data: { sWhere: '', user: uni.getStorageSync('HUserName') },
|
success: (res) => {
|
if(res.data.count == 1){
|
this.HSourceNameList = res.data.data
|
for(var i=0;i<res.data.data.length;i++){
|
this.arrayHSourceName[i] = res.data.data[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
|
}
|
}
|
},
|
|
//获取ERP物料数据
|
getHMaterList(){
|
uni.request({
|
url: this.serverUrl + '/PublicPageMethod/PartList',
|
data: { sWhere: '' },
|
success: (res) => {
|
// console.log(1,res.data.data);
|
if(res.data.count == 1){
|
this.HMaterNumberList = res.data.data
|
for(var i=0;i<res.data.data.length;i++){
|
this.arrayHMaterNumber[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'
|
})
|
},
|
});
|
},
|
//选择ERP物料
|
HMaterNumberChange(e){
|
for(var i=0;i<this.HMaterNumberList.length;i++){
|
if(this.HMaterNumberList[i].HName == e){
|
this.hform.HMaterNumber = this.HMaterNumberList[i].HNumber
|
this.hform.HMaterID = this.HMaterNumberList[i].HItemID
|
}
|
}
|
// console.log(e,this.hform)
|
},
|
//获取设备分类数据
|
getHEquipFileTypeList(){
|
uni.request({
|
url: this.serverUrl + '/Gy_EquipType/GetList',
|
data: { sWhere: '', user: uni.getStorageSync('HUserName') },
|
success: (res) => {
|
if(res.data.count == 1){
|
this.HEquipFileTypeNameList = res.data.data
|
for(var i=0;i<res.data.data.length;i++){
|
this.arrayHEquipFileTypeName[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'
|
})
|
},
|
});
|
},
|
//选择设备分类
|
HEquipFileTypeNameChange(e){
|
for(var i=0;i<this.HEquipFileTypeNameList.length;i++){
|
if(this.HEquipFileTypeNameList[i].HName == e){
|
this.hform.HEquipFileTypeID = this.HEquipFileTypeNameList[i].HItemID
|
}
|
}
|
},
|
//获取单位数据
|
getHUnitList(){
|
uni.request({
|
url: this.serverUrl + '/PublicPageMethod/UnitList',
|
data: { sWhere: '' },
|
success: (res) => {
|
if(res.data.count == 1){
|
this.HUnitNameList = res.data.data
|
for(var i=0;i<res.data.data.length;i++){
|
this.arrayHUnitName[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'
|
})
|
},
|
});
|
},
|
//选择单位
|
HUnitNameChange(e){
|
for(var i=0;i<this.HUnitNameList.length;i++){
|
if(this.HUnitNameList[i].HName == e){
|
this.hform.HUnitID = this.HUnitNameList[i].HItemID
|
}
|
}
|
},
|
//获取供应商/制造商数据
|
getHSellSupList(){
|
uni.request({
|
url: this.serverUrl + '/PublicPageMethod/SupplierList',
|
data: { sWhere: '' },
|
success: (res) => {
|
if(res.data.count == 1){
|
this.HSellSupNameList = res.data.data
|
for(var i=0;i<res.data.data.length;i++){
|
this.arrayHSellSupName[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'
|
})
|
},
|
});
|
},
|
//选择供应商
|
HSellSupNameChange(e){
|
for(var i=0;i<this.HSellSupNameList.length;i++){
|
if(this.HSellSupNameList[i].HName == e){
|
this.hform.HSellSupID = this.HSellSupNameList[i].HItemID
|
}
|
}
|
},
|
//选择制造商
|
HMakeSupNameChange(e){
|
for(var i=0;i<this.HSellSupNameList.length;i++){
|
if(this.HSellSupNameList[i].HName == e){
|
this.hform.HMakeSupID = this.HSellSupNameList[i].HItemID
|
}
|
}
|
},
|
|
//获取使用部门数据
|
getHDeptList(){
|
uni.request({
|
url: this.serverUrl + '/PublicPageMethod/DeptList',
|
data: { sWhere: '' },
|
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
|
}
|
}
|
},
|
//获取使用/维护负责人数据
|
getEmpList(){
|
uni.request({
|
url: this.serverUrl + '/PublicPageMethod/UserList',
|
data: { sWhere: '' },
|
success: (res) => {
|
if(res.data.count == 1){
|
this.EmpNameList = res.data.data
|
for(var i=0;i<res.data.data.length;i++){
|
this.arrayEmpName[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'
|
})
|
},
|
});
|
},
|
//选择使用负责人
|
HUseEmpNameChange(e){
|
for(var i=0;i<this.EmpNameList.length;i++){
|
if(this.EmpNameList[i].HName == e){
|
this.hform.HUseEmpID = this.EmpNameList[i].HItemID
|
}
|
}
|
},
|
//选择维护负责人
|
HRepairEmpNameChange(e){
|
for(var i=0;i<this.EmpNameList.length;i++){
|
if(this.EmpNameList[i].HName == e){
|
this.hform.HRepairEmpID = this.EmpNameList[i].HItemID
|
}
|
}
|
},
|
|
//设备状态选择
|
HStatusChange(e){
|
console.log(e.detail.value)
|
this.hform.HStatus = this.arrayHStatus[e.detail.value]
|
},
|
|
|
//编辑
|
getEditData(hmainid){
|
//主表
|
uni.request({
|
url: this.serverUrl + '/Gy_EquipFileMain/Gy_EquipFileCheckDetai',
|
data: { HInterID: hmainid },
|
success: (res) => {
|
console.log(1,res.data.data[0]);
|
if(res.data.code == 1){
|
var data = res.data.data[0]
|
this.hform = {
|
HInterID:hmainid,
|
HBillNo:data.单据号,
|
HDate:data.日期.substr(0,10),
|
HOutComNo:data.设备出厂编号,
|
HBarCode:data.条形码,
|
|
HEquipFileNumber:data.设备代码,
|
HEquipFileNo:data.设备编码,
|
HName:data.设备名称,
|
HModel:data.设备规格,
|
HModel2:data.设备型号,
|
|
HEquipMaintainRuleInterName:data.默认保养规程,
|
HEquipMaintainRuleInterID:data.HEquipMaintainRuleInterID,
|
HEquipDotCheckRuleInterName:data.默认点检规程,
|
HEquipDotCheckRuleInterID:data.HEquipDotCheckRuleInterID,
|
HSourceName:data.HSourceName,
|
HSourceID:data.HSourceID,
|
|
HMaterNumber:data.物料名称,
|
HMaterID:data.HMaterID,
|
HEquipFileTypeName:data.设备类型,
|
HEquipFileTypeID:data.HEquipFileTypeID,
|
HUnitName:data.单位,
|
HUnitID:data.HUnitID,
|
HSellSupName:data.供应商,
|
HSellSupID:data.HSellSupID,
|
|
HDeptName:data.使用部门,
|
HDeptID:data.HDeptID,
|
HUseEmpName:data.使用负责人,
|
HUseEmpID:data.HUseEmpID,
|
HRepairEmpName:data.维护负责人,
|
HRepairEmpID:data.HRepairEmpID,
|
HMakeSupName:data.制造商,
|
HMakeSupID:data.HMakeSupID,
|
|
HOutComDate:data.设备出厂日期.substr(0,10),
|
HAddress:data.安装地点,
|
HSetupDate:data.安装日期.substr(0,10),
|
HStartupDate:data.运行开始日期.substr(0,10),
|
|
HProNum:data.工程编码,
|
HWorkArea:data.产地,
|
HLogo:data.品牌,
|
HStatus:data.当前状态,
|
}
|
}else{
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
//子表
|
uni.request({
|
url: this.serverUrl + '/Sb_EquipMaintainBill/Sb_EquipMaintainBillListProjectDetaiNew',
|
data: { HInterID: hmainid },
|
success: (res) => {
|
if(res.data.count == 1){
|
this.form1List = res.data.list[0];
|
console.log(2,res.data.list[0]);
|
}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: '3308' },
|
success: (res) => {
|
console.log(res.data)
|
if(res.data.count == 1){
|
this.hform.HInterID = 0
|
this.hform.HBillNo = res.data.data[0].HBillNo
|
}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.HEquipFileNo){
|
uni.showToast({
|
title:'请输入设备编号',
|
icon:'none'
|
})
|
}else if(!this.hform.HName){
|
uni.showToast({
|
title:'请输入设备名称',
|
icon:'none'
|
})
|
}else if(!this.hform.HModel){
|
uni.showToast({
|
title:'请输入设备规格',
|
icon:'none'
|
})
|
}else if(!this.hform.HEquipFileNumber){
|
uni.showToast({
|
title:'请输入设备代码',
|
icon:'none'
|
})
|
}else if(!this.hform.HMaterID){
|
uni.showToast({
|
title:'请选择对应ERP物料',
|
icon:'none'
|
})
|
}else if(!this.hform.HEquipFileTypeID){
|
uni.showToast({
|
title:'请选择设备分类',
|
icon:'none'
|
})
|
}else if(!this.hform.HUnitID){
|
uni.showToast({
|
title:'请选择单位',
|
icon:'none'
|
})
|
}else if(!this.hform.HSellSupID){
|
uni.showToast({
|
title:'请选择供应商',
|
icon:'none'
|
})
|
}else if(!this.hform.HDeptID){
|
uni.showToast({
|
title:'请选择使用部门',
|
icon:'none'
|
})
|
}else if(!this.hform.HUseEmpID){
|
uni.showToast({
|
title:'请选择使用负责人',
|
icon:'none'
|
})
|
}else if(!this.hform.HRepairEmpID){
|
uni.showToast({
|
title:'请选择维护负责人',
|
icon:'none'
|
})
|
}else if(!this.hform.HStatus){
|
uni.showToast({
|
title:'请选择设备状态',
|
icon:'none'
|
})
|
}else{
|
uni.showLoading({
|
title:'请稍候'
|
})
|
var ModRightNameAdd = 'Gy_MouldFile_Edit';
|
if(this.isEdit){
|
this.hform.HUpDater = uni.getStorageSync('HUserName');//修改人
|
var sMainStr = JSON.stringify(this.hform);
|
var sMainSub = sMainStr + ";" + ModRightNameAdd + ";" + uni.getStorageSync('HUserName');
|
var urls = '/Gy_EquipFileMain/EditBill'
|
}else{
|
this.hform.HMaker = uni.getStorageSync('HUserName');//制单人
|
var sMainStr = JSON.stringify(this.hform);
|
var sMainSub = sMainStr + ";" + ModRightNameAdd + ";" + uni.getStorageSync('HUserName');
|
var urls = '/Gy_EquipFileMain/AddBill'
|
}
|
console.log(sMainSub);
|
uni.request({
|
url: this.serverUrl + urls,
|
method:'POST',
|
dataType:"json",
|
data:{ oMain: sMainSub },
|
success: (res) => {
|
console.log(1,res);
|
uni.hideLoading()
|
if(res.data.count == 1){
|
let pages = getCurrentPages();
|
let prePage = pages[pages.length - 2];
|
prePage.$vm.getList()
|
setTimeout(()=>{
|
uni.navigateBack()
|
},1000)
|
}
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
}
|
},
|
goBack(){
|
uni.navigateBack()
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.form{
|
width: 668rpx;
|
margin: 20rpx auto;
|
padding-bottom: 240rpx;
|
}
|
.tab_area{
|
width: 100%;
|
height: 50rpx;
|
}
|
.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;
|
margin-left: 30rpx;
|
}
|
.btn-c{
|
background-color: #acacac;
|
color: #fff;
|
position: absolute;
|
right: 120rpx;
|
}
|
}
|
</style>
|