Browse Source

rerange

master
pengjun 2 years ago
parent
commit
67918dc773
  1. 52
      src/components/itemSet/ReferenceRange.vue

52
src/components/itemSet/ReferenceRange.vue

@ -34,7 +34,7 @@
</div> </div>
<!-- 新增或者编辑弹框 --> <!-- 新增或者编辑弹框 -->
<el-dialog :title="id ? '编辑':'新增'" :visible.sync="dialogVisible" width="70%">
<el-dialog :title="id ? '编辑' : '新增'" :visible.sync="dialogVisible" width="70%" :append-to-body="true">
<el-form ref="form" :model="form" label-width="100px" :rules="rules"> <el-form ref="form" :model="form" label-width="100px" :rules="rules">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
@ -71,15 +71,16 @@
</el-row> </el-row>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="onsbmint"> </el-button> <el-button type="primary" @click="onsbmint"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getapi, postapi, putapi } from "@/api/api";
import { mapState } from "vuex";
import { getapi, postapi, putapi,deletapi } from "@/api/api";
import { referencerangelist, getporjectlists } from "@/request/commonapi"; import { referencerangelist, getporjectlists } from "@/request/commonapi";
import { examinationgender } from "@/request/systemapi"; import { examinationgender } from "@/request/systemapi";
// import // import
@ -145,7 +146,9 @@ export default {
this.getlist(this.itemId, this.ReferenceRangeTypeFlag); this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
this.addtoedit() this.addtoedit()
}, },
computed: {
...mapState(['itemSet'])
},
methods: { methods: {
getlist(itemId, ReferenceRangeTypeFlag) { getlist(itemId, ReferenceRangeTypeFlag) {
//http://81.70.217.145:9529/api/app/reference-range/in-type/3a0bcedc-328c-9322-e75d-343c3ce557fb?ReferenceRangeTypeFlag=1 //http://81.70.217.145:9529/api/app/reference-range/in-type/3a0bcedc-328c-9322-e75d-343c3ce557fb?ReferenceRangeTypeFlag=1
@ -183,37 +186,60 @@ export default {
// //
edit() { edit() {
if (!this.id) {
alert("请先选中要编辑的记录")
return
}
this.dialogVisible = true; this.dialogVisible = true;
}, },
del() { del() {
this.$message.success("删除操作");
//this.$message.success("");
if (!this.id) { if (!this.id) {
alert("请先选中要删除的记录") alert("请先选中要删除的记录")
return return
} }
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletapi(`/api/app/reference-range/${this.id}`, this.form).then(res => {
this.$message.success('删除成功')
this.getlist(this.itemId, this.ReferenceRangeTypeFlag)
this.id = ''
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
}, },
// //
onsbmint() { onsbmint() {
this.$refs.form.validate((v) => {
this.$refs['form'].validate((v) => {
if (v) { if (v) {
if (this.title == 1) {
if (!this.id) {
postapi("/api/app/reference-range", this.form).then((res) => { postapi("/api/app/reference-range", this.form).then((res) => {
this.$message.success("新增成功"); this.$message.success("新增成功");
this.getlist();
this.dialogVisible = false;
this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
console.log('res',res)
this.id = res.data.id;
}); });
} else if (this.title == 2) {
putapi(`/api/app/reference-range/${this.form.id}`, this.form).then(res => {
}
else {
putapi(`/api/app/reference-range/${this.id}`, this.form).then(res => {
this.$message.success('修改成功') this.$message.success('修改成功')
this.getlist()
this.dialogVisible = false
this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
}) })
} }
} }
}); });
}, },
}, },
// //

Loading…
Cancel
Save