| | |
| | | <div class="table-operator"> |
| | | <Tooltip |
| | | placement="top" |
| | | title="选择工具分类后再执行新增" |
| | | title="选择工具四级分类后再执行新增" |
| | | > |
| | | <a-button @click="handleAdd(nodeSelected)" type="primary" icon="plus" :disabled="!nodeSelected.key || nodeSelected.entity.leafFlag === '2'">新增</a-button> |
| | | </Tooltip> |
| | | <a-button type="primary" @click="exportToExcel('刀具信息导入模板')" icon="export" style="margin-left: 8px" :disabled="!nodeSelected.key || nodeSelected.entity.leafFlag === '2'">下载导入模板</a-button> |
| | | <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
| | | <a-button type="primary" icon="import" :disabled="!nodeSelected.key || nodeSelected.entity.leafFlag === '2'">导入</a-button> |
| | | </a-upload> |
| | | <!-- <a-button type="primary" icon="download" @click="handleExportXls('tms_tools_classify')">导出</a-button> |
| | | <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
| | | <a-button type="primary" icon="import">导入</a-button> |
| | |
| | | :customRow="customRow" |
| | | @change="handleTableChange"> |
| | | |
| | | <template slot="htmlSlot" slot-scope="text"> |
| | | <div v-html="text"></div> |
| | | </template> |
| | | <template slot="imgSlot" slot-scope="text,record"> |
| | | <template slot='toolPicture' slot-scope='text, record, index'> |
| | | <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> |
| | | <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> |
| | | <img v-else :src="getImgView(text)" :preview="record.toolPicture" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> |
| | | </template> |
| | | |
| | | <template slot="fileSlot" slot-scope="text"> |
| | | <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> |
| | | <a-button |
| | |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | import BaseToolsModal from './BaseToolsModal' |
| | | import Tooltip from 'ant-design-vue/es/tooltip' |
| | | import { getAction, postAction, deleteAction, requestPut } from '@api/manage' |
| | | import { getAction, postAction, deleteAction, requestPut,downFile } from '@api/manage' |
| | | import ParaHoleToolsModal from './ParaHoleToolsModal' |
| | | import ParaMillToolModal from './ParaMillToolModal' |
| | | import ParaThreadingToolModal from './ParaThreadingToolModal' |
| | |
| | | dataIndex: 'toolModel' |
| | | }, |
| | | { |
| | | title: '工具图片', |
| | | align: 'center', |
| | | width: 120, |
| | | dataIndex: 'toolPicture', |
| | | scopedSlots: { customRender: 'toolPicture' } |
| | | }, |
| | | { |
| | | title:'备注', |
| | | align:"center", |
| | | dataIndex: 'remark' |
| | |
| | | exportXlsUrl: "/tms/baseTools/exportXls", |
| | | importExcelUrl: "tms/baseTools/importExcel", |
| | | queryParaByToolCode:"/tms/baseTools/queryByToolCode", |
| | | queryByToolCode:"/tms/toolsConfigProperty/queryByToolCode" |
| | | queryByToolCode:"/tms/toolsConfigProperty/queryByToolCode", |
| | | loadTemplate:"/tms/baseTools/loadTemplate", |
| | | importBlade:"/tms/paraBlade/importExcel", |
| | | importCommonTool:"/tms/paraCommonTool/importExcel", |
| | | importHoleTools:"/tms/paraHoleTools/importExcel", |
| | | importThreading:"/tms/paraThreadingTool/importExcel", |
| | | importTurning:"/tms/paraTurningTools/importExcel", |
| | | importMillTool:"/tms/paraMillTool/importExcel" |
| | | }, |
| | | dictOptions:{}, |
| | | superFieldList:[], |
| | | nodeSelected: {}, // 当前选中的节点数据 |
| | | paraTypeFlag:'', |
| | | disableMixinCreated:true |
| | | disableMixinCreated:true, |
| | | loading:false |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | }, |
| | | computed: { |
| | | importExcelUrl: function(){ |
| | | return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
| | | if(this.paraTypeFlag === "1"){ |
| | | return `${window._CONFIG['domianURL']}/${this.url.importCommonTool}`; |
| | | }else if(this.paraTypeFlag === "2"){ |
| | | return `${window._CONFIG['domianURL']}/${this.url.importHoleTools}`; |
| | | }else if(this.paraTypeFlag === "3"){ |
| | | return `${window._CONFIG['domianURL']}/${this.url.importThreading}`; |
| | | }else if(this.paraTypeFlag === "4"){ |
| | | return `${window._CONFIG['domianURL']}/${this.url.importMillTool}`; |
| | | }else if(this.paraTypeFlag === "5"){ |
| | | return `${window._CONFIG['domianURL']}/${this.url.importTurning}`; |
| | | }else if(this.paraTypeFlag === "6"){ |
| | | return `${window._CONFIG['domianURL']}/${this.url.importBlade}`; |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | |
| | | if (res.success) { |
| | | this.dataSource = res.result.records; // 更新表格数据 |
| | | this.ipagination.total = res.result.total |
| | | //默认选中第一条数据 |
| | | this.selectedRowKeys[0] = res.result.records[0].id |
| | | this.onSelectChange(this.selectedRowKeys) |
| | | } else { |
| | | this.$message.warning("请选择叶子节点进行查询"); |
| | | this.ipagination.total = 0 |
| | |
| | | } |
| | | } |
| | | }, |
| | | |
| | | exportToExcel(fileName) { |
| | | this.loading = true // 显示加载遮罩 |
| | | this.queryParam.paraTypeFlag = this.paraTypeFlag |
| | | var params = this.getQueryParams() |
| | | downFile(this.url.loadTemplate,params).then((data)=>{ |
| | | if (!data) { |
| | | this.$message.warning("文件下载失败") |
| | | return |
| | | } |
| | | if (typeof window.navigator.msSaveBlob !== 'undefined') { |
| | | window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}), fileName+'.xlsx') |
| | | }else{ |
| | | let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})) |
| | | let link = document.createElement('a') |
| | | link.style.display = 'none' |
| | | link.href = url |
| | | link.setAttribute('download', fileName+'.xlsx') |
| | | document.body.appendChild(link) |
| | | link.click() |
| | | document.body.removeChild(link); //下载完成移除元素 |
| | | window.URL.revokeObjectURL(url); //释放掉blob对象 |
| | | } |
| | | this.loading = false // 隐藏遮罩 |
| | | }) |
| | | }, |
| | | }, |
| | | } |
| | | </script> |