| | |
| | | * data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除 |
| | | */ |
| | | import { filterObj } from '@/utils/util'; |
| | | import { deleteAction, getAction,downFile,getFileAccessHttpUrl } from '@/api/manage' |
| | | import { deleteAction, getAction, downFile, getFileAccessHttpUrl, httpAction } from '@/api/manage' |
| | | import Vue from 'vue' |
| | | import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types" |
| | | import store from '@/store' |
| | |
| | | created() { |
| | | if(!this.disableMixinCreated){ |
| | | console.log(' -- mixin created -- ') |
| | | // 此处需在loadData函数之前将参数设置为所需要的值,在组件中的created中无法设置,因为mixin的生命周期函数执行顺序优先于组件的生命周期函数 |
| | | const { equipmentId } = this.$route.params |
| | | if(equipmentId) this.$set(this.queryParam,'equipmentNum',equipmentId) |
| | | this.loadData(); |
| | | //初始化字典配置 在自己页面定义 |
| | | this.initDictConfig(); |
| | |
| | | this.ipagination.current = 1; |
| | | } |
| | | var params = this.getQueryParams();//查询条件 |
| | | |
| | | console.log('params',params) |
| | | if(!params){ |
| | | return false; |
| | | } |
| | | |
| | | this.loading = true; |
| | | getAction(this.url.list, params).then((res) => { |
| | | if (res.success) { |
| | |
| | | sqp['superQueryMatchType'] = this.superQueryMatchType |
| | | } |
| | | var param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters); |
| | | param.field = this.getQueryField(); |
| | | if(this.columns) param.field = this.getQueryField(); |
| | | param.pageNo = this.ipagination.current; |
| | | param.pageSize = this.ipagination.pageSize; |
| | | //获取用户定制的参数属性 |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | return filterObj(param); |
| | | }, |
| | | getQueryField() { |
| | |
| | | }); |
| | | return str; |
| | | }, |
| | | |
| | | onSelectChange(selectedRowKeys, selectionRows) { |
| | | this.selectedRowKeys = selectedRowKeys; |
| | | this.selectionRows = selectionRows; |
| | |
| | | //重新计算分页问题 |
| | | that.reCalculatePage(that.selectedRowKeys.length) |
| | | // that.$message.success(res.message); |
| | | this.$notification.warning({ |
| | | that.$notification.success({ |
| | | message:'消息', |
| | | description:res.message |
| | | }); |
| | |
| | | that.onClearSelected(); |
| | | } else { |
| | | // that.$message.warning(res.message); |
| | | this.$notification.warning({ |
| | | that.$notification.warning({ |
| | | message:'消息', |
| | | description:res.message |
| | | }); |
| | |
| | | description:res.message |
| | | }); |
| | | that.loadData(); |
| | | that.clearSelected() |
| | | } else { |
| | | // that.$message.warning(res.message); |
| | | that.$notification.warning({ |
| | |
| | | //清空列表选中 |
| | | this.onClearSelected() |
| | | }, |
| | | /** |
| | | * 点击表格中详情按钮事件 |
| | | * @param record 选中的当前行数据 |
| | | */ |
| | | handleDetail:function(record){ |
| | | this.$refs.modalForm.edit(record); |
| | | this.$refs.modalForm.title="详情"; |
| | | this.$refs.modalForm.disableSubmit = true; |
| | | // 打开详情抽屉时禁用设备编码、设备名称输入框 |
| | | this.$refs.modalForm.disSeach = true; |
| | | // 调用抽屉表单组件中的清除表单验证方法 |
| | | this.$refs.modalForm.removeValidate() |
| | | }, |
| | | /* 导出 */ |
| | | handleExportXls2(){ |
| | |
| | | this.$warning({ |
| | | title: message, |
| | | content: (<div> |
| | | <span>{msg}</span><br/> |
| | | <span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span> |
| | | </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.$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.$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; |
| | |
| | | }) |
| | | } |
| | | } else { |
| | | this.$message.error(`文件上传失败: ${info.file.msg} `); |
| | | // this.$message.error(`文件上传失败: ${info.file.msg} `); |
| | | this.$notification.error({ |
| | | message:'消息', |
| | | description:`文件上传失败: ${info.file.msg} ` |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | |
| | | let url = getFileAccessHttpUrl(text) |
| | | window.open(url); |
| | | }, |
| | | |
| | | /** |
| | | * 单据批量提交 |
| | | */ |
| | | handleSubmitBatch: function() { |
| | | if (!this.url.submitBatch) { |
| | | this.$message.error('请设置url.submitBatch属性!') |
| | | return |
| | | } |
| | | if (this.selectedRowKeys.length <= 0) { |
| | | this.$message.warning('请选择一条记录!') |
| | | return |
| | | } else { |
| | | var ids = '' |
| | | for (var a = 0; a < this.selectedRowKeys.length; a++) { |
| | | ids += this.selectedRowKeys[a] + ',' |
| | | } |
| | | let httpurl = this.url.submitBatch |
| | | let method = 'post' |
| | | var params = { ids: ids } |
| | | |
| | | const that = this |
| | | httpAction(httpurl, params, method).then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.loadData() |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }).finally(() => { |
| | | that.loading = false |
| | | |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | /** |
| | | * 批量撤回已提交的记录 |
| | | */ |
| | | handleRevocationBatch: function() { |
| | | if (!this.url.revocationBatch) { |
| | | this.$message.error('请设置url.revocationBatch属性!') |
| | | return |
| | | } |
| | | if (this.selectedRowKeys.length <= 0) { |
| | | this.$message.warning('请选择一条记录!') |
| | | return |
| | | } else { |
| | | var ids = '' |
| | | for (var a = 0; a < this.selectedRowKeys.length; a++) { |
| | | ids += this.selectedRowKeys[a] + ',' |
| | | } |
| | | let httpurl = this.url.revocationBatch |
| | | let method = 'post' |
| | | var params = { ids: ids } |
| | | |
| | | const that = this |
| | | httpAction(httpurl, params, method).then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.loadData() |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }).finally(() => { |
| | | that.loading = false |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | /** |
| | | * 单据提交 |
| | | */ |
| | | handleSubmit: function() { |
| | | if (!this.url.submit) { |
| | | this.$message.error('请设置url.submit属性!') |
| | | return |
| | | } |
| | | if (this.selectedRowKeys.length != 1) { |
| | | this.$message.warning('请选择一条记录!') |
| | | return |
| | | } else { |
| | | var id = this.selectedRowKeys[0] |
| | | let httpurl = this.url.submit |
| | | let method = 'post' |
| | | var params = { id: id } |
| | | |
| | | const that = this |
| | | |
| | | this.$confirm({ |
| | | title: '确认提交!', |
| | | okText: '确认', |
| | | cancelText: '取消', |
| | | onOk() { |
| | | httpAction(httpurl, params, method).then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.loadData() |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }).finally(() => { |
| | | that.loading = false |
| | | |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | |
| | | } |
| | | }, |
| | | /** |
| | | * 撤回已提交的记录 |
| | | */ |
| | | handleRevocation: function() { |
| | | if (!this.url.revocation) { |
| | | this.$message.error('请设置url.revocation属性!') |
| | | return |
| | | } |
| | | if (this.selectedRowKeys.length != 1) { |
| | | this.$message.warning('请选择一条记录!') |
| | | return |
| | | } else { |
| | | var id = this.selectedRowKeys[0] |
| | | let httpurl = this.url.revocation |
| | | let method = 'post' |
| | | var params = { id: id } |
| | | |
| | | const that = this |
| | | this.$confirm({ |
| | | title: '确认撤回!', |
| | | okText: '确认', |
| | | cancelText: '取消', |
| | | onOk() { |
| | | |
| | | httpAction(httpurl, params, method).then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.loadData() |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }).finally(() => { |
| | | that.loading = false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |