| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728 |
- <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 v-if='btnControlReportMethod == 2' class="list rx-bc">
- <view class="round">{{btnList[btnState].length + 1}}</view>
- <view class="name" @click="operate('skip', {})" skip>跳过(不报工)</view>
- <image class="arrow_right" src="~@/static/pda/arrow_right.svg"></image>
- </view>
- <view class="list rx-bc" v-if="btnState == 1">
- <view class="list_item_btn" @click="operate('jobBooking', {})">报工</view>
- <view class="list_item_btn" @click="operate('',item)">多工单报工</view>
- </view>
- <view class="list rx-bc" v-if="newTaskObj.existOutsource == 1">
- <view class="list_item_btn" @click="operate('outPicking', {})">委外领料</view>
- <view class="list_item_btn" @click="operate('jobBooking', {})">委外报工</view>
- </view>
- </view>
- <view class="btn_box">
- <view class="btn" @click="handPause()">{{ GDStatus == 9 ? '取消暂停' : '暂停' }}</view>
- <view class="btn" @click="handTerminate()">终止</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="name">
- <input class="uni-input" v-model="outsourceForm.name" placeholder="请输入委外名称"></input>
- </u-form-item>
- <u-form-item label="委外类型:" borderBottom prop="">
- <zxz-uni-data-select :localdata="typeList" v-model="outsourceForm.type" dataValue='id'
- dataKey="name" filterable format='{name}'></zxz-uni-data-select>
- </u-form-item>
- <u-form-item label="委外数量:" borderBottom prop="formedNumLast" v-if="clientEnvironmentId == 2">
- <input class="uni-input content_num"
- v-model="outsourceForm.formedNumLast" type='number'></input>
- </u-form-item>
- <u-form-item label="委外到:" borderBottom prop="taskIds">
- <zxz-uni-data-select :localdata="newStepsList" v-model="outsourceForm.taskIds"
- dataValue='taskId' format='{taskTypeName}' dataKey="taskId" filterable
- :clear='true'></zxz-uni-data-select>
- </u-form-item>
-
- <u-form-item label="直接入库:" borderBottom prop="isInWarehouse" >
- <u-checkbox-group v-model="isInWarehouse" size="14px" v-if="clientEnvironmentId != 2 " >
- <u-checkbox labelSize="14px" iconSize="10px" activeColor="#157A2C" name="true" label="是"></u-checkbox>
- </u-checkbox-group>
- <view v-if="clientEnvironmentId == 2 " >是</view>
- <zxz-uni-data-select style="margin-left: 10px;" v-if="clientEnvironmentId == 2 || isInWarehouse.length" :localdata="warehouseList" v-model="outsourceForm.warehouseId"
- dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
- </u-form-item>
-
-
- <u-form-item label="工艺路线:" borderBottom prop="produceRoutingId" v-if="clientEnvironmentId != 2 &&isInWarehouse && isInWarehouse.length == 0">
- <zxz-uni-data-select :localdata="produceList" v-model="outsourceForm.produceRoutingId"
- dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
- </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>
-
- <outsourceList ref="outsourceListRef" @close="outCancel()"></outsourceList>
- </view>
- </template>
- <script>
- import {
- getTwoTreeByPid,
- checkOutsource,
- applyoutsourceSave,
- producerouting,
- getWarehouseList,
- updateStatusPause,
- updateStatusPauseRecover,
- updateStatusTerminate
- } from '@/api/pda/workOrder.js'
- import SearchPopup from './searchPopup.vue'
-
- import outsourceList from './outsourceList.vue'
-
- import {
- EventBus
- } from '@/utils/eventBus.js'
- export default {
- components: {
- SearchPopup,
- outsourceList
- },
- props: {
- state: String | Number,
- gdStatus: String | Number,
- taskObj: Object,
- controlReportMethod: String | Number,
- stepsList: {
- type: Array,
- default: () => []
- },
- },
- watch: {
- btns: {
- immediate: true,
- deep: true,
- handler(newVal) {
- this.btnsList = []
- this.btnsList = newVal
- }
- },
- state: {
- immediate: true,
- deep: true,
- handler(newVal) {
- this.btnState = newVal
- }
- },
- gdStatus: {
- immediate: true,
- deep: true,
- handler(newVal) {
- this.GDStatus = newVal
- }
- },
- controlReportMethod: {
- immediate: true,
- deep: true,
- handler(newVal) {
- this.btnControlReportMethod = newVal
- }
- },
- taskObj: {
- immediate: true,
- deep: true,
- handler(newVal) {
- console.log(newVal)
- this.newTaskObj = newVal
- }
- },
- stepsList: {
- immediate: true,
- deep: true,
- handler(newVal) {
- }
- }
- },
- data() {
- return {
- isOperate: false,
- btnsList: [],
- btnState: 1,
- GDStatus: null,
- btnControlReportMethod: null,
- btnList: {
- 1: [{
- name: '领料',
- type: 'picking'
- },
- {
- name: '投料',
- type: 'feeding'
- },
- {
- name: '更换周转车',
- type: 'turnover'
- },
- ],
- 2: [{
- name: '取样',
- type: 'sample'
- },
- {
- name: '报工',
- type: 'sampleJob'
- },
- ],
- 3: [{
- name: '更换周转车',
- type: 'qualityTurnover'
- },
- {
- name: '质检',
- type: 'inspection'
- },
- {
- name: '报工',
- type: 'inspectionJob'
- }
- ],
- 4: [{
- name: '领料',
- type: 'picking'
- },
- {
- name: '投料',
- type: 'feeding'
- },
- {
- name: '报工',
- type: 'jobBooking'
- },
- ],
- 5: [{
- name: '入库',
- type: 'warehousing'
- },
- ],
- 6: [{
- name: '报工',
- type: 'jobBooking'
- },
- ],
- },
- newTaskObj: {},
- outsourceShow: false,
- outsourceForm: {
- },
- produceList: [],
- warehouseList: [],
- typeList: [{
- id: 4,
- name: '带料委外'
- },
- {
- id: 5,
- name: '无料委外'
- },
- ],
- newStepsList: [],
- clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
- .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
-
- isInWarehouse: []
- }
- },
- created() {
- },
- methods: {
- 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,
-
- }
- this.outsourceForm.name = this.taskObj.currentTaskName + '委外'
- if (res.outsource) {
- this.getNewSteps()
- this.outsourceShow = true
- this.produceFn()
- this.getWarehouseFn()
- } else {
- uni.showToast({
- title: '此工序不能委外',
- icon: 'none'
- })
- }
- })
- },
- handPause() {
- if (this.GDStatus == 9) {
- uni.showModal({
- title: '提示',
- content: '确定该工单取消暂停?',
- success: async res => {
- if (res.confirm) {
- updateStatusPauseRecover([this.newTaskObj.workOrderId]).then(res => {
- this.$emit('refresh')
- })
- }
- }
- })
- } else {
- uni.showModal({
- title: '提示',
- content: '确定该工单暂停?',
- success: async res => {
- if (res.confirm) {
- updateStatusPause([this.newTaskObj.workOrderId]).then(res => {
- this.$emit('refresh')
- })
- }
- }
- })
- }
- },
- handTerminate() {
- uni.showModal({
- title: '提示',
- content: '确定该工单终止?',
- success: async res => {
- if (res.confirm) {
- updateStatusTerminate([this.newTaskObj.workOrderId]).then(res => {
- this.$emit('refresh')
- })
- }
- }
- })
- },
- outCancel() {
- this.outsourceShow = false
- EventBus.$off('outEvent');
- },
- getNewSteps() {
- this.activeIndex = this.getIndexOfElementInArray(this.stepsList, this.newTaskObj.currentTaskId)
- this.newStepsList = []
- this.stepsList.forEach((f, i) => {
- if (f.taskId != '-1' && f.taskId != '-2' && i > this.activeIndex && (f.type == 1 || f.type ==
- 4)) {
- this.newStepsList.push(f)
- }
- })
- },
- getIndexOfElementInArray(array, target) {
- for (let i = 0; i < array.length; i++) {
- if (array[i].taskId === target) {
- return i; // 返回第一次出现target的索引位置
- }
- }
- return -1; // 未找到目标值时返回-1
- },
- onDateChange(e) {
- this.$set(this.outsourceForm, 'requireDeliveryTime', e.detail.value)
- this.$forceUpdate()
- },
- // 工艺路线
- produceFn() {
- let param = {
- pageNum: 1,
- size: -1,
- routeType: 2
- }
- producerouting(param).then(res => {
- this.produceList = res.list
- })
- },
- // 仓库
- getWarehouseFn() {
- getWarehouseList().then(res => {
- this.warehouseList = res
- })
- },
- outsourceOk(isRelease) {
- if (!this.outsourceForm.name) {
- uni.showToast({
- title: '请输入委外名称',
- icon: 'none'
- })
- return false
- }
- if (!this.outsourceForm.type) {
- uni.showToast({
- title: '请选择委外类型',
- icon: 'none'
- })
- return false
- }
- // this.outsourceForm.requireDeliveryTime = '2025-03-18'
- if (!this.outsourceForm.requireDeliveryTime) {
- uni.showToast({
- title: '请选择委外完成时间',
- icon: 'none'
- })
- return false
- }
- if(this.clientEnvironmentId == 2) {
- this.outsourceForm.isInWarehouse = 1
- } else {
- this.isInWarehouse.length > 0 ? this.outsourceForm.isInWarehouse = 1 : this.outsourceForm.isInWarehouse = 0
- }
-
- let param = {
- ...this.outsourceForm,
- taskId: this.newTaskObj.currentTaskId,
- workOrderId: this.newTaskObj.workOrderId,
- isRelease: isRelease
- }
-
- console.log(param)
-
- this.$refs.outsourceListRef.open(param)
-
-
- // 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: 180rpx;
- }
- }
- .popup_list {
- width: 78vw;
- min-height: 360rpx;
- padding: 0 32rpx;
- .title {
- color: #333;
- font-size: 28rpx;
- text-align: center;
- padding: 30rpx;
- }
- }
- .list_item_btn {
- width: 160rpx;
- height: 54rpx;
- line-height: 54rpx;
- background: $theme-color;
- text-align: center;
- border-radius: 8rpx;
- color: #fff;
- font-family: PingFang HK;
- font-size: 22rpx;
- font-style: normal;
- font-weight: 600;
- }
- .content_num {
- display: flex;
- align-items: center;
- padding: 0 4rpx;
- /deep/ .uni-input-input {
- border: 2rpx solid #F0F8F2;
- background: #F0F8F2;
- color: $theme-color;
- }
- }
- </style>
|