新购-新增-文件管理
This commit is contained in:
parent
534a14bc0f
commit
6613e9fe16
|
|
@ -26,14 +26,14 @@ export function acceptancePurchase(data) {
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//根据任务id查询报告附件
|
// //根据任务id查询报告附件
|
||||||
export function getPurchaseFileList(query) {
|
// export function getPurchaseFileList(query) {
|
||||||
return request({
|
// return request({
|
||||||
url: '/material/purchase_check_details/fileList',
|
// url: '/material/purchase_check_details/fileList',
|
||||||
method: 'get',
|
// method: 'get',
|
||||||
params: query
|
// params: query
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
// 上传报告附件 - 异步
|
// 上传报告附件 - 异步
|
||||||
export function uploadPurchaseFile(data) {
|
export function uploadPurchaseFile(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
@ -42,7 +42,14 @@ export function uploadPurchaseFile(data) {
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//根据任务id查询报告附件
|
||||||
|
export function getPurchaseFileList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/material/bm_file_info/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 查询新购验收任务详细列表
|
// 查询新购验收任务详细列表
|
||||||
export function getPurchaseCheckFormByTaskId(taskId) {
|
export function getPurchaseCheckFormByTaskId(taskId) {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export function getListNewBuy(query) {
|
||||||
//新购到货-二级列表详情
|
//新购到货-二级列表详情
|
||||||
export function getPurchaseCheckInfo(query) {
|
export function getPurchaseCheckInfo(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/material//purchase_check_info/getInfo',
|
url: '/material/purchase_check_info/getInfo',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query,
|
params: query,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
clearable
|
clearable
|
||||||
filterable
|
filterable
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
@change="changeSupplier"
|
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in supplierList"
|
v-for="item in supplierList"
|
||||||
|
|
@ -164,32 +163,25 @@
|
||||||
></el-input-number>
|
></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column
|
<el-table-column
|
||||||
label="是否为固定资产"
|
label="是否为固定资产"
|
||||||
prop=""
|
prop="fixCode"
|
||||||
align="center"
|
align="center"
|
||||||
width="200"
|
width="200"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="scope.row.supplierId"
|
v-model="scope.row.fixCode"
|
||||||
placeholder="固定资产"
|
placeholder="固定资产"
|
||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<el-option label="是" value="0"></el-option>
|
<el-option label="是" value="1"></el-option>
|
||||||
<el-option label="否" value="1"></el-option>
|
<el-option label="否" value="0"></el-option>
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-table-column> -->
|
|
||||||
<el-table-column label="物资厂家" prop="supplierId" width="200">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-select v-model="scope.row.supplierId" placeholder="物资厂家" filterable clearable style="width: 180px">
|
|
||||||
<el-option v-for="item in supplierList" :key="item.supplierId" :label="item.supplier"
|
|
||||||
:value="item.supplierId" />
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="出厂日期"
|
label="出厂日期"
|
||||||
align="center"
|
align="center"
|
||||||
|
|
@ -211,7 +203,7 @@
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="相关配套资料"
|
label="相关配套资料"
|
||||||
align="center"
|
align="center"
|
||||||
prop="checkUrlName"
|
prop="bmFileInfos"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div style="color: rgb(2, 167, 240);cursor: pointer;" @click="openFileDialog(scope.row)">报告管理</div>
|
<div style="color: rgb(2, 167, 240);cursor: pointer;" @click="openFileDialog(scope.row)">报告管理</div>
|
||||||
|
|
@ -239,7 +231,7 @@
|
||||||
<el-table :data="fileDataList" width="100%" height="350px">
|
<el-table :data="fileDataList" width="100%" height="350px">
|
||||||
<el-table-column label="序号" type="index" width="55" align="center"/>
|
<el-table-column label="序号" type="index" width="55" align="center"/>
|
||||||
<el-table-column label="报告类型" align="center" prop="dictLabel" :show-overflow-tooltip="true"/>
|
<el-table-column label="报告类型" align="center" prop="dictLabel" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="文件名称" align="center" prop="fileName" :show-overflow-tooltip="true"/>
|
<el-table-column label="文件名称" align="center" prop="name" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="类型名称" align="center" :show-overflow-tooltip="true">
|
<el-table-column label="类型名称" align="center" :show-overflow-tooltip="true">
|
||||||
<template>
|
<template>
|
||||||
<div>{{this.rowData.maTypeName}}</div>
|
<div>{{this.rowData.maTypeName}}</div>
|
||||||
|
|
@ -264,7 +256,7 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
|
||||||
<el-button size="mini" type="text" @click="picturePreview(scope.row)" v-if="scope.row.fileUrl">
|
<el-button size="mini" type="text" @click="picturePreview(scope.row)" v-if="scope.row.url">
|
||||||
查看
|
查看
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -293,7 +285,7 @@ import {
|
||||||
} from '@/api/purchase/goodsArrived';
|
} from '@/api/purchase/goodsArrived';
|
||||||
import { getListFacturer } from '@/api/ma/supplier';
|
import { getListFacturer } from '@/api/ma/supplier';
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
import { uploadPurchaseFile } from "@/api/purchase/goodsAccept";
|
import { uploadPurchaseFile,getPurchaseFileList } from "@/api/purchase/goodsAccept";
|
||||||
|
|
||||||
// import Treeselect from '@riophae/vue-treeselect'
|
// import Treeselect from '@riophae/vue-treeselect'
|
||||||
// import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
// import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||||
|
|
@ -352,11 +344,11 @@ export default {
|
||||||
open: false,
|
open: false,
|
||||||
rowData:{},
|
rowData:{},
|
||||||
fileDataList: [
|
fileDataList: [
|
||||||
{dictLabel:"合格证",dictCode:"0",fileName:"",fileUrl:""},
|
{dictLabel:"合格证",fileType:"0",name:"",url:""},
|
||||||
{dictLabel:"型式试验报告",dictCode:"1",fileName:"",fileUrl:""},
|
{dictLabel:"型式试验报告",fileType:"1",name:"",url:""},
|
||||||
{dictLabel:"出厂检测报告",dictCode:"2",fileName:"",fileUrl:""},
|
{dictLabel:"出厂检测报告",fileType:"2",name:"",url:""},
|
||||||
{dictLabel:"第三方监测报告",dictCode:"3",fileName:"",fileUrl:""},
|
{dictLabel:"第三方监测报告",fileType:"3",name:"",url:""},
|
||||||
{dictLabel:"其他报告",dictCode:"4",fileName:"",fileUrl:""},
|
{dictLabel:"其他报告",fileType:"4",name:"",url:""},
|
||||||
],
|
],
|
||||||
//图片查看弹窗
|
//图片查看弹窗
|
||||||
dialogImageUrl: '',
|
dialogImageUrl: '',
|
||||||
|
|
@ -372,7 +364,6 @@ export default {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
equipmentId: undefined,
|
equipmentId: undefined,
|
||||||
productionTime: '',
|
productionTime: '',
|
||||||
supplierId: '',
|
|
||||||
},
|
},
|
||||||
maForm: {
|
maForm: {
|
||||||
taxRate:13,
|
taxRate:13,
|
||||||
|
|
@ -467,7 +458,7 @@ export default {
|
||||||
// this.equipmentList[val].purchaseTaxPrice = (row.purchasePrice*(1 + this.maForm.taxRate/100)).toFixed(2)
|
// this.equipmentList[val].purchaseTaxPrice = (row.purchasePrice*(1 + this.maForm.taxRate/100)).toFixed(2)
|
||||||
row.purchaseTaxPrice = (row.purchasePrice*(1 + this.maForm.taxRate/100)).toFixed(2)
|
row.purchaseTaxPrice = (row.purchasePrice*(1 + this.maForm.taxRate/100)).toFixed(2)
|
||||||
},
|
},
|
||||||
/** 物资厂家 */
|
/** 物资厂家-下拉选 */
|
||||||
supplierInfoList() {
|
supplierInfoList() {
|
||||||
let param = {
|
let param = {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
|
@ -479,11 +470,11 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//选择物资厂家
|
//选择物资厂家
|
||||||
changeSupplier(supplierId) {
|
// changeSupplier(supplierId) {
|
||||||
this.equipmentList.forEach((item) => {
|
// this.equipmentList.forEach((item) => {
|
||||||
this.$set(item, 'supplierId', supplierId)
|
// this.$set(item, 'supplierId', supplierId)
|
||||||
})
|
// })
|
||||||
},
|
// },
|
||||||
/** 机具类型 */
|
/** 机具类型 */
|
||||||
equipmentType() {
|
equipmentType() {
|
||||||
equipmentTypeTree().then((response) => {
|
equipmentTypeTree().then((response) => {
|
||||||
|
|
@ -522,32 +513,6 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//添加机具类型
|
//添加机具类型
|
||||||
select(row) {
|
|
||||||
console.log(row)
|
|
||||||
if (row.level == 4) {
|
|
||||||
for (let i = 0; i < this.equipmentList.length; i++) {
|
|
||||||
if (this.equipmentList[i].typeId == row.typeId) {
|
|
||||||
this.equipmentList.splice(i, 1)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果有厂家则代入
|
|
||||||
if (this.queryParams.supplierId) {
|
|
||||||
this.$set(row, 'supplierId', this.queryParams.supplierId)
|
|
||||||
} else {
|
|
||||||
this.$set(row, 'supplierId', '')
|
|
||||||
}
|
|
||||||
this.$set(row, 'createTime', null)
|
|
||||||
this.$set(row, 'productionTime', '')
|
|
||||||
// this.$set(row, 'supplierId', '')
|
|
||||||
this.$set(row, 'purchaseTaxPrice', 0)
|
|
||||||
this.$set(row, 'purchasePrice', 0)
|
|
||||||
this.$set(row, 'purchaseNum', 1)
|
|
||||||
this.equipmentList.unshift(row)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//添加机具类型
|
|
||||||
deviceTypeChange(val) {
|
deviceTypeChange(val) {
|
||||||
const deviceTypeList =
|
const deviceTypeList =
|
||||||
this.$refs.deviceTypeCascader.getCheckedNodes()
|
this.$refs.deviceTypeCascader.getCheckedNodes()
|
||||||
|
|
@ -560,12 +525,14 @@ export default {
|
||||||
for (let z of deviceTypeList) {
|
for (let z of deviceTypeList) {
|
||||||
if (z.data.typeId === i) {
|
if (z.data.typeId === i) {
|
||||||
const obj = JSON.parse(JSON.stringify(z.data))
|
const obj = JSON.parse(JSON.stringify(z.data))
|
||||||
obj.supplierId = ''
|
// obj.supplierId = ''
|
||||||
obj.createTime = null
|
obj.createTime = null
|
||||||
obj.productionTime = ''
|
obj.productionTime = ''
|
||||||
obj.purchaseTaxPrice = 0
|
obj.purchaseTaxPrice = 0
|
||||||
obj.purchaseTaxPrice = 0
|
obj.purchaseTaxPrice = 0
|
||||||
obj.purchaseNum = 1
|
obj.purchaseNum = 1
|
||||||
|
obj.fixCode = "0"
|
||||||
|
obj.bmFileInfos=[]
|
||||||
tempList.push(obj)
|
tempList.push(obj)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -622,7 +589,7 @@ export default {
|
||||||
this.single = selection.length != 1
|
this.single = selection.length != 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 保存按钮操作 */
|
||||||
handleSave() {
|
handleSave() {
|
||||||
console.log(this.equipmentList)
|
console.log(this.equipmentList)
|
||||||
if (this.equipmentList.length > 0) {
|
if (this.equipmentList.length > 0) {
|
||||||
|
|
@ -637,9 +604,7 @@ export default {
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
console.log('编辑')
|
console.log('编辑')
|
||||||
this.loading = true
|
this.loading = true
|
||||||
updatePurchaseCheckInfo(
|
updatePurchaseCheckInfo({purchaseCheckDetailsList: this.equipmentList,purchaseCheckInfo:this.maForm}).then((response) => {
|
||||||
{purchaseCheckDetailsList: this.equipmentList,purchaseCheckInfo:this.maForm}
|
|
||||||
).then((response) => {
|
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
this.$modal.msgSuccess(
|
this.$modal.msgSuccess(
|
||||||
'编辑成功',
|
'编辑成功',
|
||||||
|
|
@ -656,10 +621,9 @@ export default {
|
||||||
})
|
})
|
||||||
} else if (!this.isEdit) {
|
} else if (!this.isEdit) {
|
||||||
console.log('新增')
|
console.log('新增')
|
||||||
|
console.log(this.equipmentList)
|
||||||
this.loading = true
|
this.loading = true
|
||||||
addPurchaseCheckInfo(
|
addPurchaseCheckInfo({purchaseCheckDetailsList: this.equipmentList,purchaseCheckInfo:this.maForm}).then((response) => {
|
||||||
{purchaseCheckDetailsList: this.equipmentList,purchaseCheckInfo:this.maForm}
|
|
||||||
).then((response) => {
|
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
this.$modal.msgSuccess(
|
this.$modal.msgSuccess(
|
||||||
'新增成功',
|
'新增成功',
|
||||||
|
|
@ -688,38 +652,88 @@ export default {
|
||||||
//文件管理
|
//文件管理
|
||||||
openFileDialog(row){
|
openFileDialog(row){
|
||||||
this.rowData=row;
|
this.rowData=row;
|
||||||
// this.getFileData()
|
if(this.taskId==""){
|
||||||
|
this.fileDataList = [{dictLabel:"合格证",fileType:"0",name:"",url:""},
|
||||||
|
{dictLabel:"型式试验报告",fileType:"1",name:"",url:""},
|
||||||
|
{dictLabel:"出厂检测报告",fileType:"2",name:"",url:""},
|
||||||
|
{dictLabel:"第三方监测报告",fileType:"3",name:"",url:""},
|
||||||
|
{dictLabel:"其他报告",fileType:"4",name:"",url:""}]
|
||||||
|
// console.log(this.rowData)
|
||||||
|
// console.log(this.rowData.bmFileInfos)
|
||||||
|
if(this.rowData.bmFileInfos.length>0){
|
||||||
|
this.rowData.bmFileInfos.forEach(item=>{
|
||||||
|
let index = this.fileDataList.findIndex(v=>v.fileType==item.fileType)
|
||||||
|
this.fileDataList[index].name = item.name
|
||||||
|
this.fileDataList[index].url = item.url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.getFileData()
|
||||||
|
}
|
||||||
this.open=true
|
this.open=true
|
||||||
},
|
},
|
||||||
// getFileData(){
|
getFileData(){
|
||||||
// let param = {
|
let param = {
|
||||||
// typeId:this.rowData.typeId,
|
modelId:this.rowData.typeId,
|
||||||
// taskId:this.rowData.taskId
|
taskType:0,
|
||||||
// }
|
taskId:this.rowData.taskId
|
||||||
// this.dialogLoading=true
|
}
|
||||||
// getPurchaseFileList(param).then((response) => {
|
getPurchaseFileList(param).then((response) => {
|
||||||
// this.fileDataList=response.data
|
if(response.rows.length>0){
|
||||||
// this.dialogLoading = false;
|
response.rows.forEach(item=>{
|
||||||
// }).catch(() => {this.dialogLoading = false;})
|
let index = this.fileDataList.findIndex(v=>v.fileType==item.fileType)
|
||||||
// },
|
this.fileDataList[index].name = item.name
|
||||||
|
this.fileDataList[index].url = item.url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
beforeFileUpload(row){
|
beforeFileUpload(row){
|
||||||
this.rowData.dictCode=row.dictCode;
|
this.rowData.fileType=row.fileType;
|
||||||
this.rowData.dictLabel=row.dictLabel;
|
|
||||||
},
|
},
|
||||||
// 文件上传成功处理
|
// 文件上传成功处理
|
||||||
handleFileSuccess(response, file, fileList) {
|
handleFileSuccess(response, file, fileList) {
|
||||||
if(response.code==200){
|
if(response.code==200){
|
||||||
let param = {
|
if(this.taskId==""){//新增逻辑
|
||||||
// "id": this.id,
|
// console.log(response)
|
||||||
|
// console.log(this.rowData)
|
||||||
|
// console.log(this.rowData.bmFileInfos)
|
||||||
|
let obj = {
|
||||||
"taskId": this.taskId,
|
"taskId": this.taskId,
|
||||||
"taskType": "0",
|
"taskType": "0",
|
||||||
"name": response.data.name,
|
"name": response.data.name,
|
||||||
"url": response.data.url,
|
"url": response.data.url,
|
||||||
"modelId": this.rowData.typeId,
|
"modelId": this.rowData.typeId,
|
||||||
"fileType": this.rowData.dictCode,
|
"fileType": this.rowData.fileType,
|
||||||
|
// "dictLabel": this.rowData.dictLabel,
|
||||||
|
}
|
||||||
|
//根据文件上传返回更新文件管理弹窗内容
|
||||||
|
let index = this.fileDataList.findIndex(v=>v.fileType==this.rowData.fileType)
|
||||||
|
this.fileDataList[index].name = response.data.name
|
||||||
|
this.fileDataList[index].url = response.data.url
|
||||||
|
//判断当前上传的文件是否已上传过-再往机具类型数据中插入
|
||||||
|
if(this.rowData.bmFileInfos.length>0){
|
||||||
|
let index2 = this.rowData.bmFileInfos.findIndex(v=>v.fileType==this.rowData.fileType)
|
||||||
|
if(index2>-1){//相同类型文件重复上传-替换
|
||||||
|
this.rowData.bmFileInfos.splice(index2,0,obj)
|
||||||
|
}else{//不存在相同类型文件-添加
|
||||||
|
this.rowData.bmFileInfos.push(obj)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.rowData.bmFileInfos.push(obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{//编辑逻辑
|
||||||
|
let param = {
|
||||||
|
"taskId": this.taskId,
|
||||||
|
"taskType": "0",
|
||||||
|
"name": response.data.name,
|
||||||
|
"url": response.data.url,
|
||||||
|
"modelId": this.rowData.typeId,
|
||||||
|
"fileType": this.rowData.fileType,
|
||||||
// "dictLabel": this.rowData.dictLabel,
|
// "dictLabel": this.rowData.dictLabel,
|
||||||
}
|
}
|
||||||
console.log(param)
|
|
||||||
uploadPurchaseFile(param).then((response) => {
|
uploadPurchaseFile(param).then((response) => {
|
||||||
this.$modal.msgSuccess('上传成功')
|
this.$modal.msgSuccess('上传成功')
|
||||||
this.getFileData()
|
this.getFileData()
|
||||||
|
|
@ -727,15 +741,16 @@ export default {
|
||||||
this.$modal.msgError('上传失败')
|
this.$modal.msgError('上传失败')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
//图片查看
|
//图片查看
|
||||||
picturePreview(file) {
|
picturePreview(file) {
|
||||||
this.dialogImageUrl = file.fileUrl;
|
this.dialogImageUrl = file.url;
|
||||||
const parts = file.fileName.split('.');
|
const parts = file.name.split('.');
|
||||||
const extension = parts.pop();
|
const extension = parts.pop();
|
||||||
if(extension === 'doc'||extension === 'docx'||extension === 'pdf'){
|
if(extension === 'doc'||extension === 'docx'||extension === 'pdf'){
|
||||||
const windowName = file.fileName;
|
const windowName = file.name;
|
||||||
window.open(file.fileUrl,windowName)
|
window.open(file.url,windowName)
|
||||||
}else{
|
}else{
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue