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.
 
 
 
 

378 lines
13 KiB

<template>
<div class="app-container">
<div class="filter-container">
<sticky style="margin-bottom: 10px;">
<div class="sub-navbar">
<el-button type="success" icon="el-icon-printer" @click="batchPrintHzd">
回执单
</el-button>
<el-button type="warning" icon="el-icon-circle-close" @click="errorBjd">
异常收回
</el-button>
<el-button type="danger" icon="el-icon-circle-close" @click="invalidBjd">
作废
</el-button>
</div>
</sticky>
<el-form>
<el-form-item>
<el-input v-model="listQuery.serialNumber" placeholder="报检单号/流水号" clearable style="width: 200px" @keyup.enter.native="handleFilter" />
<el-select v-model="listQuery.shebeizhongleidaima" placeholder="请选择设备种类" clearable @change="handleFilter">
<el-option v-for="item in sbzlList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-input v-model="listQuery.shiyongdanwei" placeholder="使用单位名称" clearable style="width: 300px" @keyup.enter.native="handleFilter" />
<el-button type="primary" icon="el-icon-search" @click="handleFilter">
查询
</el-button>
<br>
<el-select v-model="listQuery.jianyanleibie" placeholder="请选择检验类别" clearable @change="handleFilter">
<el-option key="" label="全部" value="" />
<el-option key="JJ" label="监督检验" value="JJ" />
<el-option key="DJ" label="定期检验" value="DJ" />
</el-select>
<el-input v-model="listQuery.zhizaodanwei" placeholder="制造单位名称" clearable style="width: 300px" @keyup.enter.native="handleFilter" />
<el-date-picker v-model="listQuery.shouliriqi" type="date" value-format="yyyy-MM-dd" placeholder="选择报检日期" style="width: 180px" />
<br>
<span class="radio-group-label">报检状态:</span>
<el-radio-group v-model="listQuery.bjState" @change="handleFilter">
<el-radio :label="undefined">
全部
</el-radio>
<el-radio :label="0">
新建/预审
</el-radio>
<el-radio :label="1">
待审核
</el-radio>
<el-radio :label="2">
已审核
</el-radio>
<el-radio :label="5">
异常收回
</el-radio>
<el-radio :label="6">
异常退回
</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</div>
<el-table
ref="bjdList"
v-adaptive="{bottomOffset: 50}"
height="0"
:data="list"
element-loading-text="拼命加载中"
size="small"
border
fit
highlight-current-row
stripe
@row-click="onRowClick"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="45" />
<el-table-column 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" min-width="80" />
<el-table-column align="center" label="设备种类" prop="shebeizhonglei" min-width="50" />
<el-table-column align="center" label="检验类别" prop="jianyanleibie" min-width="50">
<template slot-scope="scope">
<span v-if="scope.row.jianyanleibie === 'DJ'">定期检验</span>
<span v-else>监督检验</span>
</template>
</el-table-column>
<el-table-column align="center" label="使用单位" prop="shiyongdanwei" min-width="150" />
<el-table-column align="center" label="制造单位" prop="zhizaodanwei" min-width="120" />
<el-table-column align="center" label="报检日期" prop="baojianriqi" min-width="60" />
<el-table-column align="center" label="报检状态" prop="bjState" min-width="50">
<template slot-scope="scope">
<el-tag v-if="scope.row.bjState===0" type="success">
新建/预审
</el-tag>
<el-tag v-else-if="scope.row.bjState===1" type="primary">
待审核
</el-tag>
<el-tag v-else-if="scope.row.bjState===2" type="info">
已审核
</el-tag>
<el-tag v-else-if="scope.row.bjState===3" type="danger">
不予受理
</el-tag>
<el-tag v-else-if="scope.row.bjState===4" type="warning">
补正通知
</el-tag>
<el-tag v-else-if="scope.row.bjState===5" type="danger">
异常收回
</el-tag>
<el-tag v-else-if="scope.row.bjState===6" type="danger">
异常退回
</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="设备台数" prop="totalNum" min-width="50" />
<el-table-column :formatter="formatter.getChineseName" align="center" label="受理人员" prop="shouliren" min-width="50" />
<el-table-column align="center" label="操作" min-width="60">
<template slot-scope="scope">
<el-button type="primary" size="mini" circle icon="el-icon-edit" title="编辑" @click="editBjd(scope.$index)" />
<el-button v-show="scope.row.bjState === 3 || scope.row.bjState === 4" size="mini" type="info" icon="el-icon-message" title="查看原因" circle @click="viewInfo(scope.row.bjdBeizhu)" />
<el-button v-show="scope.row.bjState === 2 || scope.row.bjState === 5 || scope.row.bjState === 6" type="success" size="mini" circle icon="el-icon-view" title="预览回执单" @click="bjdService.viewHzd(scope.row.id)" />
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page-num.sync="listQuery.pageNum" :page-row.sync="listQuery.pageSize" style="float: left" @pagination="getList" />
<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'
// import store from '../../store'
// import router from '../../router'
import qs from 'qs'
export default {
name: 'ProjectQyList',
components: { Sticky, Pagination },
data() {
return {
total: 0,
list: [],
listQuery: {
pageNum: 1, // 页码
pageSize: 20, // 每页条数
orderBy: 'id desc',
zfState: false,
shoulikeshi: undefined,
shouliren: undefined,
bjState: undefined,
dataSource: 1
},
sbzlList: [],
ids: '',
multipleSelection: [],
params: {
bjdIds: this.ids
},
printbutton: ''
}
},
created() {
this.getList()
this.getSbzlList()
},
mounted() {
const that = this
this.common.$on('bjd-list', function() {
that.handleFilter()
})
},
methods: {
getList() {
this.apibjd({
url: '/bjd/list',
method: 'get',
params: this.listQuery
}).then(data => {
this.list = data.list
this.total = data.total
})
},
getSbzlList() {
this.api({
url: '/sedirectory/getList',
method: 'get',
params: {
sbzl: undefined,
level: '1'
}
}).then(data => {
this.sbzlList = data
})
},
getIndex($index) {
// 表格序号
return (this.listQuery.pageNum - 1) * this.listQuery.pageSize + $index + 1
},
handleFilter() {
// 查询事件
this.listQuery.pageNum = 1
this.getList()
},
handleCommand(item) {
this.$router.push({ path: '/bjd/bjd-dj-input/null/' + item.value + '/' + item.label + '/newBuild' })
},
// 表格单击选中行
onRowClick(row) {
this.$refs.bjdList.toggleRowSelection(row)
},
// 获取选中行的bdjId
handleSelectionChange: function(val) {
this.multipleSelection = val
},
handleDialogSelectionChange(val) {
this.selection = val
},
// 作废报检单
invalidBjd: function() {
this.ids = []
if (this.multipleSelection.length === 0) {
this.$message({
type: 'error',
message: '请选中需要删除的数据!'
})
return false
} else {
for (let i = 0; i < this.multipleSelection.length; i++) {
this.$prompt(
'请输入作废原因',
'共' +
this.multipleSelection.length +
'条报检项目将作废,是否继续?',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /\S/,
inputErrorMessage: '作废原因不能为空'
}
)
.then(({ value }) => {
for (let i = 0; i < this.multipleSelection.length; i++) {
this.ids.push(this.multipleSelection[i].id)
}
this.apibjd({
url: '/bjd/updBjdToZf',
method: 'get',
params: { reason: value, bjdId: this.ids },
paramsSerializer: function(params) {
return qs.stringify(params, { indices: false })
}
}).then(() => {
this.$notify.success('操作成功!')
this.getList()
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消作废'
})
})
}
}
},
editBjd($index) {
const bjd = this.list[$index]
let type = '/update'
if (bjd.bjState === 2 || bjd.bjState === 3) {
type = '/finish'
}
if (bjd.jianyanleibie === 'DJ') {
this.$router.push({ path: '/bjd/bjd-dj-input/' + bjd.id + '/' + bjd.shebeizhongleidaima + '/' + bjd.shebeizhonglei + type })
} else if (bjd.jianyanleibie === 'JJ') {
this.$router.push({ path: '/bjd/bjd-jj-input/' + bjd.id + '/' + bjd.shebeizhongleidaima + '/' + bjd.shebeizhonglei + type })
}
},
// 打印回执单
batchPrintHzd() {
if (this.multipleSelection.length === 0) {
this.$message({ message: '请选择至少一条数据进行打印!', type: 'error' })
return false
}
const arr = this.$refs.bjdList.selection.map((bjd) => {
return bjd.id
})
console.log(arr)
this.preview({
url: '/print/batchGeneratePdfHzd',
method: 'get',
params: {
bjdIds: arr
},
paramsSerializer: function(params) {
return qs.stringify(params, { indices: false })
}
}).then((data) => {
this.preview({
url: '/print/createXmlOther',
method: 'post',
params: {
ids: arr,
type: 'HZD'
},
paramsSerializer: function(params) {
return qs.stringify(params, { indices: false })
}
}).then((data) => {
this.printbutton = 'ReportPrintApp://' + data
})
})
},
// 打印回执单
printHzd() {
if (this.multipleSelection.length > 1) {
this.$message({ message: '只能打印一份报检单', type: 'error' })
return
}
this.apibjd({
url: '/bjd/printHzd',
method: 'get',
params: {
bjdIds: this.multipleSelection[0].id
}
}).then(data => {
this.preview({
url: '/print/generatePdfListing',
method: 'post',
data: {
info: data.bjd,
paramList: data.renwu,
viewType: 'HZD'
}
}).then(data => {
data = data.replace(/\\/g, '/')
// router.push({ path: '/preview/1/1/urlPath?src=' + store.getters.prodName + '/static/web/viewer.html?file=' + encodeURIComponent(data) + '&v=' + Math.random() })
window.open(data)
})
})
},
viewInfo(reason) {
this.$message({ message: reason, type: 'info' })
},
errorBjd() {
// 异常收回
this.$confirm('报检项目将进行异常收回,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.multipleSelection.length !== 1) {
this.$message({ message: '只允许单台报检单收回', type: 'error' })
return false
}
if (this.multipleSelection[0].bjState !== 2) {
this.$message({ message: '非审核通过数据不允许异常收回!', type: 'error' })
return false
}
// 业务
this.apibjd({
url: '/bjd/updBjdToYcsh',
method: 'get',
params: { bjdId: this.multipleSelection[0].id }
}).then(data => {
this.$message.success('异常收回成功!!请修改后重新审核通过!')
this.getList()
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消收回'
})
})
}
}
}
</script>