| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- <template>
- <view class="bottom_box">
- <view class="nav_box rx-cc" @click="open">
- <image class="open_icon" :class="{open_icon_reversal : isOperate}" src="~@/static/pda/open.svg"></image>
- </view>
- <view class="operate_list" v-show="isOperate">
- <view v-for="(item, index) in btnList[btnState]" :key="index" class="list rx-bc"
- @click="operate(item.type, item)">
- <view class="round">{{index + 1}}</view>
- <view class="name">{{item.name}}</view>
- <image class="arrow_right" src="~@/static/pda/arrow_right.svg"></image>
- </view>
- </view>
- <view class="btn_box">
- <view class="btn">暂停</view>
- <view class="btn">终止</view>
- <view class="btn">转派</view>
- <view class="btn" @click="handOutsource()">委外</view>
- </view>
- <SearchPopup mode="center" v-if="outsourceShow">
- <template v-slot:list>
- <view class="popup_list">
- <view class="title">【{{taskObj.currentTaskName}}】是否委外</view>
- <u-form labelPosition="left" :model="outsourceForm" labelWidth="180" labelAlign="left" class="">
- <u-form-item label="委外名称:" borderBottom prop="num">
- <input class="uni-input" v-model="outsourceForm.name" placeholder="请输入委外名称"></input>
- </u-form-item>
- <u-form-item label="委外数量:" borderBottom prop="num">
- <input class="uni-input" v-model="outsourceForm.formedNumLast" type='number'></input>
- </u-form-item>
- <u-form-item label="完成时间:" borderBottom prop="requireDeliveryTime">
- <picker mode="date" :value="outsourceForm.requireDeliveryTime" @change="onDateChange">
- <view class="uni-input">{{ outsourceForm.requireDeliveryTime || '选择日期' }}</view>
- </picker>
- </u-form-item>
- </u-form>
- </view>
- </template>
- <template v-slot:operate>
- <view class="operate_box rx-bc">
- <u-button size="small" class="u-reset-button" @click="outCancel">
- 取消
- </u-button>
- <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(0)">
- 提交
- </u-button>
- <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(1)">
- 提交并发布
- </u-button>
- </view>
- </template>
- </SearchPopup>
- </view>
- </template>
- <script>
- import {
- getTwoTreeByPid,
- checkOutsource,
- applyoutsourceSave,
- } from '@/api/pda/workOrder.js'
- import SearchPopup from './searchPopup.vue'
- export default {
- components: {
- SearchPopup
- },
- props: {
- state: String | Number,
- taskObj: Object
- },
- watch: {
- btns: {
- immediate: true,
- deep: true,
- handler(newVal) {
- this.btnsList = []
- this.btnsList = newVal
- }
- },
- state: {
- immediate: true,
- deep: true,
- handler(newVal) {
- this.btnState = newVal
- }
- },
- taskObj: {
- immediate: true,
- deep: true,
- handler(newVal) {
- this.newTaskObj = newVal
- }
- }
- },
- data() {
- return {
- isOperate: false,
- btnsList: [],
- btnState: 1,
- btnList: {
- 1: [{
- name: '领料',
- type: 'picking'
- },
- {
- name: '投料',
- type: 'feeding'
- },
- {
- name: '报工',
- type: 'jobBooking'
- },
- {
- name: '更换周转车',
- type: 'turnover'
- },
- ],
- 2: [{
- name: '取样',
- type: 'sample'
- },
- {
- name: '报工',
- type: 'sampleJob'
- },
- ],
- 3: [{
- name: '报工',
- type: 'inspection'
- }, ],
- 4: [{
- name: '领料',
- type: 'picking'
- },
- {
- name: '投料',
- type: 'feeding'
- },
- {
- name: '报工',
- type: 'jobBooking'
- },
- ],
- 5: [{
- name: '入库',
- type: 'warehousing'
- },
- ],
- },
- newTaskObj: {},
- outsourceShow: false,
- outsourceForm: {
- },
- }
- },
- created() {
- this.getTwoTree()
- },
- methods: {
- getTwoTree() {
- getTwoTreeByPid(12).then(res => {
- let _arr = res.map(m => {
- m.type = 'inspection'
- return m
- })
- this.btnList[3] = []
- this.btnList[3] = [
- ..._arr,
- {
- name: '报工',
- type: 'inspectionJob'
- }
- ]
- })
- },
- open() {
- this.isOperate = !this.isOperate
- },
- operate(type, item) {
- this.$emit('operate', type, item)
- },
- handOutsource() {
- let param = {
- taskId: this.newTaskObj.currentTaskId,
- workOrderId: this.newTaskObj.workOrderId
- }
- checkOutsource(param).then(res => {
- this.outsourceForm = {
- ...res,
- requireDeliveryTime: '2024-05-20'
- }
- console.log(this.outsourceForm)
- if (res.outsource) {
- this.outsourceShow = true
- } else {
- uni.showToast({
- title: '此工序不能委外',
- icon: 'none'
- })
- }
- })
- },
- outCancel() {
- this.outsourceShow = false
- },
- onDateChange(e) {
- this.$set(this.outsourceForm, 'requireDeliveryTime', e.detail.value)
- this.$forceUpdate()
- },
- outsourceOk(isRelease) {
- if (!this.outsourceForm.name) {
- uni.showToast({
- title: '请输入委外名称',
- icon: 'none'
- })
- return false
- }
- if (!this.outsourceForm.requireDeliveryTime) {
- uni.showToast({
- title: '请选择委外完成时间',
- icon: 'none'
- })
- return false
- }
- let param = {
- ...this.outsourceForm,
- taskId: this.newTaskObj.currentTaskId,
- workOrderId: this.newTaskObj.workOrderId,
- isRelease: isRelease
- }
- applyoutsourceSave(param).then(res => {
- console.log(res)
- this.outCancel()
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .bottom_box {
- background: #fff;
- }
- .nav_box {
- width: 750rpx;
- height: 40rpx;
- background: $theme-color;
- .open_icon {
- width: 48rpx;
- height: 48rpx;
- }
- .open_icon_reversal {
- transform: scaleY(-1);
- /* 垂直翻转 */
- }
- }
- .operate_list {
- margin: 0 32rpx;
- .list {
- border-radius: 8rpx;
- border: 1rpx solid $theme-color;
- background: #F0F8F2;
- height: 64rpx;
- padding: 0rpx 16rpx;
- margin-top: 16rpx;
- }
- .round {
- width: 32rpx;
- height: 32rpx;
- line-height: 32rpx;
- text-align: center;
- border-radius: 50%;
- background: $theme-color;
- font-size: 24rpx;
- font-style: normal;
- font-weight: 400;
- color: #fff;
- }
- .name {
- font-family: PingFang HK;
- font-size: 24rpx;
- font-style: normal;
- font-weight: 600;
- color: $theme-color;
- }
- .arrow_right {
- width: 32rpx;
- height: 32rpx;
- }
- }
- .btn_box {
- display: flex;
- padding: 16rpx 32rpx;
- align-items: flex-start;
- gap: 16rpx;
- align-self: stretch;
- .btn {
- width: 160rpx;
- height: 64rpx;
- line-height: 64rpx;
- background: $theme-color;
- text-align: center;
- border-radius: 8rpx;
- color: #fff;
- font-family: PingFang HK;
- font-size: 24rpx;
- font-style: normal;
- font-weight: 600;
- }
- }
- .operate_box {
- padding: 10rpx 20rpx;
- /deep/ .u-button {
- width: 160rpx;
- }
- }
- .popup_list {
- width: 78vw;
- min-height: 360rpx;
- padding: 0 32rpx;
- .title {
- color: #333;
- font-size: 28rpx;
- text-align: center;
- padding: 30rpx;
- }
- }
- </style>
|