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.
399 lines
16 KiB
399 lines
16 KiB
<template>
|
|
<div class="app-container">
|
|
<div class="filter-container">
|
|
<sticky style="margin-bottom: 10px;">
|
|
<div class="sub-navbar">
|
|
<el-button type="primary" icon="el-icon-printer" @click="createZjdShow">
|
|
生成转交单
|
|
</el-button>
|
|
<!-- <div style="float:right;">
|
|
<el-badge :value="shoppingSize" :max="99" class="item">
|
|
<el-popover placement="bottom" width="800" trigger="click">
|
|
<div class="filter-container" style="padding-bottom: 3px;">
|
|
<el-button icon="el-icon-sold-out" type="primary" @click="convertZjdByCart">
|
|
生成转交单
|
|
</el-button>
|
|
<el-button type="danger" icon="el-icon-circle-close-outline" @click="clearCart">
|
|
清空购物车
|
|
</el-button>
|
|
</div>
|
|
<el-table ref="shoppingTable" v-adaptive="{bottomOffset: 50}" height="0" :data="shoppingCartData" border style="width: 100%;" @selection-change="handleCartSelectionChange" @row-click="checkCartSelection">
|
|
<el-table-column type="selection" width="40" />
|
|
<el-table-column align="center" label="操作" min-width="65">
|
|
<template slot-scope="scope">
|
|
<el-button type="danger" icon="el-icon-delete" @click="removeCart(scope.$index)" />
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="baogaobianhao" label="报告编号" min-width="120" />
|
|
<el-table-column prop="zhucedaima" label="注册代码" min-width="120" />
|
|
<el-table-column prop="chanpinbianhao" label="出厂编号" min-width="90" />
|
|
<el-table-column prop="shiyongdengjibianhao" label="使用登记证号" min-width="90" />
|
|
</el-table>
|
|
<el-button slot="reference" type="primary">
|
|
<svg-icon icon-class="shoppingCard" />
|
|
</el-button>
|
|
</el-popover>
|
|
</el-badge>
|
|
</div>-->
|
|
</div>
|
|
</sticky>
|
|
<el-form>
|
|
<el-form-item>
|
|
<!-- <el-input v-model="listQuery.serialNumber" placeholder="报检单编号" clearable style="width: 200px" @keyup.enter.native="handleFilter" />-->
|
|
<el-input v-model="listQuery.zhucedaima" placeholder="注册代码" clearable style="width: 200px" @keyup.enter.native="handleFilter" />
|
|
<el-input v-model="listQuery.shiyongdanwei" placeholder="使用单位" clearable style="width: 350px" @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>
|
|
<br>
|
|
<el-input v-model="listQuery.baogaobianhao" placeholder="报告编号" clearable style="width: 200px" @keyup.enter.native="handleFilter" />
|
|
<el-input v-model="listQuery.shiyongdengjibianhao" placeholder="请输入使用登记证编号" clearable style="width: 200px" @keyup.enter.native="handleFilter" />
|
|
<el-input v-model="listQuery.chanpinbianhao" placeholder="请输入产品编号" clearable style="width: 185px" @keyup.enter.native="handleFilter" />
|
|
<el-select v-model="listQuery.neibuleibie" placeholder="请选择检验类别" style="width: 165px" filterable clearable @change="handleFilter">
|
|
<el-option v-for="item in jylbList" v-show="item.parentId" :key="item.code" :label="item.name" :value="item.code" />
|
|
</el-select>
|
|
<el-date-picker v-model="listQuery.xiacijianyanriqi" type="date" value-format="yyyy-MM-dd" placeholder="请选择下次检验日期" style="width:145px" />
|
|
<el-date-picker
|
|
v-model="jianyanriqi"
|
|
type="daterange"
|
|
range-separator="至"
|
|
start-placeholder="检验开始日期"
|
|
end-placeholder="检验结束日期"
|
|
/>
|
|
</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="baogaobianhao" width="120" sortable="custom" />
|
|
<el-table-column :formatter="formatter.formatterCategory" align="center" label="检验类别" prop="jianyanleibie" width="90" />
|
|
<el-table-column align="center" label="使用登记证号" prop="shiyongdengjibianhao" width="140" sortable="custom" />
|
|
<el-table-column align="center" label="注册代码" prop="zhucedaima" width="160" sortable="custom" />
|
|
<el-table-column align="center" label="使用单位" prop="shiyongdanwei" width="240" />
|
|
<el-table-column align="center" label="制造单位" prop="zhizaodanwei" width="240" />
|
|
<el-table-column align="center" label="产品编号/出厂编号" prop="chanpinbianhao" width="140" />
|
|
<el-table-column align="center" label="单位内编号" prop="danweineibubianhao" width="140" sortable="custom" />
|
|
<el-table-column :formatter="formatter.getChineseName" align="center" label="检验人员" prop="jianyanrenyuan" width="120" />
|
|
<el-table-column align="center" label="检验开始日期" prop="jianyankaishiriqi" width="130" sortable="custom" />
|
|
<el-table-column align="center" label="检验结束日期" prop="jianyanjieshuriqi" width="130" sortable="custom" />
|
|
<el-table-column align="center" label="下次检验日期" prop="xiacijianyanriqi" width="130" sortable="custom" />
|
|
<el-table-column align="center" label="检验结论" prop="jianyanjielun" width="80" />
|
|
<!-- <el-table-column fixed="right" align="center" label="操作" min-width="80">
|
|
<template slot-scope="scope">
|
|
<el-button type="primary" @click="addToCart(scope.$index)">
|
|
<svg-icon icon-class="shoppingCard" />
|
|
</el-button>
|
|
</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="createBy">
|
|
<el-input v-model="zhuanjiao.createBy" type="text" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="12">
|
|
<el-form-item label="转交日期" prop="createTime">
|
|
<el-date-picker v-model="zhuanjiao.createTime" 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="zhuanjiaoCartVisible" 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="createBy">
|
|
<el-input v-model="zhuanjiao.createBy" type="text" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="12">
|
|
<el-form-item label="转交日期" prop="createTime">
|
|
<el-date-picker v-model="zhuanjiao.createTime" 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="commitZjdCart">
|
|
提 交
|
|
</el-button>
|
|
<el-button @click="zhuanjiaoCartVisible = false">
|
|
取 消
|
|
</el-button>
|
|
</div>
|
|
</el-dialog>-->
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import Sticky from '@/components/Sticky'
|
|
import Pagination from '@/components/Pagination'
|
|
import Utils from '../../utils/contact.js'
|
|
|
|
export default {
|
|
name: 'ZjbgReportList',
|
|
components: { Sticky, Pagination },
|
|
data() {
|
|
return {
|
|
total: 0,
|
|
list: [],
|
|
listQuery: {
|
|
pageNum: 1, // 页码
|
|
pageRow: 20, // 每页条数
|
|
orderBy: 'id desc' // 排序字段
|
|
},
|
|
flowUserList: [],
|
|
dialogFormVisible: false,
|
|
shoppingCartData: [],
|
|
shoppingSize: 0,
|
|
multipleSelection: [],
|
|
multipleCartSelection: [],
|
|
jianyanriqi: '',
|
|
jylbList: [],
|
|
userList: [],
|
|
zhuanjiaoVisible: false,
|
|
zhuanjiaoCartVisible: false,
|
|
zhuanjiao: {
|
|
createBy: '',
|
|
createTime: '',
|
|
ysjlId: ''
|
|
},
|
|
rules: {
|
|
createBy: [{ required: true, message: '转交人不能为空', trigger: 'blur', validator: this.validator }],
|
|
createTime: [{ required: true, message: '转交日期不能为空', trigger: 'blur', validator: this.validator }]
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
this.getList()
|
|
this.jylbList = this.$store.getters.allCategory.filter(row => row.parentId)
|
|
this.userList = this.$store.getters.allUser
|
|
},
|
|
mounted() {
|
|
const that = this
|
|
this.common.$on('bggl-print-list', function() {
|
|
that.handleFilter()
|
|
})
|
|
},
|
|
methods: {
|
|
async validator(rule, value, callback) {
|
|
if (!value) {
|
|
callback(new Error(rule.message))
|
|
} else {
|
|
callback()
|
|
}
|
|
},
|
|
getList() {
|
|
if (this.jianyanriqi) {
|
|
// 解析
|
|
this.listQuery.jianyankaishiriqi = this.jianyanriqi[0]
|
|
this.listQuery.jianyanjieshuriqi = this.jianyanriqi[1]
|
|
} else {
|
|
this.listQuery.jianyankaishiriqi = ''
|
|
this.listQuery.jianyanjieshuriqi = ''
|
|
}
|
|
this.api({
|
|
url: '/ysjl/getListCanZj',
|
|
method: 'get',
|
|
params: this.listQuery
|
|
}).then(data => {
|
|
this.list = data.list
|
|
this.total = data.total
|
|
})
|
|
},
|
|
sortChange(column) {
|
|
this.listQuery.orderBy = column.prop + ' ' + 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', {
|
|
pageNum: 1,
|
|
pageRow: 20,
|
|
orderBy: 'id desc'
|
|
})
|
|
this.jianyanriqi = ''
|
|
this.getList()
|
|
},
|
|
createZjdShow: function() { // 创建转交单
|
|
if (this.multipleSelection.length === 0) {
|
|
this.$message({ message: '请在列表选择形成转交的数据。', type: 'warning' })
|
|
return false
|
|
}
|
|
if (this.$refs.list.selection.length) {
|
|
const rows = this.$refs.list.selection.filter(row => row.jianyanleibie !== this.$refs.list.selection[0].jianyanleibie)
|
|
if (rows.length) {
|
|
this.$message.warning('请选择相同检验类别的报告!')
|
|
return false
|
|
}
|
|
}
|
|
this.api({
|
|
url: '/zjd',
|
|
method: 'post',
|
|
data: {
|
|
ysjlIds: this.$refs.list.selection.map(row => row.id),
|
|
sbzldm: this.$refs.list.selection[0].shebeizhongleidaima,
|
|
neibuleibie: this.$refs.list.selection[0].neibuleibie
|
|
}
|
|
}).then(data => {
|
|
this.getList()
|
|
Utils.$emit('zjd-list')
|
|
})
|
|
},
|
|
commitZjd() {
|
|
if (this.multipleSelection.length === 0) {
|
|
this.$message({ message: '请在列表选择形成转交的数据。', type: 'warning' })
|
|
return false
|
|
}
|
|
const ysjl = this.$refs.list.selection[0]
|
|
this.zhuanjiao.jianyanleibie = ysjl.jianyanleibie
|
|
this.zhuanjiao.shebeizhongleidaima = ysjl.shebeizhongleidaima
|
|
this.zhuanjiao.ysjlIds = this.$refs.list.selection.map(rw => {
|
|
return rw.id
|
|
}).join(',')
|
|
this.api({
|
|
url: '/zjd',
|
|
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
|
|
Utils.$emit('zjd-list')
|
|
})
|
|
},
|
|
addToCart($index) {
|
|
const base = this.list[$index]
|
|
if (this.shoppingCartData.length === 0) {
|
|
this.shoppingCartData = [base]
|
|
} else {
|
|
for (let i = 0; i < this.shoppingCartData.length; i++) {
|
|
if (base.id === this.shoppingCartData[i].id) {
|
|
this.$message({ message: '该设备已存在购物车中,请勿重复添加。', type: 'warning' })
|
|
return false
|
|
}
|
|
if (base.shebeizhongleidaima !== this.shoppingCartData[i].shebeizhongleidaima) {
|
|
this.$message('请选择同“种类”设备进行转交。')
|
|
return false
|
|
}
|
|
}
|
|
this.shoppingCartData.push(base)
|
|
}
|
|
this.shoppingSize++
|
|
},
|
|
clearCart() {
|
|
this.shoppingCartData = []
|
|
this.shoppingSize = 0
|
|
},
|
|
removeCart($index) {
|
|
if ($index === 0) {
|
|
this.shoppingCartData.splice($index, $index + 1)
|
|
} else {
|
|
this.shoppingCartData.splice($index, 1)
|
|
}
|
|
this.shoppingSize--
|
|
},
|
|
handleCartSelectionChange(val) {
|
|
this.multipleCartSelection = val
|
|
},
|
|
checkCartSelection(row) {
|
|
this.$refs.shoppingTable.toggleRowSelection(row)
|
|
},
|
|
convertZjdByCart() {
|
|
if (this.$refs.list.selection.length) {
|
|
const rows = this.$refs.list.selection.filter(row => row.jianyanleibie !== this.$refs.list.selection[0].jianyanleibie)
|
|
if (rows.length) {
|
|
this.$message.warning('请选择相同检验类别的报告!')
|
|
return false
|
|
}
|
|
}
|
|
this.zhuanjiao.zhuanjiaoriqi = new Date()
|
|
this.zhuanjiao.zhuanjiaoren = this.$store.getters.nickname
|
|
this.zhuanjiaoCartVisible = true
|
|
},
|
|
commitZjdCart() {
|
|
if (this.shoppingCartData.length === 0) {
|
|
this.$message({ message: '请在列表选择形成转交的数据。', type: 'warning' })
|
|
return false
|
|
}
|
|
this.zhuanjiao.ysjlIds = this.shoppingCartData.map(rw => {
|
|
return rw.id
|
|
}).join(',')
|
|
this.api({
|
|
url: '/zjd',
|
|
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.zhuanjiaoCartVisible = false
|
|
Utils.$emit('zjd-list')
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|