Commit c6cee4a9 by lichengming

修改了资质管理

parent bedfa32b
<template>
<div>
<Tooltip v-for="item in msg" :content="item.name" :key="item.name" transfer>
<span v-if="item.disabled">
<Icon :type="item.type"
:id="item.id"
v-if="$showBtn(item.id)"
:style="objStyle" class="marRight-10 icons"
size=20></Icon>
</span>
<span v-else>
<!--预览或预览编辑报告 需要选中前面的checkbox-->
<Icon :type="item.type"
:id="item.id"
v-if="$showBtn(item.id) && (item.name.indexOf('预览') !== -1)"
@click.native="_iconClick(item.name,item.componentName,rowIndex,item.id)" class="marRight-10 icons"
size=20></Icon>
<Icon :type="item.type"
:id="item.id"
v-else-if="$showBtn(item.id)"
@click.native.stop="_iconClick(item.name,item.componentName,rowIndex,item.id)" class="marRight-10 icons"
size=20></Icon>
</span>
</Tooltip>
</div>
</template>
<script>
/**
* VXE-TABLE ICON-LIST
*/
export default {
props: {
msg: null, // 任何类型
id: null,
rowData: null,
rowIndex: null // 当前行的索引值
},
data() {
return {
objStyle: {
color: '#999',
cursor: 'not-allowed'
}
}
},
methods: {
_iconClick(name, componentName, rowIndex, btnId) {
// 按钮点击事件
this.$emit(
'on-result-change',
name,
this.rowData,
componentName,
rowIndex,
{ btnId: btnId }
)
}
}
}
</script>
<template>
<div>
<vxe-grid
ref="xTable"
:resizable="(resizable === undefined || resizable === true)?true:false"
:highlight-current-row="
hideCheckbox!==undefined|| hideCheckbox === true"
:height="500"
:loading="loading"
:auto-resize="true"
:pager-config="
hidePage === undefined?{total:getPage.total,currentPage:getPage.current,pageSize:getPage.size,pageSizes:pageSizeOpts,background:true}:null"
:scroll-y="setOptimization === undefined?defOptimization:setOptimization"
:checkbox-config="selectConfig"
@checkbox-all="_selectAll"
@checkbox-change="_selectRowChange"
@page-change="_pageSizeChange"
@cell-click="_cellChange"
@cell-dblclick="_dbChange"
@radio-change="_radioChange"
:cell-class-name="_tableCellClassName"
:row-class-name="_tableRowClassName"
:edit-config="isEdit !== undefined?editConfig:null"
size="mini"
:radio-config="isRadio !== undefined?radioConfig:null"
border
:row-key="true"
stripe
:tooltip-config="{enterable:true}"
show-overflow
show-header-overflow
>
<vxe-table-column
v-if="hideCheckbox===undefined || hideCheckbox === false"
type="checkbox"
fixed="left"
width="50"
align="center"/>
<vxe-table-column
v-if="isRadio === true"
type="radio"
title="单选"
fixed="left"
align="center"
width="50"/>
<vxe-table-column
v-if="!isNoOrder"
type="seq"
fixed="left"
title="序号"
width="50"
align="center"/>
<slot></slot>
<vxe-table-column
:width="$optColWidth(iconMsg)"
v-if="$optColWidth(iconMsg)>0?true:false"
title="操作"
align="center" fixed="right">
<template slot-scope="scope">
<VXEIconList :msg="iconMsg" @on-result-change="_iconClick" :rowData="scope.row"
:rowIndex="scope.rowIndex"></VXEIconList>
</template>
</vxe-table-column>
<slot name="col"></slot>
</vxe-grid>
<!--自定义表格列-->
<div style="position: absolute;right:0;top:0;z-index:2000">
<slot name="setting"></slot>
</div>
</div>
</template>
<script>
/**
* VXE-TABLE 通用 (单选,多选,双击,自定义操作列,自定义表格列)
*/
import VXEIconList from '../base/VXEIconList'
export default {
name: 'PTVXETable',
components: { VXEIconList },
props: {
tableHeight: 500,
getPage: null,
hidePage: null,
clickValue: null,
selectData: null,
hideCheckbox: null,
isReport: null, // 判断是否是报告
isDataInput: null, // 判断数据录入
isTask: null, // 判断是否是检测管理
isHandle: null, // 样品
tableName: null, // 该值存在,则支持自定义表格
iconMsg: null,
pageColumns: null,
isEdit: null, // 是否可编辑
setOptimization: null, // 加载滚动配置项
isRadio: null, // 是否是单选
isGC: null, // 国抽(抽样单管理)
isGroup: null, // 科室为化验室单元格变红色
isNoOrder: null, // 如果是true的话,则不显示序号这一列
pageSize: null,
rows: null,
resizable: null // 是否允许列拖动
},
data() {
return {
formId: '',
extendsData: {},
loading: false,
pageParams: {
page: 1,
rows: this.rows !== undefined ? this.rows : this.$defRow
},
rowData: {},
checkData: [], // 用于多选的高亮显示数据
sampleHandleValue: '',
// 一系列配置
pageSizeOpts:
this.pageSize !== undefined
? this.pageSize
: [10, 20, 50, 100, 500, 1000],
// 默认的配置
defOptimization: this.$setOptimization(),
selectConfig: { checkField: 'checked', trigger: 'row' },
editConfig: {
trigger: 'click',
mode: 'cell',
showIcon: true,
autoClear: false,
showStatus: true
},
// 单选的配置项
radioConfig: { trigger: 'row' }
}
},
watch: {
// 监听数据
'getPage.records': function(newVal, oldVal) {
this._loadData(newVal)
}
},
methods: {
_loadData(data) {
// 阻断 vue 对大数组的双向绑定,大数据性能翻倍提升
if (this.$refs.xTable) {
this.$refs.xTable.loadData(data)
}
},
// 刷新column 和刷新数据
_refreshColumn() {
this.$refs.xTable.refreshColumn()
this.$refs.xTable.syncData()
},
_clearSelection() {
this.$nextTick(function() {
this.$refs.xTable.clearCheckboxRow()
})
this.checkData = []
if (this.hideCheckbox === undefined || this.hideCheckbox === false) {
if (this.selectData === undefined) {
this.$emit('on-result-change', 'selectIds', [])
} else {
this.$emit('on-result-change', 'selectData', [])
}
}
},
_checkAll() {
setTimeout(() => {
// 控制checkbox状态(加0s的延时才好用)
this.$refs.xTable.setAllCheckboxRow(true)
// 全选当前界面的数据
this._selectRowChange({ selection: this.getPage.records })
}, 0)
},
_pageSizeChange(row) {
switch (row.type) {
case 'size':
this.pageParams.page = 1
this.pageParams.rows = row.pageSize
this._pageParamsChange()
break
case 'current':
this._pageChange(row.currentPage)
break
}
},
_pageChange(page) {
this.pageParams.page = page
this._pageParamsChange()
},
_pageParamsChange() {
this.$emit('on-result-change', 'changeSize')
},
_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._settingCol(formId, uri, extendsData)
} else {
this._pageTemp(formId, uri, extendsData)
}
},
_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)
})
}
},
// 临时
_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', '')
this._refreshColumn()
// 每次请求完清空上次的选择
this._clearSelection()
})
},
// 多选
_selectAll: function(data) {
this._selectRowChange(data)
},
_selectRowChange(data) {
if (this.hideCheckbox === undefined || this.hideCheckbox === false) {
const selData = data.selection
this.checkData = selData
// 默认返回的是id数组
if (this.selectData === undefined) {
const idList = []
for (let i = 0; i < selData.length; i++) {
idList.push(selData[i].id)
}
this.$emit('on-result-change', 'selectIds', idList)
} else {
// 有selectData参数时执行
this.$emit('on-result-change', 'selectData', selData)
}
}
},
// 整行变色
_tableRowClassName({ row, rowIndex }) {
if (this.checkData.length !== 0) {
/* 选中的进行高亮显示 */
const index = this.checkData.indexOf(row)
if (index !== -1) {
return 'high-light-row'
}
} else {
/* 没选中的根据页面逻辑变色 */
// 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' // 橙色
// }
// }
}
},
// 单元格变色
_tableCellClassName({ row, rowIndex, column, 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 if (this.isGroup !== undefined) {
if (column.property === 'groupName' && row.groupName === '化验室') {
// 国抽的检测项目列表,科室为化验室(变红)
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'
}
}
}
},
// 操作列回调
_iconClick(name, rowData, componentName, rowIndex, obj) {
this.$emit('on-result-change', 'iconClick', {
name: name,
rowData: rowData,
componentName: componentName,
rowIndex: rowIndex,
obj: obj
})
},
// 双击行操作
_dbChange(data, event) {
this.$emit('on-result-change', 'dbSelect', data.row)
},
// 点击单元格触发
_cellChange(data, event) {
if (this.clickValue !== undefined) {
// 有clickValue参数时执行
this.$emit('on-result-change', 'singleSelect', data.row)
}
},
// 单选操作
_radioChange({ row }) {
this.$emit('on-result-change', 'singleSelect', row)
},
// 关闭loading
_hideLoading() {
this.loading = false
},
// 打开loading
_showLoading() {
this.loading = true
},
// 只刷新选中行的数据(目前报告盖章中需要)
_refreshRows(rowList) {
const records = this.getPage.records
for (let i = 0; i < rowList.length; i++) {
const index = records.findIndex(item => item.id === rowList[i].id)
if (index !== -1) {
this.$set(this.getPage.records, index, rowList[i])
}
}
}
}
}
</script>
...@@ -41,7 +41,11 @@ ...@@ -41,7 +41,11 @@
"vue-echarts-v3": "^2.0.1", "vue-echarts-v3": "^2.0.1",
"vue-gallery-slideshow": "^1.3.1", "vue-gallery-slideshow": "^1.3.1",
"vue-quill-editor": "^3.0.6", "vue-quill-editor": "^3.0.6",
"vue-runtime-helpers": "^1.1.2",
"vxe-table": "^2.9.11",
"vxe-utils": "^1.9.3",
"webstomp-client": "^1.2.0", "webstomp-client": "^1.2.0",
"xe-utils": "^2.4.5",
"xlsx": "^0.14.1" "xlsx": "^0.14.1"
}, },
"devDependencies": { "devDependencies": {
......
<template> <template>
<div> <div>
123456
</div> </div>
</template> </template>
......
<template> <template>
<div> <div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top:10px">
<Form id="search-form-package" :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="判定依据:" style="margin-left: -20px">
<Input @on-enter="_formSearch" name="judgeBasis" placeholder="请输入判定依据" clearable/>
</Form-item>
<Form-item class="search-item" label="判定依据名称:">
<Input @on-enter="_formSearch" name="judgeBasisName" placeholder="请输入判定依据名称" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<span v-if="item.dateTime">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!-- 添加、编辑 -->
<!-- <JudgmentEdit ref="editModal" @on-result-change="_page"></JudgmentEdit>-->
<!--导入资质项目-->
<!-- <DownloadTemplateImport ref="sampleModal" @on-result-change="_page"></DownloadTemplateImport>-->
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'MeterAptitudeStandard' name: 'MeterAptitudeStandard',
data() {
return {
pageColumns: [
{ title: '判定依据', key: 'judgeBasis', width: 160 },
{ title: '判定依据名称', key: 'judgeBasisName' },
// {title: '限制范围或说明', key: 'limitDescription'},
{ title: '登记时间', key: 'ctime', dateTime: true, width: 140 },
{ title: '备注', key: 'remark' }
],
btn: [
{ type: 'success', id: '', name: '添加' },
{ type: 'error', id: '', name: '删除' },
{ type: '', id: '', name: '导入' },
{ type: '', id: '', name: '导出' }
],
iconMsg: [
{ type: 'compose', id: '', name: '编辑' },
{ type: 'trash-a', id: '', name: '删除' }
],
searchOpen: true,
selectIds: [],
getPage: {},
typeData: []
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
methods: {
_btnClick(msg) {
switch (msg) {
case '添加':
this._editModal(false)
break
case '删除':
this._deleteSelected()
break
case '导入':
this._import()
break
case '导出':
this._export()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '删除':
this._deleteById(data.id)
break
case '操作日志':
this._record(data.id)
break
}
},
_page() {
this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodJudgeBasis.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
loading: true,
content: content || '确定删除该记录?',
onOk: () => {
this.$store
.dispatch('FoodJudgeBasis/deleteByIdsMore', { ids: ids.join(',') })
.then(() => {
if (this.$store.state.FoodJudgeBasis.success) {
this._page()
this.$Message.success('删除成功!')
this.$Modal.remove()
} else {
this.$Modal.remove()
}
})
}
})
},
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除这 ' + ids.length + ' 条记录?')
}
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this.$store.dispatch('FoodJudgeBasis/getById', id).then(() => {
this.$refs.editModal._open(this.$store.state.FoodJudgeBasis.model)
})
} else {
// 添加
this.$refs.editModal._open()
}
},
// 导入
_import() {
const data = {
importUrl:
'/food/v1/food_aptitude_judge_basis/food_aptitude_judge_import',
downloadUrl: '/food/v1/excel/template/FoodAptitudeJudgeBasis',
title: '导入检验方法管理'
}
this.$refs.sampleModal._open(data)
},
// 导出
_export() {
console.log('.this.selectIds', this.selectIds)
if (this.selectIds.length === 0) {
this.$Message.warning('请选择需要导出的数据')
} else {
const content = '确定导出 ' + this.selectIds.length + ' 条记录?'
this.$Modal.confirm({
title: '提示',
content: content,
onOk: () => {
// eslint-disable-next-line no-undef
http.open(
'/food/v1/food_aptitude_judge_basis/food_aptitude_judge_export?ids=' +
this.selectIds
)
}
})
}
}
}
} }
</script> </script>
......
...@@ -791,3 +791,26 @@ Vue.prototype.$countDays = function() { ...@@ -791,3 +791,26 @@ Vue.prototype.$countDays = function() {
86400000 86400000
) )
} }
Vue.prototype.$optColWidth = function(list) {
const arrayList = []
const width = 20
for (const i in list) {
if (this.$showBtn(list[i].id)) {
arrayList.push(list[i])
}
}
return arrayList.length > 0 ? 85 + width * (arrayList.length - 1) : 0
}
Vue.prototype.$setOptimization = function(msg) {
// 默认 数据超过200条,启用虚拟加载,每次加载50条
let result = { gt: 200, oSize: 20, rSize: 50 }
switch (msg) {
case 'modal-normal':
// 弹出框正常情况下-- 数据超过25条启用虚拟加载
result = { gt: 25, oSize: 10, rSize: 25 }
break
}
return result
}
// 注册全局组件(vue文件) // 注册全局组件(vue文件)
import Vue from 'vue' import Vue from 'vue'
// vex-table
import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/index.css'
import btnList from '../components/base/btnList' import btnList from '../components/base/btnList'
import iconList from '../components/base/iconList' import iconList from '../components/base/iconList'
import elementTable from '../components/table/elementTable' import elementTable from '../components/table/elementTable'
import modalFooter from '../components/base/modalFooter' import modalFooter from '../components/base/modalFooter'
import PTVXETable from '../components/table/PTVXETable'
import VXEIconList from '../components/base/VXEIconList'
Vue.use(VXETable)
Vue.component('btn-list', btnList) Vue.component('btn-list', btnList)
Vue.component('icon-list', iconList) Vue.component('icon-list', iconList)
Vue.component('element-table', elementTable) Vue.component('element-table', elementTable)
Vue.component('modal-footer', modalFooter) Vue.component('modal-footer', modalFooter)
Vue.component('PTVXETable', PTVXETable)
Vue.component('VXEIconList', VXEIconList)
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