Browse Source

提交

master
xiaobai 3 years ago
parent
commit
59dc399361
  1. 1
      package.json
  2. 11
      src/api/common.js
  3. 8
      src/api/data.js
  4. 49
      src/components/Crud/crud.js
  5. 3
      src/utils/index.js
  6. 18
      src/views/borrow/borrow-history.vue
  7. 252
      src/views/document/index.vue
  8. 17
      src/views/ysjl/components/manufacture_yb_list.vue
  9. 20
      src/views/ysjl/components/original_yb_list.vue

1
package.json

@ -25,6 +25,7 @@
"babel-plugin-import": "^1.13.0", "babel-plugin-import": "^1.13.0",
"clipboard": "^2.0.4", "clipboard": "^2.0.4",
"core-js": "^2.6.5", "core-js": "^2.6.5",
"downloadjs": "^1.4.7",
"echarts": "5.1.1", "echarts": "5.1.1",
"element-ui": "2.11.1", "element-ui": "2.11.1",
"file-saver": "2.0.1", "file-saver": "2.0.1",

11
src/api/common.js

@ -199,3 +199,14 @@ export function addBorrowFn(params) {
} }
}) })
} }
export function uploadFileFn(params) {
return preview({
url: '/inspectionSystemFile',
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: params,
responseType: 'blob'
})
}

8
src/api/data.js

@ -1,9 +1,15 @@
import api from '@/utils/api' import api from '@/utils/api'
import qs from 'qs' import qs from 'qs'
import preview from '@/utils/preview'
export function initData(url, params) { export function initData(url, params) {
return api({ return api({
url: url + '?' + qs.stringify(params, { indices: false }), url: url + '?' + qs.stringify(params, { indices: false }),
method: 'get' method: 'get'
}) })
} }
export function initData1(url, params) {
return preview({
url: url + '?' + qs.stringify(params, { indices: false }),
method: 'get'
})
}

49
src/components/Crud/crud.js

