add:增加回传管理页面,先生成回传单再回传(允许手动修改回传数据)
This commit is contained in:
@@ -2,7 +2,7 @@ import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/iosReturn',
|
||||
url: 'api/stockReturn',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
@@ -10,7 +10,7 @@ export function add(data) {
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/iosReturn/',
|
||||
url: 'api/stockReturn',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
@@ -18,7 +18,7 @@ export function del(ids) {
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/iosReturn',
|
||||
url: 'api/stockReturn',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
@@ -26,18 +26,10 @@ export function edit(data) {
|
||||
|
||||
export function upload(data) {
|
||||
return request({
|
||||
url: '/api/iosReturn/upload',
|
||||
url: '/api/stockReturn/upload',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function disupload(data) {
|
||||
return request({
|
||||
url: '/api/iosReturn/disupload',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, upload, disupload }
|
||||
export default { add, edit, del, upload }
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<template>
|
||||
<div v-loading.fullscreen.lock="fullscreenLoading" class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
@@ -11,9 +9,27 @@
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="所属仓库">
|
||||
<el-form-item label="单据号">
|
||||
<el-input
|
||||
v-model="query.request_Id"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="回传业务单据号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="回传类型">
|
||||
<el-input
|
||||
v-model="query.request_type"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="入库回传/出库回传/调拨"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select
|
||||
v-model="query.stor_id"
|
||||
v-model="query.status"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="全部"
|
||||
@@ -21,75 +37,14 @@
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storlist"
|
||||
:key="item.stor_id"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="出入类型">
|
||||
<el-select
|
||||
v-model="query.io_type"
|
||||
size="mini"
|
||||
placeholder="出入类型"
|
||||
class="filter-item"
|
||||
@change="ioTypeChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.io_type"
|
||||
v-for="item in statusOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="业务类型">
|
||||
<el-select
|
||||
v-model="query.bill_type"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
placeholder="业务类型"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in billtypelist"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="模糊查询">
|
||||
<el-input
|
||||
v-model="query.bill_code"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="出入库单号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否回传">
|
||||
<el-select
|
||||
v-model="query.is_upload"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="是否回传"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.is_upload"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据日期">
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="query.createTime"
|
||||
type="daterange"
|
||||
@@ -97,14 +52,13 @@
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
@input="onInput()"
|
||||
@input="onInput"
|
||||
@change="mytoQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
@@ -116,18 +70,7 @@
|
||||
>
|
||||
回传
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="disupload"
|
||||
>
|
||||
不回传
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
@@ -138,25 +81,45 @@
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="is_upload" label="是否回传" :formatter="formatIsUpload" :min-width="flexWidth('is_upload',crud.data,'是否回传')" />
|
||||
<el-table-column prop="bill_code" label="单据号" :min-width="flexWidth('bill_code',crud.data,'单据号')" />
|
||||
<el-table-column prop="stor_name" label="仓库" :min-width="flexWidth('stor_name',crud.data,'仓库')" />
|
||||
<el-table-column prop="bill_type" :formatter="bill_typeFormat" label="业务类型" :min-width="flexWidth('bill_type',crud.data,'业务类型')" />
|
||||
<el-table-column prop="biz_date" label="业务日期" :min-width="flexWidth('biz_date',crud.data,'业务日期')" />
|
||||
<el-table-column prop="total_qty" label="总重量" :min-width="100" :formatter="crud.formatNum3" />
|
||||
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
|
||||
<el-table-column :formatter="create_modeFormat" prop="create_mode" label="生成方式" :min-width="flexWidth('create_mode',crud.data,'生成方式')" />
|
||||
<el-table-column label="明细数" align="center" prop="detail_count" :min-width="flexWidth('detail_count',crud.data,'明细数')" />
|
||||
<el-table-column prop="input_optname" label="制单人" :min-width="flexWidth('input_optname',crud.data,'制单人')" />
|
||||
<el-table-column prop="input_time" label="制单时间" :min-width="flexWidth('input_time',crud.data,'制单时间')" />
|
||||
<el-table-column prop="confirm_optname" label="完成人" :min-width="flexWidth('confirm_optname',crud.data,'完成人')" />
|
||||
<el-table-column prop="confirm_time" label="完成时间" :min-width="flexWidth('confirm_time',crud.data,'完成时间')" />
|
||||
<el-table-column prop="update_optname" label="回传人" :min-width="flexWidth('update_optname',crud.data,'回传人')" />
|
||||
<el-table-column prop="update_time" label="回传时间" :min-width="flexWidth('update_time',crud.data,'回传时间')" />
|
||||
<el-table-column prop="request_Id" label="回传业务单据号" min-width="170" />
|
||||
<el-table-column prop="request_type" label="回传类型" min-width="120" />
|
||||
<el-table-column prop="status" label="状态" min-width="90" :formatter="formatStatus" />
|
||||
<el-table-column prop="error_msg" label="ERP处理失败记录" min-width="220" show-overflow-tooltip />
|
||||
<el-table-column prop="create_time" label="单据创建时间" min-width="160" />
|
||||
<el-table-column prop="process_time" label="成功时间" min-width="160" />
|
||||
<el-table-column label="回传JSON数据" min-width="120" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="openJsonDialog(scope.row, false)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" fixed="right" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="openJsonDialog(scope.row, true)">编辑JSON</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
:title="jsonDialog.edit ? '编辑回传JSON数据' : '查看回传JSON数据'"
|
||||
:visible.sync="jsonDialog.visible"
|
||||
width="760px"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-input
|
||||
v-model="jsonDialog.content"
|
||||
type="textarea"
|
||||
:rows="18"
|
||||
:readonly="!jsonDialog.edit"
|
||||
spellcheck="false"
|
||||
/>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="jsonDialog.visible = false">关闭</el-button>
|
||||
<el-button v-if="jsonDialog.edit" size="mini" type="info" @click="formatJsonContent">格式化</el-button>
|
||||
<el-button v-if="jsonDialog.edit" size="mini" type="primary" @click="saveJsonContent">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -166,7 +129,6 @@ import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudUserStor from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
||||
import Date from '@/utils/datetime'
|
||||
|
||||
export default {
|
||||
@@ -174,7 +136,7 @@ export default {
|
||||
components: { crudOperation, rrOperation, pagination },
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '出入库单回传', idField: 'iostorinv_id', url: 'api/iosReturn', crudMethod: { ...inandoutreturn },
|
||||
title: 'ERP回传管理', idField: 'id', url: 'api/stockReturn', crudMethod: { ...inandoutreturn },
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
@@ -182,52 +144,42 @@ export default {
|
||||
reset: true,
|
||||
download: false
|
||||
},
|
||||
query: { io_type: '0', bill_status: '99' },
|
||||
queryOnPresenterCreated: false
|
||||
})
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
// 数据字典
|
||||
dicts: ['ST_CREATE_MODE', 'io_type', 'is_upload', 'ST_INV_IN_TYPE', 'ST_INV_OUT_TYPE'],
|
||||
data() {
|
||||
return {
|
||||
height: document.documentElement.clientHeight - 180 + 'px;',
|
||||
permission: {},
|
||||
mstrow: {},
|
||||
fullscreenLoading: false,
|
||||
storlist: [],
|
||||
query_flag: true,
|
||||
billtypelist: [],
|
||||
showDtlLoading: false
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
const that = this
|
||||
window.onresize = function temp() {
|
||||
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
||||
statusOptions: [
|
||||
{ value: '0', label: '待回传' },
|
||||
{ value: '1', label: '成功' },
|
||||
{ value: '2', label: '失败' }
|
||||
],
|
||||
jsonDialog: {
|
||||
visible: false,
|
||||
edit: false,
|
||||
row: null,
|
||||
content: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudUserStor.getStor().then(res => {
|
||||
this.storlist = res
|
||||
})
|
||||
// debugger
|
||||
this.billtypelist = this.dict.ST_INV_OUT_TYPE
|
||||
this.crud.query.createTime = [new Date().daysAgo(30), new Date()]
|
||||
this.crud.query.createTime = [this.formatDateTime(new Date().daysAgo(30), '00:00:00'), this.formatDateTime(new Date(), '23:59:59')]
|
||||
this.initQuery()
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
if (this.query_flag) {
|
||||
this.crud.query.begin_time = (new Date().daysAgo(30)).strftime('%F', 'zh')
|
||||
this.crud.query.end_time = (new Date()).strftime('%F', 'zh')
|
||||
this.crud.query.begin_time = this.formatDateTime(new Date().daysAgo(30), '00:00:00')
|
||||
this.crud.query.end_time = this.formatDateTime(new Date(), '23:59:59')
|
||||
this.query_flag = false
|
||||
}
|
||||
},
|
||||
/* 搜索框出入类型 默认出库*/
|
||||
initQuery() {
|
||||
this.query.io_type = '1'
|
||||
this.query.is_upload = '0'
|
||||
this.query.status = '0'
|
||||
this.crud.toQuery()
|
||||
},
|
||||
mytoQuery(array1) {
|
||||
@@ -235,115 +187,99 @@ export default {
|
||||
this.crud.query.begin_time = ''
|
||||
this.crud.query.end_time = ''
|
||||
} else {
|
||||
this.crud.query.begin_time = array1[0]
|
||||
this.crud.query.end_time = array1[1]
|
||||
this.crud.query.begin_time = this.formatDateTime(array1[0], '00:00:00')
|
||||
this.crud.query.end_time = this.formatDateTime(array1[1], '23:59:59')
|
||||
}
|
||||
this.crud.toQuery()
|
||||
},
|
||||
formatDateTime(value, defaultTime) {
|
||||
if (!value) {
|
||||
return ''
|
||||
}
|
||||
if (value instanceof Date) {
|
||||
return value.strftime('%F %T', 'zh')
|
||||
}
|
||||
const str = String(value)
|
||||
if (str.includes('T')) {
|
||||
return new Date(str).strftime('%F %T', 'zh')
|
||||
}
|
||||
if (str.length === 10) {
|
||||
return str + ' ' + defaultTime
|
||||
}
|
||||
return str
|
||||
},
|
||||
onInput() {
|
||||
this.$forceUpdate()
|
||||
},
|
||||
querytable() {
|
||||
this.onSelectAll()
|
||||
this.crud.toQuery()
|
||||
},
|
||||
bill_typeFormat(row) {
|
||||
if (this.query.io_type === '0') {
|
||||
return this.dict.label.ST_INV_IN_TYPE[row.bill_type]
|
||||
}
|
||||
if (this.query.io_type === '1') {
|
||||
return this.dict.label.ST_INV_OUT_TYPE[row.bill_type]
|
||||
}
|
||||
},
|
||||
ioTypeChange(value) {
|
||||
if (value === '1') {
|
||||
this.billtypelist = this.dict.ST_INV_OUT_TYPE
|
||||
} else {
|
||||
this.billtypelist = this.dict.ST_INV_IN_TYPE
|
||||
}
|
||||
this.crud.toQuery()
|
||||
},
|
||||
create_modeFormat(row) {
|
||||
return this.dict.label.ST_CREATE_MODE[row.create_mode]
|
||||
},
|
||||
upload() {
|
||||
const res = this.$refs.table.selection
|
||||
if (!res || res.length < 1) {
|
||||
const rows = this.$refs.table.selection
|
||||
if (!rows || rows.length < 1) {
|
||||
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
const upload_flag = res.some(row => row.is_upload === '1')
|
||||
if (upload_flag) {
|
||||
this.$confirm('存在已经回传的单据, 是否继续回传?', '提示', {
|
||||
const successFlag = rows.some(row => row.status === '1')
|
||||
const doUpload = () => {
|
||||
this.fullscreenLoading = true
|
||||
inandoutreturn.upload({ rows }).then(() => {
|
||||
this.crud.notify('单据回传成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
}).finally(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
}
|
||||
if (successFlag) {
|
||||
this.$confirm('存在已经回传成功的单据, 是否继续回传?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.fullscreenLoading = true
|
||||
const data = {}
|
||||
data.rows = res
|
||||
inandoutreturn.upload(data).then(res => {
|
||||
this.fullscreenLoading = false
|
||||
this.crud.notify('单据回传成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消回传'
|
||||
})
|
||||
}).then(doUpload).catch(() => {
|
||||
this.$message({ type: 'info', message: '已取消回传' })
|
||||
})
|
||||
} else {
|
||||
this.fullscreenLoading = true
|
||||
const data = {}
|
||||
data.rows = res
|
||||
inandoutreturn.upload(data).then(res => {
|
||||
this.fullscreenLoading = false
|
||||
this.crud.notify('单据回传成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
disupload() {
|
||||
const res = this.$refs.table.selection
|
||||
if (!res || res.length < 1) {
|
||||
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
this.fullscreenLoading = true
|
||||
const data = {}
|
||||
data.rows = res
|
||||
inandoutreturn.disupload(data).then(res => {
|
||||
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).finally(() => {
|
||||
this.fullscreenLoading = false
|
||||
doUpload()
|
||||
},
|
||||
openJsonDialog(row, edit) {
|
||||
this.jsonDialog.row = row
|
||||
this.jsonDialog.edit = edit
|
||||
this.jsonDialog.content = this.formatJson(row.request_data)
|
||||
this.jsonDialog.visible = true
|
||||
},
|
||||
saveJsonContent() {
|
||||
let content = this.jsonDialog.content
|
||||
try {
|
||||
content = JSON.stringify(JSON.parse(content), null, 2)
|
||||
} catch (e) {
|
||||
this.crud.notify('JSON格式错误:' + e.message, CRUD.NOTIFICATION_TYPE.ERROR)
|
||||
return
|
||||
}
|
||||
const data = { ...this.jsonDialog.row, request_data: content }
|
||||
inandoutreturn.edit(data).then(() => {
|
||||
this.crud.notify('保存成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.jsonDialog.visible = false
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
formatIsUpload(row) {
|
||||
if (row.is_upload === '0') {
|
||||
return '否'
|
||||
} else if (row.is_upload === '1') {
|
||||
return '是'
|
||||
formatJsonContent() {
|
||||
try {
|
||||
this.jsonDialog.content = JSON.stringify(JSON.parse(this.jsonDialog.content), null, 2)
|
||||
} catch (e) {
|
||||
this.crud.notify('JSON格式错误:' + e.message, CRUD.NOTIFICATION_TYPE.ERROR)
|
||||
}
|
||||
},
|
||||
formatUploadMes(row) {
|
||||
if (row.upload_mes === '0') {
|
||||
return '否'
|
||||
} else if (row.upload_mes === '1') {
|
||||
return '是'
|
||||
formatJson(value) {
|
||||
if (!value) {
|
||||
return ''
|
||||
}
|
||||
try {
|
||||
return JSON.stringify(JSON.parse(value), null, 2)
|
||||
} catch (e) {
|
||||
return value
|
||||
}
|
||||
},
|
||||
formatUploadSap(row) {
|
||||
if (row.upload_sap === '0') {
|
||||
return '否'
|
||||
} else if (row.upload_sap === '1') {
|
||||
return '是'
|
||||
}
|
||||
formatStatus(row) {
|
||||
const item = this.statusOptions.find(option => option.value === row.status)
|
||||
return item ? item.label : row.status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user