irc_web/.svn/pristine/9e/9e952cd99deef34e1014353aa1f...

206 lines
5.6 KiB
Plaintext

<template>
<BaseContainer>
<!-- 搜索框 -->
<template slot="search-container">
<!-- <el-form :inline="true">
<el-form-item label="类型">
<el-select v-model="searchData.OrganType" clearable style="width:130px;">
<el-option v-for="item of $d.OrganInfo" :key="item.id" :value="item.value" :label="item.label" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="handleSearch">
{{ $t('common:button:search') }}
</el-button>
<el-button type="primary" icon="el-icon-refresh-left" size="small" @click="handleReset">
{{ $t('common:button:reset') }}
</el-button>
</el-form-item>
</el-form> -->
<span style="margin-left:auto">
<el-button
v-if="!isCompleteConfig"
type="primary"
icon="el-icon-plus"
style="margin-left:auto;"
size="small"
@click="handleAdd"
>
{{ $t('common:button:new') }}
</el-button>
</span>
</template>
<template slot="main-container">
<!-- 受试者列表 -->
<el-table
ref="LesionTypeList"
v-loading="loading"
v-adaptive="{bottomOffset:60}"
:data="list"
stripe
height="100"
>
<el-table-column type="index" width="90" />
<el-table-column
prop="LesionType"
label="病灶类型"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('LesionType',scope.row.LesionType) }}
</template>
</el-table-column>
<el-table-column
prop="OrganType"
label="器官类型"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('OrganType',scope.row.OrganType) }}
</template>
</el-table-column>
<el-table-column
prop="CreateTime"
label="创建时间"
show-overflow-tooltip
/>
<el-table-column
v-if="!isCompleteConfig"
:label="$t('common:action:action')"
width="200"
fixed="right"
>
<template slot-scope="scope">
<el-button
circle
title="编辑"
icon="el-icon-edit-outline"
@click="handleEdit(scope.row)"
/>
<el-button
circle
title="删除"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
/>
</template>
</el-table-column>
</el-table>
</template>
<!-- 新增/编辑 -->
<el-dialog
v-if="editDialog.visible"
:visible.sync="editDialog.visible"
:close-on-click-modal="false"
:title="editDialog.title"
width="500px"
custom-class="base-dialog-wrapper"
append-to-body
>
<LesionTypeForm :data="rowData" @close="editDialog.visible = false" @getList="getList" />
</el-dialog>
</BaseContainer>
</template>
<script>
import { getCriterionNidusList, deleteCriterionNidus } from '@/api/dictionary'
import BaseContainer from '@/components/BaseContainer'
import LesionTypeForm from './LesionTypeForm'
const searchDataDefault = () => {
return {
OrganType: null
}
}
export default {
name: 'LesionTypeTbl',
components: { BaseContainer, LesionTypeForm },
props: {
criterionId: {
type: String,
required: true
},
isCompleteConfig: {
type: Boolean,
required: true
}
},
data() {
return {
searchData: searchDataDefault(),
loading: false,
list: [],
total: 0,
rowData: {},
editDialog: { title: '', visible: false }
}
},
mounted() {
this.getList()
},
methods: {
// 获取受试者列表
getList() {
this.loading = true
getCriterionNidusList({ criterionId: this.criterionId }).then(res => {
this.loading = false
this.list = res.Result
}).catch(() => { this.loading = false })
},
// 新增
handleAdd() {
this.rowData = { CriterionId: this.criterionId }
this.editDialog.title = '新增'
this.editDialog.visible = true
},
// 编辑
handleEdit(row) {
this.rowData = { ...row }
this.editDialog.title = '编辑'
this.editDialog.visible = true
},
// 删除
handleDelete(row) {
this.$confirm('是否确认删除', {
type: 'warning',
distinguishCancelAndClose: true
})
.then(() => {
this.loading = true
deleteCriterionNidus(row.Id)
.then(res => {
this.loading = false
if (res.IsSuccess) {
this.getList()
this.$message.success('删除成功!')
}
}).catch(() => { this.loading = false })
})
},
// 查询
handleSearch() {
// this.searchData.PageIndex = 1
this.getList()
},
// 重置
handleReset() {
// this.searchData = searchDataDefault()
this.getList()
},
// 排序
handleSortByColumn(column) {
if (column.order === 'ascending') {
this.searchData.Asc = true
} else {
this.searchData.Asc = false
}
this.searchData.SortField = column.prop
this.searchData.PageIndex = 1
this.getList()
}
}
}
</script>