| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <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:34rpx;"
- 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 v-if="cardList.length > 0" class="list-panel">
- <view v-for="(item, key) in cardList" :key="key" class="panel">
- <view class="panel-row">
- <text>物料编码</text>
- <text>{{ item.materialNo }}</text>
- </view>
- <view class="panel-row">
- <text>物料名称</text>
- <text>{{ item.materialName }}</text>
- </view>
- <view class="panel-row">
- <text>需求数量</text>
- <text>{{ ~~item.needQty }}</text>
- </view>
- <view class="panel-row">
- <text>已发数量</text>
- <text>{{ ~~item.totalSendCount }}</text>
- </view>
- <view class="panel-row">
- <text>待发数量</text>
- <text>{{ ~~item.overplusSendCount }}</text>
- </view>
- <view class="panel-row">
- <text>本次发料</text>
- <text>{{ ~~item.currentSendCount }}</text>
- </view>
- <view class="panel-row-operation">
- <text class="tag-skyblue" @click="handleNavigateTo(item)">发料扫描</text>
- </view>
- <Modal
- v-model:modalState="modalState"
- v-model:title="modalTitle"
- v-model:content="modalContent"
- @complate="complate"
- />
- </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-green gui-flex gui-columns gui-justify-content-center"
- @click="modalState = true"
- >
- <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 {
- ref,
- defineComponent
- } from 'vue'
- import Modal from '@/components/modal.vue'
- import {
- onReachBottom
- } from '@dcloudio/uni-app'
- export default defineComponent({
- name: 'DemanDetails',
- components: {
- Modal
- },
- setup(options) {
- const issueId = options.issueId ?? ''
- const modalState = ref(false)
- const modalTitle = ref('警告')
- const modalContent = ref('确定要完成发料吗?')
- // 传入模态对话框当中的索引,用于列表的索引查找
- const cardList = ref([])
- const queryParams = ref({
- pageSize: 10,
- pageNo: 1
- })
- // 需求明细
- uni.$reqGet('demandDetail', {
- masterId: issueId,
- ...queryParams.value
- })
- .then(({
- data
- }) => {
- cardList.value = data.list ?? []
- })
- const goBack = function() {
- uni.$goBack('/pages/workbranch/warehouse/productionIssue/productionIssue')
- }
- const handleNavigateTo = function(item) {
- uni.navigateTo({
- url: `/pages/workbranch/warehouse/productionIssue/issuePage?id=${item?.id}`
- })
- }
- const complate = function() {
- uni.$reqPut('demandDetailFinishIssue', {
- masterId: issueId
- })
- .then(({
- code,
- msg
- }) => {
- if (code === 0) {
- uni.$grace.msg('已完成发料')
- } else {
- uni.$grace.msg(msg)
- }
- })
- }
- // uniapp移动端触底事件
- onReachBottom(() => {
- queryParams.value.pageNo += 1
- // 生产发料主列表
- uni.$reqGet('demandDetail', {
- masterId: issueId,
- ...queryParams.value
- })
- .then(({
- data
- }) => {
- Array.prototype.push.call(cardList.value, ...data?.list ?? [])
- })
- })
- return {
- goBack,
- modalState,
- modalTitle,
- modalContent,
- cardList,
- handleNavigateTo,
- complate
- }
- }
- })
- </script>
- <style lang="scss" scoped>
- .gui-header-leader-btns {
- color: black;
- font-size: 24px !important;
- margin-left: 24rpx;
- }
- .list-content {
- margin-top: 80px;
- background-color: #edeeee;
- }
-
- .tag-limegreen,
- .tag-skyblue {
- padding: 0 8px;
- margin: 4px;
- border-radius: 5px;
- font-size: 12px;
- color: white;
- }
- .tag-limegreen {
- background-color: #2fb657;
- }
- .tag-skyblue {
- background-color: #00a0e9;
- }
- </style>
|