| | |
| | | <view class="form-item"> |
| | | <view class="title">条码</view> |
| | | <view class="right" style="width: 350rpx;"> |
| | | <input v-model="hform.HBarCode" placeholder="请扫描(或输入)条码" @confirm="getCode(hform.HBarCode)" @blur="getCode(hform.HBarCode)"/> |
| | | <input type="text" :focus="HBarCodeFocus" v-model="hform.HBarCode" placeholder="请扫描(或输入)条码" |
| | | @confirm="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 class="tabs"> |
| | | <view :class="tabs == 0 ? 'on':''" @tap="() => { tabs = 0; reFocusBarCode(); }">单据信息</view> |
| | | <view :class="tabs == 1 ? 'on':''" @tap="() => { tabs = 1; reFocusBarCode(); }">模具信息</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 v-if="tabs == 0"> |
| | | <view class="form-item"> |
| | | <view class="title">单据号:</view> |
| | | <view class="righton"> |
| | | <input name="HBillNo" disabled v-model="hform.HBillNo" /> |
| | | </view> |
| | | </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 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> |
| | | <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 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> |
| | | <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 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> |
| | | <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 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> |
| | | <view class="form-item"> |
| | | <view class="title">器具编码:</view> |
| | | <view class="righton"> |
| | | <input name="HMouldNumber" v-model="hform.HMouldNumber" disabled placeholder="请输入器具编码" /> |
| | | <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> |
| | | <view class="form-item"> |
| | | <view class="title">器具名称:</view> |
| | | <view class="righton"> |
| | | <input name="HMouldName" v-model="hform.HMouldName" disabled placeholder="请输入器具名称" /> |
| | | <view class="form-item"> |
| | | <view class="title">上模时间:</view> |
| | | <view class="righton"> |
| | | <input name="HScanDate" disabled v-model="hform.HScanDate" placeholder="请选择" /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="form-item"> |
| | | <view class="title">器具型号:</view> |
| | | <view class="righton"> |
| | | <input name="HMouldModel" v-model="hform.HMouldModel" disabled placeholder="请输入器具型号" /> |
| | | <view class="form-item"> |
| | | <view class="title">生产订单:</view> |
| | | <view class="righton"> |
| | | <input name="HICMOBillNo" disabled v-model="hform.HICMOBillNo" /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="form-item"> |
| | | <view class="title">数量:</view> |
| | | <view class="righton"> |
| | | <input name="HQty" v-model="hform.HQty" disabled placeholder="请输入数量" /> |
| | | <view class="form-item"> |
| | | <view class="title">流转卡:</view> |
| | | <view class="righton"> |
| | | <input disabled v-model="hform.HProcExchBillNo" /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="form-item"> |
| | | <view class="title">上模时间:</view> |
| | | <view class="righton"> |
| | | <input name="HScanDate" disabled v-model="hform.HScanDate" placeholder="请选择" /> |
| | | |
| | | <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> |
| | | |
| | | <view class="form-item"> |
| | | <view class="title">生产订单:</view> |
| | | <view class="righton"> |
| | | <input name="HICMOBillNo" disabled v-model="hform.HICMOBillNo" /> |
| | | </view> |
| | | <!-- 模具信息 --> |
| | | <view v-if="tabs == 1"> |
| | | <zb-table id="list-table" :checked-highlight="true" :fit="true" |
| | | :style="{height: `${listTableHeight}px`}" :columns="columns" :data="listData" :show-header="true" |
| | | :border="true" :row-key="row => row.index" @toggleRowSelection="handleSelect" |
| | | @toggleAllSelection="handleSelectAll" @rowClick="onTableRowClickHandler" /> |
| | | </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 v-if="showmore"> |
| | | <view class="form-item"> |
| | | <view class="title">制单人:</view> |
| | | <view class="righton"> |
| | | <input v-model="hform.HMaker" disabled/> |
| | | <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/> |
| | | <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/> |
| | | <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/> |
| | | <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/> |
| | | <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/> |
| | | <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="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 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修改 |
| | | import { |
| | | getUserInfo |
| | | } from "@/utils/auth.js"; |
| | | export default { |
| | | data() { |
| | | return { |
| | | // 计算列表高度 |
| | | bottomBtnTop: 0, |
| | | listTableTop: 0, |
| | | tabs: 0, |
| | | |
| | | 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:[], |
| | | |
| | | |
| | | HBarCodeFocus: false, |
| | | |
| | | arrayHDeptName: [], //部门 |
| | | HDeptNameList: [], |
| | | arrayHEmpName: [], //发现人/负责人 |
| | | HEmpNameList: [], |
| | | arrayHSourceName: [], //生产资源 |
| | | HSourceNameList: [], |
| | | |
| | | |
| | | isEdit: false, |
| | | hform:{ |
| | | HInterID:'', |
| | | HBillNo:'', |
| | | HDate:getDateTime.dateTimeStr('y-m-d'), |
| | | HBarCode:'', |
| | | HDeptName:'', |
| | | HDeptID:'', |
| | | HEmpName:'', |
| | | HEmpID:'', |
| | | HMangerName:'', |
| | | 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' |
| | | listOption: [], // 列表选项 |
| | | listData: [], // 表格数据 |
| | | selectedRows: [], // 表格选中的数据 |
| | | // 在columns配置中添加操作列 |
| | | columns: [ // 表格列配置 |
| | | { |
| | | type: 'selection', |
| | | fixed: true, |
| | | width: 50 |
| | | }, |
| | | { |
| | | name: 'index', |
| | | label: '序号', |
| | | width: 60, |
| | | hidden: true |
| | | }, |
| | | { |
| | | name: 'HMouldID', |
| | | label: 'HMouldID', |
| | | width: 100, |
| | | hidden: true |
| | | }, |
| | | { |
| | | name: '器具数量', |
| | | label: '器具数量', |
| | | width: 120 |
| | | }, |
| | | { |
| | | name: '器具编码', |
| | | label: '器具编码', |
| | | width: 150 |
| | | }, |
| | | { |
| | | name: '器具名称', |
| | | label: '器具名称', |
| | | width: 120 |
| | | }, |
| | | { |
| | | name: '器具型号', |
| | | label: '器具型号', |
| | | width: 120 |
| | | }, |
| | | { |
| | | name: '器具条码', |
| | | label: '器具条码', |
| | | width: 120 |
| | | } |
| | | ], |
| | | |
| | | 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('HEmpName'), |
| | | HMangerID: uni.getStorageSync('HEmpID'), |
| | | |
| | | |
| | | HSourceName: '', |
| | | HSourceID: '0', |
| | | HQty: '0', |
| | | HScanDate: getDateTime.dateTimeStr('y-m-d h:i:s'), |
| | | HMaterID: '0', |
| | | HICMOBillNo: '', |
| | | HICMOInterID: '0', |
| | | HICMOEntryID: '0', |
| | | HProcExchBillNo: '', |
| | | HProcExchInterID: '0', |
| | | HProcExchEntryID: '0', |
| | | HOrgID: uni.getStorageSync('OrganizationID'), |
| | | |
| | | HMaker: '', |
| | | HMakeDate: '', |
| | | HUpDater: '', |
| | | HUpDateDate: '', |
| | | HChecker: '', |
| | | HCheckDate: '', |
| | | HCloseMan: '', |
| | | HCloseDate: '', |
| | | HDeleteMan: '', |
| | | HDeleteDate: '', |
| | | |
| | | eventType: 'Add' |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | }, |
| | | onLoad(e) { |
| | | |
| | | this.HBarCodeFocus = true |
| | | this.getHDeptList() |
| | | this.getHEmpList() |
| | | this.getHSourceList() |
| | | this.hform.HMaker = uni.getStorageSync('HUserName') |
| | | console.log(e,this.userInfo) |
| | | if(e.linterid){ |
| | | 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.getMouldDetailData(e.linterid, e.HBillNo); |
| | | } else { |
| | | this.getNewData() |
| | | } |
| | | |
| | | this.getHDeptList() |
| | | this.getHEmpList() |
| | | this.getHSourceList() |
| | | this.tabs = 0 |
| | | }, |
| | | methods: { |
| | | // ==================== 计算属性 ==================== |
| | | computed: { |
| | | // 计算表格高度 |
| | | listTableHeight: { |
| | | get() { |
| | | return this.bottomBtnTop - this.listTableTop - 10 |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | //扫码 |
| | | toScanCode(){ |
| | | toScanCode() { |
| | | var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module") |
| | | mpaasScanModule.mpaasScan({ |
| | | 'hideAlbum': true, |
| | | 'timeoutInterval':'10', //超时时间 |
| | | 'timeoutText':'未识别到二维码' //超时提醒 |
| | | },(ret) => { |
| | | 'timeoutInterval': '10', //超时时间 |
| | | 'timeoutText': '未识别到二维码' //超时提醒 |
| | | }, (ret) => { |
| | | console.log(ret.resp_result) |
| | | this.hform.HBarCode = ret.resp_result |
| | | this.getHBarCodeData(ret.resp_result) |
| | | }) |
| | | }, |
| | | //光标 |
| | | async refreshBarCodeState() { |
| | | this.HBarCodeFocus = false |
| | | await this.$nextTick(() => { |
| | | this.HBarCodeFocus = true |
| | | this.hform.HBarCode = "" |
| | | }) |
| | | }, |
| | | // 添加一个重新聚焦的方法 |
| | | reFocusBarCode() { |
| | | this.HBarCodeFocus = false; |
| | | this.$nextTick(() => { |
| | | this.HBarCodeFocus = true; |
| | | }); |
| | | }, |
| | | // 表格行点击处理 |
| | | onTableRowClickHandler(row, index) { |
| | | if (!this.listData[index].checked) { |
| | | this.$set(this.listData[index], 'checked', true) |
| | | } else { |
| | | this.listData[index].checked = !this.listData[index].checked |
| | | } |
| | | }, |
| | | |
| | | // 表格选择处理 |
| | | handleSelect(selected, array) { |
| | | this.selectedRows = array |
| | | }, |
| | | |
| | | // 表格全选处理 |
| | | handleSelectAll(selected, array) { |
| | | this.selectedRows = array |
| | | }, |
| | | // 表格行删除 |
| | | deleteSelected() { |
| | | if (this.selectedRows.length === 0) { |
| | | uni.showToast({ |
| | | title: '请先选择要删除的模具', |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | // 显示确认对话框 |
| | | uni.showModal({ |
| | | title: '确认删除', |
| | | content: `确定要删除选中的${this.selectedRows.length}条数据吗?`, |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | // 获取选中行的HMouldID集合 |
| | | const selectedIds = this.selectedRows.map(row => row.HMouldID) |
| | | |
| | | // 过滤掉选中的数据 |
| | | this.listData = this.listData.filter(item => |
| | | !selectedIds.includes(item.HMouldID) |
| | | ) |
| | | |
| | | // 重新计算序号 |
| | | this.listData.forEach((item, index) => { |
| | | item.index = index + 1 |
| | | }) |
| | | |
| | | // 清空选中状态 |
| | | this.selectedRows = [] |
| | | |
| | | uni.showToast({ |
| | | title: '删除成功', |
| | | icon: 'success' |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | //日期 |
| | | HDateChange(e){ |
| | | HDateChange(e) { |
| | | console.log(e.detail.value) |
| | | this.hform.HDate = e.detail.value |
| | | }, |
| | | getHBarCodeData(HBarCode) { |
| | | if(!this.hform.HSourceName){ |
| | | uni.showToast({ |
| | | title:'请先选择生产资源', |
| | | icon:'none' |
| | | }); |
| | | return; |
| | | if (uni.getStorageSync('Organization') == "杭州斯莫尔磁性材料有限公司") { |
| | | if (!this.hform.HSourceName) { |
| | | uni.showToast({ |
| | | title: '请先选择生产资源', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | var HBillType = ""; |
| | | var barNo = ""; |
| | | if (HBarCode.length < 22) { |
| | | barNo = HBarCode.substr(0, 4); |
| | | switch (barNo) { |
| | | case "GXLX": |
| | | if (HBarCode.substr(0, 4) === "GXLX") { |
| | | HBillType = "3772"; |
| | | break; |
| | | } else if (HBarCode.substr(0, 2) === "WP") { |
| | | HBillType = "3710"; |
| | | } else if (HBarCode.substr(0, 4) === "SCRW") { |
| | | HBillType = "3710"; |
| | | } |
| | | } |
| | | |
| | |
| | | case "https://www.aliwork.com": |
| | | HBillType = "3308"; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | uni.request({ |
| | | url: this.serverUrl + '/Sc_MouldUpperBill/txtHBarCode_KeyDown', |
| | | data: { |
| | | HBarCode: this.hform.HBarCode, |
| | | HSourceID:this.hform.HSourceID, |
| | | UserID:uni.getStorageSync('Czybm'), |
| | | HBillType:HBillType |
| | | HSourceID: this.hform.HSourceID, |
| | | UserID: uni.getStorageSync('Czybm'), |
| | | HBillType: HBillType |
| | | }, |
| | | success: (res) => { |
| | | console.log(2, res.data); |
| | | if (res.data.code == 1) { |
| | | var data = res.data.data[0]; |
| | | console.log(3, data); |
| | | var num=data.Num; |
| | | var num = data.Num; |
| | | console.log(4, num); |
| | | switch (num) { |
| | | case 1: |
| | | this.hform.HSourceID = data.HItemID; |
| | | this.hform.HSourceName = data.HName; |
| | | break; |
| | | this.refreshBarCodeState(); |
| | | break; |
| | | |
| | | case 2: |
| | | this.hform.HICMOBillNo = data.单据号; |
| | | this.hform.HICMOInterID = data.hmainid; |
| | | this.hform.HICMOEntryID = data.HEntryID; |
| | | break; |
| | | this.hform.HMaterID = data.HMaterID; |
| | | this.refreshBarCodeState(); |
| | | if (uni.getStorageSync('OrganizationID') == "100007" && uni.getStorageSync( |
| | | 'Organization') == "事业一处") { |
| | | //获取器具清单 |
| | | this.GetMaterialMouldList(); |
| | | } |
| | | break; |
| | | |
| | | case 3: |
| | | this.hform.HMouldID = data.hmainid; |
| | | this.hform.HMouldNumber = data.模具编号; |
| | | this.hform.HMouldName = data.模具名称; |
| | | this.hform.HMouldModel = data.模具型号; |
| | | this.hform.HQty = 1; |
| | | break; |
| | | if (!this.hform.HICMOBillNo && !this.hform.HProcExchBillNo) { |
| | | uni.showToast({ |
| | | title: '请先扫描生产工单', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 先调用模具档案检查,校验通过后才添加数据 |
| | | this.getMould_FC().then(isValid => { |
| | | if (isValid) { |
| | | this.tabs = 1; |
| | | // 检查模具是否已存在于表格中 |
| | | const existingIndex = this.listData.findIndex(item => |
| | | item.HMouldID === data.hmainid |
| | | ); |
| | | if (uni.getStorageSync('OrganizationID') == "100007" && uni |
| | | .getStorageSync('Organization') == "事业一处") { |
| | | if (existingIndex === -1) { |
| | | // 如果不存在,添加到表格 |
| | | uni.showToast({ |
| | | title: '当前检具不在当前物料的检具清单中', |
| | | icon: 'none', |
| | | duration: 1500 |
| | | }); |
| | | this.refreshBarCodeState(); |
| | | } else { |
| | | // 如果已存在,检查器具数量 |
| | | if (this.listData[existingIndex].器具数量 === 0) { |
| | | // 器具数量为0,更新条码并将数量变为1 |
| | | this.listData[existingIndex].器具条码 = this.hform |
| | | .HBarCode; |
| | | this.listData[existingIndex].器具数量 = 1; |
| | | uni.showToast({ |
| | | title: '扫描成功', |
| | | icon: 'success', |
| | | duration: 1500 |
| | | }); |
| | | this.refreshBarCodeState(); |
| | | } else { |
| | | // 器具数量已为1,提示不允许重复扫描 |
| | | uni.showToast({ |
| | | title: '该模具已扫描,不允许重复扫描', |
| | | icon: 'none', |
| | | duration: 1500 |
| | | }); |
| | | this.refreshBarCodeState(); |
| | | } |
| | | } |
| | | } else { |
| | | if (existingIndex === -1) { |
| | | // 如果不存在,添加到表格 |
| | | const newRow = { |
| | | index: this.listData.length + 1, |
| | | HMouldID: data.hmainid, |
| | | 器具编码: data.模具编号, |
| | | 器具名称: data.模具名称, |
| | | 器具型号: data.模具型号, |
| | | 器具条码: this.hform.HBarCode, |
| | | 器具数量: 1, |
| | | checked: false // 默认不选中 |
| | | }; |
| | | this.listData.push(newRow); |
| | | this.refreshBarCodeState(); |
| | | } else { |
| | | // 如果已存在,提示用户 |
| | | uni.showToast({ |
| | | title: '该模具已扫描', |
| | | icon: 'none', |
| | | duration: 1500 |
| | | }); |
| | | this.refreshBarCodeState(); |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | // 校验不通过,清空条码但不添加数据 |
| | | this.refreshBarCodeState(); |
| | | } |
| | | }).catch(error => { |
| | | console.log('校验失败:', error); |
| | | this.refreshBarCodeState(); |
| | | }); |
| | | break; |
| | | |
| | | case 4: |
| | | this.hform.HProcExchBillNo = data.单据号; |
| | |
| | | this.hform.HICMOBillNo = data.任务单号; |
| | | this.hform.HICMOInterID = data.hicmointerid; |
| | | this.hform.HICMOEntryID = data.HICMOEntryID; |
| | | break; |
| | | this.hform.HMaterID = data.HMaterID; |
| | | this.refreshBarCodeState(); |
| | | if (uni.getStorageSync('OrganizationID') == "100007" && uni.getStorageSync( |
| | | 'Organization') == "事业一处") { |
| | | //获取器具清单 |
| | | this.GetMaterialMouldList(); |
| | | } |
| | | break; |
| | | default: |
| | | uni.showToast({ |
| | | title: '未知的返回类型', |
| | | icon: 'none', |
| | | }); |
| | | break; |
| | | break; |
| | | } |
| | | |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.data.Message, |
| | |
| | | }) |
| | | }, |
| | | }); |
| | | }, |
| | | }, |
| | | //获取使用部门数据 |
| | | getHDeptList(){ |
| | | 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){ |
| | | 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++){ |
| | | for (var i = 0; i < res.data.data.length; i++) { |
| | | this.arrayHDeptName[i] = res.data.data[i].HName |
| | | } |
| | | this.$forceUpdate(); |
| | | }else{ |
| | | } else { |
| | | uni.showToast({ |
| | | title:res.data.Message, |
| | | icon:'none' |
| | | title: res.data.Message, |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | fail: (res) => { |
| | | console.log(res); |
| | | uni.showToast({ |
| | | title:'接口请求失败', |
| | | icon:'none' |
| | | title: '接口请求失败', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | }); |
| | | }, |
| | | //选择使用部门 |
| | | HDeptNameChange(e){ |
| | | for(var i=0;i<this.HDeptNameList.length;i++){ |
| | | if(this.HDeptNameList[i].HName == e){ |
| | | 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(){ |
| | | getHEmpList() { |
| | | uni.request({ |
| | | url: this.serverUrl + '/Web/GetEmployeeList_Json', |
| | | data: { Employee: '',HGroupID:0 }, |
| | | url: this.serverUrl + '/Web/GetEmployeeList_Json', |
| | | data: { |
| | | Employee: '', |
| | | HGroupID: 0 |
| | | }, |
| | | success: (res) => { |
| | | if(res.data.count == 1){ |
| | | if (res.data.count == 1) { |
| | | this.HEmpNameList = res.data.data |
| | | for(var i=0;i<res.data.data.length;i++){ |
| | | for (var i = 0; i < res.data.data.length; i++) { |
| | | this.arrayHEmpName[i] = res.data.data[i].HName |
| | | } |
| | | this.$forceUpdate(); |
| | | }else{ |
| | | } else { |
| | | uni.showToast({ |
| | | title:res.data.Message, |
| | | icon:'none' |
| | | title: res.data.Message, |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | fail: (res) => { |
| | | console.log(res); |
| | | uni.showToast({ |
| | | title:'接口请求失败', |
| | | icon:'none' |
| | | title: '接口请求失败', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | }); |
| | | }, |
| | | //选择操作员 |
| | | HEmpNameChange(e){ |
| | | for(var i=0;i<this.HEmpNameList.length;i++){ |
| | | if(this.HEmpNameList[i].HName == e){ |
| | | HEmpNameChange(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){ |
| | | 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(){ |
| | | getHSourceList() { |
| | | uni.request({ |
| | | url: this.serverUrl + '/api/newBill/getSourceList', |
| | | data: { sWhere: '' }, |
| | | url: this.serverUrl + '/api/newBill/getSourceList', |
| | | data: { |
| | | sWhere: " and HUSEORGID = " + uni.getStorageSync('OrganizationID') + "" |
| | | }, |
| | | success: (res) => { |
| | | if(res.data.code == 1){ |
| | | if (res.data.code == 1) { |
| | | this.HSourceNameList = res.data.data.Gy_Source |
| | | for(var i=0;i<res.data.data.Gy_Source.length;i++){ |
| | | for (var i = 0; i < res.data.data.Gy_Source.length; i++) { |
| | | this.arrayHSourceName[i] = res.data.data.Gy_Source[i].生产资源 |
| | | } |
| | | this.$forceUpdate(); |
| | | }else{ |
| | | } else { |
| | | uni.showToast({ |
| | | title:res.data.Message, |
| | | icon:'none' |
| | | title: res.data.Message, |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | fail: (res) => { |
| | | console.log(res); |
| | | uni.showToast({ |
| | | title:'接口请求失败', |
| | | icon:'none' |
| | | title: '接口请求失败', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | }); |
| | | }, |
| | | //选择生产资源 |
| | | HSourceNameChange(e){ |
| | | for(var i=0;i<this.HSourceNameList.length;i++){ |
| | | if(this.HSourceNameList[i].生产资源 == e){ |
| | | HSourceNameChange(e) { |
| | | for (var i = 0; i < this.HSourceNameList.length; i++) { |
| | | if (this.HSourceNameList[i].生产资源 == e) { |
| | | this.hform.HSourceID = this.HSourceNameList[i].HItemID |
| | | } |
| | | } |
| | | }, |
| | | ifEdit(){ |
| | | ifEdit() { |
| | | this.isEdit = true |
| | | this.hform.eventType = 'Modify' |
| | | }, |
| | | //编辑回显 |
| | | getEditData(linterid,HBillNo){ |
| | | getEditData(linterid, HBillNo) { |
| | | //主表 |
| | | var sWhere = " and hmainid='" + linterid + "'"; |
| | | uni.request({ |
| | | url: this.serverUrl + '/Sc_MouldUpperBill/Sc_MouldUpperBillList', |
| | | 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{ |
| | | url: this.serverUrl + '/Sc_MouldUpperBill/Sc_MouldUpperBillList', |
| | | 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.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' |
| | | title: res.data.Message, |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | fail: (res) => { |
| | | console.log(res); |
| | | uni.showToast({ |
| | | title:'接口请求失败', |
| | | icon:'none' |
| | | title: '接口请求失败', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | }); |
| | | }); |
| | | }, |
| | | // 编辑获取模具明细的方法 |
| | | getMouldDetailData(linterid) { |
| | | var sWhere = " and hmainid='" + linterid + "'"; |
| | | uni.request({ |
| | | url: this.serverUrl + '/Sc_MouldUpperBill/Sc_MouldUpperBillList', |
| | | data: { |
| | | sWhere: sWhere, |
| | | user: uni.getStorageSync('HUserName') |
| | | }, |
| | | success: (res) => { |
| | | if (res.data.code == 1 && res.data.data && res.data.data.length > 0) { |
| | | this.listData = []; |
| | | |
| | | res.data.data.forEach((item, index) => { |
| | | this.listData.push({ |
| | | index: index + 1, |
| | | HMouldID: item.HMouldID, |
| | | 器具编码: item.模具编码 || item.HMouldNumber, |
| | | 器具名称: item.模具名称 || item.HMouldName, |
| | | 器具型号: item.模具规格 || item.HMouldModel, |
| | | 器具条码: item.条形码 || item.HBarCode, |
| | | 器具数量: item.数量 || item.HBarCode |
| | | }); |
| | | }); |
| | | |
| | | this.selectedRows = [...this.listData]; |
| | | } |
| | | }, |
| | | fail: (res) => { |
| | | console.log('获取模具明细失败:', res); |
| | | } |
| | | }); |
| | | }, |
| | | // 提供工单的物料自动带出对应的产品器具清单 |
| | | GetMaterialMouldList() { |
| | | var sWhere = " and HMaterID='" + this.hform.HMaterID + "'"; |
| | | uni.request({ |
| | | url: this.serverUrl + '/Sc_MouldUpperBill/GetMaterialMouldList', |
| | | data: { |
| | | sWhere: sWhere, |
| | | user: uni.getStorageSync('HUserName') |
| | | }, |
| | | success: (res) => { |
| | | if (res.data.code == 1 && res.data.data && res.data.data.length > 0) { |
| | | this.listData = []; |
| | | this.tabs=1; |
| | | res.data.data.forEach((item, index) => { |
| | | this.listData.push({ |
| | | index: index + 1, |
| | | HMouldID: item.HMouldID, |
| | | 器具编码: item.模具编号 || item.HMouldNumber, |
| | | 器具名称: item.模具名称 || item.HMouldName, |
| | | 器具型号: item.模具型号 || item.HMouldModel, |
| | | 器具条码: item.条形码 || item.HBarCode, |
| | | 器具数量: 0 |
| | | }); |
| | | }); |
| | | |
| | | this.selectedRows = [...this.listData]; |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.data.Message, |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | fail: (res) => { |
| | | console.log('获取模具明细失败:', res); |
| | | } |
| | | }); |
| | | }, |
| | | // 条码扫描时候判断是否是存在模具档案 并且是否存在产品器具清单 |
| | | getMould_FC() { |
| | | return new Promise((resolve, reject) => { |
| | | uni.request({ |
| | | url: this.serverUrl + '/Sc_MouldUpperBill/GetBarCode_FC', |
| | | data: { |
| | | HBarCode: this.hform.HBarCode, |
| | | HMaterID: this.hform.HMaterID |
| | | }, |
| | | success: (res) => { |
| | | if (res.data.code == 1) { |
| | | // 校验通过 |
| | | resolve(true); |
| | | } else { |
| | | // 校验不通过,显示错误信息 |
| | | uni.showToast({ |
| | | title: res.data.Message || '模具档案校验失败', |
| | | icon: 'none' |
| | | }); |
| | | resolve(false); |
| | | } |
| | | }, |
| | | fail: (res) => { |
| | | console.log('获取模具条码失败:', res); |
| | | uni.showToast({ |
| | | title: '校验失败,请检查网络', |
| | | icon: 'none' |
| | | }); |
| | | resolve(false); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | //新增 |
| | | getNewData(){ |
| | | getNewData() { |
| | | uni.request({ |
| | | url: this.serverUrl + '/Web/GetMAXNum', |
| | | data: { HBillType: '3846' }, |
| | | success: (res) => { |
| | | url: this.serverUrl + '/Web/GetMAXNum', |
| | | data: { |
| | | HBillType: '3846' |
| | | }, |
| | | success: (res) => { |
| | | console.log(res.data) |
| | | if(res.data.count == 1){ |
| | | 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{ |
| | | this.btnType = 1 |
| | | } else { |
| | | uni.showToast({ |
| | | title:res.data.Message, |
| | | icon:'none' |
| | | title: res.data.Message, |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | fail: (res) => { |
| | | console.log(res); |
| | | uni.showToast({ |
| | | title:'接口请求失败', |
| | | icon:'none' |
| | | title: '接口请求失败', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | }); |
| | | }, |
| | | submit() { |
| | | if(!this.hform.HBarCode){ |
| | | uni.showToast({ |
| | | title:'请扫描模具条形码', |
| | | icon:'none' |
| | | }) |
| | | }else if(!this.hform.HSourceName){ |
| | | submit() { |
| | | if (uni.getStorageSync('Organization') == "杭州斯莫尔磁性材料有限公司") { |
| | | if (!this.hform.HSourceName) { |
| | | uni.showToast({ |
| | | title: '请先选择生产资源', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | if (this.listData.length === 0) { |
| | | uni.showToast({ |
| | | title:'请选择生产资源', |
| | | icon:'none' |
| | | title: '请至少添加一个模具', |
| | | icon: 'none' |
| | | }) |
| | | }else if(!this.hform.HMouldName){ |
| | | } |
| | | // 如果是事业一处组织,校验器具数量 |
| | | if (uni.getStorageSync('OrganizationID') === "100007" && uni.getStorageSync('Organization') === "事业一处") { |
| | | const zeroQtyItem = this.listData.find(item => { |
| | | // 考虑0、null、undefined等异常情况 |
| | | const qty = Number(item.器具数量) || 0; |
| | | return qty <= 0; |
| | | }); |
| | | |
| | | if (zeroQtyItem) { |
| | | // 找到第一个数量异常项的位置(索引+1) |
| | | const index = this.listData.indexOf(zeroQtyItem) + 1; |
| | | const code = zeroQtyItem.器具编码 || '未知编码'; |
| | | uni.showToast({ |
| | | title: `第${index}行【${code}】器具数量为0,请检查`, |
| | | icon: 'none', |
| | | duration: 3000 |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | if (!this.hform.HEmpName) { |
| | | uni.showToast({ |
| | | title:'模具不能为空', |
| | | icon:'none' |
| | | title: '请选择操作员', |
| | | icon: 'none' |
| | | }) |
| | | }else if(!this.hform.HEmpName){ |
| | | } else if (!this.hform.HMangerName) { |
| | | uni.showToast({ |
| | | title:'请选择操作员', |
| | | icon:'none' |
| | | title: '请选择负责人', |
| | | icon: 'none' |
| | | }) |
| | | }else if(!this.hform.HMangerName){ |
| | | } else if (!this.hform.HDeptName) { |
| | | uni.showToast({ |
| | | title:'请选择负责人', |
| | | icon:'none' |
| | | 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_MouldUpperBill_PDA', |
| | | method:'POST', |
| | | dataType:"json", |
| | | data:{ oMain: sMainSub }, |
| | | success: (res) => { |
| | | console.log(1,res); |
| | | } else { |
| | | uni.showLoading({ |
| | | title: '请稍候' |
| | | }) |
| | | // ========== 第一步:构建主表数据 ========== |
| | | const mainData = { |
| | | HBillNo: this.hform.HBillNo, |
| | | HInterID: this.hform.HInterID, |
| | | HDate: this.hform.HDate, |
| | | |
| | | // 扫码信息 |
| | | HBarCode: this.hform.HBarCode, |
| | | |
| | | // 部门信息 |
| | | HDeptName: this.hform.HDeptName, |
| | | HDeptID: this.hform.HDeptID, |
| | | |
| | | // 人员信息 |
| | | HEmpName: this.hform.HEmpName, |
| | | HEmpID: this.hform.HEmpID, |
| | | HMangerName: this.hform.HMangerName, |
| | | HMangerID: this.hform.HMangerID, |
| | | |
| | | // 其他信息 |
| | | HRemark: this.hform.HRemark || "", |
| | | HOrgID: this.hform.HOrgID, |
| | | |
| | | // 系统字段 |
| | | HMaker: this.hform.HMaker || uni.getStorageSync('HUserName'), |
| | | hupdater: this.hform.HUpDater || uni.getStorageSync('HUserName'), |
| | | hchecker: this.hform.HChecker || "", |
| | | HMakeDate: this.hform.HMakeDate || getDateTime.dateTimeStr('y-m-d'), |
| | | hupdatedate: this.hform.HUpDateDate || getDateTime.dateTimeStr('y-m-d'), |
| | | hcheckdate: this.hform.HCheckDate || "", |
| | | hdeleteman: this.hform.HDeleteMan || "", |
| | | hdeletedate: this.hform.HDeleteDate || "", |
| | | }; |
| | | |
| | | // ========== 第二步:构建明细数据 ========== |
| | | const detailData = this.listData.map((item, index) => ({ |
| | | HMouldID: item.HMouldID, |
| | | HMouldNumber: item.器具编码, |
| | | HMouldName: item.器具名称, |
| | | HMouldModel: item.器具型号, |
| | | HBarCode: item.器具条码, |
| | | HQty: 1, // 每个模具数量默认为1 |
| | | |
| | | // 从hform中复用的生产信息 |
| | | HSourceID: this.hform.HSourceID, |
| | | HSourceName: this.hform.HSourceName, |
| | | HICMOInterID: this.hform.HICMOInterID || "0", |
| | | HICMOEntryID: this.hform.HICMOEntryID || "0", |
| | | HICMOBillNo: this.hform.HICMOBillNo || "", |
| | | |
| | | LAY_TABLE_INDEX: index // 从0开始的索引 |
| | | })); |
| | | |
| | | // ========== 第三步:拼接完整数据 ========== |
| | | const submitStr = JSON.stringify(mainData) + ";" + JSON.stringify(detailData) + ";" + this.btnType + |
| | | ";" + uni.getStorageSync('HUserName'); |
| | | |
| | | |
| | | console.log(submitStr); |
| | | uni.request({ |
| | | url: this.serverUrl + '/Sc_MouldUpperBill/AddSc_MouldUpperBill_APP', |
| | | method: 'POST', |
| | | dataType: "json", |
| | | data: { |
| | | sMainSub: submitStr |
| | | }, |
| | | success: (res) => { |
| | | console.log(1, res); |
| | | uni.hideLoading() |
| | | if(res.data.count == 1){ |
| | | if (res.data.count == 1) { |
| | | let pages = getCurrentPages(); |
| | | let prePage = pages[pages.length - 2]; |
| | | prePage.$vm.getList() |
| | | if(this.isEdit){ |
| | | setTimeout(()=>{ |
| | | let prePage = pages[pages.length - 2]; |
| | | |
| | | if (this.isEdit) { |
| | | setTimeout(() => { |
| | | uni.redirectTo({ |
| | | url:'/pages/weiwaigxIn/Cj_StationEntrustInBill?linterid=' + this.linterid + '&HBillNo=' + this.linterid |
| | | url: '/pages/shangmudan/MouldUpperBill?linterid=' + |
| | | this.linterid + '&HBillNo=' + this.HBillNo |
| | | }) |
| | | },1000) |
| | | }else{ |
| | | setTimeout(()=>{ |
| | | }, 1000) |
| | | } else { |
| | | setTimeout(() => { |
| | | uni.navigateBack() |
| | | },1000) |
| | | }, 1000) |
| | | } |
| | | } |
| | | uni.showToast({ |
| | | title:res.data.Message, |
| | | icon:'none' |
| | | }) |
| | | }, |
| | | fail: (res) => { |
| | | console.log(res); |
| | | uni.showToast({ |
| | | title:'接口请求失败', |
| | | icon:'none' |
| | | }) |
| | | }, |
| | | }); |
| | | } |
| | | }, |
| | | goBack(){ |
| | | } |
| | | 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('用户点击确定'); |
| | | title: '提示', |
| | | content: '确认要退出当前页面吗?', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | console.log('用户点击确定'); |
| | | uni.navigateBack() |
| | | } else if (res.cancel) { |
| | | console.log('用户点击取消'); |
| | | } |
| | | } |
| | | } else if (res.cancel) { |
| | | console.log('用户点击取消'); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .form{ |
| | | .form { |
| | | width: 668rpx; |
| | | margin: 20rpx auto; |
| | | padding-bottom: 240rpx; |
| | | } |
| | | .tab_area{ |
| | | |
| | | .tab_area { |
| | | width: 100%; |
| | | height: 50rpx; |
| | | } |
| | | .other{ |
| | | |
| | | .other { |
| | | margin-top: 8rpx; |
| | | text-align: center; |
| | | font-size: 28rpx; |
| | | padding: 4rpx 18rpx; |
| | | color: #1890FF; |
| | | } |
| | | .form-item{ |
| | | |
| | | .form-item { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 30rpx; |
| | | padding: 6rpx 0; |
| | | .title{ |
| | | |
| | | .title { |
| | | width: 208rpx; |
| | | text{ |
| | | |
| | | text { |
| | | color: red; |
| | | font-weight: bold; |
| | | } |
| | | } |
| | | .right{ |
| | | |
| | | .right { |
| | | width: 450rpx; |
| | | border-radius: 22rpx; |
| | | border: 1px solid #acacac; |
| | | } |
| | | .righton{ |
| | | |
| | | .righton { |
| | | width: 450rpx; |
| | | border-radius: 22rpx; |
| | | border: 1px solid #e4e4e4; |
| | | background-color: #e4e4e4; |
| | | } |
| | | input{ |
| | | |
| | | input { |
| | | width: 100%; |
| | | padding: 8rpx 20rpx; |
| | | font-size: 30rpx; |
| | | } |
| | | textarea{ |
| | | |
| | | textarea { |
| | | width: 98%; |
| | | padding: 8rpx 20rpx; |
| | | font-size: 30rpx; |
| | | } |
| | | |
| | | } |
| | | .bottom-btn{ |
| | | |
| | | .bottom-btn { |
| | | width: 100%; |
| | | // height: 120rpx; |
| | | position: fixed; |
| | |
| | | background-color: #fff; |
| | | box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4); |
| | | padding: 30rpx 40rpx 40rpx 40rpx; |
| | | button{ |
| | | |
| | | button { |
| | | border-radius: 50rpx; |
| | | width: 180rpx; |
| | | height: 66rpx; |
| | | line-height: 66rpx; |
| | | font-size: 28rpx; |
| | | } |
| | | .btn-a{ |
| | | |
| | | .btn-a { |
| | | background-color: #3A78FF; |
| | | color: #fff; |
| | | } |
| | | .btn-b{ |
| | | |
| | | .btn-b { |
| | | background-color: #41a863; |
| | | color: #fff; |
| | | } |
| | | .btn-c{ |
| | | |
| | | .btn-c { |
| | | background-color: #acacac; |
| | | color: #fff; |
| | | position: absolute; |
| | | right: 120rpx; |
| | | } |
| | | .btn-d{ |
| | | |
| | | .btn-d { |
| | | background-color: #ff8901; |
| | | color: #fff; |
| | | } |
| | | } |
| | | |
| | | .tabs { |
| | | width: 100%; |
| | | display: flex; |
| | | border-bottom: 1px solid #ddd; |
| | | margin: 20rpx 0; |
| | | |
| | | view { |
| | | width: 25%; |
| | | font-size: 30rpx; |
| | | color: #555; |
| | | text-align: center; |
| | | padding: 16rpx 0; |
| | | } |
| | | |
| | | .on { |
| | | color: #3a78ff; |
| | | font-weight: bold; |
| | | border-bottom: 3px solid #3a78ff; |
| | | } |
| | | } |
| | | </style> |