Compare commits
21 Commits
129a21d533
...
86325a00a3
Author | SHA1 | Date |
---|---|---|
ynmlzdwsp | 86325a00a3 | 10 months ago |
ynmlzdwsp | ad27d3bc1d | 11 months ago |
ynmlzdwsp | 9541be0e83 | 11 months ago |
ynmlzdwsp | fbae76b86f | 11 months ago |
ynmlzdwsp | 03a022c778 | 11 months ago |
ynmlzdwsp | 1f94efe60c | 11 months ago |
王岚馨 | 13f70e3047 | 11 months ago |
王岚馨 | efe15fbc19 | 11 months ago |
王岚馨 | 210ef6e3e8 | 11 months ago |
王岚馨 | 636e8c94c6 | 11 months ago |
ynmlzdwsp | 7a3be7c18f | 11 months ago |
ynmlzdwsp | 17ff7b6175 | 11 months ago |
王岚馨 | 0a8f850c19 | 11 months ago |
ynmlzdwsp | 70677674bc | 11 months ago |
ynmlzdwsp | 7322f566f1 | 11 months ago |
ynmlzdwsp | 6110fde8fb | 11 months ago |
ynmlzdwsp | 54f75993a0 | 11 months ago |
ynmlzdwsp | bee8311f24 | 11 months ago |
ynmlzdwsp | fff40b27d2 | 11 months ago |
ynmlzdwsp | 5b82cc74d8 | 11 months ago |
ynmlzdwsp | 2d2601b1c5 | 11 months ago |
After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 555 KiB |
@ -0,0 +1,324 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<div class="handle-box">
|
||||
<el-input v-model="queryParams.drug1" placeholder="药品A名称" class="handle-input mrb10"></el-input>
|
||||
<el-input v-model="queryParams.drug2" placeholder="药品B名称" class="handle-input mrb10"></el-input>
|
||||
<el-input v-model="queryParams.reaction" placeholder="相互作用效果" class="handle-input mrb10"></el-input>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery()">搜索</el-button>
|
||||
<el-button type="danger" @click="clearSearch()">清除参数</el-button>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="addDrugs()">新增</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="table1List" border class="table" header-cell-class-name="table-header">
|
||||
<el-table-column prop="id" label="ID" width="55" align="center"></el-table-column>
|
||||
<el-table-column prop="drug1" label="药品A名称" align="center"></el-table-column>
|
||||
<el-table-column prop="drug2" label="药品B名称" align="center"></el-table-column>
|
||||
<el-table-column prop="reaction" label="相互作用效果" align="center"></el-table-column>
|
||||
<el-table-column label="操作" width="180" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
|
||||
<el-button type="text" icon="el-icon-delete" style="color: var(--orangeRed)" @click="handleDelete(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog title="新增药品作用" :visible.sync="dialogVisible">
|
||||
<el-form :model="formData" :rules="rules" ref="drugForm" label-width="100px" class="demo-ruleForm">
|
||||
<el-form-item label="药品A名称" prop="drug1">
|
||||
<el-input v-model="formData.drug1"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="药品B名称" prop="drug2">
|
||||
<el-input v-model="formData.drug2"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="相互作用效果" prop="reaction">
|
||||
<el-input v-model="formData.reaction"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm('drugForm')">提 交</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="编辑药品作用" :visible.sync="editVisible">
|
||||
<el-form :model="changeUser" :rules="editRules" ref="editForm" label-width="100px" class="demo-ruleForm">
|
||||
<el-form-item label="药品A名称" prop="drug1">
|
||||
<el-input v-model="changeUser.drug1"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="药品B名称" prop="drug2">
|
||||
<el-input v-model="changeUser.drug2"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="相互作用效果" prop="reaction">
|
||||
<el-input v-model="changeUser.reaction"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="editVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitEditForm('editForm')">提 交</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<div class="pagination">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="1"
|
||||
:page-sizes="[10, 15, 20, 25]"
|
||||
:page-size="10"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total=this.pagination.total>
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {addTable1, listTable1, listTotal} from "../../utils/table1";
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
pagination: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
total: 0,
|
||||
searchKey: "",
|
||||
userStatus: null,
|
||||
userType: null
|
||||
},
|
||||
users: [],
|
||||
table1List: [
|
||||
],
|
||||
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
drug1: null,
|
||||
drug2: null,
|
||||
reaction: null
|
||||
},
|
||||
// 新增药品作用的数据
|
||||
formData: {
|
||||
drug1: "",
|
||||
drug2: "",
|
||||
reaction: ""
|
||||
},
|
||||
dialogVisible: false,
|
||||
rules: {
|
||||
drug1: [
|
||||
{ required: true, message: "请输入药品A名称", trigger: "blur" }
|
||||
],
|
||||
drug2: [
|
||||
{ required: true, message: "请输入药品B名称", trigger: "blur" }
|
||||
],
|
||||
reaction: [
|
||||
{ required: true, message: "请输入相互作用效果", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
editVisible: false,
|
||||
changeUser: {
|
||||
id: null,
|
||||
drug1: null,
|
||||
drug2: null,
|
||||
reaction: null
|
||||
},
|
||||
editRules: {
|
||||
drug1: [
|
||||
{ required: true, message: "请输入药品A名称", trigger: "blur" }
|
||||
],
|
||||
drug2: [
|
||||
{ required: true, message: "请输入药品B名称", trigger: "blur" }
|
||||
],
|
||||
reaction: [
|
||||
{ required: true, message: "请输入相互作用效果", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
computed: {},
|
||||
|
||||
watch: {},
|
||||
|
||||
created() {
|
||||
// this.getUsers();
|
||||
this.handleQuery();
|
||||
},
|
||||
|
||||
mounted() {
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 新增药品操作
|
||||
addDrugs(){
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
/** 查询药品作用列表条数 */
|
||||
getTotal() {
|
||||
listTotal(this.queryParams).then(response => {
|
||||
this.pagination.total = parseInt(response);
|
||||
console.log(this.pagination.total);
|
||||
});
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.queryParams.pageSize = val; // 修改每页显示数量
|
||||
this.getList();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.queryParams.pageNum = val; // 修改每页显示数量
|
||||
this.getList();
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.getTotal();
|
||||
},
|
||||
/** 查询药品作用管理列表 */
|
||||
getList() {
|
||||
// this.loading = true;
|
||||
this.table1List = []; // 初始化为空数组
|
||||
listTable1(this.queryParams).then(response => {
|
||||
this.table1List = response;
|
||||
});
|
||||
},
|
||||
clearSearch() {
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
drug1: null,
|
||||
drug2: null,
|
||||
reaction: null
|
||||
}
|
||||
},
|
||||
handlePageChange(val) {
|
||||
this.pagination.current = val;
|
||||
this.getUsers();
|
||||
},
|
||||
// 提交新增药品作用表单
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
addTable1(this.formData).then(() => {
|
||||
this.dialogVisible = false;
|
||||
this.getList();
|
||||
this.getTotal();
|
||||
this.$message({
|
||||
message: "新增成功",
|
||||
type: "success"
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.$message.error(error);
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//编辑药品作用
|
||||
handleEdit(row) {
|
||||
this.changeUser.id = row.id;
|
||||
this.changeUser.drug1 = row.drug1;
|
||||
this.changeUser.drug2 = row.drug2;
|
||||
this.changeUser.reaction = row.reaction;
|
||||
this.editVisible = true;
|
||||
},
|
||||
|
||||
submitEditForm(formName) {
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
axios.put(`/system/table1/`, this.changeUser)
|
||||
.then(() => {
|
||||
this.editVisible = false; // 关闭对话框
|
||||
this.getList(); // 刷新列表
|
||||
this.getTotal(); // 刷新总数
|
||||
this.$message({
|
||||
message: "编辑成功",
|
||||
type: "success"
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message.error("编辑失败:" + error.message);
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除药品作用
|
||||
handleDelete(row) {
|
||||
this.$confirm("此操作将永久删除该药品作用, 是否继续?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
axios.delete(`/system/table1/${row.id}`)
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.getTotal();
|
||||
this.$message({
|
||||
message: "删除成功",
|
||||
type: "success"
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message.error("删除失败:" + error.message);
|
||||
});
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.handle-box {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.handle-select {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.handle-input {
|
||||
width: 160px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.mrb10 {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.table-td-thumb {
|
||||
display: block;
|
||||
margin: auto;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
margin: 20px 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.el-switch {
|
||||
margin: 5px;
|
||||
}
|
||||
</style>
|
Before Width: | Height: | Size: 97 KiB |
Loading…
Reference in new issue