Commit d26fa826 by lichengming

修改了证书管理模板管理

parent 192bdfd7
...@@ -8,6 +8,10 @@ import { https } from '../https' ...@@ -8,6 +8,10 @@ import { https } from '../https'
export default { export default {
// page // page
page: data => http.post('meter/v1/sample/page', data).then(res => res), page: data => http.post('meter/v1/sample/page', data).then(res => res),
pageTemplate: data =>
http.post('base/v1/file_template/page', data).then(res => res),
templateList: data =>
http.post('base/v1/file_template_classify/list', data).then(res => res),
pageSubSample: data => pageSubSample: data =>
http.post('/meter/v1/sub_sample/page', data).then(res => res), http.post('/meter/v1/sub_sample/page', data).then(res => res),
pageSampleProgress: data => pageSampleProgress: data =>
......
<template>
<div>
<!--内容-->
<div class="layout-content-padding marginLeft-10">
<div class="layout-content-main tree-position">
<div class="position-right">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="模板名称:">
<Input @on-enter="_formSearch" name="name" placeholder="请输入模板名称"></Input>
<input type="hidden" name="classifyId">
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns"
@on-result-change="_tableResultChange" :getPage="getPage" :optColWidth="120" :icon-msg="iconMsg">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
</div>
<!-- 添加、编辑 -->
<FoodReportTemplateEdit ref="editModal" @on-result-change="_search"></FoodReportTemplateEdit>
</div>
</template>
<script>
import global from '../../../api/config'
import { meterSample } from '../../../api'
import FoodReportTemplateEdit from './MeterReportTemplateEdit'
export default {
components: {
FoodReportTemplateEdit
},
data() {
return {
pageColumns: [
{ title: '报告模板名称', key: 'name' },
{ title: '别名', key: 'alias' }
],
formObj: {
name: undefined,
aptitude: undefined
},
iconMsg: [
{ type: 'ios-book', id: '', name: '预览/编辑' },
{ type: 'ios-download', id: '', name: '下载' },
{ type: 'md-remove-circle', id: '', name: '删除' }
],
getPage: {},
tableStyleObj: {},
btn: [
{ type: 'success', id: '', name: '添加' },
{ type: 'error', id: '', name: '删除' }
],
searchOpen: true,
selectIds: []
}
},
computed: {
// tableHeight: function() {
// if (this.searchOpen) {
// return this.$newTableHeight('search')
// } else {
// return this.$newTableHeight('noSearch')
// }
// }
},
mounted() {
// this._contHide()
// this._classTree()
this._page()
},
methods: {
_btnClick(msg) {
switch (msg) {
case '添加':
this._editModal()
break
case '删除':
this._delAll()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_refresh() {
// 刷新
this.id = ''
this.name = ''
this._search()
this._classTree()
},
_classData(result, msg) {
$('input[name=classifyId]').val(result)
this._formSearch()
},
_classTree() {
this.$refs.classTree._Ztree()
},
_treeHide() {
// 左侧树隐藏
this.isTree = false
this.tableStyleObj.marginLeft = '15px'
},
_treeShow() {
this.isTree = true
this.tableStyleObj.marginLeft = '215px'
},
_iconClick(res, data) {
switch (res) {
case '下载':
this._download(data.id)
break
case '预览/编辑':
this._viewReport(data)
break
case '删除':
this._deleteById([data.id])
break
}
},
_viewReport(data) {
// window.open(global.baseURL + '/print/v1/oos?key=' + objectKey+'&edit=true', '', 'height=' + (screen.availHeight - 50) + ',' +
// 'width=' + (screen.availWidth - 10) + ',top=0,left=0,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,' +
// 'location=no,status=no')
if (data) {
this.$openWindowModeless({
objectKey: data.objectKey,
id: data.id,
isReport: 4
})
}
},
_contHide() {
this._page()
},
_page: async function() {
console.log('page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await meterSample.pageTemplate(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
// const result = await
// this.$refs.pageTable._page('search-form', 'SysFileTemplate/page')
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_editModal() {
this.$refs.editModal._open()
},
// 批量删除
_delAll() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this._deleteById(ids)
}
},
_deleteById(ids) {
// 删除一条记录
this.$Modal.confirm({
title: '提示',
content: '确定删除这 ' + ids.length + ' 条记录?',
onOk: () => {
this.$store.dispatch('SysFileTemplate/deleteById', ids).then(() => {
if (this.$store.state.SysFileTemplate.success) {
this._page()
this.$Message.success('删除成功!')
this.selectIds = []
}
})
}
})
},
_download(id) {
this.$Modal.confirm({
title: '提示',
content: '确定要下载?',
onOk: () => {
window.open(
global.baseURL + '/base/v1/file_template/download/' + id,
'_blank'
)
}
})
},
_search() {
this._page()
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
// this.getPage = this.$store.state.SysFileTemplate.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
default:
this._page()
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showEditModal" :mask-closable="false">
<p slot="header">{{modalTitle}}</p>
<div v-show="isLoad">
<Spin fix>
<Icon type="load-c" size=18 class="file-spin-icon-load"></Icon>
<div>正在上传,请稍后...</div>
</Spin>
</div>
<div>
<Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="80">
<Form-item label="类别" prop="pname">
<Input v-model="pname" @click.native="_selectZtree" placeholder="请选择类别" icon="plus-circled"
readonly></Input>
</Form-item>
<Form-item label="别名" prop="alias">
<Input v-model="formObj.alias" @on-keyup="_onKeyUp" name="alias" placeholder="请输入别名"></Input>
</Form-item>
</Form>
</div>
<div slot="footer" class="btn-width clearfix">
<Button @click="_cancel" type="" style="margin-left: 8px;">取消</Button>
<label style="margin-bottom: 0;float: right">
<Upload
:action="action"
:on-success="_handelsuccess"
:before-upload="_beupload"
:on-progress="_handelprogress"
:on-format-error="_formatError"
:data="dataObj"
:with-credentials="true"
:show-upload-list="false"
:format="format"
>
<Button :disabled="isDisable" type="primary">导入文件</Button>
</Upload>
</label>
</div>
</Modal>
<!--类别弹出树-->
<!-- <LmsTemplateClassifyZTree ref="ztreeModal" @on-result-change="_ztree"></LmsTemplateClassifyZTree>-->
</div>
</template>
<script>
/**
* 添加编辑
*/
// import LmsTemplateClassifyZTree from '../lms-template-classify/LmsTemplateClassifyZTree.vue'
import global from '../../../api/config'
const defVal = {
alias: '',
classifyId: 0
}
export default {
// components: { LmsTemplateClassifyZTree },
data() {
return {
modalTitle: '添加',
formObj: defVal,
ruleValidate: {
alias: [{ required: true, message: '别名不能为空', trigger: 'blur' }],
pname: [{ required: true, message: '类别不能为空', trigger: 'blur' }]
},
showEditModal: false,
dataObj: {
file: ''
},
pname: '',
action: '',
isLoad: false,
isDisable: true,
format: ['docx', 'xlsx', 'xls']
}
},
methods: {
_onKeyUp() {
if (this.formObj.alias === '' || this.pname === '') {
this.isDisable = true
} else {
this.isDisable = false
this.action =
global.baseURL +
'/base/v1/file_template/?alias=' +
this.formObj.alias +
'&classifyId=' +
this.formObj.classifyId
}
},
_selectZtree() {
// this.$refs.ztreeModal._openZtree()
},
_cancel() {
this.showEditModal = false
},
_open() {
this.showEditModal = true
this.isLoad = false
this.formObj.alias = ''
this.modalTitle = '添加模板'
},
_beupload(file) {
this.dataObj.file = file.name
},
_handelprogress(event, file, fileList) {
this.isLoad = true
},
_handelsuccess(response, file, fileList) {
// 上传成功
if (response.success) {
this.isLoad = false
this.$Message.success('上传成功!')
this.$emit('on-result-change')
this.showEditModal = false
} else {
this.isLoad = true
this.$Message.error(response.msg)
}
},
_formatError(file) {
this.$Notice.error({
title: '文件格式不正确',
duration: 10,
desc:
'文件 ' +
file.name +
' 格式不正确,请上传格式为 docx、xlsx、xls 的文件!'
})
},
_ztree(result) {
this.pname = ''
if (result === undefined) {
this.formObj.classifyId = '0'
this.pname = ''
} else {
this.formObj.classifyId = result.id
this.pname = result.name
}
// 判断必填项是否为空
this._onKeyUp()
}
}
}
</script>
<style scoped>
.clearfix:after {
content: '';
clear: both;
display: block;
}
</style>
<template>
<div>
<div>
<Form onsubmit="return false">
<Form-item>
<Input v-model="key" @on-enter="_search"
@on-click="_search" placeholder="请输入关键字,回车查询" style="width:100%" icon="ios-search-strong" ></Input>
</Form-item>
</Form>
</div>
<!--加载中-->
<div v-show="isloading" class="demo-spin-container spin-bg">
<Spin fix size="large"></Spin>
</div>
<ul id="equipClassTree" v-show="isTree" class="ztree ztreePro tree_height" style="overflow-x: auto;" ></ul>
</div>
</template>
<style>
</style>
<script>
import { meterSample } from '../../../api'
/**
* 添加编辑Ztree
*/
let setting
export default {
data() {
return {
key: '',
isloading: true,
isTree: false
}
},
mounted() {
// this._treeHeight()
},
created() {
// this._Ztree()
// this.$bus.$on('class', msg => {
// this._Ztree()
// })
},
methods: {
_Ztree() {
this.key = ''
this.isloading = true
this.isTree = false
setting = {
data: {
simpleData: {
enable: true,
idKey: 'id',
pIdKey: 'pid'
}
},
callback: {
onClick: this.zTreeOnClick
}
}
// this.$store.dispatch('LmsTemplateClassifyManage/list').then(() => {
// $.fn.zTree.init(
// $('#equipClassTree'),
// setting,
// this.$store.state.LmsTemplateClassifyManage.list
// )
// setTimeout(() => {
// this.isloading = false
// this.isTree = true
// }, 300)
// })
},
_page: async function() {
console.log('page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await meterSample.templateList(this.formObj)
if (result) {
$.fn.zTree.init(
$('#equipClassTree'),
setting,
this.$store.state.LmsTemplateClassifyManage.list
)
setTimeout(() => {
this.isloading = false
this.isTree = true
}, 300)
}
},
zTreeOnClick(event, treeId, treeNode) {
this.$emit('on-result-change', treeNode.id)
},
_search() {
if (this.key !== '') {
this.isloading = true
this.isTree = false
this.$store
.dispatch('LmsTemplateClassifyManage/getTreeKeyword', this.key)
.then(() => {
$.fn.zTree.init(
$('#equipClassTree'),
setting,
this.$store.state.LmsTemplateClassifyManage.list
)
setTimeout(() => {
this.isloading = false
this.isTree = true
}, 300)
})
} else {
this._Ztree()
}
},
_treeHeight() {
$('.tree_height').height(document.documentElement.clientHeight - 225)
}
}
}
</script>
...@@ -46,6 +46,7 @@ import MeterAnnualEntrust from '../pages/meter-statistics/annual-entrust/MeterAn ...@@ -46,6 +46,7 @@ import MeterAnnualEntrust from '../pages/meter-statistics/annual-entrust/MeterAn
import MeterCustomerEntrust from '../pages/meter-statistics/customer-entrust/MeterCustomerEntrust' import MeterCustomerEntrust from '../pages/meter-statistics/customer-entrust/MeterCustomerEntrust'
import MeterCertificateRate from '../pages/meter-statistics/certificate-rate/MeterCertificateRate' import MeterCertificateRate from '../pages/meter-statistics/certificate-rate/MeterCertificateRate'
import MeterSampleQuantity from '../pages/meter-statistics/sample-quantity/MeterSampleQuantity' import MeterSampleQuantity from '../pages/meter-statistics/sample-quantity/MeterSampleQuantity'
import MeterReportTemplate from '../pages/meter-certificate/template/MeterReportTemplate'
import Blank from '~/pages/blank' import Blank from '~/pages/blank'
export default [ export default [
{ {
...@@ -185,6 +186,11 @@ export default [ ...@@ -185,6 +186,11 @@ export default [
path: 'certificate_print', path: 'certificate_print',
component: MeterCertificatePrintIndex, component: MeterCertificatePrintIndex,
meta: { title: '证书打印' } meta: { title: '证书打印' }
},
{
path: 'report_template',
component: MeterReportTemplate,
meta: { title: '模板管理' }
} }
] ]
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment