projects/mes-test #133

Merged
gtz217 merged 281 commits from projects/mes-test into projects/mes 2023-11-30 09:11:34 +08:00
16 changed files with 821 additions and 165 deletions
Showing only changes of commit 00fba0a83b - Show all commits

View File

@ -13,11 +13,11 @@ VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境
VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.2.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.49:48080'
# VUE_APP_BASE_API = 'http://192.168.1.8:48080'
# VUE_APP_BASE_API = 'http://192.168.1.56:48080'
VUE_APP_BASE_API = 'http://192.168.1.56:48080'
# VUE_APP_BASE_API = 'http://192.168.1.188:48080'

View File

@ -55,7 +55,7 @@ export function exportEquipmentExcel(query) {
// 获得所有设备列表
export function getEquipmentAll() {
return request({
url: '/base/equipment/listAll',
url: '/base/core-equipment/listAll',
method: 'get'
})
}

View File

@ -26,12 +26,3 @@ export function autoSet(query) {
params: query
})
}
// 获得排班信息分页 建议size 150
export function groupTeamSchedulingPage(query) {
return request({
url: '/base/group-team-scheduling/page',
method: 'get',
params: query
})
}

View File

@ -34,6 +34,14 @@ export function getOrderCode() {
})
}
// 获取工单code
export function getWorkOrderCode() {
return request({
url: '/base/order/getWorkOrderCode',
method: 'get'
})
}
// 获得订单
export function getOrderById(query) {
return request({
@ -42,3 +50,47 @@ export function getOrderById(query) {
params: query
})
}
// 获得工艺流程列表
export function getProcessFlowList() {
return request({
url: '/extend/process-flow/listAll',
method: 'get'
})
}
// 创建订单
export function orderCreate(data) {
return request({
url: '/base/order/create',
method: 'post',
data: data
})
}
// 更新订单
export function orderUpdate(data) {
return request({
url: '/base/order/update',
method: 'put',
data: data
})
}
// 删除订单
export function orderDelete(query) {
return request({
url: '/base/order/delete',
method: 'delete',
params: query
})
}
// 下发订单绑定的穿工单id新建不传
export function orderIssue(data) {
return request({
url: '/base/order/issue',
method: 'post',
data: data
})
}

View File

@ -0,0 +1,19 @@
import request from '@/utils/request'
// 获得排班信息分页 建议size 150
export function groupTeamSchedulingPage(query) {
return request({
url: '/base/group-team-scheduling/page',
method: 'get',
params: query
})
}
// 获得不同产线每小时报废数据,用于班组检测 班组生产情况详情(动态结构)
export function getSchedulingMonitoringRecord(query) {
return request({
url: '/base/quality-inspection-record/getSchedulingMonitoringRecord',
method: 'get',
params: query
})
}

View File

@ -89,8 +89,6 @@ export const DICT_TYPE = {
// ============== ENERGY - 能源模块 =============
ENERGY_UNIT: 'energy_unit',
// ============== ENERGY - 能源模块 =============
EQU_ALARM_LEVEL: 'equ_alarm_level',
MONITOR_INDEX_TYPE: 'monitor_index_type',
OBJECT_TYPE: 'object_type',
@ -99,8 +97,9 @@ export const DICT_TYPE = {
// ============== ORDER - 订单模块 =============
ORDER_STATUS: 'order_status',
ORDER_ORIGIN: 'order_origin',
ORDER_PRIORITY: 'order_priority'
ORDER_ORIGIN: 'order_Origin',
ORDER_PRIORITY: 'order_priority',
PACK_SPEC: 'pack_spec'
}
/**

View File

@ -96,7 +96,7 @@ const tableProps = [
}
]
import { getEnergyTypeListAll } from '@/api/base/energyType'
import { orderList, workOrderList } from '@/api/base/orderManage'
import { workOrderList } from '@/api/base/orderManage'
import { getWorkOrderMsg, getOrderEnergyData } from '@/api/monitoring/orderEnergy'
import BarChart from "./components/barChart"
export default {
@ -104,25 +104,21 @@ export default {
data() {
return {
formConfig: [
{
type: 'select',
label: '订单',
selectOptions: [],
param: 'energyTypeId'
},
{
type: 'select',
label: '工单',
selectOptions: [],
param: 'energyTypeId1'
param: 'workOrderId',
clearable: false
},
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId2',
param: 'objType',
filterable: true,
width: 120
width: 120,
clearable: false
},
{
type: 'select',
@ -130,8 +126,9 @@ export default {
selectOptions: this.getDictDatas(this.DICT_TYPE.OBJECT_TYPE),
labelField: 'label',
valueField: 'value',
param: 'energyTypeId3',
width: 100
param: 'energyTypeId',
width: 100,
clearable: false
},
{
type: 'button',
@ -145,8 +142,9 @@ export default {
tableH: this.tableHeight(400),
//
queryParams: {
pageNo: 1,
pageSize: 10000
workOrderId: '',
objType: '',
energyTypeId: ''
},
orderMsg: {},
chartData: [],
@ -162,34 +160,38 @@ export default {
},
methods: {
getListArr() {
getEnergyTypeListAll().then(res => {
this.formConfig[2].selectOptions = res.data || []
})
orderList().then(res => {
console.log(res)
})
workOrderList().then(res => {
console.log(res)
this.formConfig[0].selectOptions = res.data || []
})
getEnergyTypeListAll().then(res => {
this.formConfig[1].selectOptions = res.data || []
})
},
buttonClick() {
getWorkOrderMsg({
"workOrderId": 1,
"objType": "3",
"energyTypeId": '1681183397517406210'
}).then(res => {
console.log(res)
buttonClick(val) {
if (!val.workOrderId) {
this.$modal.msgWarning('工单不能为空')
return false
}
if (!val.objType) {
this.$modal.msgWarning('能源类型不能为空')
return false
}
if (!val.energyTypeId) {
this.$modal.msgWarning('对象维度不能为空')
return false
}
this.queryParams.workOrderId = val.workOrderId
this.queryParams.objType = val.objType
this.queryParams.energyTypeId = val.energyTypeId
getWorkOrderMsg({ ...this.queryParams }).then(res => {
this.orderMsg = res.data || {}
getOrderEnergyData({
"workOrderId": 1,
"objType": "3",
"energyTypeId": '1681183397517406210',
"startProduceTime": "1694239523000",
"finishProduceTime": "1694498723000"
}).then(res => {
console.log(res)
this.tableData = res.data || []
this.chartData = res.data || []
...this.queryParams,
startProduceTime: res.data.startProduceTime || '',
finishProduceTime: res.data.finishProduceTime || ''
}).then(result => {
this.tableData = result.data || []
this.chartData = result.data || []
})
})
},

View File

@ -1,46 +0,0 @@
<template>
<div>
<el-drawer title="查看详情" :visible.sync="visible" size="70%">
<div class="box">
<base-table
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH"
/>
</div>
</el-drawer>
</div>
</template>
<script>
import { getByScheduling } from '@/api/monitoring/groupTeamView'
export default {
name: 'schedulingMonitoringDetail',
data() {
return {
visible: false,
tableProps: [],
tableData: [],
tableH: this.tableHeight(200)
}
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(200)
})
},
methods: {
init(id) {
this.visible = true
console.log(id)
getByScheduling({id}).then(res => {
console.log(res)
})
}
}
}
</script>
<style lang="scss" scoped>
.box {
padding: 0 32px;
}
</style>

View File

@ -64,14 +64,12 @@ export default {
},
methods: {
init(params) {
console.log(params)
this.visible = true
this.queryParams = params
getByTeam({
teamId: this.queryParams.teamId,
workOrderId: this.queryParams.workOrderId
}).then(res => {
console.log(res)
this.tableData = res.data || []
})
}

View File

@ -61,10 +61,11 @@ export default {
return {
formConfig: [
{
type: 'input',
label: '工单名称',
placeholder: '工单名称',
param: 'cnName'
type: 'select',
label: '工单',
selectOptions: [],
param: 'workOrderId',
clearable: false
},
{
type: 'button',
@ -79,7 +80,8 @@ export default {
pageSize: 1000,
workOrderId: ''
},
workOrderName: '工单名称ddd',
workOrderList: [],
workOrderName: '',
tableBtn,
tableProps,
tableH: this.tableHeight(220),
@ -92,33 +94,42 @@ export default {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(220)
})
this.getOrderList()
},
methods: {
// list
getOrderList() {
workOrderList().then(res => {
console.log(res)
this.formConfig[0].selectOptions = res.data || []
this.workOrderList = res.data || []
})
},
//
buttonClick(val) {
// this.queryParams.workOrderId = val.id
this.queryParams.workOrderId = 1
if (!val.workOrderId) {
this.$modal.msgWarning('工单不能为空')
return false
}
this.queryParams.workOrderId = val.workOrderId
this.getList()
},
// table
getList() {
getByWorkOrder({ id: this.queryParams.workOrderId }).then(res => {
console.log(res)
this.list = res.data
this.list = res.data || []
})
},
handleClick(val) {
console.log(val)
this.paramVisible = true
let params = {}
params.teamId = val.data.id
params.teamName = val.data.name
this.workOrderList.map(item => {
if (this.queryParams.workOrderId === item.id) {
this.workOrderName = item.name
}
})
params.workOrderId = this.queryParams.workOrderId
params.workOrderName = this.workOrderName
this.$nextTick(() => {

View File

@ -0,0 +1,162 @@
<template>
<div>
<el-drawer title="查看详情" :visible.sync="visible" size="70%" :wrapperClosable='false' @closed="closeDrawer">
<div class="box">
<base-table
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH"
/>
</div>
</el-drawer>
</div>
</template>
<script>
import { getByScheduling } from '@/api/monitoring/groupTeamView'
import { getSchedulingMonitoringRecord } from '@/api/monitoring/teamProduction'
export default {
name: 'TeamProductionDetail',
data() {
return {
visible: false,
tableProps: [
{
prop: 'lineName',
label: '产线',
minWidth: 120
},
{
prop: 'startTime',
label: '上班时间',
minWidth: 150
},
{
prop: 'endTime',
label: '下班时间',
minWidth: 150
},
{
prop: 'workOrderList',
label: '生产工单'
}
],
tableData: [],
tableH: this.tableHeight(200)
}
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(200)
})
},
methods: {
init(params) {
this.visible = true
// console.log(params)
getByScheduling({id:params.id}).then(res => {
let dataList1 = []
let dataList2 = []
if (res.data.nameData && res.data.nameData.length > 0) {
dataList1 = res.data
// &&
let timeArr = []
res.data.nameData.map(item => {
let tablePropsObj = {
prop: '',
label: '',
children: [
{
prop: '',
label: '上片数据'
},
{
prop: '',
label: '下片数据'
},
{
prop: '',
label: '良品面积'
},
{
prop: '',
label: '报废数据'
},
{
prop: '',
label: '报废比例'
}
]
}
timeArr.push(this.parseTime(item.name))
tablePropsObj.prop = item.name
tablePropsObj.label = this.parseTime(item.name)
tablePropsObj.children[0].prop = item.name+'sumInput'
tablePropsObj.children[1].prop = item.name+'sumOutput'
tablePropsObj.children[2].prop = item.name+'goodArea'
tablePropsObj.children[3].prop = item.name+'dynamicValue'
tablePropsObj.children[4].prop = item.name+'dynamicRatio'
this.tableProps.push(tablePropsObj)
})
getSchedulingMonitoringRecord({
checkTime: timeArr
}).then(result => {
dataList2 = result.data
// console.log(dataList1)
// console.log(dataList2)
for (let i = 0; i < dataList1.data.length; i++) {
let obj = {}
obj.lineName = dataList1.data[i].lineName
obj.startTime = this.parseTime(params.startTime)
obj.endTime = this.parseTime(params.endTime)
obj.workOrderList = dataList1.data[i].workOrderList
let subData1 = dataList1.data[i].data
for (let ii = 0; ii < subData1.length; ii++) {
obj[subData1[ii].dynamicName+'sumInput'] = subData1[ii].dynamicValue.sumInput
obj[subData1[ii].dynamicName+'sumOutput'] = subData1[ii].dynamicValue.sumOutput
obj[subData1[ii].dynamicName+'goodArea'] = subData1[ii].dynamicValue.goodArea
}
for (let j = 0; j < dataList2.data.length; j++) {
let subData2 = dataList2.data[j].data
for (let jj = 0; jj < subData2.length; jj++) {
obj[subData2[jj].dynamicName+'dynamicValue'] = subData2[jj].dynamicValue
obj[subData2[jj].dynamicName+'dynamicRatio'] = obj[subData2[jj].dynamicName+'dynamicValue'] / obj[subData2[jj].dynamicName+'sumOutput']
}
}
this.tableData.push(obj)
}
})
}
})
},
closeDrawer() {
this.tableData = []
this.tableProps = [
{
prop: 'lineName',
label: '产线',
minWidth: 120
},
{
prop: 'startTime',
label: '上班时间',
minWidth: 150
},
{
prop: 'endTime',
label: '下班时间',
minWidth: 150
},
{
prop: 'workOrderList',
label: '生产工单'
}
]
}
}
}
</script>
<style lang="scss" scoped>
.box {
padding: 0 32px;
}
</style>

View File

@ -30,13 +30,13 @@
@pagination="getList"
/>
<!-- 查看生产情况 -->
<scheduling-monitoring-detail v-if='paramVisible' ref='schedulingMonitoringDetail'/>
<team-production-detail v-if='paramVisible' ref='schedulingMonitoringDetail'/>
</div>
</template>
<script>
import { groupTeamSchedulingPage } from '@/api/base/groupTeamScheduling'
import { groupTeamSchedulingPage } from '@/api/monitoring/teamProduction'
import { parseTime } from '@/utils/ruoyi'
import SchedulingMonitoringDetail from './components/schedulingMonitoringDetail'
import TeamProductionDetail from './components/teamProductionDetail'
const tableProps = [
{
prop: 'createTime',
@ -122,7 +122,7 @@ export default {
paramVisible: false
}
},
components: { SchedulingMonitoringDetail },
components: { TeamProductionDetail },
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(220)
@ -141,12 +141,15 @@ export default {
this.list = res.data.list || []
this.total = res.data.total || 0
})
},
getGroupClass() {
},
handleClick(val) {
console.log(val)
this.paramVisible = true
this.$nextTick(() => {
this.$refs.schedulingMonitoringDetail.init(val.data.id)
this.$refs.schedulingMonitoringDetail.init(val.data)
})
}
}

View File

@ -0,0 +1,289 @@
<template>
<el-form ref="addWorkOrder" :rules="rules" label-width="130px" :model="form">
<el-row>
<el-col :span='12'>
<el-form-item label="工单名称" prop="name" v-if='!isBind'>
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="产品名称" prop="orderId" v-if='isBind'>
<el-select v-model="form.orderId" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in workOrderList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="工单编码" prop="code">
<el-input v-model="form.code" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="产品名称" prop="planProductId">
<el-select v-model="form.planProductId" placeholder="请选择" style="width: 100%;" @change="selectProduct">
<el-option
v-for="item in productList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="产品规格" prop="productSpec">
<el-input v-model="form.productSpec" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="计划开始时间">
<el-date-picker
v-model="planStartTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%;"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="计划完成时间">
<el-date-picker
v-model="planFinishTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%;"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="计划投入数量" prop="planAssignQuantity">
<el-input-number v-model="form.planAssignQuantity" :min="0" :max="9999999999999" style="width: 100%;"></el-input-number>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="计划生产数量" prop="planQuantity">
<el-input-number v-model="form.planQuantity" :min="0" :max="9999999999999" style="width: 100%;"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="关联工艺" prop="processFlowId">
<el-select v-model="form.processFlowId" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in processFlowList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="物料计算方式" prop="materialMethod">
<el-radio-group v-model="form.materialMethod">
<el-radio :label="1">产品基础</el-radio>
<el-radio :label="2">工艺扩展</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="优先级" prop="priority">
<el-select v-model="form.priority" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in getDictDatas(DICT_TYPE.ORDER_PRIORITY)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="工单类型" prop="type">
<el-select v-model="form.type" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in workOrderTypeList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="关联产线" prop="productLineId">
<el-select v-model="form.productLineId" placeholder="请选择" multiple style="width: 100%;">
<el-option
v-for="item in productLineList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="负责人" prop="workers">
<el-input v-model="form.workers"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="计划分配订单量" prop="planAssignmentQuantity">
<el-input-number v-model="form.planAssignmentQuantity" :min="0" :max="9999999999999" style="width: 100%;"></el-input-number>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getProductAll } from '@/api/base/product'
import { getProcessFlowList, getWorkOrderCode, orderIssue, workOrderList } from '@/api/base/orderManage'
import { getLineAll } from '@/api/base/productionLine'
export default {
name: 'AddWorkOrder',
data() {
return {
form: {
workOrderId: '',
orderId: '',
name: '',
code: '',
planProductId: '',
productSpec: '',
planStartTime: '',
planFinishTime: '',
planAssignQuantity: 0,
planQuantity: 0,
processFlowId: '',
materialMethod: 1,
priority: '',
productLineId: [],
type: '',
workers: '',
planAssignmentQuantity: ''
},
rules: {
name: [{ required: true, message: "工单名称不能为空", trigger: "blur" }],
planProductId: [{ required: true, message: "产品名称不能为空", trigger: "change" }],
planAssignQuantity: [{ required: true, message: "计划投入数量不能为空", trigger: "blur" }],
planQuantity: [{ required: true, message: "计划生产数量不能为空", trigger: "blur" }],
productLineId: [{ required: true, message: "产品不能为空", trigger: "change" }]
},
productList: [],
processFlowList: [],
productLineList: [],
workOrderTypeList: [
{id: 1,name:'标准工单'},
{id: 2, name:'特殊工单'}
],
planStartTime: '',
planFinishTime: '',
isBind: false,
workOrderList: []
}
},
methods: {
init(id, param) {
console.log(id)
this.form.orderId = id
this.getList()
if (param === 'add') {
this.isBind = false
getWorkOrderCode().then(res => {
this.form.code = res.data || ''
})
}else{//
this.isBind = true
}
},
getList() {
//
getProductAll().then(res => {
this.productList = res.data || []
})
// 线
getLineAll().then(res => {
this.productLineList = res.data || []
})
//
getProcessFlowList().then(res => {
this.processFlowList = res.data || []
})
// list
workOrderList({
status: 1
}).then(res => {
this.workOrderList = res.data || []
})
},
//
selectProduct(val) {
if (val) {
this.productList.map(item => {
if (val === item.id) {
this.form.productSpec = item.specifications
}
})
} else {
this.form.productSpec = ''
}
},
addWorkOrderSubmit() {
this.$refs['addWorkOrder'].validate((valid) => {
if (valid) {
this.form.planStartTime = this.planStartTime ? new Date(this.planStartTime).valueOf() : ''
this.form.planFinishTime = this.planFinishTime ? new Date(this.planFinishTime).valueOf() : ''
console.log(this.form)
orderIssue({ ...this.form }).then(res => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功")
this.$emit('addWorkOrderSubmit')
}
})
// if (this.isEdit) {
// //
// orderUpdate({ ...this.form }).then((res) => {
// if (res.code === 0) {
// this.$modal.msgSuccess("");
// this.$emit('successSubmit')
// }
// })
// } else {
// this.form.status = 1
// this.form.triggerOrigin = 1
// orderCreate({ ...this.form }).then((res) => {
// if (res.code === 0) {
// this.$modal.msgSuccess("");
// this.$emit('successSubmit')
// }
// })
// }
} else {
return false
}
})
},
formClear() {
this.$refs.addWorkOrder.resetFields()
}
}
}
</script>

View File

@ -0,0 +1,11 @@
<template>
<div>111</div>
</template>
<script>
export default {
name: 'BindWorkOrder',
data() {
return {}
}
}
</script>

View File

@ -20,7 +20,7 @@
</el-col>
<el-col :span='12'>
<el-form-item label="产品名称" prop="planProductId">
<el-select v-model="form.planProductId" placeholder="请选择" style="width: 100%;">
<el-select v-model="form.planProductId" placeholder="请选择" style="width: 100%;" @change="selectProduct">
<el-option
v-for="item in productList"
:key="item.id"
@ -49,9 +49,9 @@
<el-select v-model="form.customerId" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in customerList"
:key="item.value"
:label="item.label"
:value="item.value">
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
@ -72,7 +72,14 @@
<el-row>
<el-col :span='12'>
<el-form-item label="包装规格" prop="packSpec">
<el-input v-model="form.packSpec" disabled></el-input>
<el-select v-model="form.packSpec" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in getDictDatas(DICT_TYPE.PACK_SPEC)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
@ -86,7 +93,7 @@
<el-form-item label="关联工艺" prop="processFlowId">
<el-select v-model="form.processFlowId" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in customerList"
v-for="item in processFlowList"
:key="item.id"
:label="item.name"
:value="item.id">
@ -105,20 +112,24 @@
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="订单计划开始时间" prop="planStartTime">
<el-form-item label="订单计划开始时间">
<el-date-picker
v-model="form.planStartTime"
v-model="planStartTime"
type="date"
format='yyyy-MM-dd'
value-format="yyyy-MM-dd"
style="width: 100%;"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="订单计划完成时间" prop="planFinishTime">
<el-form-item label="订单计划完成时间">
<el-date-picker
v-model="form.planFinishTime"
v-model="planFinishTime"
type="date"
format='yyyy-MM-dd'
value-format="yyyy-MM-dd"
style="width: 100%;"
placeholder="选择日期">
</el-date-picker>
@ -142,9 +153,10 @@
</el-form>
</template>
<script>
import { getOrderCode, getOrderById } from '@/api/base/orderManage'
import { getOrderCode, getOrderById, getProcessFlowList, orderUpdate, orderCreate } from '@/api/base/orderManage'
import { getProductAll } from '@/api/base/product'
import { getCustomerList } from '@/api/base/customer'
import moment from 'moment'
export default {
name: 'OrderAdd',
data() {
@ -162,12 +174,14 @@ export default {
packSpec: '',
workers: '',
processFlowId: '',
materialMethod: '1',
materialMethod: 1,
remark: '',
description: '',
planStartTime: '',
planFinishTime: ''
},
planStartTime: '',
planFinishTime: '',
remark: '',
description: ''
},
rules: {
name: [{ required: true, message: "订单名称不能为空", trigger: "blur" }],
planQuantity: [{ required: true, message: "计划加工数量不能为空", trigger: "blur" }],
@ -175,6 +189,7 @@ export default {
},
productList: [],
customerList: [],
processFlowList: [],
isEdit: false //
}
},
@ -184,10 +199,24 @@ export default {
if (id) {
this.isEdit = true
this.form.id = id
getOrderById(id).then(res => {
getOrderById({id: this.form.id}).then(res => {
if (res.code === 0) {
this.form = res.data
// this.selectLeader()
this.form.name = res.data.name
this.form.code = res.data.code
this.form.planQuantity = res.data.planQuantity
this.form.planProductId = res.data.planProductId
this.selectProduct(this.form.planProductId)
this.form.price = res.data.price
this.form.customerId = res.data.customerId
this.form.priority = res.data.priority ? res.data.priority + '' : ''
this.planStartTime = res.data.planStartTime ? moment(res.data.planStartTime).format('YYYY-MM-DD') : null
this.form.packSpec = res.data.packSpec ? res.data.packSpec+'' : ''
this.form.workers = res.data.workers
this.form.processFlowId = res.data.processFlowId
this.form.materialMethod = res.data.materialMethod
this.planFinishTime = res.data.planFinishTime ? moment(res.data.planFinishTime).format('YYYY-MM-DD') : null
this.form.remark = res.data.remark
this.form.description = res.data.description
}
})
} else {
@ -209,20 +238,40 @@ export default {
this.customerList = res.data || []
})
//
getProcessFlowList().then(res => {
this.processFlowList = res.data || []
})
},
//
selectProduct(val) {
if (val) {
this.productList.map(item => {
if (val === item.id) {
this.form.productSpec = item.specifications
}
})
} else {
this.form.productSpec = ''
}
},
submitForm() {
this.$refs['orderAddForm'].validate((valid) => {
if (valid) {
this.form.planStartTime = this.planStartTime ? new Date(this.planStartTime).valueOf() : ''
this.form.planFinishTime = this.planFinishTime ? new Date(this.planFinishTime).valueOf() : ''
console.log(this.form)
if (this.isEdit) {
//
updateGroupTeam({ ...this.form }).then((res) => {
orderUpdate({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createGroupTeam({ ...this.form }).then((res) => {
this.form.status = 1
this.form.triggerOrigin = 1
orderCreate({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
@ -236,6 +285,13 @@ export default {
},
formClear() {
this.$refs.orderAddForm.resetFields()
this.form.materialMethod = 1
this.form.price = 0.00
this.form.planQuantity = 0
this.planFinishTime = ''
this.planStartTime = ''
this.form.planFinishTime = ''
this.form.planStartTime = ''
this.isEdit = false
}
}

View File

@ -17,7 +17,7 @@
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
:width="250"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
@ -41,12 +41,37 @@
<order-add ref="orderAdd" @successSubmit="successSubmit" />
</base-dialog>
<!-- 查看详情 -->
<!-- 新增工单 -->
<base-dialog
:dialogTitle="workIssueTitle"
:dialogVisible="addWorkOrdervisible"
@cancel="addWorkOrderCancel"
@confirm="addWorkOrderConfirm"
:before-close="addWorkOrderCancel"
width='70%'
>
<add-work-order ref="addWorkOrder" @successSubmit="addWorkOrderSubmit" />
</base-dialog>
<!-- 绑定工单 -->
<!-- <base-dialog
dialogTitle="绑定工单"
:dialogVisible="bindWorkOrdervisible"
@cancel="bindWorkOrderCancel"
@confirm="bindWorkOrderConfirm"
:before-close="bindWorkOrderCancel"
width='70%'
>
<bind-work-order ref="bindWorkOrder" @successSubmit="bindWorkOrderSubmit" />
</base-dialog> -->
</div>
</template>
<script>
import { parseTime } from '@/utils/ruoyi'
import { getOrderPage } from '@/api/base/orderManage'
import OrderAdd from './components/orderAdd.vue'
import { getOrderPage, orderDelete } from '@/api/base/orderManage'
import OrderAdd from './components/orderAdd'
import AddWorkOrder from './components/addWorkOrder'
import BindWorkOrder from './components/bindWorkOrder'
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'createTime',
@ -61,46 +86,49 @@ const tableProps = [
{
prop: 'code',
label: '订单编码',
minWidth: 220
minWidth: 180
},
{
prop: 'num',
label: '客户'
prop: 'customerId',
label: '客户(?)'
},
{
prop: 'leaderName',
label: '来源'
prop: 'triggerOrigin',
label: '来源',
filter: publicFormatter('order_Origin')
},
{
prop: 'leaderName1',
label: '优先级'
prop: 'priority',
label: '优先级',
filter: publicFormatter('order_priority')
},
{
prop: 'leaderNam1e',
label: '订单状态'
prop: 'status',
label: '订单状态',
filter: publicFormatter('order_status')
},
{
prop: 'leaderName3',
prop: 'planQuantity',
label: '计划加工量'
},
{
prop: 'leaderName9',
prop: 'actualQuantity',
label: '实际加工量'
},
{
prop: 'leaderN4ame',
label: '产品'
prop: 'planProductId',
label: '产品(?)'
},
{
prop: 'leade2rName',
label: '单位'
prop: 'unit',
label: '单位(?)'
},
{
prop: 'leaderN11ame',
prop: 'price',
label: '单价(元)'
},
{
prop: 'leaderName22',
prop: 'workOrderNum',
label: '工单数量'
}
]
@ -166,6 +194,24 @@ export default {
list: [],
tableH: this.tableHeight(260),
tableBtn: [
this.$auth.hasPermi('base:group-team:update')
? {
type: 'add',
btnName: '新增工单'
}
: undefined,
this.$auth.hasPermi('base:group-team:update')
? {
type: 'bind',
btnName: '绑定工单'
}
: undefined,
this.$auth.hasPermi('base:group-team:update')
? {
type: 'detail',
btnName: '详情'
}
: undefined,
this.$auth.hasPermi('base:group-team:update')
? {
type: 'edit',
@ -180,20 +226,29 @@ export default {
: undefined
].filter((v) => v),
addOrEditTitle: '',
centervisible: false
centervisible: false,
priorityList: this.getDictDatas(this.DICT_TYPE.ORDER_PRIORITY),
workIssueTitle: '',
addWorkOrdervisible: false
// bindWorkOrdervisible: false
}
},
components: { OrderAdd },
components: { OrderAdd, AddWorkOrder, BindWorkOrder },
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getSelectList()
this.getList();
},
methods: {
getSelectList() {
console.log(this.getDictDatas(this.DICT_TYPE.ORDER_PRIORITY))
},
getList() {
getOrderPage({...this.queryParams}).then(res => {
console.log(res)
this.list = res.data.records || []
this.total = res.data.total || 0
})
},
buttonClick(val) {
@ -211,21 +266,52 @@ export default {
} else {
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.orderAdd.init()
})
}
},
handleClick(val) {
console.log(val)
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.groupList.init(val.data.id)
})
this.centervisible = true
this.$nextTick(() => {
this.$refs.orderAdd.init(val.data.id)
})
break
case 'delete':
this.handleDelete(val.data)
break
case 'detail':
break
case 'add':
this.workIssueTitle = '新增工单'
this.addWorkOrdervisible = true
this.$nextTick(() => {
this.$refs.addWorkOrder.init(val.data.id, 'add')
})
break
case 'bind':
this.workIssueTitle = '绑定工单'
this.addWorkOrdervisible = true
this.$nextTick(() => {
this.$refs.addWorkOrder.init(val.data.id, 'bind')
})
break
default:
this.handleDelete(val.data)
}
},
//
handleDelete(val) {
this.$modal.confirm('是否确认删除"' + val.name + '"的数据项?').then(function() {
return orderDelete({ id: val.id })
}).then(() => {
this.getList();
this.$modal.msgSuccess("操作成功");
}).catch(() => {});
},
//
handleCancel() {
this.$refs.orderAdd.formClear()
@ -239,6 +325,29 @@ export default {
this.handleCancel()
this.getList()
},
//
addWorkOrderCancel() {
this.$refs.addWorkOrder.formClear()
this.addWorkOrdervisible = false
},
addWorkOrderConfirm() {
this.$refs.addWorkOrder.addWorkOrderSubmit()
},
addWorkOrderSubmit() {
this.addWorkOrderCancel()
this.getList()
}
// bindWorkOrderCancel() {
// this.$refs.bindWorkOrder.formClear()
// this.bindWorkOrdervisible = false
// },
// bindWorkOrderConfirm() {
// this.$refs.bindWorkOrder.bindWorkOrderSubmit()
// },
// bindWorkOrderSubmit() {
// this.bindWorkOrderCancel()
// this.getList()
// }
}
}
</script>