物资厂家管理
This commit is contained in:
parent
0596f2a887
commit
4f078ed5a7
|
|
@ -54,5 +54,12 @@ export function addFacturer(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//删除服务器中的文件
|
||||||
|
export function deleteFile(objectKey) {
|
||||||
|
return request({
|
||||||
|
url: '/file/deleteFile',
|
||||||
|
method: 'delete',
|
||||||
|
params:{objectKey}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,7 @@
|
||||||
:file-list="businessLicenseListTemp"
|
:file-list="businessLicenseListTemp"
|
||||||
:show-file-list="true"
|
:show-file-list="true"
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
|
:key="uploadKey"
|
||||||
list-type="picture-card"
|
list-type="picture-card"
|
||||||
accept=".png, .jpg, .jpeg, .pdf"
|
accept=".png, .jpg, .jpeg, .pdf"
|
||||||
:on-change="handleChangeBusinessList"
|
:on-change="handleChangeBusinessList"
|
||||||
|
|
@ -230,15 +231,16 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getListFacturer,getFacturerDetail,editFacturer,addFacturer,delFacturer } from "@/api/ma/supplier";
|
import { getListFacturer,getFacturerDetail,editFacturer,addFacturer,delFacturer,deleteFile } from "@/api/ma/supplier";
|
||||||
import { imgUpLoadThree, fileUpLoad } from '@/api/system/upload'
|
import { imgUpLoadThree, fileUpLoad } from '@/api/system/upload'
|
||||||
import { downloadFile,downloadFileData } from '@/utils/download'
|
import { downloadFile,downloadFileData } from '@/utils/download'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
import { forEach } from 'jszip';
|
import { forEach } from 'jszip';
|
||||||
export default {
|
export default {
|
||||||
name: "supplier",
|
name: "supplier",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
uploadKey: Date.now(),
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
|
|
@ -295,6 +297,7 @@ import { forEach } from 'jszip';
|
||||||
businessLicenseFileList:[],
|
businessLicenseFileList:[],
|
||||||
businessLicenseListTemp:[],
|
businessLicenseListTemp:[],
|
||||||
delBusinessFileIdList:[],
|
delBusinessFileIdList:[],
|
||||||
|
modelIdTemp:undefined,
|
||||||
//图片查看弹窗
|
//图片查看弹窗
|
||||||
dialogImageUrl: '',
|
dialogImageUrl: '',
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
|
@ -385,6 +388,10 @@ import { forEach } from 'jszip';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.businessLicenseListTemp.splice(sum, 1)
|
this.businessLicenseListTemp.splice(sum, 1)
|
||||||
|
if(file.status=='success'){
|
||||||
|
this.delBusinessFileIdList.push(file.url);
|
||||||
|
}
|
||||||
|
console.log('delBusinessFileIdList',this.delBusinessFileIdList)
|
||||||
},
|
},
|
||||||
|
|
||||||
isImage(file){
|
isImage(file){
|
||||||
|
|
@ -480,6 +487,8 @@ import { forEach } from 'jszip';
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset()
|
this.reset()
|
||||||
|
this.uploadKey = Date.now();
|
||||||
|
this.delBusinessFileIdList=[];
|
||||||
this.businessLicenseListTemp=[];
|
this.businessLicenseListTemp=[];
|
||||||
this.businessLicenseFileList=[];
|
this.businessLicenseFileList=[];
|
||||||
this.showHouse = true
|
this.showHouse = true
|
||||||
|
|
@ -488,19 +497,24 @@ import { forEach } from 'jszip';
|
||||||
|
|
||||||
handleUpdate(row){
|
handleUpdate(row){
|
||||||
this.reset()
|
this.reset()
|
||||||
|
this.uploadKey = Date.now();
|
||||||
|
this.delBusinessFileIdList=[];
|
||||||
this.businessLicenseListTemp=[];
|
this.businessLicenseListTemp=[];
|
||||||
this.businessLicenseFileList=[];
|
this.businessLicenseFileList=[];
|
||||||
const supplierId = row.supplierId
|
const supplierId = row.supplierId;
|
||||||
|
this.modelIdTemp = row.supplierId;
|
||||||
getFacturerDetail(supplierId).then((response) => {
|
getFacturerDetail(supplierId).then((response) => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
if(response.data.bmFileInfos!=null){
|
if(response.data.bmFileInfos!=null){
|
||||||
this.businessLicenseListTemp = response.data.bmFileInfos;
|
this.businessLicenseListTemp = response.data.bmFileInfos;
|
||||||
this.businessLicenseListTemp.forEach(item=>{
|
this.businessLicenseListTemp.forEach(item=>{
|
||||||
|
if(item.name.includes('/')){
|
||||||
const fileNameWithTimestamp = item.name.split('/').pop();
|
const fileNameWithTimestamp = item.name.split('/').pop();
|
||||||
const parts = fileNameWithTimestamp.split('_'); // 按下划线分割
|
const parts = fileNameWithTimestamp.split('_'); // 按下划线分割
|
||||||
const fileType = item.name.split('.').pop();
|
const fileType = item.name.split('.').pop();
|
||||||
const mainFileName = parts.slice(0, parts.length - 1).join('_');
|
const mainFileName = parts.slice(0, parts.length - 1).join('_');
|
||||||
item.name = mainFileName + '.' +fileType;
|
item.name = mainFileName + '.' +fileType;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
this.businessLicenseListTemp = [];
|
this.businessLicenseListTemp = [];
|
||||||
|
|
@ -531,8 +545,10 @@ import { forEach } from 'jszip';
|
||||||
if(this.businessLicenseListTemp.length!=0){
|
if(this.businessLicenseListTemp.length!=0){
|
||||||
await this.getImaUploadEdit(),
|
await this.getImaUploadEdit(),
|
||||||
await this.editFacturerTemp(this.form);
|
await this.editFacturerTemp(this.form);
|
||||||
|
await this.deleteFile();
|
||||||
}else{
|
}else{
|
||||||
await this.editFacturerTemp(this.form);
|
await this.editFacturerTemp(this.form);
|
||||||
|
await this.deleteFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -546,6 +562,8 @@ import { forEach } from 'jszip';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.uploadKey = Date.now();
|
||||||
},
|
},
|
||||||
|
|
||||||
async getImaUpload(){
|
async getImaUpload(){
|
||||||
|
|
@ -570,7 +588,7 @@ import { forEach } from 'jszip';
|
||||||
console.log('fileTwo',fileTwo)
|
console.log('fileTwo',fileTwo)
|
||||||
this.businessLicenseListTemp.forEach(item=>{
|
this.businessLicenseListTemp.forEach(item=>{
|
||||||
if(item.status=='success'){
|
if(item.status=='success'){
|
||||||
let objThree = { 'name': item.name, 'url': item.url,'modelId': null, 'dicId':4 };
|
let objThree = { 'name': item.name, 'url': item.url,'modelId': this.modelIdTemp, 'dicId':4 };
|
||||||
this.businessLicenseFileList.push(objThree);
|
this.businessLicenseFileList.push(objThree);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -578,7 +596,7 @@ import { forEach } from 'jszip';
|
||||||
let res = await imgUpLoadThree(fileTwo);
|
let res = await imgUpLoadThree(fileTwo);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
res.data.forEach(item=>{
|
res.data.forEach(item=>{
|
||||||
let objTwo = { 'name': item.name, 'url': item.url,'modelId': null, 'dicId':4 };
|
let objTwo = { 'name': item.name, 'url': item.url,'modelId': this.modelIdTemp, 'dicId':4 };
|
||||||
this.businessLicenseFileList.push(objTwo);
|
this.businessLicenseFileList.push(objTwo);
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -593,6 +611,7 @@ import { forEach } from 'jszip';
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.showHouse = false;
|
this.showHouse = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
|
this.delBusinessFileIdList=[];
|
||||||
this.businessLicenseListTemp=[];
|
this.businessLicenseListTemp=[];
|
||||||
this.businessLicenseFileList=[];
|
this.businessLicenseFileList=[];
|
||||||
|
|
||||||
|
|
@ -605,15 +624,29 @@ import { forEach } from 'jszip';
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.showHouse = false;
|
this.showHouse = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
|
this.delBusinessFileIdList=[];
|
||||||
this.businessLicenseListTemp=[];
|
this.businessLicenseListTemp=[];
|
||||||
this.businessLicenseFileList=[];
|
this.businessLicenseFileList=[];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async deleteFile(){
|
||||||
|
if(this.delBusinessFileIdList.length>0){
|
||||||
|
this.delBusinessFileIdList.forEach(item=>{
|
||||||
|
const objectKey = item;
|
||||||
|
console.log('objectKey',objectKey)
|
||||||
|
deleteFile(objectKey);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.showHouse = false;
|
this.showHouse = false;
|
||||||
|
this.delBusinessFileIdList=[];
|
||||||
|
this.businessLicenseListTemp=[];
|
||||||
this.businessLicenseFileList=[];
|
this.businessLicenseFileList=[];
|
||||||
|
this.uploadKey = Date.now();
|
||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue