123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400 |
- <template>
- <div>
- <div class="Dialog" v-show="!selecting">
- <div class="DialogTit">
- <span @click="close()" class="iconfont"></span>
- <h1 class="name">透析下机</h1>
-
- <span
- class="success"
- v-if="
- this.record.state == 1 ||
- this.$store.getters.user.user.id != this.creator
- "
- ></span>
- <span
- class="success"
- @click="modify()"
- v-if="isPremission || this.$store.getters.user.user.id == this.creator"
- >修改</span
- >
- </div>
-
- <div class="DialogContent">
- <div class="item" @click="select_nurse">
- <h2 class="name">下机护士</h2>
- <div class="content">
- <span class="text" style="width: 100px">{{
- nurse_id == 0 ? "" : admin_map[nurse_id].name
- }}</span>
-
- <span class="iconfont"></span>
- </div>
- </div>
-
- <div class="item">
- <h2 class="name">下机时间</h2>
- <div class="content">
- <span
- class="text"
- style="width: 100px"
- @click="selectStartTimeAction"
- >{{ end_time_str }}</span
- >
-
- <span class="iconfont"></span>
- </div>
- </div>
-
- <div class="perform">
- <button
- @click="commitInfo"
- v-show="record != null && record.id != '' && record.stage == 1"
- >
- 执行下机
- </button>
- <button
- :disabled="true"
- style="background-color:lightgray;"
- v-show="record != null && record.id != '' && record.stage == 2"
- >
- 已下机
- </button>
- <button
- :disabled="true"
- style="background-color:lightgray;"
- v-show="record == null || record.id == ''"
- >
- 未上机
- </button>
- </div>
- </div>
- </div>
- <two-menu ref="selector"></two-menu>
- <mt-datetime-picker
- ref="start_time_picker"
- type="datetime"
- @confirm="didSelectStartTime"
- v-model="end_time"
- ></mt-datetime-picker>
- </div>
- </template>
-
- <script>
- import { finish, PostModifyEndDialysis } from "@/api/dialysis";
- import { Toast } from "vant";
- import TwoMenu from "./TwoMenu";
- import { parseTime } from "@/utils";
-
- export default {
- name: "PlaneDialog",
- components: {
- TwoMenu
- },
- data() {
- return {
- selecting: false,
- end_time_str: "",
- end_time: new Date(),
- nurse_id: 0,
- isPremission: false,
- creator: 0
- };
- },
- props: {
- prescription_prop: {
- type: Object
- },
- patient_prop: {
- type: Object
- },
- record: {
- type: Object
- },
- admins: {
- type: Array
- },
- admin_map: {
- type: Object
- },
- special_premission: {
- type: Array
- },
- last_monitor_record: {
- type: Object
- }
- },
- mounted() {
- if (this.record.id == "") {
- //没有上下机记录
- this.end_time_str =
- parseTime(Date.parse(new Date()) / 1000, "{y}-{m}-{d} {h}:{i}") + ":00";
- } else {
- if (this.record.start_time > 0) {
- if (this.prescription_prop.id != "") {
- let endTime = 0;
- endTime =
- this.record.start_time +
- this.prescription_prop.dialysis_duration_hour * 3600 +
- this.prescription_prop.dialysis_duration_minute * 60;
- this.end_time_str = parseTime(endTime, "{y}-{m}-{d} {h}:{i}") + ":00";
- } else {
- this.end_time_str =
- parseTime(Date.parse(new Date()) / 1000, "{y}-{m}-{d} {h}:{i}") +
- ":00";
- }
- if (this.record.end_time > 0) {
- this.end_time_str =
- parseTime(this.record.end_time, "{y}-{m}-{d} {h}:{i}") + ":00";
- }
- } else {
- this.end_time_str =
- parseTime(Date.parse(new Date()) / 1000, "{y}-{m}-{d} {h}:{i}") +
- ":00";
- }
- }
- this.end_time = this.end_time_str;
-
- // if(this.record.idthis.record.end_time == 0)
-
- // if(this.last_monitor_record.id == 0){
- //
- // this.end_time_str = parseTime(this.last_monitor_record.operate_time, "{y}-{m}-{d} {h}:{i}") + ":00";
- // }else{
- // this.end_time_str = parseTime(this.end_time, "{y}-{m}-{d} {h}:{i}") + ":00";
- //
- // }
- },
- created() {
- var date = this.$route.query && this.$route.query.date;
- date *= 1000;
- var newDate = new Date(date);
- var y = newDate.getFullYear();
- var m = newDate.getMonth() + 1;
- var d = newDate.getDate();
- if (isNaN(y) || isNaN(m) || isNaN(d)) {
- newDate = new Date();
- y = newDate.getFullYear();
- m = newDate.getMonth() + 1;
- d = newDate.getDate();
- }
- this.record_date =
- y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
-
- if (this.record == null || this.record.id == "") {
- this.nurse_id = 0;
- } else if (this.record.stage == 1) {
- this.nurse_id = this.$store.getters.user.user.id;
- } else {
- this.nurse_id = this.record.finish_nurse;
- }
-
- if (this.record.id > 0) {
- for (let i = 0; i < this.special_premission.length; i++) {
- if (
- this.$store.getters.user.user.id ==
- this.special_premission[i].admin_user_id
- ) {
- this.isPremission = true;
- }
- }
- }
-
- if (this.record.id > 0) {
- if (this.record.finish_creator == 0) {
- this.creator = this.record.finish_nurse;
- } else {
- this.creator = this.record.finish_creator;
- }
- }
- },
- methods: {
- set_last_monitor_record(monitor) {
- this.last_monitor_record = monitor;
- this.end_time_str =
- parseTime(
- this.last_monitor_record.operate_time,
- "{y}-{m}-{d} {h}:{i}"
- ) + ":00";
- },
- modify() {
- let ParamsQuery = {};
- ParamsQuery["id"] = this.record.id;
- ParamsQuery["nurse"] = this.nurse_id;
- ParamsQuery["end_time"] = this.end_time_str;
- PostModifyEndDialysis(ParamsQuery).then(response => {
- if (response.data.state == 0) {
- Toast.fail(response.data.msg);
- return false;
- } else {
- Toast.success("修改成功");
- this.$emit("did_off", response.data.data.dialysis_order);
- var record = this.record;
- for (const key in response.data.data.dialysis_order) {
- this.$set(record, key, response.data.data.dialysis_order[key]);
- }
- }
- }).catch(err => {
- Toast.fail(err)
- });
- },
- didSelectStartTime: function(time) {
- this.end_time_str = parseTime(time, "{y}-{m}-{d} {h}:{i}") + ":00";
- },
- selectStartTimeAction: function() {
- if (this.record.id != 0) {
- if (this.record.end_time > 0) {
- var creator = 0;
- if (this.record.finish_creator == 0) {
- creator = this.record.finish_nurse;
- } else {
- creator = this.record.finish_creator;
- }
- if (
- this.$store.getters.user.user.id == creator ||
- this.isPremission
- ) {
- this.$refs.start_time_picker.open();
- } else {
- return;
- }
- } else {
- this.$refs.start_time_picker.open();
- }
- } else {
- this.$refs.start_time_picker.open();
- }
- },
- commitInfo: function() {
- Toast.loading({ forbidClick: true, duration: 0 });
- let ParamsQuery = {};
- ParamsQuery["patient"] = this.patient_prop.id;
- ParamsQuery["record_date"] = this.record_date;
- ParamsQuery["nurse"] = this.nurse_id;
- ParamsQuery["end_time"] = this.end_time_str;
-
- finish(ParamsQuery).then(response => {
- if (response.data.state == 0) {
- Toast.fail(response.data.msg);
- return false;
- } else {
- Toast.success("下机成功");
- this.$emit("did_off", response.data.data.assessmentAfterDislysis);
- var record = this.record;
- for (const key in response.data.data.dialysisOrder) {
- this.$set(record, key, response.data.data.dialysisOrder[key]);
- // record[key] = response.data.data.dialysisOrder[key]
- }
- // console.log(this.record)
- }
- }).catch(err => {
- Toast.fail(err)
- });
- },
- close: function() {
- this.$emit("close");
- },
- select_nurse: function() {
- if (this.record != null && this.record.id != "") {
- if (this.record.stage == 1) {
- this.selecting = true;
- var t = this;
- this.$refs.selector.showSingleSelect(
- this.admins,
- this.nurse_id,
- "选择下机护士",
- "name",
- "id",
- function(select_id) {
- console.log("nurse id: ", select_id);
- t.nurse_id = select_id;
- },
- function() {
- t.selecting = false;
- }
- );
- } else {
- var creator = 0;
- if (this.record.finish_creator == 0) {
- creator = this.record.finish_nurse;
- } else {
- creator = this.record.finish_creator;
- }
- if (
- this.$store.getters.user.user.id == creator ||
- this.isPremission
- ) {
- this.selecting = true;
- var t = this;
- this.$refs.selector.showSingleSelect(
- this.admins,
- this.nurse_id,
- "选择下机护士",
- "name",
- "id",
- function(select_id) {
- console.log("nurse id: ", select_id);
- t.nurse_id = select_id;
- },
- function() {
- t.selecting = false;
- }
- );
- } else {
- return;
- }
- }
- }
- },
- open: function() {
- this.selecting = false;
- this.$refs.selector.hide();
- }
- },
- watch: {
- "record.stage": function(val) {
- if (val == 2) {
- for (let i = 0; i < this.special_premission.length; i++) {
- if (
- this.$store.getters.user.user.id ==
- this.special_premission[i].admin_user_id
- ) {
- this.isPremission = true;
- }
- }
- if (this.record.finish_nurse == 0) {
- this.creator = this.record.finish_nurse;
- } else {
- this.creator = this.record.finish_creator;
- }
- }
-
- console.log(this.creator);
- console.log(this.$store.getters.user.user.id);
- }
- }
- };
- </script>
-
- <style style="stylesheet/scss" lang="scss" scoped>
- .perform {
- text-align: center;
- font-size: 0.3rem;
- padding-top: 2rem;
- .crew {
- color: $pgh-color;
- }
- button {
- background: $main-color;
- color: #fff;
- font-size: 0.45rem;
- text-align: center;
- width: 3rem;
- height: 1.2rem;
- line-height: 1.2rem;
- border-radius: 4px;
- margin-top: 10px;
- }
- }
- </style>
|