| | |
| | | <view class="tabs"> |
| | | <view :class="tabs == 0 ? 'on':''" @tap="() => { tabs = 0; reFocusBarCode(); }">单据信息</view> |
| | | <view :class="tabs == 1 ? 'on':''" @tap="() => { tabs = 1; reFocusBarCode(); }">模具信息</view> |
| | | <view :class="tabs == 2 ? 'on':''" @tap="() => { tabs = 2; reFocusBarCode(); }">制单信息</view> |
| | | </view> |
| | | |
| | | <!-- 单据信息 --> |
| | |
| | | </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 class="card-list" :style="{height: `${listTableHeight}px`, overflow: 'auto'}"> |
| | | <!-- 卡片列表 --> |
| | | <view v-for="(item, index) in listData" :key="index" class="card-item"> |
| | | <uni-card style="margin: 10rpx 0;"> |
| | | <view class="card-content"> |
| | | <view class="card-row"> |
| | | <text class="label">序号:</text> |
| | | <text class="value">{{ index + 1 }}</text> |
| | | </view> |
| | | <view class="card-row"> |
| | | <text class="label">器具编码:</text> |
| | | <text class="value">{{ item.器具编码 }}</text> |
| | | </view> |
| | | <view class="card-row"> |
| | | <text class="label">器具名称:</text> |
| | | <text class="value">{{ item.器具名称 }}</text> |
| | | </view> |
| | | <view class="card-row"> |
| | | <text class="label">器具型号:</text> |
| | | <text class="value">{{ item.器具型号 }}</text> |
| | | </view> |
| | | <view class="card-row"> |
| | | <text class="label">器具条码:</text> |
| | | <text class="value">{{ item.器具条码 }}</text> |
| | | </view> |
| | | <view class="card-row"> |
| | | <text class="label">器具数量:</text> |
| | | <text class="value">{{ item.器具数量 }}</text> |
| | | </view> |
| | | </view> |
| | | </uni-card> |
| | | </view> |
| | | |
| | | <view class="over" v-if="listData.length == 0">暂无模具数据</view> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="tab_area"></view> |
| | | |
| | | <view v-if="showmore"> |
| | | <view v-if="tabs == 2"> |
| | | <view class="form-item"> |
| | | <view class="title">制单人:</view> |
| | | <view class="righton"> |
| | |
| | | </view> |
| | | |
| | | </view> |
| | | <view class="other"> |
| | | <view v-if="!showmore" @tap="showmore = true"> |
| | | 展开其他信息<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="bottom"></uni-icons> |
| | | </view> |
| | | <view v-if="showmore" @tap="showmore = false"> |
| | | 折叠其他信息<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> |
| | |
| | | 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: '', |
| | |
| | | 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) { |
| | | console.log(e.detail.value) |
| | | this.hform.HDate = e.detail.value |
| | | }, |
| | | getHBarCodeData(HBarCode) { |
| | | if (uni.getStorageSync('Organization') == "杭州斯莫尔磁性材料有限公司") { |
| | | if (uni.getStorageSync('Organization') != "事业一处") { |
| | | if (!this.hform.HSourceName) { |
| | | uni.showToast({ |
| | | title: '请先选择生产资源', |
| | | title: '请先选择或扫描生产资源', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | |
| | | }) |
| | | } |
| | | // 如果是事业一处组织,校验器具数量 |
| | | // 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 (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 (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: '请选择操作员', |
| | |
| | | } |
| | | |
| | | .btn-c { |
| | | background-color: #acacac; |
| | | background-color: #FFA500; |
| | | color: #fff; |
| | | position: absolute; |
| | | right: 120rpx; |
| | |
| | | border-bottom: 3px solid #3a78ff; |
| | | } |
| | | } |
| | | |
| | | </style> |