附件:真假上传
新增的时候,上传存在前端一个list里面;删除是真删除,直接删除
编辑的时候,删除是假删除,把删除的数据id存在一个list里
<template>
<div class="app-add">
<el-form
:model="ruleForm"
:label-position="labelPosition"
:rules="rules"
ref="ruleForm"
label-width="240px"
autocomplete='off'>
<el-form-item label="采购包或标段编号" prop="biddingId">
<el-input v-model.trim="ruleForm.biddingId" placeholder="请输入采购包或标段编号" class="input-text" maxlength="255"/>
</el-form-item>
<el-form-item label="采购包或标段名称" prop="biddingName">
<el-input v-model.trim="ruleForm.biddingName" placeholder="请输入采购包或标段名称" class="input-text" maxlength="255"/>
</el-form-item>
<el-form-item label="采购人名称" prop="purchaseName">
<el-input v-model="ruleForm.purchaseName" placeholder="请输入采购人名称" class="input-text" maxlength="255"/>
</el-form-item>
<el-form-item label="采购人代码" prop="purchaseCode">
<el-input v-model="ruleForm.purchaseCode" placeholder="请输入采购人代码" class="input-text" maxlength="255"/>
</el-form-item>
<el-form-item label="采购人所属的一级中央企业" prop="purchaseParentOrgCode">
<el-input v-model="ruleForm.purchaseParentOrgCode" placeholder="请输入采购人代码所属的一级中央企业" class="input-text"
maxlength="255" disabled/>
</el-form-item>
<el-form-item label="采购人所属主要行业" required>
<el-row :gutter="10">
<el-col :span="9">
<el-form-item prop="firstcode">
<el-select
v-model="ruleForm.firstcode"
placeholder="请选择"
class="select-text"
@change="getType"
style="width:100%"
>
<el-option
v-for="item in industryCodeOption"
:key="item.firstcode"
:label="item.firstname"
:value="item.firstcode"
/>
</el-select>
</el-form-item>
</el-col>
<el-col class="line" :span="3"></el-col>
<el-col :span="9">
<el-form-item prop="secondcode">
<el-select
v-model="ruleForm.secondcode"
placeholder="请选择"
class="select-text"
style="width:100%"
value-key="item"
>
<el-option
v-for="item in industrySecondOption"
:key="item.secondcode"
:label="item.secondname"
:value="item.secondcode"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="采购组织形式" prop="purchaseForm">
<el-radio-group v-model="ruleForm.purchaseForm">
<el-radio :label="1">自主采购</el-radio>
<el-radio :label="2">委托采购</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="采购方式" prop="purchaseType">
<el-radio-group v-model="ruleForm.purchaseType">
<el-radio :label="1">公开招标</el-radio>
<el-radio :label="2">邀请招标</el-radio>
<el-radio :label="3">竞争性谈判</el-radio>
<el-radio :label="4">单一来源采购</el-radio>
<el-radio :label="5">询价采购</el-radio>
<el-radio :label="6">其他</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
prop="singleSourcePurchaserType"
v-if="ruleForm.purchaseType === 4"
:rules="ruleForm.purchaseType === 4 ?
[{ required: true, message: '请选择单一来源采购属性', trigger: 'blur' }]:
[{required: false}]">
<span slot="label">单一来源采购属性
<el-tooltip placement="top">
<div slot="content">采购方式选择“单一来源采购”时,本字段为必填项。</div>
<i class="el-icon-warning" style="color: #0e1B50;"></i>
</el-tooltip>
</span>
<el-radio-group v-model="ruleForm.singleSourcePurchaserType">
<el-radio :label="'1'" @click.native.prevent="singleSourceClick('1')">一般单一来源</el-radio>
<el-radio :label="'2'" @click.native.prevent="singleSourceClick('2')">框架协议执行</el-radio>
<el-radio :label="'3'" @click.native.prevent="singleSourceClick('3')">统谈分签执行</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="采购平台" prop="purchasePlatform">
<span slot="label">采购平台
<el-tooltip placement="top">
<div slot="content">如在采购平台采购则填平台全称,如没有在采购平台采购则填无</div>
<i class="el-icon-warning" style="color: #0e1B50;"></i>
</el-tooltip>
</span>
<el-input v-model.trim="ruleForm.purchasePlatform" placeholder="请输入采购平台" class="input-text" maxlength="255"/>
</el-form-item>
<el-form-item label="预算类型" prop="fundType">
<el-radio-group v-model="ruleForm.fundType" @change="clearFundScale">
<el-radio :label="1">有采购包或标段预算</el-radio>
<el-radio :label="2">仅有整体项目预算</el-radio>
<el-radio :label="3">有预估采购规模(标段预计金额)</el-radio>
<el-radio :label="4">无预算</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label="采购包或标段预算/规模"
prop="fundScale"
:rules="ruleForm.fundType === 1 ?
[{ required: true, message: '请输入采购包或标段预算金额', trigger: 'blur' },
{ pattern: /(^[\-0-9][0-9]*(.[0-9]+)?)$/, message: '请正确输入采购包或标段预算金额', trigger: 'blur' },
{ pattern: /^[0-9]+(.?[0-9]{1,2})?$/, message: '最多填写两位小数', trigger: 'blur' }]:
[{ required: true, message: '请输入采购包或标段估算规模金额', trigger: 'blur' },
{ pattern: /(^[\-0-9][0-9]*(.[0-9]+)?)$/, message: '请正确输入采购包或标段估算规模金额', trigger: 'blur' },
{ pattern: /^[0-9]+(.?[0-9]{1,2})?$/, message: '最多填写两位小数', trigger: 'blur' }]">
<span slot="label">采购包或标段预算/规模
<el-tooltip placement="top">
<div slot="content">填写对应预算类型的采购包或标段预算/规模金额(单位:元),外币转化成人民币。当预算类型选择“有采购包或标段预算”时,填写采购包或标段预算金额;
<br/>当预算类型选择“仅有整体项目预算、有预估采购规模(标段预计金额)、无预算”时,填写采购包或标段估算规模金额。</div>
<i class="el-icon-warning" style="color: #0e1B50;"></i>
</el-tooltip>
</span>
<el-input v-model.trim="ruleForm.fundScale" placeholder="请输入采购包或标段预算/规模" class="input-text-short" maxlength="15"/>
<span>元</span>
</el-form-item>
<el-form-item label="评标/评价方法" prop="evaluationType">
<el-radio-group v-model="ruleForm.evaluationType" @change="changeData">
<el-radio :label="1">综合评分法</el-radio>
<el-radio :label="2">最低评标价法</el-radio>
<el-radio :label="3">其他</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label="技术权重"
prop="technicalWeight"
v-if="ruleForm.purchaseType === 1 || ruleForm.purchaseType === 2"
:rules="ruleForm.purchaseType === 1 || ruleForm.purchaseType === 2 ?
[{ required: true, message: '请输入技术权重', trigger: 'blur' },
{ pattern: /(^[\-0-9][0-9]*(.[0-9]+)?)$/, message: '请正确输入技术权重', trigger: 'blur'},
{ pattern:/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/, message: '最多填写两位小数',trigger: 'blur' }]:
[{required: false},
{ pattern: /(^[\-0-9][0-9]*(.[0-9]+)?)$/, message: '请正确输入技术权重', trigger: 'blur'},
{ pattern:/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/, message: '最多填写两位小数',trigger: 'blur' }]">
<span slot="label">技术权重
<el-tooltip placement="top">
<div slot="content">【 】%,小数点后最多保留2位,采购方式选择“公开招标“或”邀请招标“时必填。<br/>技术权重与商务权重相加等于100。</div>
<i class="el-icon-warning" style="color: #0e1B50;"></i>
</el-tooltip>
</span>
<el-input
v-model.trim="ruleForm.technicalWeight"
placeholder="请输入技术权重"
class="input-text-short"
maxlength="255"
/>
<span>%</span>
</el-form-item>
<el-form-item
label="商务权重"
prop="businessWeight"
v-if="ruleForm.purchaseType === 1 || ruleForm.purchaseType === 2"
:rules="ruleForm.purchaseType === 1 || ruleForm.purchaseType === 2 ?
[{ required: true, message: '请输入商务权重', trigger: 'blur' },
{ pattern: /(^[\-0-9][0-9]*(.[0-9]+)?)$/, message: '请正确输入商务权重', trigger: 'blur'},
{ pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/, message: '最多填写两位小数',trigger: 'blur' }]:
[{required: false},
{ pattern: /(^[\-0-9][0-9]*(.[0-9]+)?)$/, message: '请正确输入技术权重', trigger: 'blur'},
{ pattern:/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/, message: '最多填写两位小数',trigger: 'blur' }]">
<span slot="label">商务权重
<el-tooltip placement="top">
<div slot="content">【 】%,小数点后最多保留2位,采购方式选择“公开招标“、”邀请招标“时必填。商务权重包含价格权重,
<br/>技术权重与商务权重相加等于100。</div>
<i class="el-icon-warning" style="color: #0e1B50;"></i>
</el-tooltip>
</span>
<el-input
v-model.trim="ruleForm.businessWeight"
placeholder="请输入商务权重"
class="input-text-short"
maxlength="255"
/>
<span>%</span>
</el-form-item>
<el-form-item
label="发标日期"
prop="biddingDate"
v-if="ruleForm.purchaseType === 1 || ruleForm.purchaseType === 2 || ruleForm.purchaseType === 3 || ruleForm.purchaseType === 5"
:rules="ruleForm.purchaseType === 1 || ruleForm.purchaseType === 2 || ruleForm.purchaseType === 3 || ruleForm.purchaseType === 5?
[{ required: true, message: '请选择公开招标公告、邀请招标公告、竞争性谈判公告、询价采购公告的发布日期', trigger: 'blur' }]:
[{required: false}]">
<span slot="label">发标日期
<el-tooltip placement="top">
<div slot="content">当采购方式为公开招标、邀请招标、竞争性谈判、询
<br/>价采购时,本字段必填。填写公开招标公告、邀请招
<br/>标公告、竞争性谈判公告、询价采购公告的发布日期。</div>
<i class="el-icon-warning" style="color: #0e1B50;"></i>
</el-tooltip>
</span>
<el-date-picker
v-model="ruleForm.biddingDate"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
</el-form-item>
<el-form-item
label="开标日期"
prop="bidOpeningDate"
v-if="ruleForm.purchaseType === 1 || ruleForm.purchaseType === 2 || ruleForm.purchaseType === 3 || ruleForm.purchaseType === 5"
:rules="ruleForm.purchaseType === 1 || ruleForm.purchaseType === 2 || ruleForm.purchaseType === 3 || ruleForm.purchaseType === 5?
[{ required: true, message: '请选择招标公告、邀请招标公告中确定的开标日期、竞争性谈判公告确定的谈判日期和询价采购公告中确定的报价截止日期。如因特殊原因存在多次开标,则选择最后一次开标日期', trigger: 'blur' }]:
[{required: false}]">
<span slot="label">开标日期
<el-tooltip placement="top">
<div slot="content">当采购方式为公开招标、邀请招标、竞争性谈判、询
<br/>价采购时,本字段必填。填写招标公告、邀请招标公
<br/>告中确定的开标日期、竞争性谈判公告确定的谈判日
<br />期和询价采购公告中确定的报价截止日期。如因特殊
<br />原因存在多次开标,则填写最后一次开标日期。</div>
<i class="el-icon-warning" style="color: #0e1B50;"></i>
</el-tooltip>
</span>
<el-date-picker
v-model="ruleForm.bidOpeningDate"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="标段异常状态" prop="biddingState">
<span slot="label">标段异常状态
<el-tooltip placement="top">
<div slot="content">当填报标段存在暂停、流标等情况时必填。</div>
<i class="el-icon-warning" style="color: #0e1B50;"></i>
</el-tooltip>
</span>
<el-radio-group v-model="ruleForm.biddingState" @change="changeData">
<el-radio :label="1" @click.native.prevent="biddingStateClick(1)">暂停(暂时停止,后续有可能继续)</el-radio>
<el-radio :label="2" @click.native.prevent="biddingStateClick(2)">流标(本标段招标终止;如项目继续,重新招标时重新编号)</el-radio>
<el-radio :label="3" @click.native.prevent="biddingStateClick(3)">废标</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label="招标文件"
prop="invitationBiddingDocument"
ref="upload-file"
v-if="!oldDataFlag"
:rules="ruleForm.purchaseType === 1 || ruleForm.noFileType === '0'?
[{ required: true, message: '请选择招标文件', trigger: 'blur' }]:
[{required: false}]">
<span>
非公开发布的线下直签、现货采购、商城采购等少数类产品特性形成的线下直接签署合同的项目可不上传附件,
系统将自动在采购包或标段编号前增加非招标采购标识。否则招标文件附件必填。
</span>
<el-form-item label="是否线下直签、现货采购、商城采购" prop="noFileType">
<el-radio-group v-model="ruleForm.noFileType">
<el-radio :label="'0'" @click.native.prevent="isLineClick('0')">否</el-radio>
<el-radio :label="'1'" @click.native.prevent="isLineClick('1')">是</el-radio>
</el-radio-group>
</el-form-item>
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
multiple
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:auto-upload="false"
:on-change="handleStatus"
:on-exceed="handleExceed"
:show-file-list="false"
:http-request="uploadFile"
accept=".pdf,.doc,.ofd,.docx,.xls,.xlsx,.et,.wps"
:file-list="fileList">
<el-button size="small" type="primary">+点击上传</el-button>
<div slot="tip" class="el-upload__tip"><i>*</i>支持上传招标文件,支持pdf、ofd、doc、docx、xls、xlsx、et、wps格式文件</div>
</el-upload>
<el-table :data="attachments" border style="width: 750px">
<el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
<el-table-column prop="name" label="附件名称" align="center" width="400"></el-table-column>
<el-table-column label="进度" align="center">
<template slot-scope="scope">
<el-progress :percentage="scope.row.percentage"></el-progress>
</template>
</el-table-column>
<el-table-column label="操作" width="130" align="center">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handlePreview(scope.row,2)" v-if="scope.row.name && scope.row.name.substring(scope.row.name.length-3) == 'pdf'">查看</el-button>
<el-button type="text" size="small" @click="handlePreview(scope.row,1)" v-if="scope.row.id">下载</el-button>
<el-button type="text" size="small" @click="handleDel(scope.row,scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item
label="招标文件"
prop="invitationBiddingDocument"
ref="upload-file"
v-else>
<span>
非公开发布的线下直签、现货采购、商城采购等少数类产品特性形成的线下直接签署合同的项目可不上传附件,
系统将自动在采购包或标段编号前增加非招标采购标识。否则招标文件附件必填。
</span>
<el-form-item label="是否线下直签、现货采购、商城采购" prop="noFileType">
<el-radio-group v-model="ruleForm.noFileType">
<el-radio :label="'0'" @click.native.prevent="isLineClick('0')">否</el-radio>
<el-radio :label="'1'" @click.native.prevent="isLineClick('1')">是</el-radio>
</el-radio-group>
</el-form-item>
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
multiple
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:auto-upload="false"
:on-change="handleStatus"
:on-exceed="handleExceed"
:show-file-list="false"
:http-request="uploadFile"
accept=".pdf,.doc,.ofd,.docx,.xls,.xlsx,.et,.wps"
:file-list="fileList">
<el-button size="small" type="primary">+点击上传</el-button>
<div slot="tip" class="el-upload__tip"><i>*</i>支持上传招标文件,支持pdf、ofd、doc、docx、xls、xlsx、et、wps格式文件</div>
</el-upload>
<el-table :data="attachments" border style="width: 750px">
<el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
<el-table-column prop="name" label="附件名称" align="center" width="400"></el-table-column>
<el-table-column label="进度" align="center">
<template slot-scope="scope">
<el-progress :percentage="scope.row.percentage"></el-progress>
</template>
</el-table-column>
<el-table-column label="操作" width="130" align="center">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handlePreview(scope.row,2)" v-if="scope.row.name && scope.row.name.substring(scope.row.name.length-3) == 'pdf'">查看</el-button>
<el-button type="text" size="small" @click="handlePreview(scope.row,1)" v-if="scope.row.id">下载</el-button>
<el-button type="text" size="small" @click="handleDel(scope.row,scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item class="detail-btn">
<el-button @click="resetForm('ruleForm')" class="cancelBtn">取消</el-button>
<el-button @click="submitForm('ruleForm')" class="holdBtn">保存</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import "@/assets/styles/tpoms.scss"
import { addData, getDetail, getType, getSecondType, getSelectData, getCompanyInfo } from "@/api/purchase";
import request from '@/utils/request';
import { supplierFile } from "@/api/purchase/index";
export default {
name: "PurchaseAdd",
data() {
// var check = (rule, value, callback) => {
// if (this.attachments.length > 0 && (this.ruleForm.purchaseType !== 1 || this.ruleForm.noFileType !== 0)) {
// callback();
// }else{
// return callback(new Error('请选择上传招标文件'));
// }
// };
return {
id: '',
ruleForm: {
biddingId: "",
biddingName: "",
purchaseName: "",
purchaseCode: "",
purchaseParentOrgCode: "中国中化控股有限责任公司",
industryCode: "",
purchaseForm: 1,
purchaseType: 1,
purchasePlatform: "",
fundScale: "",
evaluationType: 1,
technicalWeight: "",
businessWeight: "",
industryName: "",
firstcode: "",
secondcode: "",
fundType: 1, // 预算类型
singleSourcePurchaserType: '',
biddingDate: '',
bidOpeningDate: '',
biddingState: '',
invitationBiddingDocument: [],
documentDeleteIds: [],
noFileType: ''
},
// 表单校验
rules: {
biddingId: [
{ required: true, message: '请输入采购包或标段编号', trigger: 'blur' }
],
biddingName: [
{ required: true, message: '请输入采购包或标段名称', trigger: 'blur' }
],
purchaseName: [
{ required: true, message: '请输入采购人名称', trigger: 'blur' }
],
purchaseCode: [
{ required: true, message: '请输入采购人代码', trigger: 'blur' }
],
purchaseParentOrgCode: [
{ required: true, message: '请输入采购人代码所属的一级中央企业', trigger: 'blur' }
],
firstcode: [
{ required: true, message: '请选择采购人所属主要行业', trigger: 'change' }
],
secondcode: [
{ required: true, message: '请选择采购人所属主要行业', trigger: 'change' }
],
purchaseForm: [
{ required: true, message: '请选择采购组织形式', trigger: 'blur' }
],
purchaseType: [
{ required: true, message: '请选择采购方式', trigger: 'blur' }
],
purchasePlatform: [
{ required: true, message: "请输入采购平台,如在采购平台采购则填平台全称,如没有在采购平台采购则填无", trigger: "blur" }
],
// fundScale: [
// { required: true, message: "请输入采购包或标段预算/规模", trigger: "blur" },
// { pattern: /(^[\-0-9][0-9]*(.[0-9]+)?)$/, message: "请正确输入采购包或标段预算/规模", trigger: "blur" },
// { pattern: /^[0-9]+(.?[0-9]{1,2})?$/, message: "最多填写两位小数", trigger: "blur" }
// ],
evaluationType: [
{ required: true, message: '请选择评标/评价方法', trigger: 'blur' }
],
fundType: [
{ required: true, message: '请选择预算类型', trigger: 'blur' }
],
// invitationBiddingDocument:[
// { required: true,validator: check, trigger: 'blur' }
// ],
},
labelPosition: 'right',
industryCodeOption: [], // 一级
industrySecondOption: [], // 二级
// 查询参数
queryParams: {
pageNo: 1,
pageNum: 1,
pageSize: 10,
type: 3
},
obj: {},
isChange: false,
// 上传 文件列表
fileList: [],
// 验证 文件 列表
attachments:[],
documentDeleteIds: [],
news: '',
queryParamsEdit: {},
oldDataFlag: false
};
},
watch: {
ruleForm: {
handler: function(nowVal, oldVal) {
for (let key in this.ruleForm) {
if (nowVal[key] != this.obj[key]) {
this.isChange = false
break
} else {
this.isChange = true
}
}
},
deep: true
},
},
created() {
this.id = this.$route.query.id;
this.news = this.$route.query.news;
if(this.news){
this.queryParamsEdit.tableType = this.$route.query.tableType;
}else{
this.queryParamsEdit = JSON.parse(sessionStorage.getItem('Purchase_QUERY_PARAMS'));
}
this.getType();
if (this.id) {
this.getDetail(this.id,this.queryParamsEdit.tableType);
}else{
this.loading = true
getCompanyInfo().then((response) => {
this.ruleForm.purchaseName = response.name;
this.ruleForm.purchaseCode = response.scode;
this.loading = false;
})
this.getSelectData();
}
},
methods: {
/** 详情 */
getDetail(id,tableType) {
this.loading = true
let detail = new Promise((resolve, reject) => {
getDetail(id,tableType).then((response) => {
for(let i = 0; i < response.data.documents.length;i++){
this.attachments = response.data.documents;
//有附件的情况可以让后台返回一下这个字段
this.attachments[i].percentage = 100;
this.attachments[i].name = response.data.documents[i].docname;
}
resolve(response.data)
this.loading = false
})
})
let _this = this
detail.then((function(data) {
_this.ruleForm = data;
_this.oldDataFlag = data.oldDataFlag;
_this.ruleForm.invitationBiddingDocument = _this.attachments;
_this.ruleForm.firstcode = data.firstcode;
_this.ruleForm.purchaseParentOrgCode = "中国中化控股有限责任公司";
let secondcode = data.secondcode;
if (data.technicalWeight == null) {
_this.ruleForm.technicalWeight === '';
}
if (data.businessWeight == null) {
_this.ruleForm.businessWeight === '';
}
let pageSize = 0;
let pageNum = 0;
let secondData = {
firstcode: data.firstcode
}
/** 采购人代码所属主要行业*/
getSecondType(pageSize, pageNum, secondData).then(response => {
_this.industrySecondOption = response.data.list;
for (let i = 0; i < response.data.list.length; i++) {
if (secondcode == response.data.list[i].secondcode) {
_this.ruleForm.secondcode = secondcode
}
}
_this.loading = false
}).catch(res => {
_this.loading = false
})
_this.loading = false
})).catch(res => {
_this.loading = false
})
},
async addMechanism(){
let fileData = new FormData();
this.ruleForm.documentDeleteIds = (this.documentDeleteIds).join(); // 删除id
let _this = this;
if (_this.id) {
_this.ruleForm.id = _this.id;
}
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
if (this.ruleForm.purchaseType == 1 || this.ruleForm.purchaseType == 2) {
// 技术权重及商务权重之和为100
let technicalWeight = Number(_this.ruleForm.technicalWeight)
let businessWeight = Number(_this.ruleForm.businessWeight)
let sum = technicalWeight + businessWeight
if (sum !== 100) {
_this.msgError('技术权重及商务权重之和为100')
loading.close()
return false
}
}
// if(this.id){
// if(_this.ruleForm.documents.length == 0){
// _this.msgError('请上传招标附件')
// }
// }else{
// if(_this.ruleForm.invitationBiddingDocument.length == 0){
// _this.msgError('请上传招标附件')
// }
// }
_this.ruleForm.industryName = _this.ruleForm.secondcode;
_this.ruleForm.purchaseParentOrgCode = 41;
this.attachments.map((item, index) => {
if (item.raw) fileData.append('file', item.raw);
})
// fileData.append('documentDeleteIds',delData);
fileData.append('params',JSON.stringify(this.ruleForm));
try {
let res = await request.post('/purchaserInfo/save/purchaser', fileData);
if (res.code == 200) {
_this.msgSuccess(res.msg);
loading.close()
// setTimeout(function() {
_this.commonRoute()
// }, 1500)
}
}catch (e) {
loading.close();
_this.ruleForm.purchaseParentOrgCode = "中国中化控股有限责任公司";
}
},
/** 提交和编辑 */
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if(this.id){
if(this.attachments.length == 0){
// this.msgError('请上传招标附件')
this.commonDialog();
}else{
this.addMechanism();
}
}else{
if(this.ruleForm.invitationBiddingDocument.length == 0){
this.commonDialog();
}else{
this.addMechanism();
}
}
}
});
},
commonDialog(){
this.$confirm('请确认,该采购是否为非公开发布的线下直签、现货采购、商城采购等少数类产品特性形成的线下直接签署合同的项目?', '提示', {
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
}).then(() => {
this.addMechanism();
}).catch(() => {
// this.msgError('请上传招标附件')
});
},
/** 取消 */
resetForm(formName) {
this.$confirm('离开页面,所有修改内容将丢失!', '提示', {
confirmButtonText: '确认离开',
cancelButtonText: '继续编辑',
showClose: false,
callback: action => {
if (action === 'confirm') {
this.commonRoute()
}
}
})
},
/** 公共跳转路由 */
commonRoute() {
let tableType = this.tableType
if (this.news) {
this.$router.go(-1);
} else {
let pageNum = this.pageNum
let pageSize = this.pageSize
this.$router.push({ path: '/purchase/index', query: { tableType, pageNum, pageSize } })
}
},
/**技术权重,商务权重的数据清空 */
changeData() {
this.ruleForm.technicalWeight = ''
this.ruleForm.businessWeight = ''
},
/**解决单选不必填的BUG */
singleSourceClick(number) {
if (this.ruleForm.singleSourcePurchaserType === number) {
this.ruleForm.singleSourcePurchaserType = "";
} else {
this.ruleForm.singleSourcePurchaserType = number;
}
},
isLineClick(number){
if (this.ruleForm.noFileType === number) {
this.ruleForm.noFileType = "";
} else {
this.ruleForm.noFileType = number;
}
},
/**解决单选不必填的BUG */
biddingStateClick(number) {
if (this.ruleForm.biddingState === number) {
this.ruleForm.biddingState = "";
} else {
this.ruleForm.biddingState = number;
}
},
/** 获取采购人代码所属主要行业*/
getType(event) {
this.loading = true
let pageSize = 0
let pageNum = 0
// 二级下拉
if (event !== '' || event !== undefined || event !== null) {
let data = {
firstcode: event
}
getSecondType(pageSize, pageNum, data).then(response => {
this.industrySecondOption = response.data.list
this.ruleForm.secondcode = ''
this.loading = false
})
}
// 一级下拉
if (event == undefined) {
let data = {}
getType(pageSize, pageNum, data).then(response => {
this.industryCodeOption = response.data.list
this.loading = false
})
}
},
/**采购人名称,代码*/
getSelectData() {
getSelectData(this.queryParams).then((response) => {
const { code, data, total } = response
this.total = response.total;
// if(this.id == undefined){
// this.ruleForm.purchaseName = response.name
// this.ruleForm.purchaseCode = response.scode
// }
this.ruleForm.firstcode = response.firstcode
let secondcode = response.secondcode
let pageSize = 0
let pageNum = 0
let secondData = {
firstcode: response.firstcode
}
/** 采购人代码所属主要行业*/
getSecondType(pageSize, pageNum, secondData).then(response => {
this.industrySecondOption = response.data.list
for (let i = 0; i < response.data.list.length; i++) {
if (secondcode == response.data.list[i].secondcode) {
this.ruleForm.secondcode = secondcode
}
}
this.loading = false
})
this.loading = false
})
.catch(function(error) {
this.loading = false
})
},
/** 公共二级下拉框代码*/
commonSecondList() {
/** 采购人代码所属主要行业*/
getSecondType(pageSize, pageNum, secondData).then(response => {
this.industrySecondOption = response.data.list;
for (let i = 0; i < response.data.list.length; i++) {
if (secondcode == response.data.list[i].secondcode) {
this.ruleForm.secondcode = secondcode;
}
}
this.loading = false;
})
},
/** 清空采购包或标段预算/规模*/
clearFundScale(){
this.ruleForm.fundScale = '';
},
/** 浏览 */
handlePreview(row,index) {
//hasOwnProperty方法返回一个布尔值,判断自身属性是否存在,循环的是那个列表
console.log(row,'row')
if(row.hasOwnProperty('raw')){
let pdfUrl = URL.createObjectURL(row.raw)
window.open(pdfUrl);
}else{
supplierFile(row.id,index).then(response => {
window.open(response.msg);
});
}
},
/** 文件必传验证 */
handleStatus(file, fileList){
console.log(file,'file')
// this.$refs.upload.active = true
let patrn = /^[^`!@#$%^&*<>]+$/
if (!patrn.test(file.name)) {// 如果包含特殊字符返回false
this.msgError('文件名称不能有特殊字符');
return false;
}
for(let i = 0; i<this.attachments.length; i++){
if(file.name === this.attachments[i].name){
// this.msgSuccess('替换' + file.name);
this.ruleForm.files = this.attachments[i];
return
}
}
file.percentage = 98;
setTimeout(() => {
file.percentage = 100;
},300)
this.attachments.push(file);
this.ruleForm.invitationBiddingDocument = this.attachments;
},
uploadFile(file){
// console.log(file.file)
},
handleRemove(file, fileList) {
this.attachments = fileList;
},
handleExceed(files, fileList) {
// this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`);
},
/** 删除附件 */
handleDel(params,index){
if(params.hasOwnProperty('id')){
this.documentDeleteIds.push(params.id)
}
this.attachments.splice(index,1)
this.ruleForm.invitationBiddingDocument = this.attachments;
},
}
}
</script>
<style scoped lang="scss">
.iconStyle{
display: flex;
flex-direction: row;
}
</style>
还没有评论,来说两句吧...