irc_web/.svn/pristine/32/326621ec17fd066302541846415...

163 lines
3.8 KiB
Plaintext

<template>
<box-content>
<!-- 搜索框 -->
<div class="search">
<span style="margin-left:auto;">
<el-button
type="primary"
size="mini"
@click="handleAdd"
>
Add
</el-button>
</span>
</div>
<!-- 受试者列表 -->
<el-table
v-loading="loading"
v-adaptive="{bottomOffset:45}"
:data="list"
stripe
height="100"
style="width:100%"
>
<el-table-column type="index" width="40" />
<el-table-column
prop="Code"
label="编号"
sortable="custom"
show-overflow-tooltip
/>
<el-table-column
prop="Name"
label="场景类型"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
prop="Value"
label="签名内容(EN)"
show-overflow-tooltip
/>
<el-table-column
prop="ValueCN"
label="签名内容(CN)"
show-overflow-tooltip
/>
<el-table-column
prop="UpdateTime"
label="更新时间"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
prop="CreateTime"
label="创建时间"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column label="Action" width="200" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
@click="handleEdit(scope.row)"
>
Edit
</el-button>
<el-button type="text" @click="handleDelete(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>
<!-- 场景配置 -->
<el-dialog
v-if="editVisible"
:visible.sync="editVisible"
:close-on-click-modal="false"
:title="title"
width="700px"
append-to-body
custom-class="base-dialog-wrapper"
>
<SceneConfigForm :parent-id="parentId" :data="rowData" @closeDialog="closeDialog" @getList="getList" />
</el-dialog>
</box-content>
</template>
<script>
import { getChildList, deleteSystemBasicData } from '@/api/dictionary'
import BoxContent from '@/components/BoxContent'
import SceneConfigForm from './SceneConfigForm'
export default {
name: 'SignTemplate',
components: { BoxContent, SceneConfigForm },
props: {
parentId: {
type: String,
required: true
}
},
data() {
return {
loading: false,
list: [],
rowData: {},
title: '',
editVisible: false
}
},
mounted() {
this.getList()
},
methods: {
// 获取受试者列表
getList() {
this.loading = true
getChildList(this.parentId).then(res => {
this.loading = false
this.list = res.Result
}).catch(() => { this.loading = false })
},
// 新增
handleAdd() {
this.rowData = {}
this.title = 'Add'
this.editVisible = true
},
// 编辑
handleEdit(row) {
this.rowData = { ...row }
this.title = 'Edit'
this.editVisible = true
},
// 删除
handleDelete(row) {
this.$confirm('Sure to delete?', {
type: 'warning',
distinguishCancelAndClose: true,
confirmButtonText: 'Ok',
cancelButtonText: 'Cancel'
})
.then(() => {
deleteSystemBasicData(row.Id)
.then(res => {
if (res.IsSuccess) {
this.list.splice(this.list.findIndex(item => item.Id === row.Id), 1)
this.$message.success('Deleted successfully!')
}
})
})
},
// 关闭新增、编辑框
closeDialog() {
this.editVisible = false
}
}
}
</script>