Commit ef9adb64 by wangweidong
parents a8e72a72 7f928189
<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>
......@@ -41,7 +41,11 @@
"vue-echarts-v3": "^2.0.1",
"vue-gallery-slideshow": "^1.3.1",
"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",
"xe-utils": "^2.4.5",
"xlsx": "^0.14.1"
},
"devDependencies": {
......
<template>
<div>
123456
</div>
</template>
......
<template>
<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>
</template>
<script>
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>
......
......@@ -791,3 +791,26 @@ Vue.prototype.$countDays = function() {
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文件)
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 iconList from '../components/base/iconList'
import elementTable from '../components/table/elementTable'
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('icon-list', iconList)
Vue.component('element-table', elementTable)
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