You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

353 lines
12 KiB

<template>
<div class="app-container">
<div class="filter-container">
<sticky style="margin-bottom: 10px;">
<div class="sub-navbar">
<el-button v-show="hasPerm('zjd:QRZJ')" type="warning" icon="el-ok" @click="createZjdShow">
确认转交单
</el-button>
<el-button v-show="hasPerm('zjd:CXZJ')" type="danger" icon="el-cancel" @click="revokeZjd">
撤回转交单
</el-button>
<!-- <el-button type="success" icon="el-icon-printer" @click="viewPrintZjd">
预览转交单
</el-button>
<el-button type="primary" icon="el-icon-printer" @click="batchPrintZjd">
打印转交单
</el-button>-->
</div>
</sticky>
<el-form>
<el-form-item>
<el-input v-model="listQuery.searchZjd.bianhao" placeholder="转交单编号" clearable style="width: 200px" @keyup.enter.native="handleFilter" />
<el-input v-model="listQuery.searchZjd.zhuanjiaoren" placeholder="转交人" clearable style="width: 200px" @keyup.enter.native="handleFilter" />
<el-input v-model="listQuery.searchZjd.shiyongdanwei" placeholder="使用单位" clearable style="width: 200px" @keyup.enter.native="handleFilter" />
<el-button type="primary" size="small" icon="el-icon-search" @click="handleFilter">
查询
</el-button>
<el-button type="info" size="small" icon="el-icon-close" @click="clearQuery">
清空
</el-button>
</el-form-item>
</el-form>
</div>
<el-table
ref="list"
v-adaptive="{bottomOffset: 50}"
height="0"
:data="list"
border
fit
highlight-current-row
stripe
width="100%"
size="small"
@row-click="onRowClick"
@selection-change="handleSelectionChange"
@sort-change="sortChange"
>
<el-table-column type="selection" width="40" />
<el-table-column fixed="left" align="center" label="序号" width="60">
<template slot-scope="scope">
<span v-text="getIndex(scope.$index)" />
</template>
</el-table-column>
<el-table-column align="center" label="转交单编号" prop="serialNumber" width="120" sortable="custom" />
<el-table-column :formatter="formatter.getChineseName" align="center" label="转交人" prop="createBy" width="90" />
<el-table-column align="center" label="转交日期" prop="createTime" width="140" sortable="custom" />
<el-table-column :formatter="formatter.getChineseName" align="center" label="确认人" prop="querenren" width="160" sortable="custom" />
<el-table-column align="center" label="确认日期" prop="querenriqi" width="240" />
<el-table-column align="center" label="操作" min-width="60">
<template slot-scope="scope">
<el-button type="primary" size="mini" circle icon="el-icon-view" title="编辑" @click="lookZjd(scope.$index)" />
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page-num.sync="listQuery.pageNum" :page-row.sync="listQuery.pageRow" @pagination="getList" />
<el-dialog title="确认转交单" :visible.sync="zhuanjiaoVisible" width="30%">
<el-form ref="zhuanjiao" :model="zhuanjiao" :rules="rules" class="el-form" label-position="right" label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="确认人" prop="querenren">
<el-input v-model="zhuanjiao.querenren" type="text" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="确认日期" prop="querenriqi">
<el-date-picker v-model="zhuanjiao.querenriqi" type="date" value-format="yyyy-MM-dd" placeholder="转交日期" style="width: 100%;" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="success" @click="commitZjd">
确 认
</el-button>
<el-button @click="zhuanjiaoVisible = false">
取 消
</el-button>
</div>
</el-dialog>
<el-dialog title="转交单明细表" :visible.sync="zjdInfoVisible" width="70%">
<el-table ref="zjdList" :data="zjdList" size="small" style="width: 100%" border fit highlight-current-row @selection-change="handleDialogSelectionChange">
<el-table-column type="selection" width="45" />
<el-table-column align="center" label="序号" width="50" fixed="left">
<template slot-scope="scope">
<span v-text="getIndex(scope.$index)" />
</template>
</el-table-column>
<el-table-column align="center" label="报告编号" prop="baogaobianhao" width="240px;" />
<el-table-column align="center" label="使用单位" prop="shiyongdanwei" width="240px;" />
<el-table-column align="center" label="区划名称" prop="quhuamingcheng" width="80" />
<el-table-column align="center" label="注册代码" prop="zhucedaima" width="160" />
<el-table-column align="center" label="使用登记编号" prop="shiyongdengjibianhao" width="160" />
<el-table-column align="center" label="检验日期" prop="jianyanjieshuriqi" width="160" />
</el-table>
</el-dialog>
<iframe :src="printbutton" frameborder="0" scrolling="no" height="0px" aria-disabled="true" />
</div>
</template>
<script>
import Sticky from '@/components/Sticky'
import Pagination from '@/components/Pagination'
export default {
name: 'ZjdReportList',
components: { Sticky, Pagination },
data() {
return {
total: 0,
list: [],
zjdList: [],
listQuery: {
pageNum: 1, // 页码
pageRow: 20, // 每页条数
order: 'id', // 排序字段
sort: 'desc', // 排序方式
searchZjd: {
departmentId: this.$store.getters.departmentId
}
},
flowUserList: [],
dialogFormVisible: false,
multipleSelection: [],
jylbList: [],
userList: [],
zhuanjiaoVisible: false,
zjdInfoVisible: false,
printbutton: '',
zhuanjiao: {
querenren: '',
querenriqi: ''
},
rules: {
querenren: [{ required: true, message: '确认人不能为空', trigger: 'blur', validator: this.validator }],
querenriqi: [{ required: true, message: '确认日期不能为空', trigger: 'blur', validator: this.validator }]
}
}
},
created() {
this.getList()
this.jylbList = this.$store.getters.allCategory
this.userList = this.$store.getters.allUser
},
mounted() {
const that = this
this.common.$on('zjd-list', function() {
that.handleFilter()
})
},
methods: {
async validator(rule, value, callback) {
if (!value) {
callback(new Error(rule.message))
} else {
callback()
}
},
getList() {
this.api({
url: '/zjd/list',
method: 'get',
params: this.listQuery
}).then(data => {
this.list = data.list
this.total = data.total
})
},
sortChange(column) {
this.listQuery.order = column.prop
this.listQuery.sort = column.order.replace('ending', '')
this.getList()
},
getIndex($index) {
// 表格序号
return (this.listQuery.pageNum - 1) * this.listQuery.pageRow + $index + 1
},
handleFilter() {
// 查询事件
this.listQuery.pageNum = 1
this.getList()
},
onRowClick(row) {
this.$refs.list.toggleRowSelection(row)
},
handleSelectionChange(val) {
this.multipleSelection = val
},
handleDialogSelectionChange(val) {
this.selection = val
},
clearQuery() {
this.$set(this.listQuery, 'searchZjd', {
departmentId: this.$store.getters.departmentId,
createBy: this.$store.getters.userId,
printState: 0
})
this.getList()
},
createZjdShow: function() { // 创建转交单
if (this.multipleSelection.length === 0) {
this.$message({ message: '请在列表选择操作的数据。', type: 'warning' })
return false
}
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].state) {
this.$message({ message: '存在已确认的转交单,请勿重新操作。', type: 'warning' })
return false
}
}
this.api({
url: '/zjd/complete',
method: 'post',
data: {
zjdIds: this.$refs.list.selection.map(row => row.id)
}
}).then(data => {
this.getList()
})
},
commitZjd() {
if (this.multipleSelection.length === 0) {
this.$message({ message: '请在列表选择数据后在尝试。', type: 'warning' })
return false
}
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].state) {
this.$message({ message: '存在已确认的转交单,请勿重新操作。', type: 'warning' })
return false
}
}
this.zhuanjiao.zjdIds = this.$refs.list.selection.map(rw => {
return rw.id
}).join(',')
this.api({
url: 'zjd/updateZjd',
method: 'post',
data: this.zhuanjiao
}).then(data => {
if (data.returnCode === undefined) {
this.$message({ message: data, type: 'success' })
} else {
this.$message({ message: data.returnMsg, type: 'warning' })
}
this.getList()
this.zhuanjiaoVisible = false
})
},
lookZjd($index) {
this.api({
url: '/zjd/getZjdInfoList',
method: 'get',
params: {
zjdId: this.list[$index].id
}
}).then(data => {
this.zjdList = data
this.zjdInfoVisible = true
})
},
revokeZjd() {
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].state) {
this.$message({ message: '存在已确认的转交单,请勿重新操作。', type: 'warning' })
return false
}
}
// 撤销操作
this.api({
url: '/zjd/revoke',
method: 'post',
data: {
zjdIds: this.multipleSelection.map(row => row.id)
},
paramsSerializer: function(data) {
return require('qs').stringify(data, { indices: false })
}
}).then(data => {
this.getList()
})
},
batchPrintZjd() {
if (this.multipleSelection.length === 0) {
this.$message({ message: '请选择至少一条数据进行打印!', type: 'error' })
return false
}
this.api({
url: '/zjd/printZjdBatch',
method: 'get',
params: {
zjdIds: this.$refs.list.selection.map(zjd => {
return zjd.id
}).join(',')
}
}).then(data => {
this.preview({
url: '/print/generatePdfListingBatch',
method: 'post',
data: {
list: data,
viewType: 'ZJD'
}
}).then(data => {
if (data === 'success') {
this.preview({
url: '/print/createXmlOther',
method: 'post',
params: {
ids: this.$refs.list.selection.map(zjd => {
return zjd.id
}).join(','),
type: 'ZJD'
}
}).then(data => {
this.printbutton = 'ReportPrintApp://' + data
})
} else {
this.$message({ message: '未能成功调用打印程序!', type: 'error' })
}
})
})
},
viewPrintZjd() { // 预览转交单
if (this.multipleSelection.length === 0) {
this.$message({ message: '请选择至少一条数据进行打印!', type: 'error' })
return false
}
this.preview({
url: '/print/generatePdfZjd',
method: 'get',
params: {
zjdId: this.$refs.list.selection[0].id
}
}).then(data => {
data = data.replace(/\\/g, '/')
window.open(data)
})
}
}
}
</script>