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 { ...@@ -171,7 +171,7 @@ export default {
this.$Modal.remove() this.$Modal.remove()
this.$Message.success('提交成功!') this.$Message.success('提交成功!')
this.$emit('on-result-change') this.$emit('on-result-change')
this._page() await this._page()
} }
}, },
_backCheck() { _backCheck() {
......
<template>
<div>
<Modal v-model="showModal" v-drag :mask-closable="false" width="1200" :styles="{marginTop:'-90px'}">
<p slot="header">
{{ modalTitle }}
</p>
<div>
<Form
:id="editId"
ref="formObj"
:model="formObj"
:rules="ruleValidate"
:label-width="95"
inline
>
<div>
<Collapse v-model="infoVal" class="coll-edit coll-search">
<Panel name="1">
报检信息
<p slot="content">
<Form-item label="价类" prop="category" class="width-32">
<Select v-model="categoryMultiple" multiple @on-change="_categoryChange">
<input v-model="formObj.category" hidden="hidden"></input>
<Option v-for="item in testType" :key="item.name" :value="item.name">
{{ item.name }}
</Option>
</Select>
</Form-item>
<Form-item label="生产日期" prop="pcTime" class="width-32">
<el-date-picker
v-model="formObj.pcTime"
style="width: 100%"
type="date"
@change="_obtainSampleTime"
/>
</Form-item>
<Form-item label="要求完成时间" prop="aeTime" class="width-32">
<el-date-picker
v-model="formObj.aeTime"
style="width: 100%"
type="datetime"
default-time="16:00:00"
@change="_askEndTime"
/>
</Form-item>
<Form-item label="牌号" prop="name" class="width-32">
<Input
v-model="formObj.name"
name="name"
placeholder="请选择牌号"
@dblclick.native="_selectMaterielName"
/>
</Form-item>
<Form-item label="卷制标准版本号" prop="unit" class="width-32">
<Select v-model="formObj.standard">
<Option v-for="item in standardList" :key="item.name" :value="item.name">
{{ item.name }}
</Option>
</Select>
</Form-item>
<Form-item label="机台" prop="unit" class="width-32">
<Select v-model="formObj.samplePoint">
<Option v-for="item in samplePointList" :key="item.name" :value="item.name">
{{ item.name }}
</Option>
</Select>
</Form-item>
<Form-item label="班次" prop="unit" class="width-32">
<Select v-model="formObj.classBan">
<Option v-for="item in classBanList" :key="item.name" :value="item.name">
{{ item.name }}
</Option>
</Select>
</Form-item>
<Form-item label="计量单位" prop="unit" class="width-32">
<!-- <Input v-model="formObj.unit" name="unit" placeholder="计量单位" />-->
<Select v-model="formObj.unit">
<Option v-for="item in options" :key="item.name" :value="item.name">
{{ item.name }}
</Option>
</Select>
</Form-item>
<Form-item label="规格" prop="spec" class="width-32">
<Input v-model="formObj.spec" name="spec" placeholder="规格" />
</Form-item>
<Form-item label="批号" prop="lotNum" class="width-32">
<Input v-model="formObj.lotNum" name="lotNum" placeholder="批号" />
</Form-item>
<Form-item label="数量" prop="quantity" class="width-32">
<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-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">-->
<!-- <Input v-model="formObj.supplier" name="supplier" placeholder="选择物料名称后自动生成">-->
<!-- <Icon slot="suffix" type="md-add-circle" @click="_selectSupply"/>-->
<!-- </Input>-->
<!-- </Form-item>-->
<Form-item label="备注" prop="remark" style="width:96.8%;margin-bottom: 10px !important;">
<Input v-model="formObj.remark" placeholder="请输入备注" type="textarea" :rows="2" name="remark" />
</Form-item>
<Alert type="success" style="text-align: center;font-size: 15px;margin: 5px">
检测项目列表
</Alert>
<SampleItemList ref="itemModal" @on-result-change="_testResult" />
</p>
</Panel>
</Collapse>
</div>
</Form>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
<!--选择人员-->
<UserInfo ref="userModal" is-change @on-result-change="_userData" />
<!--选择物料-->
<DrugCatalogueSelect ref="materialModal" is-change @on-result-change="_backMaterielNameData" />
<!--供应商-->
<SupplierSelect ref="supplyModal" @on-result-change="_resultModal" />
</div>
</template>
<script>
/**
* 添加编辑企业委托表
*/
import { drugSample } from '../../../api'
import UserInfo from '../../../components/user-info-single/assignPerson'
import DrugCatalogueSelect from '../../drug-register/DrugCatalogueSelect'
import SupplierSelect from '../../drug-register/SupplierSelect'
import standard from '../../../api/aptitude/standard'
import SampleItemList from './sample-manage/SampleItemList'
export default {
components: {
SampleItemList,
DrugCatalogueSelect,
SupplierSelect,
UserInfo
},
data() {
// const validateNumber = function(rule, value, callback) {
// if (!value) {
// return callback(new Error('样本编号不能为空!'))
// } else if (!/^[^\u4e00-\u9fa5]+$/.test(value)) {
// return callback(new Error('不能包含中文!'))
// } else {
// callback()
// }
// }
return {
editId: 'edit-form',
infoVal: ['1'], // 默认展开第一个
id: '',
modalTitle: '',
categoryMultiple: '',
timer: '',
currentTime: new Date(),
options: [
{
name: '支'
},
{
name: '盒'
},
{
name: '条'
}
],
formObj: {
category: '',
standard: '',
classBan: '',
pcTime: '',
aeTime: '',
pcPerson: '',
pcPersonId: '',
pcDepart: '',
samplePoint: '',
code: '',
name: '',
unit: '',
spec: '',
lotNum: '',
quantity: '',
flowed: 0,
supplier: '',
supplierId: '',
catalogueId: '',
remark: ''
},
ruleValidate: {
declarationInspection: [
{ required: true, message: '报检单位不能为空', trigger: 'blur' }
],
category: [
{ required: true, message: '价类不能为空', trigger: 'change' }
],
modelSpec: [{ required: true, message: '物料编号不能为空' }],
name: [
{ required: true, message: '物料名称不能为空', trigger: 'change' }
],
obtainSampler: [
{ required: true, message: '取样人不能为空', trigger: 'change' }
],
obtainSampleTime: [{ required: true, message: '取样时间不能为空' }],
stockOrganize: [
{ required: true, message: '库存组织不能为空', trigger: 'change' }
]
},
showModal: false,
testType: [
{
name: '一类'
},
{
name: '二类'
},
{
name: '三类'
},
{
name: '四类'
},
{
name: '五类'
}
],
classBanList: [
{
name: '甲班'
},
{
name: '乙班'
},
{
name: '正常班'
}
],
samplePointList: [
{
name: 'A1'
},
{
name: 'A2'
},
{
name: 'A3'
},
{
name: 'A4'
},
{
name: 'A5'
},
{
name: 'A6'
},
{
name: 'A7'
},
{
name: 'B1'
},
{
name: 'B2'
},
{
name: 'B3'
},
{
name: 'B4'
},
{
name: 'B5'
},
{
name: 'B6'
},
{
name: 'B7'
},
{
name: 'B8'
},
{
name: 'B9'
}
],
standardList: [],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
groupData: [],
itemIds: [],
drugItemList: [],
itemIdsEdit: [],
orgList: [],
edit: true,
optionsTime: {
disabledDate: function(date) {
return date && date.valueOf() > Date.now()
}
}
}
},
methods: {
show() {
console.log(this.formObj.flowed)
},
_testResult(data) {
this.drugItemList = data
this.itemIds = []
// 编辑和添加不一样,添加只是新增刚添加的检测项目
if (this.edit) {
for (let i = 0; i < data.length; i++) {
if (data[i].aptitudeId !== undefined) {
this.itemIds.push(data[i].aptitudeId)
}
}
} else {
for (let i = 0; i < data.length; i++) {
if (data[i].aptitudeId !== undefined) {
this.itemIds.push(data[i].aptitudeId)
}
}
}
this.itemIdsEdit = []
for (let i = 0; i < data.length; i++) {
this.itemIdsEdit.push(data[i].aptitudeId)
}
},
_categoryChange(data) {
this.formObj.category = this.categoryMultiple.join('、')
console.log(this.formObj.category)
},
_open(formObj) {
this.itemIdsEdit = []
this.itemIds = []
this.drugItemList = []
this.$refs.formObj.resetFields()
this.itemIds = []
this.showModal = true
this.infoVal = ['1']
this._getStandardList({})
this.editId = 'edit-form-product-edit'
this._hideLoading()
this.$refs.itemModal._init()
this.formObj.pcTime = this.getDay(-1, '-')
console.log('时间')
console.log(this.formObj.pcTime)
if (this.$string(formObj).isEmpty()) {
this.id = ''
this.edit = true
this._empty()
this.modalTitle = '添加报检信息'
} else {
this.id = formObj.id
this.edit = false
this.categoryMultiple = formObj.category.split('、')
if (undefined === formObj.pcPerson) {
formObj.pcPerson = ''
}
if (undefined === formObj.pcPersonId) {
formObj.pcPersonId = ''
}
this.formObj = formObj
if (undefined !== formObj.pcTime) {
this.formObj.pcTime = this._dateFormat(formObj.pcTime)
} else {
this.formObj.pcTime = ''
}
if (undefined !== formObj.aeTime) {
this.formObj.aeTime = this._dateFormat(formObj.aeTime)
} else {
this.formObj.aeTime = ''
}
console.log('this.formObj--', this.formObj)
this.formObj.category = formObj.category
this.modalTitle = '编辑报检信息'
this.$refs.itemModal._getItem(formObj.id)
}
},
getDay(num, str) {
const today = new Date()
const nowTime = today.getTime()
const ms = 24 * 3600 * 1000 * num
today.setTime(parseInt(nowTime + ms))
const oYear = today.getFullYear()
let oMoth = (today.getMonth() + 1).toString()
if (oMoth.length <= 1) oMoth = '0' + oMoth
let oDay = today.getDate().toString()
if (oDay.length <= 1) oDay = '0' + oDay
const hours =
today.getHours() < 10 ? '0' + today.getHours() : today.getHours()
const minutes =
today.getMinutes() < 10 ? '0' + today.getMinutes() : today.getMinutes()
const seconds =
today.getSeconds() < 10 ? '0' + today.getSeconds() : today.getSeconds()
// return oYear + str + oMoth + str + oDay + hours + minutes + seconds
return (
oYear +
str +
oMoth +
str +
oDay +
' ' +
hours +
':' +
minutes +
':' +
seconds
)
},
_selectMaterielName() {
this.$refs.materialModal._open()
},
_trim(str) {
return str ? str.replace(/(^\s*)|(\s*$)/g, '') : ''
},
// 返回样品信息
_backMaterielNameData(data) {
this.formObj.name = data.name
this.formObj.spec = data.spec
this.formObj.code = data.code
this.formObj.catalogueId = data.id
this.$refs.itemModal._open(data.id)
},
_ok(msg) {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.formObj
const { category, catalogueId } = this.formObj
data.pcTime = this.formObj.pcTime
data.aeTime = this.formObj.aeTime
data.drugItemList = this.drugItemList
const itemDatas = this.drugItemList
console.log('0----0', data)
for (let i = 0; i < itemDatas.length; i++) {
if (undefined === itemDatas[i].name || itemDatas[i].name === '') {
this.$Message.error('检测项目名称不能为空!')
this._hideLoading()
return false
}
}
this._save({
...data,
category,
catalogueId
})
} else {
this.$Message.error('表单验证失败')
this._hideLoading()
}
})
},
// 添加、编辑保存
_save: async function(data) {
console.log('*************', data)
// 添加
if (this.$string(this.id).isEmpty()) {
const result = await drugSample.addMaterialRegister(data)
this._resultChange(result, '添加成功')
} else {
// 编辑
data.id = this.formObj.id
const result = await drugSample.editSampleVO({
id: this.formObj.id,
obj: data
})
this._resultChange(result, '编辑成功')
}
},
_getStandardList: async function(data) {
const result = await standard.list(data)
if (result) {
this.standardList = result
}
},
_dateFormat: function(time) {
const date = new Date(time)
const year = date.getFullYear()
/* 在日期格式中,月份是从0开始的,因此要加0
* 使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
* */
const month =
date.getMonth() + 1 < 10
? '0' + (date.getMonth() + 1)
: date.getMonth() + 1
const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
const hours =
date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
const minutes =
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
const seconds =
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
// 拼接
return (
year +
'-' +
month +
'-' +
day +
' ' +
hours +
':' +
minutes +
':' +
seconds
)
},
// 请检时间
_obtainSampleTime(data) {
this.formObj.pcTime = this._dateFormat(data)
console.log('时间')
console.log(this.formObj.pcTime)
},
_askEndTime(data) {
this.formObj.aeTime = this._dateFormat(data)
},
// 清空数据
_empty() {
this.formObj.declarationInspection = '鲁丽钢铁'
this.formObj.category = ''
this.formObj.sampleCode = ''
this.formObj.name = ''
this.formObj.modelSpec = ''
this.formObj.sampleId = ''
this.formObj.supplier = ''
this.formObj.supplierId = ''
this.formObj.obtainSampler = ''
this.formObj.obtainSamplerId = ''
this.formObj.remark = ''
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_resultChange(result, msg) {
if (result) {
this.showModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
}
this._hideLoading()
},
_cancel() {
this.showModal = false
this.itemIds = []
this.itemIdsEdit = []
this.formObj.sampleId = ''
this.$refs.itemModal._init()
},
_selectSamplingPerson() {
this.$refs.userModal._open('pcPerson')
},
_userData(data, msg) {
// 选择人员返回数据
if (msg === 'pcPerson') {
// 选择取样人取样人
this.formObj.pcPerson = data.realname
this.formObj.pcPersonId = data.userId
}
},
// 选择供应商
_selectSupply() {
if (!this.edit) return
this.$refs.supplyModal._open()
},
// 回调供应商
_resultModal(data) {
this.formObj.supplierId = data.id
this.formObj.supplier = this._trim(data.name)
}
}
}
</script>
<style>
.width-32 {
width: 32%;
}
</style>
<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>
<Row>
<Col span="24" />
<Form v-model="formObj" inline onsubmit="return false" :label-width="70">
<input v-model="formObj.catalogueId" type="hidden">
</Form>
</Col>
<!--正常界面-->
<Col span="24" style="margin-top: 5px" />
<!-- <btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" />-->
<Button type="primary" style="margin-bottom: 10px" @click="_importItem">
导入检测项目
</Button>
<Button type="primary" style="margin-bottom: 10px" @click="_addItem">
添加
</Button>
</Col>
<!-- 表格 -->
<Col span="24" />
<element-table
ref="pageTable"
:page-columns="pageColumns"
:table-height="330"
:get-page="getPage"
:opt-col-width="80"
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"
>
<template slot-scope="scope">
<span v-if="item.key==='judged'">
{{ scope.row[item.key]===1?'是':'否' }}
</span>
<span
v-else-if="item.key==='name'"
@click.stop="_handleRow(scope)"
>
<el-input
v-model="scope.row.name"
size="medium"
placeholder="请输检测项目"
@blur="_testItemEdit(scope.row.id,scope.row.name,'name')"
/>
</span>
<span
v-else-if="item.key==='code'"
@click.stop="_handleRow(scope)"
>
<el-input
v-model="scope.row.code"
size="medium"
placeholder="请输入检测依据"
@blur="_testItemEdit(scope.row.id,scope.row.code,'code')"
/>
</span>
<span
v-else-if="item.key==='standardName'"
@click.stop="_handleRow(scope)"
>
<el-input
v-model="scope.row.standardName"
size="medium"
placeholder="请输入检测依据名称"
@blur="_testItemEdit(scope.row.id,scope.row.standardName,'standardName')"
/>
</span>
<span
v-else-if="item.key==='compareSymbol'"
@click.stop="_handleRow(scope)"
>
<el-input
v-model="scope.row.compareSymbol"
size="medium"
placeholder="请输入比较符"
@blur="_testItemEdit(scope.row.id,scope.row.compareSymbol,'compareSymbol')"
/>
</span>
<span
v-else-if="item.key==='limitValue'"
@click.stop="_handleRow(scope)"
>
<el-input
v-model="scope.row.limitValue"
size="medium"
placeholder="请输入限量值"
@blur="_testItemEdit(scope.row.id,scope.row.limitValue,'limitValue')"
/>
</span>
<span
v-else-if="item.key==='unit'"
@click.stop="_handleRow(scope)"
>
<el-input
v-model="scope.row.unit"
size="medium"
placeholder="请输入单位"
@blur="_testItemEdit(scope.row.id,scope.row.unit,'unit')"
/>
</span>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</el-table-column>
<el-table-column
slot="col"
label="操作"
align="center"
:width="100"
fixed="right"
>
<template slot-scope="scope">
<icon-list
:msg="scope.row['status'] === 'PRIMITIVE' || scope.row.type === 0 ? iconMsgDis : iconMsg "
:row-data="scope.row"
@on-result-change="_iconClick"
/>
</template>
</el-table-column>
</element-table>
</Col>
</Row>
<!--导入项目 左右关联的modal 单个导入项目-->
<RelItem ref="relItemModal" @on-result-change="_relItemResult" />
<!--导入检测项目包-->
<RelItemPackage ref="packageModal" @on-result-change="_relPackResult" />
<!--导入项目 左右关联的modal 单个导入项目-->
<SampleItemSelect ref="relItemModal" @on-result-change="_relItemResult" />
</div>
</template>
<script>
import { drugSample, aptitudeItem } from '../../../../api'
import SampleItemSelect from '../../SampleItemSelect'
import RelItem from './rel-item/ImportItemIndex'
import RelItemPackage from './rel-package/RelItemPackage'
export default {
components: {
RelItem,
RelItemPackage,
SampleItemSelect
},
data() {
return {
formObj: {
catalogueId: ''
},
showModal: false,
searchOpen: false,
btn: [
{ type: 'primary', id: '', name: '导入检测项目' },
{ type: 'primary', id: '', name: '导入检测项目包' }
],
iconMsg: [{ type: 'pt-a-trash', id: '', name: '删除' }],
iconMsgDis: [
{ type: 'pt-a-trash', id: '', name: '删除', disabled: true }
],
pageColumns: [
{ title: '检测项目', key: 'name', width: 140 },
{ title: '检测类型', key: 'type', width: 140 },
{ title: '检测依据', key: 'code', width: 180 },
{ title: '检测依据名称', key: 'standardName', width: 300 },
{ title: '检测科室', key: 'groupName', width: 110 },
{ title: '比较符', key: 'compareSymbol', width: 100 },
{ title: '限值', key: 'limitValue', width: 200 },
{ title: '单位', key: 'unit', width: 180 },
{ title: '是否系统判定', key: 'judged', width: 120, judged: true },
{ title: '备注', key: 'remark', width: 240 }
],
catalogueId: '',
testType: '',
currentRow: {},
currentIndex: 0,
getPage: {},
testItemData: [],
testBasisData: [],
selectData: []
}
},
methods: {
_open(catalogueId, label) {
this.catalogueId = ''
this.showModal = true
this.catalogueId = catalogueId
$('input[name=catalogueId]').val(catalogueId)
this.getPage.records = []
this.currentRow = 0
this.formObj.catalogueId = catalogueId
this.$refs.pageTable._hideLoading()
if (catalogueId) {
this._page()
} else {
this.$Message.warning('请先选择一条物料信息!')
}
},
// 操作的序号
_handleRow(data) {
this.currentRow = data.row
},
_testItemEdit(id, name) {
console.log(id)
console.log(name)
},
_getItem: async function(id) {
this.catalogueId = '1111'
const result = await drugSample.getSampleVO(id)
if (result.itemList) {
const itemList = result.itemList
this.getPage = {
total: result.itemList.length,
size: 50,
records: itemList
}
this.$refs.pageTable._initTable()
this.$emit('on-result-change', this.getPage.records)
} else {
this.getPage = {
total: 0,
size: 50,
records: []
}
this.$emit('on-result-change', this.getPage.records)
}
},
_cancel() {
this.showModal = false
this.catalogueId = ''
this.getPage.records = []
},
_page: async function() {
this.getPage.records = []
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await aptitudeItem.pageCatalogueItem(
this.$serializeForm(this.formObj)
)
console.log('----result', result)
if (result) {
const len = result
for (let i = 0; i < len.records.length; i++) {
len.records[i].aptitudeId = len.records[i].id
}
this.getPage = len
this.$emit('on-result-change', len.records)
this.$refs.pageTable._initTable()
}
},
_init() {
this.getPage = {
total: 0,
size: 50,
records: []
}
this.getPage.records = []
this.getPage.total = 0
this.$refs.pageTable._initTable()
// this.getPage.records = []
// this.getPage.total = 0
// this.$refs.pageTable._initTable()
},
_importItem() {
this.$refs.relItemModal._open(this.catalogueId)
},
_addItem() {
this.getPage.records.push({ deleted: 0 })
this.getPage.total++
this.$emit('on-result-change', this.getPage.records)
},
_btnClick(msg) {
switch (msg) {
case '删除':
this._deleteByIds()
break
case '导入检测项目':
if (this.catalogueId) {
this.$refs.relItemModal._open()
} else {
this.$Message.warning('请先选择一条物料信息!')
}
break
case '导入检测项目包':
if (this.catalogueId) {
this.$refs.packageModal._open()
} else {
this.$Message.warning('请先选择一条物料信息!')
}
break
}
},
// 导入检测项目返回的结果(根据名称判定是否重复)
_relItemResult(relList) {
let flag = true // 都重复提示重复
for (let i = 0; i < relList.length; i++) {
if (
!this.getPage.records.find(item => item.aptitudeId === relList[i].id)
) {
flag = false
const data = {
aptitudeId: relList[i].id,
name: relList[i].name,
code: relList[i].code,
standardName: relList[i].standardName,
groupName: relList[i].groupName,
groupId: relList[i].groupId,
compareSymbol: relList[i].compareSymbol,
limitValue: relList[i].limitValue,
unit: relList[i].unit,
judged: relList[i].judged,
remark: relList[i].remark,
status: 'true'
}
this.getPage.records.push(data)
this.getPage.total++
this.$emit('on-result-change', this.getPage.records)
}
}
if (flag) {
this.$Message.warning('您所选项目与已添加检测项目重复!')
}
},
// 导入检测项目包返回的结果(根据名称判定是否重复)
_relPackResult(relList) {
let flag = true // 都重复才提示重复
for (let i = 0; i < relList.length; i++) {
if (
!this.getPage.records.find(
item => item.aptitudeItemId === relList[i].id
)
) {
flag = false
const data = {
aptitudeItemId: relList[i].id,
name: relList[i].name,
standardCode: relList[i].standardCode,
standardName: relList[i].standardName,
groupName: relList[i].groupName,
groupId: relList[i].groupId,
compareSymbol: relList[i].compareSymbol,
limitValue: relList[i].limitValue,
unit: relList[i].unit,
judged: relList[i].judged,
remark: relList[i].remark,
status: 'true'
}
this.getPage.records.push(data)
this.getPage.total++
this.$emit('on-result-change', this.getPage.records)
}
}
if (flag) {
this.$Message.warning('您所选项目包与已添加检测项目重复!')
}
},
_itemSelectBack(ids) {
alert(ids)
},
// 删除
_deleteByIds(rows, content) {
for (let i = 0; i < rows.length; i++) {
const index = this.getPage.records.indexOf(rows[i])
this.getPage.records.splice(index, 1)
}
this.$Message.success('操作成功')
this.$emit('on-result-change', this.getPage.records)
},
// 操作列操作
_iconClick(res, data) {
switch (res) {
case '删除':
this._deleteByIds([data])
break
}
},
// table结果 返回整行
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'selectData':
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
}
}
}
}
</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 @@ ...@@ -97,12 +97,17 @@
<Input v-model="formObj.quantity" name="quantity" placeholder="数量" /> <Input v-model="formObj.quantity" name="quantity" placeholder="数量" />
</Form-item> </Form-item>
<Form-item label="是否流转" prop="flowed" class="width-32"> <Form-item label="是否流转" prop="flowed" class="width-32">
<el-radio v-model="formObj.flowed" label="0" @change="show"> <!-- <el-radio v-model="formObj.flowed" label="0" @change="show">-->
<!-- 否-->
</el-radio> <!-- </el-radio>-->
<el-radio v-model="formObj.flowed" label="1" @change="show"> <!-- <el-radio v-model="formObj.flowed" label="1" @change="show">-->
<!-- 是-->
</el-radio> <!-- </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>
<!-- <Form-item label="供应商" prop="supplier" class="width-32">--> <!-- <Form-item label="供应商" prop="supplier" class="width-32">-->
...@@ -198,7 +203,7 @@ export default { ...@@ -198,7 +203,7 @@ export default {
spec: '', spec: '',
lotNum: '', lotNum: '',
quantity: '', quantity: '',
flowed: '0', flowed: 1,
supplier: '', supplier: '',
supplierId: '', supplierId: '',
catalogueId: '', catalogueId: '',
......
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
<div v-else-if="item.status"> <div v-else-if="item.status">
{{ scope.row[item.key].display }} {{ scope.row[item.key].display }}
</div> </div>
<div v-else-if="item.key==='flowed'">
{{ scope.row[item.key]===0?'否':'是' }}
</div>
<div v-else> <div v-else>
{{ scope.row[item.key] }} {{ scope.row[item.key] }}
</div> </div>
...@@ -96,12 +99,13 @@ export default { ...@@ -96,12 +99,13 @@ export default {
pageColumns: [ pageColumns: [
{ title: '样本编号', key: 'sampleCode', width: 150, fixed: 'left' }, { title: '样本编号', key: 'sampleCode', width: 150, fixed: 'left' },
{ title: '价类', key: 'category', width: 120, type: true }, { 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: 'name', width: 120 },
{ title: '卷制标准版本号', key: 'standard', width: 230 }, { title: '卷制标准版本号', key: 'standard', width: 230 },
{ title: '生产日期', key: 'pcTime', width: 120 }, { title: '生产日期', key: 'pcTime', width: 120 },
{ title: '机台', key: 'samplePoint' }, { title: '机台', key: 'samplePoint' },
{ title: '班次', key: 'classBan', width: 120 }, { title: '班次', key: 'classBan', width: 120 },
{ title: '状态', key: 'status', status: true, width: 120 },
{ title: '备注', key: 'remark', width: 120 } { title: '备注', key: 'remark', width: 120 }
], ],
getPage: {}, getPage: {},
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*/ */
import DrugSampleMaterialIndex from '../pages/drug-register/material/DrugSampleMaterialIndex' import DrugSampleMaterialIndex from '../pages/drug-register/material/DrugSampleMaterialIndex'
import DrugSampleProductIndex from '../pages/drug-register/product/DrugSampleProductIndex' import DrugSampleProductIndex from '../pages/drug-register/product/DrugSampleProductIndex'
import DrugSampleDailyIndex from '../pages/drug-register/daily/DrugSampleProductIndex'
import SampleStable from '../pages/drug-register/stable/SampleStableIndex' import SampleStable from '../pages/drug-register/stable/SampleStableIndex'
export default [ export default [
{ {
...@@ -13,7 +14,12 @@ export default [ ...@@ -13,7 +14,12 @@ export default [
{ {
path: 'product_test', path: 'product_test',
component: DrugSampleProductIndex, component: DrugSampleProductIndex,
meta: { title: '产品检测' } meta: { title: '委托检测' }
},
{
path: 'daily_test',
component: DrugSampleDailyIndex,
meta: { title: '日常检测' }
}, },
{ {
path: 'stable', 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