| | |
| | | <!-- æä½æé®åºå --> |
| | | <div class="table-operator"> |
| | | <a-button @click="handleAdd" type="primary" icon="plus">æ°å¢</a-button> |
| | | <!-- <a-button type="primary" icon="download" @click="handleExportXls('åå
·å
¥åºå')">导åº</a-button> |
| | | <a-button type="primary" icon="download" @click="handleExportXls('åå
·å
¥åºå')">导åº</a-button> |
| | | <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
| | | <a-button type="primary" icon="import">导å
¥</a-button> |
| | | </a-upload> --> |
| | | </a-upload> |
| | | </div> |
| | | |
| | | <!-- tableåºå-begin --> |
| | |
| | | </a-card> |
| | | </template> |
| | | |
| | | |
| | | |
| | | |
| | | <script> |
| | | |
| | | import '@/assets/less/TableExpand.less' |
| | |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | import CuttingInboundModal from './modules/CuttingInboundModal' |
| | | import CuttingInboundDetailList from './CuttingInboundDetailList' |
| | | import { downFile } from '@api/manage' |
| | | import Vue from 'vue' |
| | | import { ACCESS_TOKEN } from '@/store/mutation-types' |
| | | import store from '@/store' |
| | | |
| | | |
| | | export default { |
| | |
| | | { |
| | | title:'å
¥åºåç¶æ', |
| | | align:"center", |
| | | dataIndex: 'orderStatus' |
| | | dataIndex: 'orderStatus_dictText', |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | |
| | | deleteBatch: "/cms/cuttingInbound/deleteBatch", |
| | | exportXlsUrl: "/cms/cuttingInbound/exportXls", |
| | | importExcelUrl: "cms/cuttingInbound/importExcel", |
| | | |
| | | }, |
| | | dictOptions:{}, |
| | | superFieldList:[], |
| | |
| | | }, |
| | | created() { |
| | | this.getSuperFieldList(); |
| | | // æ·»å åå
¸æ°æ®å è½½ |
| | | this.initDictConfig(); |
| | | }, |
| | | computed: { |
| | | importExcelUrl: function(){ |
| | |
| | | this.$refs.modalForm.title="详æ
"; |
| | | this.$refs.modalForm.disableSubmit = true; |
| | | }, |
| | | // èªå®ä¹è¡ç¹å»äºä»¶ |
| | | customRow(record) { |
| | | return { |
| | | on: { |
| | |
| | | }, |
| | | } |
| | | }, |
| | | |
| | | handleExportXls(fileName){ |
| | | if(!fileName || typeof fileName != "string"){ |
| | | fileName = "å¯¼åºæä»¶" |
| | | } |
| | | let param = this.getQueryParams(); |
| | | if(this.selectedRowKeys && this.selectedRowKeys.length>0){ |
| | | param['selections'] = this.selectedRowKeys.join(",") |
| | | } |
| | | |
| | | |
| | | |
| | | console.log("导åºåæ°",param) |
| | | downFile(this.url.exportXlsUrl,param).then((data)=>{ |
| | | if (!data) { |
| | | // this.$message.warning("æä»¶ä¸è½½å¤±è´¥") |
| | | this.$notification.warning({ |
| | | message:'æ¶æ¯', |
| | | description:"æä»¶ä¸è½½å¤±è´¥" |
| | | }); |
| | | return |
| | | } |
| | | if (typeof window.navigator.msSaveBlob !== 'undefined') { |
| | | window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls') |
| | | }else{ |
| | | let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'})) |
| | | let link = document.createElement('a') |
| | | link.style.display = 'none' |
| | | link.href = url |
| | | link.setAttribute('download', fileName+'.xls') |
| | | document.body.appendChild(link) |
| | | link.click() |
| | | document.body.removeChild(link); //ä¸è½½å®æç§»é¤å
ç´ |
| | | window.URL.revokeObjectURL(url); //éæ¾æblob对象 |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | /* 导å
¥ */ |
| | | handleImportExcel(info){ |
| | | this.loading = true; |
| | | if (info.file.status !== 'uploading') { |
| | | console.log(info.file, info.fileList); |
| | | } |
| | | if (info.file.status === 'done') { |
| | | this.loading = false; |
| | | if (info.file.response.success) { |
| | | // this.$message.success(`${info.file.name} æä»¶ä¸ä¼ æå`); |
| | | if (info.file.response.code === 201) { |
| | | let { message, result: { msg, fileUrl, fileName } } = info.file.response |
| | | let href = window._CONFIG['domianURL'] + fileUrl |
| | | this.$warning({ |
| | | title: message, |
| | | content: (<div> |
| | | <span>{msg}</span><br/> |
| | | <span>å
·ä½è¯¦æ
请 <a href={href} target="_blank" download={fileName}>ç¹å»ä¸è½½</a> </span> |
| | | </div> |
| | | ) |
| | | }) |
| | | } else { |
| | | // this.$message.success(info.file.response.message || `${info.file.name} æä»¶ä¸ä¼ æå`) |
| | | this.$notification.success({ |
| | | message:'æ¶æ¯', |
| | | description:info.file.response.message || `${info.file.name} æä»¶ä¸ä¼ æå` |
| | | }); |
| | | } |
| | | this.loadData() |
| | | } else { |
| | | // this.$message.error(`${info.file.name} ${info.file.response.message}.`); |
| | | this.$notification.error({ |
| | | message:'æ¶æ¯', |
| | | description:`${info.file.name} ${info.file.response.message}.` |
| | | }); |
| | | } |
| | | } else if (info.file.status === 'error') { |
| | | this.loading = false; |
| | | if (info.file.response.status === 500) { |
| | | let data = info.file.response |
| | | const token = Vue.ls.get(ACCESS_TOKEN) |
| | | if (token && data.message.includes("Token失æ")) { |
| | | this.$error({ |
| | | title: 'ç»å½å·²è¿æ', |
| | | content: '徿±æï¼ç»å½å·²è¿æï¼è¯·éæ°ç»å½', |
| | | okText: 'éæ°ç»å½', |
| | | mask: false, |
| | | onOk: () => { |
| | | store.dispatch('Logout').then(() => { |
| | | Vue.ls.remove(ACCESS_TOKEN) |
| | | window.location.reload(); |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | // this.$message.error(`æä»¶ä¸ä¼ 失败: ${info.file.msg} `); |
| | | this.$notification.error({ |
| | | message:'æ¶æ¯', |
| | | description:`æä»¶ä¸ä¼ 失败: ${info.file.msg} ` |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | </script> |