<template>
|
<view>
|
<view class="tabs" id="tabs">
|
<view :class="tabs == 0 ? 'on':''" @tap="tabs = 0">
|
{{ $t("Sb_EquipConkBookBill.tabBasic") == "Sb_EquipConkBookBill.tabBasic" ? "基本信息" : $t("Sb_EquipConkBookBill.tabBasic") }}
|
</view>
|
<view :class="tabs == 2 ? 'on':''" @tap="tabs = 2">
|
{{ $t("Sb_EquipConkBookBill.tabOther") == "Sb_EquipConkBookBill.tabOther" ? "其他信息" : $t("Sb_EquipConkBookBill.tabOther") }}
|
</view>
|
</view>
|
<!-- 基本信息 -->
|
<template v-if="tabs == 0">
|
<view class="form" :style="{
|
height: containerHeight + 'px',
|
overflow: 'auto'
|
}">
|
<view class="form-item">
|
<view class="title">{{ $t("Sb_EquipConkBookBill.HBarCode") == "Sb_EquipConkBookBill.HBarCode" ? "设备条码:" : $t("Sb_EquipConkBookBill.HBarCode") }}</view>
|
<view :class="enableEdit?'right':'righton'">
|
<input v-model="hform.HBarCode" :disabled="!enableEdit"
|
@confirm="GetMessageByBarCode(hform.HBarCode)" :placeholder="$t('Sb_EquipConkBookBill.HBarCode_Placeholder') == 'Sb_EquipConkBookBill.HBarCode_Placeholder' ? '请输入(或扫描)设备条码' : $t('Sb_EquipConkBookBill.HBarCode_Placeholder')" />
|
</view>
|
<view class="icon-wrapper">
|
<uni-icons type="scan" size="20" @click="toScanCode"></uni-icons>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Sb_EquipConkBookBill.HConkBeginDate") == "Sb_EquipConkBookBill.HConkBeginDate" ? "开始时间:" : $t("Sb_EquipConkBookBill.HConkBeginDate") }}</view>
|
<view class="right">
|
<uni-datetime-picker type="datetime" :clear-icon="false" v-model="hform.HRepairPlanBeginDate">
|
<input :value="hform.HConkBeginDate" :placeholder="$t('Gy.HDate_Placeholder') == 'Gy.HDate_Placeholder' ? '请选择' : $t('Gy.HDate_Placeholder')" />
|
</uni-datetime-picker>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title required">{{ $t("Sb_EquipConkBookBill.HConkTypeName") == "Sb_EquipConkBookBill.HConkTypeName" ? "故障类别:" : $t("Sb_EquipConkBookBill.HConkTypeName") }}</view>
|
<zxz-uni-data-select required class="right" :localdata="HConkTypeList" dataKey="故障类别名称"
|
dataValue="hitemid" v-model="hform.HConkTypeID">
|
</zxz-uni-data-select>
|
</view>
|
<view class="form-item">
|
<view class="title required">{{ $t("Sb_EquipConkBookBill.HConkReasonName") == "Sb_EquipConkBookBill.HConkReasonName" ? "故障原因:" : $t("Sb_EquipConkBookBill.HConkReasonName") }}</view>
|
<zxz-uni-data-select required class="right" :localdata="HConkReasonList" dataKey="HName"
|
dataValue="HItemID" v-model="hform.HConkReasonID">
|
</zxz-uni-data-select>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Sb_EquipConkBookBill.HExplanation") == "Sb_EquipConkBookBill.HExplanation" ? "故障描述:" : $t("Sb_EquipConkBookBill.HExplanation") }}</view>
|
<view class="right">
|
<textarea v-model="hform.HExplanation" :placeholder="$t('Sb_EquipConkBookBill.HExplanation_Placeholder') == 'Sb_EquipConkBookBill.HExplanation_Placeholder' ? '请输入故障描述' : $t('Sb_EquipConkBookBill.HExplanation_Placeholder')" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Gy.HBillNo") == "Gy.HBillNo" ? "单据号:" : $t("Gy.HBillNo") }}</view>
|
<view class="righton">
|
<input disabled v-model="hform.HBillNo" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Gy.HDate") == "Gy.HDate" ? "单据日期:" : $t("Gy.HDate") }}</view>
|
<view class="righton">
|
<input disabled v-model="hform.HDate" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title required">{{ $t("Gy.HDeptName") == "Gy.HDeptName" ? "部门:" : $t("Gy.HDeptName") }}</view>
|
<zxz-uni-data-select required class="right" :localdata="HDeptList" dataKey="部门名称"
|
dataValue="HItemID" v-model="hform.HDeptID">
|
</zxz-uni-data-select>
|
</view>
|
<view class="form-item">
|
<view class="title required">{{ $t("Sb_EquipConkBookBill.HEmpName") == "Sb_EquipConkBookBill.HEmpName" ? "发现人:" : $t("Sb_EquipConkBookBill.HEmpName") }}</view>
|
<zxz-uni-data-select required class="right" :localdata="HEmpList" dataKey="HName"
|
dataValue="HItemID" v-model="hform.HEmpID">
|
</zxz-uni-data-select>
|
</view>
|
<view class="form-item">
|
<view class="title required">{{ $t("Sb_EquipConkBookBill.HManagerName") == "Sb_EquipConkBookBill.HManagerName" ? "验收人:" : $t("Sb_EquipConkBookBill.HManagerName") }}</view>
|
<zxz-uni-data-select required class="right" :localdata="HEmpList" dataKey="HName"
|
dataValue="HItemID" v-model="hform.HManagerID">
|
</zxz-uni-data-select>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Sb_EquipConkBookBill.HBarName") == "Sb_EquipConkBookBill.HBarName" ? "设备名称:" : $t("Sb_EquipConkBookBill.HBarName") }}</view>
|
<view class="righton">
|
<input v-model="hform.HBarName" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Sb_EquipConkBookBill.HBarSpec") == "Sb_EquipConkBookBill.HBarSpec" ? "设备规格:" : $t("Sb_EquipConkBookBill.HBarSpec") }}</view>
|
<view class="righton">
|
<input v-model="hform.HBarSpec" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Sb_EquipConkBookBill.HBarModel") == "Sb_EquipConkBookBill.HBarModel" ? "设备型号:" : $t("Sb_EquipConkBookBill.HBarModel") }}</view>
|
<view class="righton">
|
<input v-model="hform.HBarModel" disabled />
|
</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">{{ $t("Gy.HMaker") == "Gy.HMaker" ? "创建人:" : $t("Gy.HMaker") }}</view>
|
<view class="righton">
|
<input v-model="hform.HMaker" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Gy.HMakeDate") == "Gy.HMakeDate" ? "创建日期:" : $t("Gy.HMakeDate") }}</view>
|
<view class="righton">
|
<input v-model="hform.HMakeDate" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Gy.HUpDater") == "Gy.HUpDater" ? "修改人:" : $t("Gy.HUpDater") }}</view>
|
<view class="righton">
|
<input v-model="hform.HUpDater" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Gy.HUpDateDate") == "Gy.HUpDateDate" ? "修改日期:" : $t("Gy.HUpDateDate") }}</view>
|
<view class="righton">
|
<input v-model="hform.HUpDateDate" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Gy.HChecker") == "Gy.HChecker" ? "审核人:" : $t("Gy.HChecker") }}</view>
|
<view class="righton">
|
<input v-model="hform.HChecker" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Gy.HCheckDate") == "Gy.HCheckDate" ? "审核时间:" : $t("Gy.HCheckDate") }}</view>
|
<view class="righton">
|
<input v-model="hform.HCheckDate" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Gy.HDeleteMan") == "Gy.HDeleteMan" ? "作废人:" : $t("Gy.HDeleteMan") }}</view>
|
<view class="righton">
|
<input v-model="hform.HDeleteMan" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{ $t("Gy.HDeleteDate") == "Gy.HDeleteDate" ? "作废日期:" : $t("Gy.HDeleteDate") }}</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">{{ $t("Sb_EquipConkBookBill.submit") == "Sb_EquipConkBookBill.submit" ? "提交" : $t("Sb_EquipConkBookBill.submit") }}</button>
|
<view style="flex: 1;"></view>
|
<button class="btn-a" size="mini" @tap="addNew">{{ $t("Sb_EquipConkBookBill.addNew") == "Sb_EquipConkBookBill.addNew" ? "新增" : $t("Sb_EquipConkBookBill.addNew") }}</button>
|
<button class="btn-c" size="mini" @tap="goBack">{{ $t("Sb_EquipConkBookBill.goBack") == "Sb_EquipConkBookBill.goBack" ? "退出" : $t("Sb_EquipConkBookBill.goBack") }}</button>
|
</view>
|
</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_EquipConkBookBill',
|
data() {
|
return {
|
tabs: 0,
|
HMainSourceBillType: "",
|
btnTop: 0,
|
tabsBottom: 0,
|
HModName: "Sb_EquipConkBookBill",
|
HBillType: '3907',
|
operationType: 1,
|
uploadOptions: {},
|
enableEdit: true,
|
|
HDeptList: [],
|
HEmpList: [],
|
HConkTypeList: [],
|
HConkReasonList: [],
|
|
hform: {
|
HBarCode: "",
|
HConkBeginDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
HConkTypeName: "",
|
HConkTypeID: 0,
|
HConkReasonName: "",
|
HConkReasonID: 0,
|
HExplanation: "",
|
HBillNo: "",
|
HInterID: 0,
|
HDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
HDeptName: getUserInfo().HDeptName,
|
HDeptID: getUserInfo().HDeptID,
|
HEmpName: getUserInfo().HEmpName,
|
HEmpID: getUserInfo().HEmpID,
|
HManagerName: getUserInfo().HManagerName,
|
HManagerID: getUserInfo().HManagerID,
|
HBarName: "",
|
HEquipID: 0,
|
HBarSpec: "",
|
HBarModel: "",
|
HMaker: getUserInfo()["Czymc"],
|
HChecker: '',
|
HCloseMan: '',
|
HUpDater: '',
|
HMakeDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
HCheckDate: '',
|
HCloseDate: '',
|
HUpDateDate: '',
|
HDeleteMan: '',
|
HDeleteDate: ''
|
},
|
HDetailList: [{ // 后端接口提交需要 明细信息
|
"HConkReasonID": "",
|
"HConkReasonCode": "",
|
"HConkReasonName": "",
|
"HConkExplanation": "",
|
"HManagerID": "0",
|
"HManagerCode": "",
|
"HManagerName": "",
|
"HRemark": " "
|
}]
|
};
|
},
|
computed: {
|
containerHeight: {
|
get() {
|
return this.btnTop - this.tabsBottom - 5
|
}
|
},
|
},
|
methods: {
|
// 获取故障类别
|
async getConkType() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: '/Gy_ConkType/List_PDA2',
|
data: {
|
sWhere: '',
|
user: getUserInfo()['Czymc'],
|
mode: 'Equip'
|
}
|
})
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
this.HConkTypeList = data
|
} else {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getConkTypeFailed') == 'Sb_EquipConkBookBill.getConkTypeFailed' ? '获取故障类别失败' : this.$t('Sb_EquipConkBookBill.getConkTypeFailed')}: ${Message}`
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getConkTypeFailed') == 'Sb_EquipConkBookBill.getConkTypeFailed' ? '获取故障类别失败' : this.$t('Sb_EquipConkBookBill.getConkTypeFailed')}: ${err}`
|
})
|
}
|
},
|
// 获取故障原因
|
async getConkReason() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/PublicPageMethod/Gy_ConkReasonList_PDA",
|
data: {
|
sWhere: ``,
|
}
|
})
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
this.HConkReasonList = data
|
} else {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getConkReasonFailed') == 'Sb_EquipConkBookBill.getConkReasonFailed' ? '获取故障原因失败' : this.$t('Sb_EquipConkBookBill.getConkReasonFailed')}: ${Message}`
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getConkReasonFailed') == 'Sb_EquipConkBookBill.getConkReasonFailed' ? '获取故障原因失败' : this.$t('Sb_EquipConkBookBill.getConkReasonFailed')}: ${err}`
|
})
|
}
|
},
|
// 删除明细
|
delDetail(item) {
|
|
},
|
// 提交数据有效性校验
|
ValidCheck() {
|
if (this.hform.HEquipID == 0 || this.hform.HEquipID === undefined) {
|
return {
|
Message: this.$t('Sb_EquipConkBookBill.noEquipInfo') == 'Sb_EquipConkBookBill.noEquipInfo' ? '未录入设备信息,请先录入设备信息!' : this.$t('Sb_EquipConkBookBill.noEquipInfo'),
|
state: false
|
}
|
}
|
if (this.hform.HDeptID == 0 || this.hform.HDeptID === undefined) {
|
return {
|
Message: this.$t('Sb_EquipConkBookBill.deptRequired') == 'Sb_EquipConkBookBill.deptRequired' ? '部门不得为空!' : this.$t('Sb_EquipConkBookBill.deptRequired'),
|
state: false
|
}
|
}
|
if (this.hform.HEmpID == 0 || this.hform.HEmpID === undefined) {
|
return {
|
Message: this.$t('Sb_EquipConkBookBill.discovererRequired') == 'Sb_EquipConkBookBill.discovererRequired' ? '发现人不得为空!' : this.$t('Sb_EquipConkBookBill.discovererRequired'),
|
state: false
|
}
|
}
|
if (this.hform.HManagerID === 0 || this.hform.HManagerID === undefined) {
|
return {
|
Message: this.$t('Sb_EquipConkBookBill.checkerRequired') == 'Sb_EquipConkBookBill.checkerRequired' ? '验收人不得为空!' : this.$t('Sb_EquipConkBookBill.checkerRequired'),
|
state: false
|
}
|
}
|
if (this.hform.HConkReasonID == 0 || this.hform.HConkReasonID === undefined) {
|
return {
|
Message: this.$t('Sb_EquipConkBookBill.reasonRequired') == 'Sb_EquipConkBookBill.reasonRequired' ? '故障原因不得为空!' : this.$t('Sb_EquipConkBookBill.reasonRequired'),
|
state: false
|
}
|
}
|
if (this.hform.HConkTypeID == 0 || this.hform.HConkTypeID === undefined) {
|
return {
|
Message: this.$t('Sb_EquipConkBookBill.typeRequired') == 'Sb_EquipConkBookBill.typeRequired' ? '故障类别不得为空!' : this.$t('Sb_EquipConkBookBill.typeRequired'),
|
state: false
|
}
|
}
|
|
return {
|
Message: "",
|
state: true
|
}
|
},
|
addNew() {
|
uni.redirectTo({
|
url: './Sb_EquipConkBookBill?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
|
}
|
},
|
uploadFile(index) {
|
console.log('filePath: ', this.attachmentInfo[index].filePath);
|
// 通过临时路径读取文件
|
uni.uploadFile({
|
url: CommonUtils.getServerUrl() + "/Sb_EquipDotCheckBill/UploadFile",
|
filePath: this.attachmentInfo[index].filePath,
|
name: 'file',
|
formData: {
|
HBillNo: this.hform.HBillNo,
|
HRemark: "",
|
HUserName: getUserInfo()["Czymc"]
|
},
|
success: (uploadRes) => {
|
CommonUtils.showTips({
|
message: this.$t('Sb_EquipConkBookBill.uploadSuccess') == 'Sb_EquipConkBookBill.uploadSuccess' ? '上传成功' : this.$t('Sb_EquipConkBookBill.uploadSuccess')
|
})
|
this.attachmentInfo[index].status = this.$t('Sb_EquipConkBookBill.uploadSuccess') == 'Sb_EquipConkBookBill.uploadSuccess' ? '上传成功' : this.$t('Sb_EquipConkBookBill.uploadSuccess')
|
},
|
fail: (err) => {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.uploadFailed') == 'Sb_EquipConkBookBill.uploadFailed' ? '上传失败' : this.$t('Sb_EquipConkBookBill.uploadFailed')}: ${err}`
|
})
|
}
|
})
|
},
|
delFile(index) {
|
console.log('attachmentInfo: ', this.attachmentInfo[index]);
|
uni.showModal({
|
title: this.$t('Sb_EquipConkBookBill.confirmTitle') == 'Sb_EquipConkBookBill.confirmTitle' ? '提示' : this.$t('Sb_EquipConkBookBill.confirmTitle'),
|
content: this.$t('Sb_EquipConkBookBill.delConfirm') == 'Sb_EquipConkBookBill.delConfirm' ? '确认要删除 " ' : this.$t('Sb_EquipConkBookBill.delConfirm') + this.attachmentInfo[index].fileName + this.$t('Sb_EquipConkBookBill.delConfirmSuffix') == 'Sb_EquipConkBookBill.delConfirmSuffix' ? ' " 删除后将不可恢复!' : this.$t('Sb_EquipConkBookBill.delConfirmSuffix'),
|
success: (res) => {
|
if (res.confirm) {
|
this.attachmentInfo.splice(index, 1)
|
}
|
},
|
})
|
|
},
|
handleUploadCallback(res) { // 文件上传回调
|
console.log('file: ', res);
|
let fileInfo = res.data[0]
|
this.attachmentInfo.push({
|
fileName: fileInfo.name,
|
size: fileInfo.size,
|
status: this.$t('Sb_EquipConkBookBill.uploadWaiting') == 'Sb_EquipConkBookBill.uploadWaiting' ? '等待上传' : this.$t('Sb_EquipConkBookBill.uploadWaiting'),
|
filePath: fileInfo.tempFilePath
|
})
|
},
|
// 上传文件
|
fileUpload() {
|
this.$refs.XeUpload.upload('file', {});
|
},
|
//获取班次数据
|
async getShiftList() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: '/Web/GetGy_ShiftsList_Json',
|
data: {
|
Shifts: "",
|
}
|
})
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
this.HShiftsList = data
|
} else {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: Message
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: err
|
})
|
}
|
},
|
//获取使用部门数据
|
async getHDeptList() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: '/Gy_Department/list',
|
data: {
|
sWhere: ` and HUSEORGID = ${uni.getStorageSync('OrganizationID')} `,
|
user: uni.getStorageSync('HUserName'),
|
Organization: uni.getStorageSync('Organization')
|
}
|
})
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
this.HDeptList = data
|
} else {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: Message
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: err
|
})
|
}
|
},
|
// 获取职员数据
|
async getEmpList() {
|
try {
|
let sWhere = " where 1=1 "
|
if (this.hform.HDeptName && uni.getStorageSync("Organization") == '宁波市华舟包装有限公司') {
|
sWhere += ` and HDeptName = '${this.hform.HDeptName}'`
|
}
|
|
let res = await CommonUtils.doRequest2Async({
|
url: '/PublicPageMethod/UserList',
|
data: {
|
sWhere: sWhere,
|
}
|
})
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
this.HEmpList = data
|
} else {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: Message
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: err
|
})
|
}
|
},
|
|
toScanCode() {
|
MpaasScan.scanCode(cb => {
|
this.hform.HBarCode = cb
|
this.GetMessageByBarCode(cb)
|
})
|
},
|
async GetMessageByBarCode(HBarCode) {
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
url: "/Sb_PDA_EquipDotCheckBill/txtHBarCode_KeyDown_List",
|
data: {
|
HBarCode: HBarCode,
|
},
|
})
|
|
|
if (!res) {
|
return
|
}
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
|
if (count == 1) {
|
console.log('data: ', data);
|
this.hform.HEquipID = data[0].hmainid
|
this.hform.HBarName = data[0].设备名称
|
this.hform.HBarSpec = data[0].设备规格
|
this.hform.HBarModel = data[0].设备型号
|
this.hform.HQty = 1
|
|
this.enableEdit = false
|
} else {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: Message
|
})
|
}
|
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: err
|
})
|
}
|
},
|
async GetItemByEquipFile() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Web/GetItemByEquipFile",
|
data: {
|
"EquipProjectID": this.hform.HEquipID,
|
"Type": "DJ",
|
"HDate": this.hform.HBeginDate
|
}
|
})
|
|
let {
|
data,
|
Message,
|
count
|
} = res.data
|
if (count == 1) {
|
this.hform.HEquipDotCheckRuleInterID = data[0].点检规程ID
|
this.hform.HEquipDotCheckRuleInterNo = data[0].点检规程单号
|
this.hform.HPlanNo = data[0].点检计划单
|
this.hform.HPlanInterID = (data[0].点检计划ID == null ? 0 : data[0].点检计划ID) == "" ? 0 : data[0]
|
.点检计划ID
|
this.hform.HPlanEntryID = (data[0].点检计划子ID == null ? 0 : data[0].点检计划子ID) == "" ? 0 : data[
|
0].点检计划子ID
|
|
this.HCheckFileList = Array.from(data).map(item => {
|
return {
|
"HDotCheckItemID": item.HDotCheckItemID,
|
"HDotCheckCode": item.点检项目代码,
|
"HDotCheckItem": item.点检项目,
|
"HDotCheckPart": item.点检部位,
|
"HClaim": item.具体要求,
|
"HManagerID": item.负责人ID,
|
"HManagerCode": item.负责人代码,
|
"HManagerName": item.负责人名称,
|
"HSourceInterID": item.点检计划ID == null ? 0 : item.点检计划ID,
|
"HSourceEntryID": item.点检计划子ID == null ? 0 : item.点检计划子ID,
|
"HSourceBillNo": item.点检计划单,
|
"HDotCheckItemClassID": 0,
|
"HDotCheckItemClassName": "",
|
"HDotCheckItemMethodID": 0,
|
"HDotCheckItemMethodName": "",
|
"HDotCheckResult": item.默认结论 == 1 ? true : false
|
}
|
})
|
|
} else {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getCheckRuleFailed') == 'Sb_EquipConkBookBill.getCheckRuleFailed' ? '获取点检规程错误' : this.$t('Sb_EquipConkBookBill.getCheckRuleFailed')}: ${Message}`
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getCheckRuleFailed') == 'Sb_EquipConkBookBill.getCheckRuleFailed' ? '获取点检规程错误' : this.$t('Sb_EquipConkBookBill.getCheckRuleFailed')}: ${err}`
|
})
|
}
|
},
|
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.HInterID = 0
|
this.hform.HBillNo = data[0]["HBillNo"]
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getBillInfoFailed') == 'Sb_EquipConkBookBill.getBillInfoFailed' ? '获取单据信息异常' : this.$t('Sb_EquipConkBookBill.getBillInfoFailed')}: ` + err
|
})
|
}
|
},
|
async submit() {
|
let valid = this.ValidCheck()
|
if (!valid.state) {
|
CommonUtils.showTips({
|
message: valid.Message
|
})
|
return
|
}
|
|
try {
|
let oMain = JSON.stringify(this.hform);
|
this.HDetailList[0].HConkReasonID = this.hform.HConkReasonID
|
this.HDetailList[0].HConkExplanation = this.hform.HExplanation
|
this.HDetailList[0].HManagerID = this.hform.HManagerID
|
let sSubStr = JSON.stringify(this.HDetailList);
|
let sMainSub = oMain + ';' + sSubStr + `;` + getUserInfo()[
|
'Czymc'] + ";1";
|
let res = await CommonUtils.doRequest2Sync({
|
url: "/Sb_EqpRepairWorkBill/SaveGetEqpConkBookBillList",
|
data: {
|
"msg": sMainSub
|
},
|
method: "POST"
|
})
|
|
if (!res) {
|
return
|
}
|
|
let {
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
uni.showModal({
|
title: this.$t('Sb_EquipConkBookBill.confirmTitle') == 'Sb_EquipConkBookBill.confirmTitle' ? '提示' : this.$t('Sb_EquipConkBookBill.confirmTitle'),
|
content: res.data.Message + (this.$t('Sb_EquipConkBookBill.continueAdd') == 'Sb_EquipConkBookBill.continueAdd' ? '。是否继续新增?(点击取消返回上级页面)' : this.$t('Sb_EquipConkBookBill.continueAdd')),
|
success: (res) => {
|
if (res.confirm) {
|
console.log('用户点击确定');
|
uni.redirectTo({
|
url: './Sb_EquipConkBookBill?operationType=1'
|
})
|
} else if (res.cancel) {
|
console.log('用户点击取消');
|
setTimeout(() => {
|
uni.navigateBack();
|
}, 50)
|
}
|
}
|
});
|
} else {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.submitFailed') == 'Sb_EquipConkBookBill.submitFailed' ? '提交单据失败' : this.$t('Sb_EquipConkBookBill.submitFailed')}: ` + Message
|
})
|
}
|
|
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.submitFailed') == 'Sb_EquipConkBookBill.submitFailed' ? '提交单据失败' : this.$t('Sb_EquipConkBookBill.submitFailed')}: ` + err
|
})
|
}
|
},
|
async getEditData(hmainid) {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: '/Sb_EqpRepairWorkBill/Sb_EqpConkBookBillListCheckDetai',
|
data: {
|
HID: hmainid
|
},
|
})
|
|
let {
|
data,
|
count,
|
msg,
|
code
|
} = res.data
|
|
if (code == 1) {
|
data = data.h_v_Sb_EquipConkBookBillList_Edit[0]
|
|
this.enableEdit = false
|
} else {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getEditFailed') == 'Sb_EquipConkBookBill.getEditFailed' ? '获取故障登记单失败' : this.$t('Sb_EquipConkBookBill.getEditFailed')}: ${msg}`
|
})
|
}
|
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getEditFailed') == 'Sb_EquipConkBookBill.getEditFailed' ? '获取故障登记单失败' : this.$t('Sb_EquipConkBookBill.getEditFailed')}: ${err}`
|
})
|
}
|
},
|
async GetEquipInfo(HEquipID) {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Gy_EquipFileMain/getSb_EquipList",
|
data: {
|
HInterID: HEquipID,
|
user: getUserInfo()["Czymc"]
|
}
|
})
|
|
let {
|
data,
|
Message,
|
count
|
} = res.data
|
if (count == 1) {
|
console.log('data: ', data);
|
Object.assign(this.hform, {
|
HDeptID: data[0]["HDeptID"],
|
HDeptName: data[0]["使用部门"],
|
HEquipID: data[0]["hmainid"],
|
HBarName: data[0]["设备名称"],
|
HBarModel: data[0]["设备规格"],
|
HBarSpec: data[0]["设备型号"],
|
HEmpID: getUserInfo()["HEmpID"],
|
HManagerID: data[0]["HRepairEmpID"]
|
})
|
} else {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getEquipFailed') == 'Sb_EquipConkBookBill.getEquipFailed' ? '获取设备数据失败' : this.$t('Sb_EquipConkBookBill.getEquipFailed')}: ${Message}`
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: this.$t('Sb_EquipConkBookBill.tipTitle') == 'Sb_EquipConkBookBill.tipTitle' ? '温馨提示' : this.$t('Sb_EquipConkBookBill.tipTitle'),
|
message: `${this.$t('Sb_EquipConkBookBill.getEquipFailed') == 'Sb_EquipConkBookBill.getEquipFailed' ? '获取设备数据失败' : this.$t('Sb_EquipConkBookBill.getEquipFailed')}: ${err}`
|
})
|
}
|
}
|
},
|
onLoad(e) {
|
uni.setNavigationBarTitle({
|
title: this.$t("Sb_EquipConkBookBill.title") == 'Sb_EquipConkBookBill.title' ? '设备故障登记单' : this.$t("Sb_EquipConkBookBill.title")
|
})
|
console.log('e: ', e);
|
if (!e.operationType) {
|
this.operationType = 1
|
} else {
|
this.operationType = e.operationType
|
}
|
|
if (this.operationType == 1) {
|
// 新增
|
this.getMaxNum()
|
} else if (this.operationType == 2) {
|
// 复制
|
} else if (this.operationType == 3) {
|
// 编辑 (PDA中没有编辑功能,故此处编辑功能先不使用)
|
let hmainid = e.hmainid
|
this.getEditData(hmainid)
|
|
} else if (this.operationType == 4) {
|
// 报工平台下推
|
let HEquipID = e.HEquipID
|
this.getMaxNum()
|
this.GetEquipInfo(HEquipID)
|
|
}
|
|
this.getHDeptList()
|
this.getEmpList()
|
this.getConkReason()
|
this.getConkType()
|
},
|
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>
|