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.
 
 
 
 
 
 

228 lines
7.8 KiB

<template>
<div class="page-box" v-loading="Loading.appMainLoading">
<tablePagination
:currenButtonData="currenButtonData"
:tableData="tableData"
:tableLoading="Loading.tableLoading"
:tableColumns="tableColumns"
@rowDrop="rowDrop"
:totalCount="totalCount"
:multipleSelection="multipleSelection"
:MaxResultCount="PageListParams.MaxResultCount"
@topbutton="topbutton"
@inlineDialog="inlineDialog"
@sortChange="sortChange"
@alertoldSkipCount="alertoldSkipCount"
@alterResultCount="alterResultCount"
@handleSelectionChange="handleSelectionChange"
:currentPageProps="oldSkipCount"
:quicklySearchOption="quicklySearchOption"
@quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear"
:primarySearchOption="primarySearchOption"
@overallSearchFormClick="overallSearchFormClick"
:httpOverallSearchData="httpOverallSearchData"
>
</tablePagination>
<!-- 新导入 disabledMethod 导入方式禁用 disabledIsAllowPartImport 是否局部导入禁用-->
<!-- methodValue 导入方式默认选项 是否局部导入 默认选项 -->
<importFile
:loading="Loading.importLoading"
:show="displayDialog.importDialog"
:URL="URL"
:disabledMethod="{ method1: false, method2: false, method3: false }"
:disabledIsAllowPartImport="{
isAllowPartImport1: false,
isAllowPartImport2: false,
}"
isAllowPartImportValue="1"
@importClick="postImportMergeClick(arguments)"
@postImportDown="importDown"
></importFile>
<curren-Drawer
:title="tableColumns"
:DrawerLoading="Loading.DrawerLoading"
:drawer="displayDialog.detailsDialog"
:propsData="propsData"
:tabsDesTions="tabsDesTions"
:Butttondata="DrawerButtonData"
@drawerShut="(val) => (displayDialog.detailsDialog = val)"
@drawerbutton="drawerbutton"
@close-value="closeValue"
:currenButtonData="currenButtonData"
:tableColumns="detailsTableColumns"
:totalCount="totalCountDetails"
:MaxResultCount="MaxResultCountDetails"
@alterResultCountDetails="alterResultCountDetails"
@alertoldSkipCountDetails="alertoldSkipCountDetails"
></curren-Drawer>
</div>
</template>
<script>
import { materialRequestByType,processRequest,getDetailed } from "@/api/wms-api"
import { tableMixins } from "@/mixins/TableMixins"
import { LoadingMixins } from "@/mixins/LoadingMixins"
import { drawerMixins } from "@/mixins/drawerMixins"
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins"
import { mixins } from "@/mixins/mixins"
import { requestData } from "@/utils/processButtonData"
import requestDataNames from "@/utils/processButtonData"
export default {
name: "IssueRequestZS",
mixins: [
tableMixins,
LoadingMixins,
drawerMixins,
TableHeaderMixins,
mixins,
],
computed: {
editDialog: {
get: function () {
return this.displayDialog.newDialog || this.displayDialog.editDialog;
},
},
},
data () {
let _this = this;
return {
URL: 'wms/store/material-request',
tableLoading: false,
handleMultipleSelection: [],
//常用按钮数据
currenButtonData: [
this.defaultImportBtn(),//导入
this.defaultFieldSettingBtn(),//字段设置
this.defaultFreshBtn(),//刷新
this.defaultFilterBtn(),//筛选
],
//执行前获取记录数据暂存
oldIssueJobIds: [],
DrawerButtonData: [
// ...requestData(this),
{
type: 'primary',
icon: 'el-icon-circle-check',
label: '完成',
hide: () => { return this.completeRequestInit([2,6])},
name: "completeRequest",
size: 'mini'
},
{
type: 'primary',
icon: 'el-icon-circle-check',
label: '执行',
name: "IssueRequest-zx",
hide: () => { return this.againHandleRequestInit([9])},
size: 'mini'
},
...requestData(this,false,false,[requestDataNames.againHandle]),
],
};
},
mounted () {
this.paging()
},
methods: {
//渲染数据
paging(callback) {
this.Loading.tableLoading = true;
this.PageListParams.SkipCount = (this.oldSkipCount - 1) * this.PageListParams.MaxResultCount
// 叫料请求类型: 人工拉动:Issue_Manual; 线边拉动:Issue_WIP; 直接发料:Direct_Issue
let params = {
type: 'Issue_Manual'
}
materialRequestByType(this.PageListParams, this.URL + '/by-type', params).then(res => {
this.tableData = res.items
this.totalCount = res.totalCount
this.pagingCallback(callback)
}).catch(err => {
this.Loading.tableLoading = false
})
},
// 重新定义【完成按钮】显示判断 除了2(待审批) 和 6(完成状态)都显示(abortRequestRequestInit)
completeRequestInit(val){
let data = false
val.forEach(key => {
if (this.propsData.requestStatus == key) {
data = true
}
})
return data
},
// 定义【执行按钮】显示判断 ==9时候显示
againHandleRequestInit(val){
let data = true
val.forEach(key => {
if (this.propsData.requestStatus == key) {
data = false
}
})
return data
},
// 执行成功后处理
handleResult(){
getDetailed(this.propsData.id, this.URL).then(res => {
this.propsData = res
})
this.paging()
this.Loading.appMainLoading = false
},
//抽屉常用按钮
drawerbutton (val) {
// 执行
if(val == 'IssueRequest-zx'){
this.Loading.appMainLoading = true
// 获取记录数据暂存
processRequest(this.propsData.number,'wms/store/issue-job/by-request-number/').then(resFirst=>{
this.oldIssueJobIds = []
resFirst.forEach(item=>{
this.oldIssueJobIds.push(item.id)
})
// 执行操作
processRequest(this.propsData.id, this.URL + '/handle/').then(resHandle => {
// 重新获取记录对比
processRequest(this.propsData.number,'wms/store/issue-job/by-request-number/').then(resNew=>{
// 重新获取的记录为空(未生成任务)
if(!resNew || resNew.length <= 0){
this.$errorMsg('没有可用库存,未生成新任务')
this.handleResult()
return
}
// 当前有记录
if(resNew && resNew.length > 0){
let _newIds = []
resNew.forEach(item=>{
_newIds.push(item.id)
})
if(this.oldIssueJobIds.sort().toString() === _newIds.sort().toString()){
let mes = '未生成任务原因: ' + `<br/>` + '1、该请求中的【物品】的【实际发货数量】小于【请求数量】,请确认数量后点击【完成】。' + `<br/>` + '2、该请求中的【库存余额】小于【请求数量】,请确认数量后点击【执行】'
this.$alert(mes,
'错误提示', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true
})
}else{
this.$successMsg('执行成功,已生成新任务')
}
this.handleResult()
}
})
}).catch(err => {
console.log(err)
this.Loading.appMainLoading = false
})
}).catch(err => {
console.log(err)
this.Loading.appMainLoading = false
})
} else {
drawerMixins.methods.drawerbutton(val, this)
}
},
}
};
</script>
<style lang="scss" scoped>
@import "../../../styles/mainbasicData.scss";
</style>