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