@ -1,4 +1,4 @@
import { initData } from '@/api/data' import { initData, initData1 } from '@/api/data'
import Vue from 'vue' import Vue from 'vue'
/** /**
@ -10,6 +10,8 @@ function CRUD(options) {
const defaultOptions = { const defaultOptions = {
// 标题 // 标题
title: '', title: '',
// 接口根路由
rootApi: 0,
// 请求数据的url // 请求数据的url
url: '', url: '',
// 表格数据 // 表格数据
@ -116,20 +118,37 @@ function CRUD(options) {
} }
return new Promise((resolve) => { return new Promise((resolve) => {
// 请求数据 // 请求数据
initData(crud.url, crud.getQueryParams()).then(data => { if (crud.rootApi) {
crud.page.total = data.total initData1(crud.url, crud.getQueryParams()).then(data => {
if (data.list) { crud.page.total = data.total
crud.data = data.list if (data.list) {
} else { crud.data = data.list
crud.data = data } else {
} crud.data = data
crud.resetDataStatus() }
// time 毫秒后显示表格 crud.resetDataStatus()
setTimeout(() => { // time 毫秒后显示表格
callVmHook(crud, CRUD.HOOK.afterRefresh) setTimeout(() => {
}, crud.time) callVmHook(crud, CRUD.HOOK.afterRefresh)
resolve(data) }, crud.time)
}) resolve(data)
})
} else {
initData(crud.url, crud.getQueryParams()).then(data => {
crud.page.total = data.total
if (data.list) {
crud.data = data.list
} else {
crud.data = data
}
crud.resetDataStatus()
// time 毫秒后显示表格
setTimeout(() => {
callVmHook(crud, CRUD.HOOK.afterRefresh)
}, crud.time)
resolve(data)
})
}
}) })
}, },
/** /**

3
src/utils/index.js

@ -160,7 +160,7 @@ export function html2Text(val) {
export function objectMerge(target, source) { export function objectMerge(target, source) {
/* Merges two objects, /* Merges two objects,
giving the last one precedence */ giving the last one precedence */
if (typeof target !== 'object') { if (typeof target !== 'object') {
target = {} target = {}
@ -411,6 +411,7 @@ export function downloadFile(obj, name, suffix) {
* @param suffix * @param suffix
*/ */
export function downloadFileUrl(url, name, suffix) { export function downloadFileUrl(url, name, suffix) {
console.log(url)
buildClick(url, name, suffix) buildClick(url, name, suffix)
} }

18
src/views/borrow/borrow-history.vue

@ -230,24 +230,6 @@ export default {
this.departmentId = 0 this.departmentId = 0
this.ifMeasure = false this.ifMeasure = false
}, },
// EXCEL
beforeUpload(file) {
const isExcel =
file.type === 'application/vnd.ms-excel' ||
file.type ===
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
if (!isExcel) {
this.$notify.error('只能上传xls/xlsx格式的文件')
return false
}
const fd = new FormData()
fd.append('file', file)
fd.append('type', 3)
// uploadInstrumentData(fd).then(() => {
// this.$notify.success('')
// this.crud.toQuery()
// })
},
// //
resetChecks() { resetChecks() {

252
src/views/document/index.vue

@ -2,85 +2,114 @@
<div class="app-container"> <div class="app-container">
<!--头部选项--> <!--头部选项-->
<div class="head-container"> <div class="head-container">
<div v-if="crud.props.searchToggle"> <div class="searchBox">
<el-input v-model="query.filename" placeholder="请输入文件名称" style="width: 200px;" class="filter-item" clearable @keyup.enter.native="crud.toQuery" /> <el-input
v-model="query.filename"
placeholder="请输入文件名称"
style="width: 200px"
class="filter-item"
clearable
@keyup.enter.native="crud.toQuery"
/>
<query :crud="crud" /> <query :crud="crud" />
</div> <el-upload
<crud :permission="permission"> ref="upload"
<el-button slot="right" class="filter-item" icon="el-icon-download" type="warning" @click="exportExcel"> slot="right"
class="upload-demo"
:show-file-list="false"
:before-upload="beforeUpload"
accept=".pdf"
action=""
>
<el-button slot="trigger" size="middle" type="primary">
上传文件 上传文件
</el-button> </el-button>
</crud> </el-upload>
</div>
</div> </div>
<!--表格内容--> <!--表格内容-->
<CustomTable ref="customTable" :col-configs="colConfigs" :columns="columns" :crud="crud"> <CustomTable
<el-table-column v-if="checkPermission(permission.edit)" slot="operation" align="center" width="100" label="操作"> ref="customTable"
:col-configs="colConfigs"
:columns="columns"
:crud="crud"
>
<el-table-column
slot="operation"
align="center"
width="100"
label="操作"
>
<template slot-scope="scope"> <template slot-scope="scope">
<Edit :permission="permission" :data="scope.row" :disabled-edit="false" /> <el-button type="text" @click="downLoad(scope.row)">
在线预览
</el-button>
<el-button type="text" @click="downLoadFn(scope.row)">
下载
</el-button>
<el-button type="text" @click="checkHistory(scope.row)">
查看历史版本
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</CustomTable> </CustomTable>
<pagination /> <pagination />
<el-dialog title="查看历史版本" :visible.sync="dialogTableVisible">
<el-table :data="gridData">
<el-table-column property="inspectionSystemFileId" label="文件ID" />
<el-table-column property="filename" label="文件名称" />
<el-table-column property="suffix" label="文件后缀" />
<el-table-column property="updateTime" label="更新时间" />
</el-table>
<el-pagination
:page-size="params.pageSize"
layout="total,prev, pager, next"
:total="subTotal"
@current-change="handleCurrentChange"
/>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import CRUD, { form, header, presenter } from '@/components/Crud/crud' import CRUD, { header, presenter } from '@/components/Crud/crud'
import Crud from '@/components/Crud'
import Query from '@/components/Crud/Query' import Query from '@/components/Crud/Query'
import Edit from '@/components/Crud/Edit'
import CustomTable from '@/components/Crud/Table' import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination' import Pagination from '@/components/Crud/Pagination'
import CrudDocumentArchives from '@/api/document_archives' import CrudDocumentArchives from '@/api/document_archives'
import { getDicDataListByTypeName } from '@/api/dic_data' import { uploadFileFn } from '@/api/common'
import { parseTime, downloadFile, downloadFileUrl } from '@/utils' import { downloadFileUrl } from '@/utils'
import { exportReport } from '@/api/export_document' import download from 'downloadjs'
// crudpresenter // crudpresenter
const defaultCrud = presenter(CRUD({ const defaultCrud = presenter(
title: '检验机构体系文件管理', CRUD({
url: '/documentArchives', title: '检验机构体系文件管理',
orderBy: ['id desc'], url: '/inspectionSystemFile/list',
crudMethod: { ...CrudDocumentArchives } orderBy: ['id desc'],
})) rootApi: 1,
crudMethod: { ...CrudDocumentArchives }
// form })
const defaultForm = form({ )
id: null,
documentName: '',
examiningUnit: '',
borrower: '',
borrowedDate: '',
returnDate: '',
borrowedState: '',
remark: ''
})
//
const PrefixPlusText = {
props: ['value', 'functions'],
template: `
<el-tag v-if="functions(value) === '未归还'" type="danger" effect="dark"><span v-html="functions(value)"></span></el-tag>
<el-tag v-else type="success" effect="dark"><span v-html="functions(value)"></span></el-tag>
`
}
export default { export default {
name: 'DocumentArchivesList', name: 'DocumentArchivesList',
components: { Pagination, Query, Crud, CustomTable, Edit }, components: { Pagination, Query, CustomTable },
mixins: [defaultCrud, defaultForm, header()], mixins: [defaultCrud, header()],
data() { data() {
return { return {
action: this.preview.baseURL + '/inspectionSystemFile',
fileList: [],
colConfigs: [ colConfigs: [
{ prop: 'filename', label: '文件名', align: 'center' }, { prop: 'filename', label: '文件名', align: 'center' },
{ prop: 'updateBy', label: '修改人', align: 'center', formatter: this.formatter.getChineseName }, { prop: 'createBy', label: '创建人', align: 'center', formatter: this.formatter.getChineseName },
{ prop: 'createBy', label: '创建', align: 'center' }, { prop: 'createTime', label: '创建时间', align: 'center' },
{ prop: 'createTime ', label: '创建时间', align: 'center' }, {
{ prop: 'jieyueTime', label: '借阅时间', align: 'center' }, prop: 'suffix',
{ prop: 'suffix ', label: '文件名后缀', align: 'center', formatter: this.formatter.getChineseName }, label: '文件名后缀',
{ prop: 'zfState', label: '作废状态', align: 'center', component: PrefixPlusText }, align: 'center'
{ prop: 'updateBy', label: '修改人', align: 'center' }, },
{ {
prop: 'updateTime', prop: 'updateTime',
label: '更新时间', label: '更新时间',
@ -94,73 +123,82 @@ export default {
edit: ['documentArchives:update'], edit: ['documentArchives:update'],
del: ['documentArchives:delete'] del: ['documentArchives:delete']
}, },
rules: { dialogTableVisible: false,
documentName: [ params: {
{ required: true, message: '请填写报告编号', trigger: 'blur' } inspectionSystemFileId: '',
], pageNum: 1,
borrower: [ pageSize: 10
{ required: true, message: '请填写借阅人', trigger: 'blur' }
],
borrowedDate: [
{ required: true, message: '请选择借阅时间', trigger: 'blur' }
],
agreedReturnDate: [
{ required: true, message: '请选择归还时间', trigger: 'blur' }
],
borrowedState: [
{ required: true, message: '请选择借阅状态', trigger: 'change' }
]
}, },
reportRules: { gridData: [],
year: [ subTotal: 0
{ required: true, message: '请选择年度信息', trigger: 'blur' }
],
equipmentTypeCode: [
{ required: true, message: '请选择设备种类', trigger: 'change' }
],
category: [
{ required: true, message: '请选择检验类别', trigger: 'change' }
]
},
borrowedStateList: [],
dialogVisible: false,
reportForm: {},
categoryList: [],
sedirectoryList: []
} }
}, },
mounted() { mounted() {},
this.initDicDataList()
},
methods: { methods: {
initDicDataList() { handleRemove(file, fileList) {
// console.log(file, fileList)
getDicDataListByTypeName('borrowed_state').then(data => { this.borrowedStateList = data }) },
// handlePreview(file) {
getDicDataListByTypeName('sedirectory_code').then(data => { this.sedirectoryList = data }) console.log(file)
// },
getDicDataListByTypeName('inspection_category').then(data => { this.categoryList = data }) checkHistory(row) {
this.dialogTableVisible = true
this.params.inspectionSystemFileId = row.id
this.getSubList()
}, },
exportExcel() { getSubList() {
CrudDocumentArchives.exportExcel(this.crud.query).then(data => { this.preview({
downloadFile(data, parseTime(new Date()) + '-' + this.crud.title + '数据', 'xlsx') url: '/inspectionSystemFileLog/list',
method: 'get',
params: this.params
}).then(res => {
this.gridData = res.list
this.subTotal = res.total
}) })
}, },
exportReport() { handleCurrentChange(val) {
this.$refs['reportForm'].validate((valid) => { this.params.pageNum = val
if (valid) { this.getSubList()
exportReport(this.reportForm).then(data => { },
downloadFileUrl(data.data, parseTime(new Date()) + '报告导出数据', 'xlsx') handleExceed(files, fileList) {
this.dialogVisible = false this.$message.warning(
}) `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
} else { files.length + fileList.length
return false } 个文件`
} )
},
// EXCEL
beforeUpload(file) {
const fd = new FormData()
fd.append('file', file)
uploadFileFn(fd).then(() => {
this.$notify.success('导入数据成功。')
this.crud.toQuery()
}) })
}, },
downLoad(item) {
downloadFileUrl('http://test.sdma.mingansei.com/sdma-preview/SJJY/inspectionSystemFile/' + item.id + item.suffix, item.filename, item.suffix)
},
downLoadFn(item) {
download('http://test.sdma.mingansei.com/sdma-preview/SJJY/inspectionSystemFile/' + item.id + item.suffix)
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`)
},
closeReportDialog() { closeReportDialog() {
this.$refs['reportForm'].resetFields() this.$refs['reportForm'].resetFields()
} }
} }
} }
</script> </script>
<style scoped>
.searchBox{
margin-bottom: 20px;
display: flex;
}
.upload-demo{
margin-left: 20px;
width: 200px;
}
</style>

17
src/views/ysjl/components/manufacture_yb_list.vue

@ -3,9 +3,9 @@
<div class="filter-container"> <div class="filter-container">
<el-form> <el-form>
<el-form-item> <el-form-item>
<el-input v-model="listQuery.searchYsjl.jilubianhao" placeholder="记录编号" clearable size="small" style="width: 200px" @keyup.enter.native="handleFilter" /> <el-input v-model="listQuery.jilubianhao" placeholder="记录编号" clearable size="small" style="width: 200px" @keyup.enter.native="handleFilter" />
<el-input v-model="listQuery.searchYsjl.zhizaodanwei" placeholder="单位名称" clearable size="small" style="width: 200px" @keyup.enter.native="handleFilter" /> <el-input v-model="listQuery.zhizaodanwei" placeholder="单位名称" clearable size="small" style="width: 200px" @keyup.enter.native="handleFilter" />
<el-input v-model="listQuery.searchYsjl.chanpinbianhao" placeholder="产品编号" clearable size="small" style="width: 200px" @keyup.enter.native="handleFilter" /> <el-input v-model="listQuery.chanpinbianhao" placeholder="产品编号" clearable size="small" style="width: 200px" @keyup.enter.native="handleFilter" />
<el-button size="small" type="primary" icon="el-icon-search" @click="handleFilter"> <el-button size="small" type="primary" icon="el-icon-search" @click="handleFilter">
查询 查询
</el-button> </el-button>
@ -93,11 +93,10 @@ export default {
pageRow: 20, // pageRow: 20, //
order: undefined, // order: undefined, //
sort: undefined, // sort: undefined, //
searchYsjl: { shebeizhongleidaima: '2000',
shebeizhongleidaima: '2000', jianyanleibie: 'ZJ',
jianyanleibie: 'ZJ', hasLook: 2
hasLook: 2
}
}, },
multipleSelection: [], multipleSelection: [],
dialogFormVisible: false, dialogFormVisible: false,
@ -118,7 +117,7 @@ export default {
}, },
methods: { methods: {
getList() { getList() {
this.listQuery.searchYsjl.cjState = 'bggl' this.listQuery.cjState = 'bggl'
this.api({ this.api({
url: '/ysjl/getList', url: '/ysjl/getList',
method: 'get', method: 'get',

20
src/views/ysjl/components/original_yb_list.vue

@ -10,10 +10,10 @@
</sticky> </sticky>
<el-form style="margin-top: 10px;"> <el-form style="margin-top: 10px;">
<el-form-item> <el-form-item>
<el-input v-model="listQuery.searchYsjl.jilubianhao" placeholder="记录编号" clearable style="width: 200px" @keyup.enter.native="handleFilter" /> <el-input v-model="listQuery.jilubianhao" placeholder="记录编号" clearable style="width: 200px" @keyup.enter.native="handleFilter" />
<el-input v-model="listQuery.searchYsjl.zhucedaima" placeholder="注册代码" clearable style="width: 240px" @keyup.enter.native="handleFilter" /> <el-input v-model="listQuery.zhucedaima" placeholder="注册代码" clearable style="width: 240px" @keyup.enter.native="handleFilter" />
<el-input v-model="listQuery.searchYsjl.shiyongdanwei" placeholder="使用单位" clearable style="width: 400px" @keyup.enter.native="handleFilter" /> <el-input v-model="listQuery.shiyongdanwei" placeholder="使用单位" clearable style="width: 400px" @keyup.enter.native="handleFilter" />
<el-select v-model="listQuery.searchYsjl.bglx" placeholder="报告类型" style="width: 160px"> <el-select v-model="listQuery.bglx" placeholder="报告类型" style="width: 160px">
<el-option <el-option
v-for="item in bglxOptions" v-for="item in bglxOptions"
:key="item.value" :key="item.value"
@ -23,7 +23,7 @@
</el-select> </el-select>
<br> <br>
<span class="radio-group-label">查看类型</span> <span class="radio-group-label">查看类型</span>
<el-radio-group v-model="listQuery.searchYsjl.createBy" @change="handleFilter"> <el-radio-group v-model="listQuery.createBy" @change="handleFilter">
<el-radio :label="$store.getters.userId"> <el-radio :label="$store.getters.userId">
只看创建人 只看创建人
</el-radio> </el-radio>
@ -130,9 +130,7 @@ export default {
pageRow: 20, // pageRow: 20, //
order: undefined, // order: undefined, //
sort: undefined, // sort: undefined, //
searchYsjl: { createBy: this.$store.getters.departmentId === 70 ? this.$store.getters.userId : undefined,
createBy: this.$store.getters.departmentId === 70 ? this.$store.getters.userId : undefined
},
hasChild: true, hasChild: true,
copyPage: false, copyPage: false,
link: 2 link: 2
@ -158,7 +156,7 @@ export default {
}, },
methods: { methods: {
getList() { getList() {
this.listQuery.searchYsjl.cjState = 'bggl' this.listQuery.cjState = 'bggl'
this.api({ this.api({
url: '/ysjl/getList', url: '/ysjl/getList',
method: 'get', method: 'get',
@ -190,9 +188,7 @@ export default {
this.multipleSelection = val this.multipleSelection = val
}, },
clearQuery() { clearQuery() {
this.$set(this.listQuery, 'searchYsjl', { this.$set(this.listQuery, {})
createBy: this.$store.getters.userId
})
this.getList() this.getList()
}, },
generatePdf(viewType) { generatePdf(viewType) {

Loading…
Cancel
Save