This commit is contained in:
zds
2022-08-04 08:33:21 +08:00
parent 47723a23a5
commit dc53ad0aee
5 changed files with 226 additions and 140 deletions

View File

@@ -1,6 +1,7 @@
<template>
<el-dialog
append-to-body
title="日计划重排"
:visible.sync="dialogVisible"
destroy-on-close
:show-close="false"
@@ -8,23 +9,22 @@
@close="close"
@open="open"
>
<span slot="title" class="dialog-footer">
<div class="crud-opts2">
<span class="el-dialog__title2">日计划重排</span>
<span class="crud-opts-right2">
<!--左侧插槽-->
<el-row :gutter="20">
<el-col :span="20" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="4">
<span>
<!--左侧插槽-->
<slot name="left" />
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button slot="left" type="primary" @click="submit">保存</el-button>
</span>
</div>
</span>
<!-- 搜索 -->
<el-row>
</el-col>
</el-row>
<!--表格渲染-->
<el-table
ref="table"
ref="dragTable"
:data="tableDtl"
style="width: 100%;"
border
@@ -34,18 +34,20 @@
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="plan_code" label="日计划编码" width="120" />
<el-table-column :formatter="seriesFormat" min-width="80" prop="product_series_id" label="系列产线" />
<el-table-column prop="device_code" label="关键设备" width="100" />
<el-table-column prop="device_name" label="关键设备" width="100" />
<el-table-column prop="planstart_date" label="计划开始日期" width="100" />
<el-table-column prop="plan_org_name" label="申报单位" width="100" />
<el-table-column prop="workorder_type" label="计划类型" :formatter="workorder_typeFormat" min-width="120" />
<el-table-column prop="material_code" label="物料编码" min-width="120"/>
<el-table-column prop="material_code" label="物料编码" min-width="150"/>
<el-table-column prop="old_mark" label="牌号" />
<el-table-column :formatter="seriesFormat" min-width="80" prop="mater_product_series" label="产品系列" />
<el-table-column prop="product_weight" label="生产重量(kg)" :formatter="crud.formatNum3" min-width="120" />
<el-table-column prop="product_num" label="批数" width="80" />
<el-table-column prop="planend_date" label="计划结束日期" width="100" />
<el-table-column prop="plan_finish_date" label="交货日期" width="100" />
<el-table-column prop="day_num" label="提前天数" width="90" :formatter="crud.formatNum0" />
<el-table-column :formatter="stateFormat" min-width="80" prop="status" label="状态" />
<el-table-column prop="task_code" label="生产任务号" width="120" />
<el-table-column prop="create_time" label="创建时间" width="140px" />
<el-table-column prop="create_name" label="创建人" width="100" />
<el-table-column prop="remark" label="备注" />
@@ -58,6 +60,7 @@
import { header } from '@crud/crud'
import dailyplan from '@/api/wms/pdm/dailyplan'
import crudseriesProcessRoute from '@/api/wms/pdm/seriesProcessRoute'
import Sortable from 'sortablejs'
export default {
name: 'StructIvt4',
@@ -78,7 +81,8 @@ export default {
tableDtl: [],
cxjList: [],
XLList: [],
queryrow: { },
queryrow: { device_id:'' },
sortable: null,
rows: []
}
},
@@ -101,9 +105,34 @@ export default {
})
this.queryStruct()
},
/**
* 接受父组件传值
* @param msg
*/
getMsg(msg) {
this.queryrow.device_id = msg
},
queryStruct() {
dailyplan.query2(this.queryrow).then(res => {
this.tableDtl = res
this.$nextTick(() => {
this.setSort()
})
})
},
setSort() {
const el = this.$refs.dragTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
this.sortable = Sortable.create(el, {
ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
setData: function(dataTransfer) {
// to avoid Firefox bug
// Detail see : https://github.com/RubaXa/Sortable/issues/1012
dataTransfer.setData('Text', '')
},
onEnd: evt => {
const targetRow = this.tableDtl.splice(evt.oldIndex, 1)[0]
this.tableDtl.splice(evt.newIndex, 0, targetRow)
}
})
},
stateFormat(row) {
@@ -120,12 +149,22 @@ export default {
}
},
close() {
this.$emit('update:dialogShow', false)
},
submit() {
this.rows = this.$refs.table.data
this.tableDtl = []
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed', this.rows)
},
submit() {
this.rows = this.$refs.dragTable.data
if (this.rows.length === 0) {
this.crud.notify('无可提交的记录!')
return false
}
dailyplan.submit2({ query: this.queryrow, rows: this.rows}).then(res => {
this.crud.notify('操作成功!')
this.tableDtl = []
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed', this.rows)
})
}
}
}

View File

@@ -181,7 +181,7 @@
<pagination />
</div>
<AddDialog @AddChanged="querytable" />
<StructIvt4 :dialog-show.sync="structshow" :rowmst="crud.query" @StructIvtClosed="querytable" />
<StructIvt4 ref="child" :dialog-show.sync="structshow" :rowmst="form" @StructIvtClosed="querytable" />
</div>
</template>
@@ -241,6 +241,7 @@ export default {
XLList: [],
fileList: [],
checkrows: [],
form: {},
rules: {
}}
},
@@ -307,10 +308,8 @@ export default {
this.crud.notify('请先选择关键设备!')
return false
}
if (this.crud.query.status !== '01' || this.crud.query.status === undefined) {
this.crud.notify('重排只能选择生成状态记录!')
return false
}
this.form.device_id = this.crud.query.device_id
this.$refs.child.getMsg(this.crud.query.device_id)
this.structshow = true
},
downdtl() {