生产产品企业资质页面修改

ywj_dev
郑明梁 2 years ago
parent d0419d144f
commit 3fafc6634c

@ -69,20 +69,20 @@
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="10" class="el-col">
<el-form-item label="企业名称:" label-width="150px" prop="companyName">
<el-form-item label="生产企业:" label-width="150px" prop="companyName">
<el-input
size="small"
placeholder="请输入企业名称"
placeholder="请输入生产企业"
v-model="inputQuery.companyName"
@input="change()"
></el-input>
</el-form-item>
</el-col>
<el-col :span="10" class="el-col">
<el-form-item label="统一社会信用代码:" label-width="150px" prop="creditCode">
<el-form-item label="社会信用号:" label-width="150px" prop="creditCode">
<el-input
size="small"
placeholder="请输入统一社会信用代码"
placeholder="请输入社会信用号"
v-model="inputQuery.creditCode"
@input="change()"
></el-input>
@ -92,12 +92,13 @@
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="10" class="el-col">
<el-form-item label="企业类型:" label-width="150px" prop="companyType">
<el-form-item label="境内境外企业:" label-width="150px" prop="companyType">
<el-select
size="small"
v-model="inputQuery.companyType"
placeholder="请选择企业类型"
placeholder="请选择境内境外企业"
style="width: 100%;"
@input="companyTypeChange()"
>
<el-option label="境内企业" value="1"></el-option>
<el-option label="境外企业" value="2"></el-option>
@ -172,6 +173,20 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="10" class="el-col">
<el-form-item label="代理商名称:" label-width="150px" prop="agentName">
<el-input
size="small"
placeholder="请输入代理商名称"
v-model="inputQuery.agentName"
:disabled="inputQuery.companyType==1"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="20" class="el-col">
<el-form-item label="备注:" label-width="150px" prop="remark">
@ -204,7 +219,9 @@
>
</div>
<el-table v-loading="certLoading" :data="certList" style="width: 100%;margin-top: 40px" border highlight-current-row>
<el-table v-loading="certLoading" :data="certList" style="width: 100%;margin-top: 40px" border
highlight-current-row
>
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column label="证书名称" prop="name"></el-table-column>
<el-table-column label="证书编号" prop="name"></el-table-column>
@ -229,7 +246,11 @@
<template slot-scope="scope">
<el-button type="text" size="small" @click.native="addCert(scope.row)">编辑</el-button>
<el-button type="text" size="mini" @click.native="showImgViewer(scope.row)">预览</el-button>
<el-button type="text" size="small" v-if="scope.row.auditStatus == 0 || scope.row.auditStatus == 2|| scope.row.auditStatus == 6" @click.native="deleteCompanyCert(scope.row)"></el-button>
<el-button type="text" size="small"
v-if="scope.row.auditStatus == 0 || scope.row.auditStatus == 2|| scope.row.auditStatus == 6"
@click.native="deleteCompanyCert(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -254,7 +275,7 @@
width="70%"
v-if="addCertVisible"
append-to-body
@close='closeLocalDialog'
@close="closeLocalDialog"
>
<companyAddCert
:closeDialog="closeLocalDialog"
@ -271,7 +292,7 @@
width="70%"
v-if="selectCertVisible"
append-to-body
@close='closeLocalDialog'
@close="closeLocalDialog"
>
<supCertSetSelectDialog
:certType="certType"
@ -285,35 +306,41 @@
</template>
<script>
import {getCompanyInfo, addOrModifyCompany} from "../../../api/purchase/supManufacturer";
import {provinceAndCityData, regionData, provinceAndCityDataPlus, regionDataPlus, CodeToText, TextToCode,} from "element-china-area-data";
import {filterCompanyCert, deleteCompanyCert, updateCompanyCert} from "../../../api/purchase/companyCert";
import companyAddCert from "@/views/purchase/cert/supCertAddDialog";
import draggable from "vuedraggable";
import { getCompanyInfo, addOrModifyCompany } from '../../../api/purchase/supManufacturer'
import {
provinceAndCityData,
regionData,
provinceAndCityDataPlus,
regionDataPlus,
CodeToText,
TextToCode
} from 'element-china-area-data'
import { filterCompanyCert, deleteCompanyCert, updateCompanyCert } from '../../../api/purchase/companyCert'
import companyAddCert from '@/views/purchase/cert/supCertAddDialog'
import draggable from 'vuedraggable'
import { getSupComapnys, previewImage } from '@/api/purchase/supCompany'
import {getUUID} from "@/utils/strUtil";
import supCertSetSelectDialog from "@/views/purchase/cert/supCertSetSelectDialog";
import ElImageViewer from "element-ui/packages/image/src/image-viewer"
import { getUUID } from '@/utils/strUtil'
import supCertSetSelectDialog from '@/views/purchase/cert/supCertSetSelectDialog'
import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
export default {
name: "supManufacturerEdit",
name: 'supManufacturerEdit',
props: {
addCloseDialog: {
type: Function,
required: true,
required: true
},
inputQuery: {
type: Object,
required: true,
required: true
},
editType: {
type: Object,
required: true,
required: true
},
fromType: {
type: Object,
required: true,
required: true
}
},
data() {
@ -331,86 +358,86 @@ export default {
customerId: [
{
required: true,
message: "请选择所属供应商",
trigger: "blur"
message: '请选择所属供应商',
trigger: 'blur'
}
],
companyName: [
{
required: true,
message: "请输入企业名称",
trigger: "blur"
message: '请输入企业名称',
trigger: 'blur'
}
],
creditCode: [
{
required: true,
message: "请输入统一社会信用代码",
trigger: "blur"
message: '请输入统一社会信用代码',
trigger: 'blur'
}
],
companyType: [
{
required: true,
message: "请选择企业类型",
trigger: "change"
message: '请选择企业类型',
trigger: 'change'
}
],
registerStatus: [
{
required: true,
message: "请选择登记状态",
trigger: "change"
message: '请选择登记状态',
trigger: 'change'
}
],
placeArea: [
{
required: true,
message: "请选择所在地区",
trigger: "change"
message: '请选择所在地区',
trigger: 'change'
}
],
placeAddress: [
{
required: true,
message: "请输入所在地址",
trigger: "change"
message: '请输入所在地址',
trigger: 'change'
}
],
legalPersonName: [
{
required: true,
message: "请输入法人姓名",
trigger: "change"
message: '请输入法人姓名',
trigger: 'change'
}
],
legalPersonPapersType: [
{
required: true,
message: "请选择法人证件类型",
trigger: "change"
message: '请选择法人证件类型',
trigger: 'change'
}
],
legalPersonPapersCode: [
{
required: true,
message: "请输入法人证件号码",
trigger: "change"
message: '请输入法人证件号码',
trigger: 'change'
}
],
]
},
uploadUrl: "",
uploadUrl: '',
fileList: [],
fileUrl: "",
certFileUrl: "",
fileUrl: '',
certFileUrl: '',
url: 'http://127.0.0.1:9996/udiwms/image/register/file/getImage?type=image1&name=t11111.jpg',
certQuery: {
customerId: null,
manufacturerIdFk: null,
page: 1,
limit: 20,
type: 2,
type: 2
},
certList: [],
certTotal: 0,
@ -418,52 +445,52 @@ export default {
addCertVisible: false,
fromOptions: [],
idQuery: {
id: "",
id: ''
},
addType: "2", //1:2.3.
addType: '2', //1:2.3.
checkFlag: {
0: "草稿",
1: "已通过",
2: "已拒绝",
3: "变更未审核",
6: "未审核",
0: '草稿',
1: '已通过',
2: '已拒绝',
3: '变更未审核',
6: '未审核'
},
statusFlag: {
0: "有效",
1: "失效",
0: '有效',
1: '失效'
},
editTye: 1,
formName: 1,
formMap: {
1: "新增生产企业资质证书",
2: "编辑生产企业资质证书",
1: '新增生产企业资质证书',
2: '编辑生产企业资质证书'
},
manufacturerId: null,
customerId: null,
selectCertVisible: false,
certType: 2,
};
certType: 2
}
},
created() {
if (this.editType == 0) {
this.inputQuery.manufacturerId = getUUID("")
this.inputQuery.manufacturerId = getUUID('')
} else {
this.certQuery.customerId = this.inputQuery.customerId;
this.selectedOptions = this.inputQuery.placeAreaCode.split(",");
if(this.inputQuery.productionAreaCode!="" && this.inputQuery.productionAreaCode!=null && this.inputQuery.productionAreaCode!=undefined){
this.selectedOptions2 = this.inputQuery.productionAreaCode.split(",");
this.certQuery.customerId = this.inputQuery.customerId
this.selectedOptions = this.inputQuery.placeAreaCode.split(',')
if (this.inputQuery.productionAreaCode != '' && this.inputQuery.productionAreaCode != null && this.inputQuery.productionAreaCode != undefined) {
this.selectedOptions2 = this.inputQuery.productionAreaCode.split(',')
}
}
this.certQuery.manufacturerIdFk = this.inputQuery.manufacturerId;
this.certQuery.manufacturerIdFk = this.inputQuery.manufacturerId
this.manufacturerId = this.inputQuery.manufacturerId
this.customerId = this.inputQuery.customerId;
this.customerId = this.inputQuery.customerId
// this.getData();
this.getCompanyCertList();
this.findMethod();
this.uploadUrl = this.BASE_URL + "/udiwms/upload/register/file";
this.fileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name=";
this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name=";
this.getCompanyCertList()
this.findMethod()
this.uploadUrl = this.BASE_URL + '/udiwms/upload/register/file'
this.fileUrl = this.BASE_URL + '/udiwms/image/register/file/getImage?type=image2&name='
this.certFileUrl = this.BASE_URL + '/udiwms/image/register/file/getImage?type=image2&name='
},
components: {
draggable,
@ -472,238 +499,244 @@ export default {
methods: {
onModifySubmit(type) {
this.addOrModifyCompany(type);
this.addOrModifyCompany(type)
},
addOrModifyCompany(type) {
this.$refs["inputQuery"].validate(valid => {
this.$refs['inputQuery'].validate(valid => {
if (valid) {
let formData = JSON.parse(JSON.stringify(this.inputQuery));
formData.auditStatus = type;
this.loading = true;
let urlName = this.editType == 0 ? 'add' : 'update';
let formData = JSON.parse(JSON.stringify(this.inputQuery))
formData.auditStatus = type
this.loading = true
let urlName = this.editType == 0 ? 'add' : 'update'
addOrModifyCompany(formData, urlName).then(response => {
this.loading = false;
this.loading = false
if (response.code === 20000) {
this.addCloseDialog(true);
this.$message.success("保存成功");
this.addCloseDialog(true)
this.$message.success('保存成功')
} else {
this.$message.error(response.message);
this.$message.error(response.message)
}
});
})
} else {
console.log("error submit!!");
return false;
console.log('error submit!!')
return false
}
});
})
},
certHandleCurrentChange(val) {
this.certQuery.page = val.page;
this.getCompanyCertList();
this.certQuery.page = val.page
this.getCompanyCertList()
},
companyTypeChange(val) {
if (this.inputQuery.companyType == 1) {
this.inputQuery.agentName = ''
}
},
getCompanyCertList() {
this.certLoading = true;
this.certLoading = true
filterCompanyCert(this.certQuery)
.then((response) => {
this.certLoading = false;
this.certList = response.data.list || [];
this.certLoading = false
this.certList = response.data.list || []
this.certTotal = response.data.total
})
.catch(() => {
this.certLoading = false;
this.certList = [];
});
this.certLoading = false
this.certList = []
})
},
addCert(row) {
if (this.$isNotBlank(row)) {
this.formName = 2
this.inputQuery.formData = row;
this.editTye = 2;
this.inputQuery.formData = row
this.editTye = 2
} else {
this.formName = 1;
this.inputQuery.formData = {};
this.editTye = 1;
this.formName = 1
this.inputQuery.formData = {}
this.editTye = 1
}
this.addCertVisible = true;
this.addCertVisible = true
},
selectCert() {
this.customerId = this.inputQuery.customerId;
this.selectCertVisible = true;
this.customerId = this.inputQuery.customerId
this.selectCertVisible = true
},
toViewCompanyCert(row) {
window.open(this.certFileUrl + row.filePath);
window.open(this.certFileUrl + row.filePath)
},
deleteCompanyCert(row) {
this.$confirm("是否删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
this.$confirm('是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.certLoading = true;
this.certLoading = true
let tquery = {
id: row.id,
filePath: row.filePath,
};
filePath: row.filePath
}
deleteCompanyCert(tquery)
.then((response) => {
this.certLoading = false;
this.certLoading = false
if (response.code === 20000) {
this.getCompanyCertList();
this.getCompanyCertList()
this.$message({
type: "success",
message: "删除成功!",
});
type: 'success',
message: '删除成功!'
})
} else {
this.$message.error(response.message);
this.$message.error(response.message)
}
})
.catch(() => {
this.certLoading = false;
});
this.certLoading = false
})
}).catch(() => {
});
})
},
isAssetTypeAnImage(ext) {
return [
'png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].
indexOf(ext.toLowerCase()) !== -1;
'png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].indexOf(ext.toLowerCase()) !== -1
},
showImgViewer(row) {
this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name=";
this.imgList=[];
this.certFileUrl = this.BASE_URL + '/udiwms/image/register/file/getImage?type=image2&name='
this.imgList = []
previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => {
if (response.code === 20000) {
this.imgList=response.data;
this.imgList = response.data
}
});
this.imgViewerVisible = true;
const m = (e) => { e.preventDefault() };
document.body.style.overflow = 'hidden';
document.addEventListener("touchmove", m, false); //
})
this.imgViewerVisible = true
const m = (e) => {
e.preventDefault()
}
document.body.style.overflow = 'hidden'
document.addEventListener('touchmove', m, false) //
},
closeImgViewer() {
this.imgViewerVisible = false;
const m = (e) => { e.preventDefault() };
document.body.style.overflow = 'auto';
document.removeEventListener("touchmove", m, true);
this.imgViewerVisible = false
const m = (e) => {
e.preventDefault()
}
document.body.style.overflow = 'auto'
document.removeEventListener('touchmove', m, true)
},
disableCert(row, status) {
row.status = status;
row.status = status
updateCompanyCert(row).then(response => {
this.loading = false;
this.loading = false
if (response.code === 20000) {
this.$message.success("更新成功!");
this.getCompanyCertList();
this.$message.success('更新成功!')
this.getCompanyCertList()
} else {
this.$message.error(response.message);
this.$message.error(response.message)
}
});
})
},
closeLocalDialog() {
this.addCertVisible = false;
this.selectCertVisible = false;
this.getCompanyCertList();
this.addCertVisible = false
this.selectCertVisible = false
this.getCompanyCertList()
},
findMethod(query) {
this.fromOptions = [];
this.fromOptions = []
let cQuery = {
companyName: query,
};
companyName: query
}
getSupComapnys(cQuery)
.then((response) => {
this.loading = false;
this.fromOptions = response.data.list || [];
this.loading = false
this.fromOptions = response.data.list || []
})
.catch(() => {
this.loading = false;
});
this.loading = false
})
}
,
unitChange(val) {
this.certQuery.customerId = val;
this.certQuery.customerId = val
},
handleChange(value) {
this.inputQuery.placeArea =
CodeToText[value[0]] + CodeToText[value[1]] + CodeToText[value[2]];
CodeToText[value[0]] + CodeToText[value[1]] + CodeToText[value[2]]
console.log(this.inputQuery.placeArea)
this.inputQuery.placeAreaCode = value.toString();
this.inputQuery.placeAreaCode = value.toString()
},
handleChange2(value) {
this.inputQuery.productionArea =
CodeToText[value[0]] + CodeToText[value[1]] + CodeToText[value[2]];
this.inputQuery.productionAreaCode = value.toString();
CodeToText[value[0]] + CodeToText[value[1]] + CodeToText[value[2]]
this.inputQuery.productionAreaCode = value.toString()
},
uploadHandleRemove(file, fileList) {
console.log(file, fileList);
console.log(file, fileList)
},
uploadHandlePreview(file) {
console.log(file);
console.log(this.fileList);
console.log(file)
console.log(this.fileList)
},
uploadHandleExceed(files, fileList) {
this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
},
uploadOnchange(file, fileList) {
let fileName = file.name;
let fileName = file.name
let uid = file.uid
let pos = fileName.lastIndexOf(".");
let lastName = fileName.substring(pos, fileName.length);
if (lastName.toLowerCase() !== ".jpg" && lastName.toLowerCase() !== ".png") {
this.$message.error("上传文件只能是 .jpg,.png 格式");
let pos = fileName.lastIndexOf('.')
let lastName = fileName.substring(pos, fileName.length)
if (lastName.toLowerCase() !== '.jpg' && lastName.toLowerCase() !== '.png') {
this.$message.error('上传文件只能是 .jpg,.png 格式')
for (let i = 0; i < fileList.length; i++) {//list
if (fileList[i].uid === uid) {
fileList.splice(i, 1)
}
}
return;
return
}
//
const isLt = file.size / 1024 / 1024 / 30 <= 1;
const isLt = file.size / 1024 / 1024 / 30 <= 1
if (!isLt) {
this.$message.error("上传文件大小不能超过 30MB");
this.$message.error('上传文件大小不能超过 30MB')
for (let i = 0; i < fileList.length; i++) {
if (fileList[i].uid === uid) {
fileList.splice(i, 1)
}
}
}
return isLt;
return isLt
},
uploadHandleSuccess(response, file, fileList) {
console.log(response)
if (response.code === 20000) {
this.inputQuery.newFilePath = response.data.name;
this.onModifySubmit('inputQuery');
this.inputQuery.newFilePath = response.data.name
this.onModifySubmit('inputQuery')
} else {
this.$message.error("文件上传失败:" + response.message);
this.$message.error('文件上传失败:' + response.message)
}
},
uploadHandleError() {
},
}
},
filters: {
statusFilterType(status) {
const statusMap = {
0: "warning",
1: "success",
2: "danger",
6: "warning",
};
return statusMap[status];
},
},
};
0: 'warning',
1: 'success',
2: 'danger',
6: 'warning'
}
return statusMap[status]
}
}
}
</script>
<style>
.itemTag {

Loading…
Cancel
Save