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.
489 lines
20 KiB
489 lines
20 KiB
![]()
2 years ago
|
<template>
|
||
|
<div class="app-container">
|
||
|
<!-- 标题按钮部分开始 -->
|
||
|
<div class="tab-header webtop">
|
||
|
<!-- 标题 -->
|
||
|
<div>{{ viewTitle }}</div>
|
||
|
<!-- start 添加修改按钮 -->
|
||
|
<div style="display: flex;flex-direction: row;justify-content: flex-end;align-items: center">
|
||
|
<el-button type="text" @click="handleDownload"><span style="border-bottom: 1px solid blue">下载Excel示例表样</span></el-button>
|
||
|
<div style="margin-left: 10px;margin-right: 10px">
|
||
|
<el-upload
|
||
|
ref="upload"
|
||
|
class="upload-demo"
|
||
|
accept=".xls"
|
||
|
:action="updateAction"
|
||
|
:file-list="fileList"
|
||
|
:on-progress="handleProgress"
|
||
|
:on-success="handleSuccess"
|
||
|
:multiple="false"
|
||
|
:show-file-list="false"
|
||
|
:limit="1"
|
||
|
>
|
||
|
<el-button type="primary" size="small">上传采购订单excel文件</el-button>
|
||
|
</el-upload>
|
||
|
</div>
|
||
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
|
||
|
</div>
|
||
|
<!-- end 添加修改按钮 -->
|
||
|
<!-- end 详情按钮 -->
|
||
|
</div>
|
||
|
<!-- 标题按钮部分结束 -->
|
||
|
<!-- Start 新增修改部分 -->
|
||
|
<div class="listconadd" style="padding: 20px;">
|
||
|
<el-collapse v-model="collOrderInfoActiveNames">
|
||
|
<el-collapse-item title="订单详情" name="1">
|
||
|
<el-form ref="form_obj" :model="formobj" :rules="rules" label-position="right" class="formadd" style="padding: 0px;">
|
||
|
<div class="title">
|
||
|
<div>采购订单信息</div>
|
||
|
</div>
|
||
|
<el-row>
|
||
|
<el-col :span="3" class="tleftb"><span>订单编号</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.code }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
<el-col :span="3" class="tleftb"><span>填单人</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.buyerName }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
<el-col :span="3" class="tleftb"><span>填单时间</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.purchaseDate }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row>
|
||
|
<el-col :span="3" class="tleftb"><span>供货单位</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.supplierName }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
<el-col :span="3" class="tleftb"><span>仓位</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.warehousePosition }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
<el-col :span="3" class="tleftb"><span>到货日期</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.arrivalDate }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row>
|
||
|
<el-col :span="3" class="tleftb"><span>采购员</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.buyerName }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
<el-col :span="3" class="tleftb"><span>入库单位</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.purchasingDeptName }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
<el-col :span="3" class="tleftb"><span>单据到效期</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.expiryDate }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row>
|
||
|
<el-col :span="3" class="tleftb"><span>要货单位</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.purchasingDeptName }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
<el-col :span="3" class="tleftb"><span>入库仓位</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.warehousePosition }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
<el-col :span="3" class="tleftb"><span>完成状态</span></el-col>
|
||
|
<el-col :span="5" class="trightb">
|
||
|
<el-form-item>
|
||
|
<span>{{ formobj.completionStatus }}</span>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<div class="title">
|
||
|
<div>采购商品明细</div>
|
||
|
<div>
|
||
|
<span style="padding-right: 20px">合计数量:{{ totalQuantity }}</span>
|
||
|
<span>合计金额:{{ amountInTotal }}</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
<el-table :data="prolist" :index="index" border style="width: 100%">
|
||
|
<el-table-column fixed label="序号" width="60px" type="index" :index="index + 1" align="center" />
|
||
|
<el-table-column label="商品代码" align="center" width="100" prop="proCode" />
|
||
|
<el-table-column label="商品名称" align="center" prop="proName" />
|
||
|
<el-table-column label="品类编码" align="center" width="100" prop="categoryKey" />
|
||
|
<el-table-column label="品类名称" align="center" width="100" prop="category" />
|
||
|
<el-table-column label="品牌编码" align="center" width="100" prop="brandCode" />
|
||
|
<el-table-column label="品牌名称" align="center" width="100" prop="brand" />
|
||
|
<el-table-column label="合计(元)" align="center" width="150" prop="totalPrice" />
|
||
|
<el-table-column label="数量" align="center" width="100" prop="number" />
|
||
|
<el-table-column label="包装规格" align="center" width="150" prop="packageSpec" />
|
||
|
</el-table>
|
||
|
</el-form>
|
||
|
</el-collapse-item>
|
||
|
</el-collapse>
|
||
|
|
||
|
<el-card class="box-card">
|
||
|
<div slot="header" class="clearfix">
|
||
|
<span>供应商信息检测</span>
|
||
|
<el-button style="float: right; padding: 3px 0" type="text" @click="handleDownload">重新检测</el-button>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div v-if="supplierCheckState==0">{{ supplierCheckMsg }}</div>
|
||
|
<div v-else-if="supplierCheckState==1">
|
||
|
<el-table :data="supplierChecklist" :index="index" border style="width: 100%">
|
||
|
<el-table-column fixed label="序号" width="60px" type="index" :index="index + 1" align="center" />
|
||
|
<el-table-column label="供应商编码" align="center" width="150" prop="supplierCode" />
|
||
|
<el-table-column label="供应商名称" align="center" prop="supplierName" />
|
||
|
<el-table-column label="供应商统一编码" align="center" width="150" prop="supplierCodeUnified" />
|
||
|
<el-table-column label="状态" align="center" width="150" prop="resState" />
|
||
|
<el-table-column label="检测结果" align="center" width="300" prop="msg" />
|
||
|
</el-table>
|
||
|
</div>
|
||
|
<div v-else> <el-alert title="供应商信息正常!" show-icon type="success" effect="dark" :closable="false" /></div>
|
||
|
</div>
|
||
|
</el-card>
|
||
|
<el-card class="box-card" style="margin-top: 5px;">
|
||
|
<div slot="header" class="clearfix">
|
||
|
<span>商品信息检测</span>
|
||
|
<el-button style="float: right; padding: 3px 0" type="text" @click="handleDownload">重新检测</el-button>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div v-if="proCheckState==0">{{ proCheckMsg }}</div>
|
||
|
<div v-else-if="proCheckState==1">
|
||
|
<el-table :data="proChecklist" :index="index" border style="width: 100%">
|
||
|
<el-table-column fixed label="序号" width="60px" type="index" :index="index + 1" align="center" />
|
||
|
<el-table-column label="商品代码" align="center" width="100" prop="productCode" />
|
||
|
<el-table-column label="商品名称" align="center" prop="productName" />
|
||
|
<el-table-column label="品类编码" align="center" width="100" prop="categoryCode" />
|
||
|
<el-table-column label="品类名称" align="center" width="100" prop="categoryName" />
|
||
|
<el-table-column label="品牌编码" align="center" width="100" prop="brandCode" />
|
||
|
<el-table-column label="品牌名称" align="center" width="100" prop="brandName" />
|
||
|
<el-table-column label="状态" align="center" width="150" prop="resState" />
|
||
|
<el-table-column label="检测结果" align="center" width="300" prop="msg" />
|
||
|
</el-table>
|
||
|
</div>
|
||
|
<div v-else> <el-alert title="所有商品信息正常!" show-icon type="success" effect="dark" :closable="false" /></div>
|
||
|
</div>
|
||
|
</el-card>
|
||
|
</div>
|
||
|
<!-- End 添加修改部分 -->
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import req from '@/api/supervise/purchaserequisition'
|
||
|
import reqPro from '@/api/supervise/purchaserequisitionpro'
|
||
|
export default {
|
||
|
name: 'PurchaserequisitionUploadxlsx',
|
||
|
data() {
|
||
|
return {
|
||
|
collOrderInfoActiveNames: '1',
|
||
|
candownload: true,
|
||
|
submitdisabled: false,
|
||
|
viewTitle: '',
|
||
|
tableKey: 0,
|
||
|
index: 0,
|
||
|
updateAction: '/api/customer/v1/purchaserequisition/uploadXlsxFile',
|
||
|
fileList: [],
|
||
|
totalQuantity: '', // 合计数量
|
||
|
amountInTotal: '', // 合计金额
|
||
|
formobj: {
|
||
|
sid: '',
|
||
|
code: '', // 单号
|
||
|
buyerName: '', // 采购人姓名
|
||
|
buyerCode: '', // 采购人编码
|
||
|
purchaseDate: '', // 采购日期
|
||
|
arrivalDate: '', // 到货日期
|
||
|
purchasingOrgName: '', // 采购组织名称
|
||
|
purchasingOrgCode: '', // 采购组织编码
|
||
|
purchasingDeptCode: '', // 采购部门名称
|
||
|
purchasingDeptName: '', // 采购部门编码
|
||
|
supplierName: '', // 供应商名称
|
||
|
supplierCode: '', // 供应商编码
|
||
|
logisticsCompanyName: '', // 物流公司名称
|
||
|
logisticsCompanyCode: '', // 物流公司编码
|
||
|
expiryDate: '', // 单据到效期
|
||
|
warehousePosition: '', // 仓位
|
||
|
warehousePositionCode: '', // 仓位code
|
||
|
newCode: '', // 新订单编号
|
||
|
oldCode: '', // 旧订单编号
|
||
|
completionStatus: '', // 完成状态
|
||
|
completionStatusKey: '', // 完成状态key
|
||
|
pros: [] // 采购商品明细列表
|
||
|
},
|
||
|
prolist: [],
|
||
|
supplierCheckState: 0,
|
||
|
supplierCheckMsg: '等待检测',
|
||
|
supplierChecklist: [],
|
||
|
proCheckState: 0,
|
||
|
proCheckMsg: '等待检测',
|
||
|
proChecklist: [],
|
||
|
rules: {}
|
||
|
}
|
||
|
},
|
||
|
created() {},
|
||
|
methods: {
|
||
|
handleReturn() {
|
||
|
this.formobj = {
|
||
|
sid: '',
|
||
|
code: '', // 单号
|
||
|
buyerName: '', // 采购人姓名
|
||
|
buyerCode: '', // 采购人编码
|
||
|
purchaseDate: '', // 采购日期
|
||
|
arrivalDate: '', // 到货日期
|
||
|
purchasingOrgName: '', // 采购组织名称
|
||
|
purchasingOrgCode: '', // 采购组织编码
|
||
|
purchasingDeptCode: '', // 采购部门名称
|
||
|
purchasingDeptName: '', // 采购部门编码
|
||
|
supplierName: '', // 供应商名称
|
||
|
supplierCode: '', // 供应商编码
|
||
|
logisticsCompanyName: '', // 物流公司名称
|
||
|
logisticsCompanyCode: '', // 物流公司编码
|
||
|
expiryDate: '', // 单据到效期
|
||
|
warehousePosition: '', // 仓位
|
||
|
warehousePositionCode: '', // 仓位code
|
||
|
newCode: '', // 新订单编号
|
||
|
oldCode: '', // 旧订单编号
|
||
|
completionStatus: '', // 完成状态
|
||
|
completionStatusKey: '', // 完成状态key
|
||
|
pros: [] // 采购商品明细列表
|
||
|
}
|
||
|
this.totalQuantity = ''
|
||
|
this.amountInTotal = ''
|
||
|
this.$refs['form_obj'].resetFields()
|
||
|
this.$store.dispatch('tagsView/delView', this.$route)
|
||
|
this.$router.go(-1)
|
||
|
// this.$emit('doback')
|
||
|
},
|
||
|
handleProgress(event, file, fileList) {
|
||
|
// this.progressFlag = true; // 显示进度条
|
||
|
// this.loadProgress = parseInt(event.percent); // 动态获取文件上传进度
|
||
|
// if (this.loadProgress >= 100) {
|
||
|
// this.loadProgress = 100
|
||
|
// setTimeout( () => {this.progressFlag = false}, 1000) // 一秒后关闭进度条
|
||
|
// }
|
||
|
// const _this = this
|
||
|
// this.fullscreenloading = this.$loading({
|
||
|
// lock: true,
|
||
|
// text: '文件正在上传',
|
||
|
// spinner: 'el-icon-loading',
|
||
|
// background: 'rgba(0, 0, 0, 0.7)'
|
||
|
// })
|
||
|
// console.log('111', event.percent)
|
||
|
// if (event.percent >= 100) {
|
||
|
// _this.fullscreenloading.text = '上传完成,正在导入数据库'
|
||
|
// }
|
||
|
},
|
||
|
// handleSuccess(resp, file, fileList) {
|
||
|
// // if (this.fullscreenloading) this.fullscreenloading.close()
|
||
|
// // this.fullscreenloading = null
|
||
|
// console.log('222', resp)
|
||
|
// // const rdata = resp.data
|
||
|
// // const _this = this
|
||
|
// // _this.fullscreenloading.text = '数据导入完成,进行汇总'
|
||
|
// // _this.uploadResultMesssage = '共导入数据:' + rdata.allNum + ' 条;符合监管条件的数据:' + rdata.validNum + ' 条;用时:' + rdata.durations + ' 毫秒。'
|
||
|
|
||
|
// // kchz()
|
||
|
// // .then(res => {
|
||
|
// // if (this.fullscreenloading) this.fullscreenloading.close()
|
||
|
// // this.fullscreenloading = null
|
||
|
// // console.log('333', res)
|
||
|
// // _this.hzFilePath = res.data
|
||
|
// // })
|
||
|
// // .catch(e => {
|
||
|
// // if (this.fullscreenloading) this.fullscreenloading.close()
|
||
|
// // this.fullscreenloading = null
|
||
|
// // })
|
||
|
// // // kchzyc()
|
||
|
// // // .then(res => {
|
||
|
// // // if (this.fullscreenloading) this.fullscreenloading.close()
|
||
|
// // // this.fullscreenloading = null
|
||
|
// // // console.log('444', res)
|
||
|
// // // _this.ychzFilePath = res.data
|
||
|
// // // })
|
||
|
// // // .catch(e => {
|
||
|
// // // if (this.fullscreenloading) this.fullscreenloading.close()
|
||
|
// // // this.fullscreenloading = null
|
||
|
// // // })
|
||
|
// },
|
||
|
showAdd() {
|
||
|
this.$nextTick(() => {
|
||
|
this.$refs['form_obj'].clearValidate()
|
||
|
})
|
||
|
this.viewTitle = '【审核编号】'
|
||
|
},
|
||
|
showEdit(row) {
|
||
|
this.$nextTick(() => {
|
||
|
this.$refs['form_obj'].clearValidate()
|
||
|
})
|
||
|
this.viewTitle = '【审核编号】'
|
||
|
req
|
||
|
.fetchBySid(row.sid)
|
||
|
.then(resp => {
|
||
|
if (resp.success) {
|
||
|
this.formobj = resp.data
|
||
|
if (this.formobj.pros.length > 0) {
|
||
|
this.totalQuantity = this.formobj.pros.length
|
||
|
var aa = 0
|
||
|
for (var i = 0; i < this.formobj.pros.length; i++) {
|
||
|
if (this.formobj.pros[i].totalPrice !== '') {
|
||
|
aa = parseFloat(aa) + parseFloat(this.formobj.pros[i].totalPrice)
|
||
|
}
|
||
|
}
|
||
|
this.amountInTotal = aa
|
||
|
}
|
||
|
} else {
|
||
|
// 根据resp.code进行异常情况处理
|
||
|
}
|
||
|
})
|
||
|
.catch(e => {
|
||
|
this.formobj = row
|
||
|
})
|
||
|
},
|
||
|
downCheckExcel() {
|
||
|
window.location.href = process.env.VUE_APP_BASE_API + '/v1/productnum/products?code=' + this.formobj.code
|
||
|
},
|
||
|
handleDownload() {
|
||
|
window.location.href = process.env.VUE_APP_BASE_API + '/v1/purchaserequisition/yb'
|
||
|
},
|
||
|
handleSuccess(resp, file, fileList) {
|
||
|
this.fileList = []
|
||
|
if (resp.success) {
|
||
|
this.$message({
|
||
|
showClose: true,
|
||
|
type: 'success',
|
||
|
message: '导入成功'
|
||
|
})
|
||
|
this.formobj = resp.data
|
||
|
this.loadProList()
|
||
|
this.checkPro()
|
||
|
this.checkSupplier()
|
||
|
} else {
|
||
|
this.$message({
|
||
|
showClose: true,
|
||
|
type: 'error',
|
||
|
message: resp.msg
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
loadProList() {
|
||
|
if (this.formobj.sid) {
|
||
|
reqPro.listByMainSid(this.formobj.sid).then(resp => {
|
||
|
this.prolist = resp.data
|
||
|
this.totalQuantity = this.prolist.length
|
||
|
var aa = 0
|
||
|
for (var i = 0; i < this.prolist.length; i++) {
|
||
|
if (this.prolist[i].totalPrice !== '') {
|
||
|
aa = parseFloat(aa) + parseFloat(this.prolist[i].totalPrice)
|
||
|
}
|
||
|
}
|
||
|
this.amountInTotal = aa
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
checkPro() {
|
||
|
if (this.formobj.sid) {
|
||
|
this.proCheckMsg = '正在对订单的商品信息进行检测...'
|
||
|
reqPro.checkByMainSid(this.formobj.sid).then(resp => {
|
||
|
this.proChecklist = resp.data
|
||
|
if (this.proChecklist.length > 0) {
|
||
|
this.proCheckState = 1
|
||
|
} else {
|
||
|
this.proCheckState = 2
|
||
|
if (this.formobj.purchaseState === '0' && this.supplierCheckState === 2) {
|
||
|
this.updatePurchaseStateSucess()
|
||
|
}
|
||
|
}
|
||
|
this.loadProList()
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
checkSupplier() {
|
||
|
if (this.formobj.sid) {
|
||
|
this.supplierCheckMsg = '正在检测供应商信息...'
|
||
|
req.checkSupplier(this.formobj.sid).then(resp => {
|
||
|
this.supplierChecklist = resp.data
|
||
|
if (this.supplierChecklist.length > 0) {
|
||
|
this.supplierCheckState = 1
|
||
|
} else {
|
||
|
this.supplierCheckState = 2
|
||
|
if (this.formobj.purchaseState === '0' && this.proCheckState === 2) {
|
||
|
this.updatePurchaseStateSucess()
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
updatePurchaseStateSucess() {
|
||
|
req.updatePurchaseStateSucess(this.formobj.sid).then(resp => {
|
||
|
this.formobj.purchaseState = '1'
|
||
|
})
|
||
|
},
|
||
|
dataDelete(index) {
|
||
|
const tip = '请确认是否删除所选记录?'
|
||
|
this.$confirm(tip, '提示', {
|
||
|
confirmButtonText: '确定',
|
||
|
cancelButtonText: '取消',
|
||
|
type: 'warning'
|
||
|
}).then(() => {
|
||
|
this.formobj.pros.splice(index, 1)
|
||
|
})
|
||
|
},
|
||
|
saveOrUpdate() {
|
||
|
this.$refs['form_obj'].validate(valid => {
|
||
|
if (valid) {
|
||
|
this.submitdisabled = true
|
||
|
req
|
||
|
.saveOrUpdate(this.formobj)
|
||
|
.then(resp => {
|
||
|
this.submitdisabled = false
|
||
|
if (resp.success) {
|
||
|
this.$message({
|
||
|
showClose: true,
|
||
|
type: 'success',
|
||
|
message: resp.msg
|
||
|
})
|
||
|
this.handleReturn()
|
||
|
} else {
|
||
|
// 根据resp.code进行异常情况处理
|
||
|
}
|
||
|
})
|
||
|
.catch(() => {
|
||
|
this.submitdisabled = false
|
||
|
})
|
||
|
} else {
|
||
|
return false
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
.title {
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
justify-content: space-between;
|
||
|
align-items: center;
|
||
|
}
|
||
|
</style>
|