| | |
| | | <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" :style="{ height: containerHeight + 'px',overflow: 'auto'}"> |
| | | <view class="form-item"> |
| | | <view class="title">设备条码:</view> |
| | | <view :class="enableEdit?'right':'righton'"> |
| | |
| | | <view class="form-item"> |
| | | <view class="title">维修内容:</view> |
| | | <view class="right"> |
| | | <textarea v-model="hform.HRepairContent" placeholder="请输入验证内容" /> |
| | | <textarea v-model="hform.HRepairContent" placeholder="请输入维修内容" /> |
| | | </view> |
| | | </view> |
| | | <!-- 源单类型 --> |
| | | <view class="form-item"> |
| | | <view class="title">源单类型:</view> |
| | | <view class="right" v-show="showHMainSourceBillType"> |
| | | <picker :range="arrayHMainSourceBillType" @change="HMainSourceBillTypeChange"> |
| | | <input disabled name="HMainSourceBillType" v-model="HMainSourceBillType" |
| | | placeholder="请选择源单类型" /> |
| | | <view class="picker-overlay"></view> |
| | | </picker> |
| | | </view> |
| | | <view class="righton" v-show="!showHMainSourceBillType"> |
| | | <input name="HMainSourceBillType" disabled v-model="HMainSourceBillType" |
| | | placeholder="请选择源单类型" /> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 源单单号 --> |
| | | <view class="form-item"> |
| | | <view class="title">源单单号:</view> |
| | | <view :class="enableSourceBillEdit?'right':'righton'"> |
| | | <input v-model="hform.HMainSourceBillNo" :disabled="!enableSourceBillEdit" |
| | | @confirm="GetMessageByHMainSourceBillNo(hform.HMainSourceBillNo)" |
| | | placeholder="请输入(或扫描)源单单号" /> |
| | | </view> |
| | | <!-- 放大镜图标,当源单类型不是"手工录入"时显示 --> |
| | | <view class="icon-wrapper" v-if="hform.HMainSourceBillType != '手工录入'"> |
| | | <uni-icons type="search" size="20" @click="showBillList"></uni-icons> |
| | | </view> |
| | | <!-- 扫描图标 --> |
| | | <view class="icon-wrapper"> |
| | | <uni-icons type="scan" size="20" @click="toScanHMainSourceBillNo"></uni-icons> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="form-item"> |
| | | <view class="title">单据号:</view> |
| | | <view class="righton"> |
| | |
| | | <view class="title required">维修部门:</view> |
| | | <zxz-uni-data-select required class="right" :localdata="HDeptList" dataKey="部门名称" |
| | | dataValue="HItemID" v-model="hform.HDeptID"> |
| | | |
| | | </zxz-uni-data-select> |
| | | <!-- <input disabled v-model="hform.HDeptName" placeholder="请选择部门" /> --> |
| | | </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.HEmpID"> |
| | | |
| | | </zxz-uni-data-select> |
| | | <!-- <input disabled v-model="hform.HDeptName" placeholder="请选择部门" /> --> |
| | | </view> |
| | | <view class="form-item"> |
| | | <view class="title required">维修项目:</view> |
| | | <zxz-uni-data-select required class="right" :localdata="HRepairList" dataKey="维修项目" |
| | | dataValue="hitemid" v-model="hform.HRepairID"> |
| | | |
| | | </zxz-uni-data-select> |
| | | <!-- <input disabled v-model="hform.HDeptName" placeholder="请选择部门" /> --> |
| | | </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.HManagerID"> |
| | | |
| | | </zxz-uni-data-select> |
| | | <!-- <input disabled v-model="hform.HDeptName" placeholder="请选择部门" /> --> |
| | | </view> |
| | | <view class="form-item"> |
| | | <view class="title">设备名称:</view> |
| | |
| | | <button class="btn-c" size="mini" @tap="goBack">退出</button> |
| | | </view> |
| | | <!-- <xe-upload ref="XeUpload" :options="uploadOptions" @callback="handleUploadCallback"></xe-upload> --> |
| | | <!-- 源单单据列表弹窗 --> |
| | | <BillListPopupEquipConkBookBillVue ref="billList" :HBillType="HBillType" |
| | | :HSourceBillType="hform.HMainSourceBillType" :HStockOrgID="hform.HStockOrgID"> |
| | | </BillListPopupEquipConkBookBillVue> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import { |
| | | getUserInfo |
| | | } from "../../../utils/auth"; |
| | | // 引入源单单据列表弹窗组件 |
| | | import BillListPopupEquipConkBookBillVue from '../../../components/BillListPopup/BillListPopupEquipConkBookBill.vue'; |
| | | |
| | | export default { |
| | | // 设备维修派工单 |
| | | name: 'Sb_EquipRepairSendWorkBill', |
| | | components: { |
| | | BillListPopupEquipConkBookBillVue |
| | | }, |
| | | data() { |
| | | return { |
| | | tabs: 0, |
| | | HMainSourceBillType: "", |
| | | HMainSourceBillType: "", // 用于显示的源单类型 |
| | | btnTop: 0, |
| | | tabsBottom: 0, |
| | | HModName: "Sb_EquipRepairSendWorkBill", |
| | |
| | | operationType: 1, |
| | | uploadOptions: {}, |
| | | enableEdit: true, |
| | | enableSourceBillEdit: true, // 修复:添加这个属性 |
| | | |
| | | // 源单类型相关 |
| | | arrayHMainSourceBillType: ['设备维修登记单', '手工录入'], // 可选的源单类型 |
| | | arrayHMainSourceBillTypeID: ['设备维修登记单', '手工录入'], // 对应的单据类型ID |
| | | showHMainSourceBillType: true, |
| | | |
| | | HDeptList: [], |
| | | HRepairCheckList: [], |
| | |
| | | HCloseDate: '', |
| | | HUpDateDate: '', |
| | | HDeleteMan: '', |
| | | HDeleteDate: '' |
| | | HDeleteDate: '', |
| | | // 新增的源单相关字段 |
| | | HMainSourceBillType: '-1', // 默认为设备维修登记单 |
| | | HMainSourceBillNo: '', |
| | | HMainSourceInterID: 0, |
| | | HMainSourceEntryID: 0, |
| | | HStockOrgID: uni.getStorageSync("OrganizationID"), // 新增库存组织ID |
| | | }, |
| | | HDetailList: [{ // 后端接口提交需要 明细信息 |
| | | "子维修项目": "", |
| | |
| | | }, |
| | | }, |
| | | methods: { |
| | | // 显示源单单据列表弹窗 |
| | | showBillList() { |
| | | if (this.hform.HMainSourceBillType === '手工录入') { |
| | | CommonUtils.showTips({ |
| | | title: '提示', |
| | | message: '手工录入模式下不能选择源单' |
| | | }); |
| | | return; |
| | | } |
| | | this.$refs.billList.showPopup(); |
| | | }, |
| | | |
| | | // 选择源单类型 |
| | | HMainSourceBillTypeChange(e) { |
| | | if (e.detail.value == -1 || e.detail.value == NaN) { |
| | | this.HMainSourceBillType = '手工录入'; |
| | | this.hform.HMainSourceBillType = '手工录入'; |
| | | return; |
| | | } |
| | | |
| | | this.HMainSourceBillType = this.arrayHMainSourceBillType[e.detail.value]; |
| | | this.hform.HMainSourceBillType = this.arrayHMainSourceBillTypeID[e.detail.value]; |
| | | |
| | | // 如果是手工录入,清空源单信息 |
| | | if (this.hform.HMainSourceBillType === '手工录入') { |
| | | this.hform.HMainSourceBillNo = ''; |
| | | this.hform.HMainSourceInterID = 0; |
| | | this.hform.HMainSourceEntryID = 0; |
| | | this.enableSourceBillEdit = false; // 手工录入时禁用源单单号编辑 |
| | | } else { |
| | | this.enableSourceBillEdit = true; // 非手工录入时可编辑 |
| | | } |
| | | |
| | | // 缓存当前页面选择 |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | uni.setStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`, { |
| | | HSourceBillTypeName: this.HMainSourceBillType, |
| | | HSourceBillType: this.hform.HMainSourceBillType |
| | | }); |
| | | }, |
| | | |
| | | // 读取缓存 |
| | | loadCache() { |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | let HBillTypeCache = uni.getStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`); |
| | | if (HBillTypeCache) { |
| | | this.HMainSourceBillType = HBillTypeCache.HSourceBillTypeName; |
| | | this.hform.HMainSourceBillType = HBillTypeCache.HSourceBillType; |
| | | |
| | | // 根据缓存的源单类型设置编辑状态 |
| | | if (this.hform.HMainSourceBillType === '手工录入') { |
| | | this.enableSourceBillEdit = false; |
| | | } else { |
| | | this.enableSourceBillEdit = true; |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // 扫描源单单号 |
| | | toScanHMainSourceBillNo() { |
| | | MpaasScan.scanCode(cb => { |
| | | this.hform.HMainSourceBillNo = cb; |
| | | this.GetMessageByHMainSourceBillNo(cb); |
| | | }); |
| | | }, |
| | | |
| | | // 根据源单单号获取信息 |
| | | async GetMessageByHMainSourceBillNo(HSouceBillNo) { |
| | | try { |
| | | let url, dataField; |
| | | |
| | | // 根据源单类型选择不同的接口 |
| | | if (this.hform.HMainSourceBillType === '设备维修登记单') { |
| | | url = "/Sb_EqpRepairWorkBill/GetEqpConkBookBillListPage"; |
| | | dataField = { |
| | | sWhere: ` and 单据号 = '${HSouceBillNo}'`, |
| | | user: getUserInfo()["Czymc"], |
| | | page: 1, |
| | | size: 1, |
| | | }; |
| | | } else { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: `暂不支持该源单类型:${this.hform.HMainSourceBillType}` |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | let res = await CommonUtils.doRequest2Async({ |
| | | url: url, |
| | | data: dataField |
| | | }); |
| | | |
| | | let { count, Message, data } = res.data; |
| | | if (count == 1) { |
| | | this.hform.HMainSourceBillNo = data[0]["单据号"]; |
| | | this.hform.HMainSourceInterID = data[0]["hmainid"]; |
| | | this.hform.HMainSourceEntryID = data[0]["hsubid"]; |
| | | |
| | | // 如果源单有设备信息,可以自动填充 |
| | | if (data[0].HEquipID) { |
| | | this.hform.HEquipID = data[0].HEquipID; |
| | | this.getEquipFileMain(data[0].HEquipID); |
| | | } |
| | | |
| | | } else { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: `获取源单单号失败: ${Message}` |
| | | }); |
| | | } |
| | | } catch (err) { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: `获取源单单号失败: ${err}` |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 根据设备ID获取设备信息 |
| | | async getEquipFileMain(HInterID) { |
| | | try { |
| | | let res = await CommonUtils.doRequest2Sync({ |
| | | url: "/Sb_PDA_EquipDotCheckBill/txtHBarCode_KeyDown_ListByHEquipID", |
| | | data: { |
| | | HEquipID: HInterID, |
| | | }, |
| | | }); |
| | | |
| | | if (!res) { |
| | | return; |
| | | } |
| | | |
| | | let { |
| | | data, |
| | | count, |
| | | Message |
| | | } = res.data; |
| | | |
| | | if (count == 1) { |
| | | this.hform.HEquipID = data[0].hmainid; |
| | | this.hform.HBarName = data[0].设备名称; |
| | | this.hform.HBarSpec = data[0].设备规格; |
| | | this.hform.HBarModel = data[0].设备型号; |
| | | this.hform.HBarCode = data[0].设备条码 || ""; |
| | | this.enableEdit = false; |
| | | } else { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: Message |
| | | }); |
| | | } |
| | | } catch (err) { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: err |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 维修项目 |
| | | async getRepairList() { |
| | | try{ |
| | |
| | | } |
| | | if (this.hform.HEmpID == 0) { |
| | | return { |
| | | Message: "验收人不得为空!", |
| | | Message: "维修人不得为空!", |
| | | state: false |
| | | } |
| | | } |
| | | if (this.hform.HRepairCheckMainID == 0) { |
| | | if (this.hform.HRepairID == 0) { |
| | | return { |
| | | Message: "验证项目不得为空!", |
| | | Message: "维修项目不得为空!", |
| | | state: false |
| | | } |
| | | } |
| | |
| | | return { |
| | | Message: "负责人不得为空!", |
| | | state: false |
| | | } |
| | | } |
| | | // 添加源单校验(如果不是手工录入,则必须选择源单) |
| | | if (this.hform.HMainSourceBillType !== '手工录入') { |
| | | if (!this.hform.HMainSourceBillNo || this.hform.HMainSourceBillNo.trim() === '') { |
| | | return { |
| | | Message: "源单类型非手工录入,必须选择源单!", |
| | | state: false |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // 获取职员数据 |
| | | 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: " where 1=1", |
| | | sWhere: sWhere, |
| | | } |
| | | }) |
| | | |
| | |
| | | }, |
| | | toScanCode() { |
| | | MpaasScan.scanCode(cb => { |
| | | this.hfrom.HBarCode = cb |
| | | this.hform.HBarCode = cb; // 修复:原来是 hfrom 应该是 hform |
| | | this.GetMessageByBarCode(cb) |
| | | }) |
| | | }, |
| | |
| | | HBarCode: HBarCode, |
| | | }, |
| | | }) |
| | | |
| | | |
| | | if (!res) { |
| | | return |
| | |
| | | this.hform.HBarName = data[0].设备名称 |
| | | this.hform.HBarSpec = data[0].设备规格 |
| | | this.hform.HBarModel = data[0].设备型号 |
| | | this.hform.HBarCode = HBarCode; // 确保条码正确显示 |
| | | this.hform.HQty = 1 |
| | | |
| | | this.enableEdit = false |
| | |
| | | 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: '温馨提示', |
| | | message: `获取点检规程错误: ${Message}` |
| | | }) |
| | | } |
| | | } catch (err) { |
| | | CommonUtils.showTips({ |
| | | title: '温馨提示', |
| | | message: `获取点检规程错误: ${err}` |
| | | }) |
| | | } |
| | | }, |
| | | }, |
| | | radioChange({ |
| | | detail: { |
| | | value |
| | |
| | | let oMain = JSON.stringify(this.hform); |
| | | this.HDetailList[0].HManagerID = this.hform.HManagerID |
| | | this.HDetailList[0].HRepairID = this.hform.HRepairID |
| | | let oprType = this.operationType |
| | | if(oprType == 4){ |
| | | oprType = 1 |
| | | } |
| | | let sSubStr = JSON.stringify(this.HDetailList); |
| | | let sMainSub = oMain + ';' + sSubStr + `;-1;${this.operationType}` + ';' + getUserInfo()[ |
| | | let sMainSub = oMain + ';' + sSubStr + `;-1;${oprType}` + ';' + getUserInfo()[ |
| | | 'Czymc']; |
| | | let res = await CommonUtils.doRequest2Sync({ |
| | | url: "/Sb_EquipRepairSendWorkBill/AddEquipRepairSendWorkBill", |
| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | } catch (err) { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: "提交单据失败: " + err |
| | | }) |
| | | } |
| | | }, |
| | | async getSourceBillInfo(HSourceBillType, HInterID, HBillNo) { |
| | | // 下推单据类型为设备故障登记单 |
| | | if(HSourceBillType == 3907) { |
| | | let res = await CommonUtils.doRequest2Async({ |
| | | url: "/Sb_EqpRepairWorkBill/Sb_EqpConkBookBillListCheckDetai", |
| | | data: { |
| | | HID: HInterID |
| | | } |
| | | }) |
| | | |
| | | let {data,code, count, Message} = res.data |
| | | |
| | | if(code == 1) { |
| | | console.log('data: ',data.h_v_Sb_EquipConkBookBillList_Edit); |
| | | let data1 = data.h_v_Sb_EquipConkBookBillList_Edit[0] |
| | | this.hform.HMainSourceBillType = HSourceBillType |
| | | this.HMainSourceBillType = '设备故障登记单' |
| | | this.hform.HMainSourceBillNo = data1.单据号 |
| | | this.hform.HMainSourceInterID = data1.hmainid |
| | | this.hform.HMainSourceEntryID = data1.hsubid |
| | | this.hform.HEquipID = data1.HEquipID |
| | | this.hform.HManagerName = data1.负责人 |
| | | this.hform.HManagerID = data1.HManagerID |
| | | this.hform.HBarName = data1.设备名称 |
| | | this.hform.HBarModel = data1.设备型号 |
| | | this.hform.HBarSpec = data1.设备规格 |
| | | this.hform.HRepairContent = data1.故障描述 |
| | | |
| | | } |
| | | else { |
| | | CommonUtils.showTips({ |
| | | title: '温馨提示', |
| | | message: `获取源单失败: ${Message}` |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | }, |
| | |
| | | // 复制 |
| | | } else if (this.operationType == 3) { |
| | | // 编辑 |
| | | |
| | | } else if (this.operationType == 4) { |
| | | // 浏览 |
| | | |
| | | let {HSourceBillType, HInterID, HBillNo} = e |
| | | // 下推 |
| | | // this.enableEdit = false; |
| | | // this.enableSourceBillEdit = false; |
| | | // this.showHMainSourceBillType = false; |
| | | this.getMaxNum() |
| | | this.getSourceBillInfo(HSourceBillType, HInterID, HBillNo) |
| | | } |
| | | |
| | | this.getHDeptList() |
| | | this.getEmpList() |
| | | this.getCheckProjList() |
| | | this.getRepairList() |
| | | this.loadCache() |
| | | |
| | | // 监听单据选择完成事件 |
| | | uni.$on('BillSelectComplete', (e) => { |
| | | console.log("接收到的消息: ", e) |
| | | this.hform.HMainSourceInterID = e.HInterID |
| | | this.hform.HMainSourceBillNo = e.HBillNo |
| | | this.hform.HMainSourceEntryID = e.HEntryID |
| | | this.hform.HEquipID = e.HEquipID |
| | | this.hform.HBarName = e.HEquipName |
| | | this.hform.HBarSpec = e.HEquipSpec |
| | | this.hform.HBarModel = e.HEquipModel |
| | | this.hform.HBarCode = e.HEquipBarCode || "" |
| | | this.$refs.billList.exit() |
| | | }) |
| | | }, |
| | | onUnload() { |
| | | uni.$off('BillSelectComplete') |
| | | }, |
| | | onReady() { |
| | | const query = uni.createSelectorQuery().in(this) |
| | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import "@/pages/MJGL/style/MJBillStyle.scss" |
| | | @import "@/pages/MJGL/style/MJBillStyle.scss"; |
| | | |
| | | .picker-overlay { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | z-index: 1; |
| | | } |
| | | </style> |