This commit is contained in:
2022-08-03 15:30:36 +08:00
parent 0e68a529c7
commit c124635c6d
3 changed files with 142 additions and 90 deletions

View File

@@ -12,8 +12,9 @@
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<slot name="left"/>
<el-button type="primary" @click="insertDtl">新增一行</el-button>
<el-button type="primary" @click="copyAdd">复制新增</el-button>
</span>
</div>
<el-table
@@ -21,9 +22,11 @@
:data="tableData"
style="width: 100%;"
border
highlight-current-row
@row-click="clickRow"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column type="index" label="序号" width="50" align="center"/>
<el-table-column align="center" label="操作" width="100" fixed="right">
<template scope="scope">
<el-button
@@ -70,25 +73,42 @@
<el-table-column prop="produce_date" label="生产日期" align="center" width="250px">
<template slot-scope="scope">
<el-date-picker v-model="scope.row.produce_date" type="date" value-format="yyyy-MM-dd" />
<el-date-picker v-model="scope.row.produce_date" type="date" value-format="yyyy-MM-dd"/>
</template>
</el-table-column>
<el-table-column v-if="false" prop="material_id" label="物料标识" align="center" />
<el-table-column v-if="false" prop="material_id" label="物料标识" align="center"/>
<el-table-column prop="material_code" label="物料编码" align="center" width="190px">
<template scope="scope">
<el-input v-model="scope.row.material_code" disabled class="input-with-select">
<el-button slot="append" icon="el-icon-plus" @click="queryMater(scope.$index, scope.row)" />
<el-button slot="append" icon="el-icon-plus" @click="queryMater(scope.$index, scope.row)"/>
</el-input>
</template>
</el-table-column>
<el-table-column prop="material_name" label="物料名称" align="center" width="250px" />
<el-table-column prop="material_spec" label="物料规格" align="center" width="150px" />
<el-table-column prop="material_name" label="物料名称" align="center" width="250px"/>
<el-table-column prop="material_spec" label="物料规格" align="center" width="150px"/>
<el-table-column show-overflow-tooltip prop="plan_qty" label="计划数量" align="center" width="100px">
<template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.plan_qty" size="mini" />
<el-input v-show="!scope.row.edit" v-model="scope.row.plan_qty" size="mini"/>
<span v-show="scope.row.edit">{{ scope.row.plan_qty }}</span>
</template>
</el-table-column>
<el-table-column prop="shift_type_scode" label="班次类型" align="center" width="110px">
<template slot-scope="scope">
<el-select
v-model="scope.row.shift_type_scode"
class="filter-item"
@change="(val)=>change(val,scope.$index,scope.row)"
:disabled="scope.row.edit"
>
<el-option
v-for="item in dict.PDM_BI_SHIFTTYPE"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="planproducestart_date" label="计划开始时间" align="center" width="250px">
<template slot-scope="scope">
<el-date-picker
@@ -99,25 +119,9 @@
/>
</template>
</el-table-column>
<el-table-column prop="shift_type_scode" label="班次类型" align="center" width="110px">
<template slot-scope="scope">
<el-select
v-model="scope.row.shift_type_scode"
class="filter-item"
:disabled="scope.row.edit"
>
<el-option
v-for="item in dict.PDM_BI_SHIFTTYPE"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="sale_id" label="销售单标识" align="center" width="150px">
<el-table-column prop="sale_id" label="销售单标识" align="center" width="150px">
<template scope="scope">
<el-input v-model="scope.row.sale_id" />
<el-input v-model="scope.row.sale_id"/>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="is_needmove" label="是否搬运" align="center" width="150px">
@@ -158,14 +162,14 @@
<script>
import CRUD, { crud, header, presenter } from '@crud/crud'
import CRUD, {crud, header, presenter} from '@crud/crud'
import MaterDtl from '@/views/wms/pub/MaterDialog'
import crudWorkProcedure from '@/api/wms/basedata/pdm/workProcedure'
import crudProduceshiftorder from '@/api/wms/mps/produceshiftorder'
export default {
name: 'AddDtl',
components: { MaterDtl },
components: {MaterDtl},
dicts: ['PDM_BI_SHIFTTYPE', 'MPS_BD_ORDERSTATUS', 'is_used', 'PDM_BI_ORDERTYPE', 'IS_OR_NOT'],
mixins: [presenter(), header(), crud()],
props: {
@@ -178,6 +182,7 @@ export default {
return {
dialogVisible: false,
materType: '01',
current_row: null,
workprocedureList: [],
rows: [],
materialShow: false,
@@ -227,6 +232,14 @@ export default {
this.workprocedureList = res
})
},
copyAdd() {
if (!this.current_row) {
this.crud.notify('请选择一条工单进行复制!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
const row = JSON.parse(JSON.stringify(this.current_row))
this.tableData.push(row)
},
close() {
this.$emit('update:dialogShow', false)
this.$emit('AddChanged')
@@ -237,6 +250,20 @@ export default {
this.nowindex = index
this.nowrow = row
},
change(val, index, row) {
const d = new Date()
const year = d.getFullYear()
const month = (d.getMonth() + 1) < 10 ? '0' + (d.getMonth() + 1) : (d.getMonth() + 1)
const day = d.getDate() < 10 ? '0' + d.getDate() : d.getDate()
debugger
if (val === '02') {
row.planproducestart_date = [year, month, day].join('-') + ' ' + ['18', '30', '00'].join(':')
}
if (val === '01') {
row.planproducestart_date = [year, month, day].join('-') + ' ' + ['07', '30', '00'].join(':')
}
this.tableData.splice(index, 1, row)
},
setMaterValue(row) {
this.nowrow.material_id = row.material_id
this.nowrow.material_code = row.material_code
@@ -244,15 +271,16 @@ export default {
this.nowrow.material_spec = row.material_spec
this.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
},
clickRow(row) {
debugger
this.current_row = row
},
dateFormatter(str) {
const d = new Date(str)
const year = d.getFullYear()
const month = (d.getMonth() + 1) < 10 ? '0' + (d.getMonth() + 1) : (d.getMonth() + 1)
const day = d.getDate() < 10 ? '0' + d.getDate() : d.getDate()
const hour = d.getHours() < 10 ? '0' + d.getHours() : d.getHours()
const minute = d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes()
const second = d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds()
return [year, month, day].join('-') + ' ' + [hour, minute, second].join(':')
return [year, month, day].join('-') + ' ' + ['07', '30', '00'].join(':')
},
deleteRow(index, rows) {
rows.splice(index, 1)