Commit 33912224 by wangweidong

整体优化

parent 8629c021
......@@ -51,6 +51,17 @@ export default {
pageSampleInStock: data =>
http.post('meter/v1/sample/page_sample_in_stock', data).then(res => res),
pageSampleInStockHis: data =>
http
.post('meter/v1/sample/page_sample_in_stock_his', data)
.then(res => res),
pageSampleOutStock: data =>
http.post('meter/v1/sample/page_sample_out_stock', data).then(res => res),
pageSampleOutStockHis: data =>
http
.post('meter/v1/sample/page_sample_out_stock_his', data)
.then(res => res),
pageCertificateMake: data =>
http.post('meter/v1/sample/page_certificate_make', data).then(res => res),
......@@ -117,6 +128,16 @@ export default {
.post('meter/v1/sample/subpackage_out_stock?ids=' + data.ids, data.obj)
.then(res => res),
sampleInStock: data =>
http
.put('meter/v1/sample/sample_in_stock/' + data.ids, data.obj)
.then(res => res),
sampleOutStock: data =>
http
.put('meter/v1/sample/sample_out_stock/' + data.ids, data.obj)
.then(res => res),
subpackageInStock: data =>
http
.post('meter/v1/sample/subpackage_in_stock?ids=' + data.ids, data.obj)
......
......@@ -2,7 +2,7 @@
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="待完成" name="wait">
<MeterGoOutEntrust ref="waitTabs"></MeterGoOutEntrust>
</el-tab-pane>
......@@ -28,6 +28,22 @@ export default {
return {
activeName: 'wait'
}
},
mounted() {
this.activeName = 'wait'
this._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'wait') {
this._page()
} else {
this.$refs.hisTabs._page()
}
},
_page() {
this.$refs.waitTabs._page()
}
}
}
</script>
......
......@@ -6,24 +6,21 @@
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
<Form-item class="search-item" label="样品名称:">
<Input v-model="formObj.name" name="name" placeholder="请输入样品名称" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
<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"
class="contHide"></btn-list>
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick"></btn-list>
</Col>
<!--表格-->
<Col span="24">
......@@ -57,12 +54,15 @@
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<WarehousePersonSelect ref="warehousePersonSelectModal" @on-result-change="_page"></WarehousePersonSelect>
</div>
</template>
<script>
import { meterDevice, meterSample } from '../../../api'
import WarehousePersonSelect from './WarehousePersonSelect'
export default {
components: {},
components: { WarehousePersonSelect },
data() {
return {
currentComponent: '',
......@@ -72,17 +72,10 @@ export default {
{
type: 'success',
id: '',
name: '提交'
name: '入库'
}
],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{ type: 'md-cloud', id: '', name: '附件' }
],
iconMsg: [{ type: 'md-cloud', id: '', name: '附件' }],
formObj: {
name: undefined,
aptitude: undefined
......@@ -130,7 +123,7 @@ export default {
case '添加':
this._editModal(false)
break
case '提交':
case '入库':
this._submitToReview()
break
case 'search':
......@@ -150,7 +143,12 @@ export default {
}
},
_submitToReview() {
this._submitByContractIds('委托评审')
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.warehousePersonSelectModal._open(ids)
}
},
_submitByContractIds(cont) {
const ids = this.selectIds
......
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" width="700">
<p slot="header">样品入库</p>
<div>
<Form id="batch-edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90">
<Form-item label="入库人:" prop="inner">
<Input v-model="formObj.inner" @click.native="_selectStaff" readonly name="inner"></Input>
</Form-item>
<Form-item label="入库时间:" prop="inTime">
<div class="block">
<el-date-picker
v-model="formObj.inTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间">
</el-date-picker>
</div>
</Form-item>
<!-- <Form-item label="备注" prop="remark">-->
<!-- <Input v-model="formObj.remark" :rows="3" type="textarea"-->
<!-- name="remark"-->
<!-- placeholder="请输入备注"/>-->
<!-- </Form-item>-->
</Form>
</div>
<div slot="footer">
<ModalFooter ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></ModalFooter>
</div>
</Modal>
<!--选择实验室-->
<UserInfo ref="userModal" @on-result-change="_userData" is-change></UserInfo>
</div>
</template>
<script>
import Global from '../../../api/config'
import ModalFooter from '../../../components/base/modalFooter'
import UserInfo from '../../../components/user-info-single/assignPerson'
import { meterSample } from '../../../api'
/**
* 添加编辑分包信息
*/
const defVal = {
inner: undefined,
innerId: undefined,
inTime: undefined,
remark: undefined
}
export default {
components: {
ModalFooter,
UserInfo
// AutoCompletes
},
data() {
return {
ids: [],
selectData: [],
formObj: defVal,
ruleValidate: {
// price: [{required: true, message: '分包价不能为空', trigger: 'blur', type: 'number'}],
},
showModal: false,
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
labList: []
}
},
methods: {
_labResult(data) {
console.log(data)
},
getNowTime() {
const now = new Date()
const year = now.getFullYear() // 得到年份
let month = now.getMonth() // 得到月份
let date = now.getDate() // 得到日期
let hour = now.getHours()
let min = now.getMinutes()
let second = now.getSeconds()
month = month + 1
month = month.toString().padStart(2, '0')
date = date.toString().padStart(2, '0')
hour = hour.toString().padStart(2, '0')
min = min.toString().padStart(2, '0')
second = second.toString().padStart(2, '0')
const defaultDate = `${year}-${month}-${date} ${hour}:${min}:${second}`
// this.$set(this.searchFormField, 'date', defaultDate)
console.log(now)
console.log('当前时间', defaultDate)
console.log('时间', now)
// this.formObj.outTime = now
this.formObj.inTime = defaultDate
// this.$set(this.searchFormField, 'date', defaultDate)
},
_userData(data, msg, contractTempData) {
if (msg === 'salesman') {
// 选择业务员
this.formObj.inner = data.realname
// this.formObj.detail.salesmanId = data.userId
// this.formObj.detail.salesmanPhone = data.mobile
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_selectStaff() {
this.$refs.userModal._open('salesman')
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_ok() {
this._subpackageOutStock({ ids: this.ids, obj: this.formObj })
},
_subpackageOutStock: async function(data) {
const result = await meterSample.sampleInStock(data)
if (result) {
this.$Message.success('样品入库成功!')
this.$emit('on-result-change')
this.showModal = false
this._hideLoading()
}
},
_cancel() {
this.showModal = false
},
_open(ids, selectData) {
this.formObj = {
inner: undefined,
innerId: undefined,
inTime: undefined,
remark: undefined
}
this._userInfo()
this.getNowTime()
this._hideLoading()
this.$refs.formObj.resetFields()
this.showModal = true
this.ids = ids
this.selectData = selectData
},
_labChange(msg, data) {
switch (msg) {
case 'query':
this.formObj.subcontractor = data.name
this._getLab(data.name)
break
}
},
_userInfo() {
const user = Global.getUserInfo('userInfo')
this.formObj.inner = user.realname
this.formObj.innerId = user.id
},
_labSel() {
const voList = []
for (let i = 0; i < this.selectData.length; i++) {
voList.push({
itemName: this.selectData[i].itemName,
testBasis: this.selectData[i].testBasis
})
}
this.$refs.labModal._open(voList, 'batch-lab-form')
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="样品名称:">
<Input v-model="formObj.name" name="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" class="contHide"
@on-result-change="_btnClick"></btn-list>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" >
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.key==='type'">
<span v-if="scope.row[item.key]===0">
检定
</span>
<span v-else-if="scope.row[item.key]===1">
校准
</span>
<span v-else-if="scope.row[item.key]===2">
外观检查
</span>
</span>
<div v-else-if="item.dateTime">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):''}}</div>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<WarehousePersonSelect ref="warehousePersonSelectModal" @on-result-change="_page"></WarehousePersonSelect>
</div>
</template>
<script>
import { meterDevice, meterSample } from '../../../api'
import WarehousePersonSelect from './WarehousePersonSelect'
export default {
components: { WarehousePersonSelect },
data() {
return {
currentComponent: '',
formId: 'meterWarehouseInFormId',
searchOpen: false,
btn: [
// {
// type: 'success',
// id: '',
// name: '入库'
// }
],
iconMsg: [{ type: 'md-cloud', id: '', name: '附件' }],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '样品名称', key: 'name', width: 120 },
{ title: '样品编号', key: 'code', width: 120 },
{ title: '入库人', key: 'sampleInner', width: 130 },
{
title: '入库时间',
key: 'sampleInnerTime',
width: 120,
dateTime: true
},
{ title: '出库人', key: 'sampleOuter', width: 130 },
{
title: '出库时间',
key: 'sampleOutTime',
width: 120,
dateTime: true
},
{ title: '型号规格', key: 'spec' },
{ title: '出厂编号', key: 'factoryNumber' },
{ title: '检测类型', key: 'type' },
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '数量', key: 'quantity' },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '仪器领用':
this._receiveApparatus()
break
case '车辆管理':
this._carManage()
break
case '添加':
this._editModal(false)
break
case '入库':
this._submitToReview()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_carManage() {
this.$refs.carEdit._open()
},
_receiveApparatus() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.SelEquip._open('sample-input')
}
},
_submitToReview() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.warehousePersonSelectModal._open(ids)
}
},
_submitByContractIds(cont) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要把这 ' + ids.length + ' 条记录提交到' + cont + '?',
onOk: () => {
const result = meterSample.submit(ids)
if (result) {
console.log(result)
}
}
})
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '仪器领用':
this.$refs.InstruEdit._open()
break
case '车辆管理':
this.$refs.carEdit._open()
break
case '编辑':
// this._editModal(true, data.id)
this._personModal(data)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_personModal(data) {
console.log(data)
this.$refs.personModal._open(data.id)
},
_equipSelectBack(data) {
console.log('_equipSelectBack', data)
const equipData = []
for (let i = 0; i < data.length; i++) {
const object = data[i]
const obj = {}
obj.name = object.name
obj.certificateNo = object.ceNum
obj.measuringRange = object.range
obj.uncertaintyAccuray = object.uncertainty
obj.validUntil = object.effectDate
equipData.push(obj)
}
this._addEquipUse({ sampleIds: this.selectIds, devicesList: equipData })
},
_addEquipUse: async function(data) {
const result = await meterDevice.addEquipUse(data)
if (result) {
await this._page()
}
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectIds':
this.selectIds = data
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await meterSample.pageSampleOutStockHis(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSample.getById(id)
if (result) {
this.$refs.editSubcontractorModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await meterSample.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<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="wait">
<MeterGoOutEntrust ref="waitTabs"></MeterGoOutEntrust>
</el-tab-pane>
<el-tab-pane label="历史记录" name="his">
<MeterGoOutEntrustHis ref="hisTabs"></MeterGoOutEntrustHis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import MeterGoOutEntrust from './MeterWarehouseOut'
import MeterGoOutEntrustHis from './MeterMeterWarehouseOutHis'
export default {
name: 'MeterGoOutEntrustIndex',
components: {
MeterGoOutEntrust,
MeterGoOutEntrustHis
},
data() {
return {
activeName: 'wait'
}
},
mounted() {
this.activeName = 'wait'
this._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'wait') {
this._page()
} else {
this.$refs.hisTabs._page()
}
},
_page() {
this.$refs.waitTabs._page()
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="样品名称:">
<Input v-model="formObj.name" name="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" class="contHide"
@on-result-change="_btnClick"></btn-list>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" >
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.key==='type'">
<span v-if="scope.row[item.key]===0">
检定
</span>
<span v-else-if="scope.row[item.key]===1">
校准
</span>
<span v-else-if="scope.row[item.key]===2">
外观检查
</span>
</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<WarehousePersonSelect ref="warehousePersonSelectModal" @on-result-change="_page"></WarehousePersonSelect>
</div>
</template>
<script>
import { meterDevice, meterSample } from '../../../api'
import WarehousePersonSelect from './WarehousePersonSelect'
export default {
components: { WarehousePersonSelect },
data() {
return {
currentComponent: '',
formId: 'meterWarehouseInFormId',
searchOpen: false,
btn: [
{
type: 'success',
id: '',
name: '出库'
}
],
iconMsg: [{ type: 'md-cloud', id: '', name: '附件' }],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '样品名称', key: 'name', width: 120 },
{ title: '样品编号', key: 'code', width: 120 },
{ title: '型号规格', key: 'spec' },
{ title: '出厂编号', key: 'factoryNumber' },
{ title: '检测类型', key: 'type' },
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '数量', key: 'quantity' },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '仪器领用':
this._receiveApparatus()
break
case '车辆管理':
this._carManage()
break
case '添加':
this._editModal(false)
break
case '出库':
this._submitToReview()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_carManage() {
this.$refs.carEdit._open()
},
_receiveApparatus() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.SelEquip._open('sample-input')
}
},
_submitToReview() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.warehousePersonSelectModal._open(ids)
}
},
_submitByContractIds(cont) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要把这 ' + ids.length + ' 条记录提交到' + cont + '?',
onOk: () => {
const result = meterSample.submit(ids)
if (result) {
console.log(result)
}
}
})
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '仪器领用':
this.$refs.InstruEdit._open()
break
case '车辆管理':
this.$refs.carEdit._open()
break
case '编辑':
// this._editModal(true, data.id)
this._personModal(data)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_personModal(data) {
console.log(data)
this.$refs.personModal._open(data.id)
},
_equipSelectBack(data) {
console.log('_equipSelectBack', data)
const equipData = []
for (let i = 0; i < data.length; i++) {
const object = data[i]
const obj = {}
obj.name = object.name
obj.certificateNo = object.ceNum
obj.measuringRange = object.range
obj.uncertaintyAccuray = object.uncertainty
obj.validUntil = object.effectDate
equipData.push(obj)
}
this._addEquipUse({ sampleIds: this.selectIds, devicesList: equipData })
},
_addEquipUse: async function(data) {
const result = await meterDevice.addEquipUse(data)
if (result) {
await this._page()
}
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectIds':
this.selectIds = data
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await meterSample.pageSampleOutStock(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSample.getById(id)
if (result) {
this.$refs.editSubcontractorModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await meterSample.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" width="700">
<p slot="header">样品出库</p>
<div>
<Form id="batch-edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90">
<Form-item label="出库人:" prop="outer">
<Input v-model="formObj.outer" @click.native="_selectStaff" readonly name="outer"></Input>
</Form-item>
<Form-item label="出库时间:" prop="outTime">
<div class="block">
<el-date-picker
v-model="formObj.outTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间">
</el-date-picker>
</div>
</Form-item>
<!-- <Form-item label="备注" prop="remark">-->
<!-- <Input v-model="formObj.remark" :rows="3" type="textarea"-->
<!-- name="remark"-->
<!-- placeholder="请输入备注"/>-->
<!-- </Form-item>-->
</Form>
</div>
<div slot="footer">
<ModalFooter ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></ModalFooter>
</div>
</Modal>
<!--选择实验室-->
<UserInfo ref="userModal" @on-result-change="_userData" is-change></UserInfo>
</div>
</template>
<script>
import Global from '../../../api/config'
import ModalFooter from '../../../components/base/modalFooter'
import UserInfo from '../../../components/user-info-single/assignPerson'
import { meterSample } from '../../../api'
/**
* 添加编辑分包信息
*/
const defVal = {
outer: undefined,
outerId: undefined,
outTime: undefined,
remark: undefined
}
export default {
components: {
ModalFooter,
UserInfo
// AutoCompletes
},
data() {
return {
ids: [],
selectData: [],
formObj: defVal,
ruleValidate: {
// price: [{required: true, message: '分包价不能为空', trigger: 'blur', type: 'number'}],
},
showModal: false,
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
labList: []
}
},
methods: {
_labResult(data) {
console.log(data)
},
getNowTime() {
const now = new Date()
const year = now.getFullYear() // 得到年份
let month = now.getMonth() // 得到月份
let date = now.getDate() // 得到日期
let hour = now.getHours()
let min = now.getMinutes()
let second = now.getSeconds()
month = month + 1
month = month.toString().padStart(2, '0')
date = date.toString().padStart(2, '0')
hour = hour.toString().padStart(2, '0')
min = min.toString().padStart(2, '0')
second = second.toString().padStart(2, '0')
const defaultDate = `${year}-${month}-${date} ${hour}:${min}:${second}`
// this.$set(this.searchFormField, 'date', defaultDate)
console.log(now)
console.log('当前时间', defaultDate)
console.log('时间', now)
// this.formObj.outTime = now
this.formObj.outTime = defaultDate
// this.$set(this.searchFormField, 'date', defaultDate)
},
_userData(data, msg, contractTempData) {
if (msg === 'salesman') {
// 选择业务员
this.formObj.outer = data.realname
// this.formObj.detail.salesmanId = data.userId
// this.formObj.detail.salesmanPhone = data.mobile
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_selectStaff() {
this.$refs.userModal._open('salesman')
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_ok() {
this._subpackageOutStock({ ids: this.ids, obj: this.formObj })
},
_subpackageOutStock: async function(data) {
const result = await meterSample.sampleOutStock(data)
if (result) {
this.$Message.success('样品出库成功!')
this.$emit('on-result-change')
this.showModal = false
this._hideLoading()
}
},
_cancel() {
this.showModal = false
},
_open(ids, selectData) {
this.formObj = {
outer: undefined,
outerId: undefined,
outTime: undefined,
remark: undefined
}
this._userInfo()
this.getNowTime()
this._hideLoading()
this.$refs.formObj.resetFields()
this.showModal = true
this.ids = ids
this.selectData = selectData
},
_labChange(msg, data) {
switch (msg) {
case 'query':
this.formObj.subcontractor = data.name
this._getLab(data.name)
break
}
},
_userInfo() {
const user = Global.getUserInfo('userInfo')
this.formObj.outer = user.realname
this.formObj.outerId = user.id
},
_labSel() {
const voList = []
for (let i = 0; i < this.selectData.length; i++) {
voList.push({
itemName: this.selectData[i].itemName,
testBasis: this.selectData[i].testBasis
})
}
this.$refs.labModal._open(voList, 'batch-lab-form')
}
}
}
</script>
......@@ -35,6 +35,7 @@ import MeterContractFileIndex from '../pages/meter-contract/contract-file/MeterC
import MeterSampleProgress from '../pages/meter-progress/progress-sample/MeterSampleProgress'
import MeterClientOnlineEntrustIndex from '../pages/meter-entrust/client-online/MeterClientOnlineEntrustIndex'
import MeterMeterWarehouseInIndex from '../pages/meter-warehouse/warehouse-in/MeterMeterWarehouseInIndex'
import MeterMeterWarehouseOutIndex from '../pages/meter-warehouse/warehouse-out/MeterMeterWarehouseOutIndex'
import Blank from '~/pages/blank'
export default [
{
......@@ -233,6 +234,11 @@ export default [
path: 'sample_in_store',
component: MeterMeterWarehouseInIndex,
meta: { title: '样品入库管理' }
},
{
path: 'sample_out_store',
component: MeterMeterWarehouseOutIndex,
meta: { title: '样品出库管理' }
}
]
}
......
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