You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
526 lines
21 KiB
526 lines
21 KiB
`````<template>
|
|
<div class="app-container">
|
|
<!--工具栏-->
|
|
<div class="head-container">
|
|
<div v-if="crud.props.searchToggle">
|
|
<!-- 搜索 -->
|
|
<el-form
|
|
:inline="true"
|
|
class="demo-form-inline"
|
|
label-position="right"
|
|
label-width="80px"
|
|
label-suffix=":"
|
|
>
|
|
<el-form-item label="任务编码">
|
|
<el-input v-model="query.search" clearable placeholder="请输入任务编码" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
|
</el-form-item>
|
|
<el-form-item label="所需物料">
|
|
<el-select v-model="query.material_id" style="width: 185px;" filterable clearable placeholder="请选择物料" @change="crud.toQuery">
|
|
<el-option
|
|
v-for="item in materialList"
|
|
:key="item.material_id"
|
|
:label="item.material_name"
|
|
:value="item.material_id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="工序名称">
|
|
<el-select v-model="query.workprocedure_id" filterable clearable size="small" placeholder="所属工序" class="filter-item" style="width: 185px" @change="getDevice(query.workprocedure_id)">
|
|
<el-option
|
|
v-for="item in workprocedureList"
|
|
:key="item.workprocedure_id"
|
|
:label="item.workprocedure_name"
|
|
:value="item.workprocedure_id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="所属设备">
|
|
<el-select v-model="query.device_id" style="width: 185px;" filterable clearable placeholder="请选择设备" @change="refrence">
|
|
<el-option
|
|
v-for="item in deviceList"
|
|
:key="item.device_id"
|
|
:label="item.device_name"
|
|
:value="item.device_id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="所属产线">
|
|
<el-select v-model="query.produceline_id" style="width: 185px;" filterable clearable class="filter-item" placeholder="请选择产线" @change="crud.toQuery">
|
|
<el-option
|
|
v-for="item in producelineList"
|
|
:key="item.produceline_id"
|
|
:label="item.produceline_name"
|
|
:value="item.produceline_id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="所属客户">
|
|
<el-select v-model="query.cust_id" filterable clearable class="filter-item" style="width: 185px" placeholder="请选择客户" @change="crud.toQuery">
|
|
<el-option
|
|
v-for="item in custList"
|
|
:key="item.cust_id"
|
|
:label="item.cust_name"
|
|
:value="item.cust_id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<rrOperation :crud="crud" />
|
|
</el-form>
|
|
|
|
</div>
|
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
|
<crudOperation :permission="permission">
|
|
<el-button
|
|
slot="right"
|
|
class="filter-item"
|
|
type="info"
|
|
icon="el-icon-s-comment"
|
|
:disabled="issue"
|
|
size="mini"
|
|
@click="is_sue"
|
|
>
|
|
下发
|
|
</el-button>
|
|
<el-button
|
|
slot="right"
|
|
class="filter-item"
|
|
type="success"
|
|
icon="el-icon-document-copy"
|
|
:disabled="copy_add"
|
|
size="mini"
|
|
@click="copyAdd"
|
|
>
|
|
复制新增
|
|
</el-button>
|
|
<el-button
|
|
slot="right"
|
|
class="filter-item"
|
|
type="danger"
|
|
icon="el-icon-finished"
|
|
:disabled="mind_finish"
|
|
size="mini"
|
|
@click="mandFinish"
|
|
>
|
|
强制完成
|
|
</el-button>
|
|
<el-button
|
|
slot="right"
|
|
class="filter-item"
|
|
type="warning"
|
|
icon="el-icon-upload2"
|
|
size="mini"
|
|
@click="uploadShow = true"
|
|
>
|
|
导入
|
|
</el-button>
|
|
<el-button
|
|
slot="right"
|
|
class="filter-item"
|
|
type=""
|
|
icon="el-icon-sort"
|
|
:disabled="sort_update"
|
|
size="mini"
|
|
@click="sortUpdate"
|
|
>
|
|
排序
|
|
</el-button>
|
|
</crudOperation>
|
|
<!--表单组件-->
|
|
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="780px">
|
|
<el-form ref="form" inline :model="form" :rules="rules" size="mini" label-width="120px">
|
|
<el-form-item label="物料" prop="material_name">
|
|
<label slot="label">物 料</label>
|
|
<el-input v-model="form.material_name" style="width: 200px;" @focus="getMater" />
|
|
</el-form-item>
|
|
<el-form-item label="设备名称" prop="device_id">
|
|
<el-select v-model="form.device_id" filterable clearable style="width: 200px" placeholder="请选择设备" @change="getVehicleType()">
|
|
<el-option
|
|
v-for="item in deviceList1"
|
|
:key="item.device_id"
|
|
:label="item.device_name"
|
|
:value="item.device_id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item v-if="false" label="产线名称" prop="produceline_id">
|
|
<el-select v-model="form.produceline_id" filterable clearable class="filter-item" style="width: 200px" placeholder="请选择产线">
|
|
<el-option
|
|
v-for="item in producelineList"
|
|
:key="item.produceline_id"
|
|
:label="item.produceline_name"
|
|
:value="item.produceline_id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="客户名称">
|
|
<el-select v-model="form.cust_id" filterable clearable class="filter-item" style="width: 200px" placeholder="请选择客户">
|
|
<el-option
|
|
v-for="item in custList"
|
|
:key="item.cust_id"
|
|
:label="item.cust_name"
|
|
:value="item.cust_id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="生产顺序" prop="seq_no">
|
|
<el-input-number v-model="form.seq_no" controls-position="right" style="width: 200px;text-align: left" :min="1" />
|
|
<!-- <el-input-number v-model="form.seq_no" :precision="0" :step="10" :min="0" style="width: 200px;" />-->
|
|
</el-form-item>
|
|
<el-form-item label="静置时间" prop="stewing_time">
|
|
<el-input v-model="form.stewing_time" type="number" :rows="3" style="width: 200px;" />
|
|
</el-form-item>
|
|
<el-form-item label="型号" prop="model">
|
|
<label slot="label">型 号</label>
|
|
<el-input v-model="form.model" :rows="3" style="width: 200px;" />
|
|
</el-form-item>
|
|
<el-form-item label="熔池" prop="molten_pool">
|
|
<label slot="label">熔 池</label>
|
|
<el-input v-model="form.molten_pool" :rows="3" style="width: 200px;" />
|
|
</el-form-item>
|
|
<el-form-item label="计划生产数量" prop="plan_qty">
|
|
<el-input v-model="form.plan_qty" style="width: 200px;" />
|
|
</el-form-item>
|
|
<el-form-item label="实际生产数量">
|
|
<el-input v-model="form.real_qty" style="width: 200px;" />
|
|
</el-form-item>
|
|
<el-form-item label="计划开始时间" prop="plan_start_time">
|
|
<el-date-picker v-model="form.plan_start_time" clearable value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" type="datetime" style="width: 200px;" />
|
|
</el-form-item>
|
|
<el-form-item label="计划结束时间" prop="plan_end_time">
|
|
<el-date-picker v-model="form.plan_end_time" clearable value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" type="datetime" style="width: 200px;" />
|
|
</el-form-item>
|
|
<el-form-item label="实际开始时间">
|
|
<el-date-picker v-model="form.real_start_time" clearable value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" type="datetime" style="width: 200px;" />
|
|
</el-form-item>
|
|
<el-form-item label="实际结束时间">
|
|
<el-date-picker v-model="form.real_end_time" clearable value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" type="datetime" style="width: 200px;" />
|
|
</el-form-item>
|
|
<el-form-item label="载具类型">
|
|
<el-select
|
|
v-model="form.vehicle_type"
|
|
style="width: 200px"
|
|
placeholder="载具类型"
|
|
class="filter-item"
|
|
clearable
|
|
>
|
|
<el-option
|
|
v-for="item in vehicleTypeList"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="是否优先包装">
|
|
<el-radio v-model="form.is_package" label="0">否</el-radio>
|
|
<el-radio v-model="form.is_package" label="1">是</el-radio>
|
|
</el-form-item>
|
|
<el-form-item label="备注">
|
|
<label slot="label">备 注</label>
|
|
<el-input v-model="form.remark" type="textarea" style="width: 530px;" />
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
<!--表格渲染-->
|
|
<el-table
|
|
ref="table"
|
|
v-loading="crud.loading"
|
|
:cell-style="{'text-align':'center'}"
|
|
:header-cell-style="{'text-align':'center'}"
|
|
:data="crud.data"
|
|
size="mini"
|
|
style="width: 100%;"
|
|
@selection-change="crud.selectionChangeHandler"
|
|
@current-change="handleCurrentChange"
|
|
@select="handleSelectionChange"
|
|
@select-all="onSelectAll"
|
|
>
|
|
<el-table-column type="selection" width="55" />
|
|
<el-table-column prop="producetask_code" label="生产任务编码" width="120" />
|
|
<el-table-column prop="producetask_status" label="生产任务状态" width="120">
|
|
<template slot-scope="scope">
|
|
{{ dict.label.PRODUCETASK_STATUS[scope.row.producetask_status] }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="material_name" label="物料名称" />
|
|
<el-table-column prop="device_name" label="设备名称" width="120" />
|
|
<el-table-column v-if="false" prop="produceline_name" label="产线名称" />
|
|
<el-table-column prop="cust_name" label="客户名称" />
|
|
<el-table-column prop="seq_no" label="生产顺序" />
|
|
<el-table-column prop="plan_qty" label="计划生产数量" width="120" />
|
|
<el-table-column prop="real_qty" label="实际生产数量" width="120" />
|
|
<el-table-column prop="plan_start_time" label="计划开始时间" width="150" />
|
|
<el-table-column prop="real_start_time" label="实际开始时间" width="150" />
|
|
<el-table-column prop="plan_end_time" label="计划结束时间" width="150" />
|
|
<el-table-column prop="real_end_time" label="实际结束时间" width="150" />
|
|
<el-table-column prop="producetask_finish_type" label="任务结束类型" width="120">
|
|
<template slot-scope="scope">
|
|
{{ dict.label.PRODUCETASK_STATUS_TYPE[scope.row.producetask_finish_type] }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="vehicle_type" label="载具类型" width="270">
|
|
<template slot-scope="scope">
|
|
{{ dict.label.MD_EVEHICLE_TYPE[scope.row.vehicle_type] }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="model" label="型号" />
|
|
<el-table-column prop="molten_pool" label="熔池" />
|
|
<el-table-column prop="stewing_time" label="静置时间" />
|
|
<el-table-column prop="remark" label="备注" />
|
|
<el-table-column prop="create_name" label="创建者" />
|
|
<el-table-column prop="create_time" label="创建时间" width="150" />
|
|
<el-table-column prop="update_optname" label="修改者" />
|
|
<el-table-column prop="update_time" label="修改时间" width="150" />
|
|
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
|
<template slot-scope="scope">
|
|
<udOperation
|
|
:data="scope.row"
|
|
:permission="permission"
|
|
:disabled-edit="scope.row.producetask_status !== '01'"
|
|
:disabled-dle="scope.row.producetask_status !== '01'"
|
|
/>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!--分页组件-->
|
|
<pagination />
|
|
</div>
|
|
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="tableChanged3" />
|
|
<CopyDialog ref="copyChiled" :open-param="openParam" :dialog-show.sync="copyShow" @tableChanged2="tableChanged2" />
|
|
<SortDialog :open-param="openParam" :dialog-show.sync="sortShow" @tableChanged1="tableChanged1" />
|
|
<MaterDialog :dialog-show.sync="materDialog" :dialog-matertype="materType" @tableChanged4="tableChanged4" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import crudProducetask from '@/api/wms/pdm/producetask'
|
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
|
import rrOperation from '@crud/RR.operation'
|
|
import crudOperation from '@crud/CRUD.operation'
|
|
import udOperation from '@crud/UD.operation'
|
|
import pagination from '@crud/Pagination'
|
|
import UploadDialog from '@/views/wms/pdm/produceTask/UploadDialog'
|
|
import CopyDialog from '@/views/wms/pdm/produceTask/CopyDialog'
|
|
import SortDialog from '@/views/wms/pdm/produceTask/SortDialog'
|
|
import MaterDialog from './MaterDialog.vue'
|
|
|
|
const defaultForm = { producetask_id: null, producetask_code: null, producetask_status: null, material_id: null, material_name: null, device_id: null, produceline_id: null, cust_id: null, seq_no: null, plan_qty: null, real_qty: null, plan_start_time: null, real_start_time: null, plan_end_time: null, real_end_time: null, producetask_finish_type: null, stand_hour: null, remark: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null, is_delete: null, model: null, molten_pool: null, stewing_time: 0, is_package: '0' }
|
|
export default {
|
|
name: 'Producetask',
|
|
dicts: ['PRODUCETASK_STATUS', 'PRODUCETASK_STATUS_TYPE', 'MD_EVEHICLE_TYPE'],
|
|
components: { pagination, crudOperation, rrOperation, udOperation, UploadDialog, CopyDialog, SortDialog, MaterDialog },
|
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
|
cruds() {
|
|
return CRUD({ title: '生产任务', url: 'api/producetask', idField: 'producetask_id', sort: 'producetask_id,desc', optShow: { add: true, edit: false, del: false, download: false, reset: true }, crudMethod: { ...crudProducetask }})
|
|
},
|
|
data() {
|
|
return {
|
|
permission: {
|
|
},
|
|
custList: [],
|
|
deviceList: [],
|
|
deviceList1: [],
|
|
producelineList: [],
|
|
materialList: [],
|
|
workprocedureList: [],
|
|
uploadShow: false,
|
|
copyShow: false,
|
|
sortShow: false,
|
|
copy_add: true,
|
|
mind_finish: true,
|
|
issue: true,
|
|
sort_update: false,
|
|
openParam: {},
|
|
currentRow: null,
|
|
materDialog: false,
|
|
materType: '',
|
|
vehicleTypeList: [],
|
|
rules: {
|
|
device_id: [
|
|
{ required: true, message: '设备标识不能为空', trigger: 'blur' }
|
|
],
|
|
// produceline_id: [
|
|
// { required: true, message: '产线标识不能为空', trigger: 'blur' }
|
|
// ],
|
|
seq_no: [
|
|
{ required: true, message: '生产顺序不能为空', trigger: 'blur' }
|
|
],
|
|
plan_qty: [
|
|
{ required: true, message: '计划生产数量不能为空', trigger: 'blur' }
|
|
],
|
|
plan_start_time: [
|
|
{ required: true, message: '计划开始时间不能为空', trigger: 'blur' }
|
|
],
|
|
plan_end_time: [
|
|
{ required: true, message: '计划结束时间不能为空', trigger: 'blur' }
|
|
],
|
|
stand_hour: [
|
|
{ required: true, message: '静置时间不能为空', trigger: 'blur' }
|
|
],
|
|
material_name: [
|
|
{ required: true, message: '物料不能为空', trigger: 'change' }
|
|
]
|
|
},
|
|
queryTypeOptions: [
|
|
{ key: 'producetask_code', display_name: '生产任务编码' }
|
|
]
|
|
}
|
|
},
|
|
created() {
|
|
this.getProduceline()
|
|
this.getCust()
|
|
this.getMaterial()
|
|
this.getWorkprocedure()
|
|
this.getDevice1()
|
|
this.getVehicleType()
|
|
},
|
|
methods: {
|
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
|
[CRUD.HOOK.beforeRefresh]() {
|
|
return true
|
|
},
|
|
refrence() {
|
|
this.$forceUpdate()
|
|
this.crud.toQuery()
|
|
},
|
|
sortUpdate() {
|
|
let device_id = ''
|
|
if (this.currentRow !== null) {
|
|
device_id = this.currentRow.device_id
|
|
}
|
|
const device = { device_id: device_id }
|
|
this.openParam = device
|
|
this.sortShow = true
|
|
},
|
|
copyAdd() {
|
|
if (this.currentRow !== null) {
|
|
this.$refs.copyChiled.setForm(this.currentRow)
|
|
}
|
|
},
|
|
mandFinish() {
|
|
crudProducetask.mandFinish({ producetask_id: this.currentRow.producetask_id }).then(res => {
|
|
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
this.crud.toQuery()
|
|
this.copy_add = true
|
|
this.mind_finish = true
|
|
})
|
|
},
|
|
is_sue() {
|
|
crudProducetask.issued({ producetask_id: this.currentRow.producetask_id }).then(res => {
|
|
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
this.crud.toQuery()
|
|
this.issue = true
|
|
this.copy_add = true
|
|
this.mind_finish = true
|
|
})
|
|
},
|
|
buttonChange(current) {
|
|
if (current !== null) {
|
|
this.currentRow = current
|
|
this.copy_add = false
|
|
this.mind_finish = false
|
|
if (current.producetask_status === '01') {
|
|
this.issue = false
|
|
} else {
|
|
this.issue = true
|
|
}
|
|
}
|
|
},
|
|
handleSelectionChange(val, row) {
|
|
if (val.length > 1) {
|
|
this.$refs.table.clearSelection()
|
|
this.$refs.table.toggleRowSelection(val.pop())
|
|
} else if (val.length === 1) {
|
|
this.buttonChange(row)
|
|
} else {
|
|
this.handleCurrentChange(null)
|
|
}
|
|
},
|
|
onSelectAll() {
|
|
this.$refs.table.clearSelection()
|
|
this.handleCurrentChange(null)
|
|
},
|
|
handleCurrentChange(current) {
|
|
if (current === null) {
|
|
this.currentRow = null
|
|
this.copy_add = true
|
|
this.mind_finish = true
|
|
this.issue = true
|
|
}
|
|
},
|
|
getDevice(workprocedure_id) {
|
|
this.query.device_id = ''
|
|
crudProducetask.getDevice({ workprocedure_id: workprocedure_id }).then(res => {
|
|
this.deviceList = res
|
|
if (this.deviceList.length !== 0) {
|
|
this.query.device_id = this.deviceList[0].device_id
|
|
} else {
|
|
this.query.device_id = ''
|
|
}
|
|
this.crud.toQuery()
|
|
})
|
|
},
|
|
getCust() {
|
|
crudProducetask.getCust().then(res => {
|
|
this.custList = res
|
|
})
|
|
},
|
|
getDevice1() {
|
|
crudProducetask.getDevice1().then(res => {
|
|
this.deviceList1 = res
|
|
})
|
|
},
|
|
getMaterial() {
|
|
crudProducetask.getMaterial().then(res => {
|
|
this.materialList = res
|
|
})
|
|
},
|
|
getWorkprocedure(workprocedure_id) {
|
|
crudProducetask.getWorkprocedure().then(res => {
|
|
this.workprocedureList = res
|
|
})
|
|
},
|
|
getProduceline() {
|
|
crudProducetask.getProduceline().then(res => {
|
|
this.producelineList = res
|
|
})
|
|
},
|
|
tableChanged3() {
|
|
this.crud.toQuery()
|
|
},
|
|
tableChanged2() {
|
|
this.crud.toQuery()
|
|
this.copy_add = true
|
|
this.mind_finish = true
|
|
},
|
|
tableChanged1() {
|
|
this.crud.toQuery()
|
|
},
|
|
getMater() {
|
|
this.materDialog = true
|
|
},
|
|
tableChanged4(row) {
|
|
console.log(row)
|
|
this.form.material_id = row.material_id
|
|
this.form.material_name = row.material_name
|
|
},
|
|
getVehicleType() {
|
|
if (this.form.vehicle_type) {
|
|
this.form.vehicle_type = null
|
|
}
|
|
const data = { device_id: this.form.device_id }
|
|
crudProducetask.getVehicleType(data).then(res => {
|
|
this.vehicleTypeList = res
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|
|
|