Commit 2350095e by yangmengmeng

Merge branch 'dev' of git.patzn.com:wangweidong/pt-tobacco-lims-web into dev

parents 0c491903 000d1e8a
......@@ -171,7 +171,7 @@ export default {
this.$Modal.remove()
this.$Message.success('提交成功!')
this.$emit('on-result-change')
this._page()
await this._page()
}
},
_backCheck() {
......
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="报检管理" name="report">
<DrugSampleProduct ref="reportTabs"></DrugSampleProduct>
</el-tab-pane>
<el-tab-pane label="历史报检管理" name="his">
<DrugProductSampleHis ref="hisTabs"></DrugProductSampleHis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import DrugProductSampleHis from './tabs/DrugProductSampleHis'
import DrugSampleProduct from './tabs/DrugSampleProduct'
export default {
components: { DrugProductSampleHis, DrugSampleProduct },
data() {
return {
activeName: 'report'
}
},
mounted() {
this.activeName = 'report'
this._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'report') {
this._page()
} else {
this.$refs.hisTabs._page()
}
},
_page() {
this.$refs.reportTabs._page()
}
}
}
</script>
<!--右侧选中项目的列表-->
<template>
<div>
<el-table
ref="moveTable"
stripe
border
size="small"
highlight-current-row
:data="getPage"
style="width: 100%"
:height="tableHeight"
@select-all="_selectAll"
@selection-change="_selectRowChange"
@row-click="_clickRow"
>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
v-for="item in pageColumns"
:key="item.id"
show-overflow-tooltip
:prop="item.key"
:label="item.title"
:min-width="item.width"
>
<template slot-scope="scope">
<span v-if="item.key==='scened'">{{ scope.row[item.key]?'':scope.row[item.key]===0?'否':'是' }}</span>
<span v-else>{{ scope.row[item.key] }}</span>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
props: {
formId: null,
getPage: null,
pageColumns: null
},
data() {
return {
// tableHeight: document.documentElement.clientHeight - 230
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableDetail')
}
},
methods: {
// 选中行的同时选中checkbox
_clickRow(row) {
this.$refs.moveTable.toggleRowSelection(row)
},
// 多选
_selectRowChange(data) {
this.$emit('on-result-change', 'click', data)
},
_selectAll: function(data) {
this._selectRowChange(data)
}
}
}
</script>
<!--资质项目列表-->
<template>
<div>
<div>
<Form inline onsubmit="return false" :label-width="65">
<label class="label-sign" />
<Form-item label="检测项目:" style="width:30%;margin-left: 5px;">
<Input v-model="formObj.name" placeholder="请输入检测项目" @on-enter="_search" />
</Form-item>
<Form-item label="检测依据:" style="width:30%">
<Input v-model="formObj.standardCode" placeholder="请输入检测依据" @on-enter="_search" />
</Form-item>
<Form-item style="margin-left: -40px">
<Button type="primary" @click="_search">
搜索
</Button>
</Form-item>
</Form>
</div>
<element-table
ref="pageTable"
:table-height="tableHeight"
select-data
:get-page="getPage"
hide-elevator
hide-sizer
show-check-box
@on-result-change="_tableResultChange"
>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
show-overflow-tooltip
sortable
:prop="item.key"
:label="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
>
<template slot-scope="scope">
<span v-if="item.judge">
{{ scope.row[item.key] === 0 ?'否':'是' }}
</span>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</el-table-column>
</element-table>
</div>
</template>
<script>
import { aptitudeItem } from '../../../../../api'
export default {
data() {
return {
getPage: {},
formObj: {
name: '',
standardCode: ''
},
pageColumns: [
{ title: '检测项目', key: 'name', width: 100 },
{ title: '检测依据', key: 'code', width: 120 },
{ title: '检测依据名称', key: 'standardName', width: 180 },
{ title: '检测科室', key: 'groupName', width: 100 }
]
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('searchTwo')
}
},
methods: {
_open() {
this.formObj = this.$resetFields(this.formObj)
this._page()
},
_page: async function() {
const data = this.$serializeForm(this.formObj)
Object.assign(data, this.$refs.pageTable._searchParams())
const result = await aptitudeItem.materialTestItem(data)
if (result) {
this.getPage = result
this.$refs.pageTable._initTable()
}
},
_clearSelection() {
this.$refs.pageTable._clearSelection()
},
_search() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
this.$emit('on-result-change', 'search', this.getPage)
break
case 'selectData':
this.$emit('on-result-change', 'click', data)
break
case 'dbSelect':
this.$emit('on-result-change', 'dbClick', data)
break
default:
this._page()
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="100" :mask-closable="false" :styles="{top: '0px'}" class="zIndex-1200 modal-header-none">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按项目导入" name="item">
<RelAptitudeItem ref="itemTabs" />
</el-tab-pane>
</el-tabs>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
// import { materialInspectionContract } from '../../../../../api'
import RelAptitudeItem from './RelAptitudeItem'
export default {
components: {
RelAptitudeItem
},
data() {
return {
showModal: false,
activeName: 'item',
sampleIds: '',
footerList: [
{ name: '取消', type: '' },
{ name: '确定', type: 'primary' }
],
getPage: {}
}
},
methods: {
_open(sampleIds) {
this.showModal = true
this.sampleIds = sampleIds
this.activeName = 'item'
this.$refs.itemTabs._open(sampleIds)
},
_changeTabs(tab, event) {
// 样品接收中用的导入检测项目(给一个样品导入检测项目)
if (tab.name === 'item') {
this.$refs.itemTabs._open(this.sampleIds)
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
if (this.activeName === 'item') {
this.getPage = this.$refs.itemTabs.getPage
}
this._ok()
break
}
},
_cancel() {
this.$refs.footerModal._hideLoading()
this.showModal = false
},
_ok() {
if (!this.sampleIds) {
// 编辑添加时导入
this.$refs.footerModal._hideLoading()
this.showModal = false
this.$emit('on-result-change', this.getPage)
} else if (this.getPage.records.length === 0) {
this.$Message.warning('请至少选择一条检测项目!')
this.$refs.footerModal._hideLoading()
}
}
}
}
</script>
<!--Collapse关联框 单个导入项目-->
<template>
<div>
<div>
<Collapse left-title="资质项目" right-title="已选的检测项目" :left-width="18" @on-result-change="_optionResult">
<template slot="left">
<AptitudeItem ref="leftModal" @on-result-change="_leftResult" />
</template>
<template slot="right">
<AddItem
ref="rightModal"
:get-page="getPage"
:page-columns="pageColumns"
@on-result-change="_rightResult"
/>
</template>
</Collapse>
</div>
</div>
</template>
<script>
import Collapse from '../../../../../components/base/Collapse'
import AddItem from '../RightAddTestItemTable'
import AptitudeItem from './AptitudeItem'
export default {
components: {
Collapse,
AddItem,
AptitudeItem
},
data() {
return {
pageColumns: [
{ title: '检测项目', key: 'name', width: 100 },
{ title: '检测依据', key: 'code', width: 120 },
{ title: '检测依据名称', key: 'standardName', width: 180 },
{ title: '检测科室', key: 'groupName', width: 100 }
],
selectData: [],
addIds: [],
delData: [],
getPage: [],
isEditModal: false
}
},
methods: {
_open(sampleIds) {
this.sampleIds = sampleIds
this.selectData = []
this.addIds = []
this.delData = []
this.getPage = []
this.$refs.leftModal._open()
},
_optionResult(name) {
switch (name) {
case '添加':
this._add()
break
case '删除':
this._deleteSelected()
break
}
},
// 未关联方法返回的数据
_leftResult(msg, data) {
switch (msg) {
case 'click':
this.selectData = data
break
case 'dbClick':
this.selectData = [data]
this._add()
break
case 'search':
this.selectData = []
break
}
},
// 已关联方法返回的数据
_rightResult(msg, data) {
switch (msg) {
case 'click':
this.delData = data
break
}
},
// 添加关联方法
_add() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
for (let i = 0; i < this.selectData.length; i++) {
if (
!this.getPage.find(item => item.name === this.selectData[i].name)
) {
this.getPage.push(this.selectData[i])
this.addIds.push(this.selectData[i].id)
}
}
this.$refs.leftModal._clearSelection()
}
},
_deleteSelected() {
if (this.delData.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(
this.delData,
'确定删除 ' + this.delData.length + ' 条记录?'
)
}
},
_deleteByIds(row, content) {
for (let i = 0; i < row.length; i++) {
const dataIndex = this.getPage.indexOf(row[i])
this.getPage.splice(dataIndex, 1)
const idIndex = this.addIds.indexOf(row[i].id)
this.addIds.splice(idIndex, 1)
}
}
}
}
</script>
<!--资质项目包列表-->
<template>
<div>
<div>
<Form inline onsubmit="return false" :label-width="40">
<label class="label-sign" />
<Form-item label="包名">
<Input v-model="formObj.name" name="name" placeholder="请输入包名" style="width: 90px" @on-enter="_search" />
</Form-item>
<Form-item style="margin-left: -40px">
<Button type="primary" @click="_search">
搜索
</Button>
</Form-item>
</Form>
</div>
<div>
<element-table
ref="pageTable"
:table-height="tableHeight"
:get-page="getPage"
hide-checkbox
hide-elevator
hide-sizer
hide-total
click
@on-result-change="_tableResultChange"
>
<el-table-column
v-for="item in pageColumns"
:key="item.id"
show-overflow-tooltip
:prop="item.key"
:label="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
>
<template slot-scope="scope">
<span v-if="item.key==='type'">{{ scope.row[item.key]===0 ? '产品包' : '临时包' }}</span>
<span v-else>{{ scope.row[item.key] }}</span>
</template>
</el-table-column>
</element-table>
</div>
</div>
</template>
<script>
import { drugSample } from '../../../../../api'
export default {
data() {
return {
getPage: {},
pageColumns: [{ title: '包名称', key: 'name', width: 100 }],
formObj: {
name: ''
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabNoBtn')
}
},
methods: {
_open() {
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await drugSample.page(this.$serializeForm(this.formObj))
if (result) {
this.getPage = result
this.$refs.pageTable._initTable()
}
},
_search() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'select':
this.$emit('on-result-change', data.id)
break
case 'click':
this.$emit('on-result-change', data.id)
break
}
}
}
}
</script>
<template>
<div>
<Row :gutter="16">
<!--待选列表-->
<Col :span="leftSpan">
<div v-show="isFold">
<Card>
<div slot="title" style="position: relative">
<div>{{ leftTitle }}</div>
<div style="position: absolute;right: -14px;top:-14px;">
<Tooltip content="收起" placement="bottom">
<div style="padding: 14px;cursor: pointer" @click="_fold">
<Icon type="md-arrow-dropleft" />
</div>
</Tooltip>
</div>
</div>
<div>
<slot name="left" />
</div>
</Card>
</div>
<div v-show="!isFold" class="hide-box" :style="{height:hideTableHeight === undefined ?'485px' : hideTableHeight}">
<Tooltip content="打开" placement="bottom">
<div style="margin:-14px;padding: 14px;cursor:pointer;" @click="_fold">
<Icon type="md-arrow-dropright" />
</div>
</Tooltip>
<div>{{ leftTitle }}</div>
</div>
</Col>
<!--已选列表-->
<Col :span="rightSpan">
<Card>
<div slot="title" style="position: relative">
<div>{{ rightTitle }}</div>
</div>
<div>
<slot name="right" />
</div>
</Card>
</Col>
</Row>
</div>
</template>
<style scoped>
.hide-box {
width: 43px;
/*height: 485px;*/
padding: 14px;
text-align: center;
border: 1px solid #e9eaec;
border-radius: 4px;
}
</style>
<script>
export default {
name: 'Collapse',
props: {
leftTitle: null,
rightTitle: null,
leftBtnTitle: null,
rightBtnTitle: null,
hideTableHeight: null,
// showModal: false,
leftWidth: null // 自定义宽度 传左侧宽度即可
},
data() {
return {
// leftSpan: 1,
// rightSpan: 22,
// isFold: false,
leftSpan: this.leftWidth ? this.leftWidth : 11,
rightSpan: this.leftWidth ? 24 - this.leftWidth : 12,
isFold: true
}
},
methods: {
_fold() {
if (this.isFold) {
this.leftSpan = 1
this.rightSpan = 23
this.isFold = false
} else {
this.leftSpan = this.leftWidth ? this.leftWidth : 11
this.rightSpan = this.leftWidth ? 24 - this.leftWidth : 12
this.isFold = true
}
},
_options(name) {
this.$emit('on-result-change', name)
}
}
}
</script>
<!--CollapseMulti 关联框 modal弹框-->
<template>
<div>
<Modal v-model="showModal" width="100" :mask-closable="false" :styles="{top: '0px'}" class="zIndex-1200 full-screen modal-header-none">
<div>
<Collapse left-title="项目包" right-title="检测项目列表" :left-width="5" @on-result-change="_optionResult">
<template slot="left">
<AptitudeItemPackage ref="packageModal" @on-result-change="_packageResult" />
</template>
<template slot="right">
<Row>
<Col span="24">
<Form inline onsubmit="return false" :label-width="70">
<label class="label-sign" />
<Form-item label="检测项目" style="width:200px;">
<Input v-model="formObj.itemName" placeholder="请输入检测项目" @on-enter="_search" />
<input v-model="formObj.packageId" type="hidden" />
</Form-item>
<Form-item label="检测依据:">
<Input v-model="formObj.testBasis" placeholder="请输入检测依据" @on-enter="_search" />
</Form-item>
<Form-item label="判定依据:">
<Input v-model="formObj.judgeBasis" placeholder="请输入判定依据" @on-enter="_search" />
</Form-item>
<Form-item style="margin-left: -60px">
<Button type="primary" @click="_search">
搜索
</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<element-table
ref="pageTable"
:table-height="tableHeight"
select-data
:get-page="getPage"
show-check-box
@on-result-change="_tableResultChange"
>
<el-table-column
v-for="item in pageColumns"
:key="item.id"
show-overflow-tooltip
:prop="item.key"
:label="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
>
<template slot-scope="scope">
<span v-if="item.judge">
{{ scope.row[item.key] === 0 ?'否':'是' }}
</span>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</el-table-column>
</element-table>
</Col>
</Row>
</template>
</Collapse>
</div>
<div slot="footer">
<modal-footer
ref="footerModal"
:footer="footerList"
@on-result-change="_footerResult"
/>
</div>
</Modal>
</div>
</template>
<script>
import { drugSample } from '../../../../../api'
import AptitudeItemPackage from './AptitudeItemPackage'
import Collapse from './Collapse'
export default {
components: {
Collapse,
AptitudeItemPackage
},
data() {
return {
formObj: {
itemName: '',
testBasis: '',
judgeBasis: '',
packageId: ''
},
addIds: [],
addPage: [],
selectedData: [],
selectIds: [],
showModal: false,
getPage: {},
pageColumns: [
{ title: '检测项目', key: 'name', width: 160 },
{ title: '检测依据', key: 'standardCode', width: 120 },
{ title: '检测依据名称', key: 'standardName', width: 180 },
// { title: '判定依据', key: 'judgeBasis', width: 120 },
// { title: '判定依据名称', key: 'judgeBasisName', width: 180 },
{ title: '检测科室', key: 'groupName', width: 100 }
// { title: '检测方法', key: 'testMethod', width: 100 }
],
footerList: [
{ name: '取消', type: '' },
{ name: '确定', type: 'primary' }
],
sampleIds: '',
packageId: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabNoBtn')
}
},
methods: {
_open(sampleIds) {
this.formObj.itemName = ''
this.formObj.testBasis = ''
this.formObj.judgeBasis = ''
this.formObj.packageId = ''
this.sampleIds = sampleIds
this.packageId = ''
this.getPage = {}
this.addIds = []
this.addPage = []
this.showModal = true
this.$refs.packageModal._open()
this.$refs.pageTable._hideLoading()
},
_page: async function() {
if (this.packageId !== '') {
this.formObj.packageId = this.packageId
}
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await drugSample.testPackagePage(
this.$serializeForm(this.formObj)
)
if (result) {
this.getPage = result
this.$refs.pageTable._initTable()
}
},
_search() {
if (this.packageId !== '') {
this._page()
} else {
this.$Message.warning('请先选择项目')
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'selectData':
this.selectData = data
break
default:
if (this.packageId !== '') {
this._page()
}
}
},
_optionResult(name) {
switch (name) {
case '添加':
this._add()
break
case '删除':
this._deleteSelected()
break
}
},
_packageResult(id) {
this.packageId = id
this._page()
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
},
_cancel() {
this.$refs.footerModal._hideLoading()
this.showModal = false
},
_ok() {
if (!this.sampleIds) {
this.$emit('on-result-change', this.selectData)
this.showModal = false
this.$refs.footerModal._hideLoading()
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" />
<Form
v-show="searchOpen"
inline
onsubmit="return false"
:label-width="70"
class="search-form"
>
<label class="label-sign" />
<Form-item class="search-item" label="样本编号:">
<Input v-model="formObj.sampleCode" placeholder="请输入编号" clearable @on-enter="_formSearch" />
</Form-item>
<Form-item class="search-item" label="牌号:">
<Input v-model="formObj.name" placeholder="请输入牌号" clearable @on-enter="_formSearch" />
</Form-item>
<Form-item class="search-item" label="生产日期:">
<Date-picker
type="daterange"
split-panels
style="width:100%;"
placeholder="请选择生产日期"
:editable="false"
@on-change="_ctimeChange"
/>
<input v-model="formObj.pcTimeBegin" type="hidden" name="pcTimeBegin">
<input v-model="formObj.pcTimeEnd" type="hidden" name="pcTimeEnd">
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--按钮-->
<Col span="24" />
<btn-list :msg="btn" :open="searchOpen" show-search-btn="true" @on-result-change="_btnClick" />
</Col>
<!--table-->
<Col span="24" />
<element-table
ref="pageTable"
:page-columns="pageColumns"
:table-height="tableHeight"
:get-page="getPage"
:opt-col-width="110"
:icon-msg="iconMsg"
show-check-box
@on-result-change="_tableResultChange"
>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
show-overflow-tooltip
sortable
:prop="item.key"
:label="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
>
<template slot-scope="scope">
<template v-if="item.key==='pcTime'">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):'' }}
</template>
<template v-else-if="item.status">
{{ scope.row[item.key] === undefined ? '': scope.row[item.key].display }}
</template>
<template v-else>
{{ scope.row[item.key] }}
</template>
</template>
</el-table-column>
</element-table>
</Col>
</Row>
<!--操作日志-->
<sampleRecord ref="recordModal" />
<!--附件-->
<fileManage ref="fileManageModal" @on-result-change="_fileResult" />
</div>
</template>
<script>
import { drugSample } from '../../../../api'
import sampleRecord from '../../../record/sampleRecord'
import fileManage from '../../../base-manage/fileManage'
export default {
components: { sampleRecord, fileManage },
data() {
return {
searchOpen: true,
formObj: {
sampleCode: '',
name: '',
supplier: '',
status: '',
pcTimeBegin: '',
pcTimeEnd: ''
},
pageColumns: [
{ title: '样本编号', key: 'sampleCode', width: 150, fixed: 'left' },
{ title: '价类', key: 'category', width: 120, type: true },
{ title: '状态', key: 'status', status: true, width: 120 },
{ title: '牌号', key: 'name', width: 120 },
{ title: '卷制标准版本号', key: 'standard', width: 230 },
{ title: '生产日期', key: 'pcTime', width: 120 },
{ title: '机台', key: 'samplePoint' },
{ title: '班次', key: 'classBan', width: 120 },
{ title: '备注', key: 'remark', width: 120 }
],
getPage: {
records: []
},
btn: [
// { type: 'success', id: '', name: '导出' },
// { type: 'error', id: '', name: '中止' }
],
iconMsg: [
{ type: 'pt-a-cloud', id: '', name: '附件' },
{ type: 'pt-a-clock', id: '', name: '操作日志' }
],
selectIds: []
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
methods: {
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 参数
_searchParamsTemp() {
const data = this.$serializeForm(this.formObj)
return this.$extend(data, { page: 1, rows: 5000 })
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await drugSample.pageSampleProductRegHis(
this.$serializeForm(this.formObj)
)
if (result) {
this.getPage = result
this.$refs.pageTable._initTable()
}
},
_searchParams(formId) {
return this.$refs.pageTable._searchParams(formId)
},
_btnClick(msg, data) {
switch (msg) {
case '导出':
if (this.getPage.records.length === 0) {
this.$Message.warning('暂无数据,不可导出!')
} else {
this._export()
}
break
case '中止':
this._endByIds()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_endByIds() {
const ids = this.selectIds
if (ids.length === 0) return this.$Message.warning('请至少选择一条数据!')
this.$Modal.confirm({
title: '提示',
content: `确定中止 ${ids.length} 条记录`,
onOk: () => {
this._endOk(ids)
}
})
},
_endOk: async function(id) {
const result = await drugSample.endById(id)
if (result) {
this.$Message.success('中止成功!')
this._page()
}
},
_ctimeChange(data) {
this.formObj.pcTimeBegin = data[0]
this.formObj.pcTimeEnd = data[1]
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'selectIds':
this.selectIds = data
break
}
},
_iconClick(res, data) {
switch (res) {
case '附件':
this._upload(data.id)
break
case '操作日志':
this._record(data.id)
break
case '接收记录':
this._receiveRecord(data.id)
break
}
},
// 附件
_upload(id) {
const tempData = {
id: id,
uploadFileUrl: '/v1/sample_annex/upload/',
downloadFileUrl: '/v1/sample_annex/download/'
}
this.$refs.fileManageModal._open(tempData, 'sampleId')
},
// 文件返回的数据
_fileResult(msg, data) {
switch (msg) {
case 'file-page':
this.$refs.fileModal._openFile(data)
break
case 'delete-page':
this.$refs.fileModal._delPage('', data)
break
case 'success':
this.$Message.success('删除成功!')
this.$refs.fileModal._page()
break
default:
this.$refs.fileModal._page()
}
},
_export: async function() {
const result = await drugSample.otherPageHis(this._searchParamsTemp())
// 导出全部数据
if (result) {
this.$Modal.confirm({
title: '提示',
content: '确定导出全部数据(最多导出5000条)?',
onOk: () => {
this.$exportExcel(
'dataAccessTable',
'其他报检',
this.pageColumns,
result.records
)
}
})
}
},
// 操作日志
_record(id) {
this.$refs.recordModal._open(id)
},
// 接收记录
_receiveRecord(id) {
this.$refs.receiveModal._open(id)
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24" />
<Form
v-show="searchOpen"
inline
onsubmit="return false"
:label-width="70"
class="search-form"
>
<label class="label-sign" />
<Form-item class="search-item" label="样本编号:">
<Input v-model="formObj.sampleCode" placeholder="请输入样本编号" clearable @on-enter="_formSearch" />
</Form-item>
<Form-item class="search-item" label="牌号:">
<Input v-model="formObj.name" placeholder="请输入牌号" clearable @on-enter="_formSearch" />
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--按钮-->
<Col span="24" />
<!-- <btn-list :msg="btn" :open="searchOpen" show-search-btn="true" @on-result-change="_btnClick" />-->
<el-button @click="_add" type="primary" >添加</el-button>
<el-button @click="_submitByIds" type="primary" >提交</el-button>
</Col>
<!--table-->
<Col span="24" />
<element-table
ref="pageTable"
:page-columns="pageColumns"
:table-height="tableHeight"
:get-page="getPage"
:opt-col-width="140"
:icon-msg="iconMsg"
show-check-box
select-data
@on-result-change="_tableResultChange"
>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
show-overflow-tooltip
sortable
:prop="item.key"
:label="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
>
<template slot-scope="scope">
<div v-if="item.key==='pcTime'">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):'' }}
</div>
<div v-else-if="item.status">
{{ scope.row[item.key].display }}
</div>
<div v-else>
{{ scope.row[item.key] }}
</div>
</template>
</el-table-column>
</element-table>
</Col>
</Row>
<fileManage ref="fileManageModal" @on-result-change="_fileResult" />
<!--添加编辑-->
<DrugSampleProductEdit ref="editModal" @on-result-change="_page" />
</div>
</template>
<script>
import { drugSample } from '../../../../api'
import fileManage from '../../../base-manage/fileManage'
import DrugSampleProductEdit from '../DrugSampleProductEdit'
export default {
components: { DrugSampleProductEdit, fileManage },
data() {
return {
searchOpen: true,
formObj: {
sampleCode: '',
name: '',
supplier: ''
},
selectIds: [],
btn: [
{ type: 'success', id: '', name: '添加' },
{ type: '', id: '', name: '提交' }
],
pageColumns: [
{ title: '样本编号', key: 'sampleCode', width: 150, fixed: 'left' },
{ title: '价类', key: 'category', width: 120, type: true },
{ title: '状态', key: 'status', status: true, width: 120 },
{ title: '牌号', key: 'name', width: 120 },
{ title: '卷制标准版本号', key: 'standard', width: 230 },
{ title: '生产日期', key: 'pcTime', width: 120 },
{ title: '机台', key: 'samplePoint' },
{ title: '班次', key: 'classBan', width: 120 },
{ title: '备注', key: 'remark', width: 120 }
],
getPage: {},
iconMsg: [
{ type: 'pt-a-submit', id: '', name: '提交' },
{ type: 'pt-a-edit', id: '', name: '编辑' },
{ type: 'pt-a-cloud', id: '', name: '附件' },
{ type: 'pt-a-end', id: '', name: '中止' }
],
statusList: [{ value: 0, label: '禁用' }, { value: 1, label: '正常' }],
selectData: [],
judStatus: false
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
methods: {
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await drugSample.pageSampleProductReg(
this.$serializeForm(this.formObj)
)
if (result) {
this.getPage = result
this.$refs.pageTable._initTable()
}
},
_searchParams(formId) {
return this.$refs.pageTable._searchParams(formId)
},
_add() {
this.$refs.editModal._open()
},
_btnClick(msg, data) {
switch (msg) {
case '添加':
this.$refs.editModal._open()
break
case '提交':
this._submitByIds()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'selectData':
this._selectData(data)
break
}
},
_selectData(data) {
const selectIds = []
data.forEach(i => {
selectIds.push(i.id)
})
this.selectIds = selectIds
this.selectData = data
},
_iconClick(res, data) {
switch (res) {
case '提交':
this._submitById(data.id)
break
case '编辑':
this._editModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '中止':
this._endById(data.id)
break
case '操作日志':
this._record(data.id)
break
}
},
// 提交
_submitById(id) {
this.$Modal.confirm({
title: '提示',
content: '确定提交该数据?',
onOk: () => {
this._submitOk(id)
}
})
},
_submitByIds() {
// 批量提交
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定提交 ' + ids.length + ' 条记录?',
onOk: () => {
this._submitOk(ids)
}
})
}
},
_submitOk: async function(id) {
const result = await drugSample.submitRegister(id)
if (result) {
this.$Message.success('提交成功')
this._page()
}
},
_editModal: async function(id) {
const result = await drugSample.getSampleVO(id)
this.$refs.editModal._open(result)
},
// 附件
_upload(id) {
const tempData = {
id: id,
uploadFileUrl: '/v1/sample_annex/upload/',
downloadFileUrl: '/v1/sample_annex/download/'
}
this.$refs.fileManageModal._open(tempData, 'sampleId')
},
// 文件返回的数据
_fileResult(msg, data) {
switch (msg) {
case 'file-page':
this.$refs.fileManageModal._openFile(data)
break
case 'delete-page':
this.$refs.fileManageModal._delPage('', data)
break
case 'success':
this.$Message.success('删除成功!')
this.$refs.fileManageModal._page()
break
default:
this.$refs.fileManageModal._page()
}
},
// 中止
_endById(id) {
this.$Modal.confirm({
title: '提示',
content: '确定中止该记录?',
onOk: () => {
this._endOk(id)
}
})
},
_endOk: async function(id) {
const result = await drugSample.stopTest(id)
if (result) {
this.$Message.success('中止成功')
this._page()
}
},
// 操作日志
_record(id) {
this.$refs.recordModal._open(id)
}
}
}
</script>
......@@ -97,12 +97,17 @@
<Input v-model="formObj.quantity" name="quantity" placeholder="数量" />
</Form-item>
<Form-item label="是否流转" prop="flowed" class="width-32">
<el-radio v-model="formObj.flowed" label="0" @change="show">
</el-radio>
<el-radio v-model="formObj.flowed" label="1" @change="show">
</el-radio>
<!-- <el-radio v-model="formObj.flowed" label="0" @change="show">-->
<!-- 否-->
<!-- </el-radio>-->
<!-- <el-radio v-model="formObj.flowed" label="1" @change="show">-->
<!-- 是-->
<!-- </el-radio>-->
<el-radio-group v-model="formObj.flowed">
<el-radio :label="0"></el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group>
</Form-item>
<!-- <Form-item label="供应商" prop="supplier" class="width-32">-->
......@@ -198,7 +203,7 @@ export default {
spec: '',
lotNum: '',
quantity: '',
flowed: '0',
flowed: 1,
supplier: '',
supplierId: '',
catalogueId: '',
......
......@@ -61,6 +61,9 @@
<div v-else-if="item.status">
{{ scope.row[item.key].display }}
</div>
<div v-else-if="item.key==='flowed'">
{{ scope.row[item.key]===0?'否':'是' }}
</div>
<div v-else>
{{ scope.row[item.key] }}
</div>
......@@ -96,12 +99,13 @@ export default {
pageColumns: [
{ title: '样本编号', key: 'sampleCode', width: 150, fixed: 'left' },
{ title: '价类', key: 'category', width: 120, type: true },
{ title: '状态', key: 'status', status: true, width: 120 },
{ title: '是否流转', key: 'flowed', width: 100 },
{ title: '牌号', key: 'name', width: 120 },
{ title: '卷制标准版本号', key: 'standard', width: 230 },
{ title: '生产日期', key: 'pcTime', width: 120 },
{ title: '机台', key: 'samplePoint' },
{ title: '班次', key: 'classBan', width: 120 },
{ title: '状态', key: 'status', status: true, width: 120 },
{ title: '备注', key: 'remark', width: 120 }
],
getPage: {},
......
......@@ -3,6 +3,7 @@
*/
import DrugSampleMaterialIndex from '../pages/drug-register/material/DrugSampleMaterialIndex'
import DrugSampleProductIndex from '../pages/drug-register/product/DrugSampleProductIndex'
import DrugSampleDailyIndex from '../pages/drug-register/daily/DrugSampleProductIndex'
import SampleStable from '../pages/drug-register/stable/SampleStableIndex'
export default [
{
......@@ -13,7 +14,12 @@ export default [
{
path: 'product_test',
component: DrugSampleProductIndex,
meta: { title: '产品检测' }
meta: { title: '委托检测' }
},
{
path: 'daily_test',
component: DrugSampleDailyIndex,
meta: { title: '日常检测' }
},
{
path: 'stable',
......
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