| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- <template>
- <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
- <template #gHeader>
- <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
- <!-- 使用组件实现返回按钮及返回首页按钮 -->
- <text
- style="font-size:44rpx;"
- class="gui-header-leader-btns gui-color-white font-icons"
- @tap="goBack"
- ></text>
- <!-- 导航文本此处也可以是其他自定义内容 -->
- <text
- class="gui-h4 gui-blod gui-flex1 gui-text-center gui-ellipsis gui-color-white gui-primary-text"
- >栈板列表</text>
- <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
- <!-- 实际宽度请根据自己情况设置 -->
- <view style="width:40px;" />
- <!-- 如果右侧有其他内容可以利用条件编译和定位来实现 -->
- </view>
- </template>
- <template #gBody>
- <view class="list-content">
- <view class="select-item">
- <text class="store-text">栈板编号</text>
- <view class="custom-select">
- <uni-data-select
- v-model="submitParams.wmsPalletId"
- :localdata="locationList"
- @change="handleSelect"
- />
- </view>
- </view>
- <view class="operation" style="padding: 10px 0;background-color: white;">
- <view class="gui-bg-white gui-dark-bg-level-3 gui-padding-x">
- <view class="gui-form-item gui-border-b">
- <button
- type="default"
- class="gui-button-mini gui-bg-blue gui-noborder button-search"
- @click="handleNavigateTo('input')"
- >
- <text class="gui-color-white gui-button-text-mini">搜索</text>
- </button>
- <view class="gui-form-body">
- <input
- v-model="submitParams.materialName"
- type="text"
- class="gui-form-input"
- name="name1"
- @focus="handleInputFocus"
- placeholder="请输入内容"
- >
- </view>
- </view>
- </view>
- </view>
- <view v-if="boxNumberList.length > 0">
- <view
- v-for="(item, key) in boxNumberList"
- :key="key"
- class="card-list-flexbox"
- @click="handleCheckedItem(item)"
- >
- <view v-if="computedChecked(item.materialLots)" class="checkbox-cubes">
- <view class="checkbox-box" />
- <view class="checkbox-icon">✔</view>
- </view>
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">{{ item.materialLots }}</text>
- </view>
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">物料名称</text>
- <text class="text-2 gui-color-gray">{{ item.materialName }}</text>
- </view>
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">批次数量</text>
- <text class="text-2 gui-color-gray">{{ computedMaterialQty(item.qty) }}</text>
- </view>
- </view>
- </view>
- <view v-else>
- <view class="bg-image">
- <image src="@/static/empty.png" mode="heightFix" />
- <text>这里什么都没有...</text>
- </view>
- </view>
- </view>
- <gui-right-menus>
- <!-- 扩展按钮 -->
- <template #menus-more>
- <view
- hover-class="gui-tap"
- class="menu-items gui-bg-primary gui-flex gui-columns gui-justify-content-center"
- @click="handleComplute"
- >
- <text class="menu-text gui-block gui-text-center gui-color-white">确认入栈</text>
- </view>
- </template>
- <!-- 核心按钮 -->
- <template #menus-primary>
- <view class="menu-items gui-bg-primary gui-flex gui-columns gui-justify-content-center">
- <text class="menu-icon gui-color-white gui-block gui-text-center gui-icons"></text>
- <text class="menu-text gui-color-white gui-block gui-text-center">功能</text>
- </view>
- </template>
- </gui-right-menus>
- </template>
- </gui-page>
- </template>
- <script>
- import {
- onReachBottom
- } from '@dcloudio/uni-app'
- import {
- ref,
- defineComponent,
- computed
- } from 'vue'
- export default defineComponent({
- setup() {
- const checkboxParams = ref({
- checkboxIds: [], // 待选项的物料批次集合
- checkedIds: [] // 选中的字段
- })
- const computedChecked = computed(() => {
- return item => checkboxParams.value.checkedIds.includes(item)
- })
- const computedMaterialQty = computed(() => {
- return item => {
- return item / 10000 > 1 ? (item / 10000) + 'w' : item
- }
- })
- const submitParams = ref({
- wmsPalletId: '', // 栈板ID
- materialName: '' // 物料名称
- })
- const queryParams = ref({
- pageSize: 20,
- pageNo: 1
- })
- const locationList = ref([])
- const boxNumberList = ref([])
- uni.$reqGet('getWmsTrestleDropDownList')
- .then(({
- data,
- msg
- }) => {
- if (data?.length > 0) {
- for (let x = 0; x < data.length; x++) {
- locationList.value.push({
- text: data[x].name,
- value: data[x].id
- })
- }
- }
- })
- uni.$reqGet('pdaMaterialsPage', queryParams.value)
- .then(({
- data,
- msg
- }) => {
- boxNumberList.value = data?.list ?? []
- checkboxParams.value.checkboxIds = Array.from(boxNumberList.value, item => item
- ?.materialLots)
- })
- // 多选框选中事件
- const handleCheckedItem = function(item) {
- const ifExist = checkboxParams.value.checkedIds.includes(item?.materialLots)
- if (ifExist) {
- const fdIndex = checkboxParams.value.checkedIds.findIndex(option => option === item
- ?.materialLots)
- checkboxParams.value.checkedIds.splice(fdIndex, 1)
- } else {
- checkboxParams.value.checkedIds.push(item?.materialLots)
- }
- }
- const handleComplute = function() {
- if (submitParams.value.wmsPalletId) {
- const params = []
- checkboxParams.value.checkedIds?.forEach(item => params.push({
- materialLots: item,
- wmsPalletId: submitParams.value.wmsPalletId
- }))
- uni.$reqPost('pdaCreateBatch', params)
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- uni.$grace.msg('入栈成功')
- setTimeout(() => {
- uni.redirectTo({
- url: '/pages/workbranch/warehouse/trestle/boxNumberStacking'
- })
- }, 500)
- } else {
- uni.$grace.msg(msg)
- }
- })
- } else {
- uni.$grace.msg('请先选择栈板')
- }
- }
- const goBack = function() {
- uni.$goBack('/pages/workbranch/warehouse/trestle/trestleList')
- }
-
- // 禁用软键盘
- const handleInputFocus = function() {
- setTimeout(() => {
- uni.hideKeyboard()
- }, 100)
- }
- // uniapp移动端触底事件
- onReachBottom(() => {
- queryParams.value.pageNo += 1
- uni.$reqGet('pdaMaterialsPage', queryParams.value)
- .then(({
- data
- }) => {
- Array.prototype.push.call(boxNumberList.value, ...data?.list ?? [])
- Array.prototype.push.call(checkboxParams.value.checkboxIds, ...Array.from(data
- ?.list, item => item
- ?.materialLots))
- })
- })
- return {
- submitParams,
- locationList,
- boxNumberList,
- handleComplute,
- goBack,
- computedMaterialQty,
- computedChecked,
- handleInputFocus,
- handleCheckedItem
- }
- }
- })
- </script>
- <style lang="scss" scoped>
- .gui-sbody {
- font-size: 14px;
- background-color: rgba(234, 239, 242, 1);
- }
- .gui-header-leader-btns {
- color: black;
- font-size: 24px !important;
- margin-left: 24rpx;
- margin-right: 24rpx;
- }
- .list-content {
- margin-top: 80px;
- background-color: #edeeee;
- }
- .gui-button-mini {
- line-height: 32px !important;
- height: 32px !important;
- width: 160rpx !important;
- margin-right: 34rpx;
- .gui-button-text-mini {
- line-height: 32px;
- }
- }
- .select-item {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 10px;
- padding: 12px;
- background-color: white;
- .store-text {
- width: 80px;
- text-align: center;
- margin-right: 14px;
- }
- .custom-select {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- line-height: 40px;
- width: 100%;
- min-width: 275px;
- }
- }
- ::v-deep .uni-checkbox-input {
- border-radius: 50% !important;
- }
- .card-list-flexbox {
- display: flex;
- flex-direction: row;
- align-items: center;
- flex-wrap: wrap;
- margin: 0 2px 4px 2px;
- .card-list-item,
- .card-list-item-operation {
- width: 750rpx;
- height: 40px;
- margin-bottom: 3rpx;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- background-color: #fff;
- uni-text {
- font-size: 14px;
- height: 50rpx;
- text-align: left;
- padding: 0 12px;
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- .text-1 {
- flex: 1;
- height: 40px;
- justify-content: flex-start;
- }
- .text-2 {
- flex: 3;
- height: 40px;
- justify-content: flex-end;
- margin-right: 4px;
- padding: 2px 6px;
- }
- }
- .card-list-item-operation {
- justify-content: flex-end;
- }
- .card-list-item:nth-of-type(1) {
- .text-1 {
- font-weight: bold;
- color: black !important;
- }
- .text-1::before {
- content: "";
- width: 4px;
- height: 20px;
- border-radius: 4px;
- margin-right: 4px;
- background-color: skyblue;
- }
- }
- }
- .checkbox-cubes {
- width: 30px;
- height: 124px;
- position: absolute;
- .checkbox-box {
- /*宽高为0*/
- width: 0;
- height: 0;
- position: relative;
- /*在三角形底边设置一个边界颜色*/
- border-left: 28px solid skyblue;
- /*其它3边设置相同颜色,*/
- border-bottom: 25px solid transparent;
- }
- .checkbox-icon {
- height: 20px;
- position: absolute;
- top: 0;
- left: 3px;
- display: flex;
- align-items: center;
- font-size: 10px;
- font-weight: bold;
- color: white;
- }
- }
- </style>
|