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.
575 lines
19 KiB
575 lines
19 KiB
<template>
|
|
<div>
|
|
<div class="tab-header webtop">
|
|
<!-- 标题 -->
|
|
<div>{{title}}旧件返厂申请</div>
|
|
<!-- start 添加修改按钮 -->
|
|
<div>
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="importDetail">导入厂家返件明细</el-button>
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="submit">提交</el-button>
|
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
|
|
</div>
|
|
<!-- end 添加修改按钮 -->
|
|
<!-- end 详情按钮 -->
|
|
</div>
|
|
<div class="listconadd">
|
|
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02">
|
|
<div class="title">
|
|
<div>基础信息</div>
|
|
</div>
|
|
<el-row class="first_row">
|
|
|
|
<!-- <el-col :span="12">
|
|
<div class="span-sty">单据编号</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.billNo }}</span></el-form-item>
|
|
</el-col> -->
|
|
<el-col :span="8">
|
|
<div class="span-sty">申请人</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.createByName }}</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<div class="span-sty">申请部门</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.deptName }}</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<div class="span-sty"><span class="must">*</span> 申请日期</div>
|
|
<el-form-item prop="createTime">
|
|
<el-date-picker v-model="formobj.createTime" class="addinputw addinputInfo" type="date"
|
|
value-format="yyyy-MM-dd" placeholder="选择日期">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
<!-- <el-row>
|
|
|
|
<el-col :span="12">
|
|
<div class="span-sty">分公司</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.useOrgName }}</span></el-form-item>
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="12">
|
|
<div class="span-sty">流程状态</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.nodeState }}</span></el-form-item>
|
|
</el-col>
|
|
|
|
</el-row> -->
|
|
<el-row>
|
|
|
|
<el-col :span="24">
|
|
<div class="span-sty">备注</div>
|
|
<el-form-item>
|
|
<el-input v-model="formobj.remarks" placeholder="" class="addinputw addinputInfo" type="textarea"
|
|
:rows="4" clearable />
|
|
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="24">
|
|
<div class="span-sty"><span class="must">*</span> 附件</div>
|
|
<el-form-item prop="imgList">
|
|
<upload-img ref="uploadImg" class="addinputw" v-model="imgList" :limit="50" bucket="map"
|
|
:upload-data="{ type: '0001' }" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
<div class="title">
|
|
<div>返厂旧件列表</div>
|
|
</div>
|
|
<el-table v-loading="listLoading" :data="formobj.asOldpartreturnList" border>
|
|
<el-table-column fixed width="60" label="序号" type="index" :index="indexMethod" align="center" />
|
|
<el-table-column align="center" width="100" :render-header="commodityHeader">
|
|
<template slot-scope="scope">
|
|
<i class="el-icon-delete" @click="commodityDelete(scope.$index)"></i>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="商品名称" align="center" min-width="200">
|
|
<template slot-scope="scope">
|
|
<el-popover placement="right" width="900" trigger="click">
|
|
<div>
|
|
<el-table :data="commodityData" v-loading="commodityLoading" highlight-current-row
|
|
@current-change="commodityCurrentChange($event, scope.row)">
|
|
<el-table-column fixed prop="goodsSpuName" label="商品名称" align="center" />
|
|
<el-table-column prop="goodsSkuCode" label="商品编码" align="center" />
|
|
<el-table-column prop="manufacturerName" label="厂家" align="center" />
|
|
<el-table-column prop="goodsSkuOwnSpec" label="规格" align="center" />
|
|
<el-table-column prop="unit" label="单位" align="center" />
|
|
</el-table>
|
|
<el-pagination :page.sync="commodityQuery.current" :page-size="commodityQuery.size"
|
|
layout="total, pager" :total="commodityQuery.total" />
|
|
</div>
|
|
<el-input slot="reference" v-model="scope.row.goodsSkuName"
|
|
@input="commodityInput(scope.row.goodsSkuName)" clearable placeholder="商品名称" />
|
|
</el-popover>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="goodsSkuCode" label="商品编码" align="center" />
|
|
<el-table-column prop="manufacturerName" label="厂家" align="center" />
|
|
<el-table-column prop="goodsSkuOwnSpec" label="规格" align="center" />
|
|
<el-table-column prop="unit" label="单位" align="center" />
|
|
<el-table-column label="需返厂数量" align="center" width="180">
|
|
<template slot-scope="scope">
|
|
<el-input ref="focusAssumptionInput" v-model="scope.row.needReturnCount" clearable placeholder=""
|
|
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" />
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="实际返厂数量" align="center" width="180">
|
|
<template slot-scope="scope">
|
|
<el-input ref="focusAssumptionInput" v-model="scope.row.actualReturnCount" clearable placeholder=""
|
|
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" />
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="差异说明" align="center" width="200">
|
|
<template slot-scope="scope">
|
|
<el-input ref="focusAssumptionInput" v-model="scope.row.remarks" clearable placeholder="" />
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
</el-form>
|
|
|
|
</div>
|
|
|
|
<!-- 导入 -->
|
|
<el-dialog :visible.sync="dialogVisible" width="60%" :show-close="false">
|
|
<div style="margin-top: -40px;">
|
|
<el-button size="medium" type="text" style="font-weight: bold" @click="downLoad">下载导入厂家返厂明细模板</el-button>
|
|
</div>
|
|
<el-card class="box-card">
|
|
<div>
|
|
<el-upload ref="upload" class="upload-demo" accept=".xls,.xlsx" name="file" :action="updateAction"
|
|
:on-success="handleSuccess" :file-list="fileList" :auto-upload="false" :multiple="false" :limit="1"
|
|
:data="uploadData" :headers="headers">
|
|
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
|
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传</el-button>
|
|
</el-upload>
|
|
</div>
|
|
<div>
|
|
<h3>文件上传结果</h3>
|
|
<el-card class="box-card">
|
|
<div>{{ uploadResultMesssage }}</div>
|
|
</el-card>
|
|
</div>
|
|
</el-card>
|
|
<div slot="footer" class="dialog-footer" style="text-align: center">
|
|
<el-button type="primary" size="small" @click="handleConfirm">确定</el-button>
|
|
<el-button size="small" @click="dialogVisible = false">取消</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import req from '@/api/storage/manufacturerconfirm.js'
|
|
import uploadImg from '@/components/uploadFile/uploadImg'
|
|
import {
|
|
getOrgSidByPath
|
|
} from '@/api/Common/dictcommons'
|
|
|
|
export default {
|
|
components: {
|
|
uploadImg
|
|
},
|
|
data() {
|
|
return {
|
|
dialogVisible: false,
|
|
updateAction: process.env.VUE_APP_BASE_API + '/as/v1/asoldpartreturnapply/getExcelInfo',
|
|
fileList: [],
|
|
uploadSuccess: false,
|
|
uploadResultMesssage: '',
|
|
uploadData: {
|
|
sid: ''
|
|
},
|
|
headers: {
|
|
token: window.sessionStorage.getItem('token')
|
|
},
|
|
title: '【新增】',
|
|
listLoading: false,
|
|
submitdisabled: false,
|
|
formobj: {
|
|
"sid": "",
|
|
"remarks": "",
|
|
"createBySid": window.sessionStorage.getItem('userSid'),
|
|
"createByName": window.sessionStorage.getItem('name'),
|
|
"deptSid": window.sessionStorage.getItem('defaultOrgPathName').substring(window
|
|
.sessionStorage.getItem('defaultOrgPathName').lastIndexOf('/') + 1),
|
|
"deptName": window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage
|
|
.getItem('defaultOrgPath').lastIndexOf('/') + 1),
|
|
"createTime": "",
|
|
"billNo": "",
|
|
"filePaths": [],
|
|
"useOrgSid": '',
|
|
"useOrgName": '',
|
|
"orgSidPath": window.sessionStorage.getItem('orgSidPath'),
|
|
"procDefId": "",
|
|
"nodeId": "",
|
|
"procInstId": "",
|
|
"nodeState": "",
|
|
"taskId": "",
|
|
"finishTime": "",
|
|
"asOldpartreturnList": [
|
|
|
|
]
|
|
},
|
|
hideUploadBtn: false,
|
|
|
|
// commodity商品
|
|
commodityKey: 1,
|
|
commodityLoading: false,
|
|
commodityQuery: {
|
|
current: 1,
|
|
size: 2,
|
|
total: 0,
|
|
params: {
|
|
name: '',
|
|
inOrg: "",
|
|
outOrg: ""
|
|
}
|
|
},
|
|
commodityData: [],
|
|
isUpdata: false,
|
|
imgList: [],
|
|
rules: {
|
|
createTime: [{
|
|
required: true,
|
|
message: '申请日期不能为空',
|
|
trigger: 'change'
|
|
}],
|
|
filePaths: [{
|
|
required: true,
|
|
message: '附件不能为空',
|
|
trigger: 'blur'
|
|
}],
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
getOrgSidByPath({
|
|
orgPath: window.sessionStorage.getItem('defaultOrgPath')
|
|
}).then((res) => {
|
|
if (res.success) {
|
|
this.formobj.createOrgSid = res.data
|
|
this.formobj.useOrgSid = res.data
|
|
}
|
|
})
|
|
},
|
|
methods: {
|
|
|
|
commodityInput(value) {
|
|
this.commodityQuery.params.name = value
|
|
this.commodityLoading = true
|
|
this.commodityQuery.params.userSid = window.sessionStorage.getItem('userSid')
|
|
this.commodityQuery.params.orgPath = window.sessionStorage.getItem('defaultOrgPath')
|
|
this.commodityQuery.params.menuUrl = this.$route.path
|
|
req.getGoodsListPage(this.commodityQuery).then((response) => {
|
|
if (response.success) {
|
|
this.commodityLoading = false
|
|
this.commodityData = response.data.records
|
|
this.commodityQuery.total = response.data.total
|
|
} else {
|
|
this.serviceLoading = false
|
|
this.commodityData = []
|
|
this.commodityQuery.total = 0
|
|
}
|
|
})
|
|
},
|
|
commodityDelete(index) {
|
|
this.formobj.asOldpartreturnList.splice(index, 1)
|
|
},
|
|
commodityCurrentChange(value, row) {
|
|
console.log("commodityCurrentChange》》》》", value)
|
|
console.log("commodityCurrentChange》》》》", row)
|
|
row.sid = ''
|
|
row.remarks = ''
|
|
row.mainSid = ''
|
|
row.manufacturerName = value.manufacturerName
|
|
row.goodsSkuName = value.goodsSpuName
|
|
row.goodsSkuCode = value.goodsSkuCode
|
|
row.goodsSkuOwnSpec = value.goodsSkuOwnSpec
|
|
row.unit = value.unit
|
|
row.needReturnCount = 0
|
|
row.actualReturnCount = 0
|
|
document.body.click()
|
|
},
|
|
|
|
// 在头部标题上添加“新增”图标
|
|
commodityHeader(h, {
|
|
column
|
|
}) {
|
|
return h(
|
|
'div',
|
|
[
|
|
h('span', column.label),
|
|
h('i', {
|
|
class: 'add-btn-icon el-icon-plus',
|
|
style: 'color: red;font-size:20px',
|
|
on: {
|
|
click: this.commodityAdd // 点击执行函数
|
|
}
|
|
})
|
|
]
|
|
)
|
|
},
|
|
commodityAdd() {
|
|
this.formobj.asOldpartreturnList.push({
|
|
"sid": "",
|
|
"remarks": "",
|
|
"mainSid": "",
|
|
"manufacturerName": "",
|
|
"goodsSkuName": "",
|
|
"goodsSkuCode": "",
|
|
"goodsSkuOwnSpec": "",
|
|
"unit": "",
|
|
"needReturnCount": 0,
|
|
"actualReturnCount": 0
|
|
})
|
|
},
|
|
|
|
|
|
doGoodsDel(sid) {
|
|
console.log("doGoodsDel》》》》", sid)
|
|
this.$confirm("是否确定删除此商品?", '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
const index = this.formobj.asOldpartreturnList.findIndex((item) => item === row)
|
|
console.log("index》》》》", index)
|
|
this.formobj.asOldpartreturnList.splice(index, 1)
|
|
|
|
})
|
|
},
|
|
|
|
indexMethod(index) {
|
|
return Number(index) + 1
|
|
},
|
|
importDetail() {
|
|
this.dialogVisible = true
|
|
},
|
|
saveOrUpdate() {
|
|
console.log('>>>>>>>>>saveOrUpdate', this.formobj)
|
|
|
|
this.$refs['form_obj'].validate((valid) => {
|
|
if (valid) {
|
|
this.submitdisabled = true
|
|
req.save(this.formobj).then((res) => {
|
|
if (res.success) {
|
|
this.$message({
|
|
showClose: true,
|
|
type: 'success',
|
|
message: '保存成功'
|
|
})
|
|
this.handleReturn('true')
|
|
} else {
|
|
this.submitdisabled = false
|
|
}
|
|
}).catch(() => {
|
|
this.submitdisabled = false
|
|
})
|
|
}
|
|
})
|
|
},
|
|
submit() {
|
|
|
|
this.$refs['form_obj'].validate((valid) => {
|
|
if (valid) {
|
|
this.submitdisabled = true
|
|
req.submit(this.formobj).then((res) => {
|
|
if (res.success) {
|
|
this.$message({
|
|
showClose: true,
|
|
type: 'success',
|
|
message: '保存成功'
|
|
})
|
|
this.handleReturn('true')
|
|
} else {
|
|
this.submitdisabled = false
|
|
}
|
|
}).catch(() => {
|
|
this.submitdisabled = false
|
|
})
|
|
}
|
|
})
|
|
|
|
},
|
|
handleReturn(isreload) {
|
|
if (isreload === 'true') this.$emit('reloadlist')
|
|
this.imgList = []
|
|
this.formobj = {
|
|
"sid": "",
|
|
"remarks": "",
|
|
"createBySid": window.sessionStorage.getItem('userSid'),
|
|
"createByName": window.sessionStorage.getItem('name'),
|
|
"deptSid": window.sessionStorage.getItem('defaultOrgPathName').substring(window
|
|
.sessionStorage.getItem('defaultOrgPathName').lastIndexOf('/') + 1),
|
|
"deptName": window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage
|
|
.getItem('defaultOrgPath').lastIndexOf('/') + 1),
|
|
"createTime": "",
|
|
"billNo": "",
|
|
"filePaths": [],
|
|
"useOrgSid": '',
|
|
"useOrgName": '',
|
|
"orgSidPath": window.sessionStorage.getItem('orgSidPath'),
|
|
"procDefId": "",
|
|
"nodeId": "",
|
|
"procInstId": "",
|
|
"nodeState": "",
|
|
"taskId": "",
|
|
"finishTime": "",
|
|
"asOldpartreturnList": [
|
|
|
|
]
|
|
}
|
|
this.submitdisabled = false
|
|
this.isUpdata = false
|
|
this.$emit('doback')
|
|
},
|
|
|
|
showAdd() {
|
|
this.$nextTick(() => {
|
|
this.$refs['form_obj'].clearValidate()
|
|
})
|
|
this.title = "【新增】"
|
|
this.isUpdata = false
|
|
},
|
|
showEdit(row) {
|
|
this.$nextTick(() => {
|
|
this.$refs['form_obj'].clearValidate()
|
|
})
|
|
this.title = "【修改】"
|
|
this.isUpdata = true
|
|
var params = {
|
|
sid: row.sid
|
|
}
|
|
|
|
req.init(row.sid)
|
|
.then(resp => {
|
|
if (resp.success) {
|
|
this.formobj = resp.data
|
|
|
|
for (var i = 0; i < resp.data.filePaths.length; i++) {
|
|
this.imgList.push({
|
|
url: resp.data.filePaths[i].url
|
|
})
|
|
}
|
|
|
|
}
|
|
})
|
|
.catch(e => {
|
|
this.formobj = {}
|
|
})
|
|
},
|
|
|
|
downLoad() {
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: 'Loading',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
})
|
|
req.downloadExcel().then((resp) => {
|
|
loading.close()
|
|
const blob = new Blob([resp], {
|
|
type: 'application/vnd.ms-excel'
|
|
})
|
|
const fileName = '导入厂家返厂明细模版' + '.xls'
|
|
const elink = document.createElement('a')
|
|
elink.download = fileName
|
|
elink.style.display = 'nonde'
|
|
elink.href = URL.createObjectURL(blob)
|
|
document.body.appendChild(elink)
|
|
elink.click()
|
|
URL.revokeObjectURL(elink.href)
|
|
document.body.removeChild(elink)
|
|
}).catch(() => {
|
|
loading.close()
|
|
})
|
|
},
|
|
submitUpload() {
|
|
this.$refs.upload.submit()
|
|
},
|
|
handleSuccess(resp, file, fileList) {
|
|
const _this = this
|
|
_this.uploadResultMesssage = resp.msg
|
|
_this.uploadSuccess = resp.success
|
|
|
|
if (resp.success) {
|
|
|
|
for (var i = 0; i < resp.data.length; i++) {
|
|
this.formobj.asOldpartreturnList.push(resp.data[i])
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
handleConfirm() {
|
|
if (!this.uploadSuccess) {
|
|
this.$message({
|
|
showClose: true,
|
|
type: 'error',
|
|
message: '请先上传导入厂家返件明细'
|
|
})
|
|
return
|
|
}
|
|
this.dialogVisible = false
|
|
},
|
|
backData(value) {
|
|
console.log('backData》》》》', value)
|
|
console.log('imgList', this.imgList)
|
|
|
|
for (var i = 0; i < this.imgList.length; i++) {
|
|
this.formobj.filePaths.push(this.imgList[i].url)
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
/deep/ .el-form-item__error {
|
|
margin-left: 120px !important;
|
|
}
|
|
|
|
.must {
|
|
color: #f00;
|
|
}
|
|
|
|
.span-sty {
|
|
width: 130px !important;
|
|
}
|
|
|
|
.addinputInfo {
|
|
margin-left: 120px !important;
|
|
}
|
|
|
|
.formaddcopy02 .el-row .el-col /deep/ .el-form-item .addinputw {
|
|
margin-left: 120px !important;
|
|
width: calc(100% - 115px);
|
|
}
|
|
|
|
.first_row {
|
|
border-top: 1px solid #E0E3EB;
|
|
}
|
|
|
|
.titleOne {
|
|
padding: 7px;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
</style>
|
|
|