<template>
|
<view>
|
<view class="tabs" id="tabs">
|
<view :class="tabs == 0 ? 'on':''" @tap="tabs = 0">基本信息</view>
|
<!-- <view :class="tabs == 1 ? 'on':''" @tap="tabs = 1">明细信息</view> -->
|
<view :class="tabs == 2 ? 'on':''" @tap="tabs = 2">其他信息</view>
|
<!-- <view :class="tabs == 3 ? 'on':''" @tap="tabs = 3">附件信息</view> -->
|
</view>
|
<!-- 基本信息 -->
|
<template v-if="tabs == 0">
|
<view class="form" :style="{
|
height: containerHeight + 'px',
|
overflow: 'auto'
|
}">
|
<view class="form-item">
|
<view class="title">单据号:</view>
|
<view class="righton">
|
<input disabled v-model="hform.HBillNo" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">日期:</view>
|
<view class="righton">
|
<input disabled v-model="hform.HDate" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title required">设备:</view>
|
<!-- <zxz-uni-data-select required class="right" :localdata="HDeptList" dataKey="部门名称"
|
dataValue="HItemID" v-model="hform.HEquipName">
|
|
</zxz-uni-data-select> -->
|
<view class="righton">
|
<input disabled v-model="hform.HEquipName" placeholder="" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title required">关联主设备:</view>
|
<!-- <zxz-uni-data-select required class="right" :localdata="HEmpList" dataKey="HName"
|
dataValue="HItemID" v-model="hform.HEquipRelationName">
|
|
</zxz-uni-data-select> -->
|
<view class="righton">
|
<input disabled v-model="hform.HEquipRelationName" placeholder="" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title required">开机人:</view>
|
<!-- <zxz-uni-data-select required class="right" :localdata="HEmpList" dataKey="HName"
|
dataValue="HItemID" v-model="hform.HBeginEmpName">
|
|
</zxz-uni-data-select> -->
|
<view class="righton">
|
<input disabled v-model="hform.HBeginEmpName" placeholder="" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">开机时间:</view>
|
<view class="righton">
|
<input disabled v-model="hform.HBeginTime" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">备注:</view>
|
<view class="right">
|
<textarea v-model="hform.HRemark" placeholder="请输入备注" />
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<!-- 其他信息 -->
|
<template v-if="tabs == 2">
|
<view class="form" :style="{
|
height: containerHeight + 'px',
|
overflow: 'auto'
|
}">
|
<view class="form-item">
|
<view class="title">创建人:</view>
|
<view class="righton">
|
<input v-model="hform.HMaker" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">创建日期:</view>
|
<view class="righton">
|
<input v-model="hform.HMakeDate" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">修改人:</view>
|
<view class="righton">
|
<input v-model="hform.HUpDater" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">修改日期:</view>
|
<view class="righton">
|
<input v-model="hform.HUpDateDate" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">审核人:</view>
|
<view class="righton">
|
<input v-model="hform.HChecker" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">审核时间:</view>
|
<view class="righton">
|
<input v-model="hform.HCheckDate" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">作废人:</view>
|
<view class="righton">
|
<input v-model="hform.HDeleteMan" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">作废日期:</view>
|
<view class="righton">
|
<input v-model="hform.HDeleteDate" />
|
</view>
|
</view>
|
</view>
|
|
</template>
|
<!-- 操作按钮 -->
|
<view class="buttons" id="buttons">
|
<button class="btn-a" size="mini" @tap="submit">提交</button>
|
<view style="flex: 1;"></view>
|
<!-- <button class="btn-a" size="mini" @tap="addNew">新增</button> -->
|
<button class="btn-c" size="mini" @tap="goBack">退出</button>
|
</view>
|
<!-- <xe-upload ref="XeUpload" :options="uploadOptions" @callback="handleUploadCallback"></xe-upload> -->
|
</view>
|
</template>
|
|
<script>
|
import dayjs from "dayjs";
|
import {
|
CommonUtils
|
} from "@/utils/common";
|
import {
|
MpaasScan
|
} from "@/utils/mpaasScan.js"
|
import {
|
getUserInfo
|
} from "../../../utils/auth";
|
export default {
|
// 设备开机单
|
name: 'Sb_EquipBeginBill',
|
data() {
|
return {
|
tabs: 0,
|
HMainSourceBillType: "",
|
btnTop: 0,
|
tabsBottom: 0,
|
HModName: "Sb_EquipBeginBill",
|
HBillType: '3917',
|
operationType: 1,
|
uploadOptions: {},
|
enableEdit: true,
|
|
HDeptList: [],
|
HRepairCheckList: [],
|
HEmpList: [],
|
HRepairList: [],
|
|
hform: {
|
"HBillNo": "",
|
"HInterID": "0",
|
"HDate": dayjs(new Date()).format("YYYY-MM-DD"),
|
"HEquipName": "",
|
"HEquipID": "0",
|
"HEquipRelationName": "",
|
"HEquipRelationID": "0",
|
"HBeginEmpName": getUserInfo()["HEmpName"],
|
"HBeginEmpID": getUserInfo()["HEmpID"],
|
"HBeginTime": dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
"HRemark": "",
|
HMaker: getUserInfo()["Czymc"],
|
HChecker: '',
|
HCloseMan: '',
|
HUpDater: '',
|
HMakeDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
HCheckDate: '',
|
HCloseDate: '',
|
HUpDateDate: '',
|
HDeleteMan: '',
|
HDeleteDate: ''
|
},
|
};
|
},
|
computed: {
|
containerHeight: {
|
get() {
|
return this.btnTop - this.tabsBottom - 5
|
}
|
},
|
},
|
methods: {
|
// 维修项目
|
async getRepairList() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: '/Gy_Repair/GetRepairList',
|
data: {
|
sWhere: '',
|
user: getUserInfo()["Czymc"]
|
}
|
})
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
this.HRepairList = data
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取检验项目失败: ${Message}`
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取检验项目失败: ${err}`
|
})
|
}
|
},
|
// 删除明细
|
delDetail(item) {
|
|
},
|
// 提交数据有效性校验
|
ValidCheck() {
|
if (this.hform.HEquipID == 0) {
|
return {
|
Message: "未录入设备信息,请先录入设备信息!",
|
state: false
|
}
|
}
|
|
if (this.hform.HEmpID == 0) {
|
return {
|
Message: "验收人不得为空!",
|
state: false
|
}
|
}
|
|
return {
|
Message: "",
|
state: true
|
}
|
},
|
addNew() {
|
uni.redirectTo({
|
url: './Sb_EquipRepairSendWorkBill?operationType=1'
|
})
|
},
|
goBack() {
|
uni.navigateBack()
|
},
|
checkBoxChangeHandler(index, e) {
|
let cr = e.detail.value
|
if (cr.length == 0) {
|
this.HCheckFileList[index]["HDotCheckResult"] = false
|
} else {
|
this.HCheckFileList[index]["HDotCheckResult"] = true
|
}
|
},
|
radioChange({
|
detail: {
|
value
|
}
|
}) {
|
this.hform.HCheckResult = value
|
},
|
async getMaxNum() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Web/GetMAXNum",
|
data: {
|
"HBillType": this.HBillType
|
}
|
})
|
|
let {
|
count,
|
data,
|
Message
|
} = res.data
|
console.log('data: ', data);
|
this.hform.HInterID = data[0]["HInterID"]
|
this.hform.HBillNo = data[0]["HBillNo"]
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: "获取单据信息异常: " + err
|
})
|
}
|
},
|
async set_CheckBill(HInterID, num) {
|
try{
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Sb_EquipBeginBill/AuditSb_EquipBeginBill",
|
data: {
|
HInterID: HInterID,
|
type: num,
|
user: getUserInfo()['Czymc']
|
}
|
})
|
|
if(res.count == 1) {
|
return
|
}else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: "设备开机单审核失败: " + res.Message
|
})
|
}
|
}catch(err){
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: "设备开机单审核失败: " + err
|
})
|
}
|
},
|
async submit() {
|
let valid = this.ValidCheck()
|
if (!valid.state) {
|
CommonUtils.showTips({
|
message: valid.Message
|
})
|
return
|
}
|
|
try {
|
let oMain = JSON.stringify(this.hform);
|
let sMainSub = oMain + ';Add' + `;${getUserInfo()['Czymc']}`;
|
let res = await CommonUtils.doRequest2Sync({
|
url: "/Sb_EquipBeginBill/SaveSb_EquipBeginBillMain",
|
data: {
|
"sMainSub": sMainSub
|
},
|
method: "POST"
|
})
|
|
if (!res) {
|
return
|
}
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
if (data.Verify == "Y") { //自动审核
|
set_checkBill(data.HInterID, 1)
|
}
|
|
uni.showModal({
|
title: '提示',
|
content: res.data.Message + '返回上级页面',
|
showCancel: false,
|
success: (res) => {
|
if (res.confirm) {
|
setTimeout(() => {
|
uni.navigateBack();
|
}, 50)
|
} else if (res.cancel) {
|
setTimeout(() => {
|
uni.navigateBack();
|
}, 50)
|
}
|
}
|
});
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: "提交单据失败: " + Message
|
})
|
}
|
|
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: "提交单据失败: " + err
|
})
|
}
|
},
|
async getEquipInfo() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Gy_EquipFileMain/getSb_EquipList",
|
data: {
|
HInterID: this.hform.HEquipID,
|
user: getUserInfo()['Czymc']
|
}
|
})
|
|
let {
|
data,
|
Message,
|
count
|
} = res.data
|
|
if (count == 1) {
|
console.log('data: ', data);
|
|
this.hform.HEquipID = data[0].hmainid
|
this.hform.HEquipName = data[0].设备名称
|
this.hform.HEquipRelationID = data[0].HMainSourceID
|
this.hform.HEquipRelationName = data[0].所属主生产设备
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: "获取设备信息失败: " + Message
|
})
|
}
|
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: "获取设备信息失败: " + err
|
})
|
}
|
}
|
},
|
onLoad(e) {
|
console.log('e: ', e);
|
if (!e.operationType) {
|
this.operationType = 1
|
} else {
|
this.operationType = e.operationType
|
}
|
|
if (this.operationType == 1) {
|
this.hform.HEquipID = e.HEquipID
|
// 新增
|
this.getMaxNum()
|
this.getEquipInfo()
|
} else if (this.operationType == 2) {
|
// 复制
|
} else if (this.operationType == 3) {
|
// 编辑
|
|
} else if (this.operationType == 4) {
|
// 浏览
|
|
}
|
},
|
onReady() {
|
const query = uni.createSelectorQuery().in(this)
|
query.select("#buttons")
|
.boundingClientRect()
|
.select("#tabs")
|
.boundingClientRect()
|
.exec(res => {
|
this.btnTop = Math.floor(res[0].top)
|
this.tabsBottom = Math.ceil(res[1].bottom)
|
})
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import "@/pages/MJGL/style/MJBillStyle.scss"
|
</style>
|