123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <template>
- <dialog-base ref="baseDialog" title="周转申请">
- <view class="list-container">
- <view class="list-title"><text class="label">请选择周转类型</text></view>
- <view class="btn uni-row">
- <view v-for="(item,index) in turnoverType" :class="{ 'middle-btn': true, 'active': item == turnoverTypeChecked }"
- @click="selectTurnoverType(item)"><text class="label">{{item.dictLabel}}</text></view>
- <!-- <view :class="{ 'middle-btn': true, 'active': isRightTurnoverType }"
- @click="selectTurnoverType('rightType')"><text class="label">车间外周转</text></view> -->
- </view>
- <view class="list-title">
- <text class="label">请选择周转位置</text>
- </view>
- <view v-if="curDayworkItem.turnoverType == '2'" v-for="(item,index) in turnoverArea" class="list-container">
- <view class="btn uni-row">
- <view :class="{ 'middle-btn': true, 'active': item == turnoverDoorChecked }"
- @click="selectTurnoverDoor(item)"><text class="label">{{item.dictLabel}}</text></view>
- <!-- <view :class="{ 'middle-btn': true, 'active': isRightTurnoverDoor }"
- @click="selectTurnoverDoor('rightDoor')"><text class="label">B门</text></view> -->
- </view>
- </view>
- </view>
- <view class="add-btn-container uni-row">
- <button type="default" class="btn" @click="handleConfirm">确认</button>
- </view>
- </dialog-base>
- </template>
- <script setup>
- import {
- ref,
- getCurrentInstance,
- onMounted
- } from 'vue'
- import {
- onLoad
- } from '@dcloudio/uni-app'
- import {
- getDictInfoByType
- } from '@/api/dict/dict.js'
- import {
- getDayWorkItemList,saveDayWorkItem
- } from '@/api/business/dayWorkItem.js'
- import {
- store
- } from '@/store/index.js'
- import { timestampToTime } from '@/utils/common.js'
- const baseDialog = ref(null)
- const turnoverTypeChecked = ref({})
- const turnoverDoorChecked = ref({})
- const turnoverType = ref([])
- const turnoverArea = ref([])
- const curDayworkItem = ref({})
- const dayworkInfo = ref(null);
- onLoad(() => {
-
- })
-
- function open(data){
- dayworkInfo.value = data;
- baseDialog.value.open()
- init();
- }
-
- defineExpose({
- open
- })
-
- function close() {
- baseDialog.value.close()
- }
-
- function init() {
- getDictInfoByType('daywork_turnover_type').then(res => {
- turnoverType.value = res.data;
- getDictInfoByType('daywork_turnover_area').then(res => {
- turnoverArea.value = res.data;
- })
- })
- getDayWorkItemList(dayworkInfo.value.id).then(res => {
- curDayworkItem.value = res.rows[0]
- })
- }
- function selectTurnoverType(item){
- turnoverTypeChecked.value = item;
- curDayworkItem.value.turnoverType = item.dictValue;
- }
-
- function selectTurnoverDoor(item){
- turnoverDoorChecked.value = item;
- curDayworkItem.value.turnoverArea = item.dictValue;
- }
-
- function handleConfirm(){
- curDayworkItem.value.id = null;
- curDayworkItem.value.status = '4';
- curDayworkItem.value.startTime = timestampToTime(new Date());
- curDayworkItem.value.technologicalProcessId = dayworkInfo.value.technologicalProcessId;
- if(!store.tenantId){
- curDayworkItem.value.tenantId = store.userInfo.tenantId;
- }else{
- curDayworkItem.value.tenantId = store.tenantId;
- }
- saveDayWorkItem(curDayworkItem.value).then(res => {
- if (res.code === 200) {
- uni.showToast({
- icon: 'success',
- title: '操作成功',
- duration: 2000
- });
- close();
- } else {
- uni.showToast({
- icon: 'error',
- title: '操作失败',
- duration: 2000
- });
- close();
- }
- })
- }
-
-
- </script>
- <style lang="scss">
- .dialog-body {
- .list-container {
- width: 100%;
- display: flex;
- align-items: flex-start;
- padding: 0 4rpx;
- .list-title {
- margin-top: 24rpx;
- .label {
- font-size: 32rpx;
- }
- }
- .btn {
- justify-content: space-between;
- margin-top: 24rpx;
- .middle-btn {
- margin-right: 32rpx;
- align-items: center;
- justify-content: center;
- padding-left: 0;
- height: 80rpx;
- width: 240rpx;
- border-radius: 8rpx;
- background-color: #FFFFFF;
- border: 1px solid #999999;
- background-color: #FFFFFF;
- }
- .label {
- font-size: 24rpx;
- color: #000000;
- }
- .active {
- border-color: #1684fc;
- background-color: rgb(236, 245, 255);
- .label {
- color: #1684fc;
- }
- }
- }
- }
- .add-btn-container {
- margin-top: 32rpx;
- .btn {
- flex: 1;
- background-color: rgb(255, 121, 1);
- color: #FFFFFF;
- }
- }
- }
- </style>
|