排程模块完成
This commit is contained in:
@@ -31,3 +31,19 @@ export function CancelScheduling(id) {
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function releaseProduction(id) {
|
||||
return request({
|
||||
url: '/mes/pro/workorder/releaseProduction/' + id,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function saveSrotResults(data) {
|
||||
return request({
|
||||
url: '/mes/pro/workorder/sortschedule',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType: 'application/json',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="日期" style="float: right">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="searchDate(1)">周一</el-button>
|
||||
<el-button type="primary" @click="searchDate(2)">周二</el-button>
|
||||
<el-button type="primary" @click="searchDate(3)">周三</el-button>
|
||||
<el-button type="primary" @click="searchDate(4)">周四</el-button>
|
||||
<el-button type="primary" @click="searchDate(5)">周五</el-button>
|
||||
<el-button type="primary" @click="searchDate(6)">周六</el-button>
|
||||
<el-button type="primary" @click="searchDate(7)">周日</el-button>
|
||||
<el-button type="primary" size="mini" @click="searchDate(1)">周一</el-button>
|
||||
<el-button type="primary" size="mini" @click="searchDate(2)">周二</el-button>
|
||||
<el-button type="primary" size="mini" @click="searchDate(3)">周三</el-button>
|
||||
<el-button type="primary" size="mini" @click="searchDate(4)">周四</el-button>
|
||||
<el-button type="primary" size="mini" @click="searchDate(5)">周五</el-button>
|
||||
<el-button type="primary" size="mini" @click="searchDate(6)">周六</el-button>
|
||||
<el-button type="primary" size="mini" @click="searchDate(7)">周日</el-button>
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -24,8 +24,10 @@
|
||||
<el-divider></el-divider>
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane label="已经排程" class="mytable">
|
||||
<el-button type="primary" size="mini" v-if="disabled_d" @click="setJY">开启拖拽</el-button>
|
||||
<el-button type="success" size="mini" v-if="!disabled_d" @click="SaveDragAndDropResults">结束并保存拖拽结果</el-button>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-bordered" style="table-layout: fixed">
|
||||
<table class="table table-striped table-hover" style="table-layout: fixed">
|
||||
<thead>
|
||||
<tr class="table-secondary">
|
||||
<th style="width: 50px">#</th>
|
||||
@@ -53,7 +55,15 @@
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<draggable element="tbody" v-model="workorderList_Scheduled" @start="onStart" @end="onEnd">
|
||||
<draggable
|
||||
element="tbody"
|
||||
v-model="workorderList_Scheduled"
|
||||
:disabled="disabled_d"
|
||||
@start="onStart"
|
||||
@end="onEnd"
|
||||
:move="onMove"
|
||||
animation="300"
|
||||
>
|
||||
<tr v-for="(item, index) in workorderList_Scheduled" :key="item.index">
|
||||
<td>{{ index }}</td>
|
||||
<td>{{ item.id }}</td>
|
||||
@@ -75,19 +85,24 @@
|
||||
<td>{{ item.priority }}</td>
|
||||
<td>{{ item.color }}</td>
|
||||
<td>{{ item.isarrange }}</td>
|
||||
<td>{{ item.isProduction }}</td>
|
||||
<td>{{ item.isproduction }}</td>
|
||||
<td>{{ item.order }}</td>
|
||||
<td><el-button type="warning" @click="cancel_scheduled(item)" size="mini">取消排程</el-button></td>
|
||||
<td>
|
||||
<template v-if="item.isproduction === '0' || item.isproduction === ''">
|
||||
<el-button type="primary" @click="ReleaseProduction(item)" size="mini">下达生产</el-button>
|
||||
<el-button type="warning" @click="cancel_scheduled(item)" size="mini">取消排程</el-button>
|
||||
</template>
|
||||
<template v-if="item.isproduction === '1'">
|
||||
<el-tag type="success">生产中</el-tag>
|
||||
</template>
|
||||
<template v-if="item.isproduction === '2'">
|
||||
<el-tag type="danger">结束生产</el-tag>
|
||||
</template>
|
||||
</td>
|
||||
</tr>
|
||||
</draggable>
|
||||
</table>
|
||||
</div>
|
||||
<pagination
|
||||
:total="pagination.total"
|
||||
:page.sync="pagination.pageNum"
|
||||
:limit.sync="pagination.pageSize"
|
||||
@pagination="getList(this.dateitem)"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="待产程">
|
||||
<vxe-table border :column-config="{ resizable: true }" :data="workorderList_NOSchedule" :loading="loading_v2">
|
||||
@@ -154,7 +169,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getWorkorderList_Scheduled, getWorkorderList_NOSchedule, addScheduling, CancelScheduling } from '@/api/productManagement/workorder.js'
|
||||
import {
|
||||
getWorkorderList_Scheduled,
|
||||
getWorkorderList_NOSchedule,
|
||||
addScheduling,
|
||||
CancelScheduling,
|
||||
releaseProduction,
|
||||
saveSrotResults,
|
||||
} from '@/api/productManagement/workorder.js'
|
||||
import draggable from 'vuedraggable'
|
||||
export default {
|
||||
name: 'workorder',
|
||||
@@ -196,6 +218,8 @@ export default {
|
||||
title: '进行排程',
|
||||
open: false,
|
||||
},
|
||||
WhetherToDragOrNot: true,
|
||||
disabled_d: true,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -281,6 +305,47 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
//todo 下达生产
|
||||
ReleaseProduction(row) {
|
||||
this.$modal
|
||||
.confirm('是否确认下达生产' + row.id + '"的数据项?')
|
||||
.then(function () {
|
||||
return releaseProduction(row.id)
|
||||
})
|
||||
.then((res) => {
|
||||
if ((res.code == 200) & (res.data == 1)) {
|
||||
this.$notify.success('下达生产成功')
|
||||
this.getList()
|
||||
} else {
|
||||
this.$notify.error('未知错误')
|
||||
}
|
||||
})
|
||||
},
|
||||
//todo 设置开启拖拽
|
||||
setJY() {
|
||||
this.disabled_d = false
|
||||
},
|
||||
//todo 结束并保存拖拽结果
|
||||
SaveDragAndDropResults() {
|
||||
this.disabled_d = true
|
||||
|
||||
const query = []
|
||||
this.workorderList_Scheduled.forEach((item, index) => {
|
||||
query.push({
|
||||
id: item.id,
|
||||
order: item.order,
|
||||
})
|
||||
})
|
||||
|
||||
saveSrotResults(query).then((res) => {
|
||||
if ((res.code == 200) & (res.data >= 1)) {
|
||||
this.$notify.success('保存成功')
|
||||
this.getList()
|
||||
} else {
|
||||
this.$notify.error('未知异常')
|
||||
}
|
||||
})
|
||||
},
|
||||
//todo 拖拽开始事件
|
||||
onStart(ev) {},
|
||||
//todo 拓拽结束事件
|
||||
@@ -289,6 +354,14 @@ export default {
|
||||
item.order = index
|
||||
})
|
||||
},
|
||||
//todo 处理拖拽事件
|
||||
onMove(e, event) {
|
||||
if (e.draggedContext.element.isproduction == 1) {
|
||||
return false
|
||||
}
|
||||
if (e.relatedContext.element.isproduction == 1) return false
|
||||
return true
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user