<template>
|
<div class="app-container">
|
<el-form
|
:model="queryParams"
|
ref="queryForm"
|
size="small"
|
:inline="true"
|
label-width="68px"
|
>
|
<el-form-item label="表名" prop="tbname">
|
<el-input
|
ref="inputName"
|
v-model="queryParams.tbname"
|
placeholder="请输入表名"
|
clearable
|
@keyup.enter.native="handleQuery"
|
style="width: 170px"
|
/>
|
</el-form-item>
|
<el-form-item label="字段名" prop="zd">
|
<el-input
|
v-model="queryParams.zd"
|
placeholder="请输入字段名"
|
clearable
|
@keyup.enter.native="handleQuery"
|
style="width: 170px"
|
/>
|
</el-form-item>
|
<el-form-item label="拼音名" prop="pymzd">
|
<el-input
|
v-model="queryParams.pymzd"
|
placeholder="请输入拼音名"
|
clearable
|
@keyup.enter.native="handleQuery"
|
style="width: 170px"
|
/>
|
</el-form-item>
|
<el-form-item>
|
<el-button :loading="loading" type="primary" @click="handleSubmit"
|
>提交</el-button
|
>
|
<el-button @click="handleCancel">取消</el-button>
|
</el-form-item>
|
</el-form>
|
<div class="title">必须和数据库表名、字段名严格保持一致!</div>
|
<el-table
|
id="ta"
|
ref="tb"
|
:data="pyList"
|
v-loading="loading"
|
border
|
@current-change="handleCurrentChange"
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column label="表名" align="center" prop="tj_project_copy" />
|
<el-table-column label="表名" align="center" prop="pro_name" />
|
<el-table-column label="表名" align="center" prop="pro_eng_name" />
|
</el-table>
|
|
<!-- <div>
|
<div class="title">必须和数据库表名、字段名严格保持一致</div>
|
|
</div> -->
|
<!-- <div>
|
<el-form :model="queryParams">
|
<el-form-item label="表名" prop="tbname">
|
<el-input
|
v-model="queryParams.tbname"
|
placeholder="请输入表名"
|
></el-input>
|
</el-form-item>
|
|
<el-form-item label="字段" prop="zd">
|
<el-input
|
v-model="queryParams.zd"
|
placeholder="请输入字段"
|
></el-input>
|
</el-form-item>
|
|
<el-form-item label="拼音字段" prop="pymzd">
|
<el-input
|
v-model="queryParams.pymzd"
|
placeholder="请输入拼音字段"
|
></el-input>
|
</el-form-item>
|
|
<el-form-item>
|
<el-button :loading="loading" type="primary" @click="handleSubmit"
|
>提交</el-button
|
>
|
<el-button @click="handleCancel">取消</el-button>
|
</el-form-item>
|
</el-form>
|
</div> -->
|
<div class="pag">
|
<div class="pag1">
|
<!-- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :pager-count="5" :current-page.sync="currentPage1" :current-page="page"
|
:page-sizes="pageSize" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
</el-pagination> -->
|
<!-- <pagination
|
v-show="total > 0"
|
:total="total"
|
:pager-count="5"
|
:page.sync="queryParams.page"
|
:limit.sync="queryParams.pageSize"
|
@pagination="getList"
|
/> -->
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { getPinyin } from "@/api/hosp/project";
|
|
export default {
|
dicts: ["dict_tj_status"],
|
data() {
|
return {
|
loading: false,
|
pyList:[],
|
// 查询参数
|
queryParams: {
|
tbname: "",
|
zd: "",
|
pymzd: "",
|
},
|
};
|
},
|
|
created() {
|
|
},
|
methods: {
|
handleSelectionChange(val) {
|
console.log(val);
|
if (val.length > 1) {
|
let del_row = val.shift();
|
this.$refs.tb.toggleRowSelection(del_row, false); //设置这一行取消选中
|
}
|
console.log(val, 999);
|
|
if (val.length > 0) {
|
const selectedRow = val[0];
|
this.selectedFirstTable = selectedRow;
|
console.log("当前选中的行数据:", this.selectedFirstTable);
|
this.fetchRightTableData(selectedRow);
|
} else {
|
this.selectedFirstTable = null;
|
this.checkList = [];
|
}
|
},
|
// 根据选中的行数据请求右边表格数据
|
fetchRightTableData(selectedRow) {
|
const code = selectedRow.mzh;
|
if (!code) return;
|
this.loading = true;
|
getRightList(code).then((response) => {
|
this.checkList = response.data;
|
this.loading = false;
|
});
|
},
|
|
handleSubmit() {
|
this.loading = true;
|
const { tbname, zd, pymzd } = this.queryParams;
|
|
// 调用 API 获取拼音
|
getPinyin(tbname, zd, pymzd)
|
.then((res) => {
|
console.log(res, "返回的数据");
|
if (res.code === 200) {
|
this.pyList = res.data;
|
console.log(this.pyList,9988);
|
|
this.$message.success("提交成功");
|
} else {
|
this.$message.error(res.msg || "查询失败,请稍后重试");
|
}
|
})
|
.catch((error) => {
|
this.$message.error(error.msg || "查询失败,请稍后重试");
|
})
|
.finally(() => {
|
this.loading = false;
|
});
|
},
|
// 取消操作
|
handleCancel() {
|
this.queryParams.tbname = '';
|
this.queryParams.zd = '';
|
this.queryParams.pymzd = '';
|
this.$message.info('已取消');
|
},
|
|
handleSelectionChangeSecond(selectedRows) {
|
this.selectedSecondTable = selectedRows;
|
console.log("当前选中的行数据:", this.selectedSecondTable);
|
},
|
|
/** 搜索按钮操作 */
|
handleQuery() {
|
this.loading = true;
|
getPinyin(this.queryParams)
|
.then((res) => {
|
console.log(res, 1111);
|
if (res.code == 200) {
|
// this.loading = false;
|
// this.exaLists = res.data;
|
// this.code = this.exaLists.mzh;
|
}
|
})
|
.catch((error) => {
|
// this.loading = false;
|
// this.$message.error(res.msg || "查询失败,请稍后重试");
|
});
|
},
|
|
/** 重置按钮操作 */
|
resetQuery() {
|
this.createTimeList = [];
|
this.resetForm("queryForm");
|
this.queryParams = {
|
name: null,
|
start: null,
|
end: null,
|
tjNum: null,
|
};
|
|
// 清空其他依赖数据
|
this.checkList = [];
|
this.exaLists = [];
|
},
|
|
handleCurrentChange(row) {
|
this.currentRow = row;
|
},
|
},
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.title{
|
margin-bottom: 20px;
|
color: red;
|
}
|
/* #ta .el-table__header-wrapper .el-checkbox {
|
display: none;
|
}
|
|
.el-table .warning-row {
|
background: #e5f3ff !important;
|
}
|
::v-deep .el-table__body tr.current-row > td {
|
background: #edf2fa !important;
|
}
|
|
.table-title {
|
text-align: center;
|
margin-bottom: 15px;
|
}
|
.row-disabled {
|
color: #ccc;
|
pointer-events: none;
|
background-color: #f5f5f5;
|
}
|
|
.pag {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
}
|
|
.pag1 {
|
width: 30%;
|
} */
|
</style>
|