Commit fc6730f3 by lichengming

修改了仪器领用和车辆管理

parent ada0b339
......@@ -13,6 +13,7 @@ export { default as sysAddress } from './sys/sys-address'
export { default as lmsMarshalManage } from './lims/lms-marshal-manage'
export { default as lmsUserGroup } from './lims/lms-user-group'
export { default as lmsSupplier } from './lims/lms-supplier'
export { default as equip } from './lims/lms-equip-info'
/**
*工作流
......
......@@ -8,6 +8,9 @@ import { https } from '../https'
export default {
// page
page: data => http.post('meter/v1/sample/page', data).then(res => res),
// 车辆管理
pageCarManage: data =>
http.post('/res/v1/car_info/page_car_manage', data).then(res => res),
// 个人任务
pagePersonTask: data =>
http.post('meter/v1/item/page', data).then(res => res),
......
<template>
<div>
<div>
<Form onsubmit="return false">
<Form-item>
<Input v-model="key" @on-enter="_search" placeholder="请输入关键字,回车查询" style="width:100%"
icon="ios-search-strong"/>
</Form-item>
</Form>
</div>
<!--加载中-->
<div v-show="loading" class="demo-spin-container spin-bg">
<Spin fix size="large"></Spin>
</div>
<ul :id="treeId" v-show="isTree" class="ztree ztreePro tree_height"
style="overflow-x: auto;height:360px"></ul>
</div>
</template>
<script>
import { equip } from '../../api'
/**
* 添加编辑Ztree
*/
let setting
export default {
data() {
return {
key: '',
loading: true,
isTree: false,
treeId: ''
}
},
mounted() {},
methods: {
_treeHeight() {
$('.tree_height').height(document.documentElement.clientHeight - 290)
},
_open: async function() {
this.treeId = 'equip' + this.$randomCode()
this._treeHeight()
this.key = ''
this.loading = true
this.isTree = false
setting = {
data: {
simpleData: {
enable: true,
idKey: 'id',
pIdKey: 'pid'
}
},
callback: {
onClick: this._zTreeOnClick
}
}
// this.$store.dispatch('LmsEquipClass/list').then(() => {
// $.fn.zTree.init(
// $('#' + this.treeId),
// setting,
// this.$store.state.LmsEquipClass.list
// )
const result = await equip.pageEquipList()
console.log('列表数据', result)
if (result) {
$.fn.zTree.init($('#' + this.treeId), setting, result)
setTimeout(() => {
this.loading = false
this.isTree = true
}, 300)
}
// })
},
_zTreeOnClick(event, treeId, treeNode) {
this.$emit('on-result-change', treeNode.id)
},
_search() {
if (this.key !== '') {
this.loading = true
this.isTree = false
this.$store
.dispatch('LmsEquipClass/list', { name: this.key })
.then(() => {
$.fn.zTree.init(
$('#' + this.treeId),
setting,
this.$store.state.LmsEquipClass.list
)
setTimeout(() => {
this.loading = false
this.isTree = true
}, 300)
})
} else {
this._open()
}
}
}
}
</script>
<template>
<div>
<ElTableNoPage ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage">
<el-table-column
:prop="item.key"
:label="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{scope.row[item.key]}}</span>
</template>
</el-table-column>
</ElTableNoPage>
</div>
</template>
<script>
/**
* 已选中
*/
import ElTableNoPage from '../table/ElTableNoPage'
export default {
components: {
ElTableNoPage
},
data() {
return {
// tableHeight: document.documentElement.clientHeight - 225,
tableHeight: 500,
getPage: {
records: []
},
pageColumns: [
{ title: '仪器名称', key: 'name', width: 160 },
{ title: '仪器编号', key: 'labNum', width: 100 },
{ title: '品牌', key: 'brand', width: 100 },
{ title: '规格型号', key: 'spec', width: 100 },
{ title: '描述', key: 'remark' }
],
selectIds: []
}
},
mounted() {
this.$refs.pageTable._hideLoading()
this._empty()
},
methods: {
// 添加
_open(data) {
for (let i = 0; i < data.length; i++) {
this.getPage.records.push(data[i])
}
// this.getPage.records = this.$uniqueArrayItem(this.getPage.records, 'id')
this.$emit('on-result-change', this.getPage.records, [])
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectIds':
this.selectIds = data
break
}
this.$emit('on-result-change', this.getPage.records, this.selectIds)
},
// 删除
_delData() {
for (let j = 0; j < this.selectIds.length; j++) {
for (let i = 0; i < this.getPage.records.length; i++) {
if (this.getPage.records[i].id === this.selectIds[j]) {
this.getPage.records.splice(i, 1)
}
}
}
this.$emit('on-result-change', this.getPage.records, [])
},
_empty() {
this.getPage.records = []
this.$emit('on-result-change', [], [])
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="100" class="full-screen zIndex-1200">
<div slot="header">设备管理</div>
<div>
<Collapse @on-result-change="_optionResult" left-title="仪器类别" right-title="已选仪器" left-width="15">
<template slot="left">
<Row :gutter="16">
<Col span="10">
<EquipClassTree ref="equipClassTree" :z-tree-id="treeName"
@on-result-change="_searchEquip"></EquipClassTree>
</Col>
<Col span="14">
<div>
<div>
<Form :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="仪器名称:" style="width: 40%">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入仪器名称"/>
</Form-item>
<Form-item label="仪器编号:" style="width: 40%">
<Input v-model="formObj.labNum" @on-enter="_formSearch" placeholder="请输入仪器编号"/>
</Form-item>
<Form-item style="margin-left: -60px">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</div>
<ElementTable ref="pageTable" :tableHeight="tableHeight" @on-result-change="_tableResultChange" :getPage="getPage"
hide-elevator hide-sizer hide-total select-data >
<el-table-column
:prop="item.key"
:label="item.title"
:width="item.width"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{scope.row[item.key]}}</span>
</template>
</el-table-column>
</ElementTable>
</div>
</Col>
</Row>
</template>
<template slot="right">
<Equiped ref="equipedModal" @on-result-change="_rightResult"></Equiped>
</template>
</Collapse>
</div>
<div slot="footer">
<ModalFooter ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></ModalFooter>
</div>
</Modal>
</div>
</template>
<script>
import Collapse from '../base/Collapse'
import ElementTable from '../table/elementTable'
import ModalFooter from '../base/modalFooter'
import { equip } from '../../api'
import EquipClassTree from './EquipClassTree'
import Equiped from './Equiped'
export default {
components: {
Collapse,
Equiped,
EquipClassTree,
ElementTable,
ModalFooter
},
data() {
return {
// tableHeight: document.documentElement.clientHeight - 320,
tableHeight: 500,
getPage: {},
pageColumns: [
{ title: '仪器名称', key: 'name', width: 160 },
{ title: '仪器编号', key: 'labNum', width: 100 },
{ title: '品牌', key: 'brand', width: 100 },
{ title: '规格型号', key: 'spec', width: 100 },
{ title: '描述', key: 'remark', width: 260 }
],
selectData: [],
showModal: false,
// 选中要删除的id
delIds: [],
// 要提交的数据
tempData: [],
footerList: [
{ name: '取消', type: '' },
{ name: '确定', type: 'primary' }
],
// 用于区别仪器ztree
treeName: '',
tempObj: '', // 临时数据
formObj: {
name: '',
labNum: '',
classId: ''
}
}
},
methods: {
_open(treeName, tempObj) {
this.showModal = true
this.formObj = this.$resetFields(this.formObj)
this._hideLoading()
if (treeName === undefined || treeName === '') {
this.treeName = 'equipClassTree' + this.$randomCode()
} else {
this.treeName = treeName + this.$randomCode()
}
this.$refs.equipClassTree._open()
this._page()
this.$refs.equipedModal._empty()
this.tempData = []
this.selectData = []
this.delIds = []
this.tempObj = tempObj
},
// modal-footer
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_page: async function() {
// this.$refs.pageTable._page(
// '',
// 'LmsEquipInfo/page',
// this.$serializeFormSearch(this.formObj)
// )
const result = await equip.page()
console.log('仪器结果', result)
if (result) {
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.LmsEquipInfo.page
break
case 'selectData':
this.selectData = data
break
case 'dbSelect':
this.selectData = [data]
this._add()
break
default:
this._page()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 添加
_add() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.equipedModal._open(this.selectData)
this._page()
}
},
// 删除
_del() {
if (this.delIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.equipedModal._delData()
}
},
_searchEquip(id) {
this.formObj.classId = id
this._formSearch()
},
_rightResult(data, ids) {
this.delIds = ids
this.tempData = data
},
_optionResult(name) {
switch (name) {
case '添加':
this._add()
break
case '删除':
this._del()
break
}
},
_ok() {
if (this.tempData.length === 0) {
this.$Message.warning('请至少选择一条数据!')
this._hideLoading()
} else {
this.$emit('on-result-change', this.tempData, { obj: this.tempObj })
this._cancel()
}
},
_cancel() {
this.showModal = false
}
}
}
</script>
<template>
<div>
<el-table
:show-summary="showSummary !== undefined?true:false"
:data="getPage.records"
ref="moveTable"
:height="300"
v-loading="loading"
@select-all="_selectAll"
@selection-change="_selectRowChange"
@cell-click="_cellClick"
@current-change="_currentChange"
@row-dblclick="_dbClickRow"
:row-class-name="_tableRowClassName"
stripe
border
size="small"
style="width: 100%;"
element-loading-text="拼命加载中..."
>
<el-table-column
v-if="hideCheckbox===undefined"
type="selection"
width="55"
fixed="left"
align="center">
</el-table-column>
<slot></slot>
<el-table-column
:width="$optColWidth(iconMsg)"
v-if="$optColWidth(iconMsg)>0?true:false"
label="操作"
align="center" fixed="right">
<template slot-scope="scope">
<IconList :msg="iconMsg" @on-result-change="_iconClick" :rowData="scope.row"
:rowIndex="scope.$index"></IconList>
</template>
</el-table-column>
<slot name="col"></slot>
</el-table>
</div>
</template>
<script>
export default {
name: 'PageTable',
props: {
pageColumns: null,
tableHeight: null,
hideCheckbox: null,
optColWidth: null,
getPage: null,
iconMsg: null,
warnKey: null,
selectData: null,
clickValue: null,
dbClickRow: null,
editable: null,
showSummary: null // 是否显示总计
},
data() {
return {
loading: true,
rowData: {},
extendsData: {}, // 扩展数据,数据传不过来使用
checkData: []
}
},
methods: {
// 点击单元格触发
_cellClick(row, event, column) {
if (event.label === '操作') {
} else {
this._rowClickChange(row)
}
},
// 获取当前行数据与上一行数据
_currentChange(currentRow, oldCurrentRow) {
if (this.editable !== undefined) {
if (currentRow) {
this.$set(currentRow, 'editable', true)
}
if (oldCurrentRow) {
this.$set(oldCurrentRow, 'editable', false)
}
}
},
_rowClickChange(row) {
this.checkData = [row]
if (this.clickValue === undefined) {
// 默认选中该行数据
this.$refs.moveTable.toggleRowSelection(row)
} else {
// 有clickValue参数时执行
this.$emit('on-result-change', 'select', row)
}
},
// 整行变色
_tableRowClassName({ row, rowIndex }) {
if (this.checkData.length !== 0) {
/* 选中的进行高亮显示 */
const index = this.checkData.indexOf(row)
if (index !== -1) {
return 'high-light-row'
} else {
/* 没选中的根据页面逻辑变色 */
return this._rowClassName(row, rowIndex)
}
} else {
/* 没选中的根据页面逻辑变色 */
return this._rowClassName(row, rowIndex)
}
},
_rowClassName(row, rowIndex) {
return ''
},
_checkAll() {
this.$refs.moveTable.toggleAllCheckboxRow()
},
_page(formId, uri, extendsData) {
this.loading = true
this.formId = formId
const data = this.$serialize(this.formId)
if (extendsData) {
this.extendsData = extendsData
Object.assign(data, this.extendsData)
}
this.$store.dispatch(uri, data).then(() => {
this.loading = false
this.$emit('on-result-change', 'page', '')
})
},
// 多选
_selectRowChange(data) {
if (this.hideCheckbox === undefined) {
this.checkData = data
if (this.selectData !== undefined) {
this.$emit('on-result-change', 'selectData', data)
} else {
const idList = []
for (let i = 0; i < data.length; i++) {
idList.push(data[i].id)
}
// 有checkbox 则返回选中的id数组
this.$emit('on-result-change', 'selectIds', idList)
}
}
},
_selectAll: function(data) {
this._selectRowChange(data)
},
// 操作列回调
_iconClick(name, rowData, componentName, rowIndex) {
this.$emit('on-result-change', 'iconClick', {
name: name,
rowData: rowData,
componentName: componentName,
rowIndex: rowIndex
})
},
// 关闭loading
_hideLoading() {
this.loading = false
},
// 打开loading
_showLoading() {
this.loading = true
},
// 双击行操作
_dbClickRow(row, event) {
if (this.dbClickRow === undefined) {
// 默认是有双击操作的,若此参数有值,则不返回
this.$emit('on-result-change', 'dbSelect', row)
}
}
}
}
</script>
......@@ -31,6 +31,8 @@ export default {
}
}
const result = await sysOrg.orgTreeList()
console.log('tree结果')
console.log(result)
if (result) {
$.fn.zTree.init($('#' + this.treeName), setting, result)
treeObj = $.fn.zTree.getZTreeObj(this.treeName)
......@@ -46,6 +48,8 @@ export default {
},
zTreeOnClick(event, treeId, treeNode) {
this.$emit('on-result-change', treeNode)
console.log('zTree')
console.log(treeNode)
}
}
}
......
<template>
<!--仓库-->
<Modal v-model="showModal" width="1000">
<p slot="header">选择车辆</p>
<Form onsubmit="return false">
<Form-item>
<Input v-model="license" @on-enter="_search" placeholder="请输入车牌号,回车查询" style="width:100%"
icon="ios-search-strong"/>
</Form-item>
</Form>
<Row>
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" select-data>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.date">{{$dateformat(scope.row[item.key],'yyyy-mm-dd')}}</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<ModalFooter ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></ModalFooter>
</div>
</Modal>
</template>
<script>
/**
* 选择车辆
*/
import ModalFooter from '../../../components/base/modalFooter'
import { meterSample } from '../../../api'
export default {
components: {
ModalFooter
},
data() {
return {
showModal: false,
license: '',
selectNames: '',
selectIds: '',
getPage: {},
tableHeight: '300',
pageColumns: [
{ title: '车牌号', key: 'license' },
{ title: '品牌', key: 'brand' },
{ title: '所属类型', key: 'type' },
{ title: '购买/租用时间', key: 'buyDate' },
{ title: '备注', key: 'remark' }
],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' }
]
}
},
methods: {
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open() {
this.showModal = true
this.license = ''
this._page()
},
_page: async function() {
const data = {}
if (this.license) {
data.license = this.license
}
// this.$refs.pageTable._page('search-form-car', 'LmsCarInfo/page', data)
const result = await meterSample.pageCarManage(data)
console.log('result', result)
if (result) {
this.getPage = result
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.selectNames = []
this.getPage = this.$store.state.LmsCarInfo.page
break
case 'selectData':
const nameList = []
const idList = []
for (let i = 0; i < data.length; i++) {
nameList.push(data[i].license)
idList.push(data[i].id)
}
this.selectIds = idList
this.selectNames = nameList
break
case 'changeSize':
this._page()
break
}
},
_ok() {
this.$emit('on-result-change', {
ids: this.selectIds,
names: this.selectNames
})
this.showModal = false
this._hideLoading()
},
_cancel() {
this.showModal = false
this._hideLoading()
},
_search() {
// tree查询
this._page()
}
}
}
</script>
......@@ -45,16 +45,25 @@
</Row>
</div>
</div>
<SelEquip ref="SelEquip"></SelEquip>
<CarManage ref="carEdit"></CarManage>
<MeterPersonSampleManage ref="personModal"></MeterPersonSampleManage>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
</div>
</template>
<script>
import { meterSample } from '../../../api'
import SelEquip from '../../../components/select-equip/SelEquip'
import MeterSubcontractorEdit from './MeterGoOutTestEdit'
import MeterPersonSampleManage from './MeterPersonSampleManage'
import CarManage from './CarManage'
export default {
components: { MeterSubcontractorEdit, MeterPersonSampleManage },
components: {
MeterSubcontractorEdit,
MeterPersonSampleManage,
CarManage,
SelEquip
},
data() {
return {
currentComponent: '',
......@@ -138,6 +147,12 @@ export default {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '仪器领用':
this._receiveApparatus()
break
case '车辆管理':
this._carManage()
break
case '添加':
this._editModal(false)
break
......@@ -150,6 +165,12 @@ export default {
}
})
},
_carManage() {
this.$refs.carEdit._open()
},
_receiveApparatus() {
this.$refs.SelEquip._open('sample-input')
},
_submitToReview() {
this._submitByContractIds('委托评审')
},
......
......@@ -105,17 +105,6 @@ export default {
name: '外观检查'
}
],
progress: [
{
name: 'DRAFT'
},
{
name: 'TEST'
},
{
name: 'END'
}
],
formId: 'meterReviewSampleManageFormId',
showModal: false,
searchOpen: false,
......
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