import { postDelete, getDetailed, postExportForDetail, fileStorage } from '@/api/wms-api' import * as allUrlOption from '@/utils/baseData/urlOption' export const drawerMixins = { data() { return { //抽屉按钮多选数据 dropdownData: { dropdown1: { command: "delete", label: "删除", }, }, //抽屉传入参数 propsData: {}, URLOption_base:allUrlOption[this.$route.name].baseURL, URLOption_delete:allUrlOption[this.$route.name].deleteURL, // 主表-明细-操作列 operationButtonsDetail:[{label:'查看详情',name:'info'}], } }, methods: { //关闭抽屉 closeValue(val) { this.displayDialog.detailsDialog = val; }, //抽屉常用按钮 drawerbutton(val, that) { if (!that) { that = this } if (val == "edit") { this.formTitle = this.$route.meta.title + "编辑"; this.formReveal = false this.theEvent = "edit" const listAssign = (arr1, arr2) => { Object.keys(arr1).forEach(item => { arr1[item] = arr2[item] }) } listAssign(this.editFormData, this.propsData) if(this.$route.name == 'CustomerItem'){ this.editFormData.beginTime = new Date(this.propsData.beginTime) this.editFormData.endTime = new Date(this.propsData.endTime) } this.displayDialog.editDialog = true } }, //抽屉下拉按钮操作 async drawerHandle(val) { if (val == 'delete') { this.$confirm('此操作将永久删除该消息, 是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { this.Loading.appMainLoading = true // this.Loading.tableLoading = true this.displayDialog.detailsDialog = false let _url = this.URLOption_delete ? this.URLOption_delete : this.URLOption_base + '/delete-by-id' postDelete(this.propsData.id, _url).then(res => { this.$successMsg('删除成功!') this.Loading.appMainLoading = false this.paging() }).catch(err => { this.Loading.appMainLoading = false // this.Loading.tableLoading = false }) }).catch(() => { this.Loading.appMainLoading = false }); } }, // 导出 exportForDetailHandle(that,url,params){ if (!that) { that = this } let PageListParams = {} that.Loading.appMainLoading = true PageListParams.company = window.SITE_CONFIG['company'] PageListParams.function = that.$route.meta.title PageListParams.route = url; postExportForDetail(PageListParams,url,params).then(res => { this.blob(res, this.$route.meta.title )//使用前端导出名称 that.Loading.appMainLoading = false }).catch(err => { that.Loading.appMainLoading = false }) } } }