| | |
| | | :icon="isSync ? 'el-icon-loading' : 'el-icon-refresh'">同步</el-button> |
| | | <el-button type="primary" icon="el-icon-plus" @click="openAddDia">新增</el-button> |
| | | <el-button icon="el-icon-delete" @click="delSales">删除</el-button> |
| | | <el-button icon="el-icon-download">导出</el-button> |
| | | <el-button icon="el-icon-download" @click="exportSale">导出</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | |
| | | <el-tag effect="dark" size="mini" style="font-size: 8px;">{{ scope.row.order_type }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="code" label="合同编号" width="220"> |
| | | <el-table-column prop="code" label="合同编号" > |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="工程名称" width="120"> |
| | | </el-table-column> |
| | |
| | | <template slot-scope="scope"> |
| | | <span style="color: #34BD66;" v-if="scope.row.type == 1">通过</span> |
| | | <span style="color: #E84738;" v-else-if="scope.row.type == 0">不通过</span> |
| | | <span v-else>{{ null }}</span> |
| | | <span style="color: #ff9900;" v-else>未审核</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="220"> |
| | | <el-table-column label="操作" width="250"> |
| | | <template slot-scope="scope"> |
| | | <span class="table_do" @click="changeShowDetail(scope.row)"> 查看详情 </span> |
| | | <span class="table_do" @click="downloadFile(scope.row)"> 下载附件 </span> |
| | |
| | | this.axios.post(this.$api.url.saleDownload, { |
| | | id: row.id |
| | | }).then(res => { |
| | | // console.log(res.data); |
| | | // 循环遍历每个文件并创建下载链接 |
| | | for (let index = 0; index < res.data.length; index++) { |
| | | const element = res.data[index]; |
| | | // 创建一个链接元素 |
| | | var a = document.createElement('a'); |
| | | const fileUrls = []; // 文件的urls |
| | | res.data.forEach(item=>{ |
| | | let url=baseIp+item |
| | | fileUrls.push(url) |
| | | }) |
| | | const downloadFile = (url, fileName) => { |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = fileName; |
| | | // link.style.display = 'none'; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | }; |
| | | |
| | | // 设置链接元素的href属性为文件的URL |
| | | a.href = baseIp+element; |
| | | |
| | | // // 设置链接元素的download属性为文件名 |
| | | // a.download = row.name+"附件"+(index+1); |
| | | |
| | | // 模拟点击链接以触发下载 |
| | | a.click(); |
| | | } |
| | | console.log(fileUrls); |
| | | fileUrls.forEach((url, index) => { |
| | | let s=url.split(".") |
| | | const fileName = row.name+`附件(${index + 1}).`+s[s.length-1]; |
| | | downloadFile(url, fileName); |
| | | }); |
| | | }) |
| | | }, |
| | | //销售订单导出 |
| | | exportSale(){ |
| | | this.$axios.post(this.$api.url.exportSale,{ |
| | | delTime: this.search.delTime, |
| | | name: this.search.name, |
| | | type: this.search.type, |
| | | orderNumber: this.search.code |
| | | },{responseType:'blob',headers:{"Content-Type":"application/json"}}).then((res)=>{ |
| | | const result = res; |
| | | var nameList = result.headers['content-disposition']; |
| | | nameList = decodeURI(nameList); |
| | | var fileName = nameList.split('=')[1]; |
| | | const blob = new Blob([result.data,{type: 'application/vnd.ms-excel'}]); |
| | | const link = document.createElement('a'); |
| | | link.download = fileName; |
| | | const URL = window.URL || window.webkitURL; |
| | | link.href= URL.createObjectURL(blob); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | }).catch() |
| | | }, |
| | | closeDialog() { |
| | | this.addData = { |
| | | orderNumber: null, |