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>
<template>
<div>
<!--表格-->
<div style="position: relative">
<div>
<el-table
ref="moveTable"
v-loading="loading"
:stripe="stripe === undefined"
border
size="small"
highlight-current-row
:data="getPage.records"
style="width: 100%"
:height="tableHeight"
:default-sort="{prop: 'date', order: 'descending'}"
element-loading-text="拼命加载中..."
element-loading-spinner="el-icon-loading"
:row-class-name="tableRowClassName"
:height="300"
v-loading="loading"
@select-all="_selectAll"
@selection-change="_selectRowChange"
@row-dblclick="_dbClickRow"
@cell-click="_cellClick"
>
@row-dblclick="_dbClickRow"
:cell-class-name="_tableCellClassName"
:row-class-name="_tableRowClassName"
@current-change="_currentChange"
stripe
border
size="small"
style="width: 100%"
element-loading-text="拼命加载中...">
<el-table-column
v-if="showCheckBox!==undefined&&showCheckBox!==false"
v-if="hideCheckbox===undefined || hideCheckbox === false"
type="selection"
width="55"
fixed="left"
align="center"
/>
<slot />
align="center">
</el-table-column>
<slot></slot>
<el-table-column
v-if="(iconMsg !== undefined &&iconMsg.length) > 0?(optColWidth?true:false):false"
:width="$optColWidth(iconMsg)"
v-if="$optColWidth(iconMsg)>0?true:false"
label="操作"
align="center"
:width="optColWidth"
fixed="right"
>
align="center" fixed="right">
<template slot-scope="scope">
<icon-list :msg="iconMsg" :row-data="scope.row" @on-result-change="_iconClick" />
<IconList :msg="iconMsg" @on-result-change="_iconClick" :rowData="scope.row"
:rowIndex="scope.$index"></IconList>
</template>
</el-table-column>
<slot name="col" />
<slot name="col"></slot>
</el-table>
</div>
<!--自定义表格列-->
<div style="position: absolute;right:0;top:0;z-index:2000">
<slot name="setting" />
<slot name="setting"></slot>
</div>
</div>
<div v-if="statusNum !== undefined" style="position: absolute;bottom: 9px;font-weight: bold">已选择 {{statusNum}} 条</div>
<Page
v-if="hidePage===undefined"
:total="getPage.total"
:page-size="getPage.size"
:current="getPage.current"
:page-size-opts="pageSizeOpts"
placement="top"
:show-elevator="hideElevator===undefined"
:show-total="hideTotal===undefined"
:show-sizer="hideSizer===undefined"
:style="statusNum !== undefined?'margin:10px 0 0 100px': 'margin-top:10px'"
@on-change="_pageChange"
@on-page-size-change="_pageSizeChange"
/>
<Page v-if="hidePage===undefined" :total="getPage.total" :page-size="getPage.size" :current="getPage.current"
@on-change="_pageChange"
@on-page-size-change='_pageSizeChange' :page-size-opts="pageSizeOpts"
:show-elevator="hideElevator===undefined" :show-total="hideTotal===undefined"
:show-sizer="hideSizer===undefined" placement="top"
style="margin: 10px 0 0"></Page>
</div>
</template>
<script>
import { sysTableColumn } from '../../api'
// import { sys-table-column } from '../../../'
export default {
props: [
'pageColumns',
'tableHeight',
'showCheckBox',
'optColWidth',
'getPage',
'iconMsg',
'warnKey',
'selectData',
'hideElevator',
'hideTotal',
'hidePage',
'hideSizer',
'click',
'tableName',
'statusNum',
'stripe',
'pageSizeSmall'
],
name: 'PageTable',
props: {
noHighlight: null, // 不高亮显示
pageColumns: null,
hideCheckbox: null,
optColWidth: null,
getPage: null,
iconMsg: null,
selectData: null,
hidePage: null,
hideElevator: null,
hideTotal: null,
hideSizer: null,
clickValue: null, // 单击返回值
noWarning: null, // 不显示警告提示
isReport: null, // 判断是否是报告
isDataInput: null, // 判断数据录入
isTask: null, // 判断是否是检测管理
isView: null, // 预览报告
isHandle: null, // 样品
tableName: null, // 该值存在,则支持自定义表格
editable: null,
isGC: null // 国抽(抽样单管理)
},
data() {
return {
formId: '', // 表单id
loading: true,
loading: false,
isRowClick: false,
pageParams: {
page: 1,
rows: this.$pageParams()
rows: this.$defRow
},
extendsData: {}, // 扩展数据,数据传不过来使用
rowData: {},
pageSizeOpts: this.$pageSizeOpts()
pageSizeOpts: this.$pageSizeOpts,
sampleHandleValue: '',
checkData: []
}
},
mounted() {
// 样品存储期限预警
this.sampleHandleValue = Number(localStorage.getItem('sampleHandleValue'))
},
methods: {
// 行内样式
tableRowClassName({ row, rowIndex }) {
if (this.warnKey && row.manualJudge === 1) {
return 'warning-row'
}
if (this.warnKey && row[this.warnKey] === 't') return 'warning-bg-yellow'
return ''
},
// 点击单元格触发
_cellClick(row, event, column) {
if (event.label !== '操作') {
if (event.label === '操作') {
} else {
this._rowClickChange(row)
}
},
_rowClickChange(row) {
if (this.click === undefined) {
this.checkData = [row]
if (this.clickValue === undefined) {
// 默认选中该行数据
this.$refs.moveTable.toggleRowSelection(row)
} else {
// 有click参数时执行
this.$emit('on-result-change', 'click', row)
// 有clickValue参数时执行
this.$emit('on-result-change', 'select', row)
}
},
_checkAll() {
this.$refs.moveTable.toggleAllCheckboxRow()
},
_clearSelection() {
this.$refs.moveTable.clearSelection()
},
// 初始化加载
_initTable() {
this.loading = false
// 获取当前行数据与上一行数据
_currentChange(currentRow, oldCurrentRow) {
if (this.editable !== undefined) {
if (currentRow) {
this.$set(currentRow, 'editable', true)
}
if (oldCurrentRow) {
this.$set(oldCurrentRow, 'editable', false)
}
}
},
// 整行变色
_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) {
if (this.isHandle !== undefined && row.endDate) {
// 样品待处理界面
if (this.$warningValue(row.endDate) <= 0) {
return 'warning-row' // 红色
} else if (
this.$warningValue(row.endDate) > 0 &&
this.$warningValue(row.endDate) <= this.sampleHandleValue
) {
return 'warn-row' // 橙色
}
} else {
return ''
}
},
// 单元格变色
_tableCellClassName({ row, column, rowIndex, columnIndex }) {
if (this.isReport !== undefined) {
// 报告管理
if (
column.property === 'sampleProgress' &&
row.sampleProgress &&
row.sampleProgress.indexOf('退回') !== -1
) {
// 含有退回就变红
return 'cell-red'
}
if (
column.property === 'progress' &&
row.progress &&
row.progress.indexOf('退回') !== -1
) {
// 含有退回就变红
return 'cell-red'
}
// 是否合格字体变色
if (
column.property === 'isEligible' &&
row.isEligible &&
row.isEligible === '合格'
) {
return 'cell-blue-color'
} else if (
column.property === 'isEligible' &&
row.isEligible &&
row.isEligible === '不合格'
) {
return 'cell-red-color'
}
} else if (this.isDataInput !== undefined) {
if (
column.property === 'name' &&
row.progress &&
row.progress.display.indexOf('退回') !== -1
) {
// 含有退回就变红
return 'cell-red'
}
} else if (this.isTask !== undefined) {
if (
column.property === 'serviceType' &&
row.serviceType &&
row.serviceType.indexOf('加急') !== -1
) {
return 'cell-red'
}
if (
column.property === 'name' &&
row.name &&
row.name.indexOf('复测') !== -1
) {
// 含有复测就变红
return 'cell-red'
}
} else if (this.isGC !== undefined) {
// 国抽的抽样单管理
if (
column.property === 'samplingNum' &&
row.unsuccessfulCount &&
row.unsuccessfulCount > 0
) {
// 国抽对接未成功项目数量(抽样单编号变红)
return 'cell-red'
}
} else {
// 其他列表状态
// eslint-disable-next-line no-lonely-if
if (column.property === 'progress') {
if (undefined === row.progress) {
return 'cell-blue-color'
} else if (
undefined !== row.progress &&
undefined !== row.progress.display
) {
if (row.progress.display.indexOf('退回') !== -1) {
return 'cell-red-color'
} else {
return 'cell-blue-color'
}
} else if (undefined !== row.progress) {
if (row.progress.indexOf('退回') !== -1) {
return 'cell-red-color'
} else {
return 'cell-blue-color'
}
} else {
return 'cell-blue-color'
}
} else if (column.property === 'status') {
if (
row.status &&
row.status.display !== undefined &&
row.status.display.indexOf('退回') !== -1
) {
return 'cell-red-color'
} else {
return 'cell-blue-color'
}
}
}
},
_searchParams() {
const data = {}
const serData = this.$serialize(this.formId)
Object.assign(data, serData, this.extendsData)
if (this.hidePage === undefined) {
return this.$extend(data, this.pageParams)
} else {
return this.$extend(data)
}
},
_page(formId, uri, extendsData) {
this.loading = true
if (this.tableName) {
// tableName存在-----支持自定义表格
this._getByCompanyTable()
this._settingCol(formId, uri, extendsData)
} else {
this._pageTemp(formId, uri, extendsData)
}
},
// 查询企业下得表格数据
_getByCompanyTable: async function() {
const result = await sysTableColumn.getByCompanyTable(this.tableName)
this._getByUserTable(result)
},
// 查询用户下的表格数据
_getByUserTable: async function(companyTableCode) {
const userTableCode = await sysTableColumn.getByUserTable(this.tableName)
this.$emit(
'on-result-change',
'table-col',
this.$tableColumns(this.pageColumns, companyTableCode, userTableCode)
)
_settingCol(formId, uri, extendsData) {
if (uri) {
// 为了避免uri为undefined
this.$store
.dispatch('SysTableColumn/getByTableName', this.tableName)
.then(() => {
// 查询用户下的表格数据
const userTableCode = this.$store.state.SysTableColumn.model
this.$emit(
'on-result-change',
'table-col',
this.$tableColumns(this.pageColumns, userTableCode)
)
this._pageTemp(formId, uri, extendsData)
})
}
},
_sortChange({ prop }) {
const { records } = this.getPage
records.forEach(item => console.log(item[prop]))
// 临时
_pageTemp(formId, uri, extendsData) {
this.formId = formId
if (extendsData) {
this.extendsData = extendsData
}
this.$store.dispatch(uri, this._searchParams()).then(() => {
this.loading = false
this.$emit('on-result-change', 'page', '')
})
},
_pageChange(page) {
this.pageParams.page = page
......@@ -166,24 +330,13 @@ export default {
}
},
_pageParamsChange() {
this.$emit('on-result-change', 'page', '')
},
_searchParams() {
this.loading = true
const data = {}
if (this.hidePage !== undefined) {
// 不分页
return data
} else {
// 分页
return this.pageParams
}
this.$emit('on-result-change')
},
// 多选
_selectRowChange(data) {
// 默认返回的是id数组
if (this.showCheckBox !== undefined) {
// 有checkbox 默认返回选中的id数组
if (this.hideCheckbox === undefined || this.hideCheckbox === false) {
this.checkData = data
// 默认返回的是id数组
if (this.selectData === undefined) {
const idList = []
for (let i = 0; i < data.length; i++) {
......@@ -200,27 +353,33 @@ export default {
this._selectRowChange(data)
},
// 操作列回调
_iconClick(name, rowData) {
_iconClick(name, rowData, componentName, rowIndex, obj) {
this.$emit('on-result-change', 'iconClick', {
name: name,
rowData: rowData
rowData: rowData,
componentName: componentName,
rowIndex: rowIndex,
obj: obj
})
// 点击操作列中的某个操作选中当前行数据
if (this.isView !== undefined) {
if (name === '预览/编辑报告' || name === '预览') {
this._rowClickChange(rowData)
}
}
},
// 双击行操作
_dbClickRow(row, event) {
this.$emit('on-result-change', 'dbSelect', row)
},
// 关闭loading
_hideLoading() {
this.loading = false
},
// 打开loading
_showLoading() {
this.loading = true
}
}
}
</script>
<style>
.warning-row {
color: red;
}
.el-table .warning-bg-yellow {
background: yellow;
}
</style>
......@@ -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