opt:提交合单功能
This commit is contained in:
175
nladmin-ui/src/views/wms/pm_manage/form_data2/ViewDialog.vue
Normal file
175
nladmin-ui/src/views/wms/pm_manage/form_data2/ViewDialog.vue
Normal file
@@ -0,0 +1,175 @@
|
||||
<!--suppress ALL -->
|
||||
<template>
|
||||
<el-dialog
|
||||
append-to-body
|
||||
title="单据详情"
|
||||
:visible.sync="dialogVisible"
|
||||
fullscreen
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true"
|
||||
:model="form" size="mini" label-width="100px" label-suffix=":">
|
||||
<el-form-item label="单据编号" prop="code">
|
||||
<el-input v-model="form.code" disabled placeholder="系统生成" style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据类型" prop="form_type">
|
||||
<el-input v-model="form.form_type" disabled style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据日期" prop="source_form_date">
|
||||
<el-input v-model="form.source_form_date" disabled style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料数量" prop="qty">
|
||||
<el-input v-model="form.qty" disabled style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据状态" prop="status">
|
||||
<el-select
|
||||
v-model="form.status"
|
||||
disabled
|
||||
size="mini"
|
||||
placeholder="单据状态"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.io_bill_status"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="create_time">
|
||||
<el-input v-model="form.create_time" disabled clearable style="width: 210px"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="crud-opts2">
|
||||
<span class="role-span2">单据明细</span>
|
||||
</div>
|
||||
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="tableDtl"
|
||||
style="width: 100%;"
|
||||
max-height="300"
|
||||
size="mini"
|
||||
border
|
||||
:highlight-current-row="true"
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column prop="code" label="单据编码" min-width="140" />
|
||||
<el-table-column prop="is_merge" label="是否已合单" :formatter="merge_Format" show-overflow-tooltip />
|
||||
<el-table-column show-overflow-tooltip prop="stor_name" min-width="120" label="仓库" />
|
||||
<el-table-column prop="material_code" label="物料编码" show-overflow-tooltip :min-width="flexWidth('material_code',crud.data,'物料编码')" />
|
||||
<el-table-column prop="qty" label="数量" show-overflow-tooltip />
|
||||
<el-table-column prop="assign_qty" label="出库已分配数量" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="unit_name" label="单位" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="source_form_date" label="单据日期" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="status" label="单据状态" show-overflow-tooltip :formatter="status_Format" width="120" />
|
||||
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {crud} from '@crud/crud'
|
||||
import crudFormData, {getSonFormData} from './formData'
|
||||
|
||||
export default {
|
||||
name: 'ViewDialog',
|
||||
mixins: [crud()],
|
||||
dicts: ['base_data', 'ST_INV_IN_TYPE', 'io_bill_status', 'IS_OR_NOT'],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
rowmst: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tableDtl: [],
|
||||
form: {},
|
||||
formStatus: [
|
||||
{
|
||||
value: '10',
|
||||
label: '生成'
|
||||
},
|
||||
{
|
||||
value: '20',
|
||||
label: '执行中'
|
||||
},
|
||||
{
|
||||
value: '99',
|
||||
label: '完成'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
},
|
||||
rowmst: {
|
||||
handler(newValue) {
|
||||
this.form = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
|
||||
},
|
||||
setForm(row) {
|
||||
this.dialogVisible = true
|
||||
this.form = row
|
||||
this.queryTableDtl(row.id)
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
status_Format(row, column) {
|
||||
return this.dict.label.io_bill_status[row.status]
|
||||
},
|
||||
merge_Format(row, column) {
|
||||
return this.dict.label.IS_OR_NOT[row.is_merge]
|
||||
},
|
||||
queryTableDtl(id) {
|
||||
crudFormData.getdtl(id).then(res => {
|
||||
this.tableDtl = res
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.crud-opts2 {
|
||||
padding: 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .el-dialog__title2 {
|
||||
line-height: 24px;
|
||||
font-size: 20px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.crud-opts2 .role-span2 {
|
||||
padding: 0px 0px 20px 0px;
|
||||
}
|
||||
|
||||
.crud-opts2 {
|
||||
padding: 10px 0px 0px 50px;
|
||||
}
|
||||
|
||||
</style>
|
||||
70
nladmin-ui/src/views/wms/pm_manage/form_data2/formData.js
Normal file
70
nladmin-ui/src/views/wms/pm_manage/form_data2/formData.js
Normal file
@@ -0,0 +1,70 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/pmFormData',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/pmFormData',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/pmFormData',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getFormType() {
|
||||
return request({
|
||||
url: 'api/bmFormStruc/getTypes',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getParentFormTypes() {
|
||||
return request({
|
||||
url: 'api/bmFormStruc/getParentFormTypes',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getSonFormData(id) {
|
||||
return request({
|
||||
url: 'api/pmFormData/getSonFormData/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getdtl(id) {
|
||||
return request({
|
||||
url: 'api/pmFormData/getdtl/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function tomerge(data) {
|
||||
return request({
|
||||
url: '/api/pmFormData/tomerge',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function dismerge(data) {
|
||||
return request({
|
||||
url: '/api/pmFormData/dismerge',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, getParentFormTypes, getSonFormData, dismerge, tomerge, getdtl }
|
||||
264
nladmin-ui/src/views/wms/pm_manage/form_data2/index.vue
Normal file
264
nladmin-ui/src/views/wms/pm_manage/form_data2/index.vue
Normal file
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="单据日期" prop="analyseData">
|
||||
<el-date-picker
|
||||
v-model="query.datepick"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据编码">
|
||||
<el-input
|
||||
v-model="query.code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="编码"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码">
|
||||
<el-input
|
||||
v-model="query.material_code"
|
||||
clearable
|
||||
style="width: 250px"
|
||||
size="mini"
|
||||
placeholder="请输入物料编码"
|
||||
prefix-icon="el-icon-search"
|
||||
class="filter-item"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否合单">
|
||||
<el-select
|
||||
v-model="query.is_merge"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.IS_OR_NOT"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据状态">
|
||||
<el-select
|
||||
v-model="query.status"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="单据状态"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.io_bill_status"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</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"
|
||||
size="mini"
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
>
|
||||
导入
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="tomerge"
|
||||
>
|
||||
合并清单
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-minus"
|
||||
@click="dismerge"
|
||||
>
|
||||
取消合并
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
lazy
|
||||
:data="crud.data"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="code" label="单据编码" min-width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-link v-if="scope.row.new_merge_flag === '1'" type="warning" @click="toView(scope.row)">{{
|
||||
scope.row.code
|
||||
}}
|
||||
</el-link>
|
||||
<span v-else>{{ scope.row.code }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_merge" label="是否已合单" :formatter="merge_Format" show-overflow-tooltip />
|
||||
<el-table-column show-overflow-tooltip prop="stor_name" min-width="120" label="仓库" />
|
||||
<el-table-column prop="material_code" label="物料编码" show-overflow-tooltip :min-width="flexWidth('material_code',crud.data,'物料编码')" />
|
||||
<el-table-column prop="material_name" label="物料名称" show-overflow-tooltip :min-width="flexWidth('material_name',crud.data,'物料名称')" />
|
||||
<el-table-column prop="qty" label="数量" show-overflow-tooltip />
|
||||
<el-table-column prop="assign_qty" label="出库已分配数量" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="unit_name" label="单位" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="source_form_date" label="清单日期" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="status" label="单据状态" show-overflow-tooltip :formatter="status_Format" width="120" />
|
||||
<el-table-column prop="merge_codes" label="被合单据" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<ViewDialog ref="viewDialog" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudFormData from './formData'
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation.vue'
|
||||
import rrOperation from '@crud/RR.operation.vue'
|
||||
import pagination from '@crud/Pagination.vue'
|
||||
import ViewDialog from './ViewDialog.vue'
|
||||
|
||||
export default {
|
||||
name: 'FormData2',
|
||||
dicts: ['base_data', 'ST_INV_IN_TYPE', 'io_bill_status', 'IS_OR_NOT'],
|
||||
components: { pagination, crudOperation, rrOperation, ViewDialog },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '用料清单管理',
|
||||
url: 'api/pmFormData',
|
||||
idField: 'id',
|
||||
sort: 'id,desc',
|
||||
crudMethod: { ...crudFormData },
|
||||
optShow: {
|
||||
add: false,
|
||||
reset: true
|
||||
},
|
||||
query: {
|
||||
form_type: '1001'
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {},
|
||||
rows : [],
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
if (this.query.datepick) {
|
||||
this.query.start_time = this.query.datepick[0]
|
||||
if (this.query.datepick.length > 1) {
|
||||
this.query.end_time = this.query.datepick[1]
|
||||
}
|
||||
} else {
|
||||
this.query.start_time = ''
|
||||
this.query.end_time = ''
|
||||
}
|
||||
},
|
||||
status_Format(row, column) {
|
||||
return this.dict.label.io_bill_status[row.status]
|
||||
},
|
||||
merge_Format(row, column) {
|
||||
return this.dict.label.IS_OR_NOT[row.is_merge]
|
||||
},
|
||||
tomerge() {
|
||||
this.rows = this.$refs.table.selection
|
||||
if (this.rows.length < 2) {
|
||||
this.crud.notify('最少选择2个单据进行合单', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
const mater = this.rows[0].material_code
|
||||
for (let i = 0; i < this.rows.length; i++) {
|
||||
const now = this.rows[i]
|
||||
if (now.is_merge === '1') {
|
||||
this.crud.notify('不允许提交已合单的单据:' + now.code, CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
if (now.new_merge_flag === '1') {
|
||||
this.crud.notify('不允许提交合新合单的单据:' + now.code, CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
if (now.material_code !== mater) {
|
||||
this.crud.notify('合单的物料必须相同:' + now.material_code, CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
}
|
||||
crudFormData.tomerge(this.rows).then(res => {
|
||||
this.crud.notify('合单成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
dismerge() {
|
||||
this.rows = this.$refs.table.selection
|
||||
if (this.rows.length < 1) {
|
||||
this.crud.notify('请选择需要取消合单的单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
for (let i = 0; i < this.rows.length; i++) {
|
||||
const now = this.rows[i]
|
||||
if (now.new_merge_flag === '0') {
|
||||
this.crud.notify('不允许提交未合单的单据:' + now.code, CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
}
|
||||
crudFormData.dismerge(this.rows).then(res => {
|
||||
this.crud.notify('取消合单成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
toView(row) {
|
||||
if (row !== null) {
|
||||
this.$refs.viewDialog.setForm(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user