安生 4 gadi atpakaļ
vecāks
revīzija
2e38e97c12

+ 53 - 0
src/api/duty/duty.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询【请填写功能名称】列表
+export function listDuty(query) {
+  return request({
+    url: '/system/duty/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询【请填写功能名称】详细
+export function getDuty(id) {
+  return request({
+    url: '/system/duty/' + id,
+    method: 'get'
+  })
+}
+
+// 新增【请填写功能名称】
+export function addDuty(data) {
+  return request({
+    url: '/system/duty',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改【请填写功能名称】
+export function updateDuty(data) {
+  return request({
+    url: '/system/duty',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除【请填写功能名称】
+export function delDuty(id) {
+  return request({
+    url: '/system/duty/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出【请填写功能名称】
+export function exportDuty(query) {
+  return request({
+    url: '/system/duty/export',
+    method: 'get',
+    params: query
+  })
+}

+ 539 - 0
src/views/system/duty/duty.vue

@@ -0,0 +1,539 @@
+<template>
+  <div  class="app-container">
+    <!-- 列表 -->
+    <el-card class="box-card">
+      <div class="search">
+        <el-button-group>
+          <el-button  type="primary" @click="dialogVisible = true" class="addbtn">新增排班</el-button>
+        </el-button-group>
+      </div>
+      <!-- 信息 -->
+      <el-tabs type="border-card" v-model="activeName2" @tab-click="handleClick" style="margin-top: 20px;">
+        <el-tab-pane label="本周值班" name="first">
+          <el-col :span="8" v-for="(item,index) in dutyList">
+            <el-card class="box-card">
+              <div slot="header" class="clearfix">
+                <span>{{item.week}}值班</span>
+              </div>
+              <el-table :data="[item]" border>
+                <el-table-column prop="time" label="日期">
+                </el-table-column>
+                <el-table-column
+                  prop="leader"
+                  label="带班领导"
+                >
+                </el-table-column>
+                <el-table-column
+                  prop="am"
+                  label="上午"
+                >
+                </el-table-column>
+                <el-table-column
+                  prop="noon"
+                  label="下午">
+                </el-table-column>
+                <el-table-column
+                  prop="pm"
+                  label="晚上">
+                </el-table-column>
+              </el-table>
+            </el-card>
+          </el-col>
+        </el-tab-pane>
+        <el-tab-pane label="往期值班" name="second">
+          <el-row :gutter="10" class="mb8">
+            <el-col :span="1.5">
+              <el-form :model="queryParams" ref="queryForm" :inline="true">
+                <el-form-item label="选择日期" prop="status">
+                  <el-date-picker
+                    v-model="value9"
+                    type="daterange"
+                    start-placeholder="开始日期"
+                    end-placeholder="结束日期"
+                    default-value="2010-10-01">
+                  </el-date-picker>
+                </el-form-item>
+                <el-form-item>
+                  <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+                  <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+                </el-form-item>
+              </el-form>
+            </el-col>
+            <el-col :span="24">
+              <el-card class="box-card">
+                <div slot="header" class="clearfix">
+                  <span>本月值班</span>
+                </div>
+                <el-table  :data="tableData" border>
+                  <el-table-column
+                    prop="time"
+                    label="日期"
+                  >
+                  </el-table-column>
+                  <el-table-column
+                    prop="name"
+                    label="带班领导"
+                  >
+                  </el-table-column>
+                  <el-table-column
+                    prop="swname"
+                    label="上午"
+                  >
+                  </el-table-column>
+                  <el-table-column
+                    prop="xwname"
+                    label="下午">
+                  </el-table-column>
+                  <el-table-column
+                    prop="wsname"
+                    label="晚上">
+                  </el-table-column>
+                </el-table>
+              </el-card>
+            </el-col>
+          </el-row>
+        </el-tab-pane>
+      </el-tabs>
+
+    </el-card>
+    <!-- 添加信息 -->
+    <el-dialog title="添加排班" :visible.sync="dialogVisible" width="55%" @close="dialogClosed">
+      <el-form label-width="120px" :model="form" :rules="formRules" ref="formRef">
+        <el-form-item label="值班日期" prop="schedulingDay">
+          <el-date-picker
+            v-model="form.time"
+            type="date"
+            placeholder="选择日期">
+          </el-date-picker>
+        </el-form-item>
+                <el-form-item label="值班领导" prop="staffId">
+                  <el-input v-model="form.leader" placeholder="请选择带班领导" clearable="true">
+                    <template slot="append">
+                      <el-button
+                        type="primary"
+                        icon="el-icon-plus"
+                        size="mini"
+                        @click="handleSelect" >
+                        选择人员</el-button>
+                    </template>
+                  </el-input>
+                </el-form-item>
+        <el-form-item label="上午值班人员" prop="mondayStatus">
+          <el-input v-model="form.am" placeholder="请选择上午值班人员" clearable="true">
+            <template slot="append">
+              <el-button
+                type="primary"
+                icon="el-icon-plus"
+                size="mini"
+                @click="handleSelect1" >
+                选择人员</el-button>
+            </template>
+          </el-input>
+        </el-form-item>
+        <el-form-item label="下午值班人员" prop="mondayStatus">
+          <el-input v-model="form.noon" placeholder="请选择下午值班人员" clearable="true">
+            <template slot="append">
+              <el-button
+                type="primary"
+                icon="el-icon-plus"
+                size="mini"
+                @click="handleSelect2" >
+                选择人员</el-button>
+            </template>
+          </el-input>
+        </el-form-item>
+        <el-form-item label="晚上值班人员" prop="mondayStatus">
+          <el-input v-model="form.pm" placeholder="请选择晚上值班人员" clearable="true">
+            <template slot="append">
+              <el-button
+                type="primary"
+                icon="el-icon-plus"
+                size="mini"
+                @click="handleSelect3" >
+                选择人员</el-button>
+            </template>
+          </el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="cancel">取 消</el-button>
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+      </span>
+    </el-dialog>
+    <!-- 选择人员对话框 -->
+    <select-user-by-dept ref="selectUserByDept" :title="title" :open="open" :inputName="receiverName" :inputAccount="receiverAccount" append-to-body @ok="selectOK"/>
+    <select-user-by-dept ref="selectUserByDept1" :title="title" :open="open1" :inputName="receiverName" :inputAccount="receiverAccount" append-to-body @ok="selectOK1"/>
+    <select-user-by-dept ref="selectUserByDept2" :title="title" :open="open2" :inputName="receiverName" :inputAccount="receiverAccount" append-to-body @ok="selectOK2"/>
+    <select-user-by-dept ref="selectUserByDept3" :title="title" :open="open3" :inputName="receiverName" :inputAccount="receiverAccount" append-to-body @ok="selectOK3"/>
+  </div>
+</template>
+
+<script>
+
+  import { listDuty,getDuty,addDuty,updateDuty} from "@/api/duty/duty";
+  import SelectUserByDept from "@/components/SelectRen/selectUserByDept";
+
+  export default {
+    components: {SelectUserByDept},
+    data() {
+      return {
+        leader: "",
+        am:'',
+        noon:'',
+        pm:'',
+        receiverAccount: "",
+        // 遮罩层
+        loading: true,
+        // 总条数
+        total: 0,
+        // 【请填写功能名称】表格数据
+        dutyList: [],
+        // 弹出层标题
+        title: "",
+        // 是否显示弹出层
+        open: false,
+        open1: false,
+        open2: false,
+        open3: false,
+        // 查询参数
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          time: undefined,
+          leader: undefined,
+          am: undefined,
+          noon: undefined,
+          pm: undefined,
+          applyUser: undefined
+        },
+        activeName2: 'first',
+        tableData: [{
+          time: '2016-05-02',
+          name: '王小虎',
+          swname: '王弄',
+          xwname: '李李',
+          wsname: '刘刘'}
+        ],
+        base: "",
+        monday: "",
+        today: "",
+        dateFormat2: "",
+        dateFormat8: "",
+        nextMonday: "",
+        lastsunday: "",
+        queryInfo: {
+          query: "",
+          pagenum: 1,
+          pagesize: 10
+        },
+        role: false,
+        homes: [],
+        workers: [],
+        dialogVisible: false,
+        form: {},
+        formRules: {
+          time: [
+            { required: true, message: "日期不能为空", trigger: "blur" }
+          ],
+          leader:[{
+            required:true,
+            message:'请选择值班领导',
+            trigger:'blur'
+          }],
+          am:[{
+            required:true,
+            message:'请选择上午值班人员',
+            trigger:'blur'
+          }],
+          noon:[{
+            required:true,
+            message:'请选择下午值班人员',
+            trigger:'blur'
+          }],
+          pm:[{
+            required:true,
+            message:'请选择晚上值班人员',
+            trigger:'blur'
+          }],
+        }
+      };
+    },
+    created() {
+      this.getList();
+      this.formatDate();
+    },
+    watch: {},
+    mounted() {
+    },
+    methods: {
+      handleSelect() {
+        this.$refs.selectUserByDept.childOpen=true;
+        this.open = true;
+        this.title = "选择值班领导";
+      },
+      handleSelect1() {
+        this.$refs.selectUserByDept1.childOpen=true;
+        this.open1 = true;
+        this.title = "选择上午值班人员";
+      },
+      handleSelect2() {
+        this.$refs.selectUserByDept2.childOpen=true;
+        this.open2 = true;
+        this.title = "选择下午值班人员";
+      },
+      handleSelect3() {
+        this.$refs.selectUserByDept3.childOpen=true;
+        this.open3 = true;
+        this.title = "选择晚上值班人员";
+      },
+      selectOK(zh, xm) {
+        this.leader=xm;
+        // this.form.leader = this.leader;
+        this.form.leader = xm
+        this.open=false;
+      },
+      selectOK1(zh, xm) {
+        this.am=xm;
+        // this.form.am = this.am;
+        this.form.am = xm;
+        this.open1=false;
+      },
+      selectOK2(zh, xm) {
+        this.noon=xm;
+        // this.form.noon = this.noon;
+        this.form.noon = xm;
+        this.open2=false;
+      },
+      selectOK3(zh, xm) {
+        this.pm=xm;
+        // this.form.pm = this.pm;
+        this.form.pm = xm;
+        this.open3=false;
+      },
+      cancel() {
+        this.dialogVisible = false;
+        this.reset();
+      },
+      // 表单重置
+      reset() {
+        this.form = {
+          id: undefined,
+          time: undefined,
+          leader: undefined,
+          am: undefined,
+          noon: undefined,
+          pm: undefined,
+          createTime: undefined,
+          applyUser: undefined
+        };
+        this.resetForm("form");
+      },
+      /** 提交按钮 */
+      submitForm: function() {
+        this.$refs["formRef"].validate(valid => {
+          if (valid) {
+              addDuty(this.form).then(response => {
+                if (response.code === 200) {
+                  this.msgSuccess("新增成功");
+                  console.log(this.form)
+                  this.dialogVisible = false;
+                  this.dutyList = [];
+                  this.getList();
+
+                }
+              });
+            }
+        });
+      },
+      getList(){
+        this.loading = true;
+        listDuty(this.queryParams).then(response => {
+          let arr = response.rows;
+          for(var i =0; i < arr.length;i++){
+            this.dutyList.unshift(
+              arr[i]
+            )
+          };
+
+          this.total = response.total;
+          this.loading = false;
+          console.log(this.dutyList)
+        })
+
+      },
+
+
+
+      lastweek() {
+        this.getBeforNday(this.base, 7);
+        console.log(this.dateFormat2);
+        this.getTableList();
+      },
+      nextweek() {
+        this.getBeforNday(this.base, -7);
+        console.log(this.dateFormat2);
+        this.getTableList();
+      },
+      handleChange_1(data) {
+        console.log(data);
+      },
+      handleChange_2(data) {
+        console.log(data, 123);
+      },
+      dialogClosed() {
+        this.form = {};
+        this.title = "新增";
+      },
+      //获取workers
+      async getworkers() {
+        const { data: res } = await this.$http.post(
+          "",
+          {
+            page: { pagesize: 10000, start: 0 }
+          }
+        );
+
+        this.workers = res.data;
+      },
+      async getTableList() {
+        var a = sessionStorage.getItem("elderlyHomeId");
+        if (a == 0) {
+          const { data: res } = await this.$http.post(
+            "",
+            {
+              schedulingDay: this.dateFormat2,
+              page: {
+                pagesize: 1000,
+                start: 0
+              }
+            }
+          );
+
+          if (res.msg !== "success") {
+            return this.$message.error("接口出错!");
+          }
+          this.tableData = res.data;
+          this.total = res.data.length;
+        } else {
+          const { data: res } = await this.$http.post(
+            "",
+            {
+              elderlyHomeId: a,
+              schedulingDay: this.dateFormat2,
+              page: {
+                pagesize: 1000,
+                start: 0
+              }
+            }
+          );
+
+          if (res.msg !== "success") {
+            return this.$message.error("接口出错!");
+          }
+          this.tableData = res.data;
+          this.total = res.data.length;
+        }
+      },
+      async removeUserById(id) {
+        // 弹框询问用户是否删除数据
+        const confirmResult = await this.$confirm(
+          "此操作将永久删除该数据, 是否继续?",
+          "提示",
+          {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          }
+        ).catch(err => err);
+
+        // 如果用户确认删除,则返回值为字符串 confirm
+        // 如果用户取消了删除,则返回值为字符串 cancel
+        // console.log(confirmResult)
+        if (confirmResult !== "confirm") {
+          return this.$message.info("已取消删除");
+        }
+
+        const { data: res } = await this.$http.post(
+          "5003/nurseHome/nurseSubstitute/del?id=" + id
+        );
+
+        if (res.msg !== "success") {
+          return this.$message.error("删除数据失败");
+        }
+        this.getTableList();
+        this.$message.success("删除数据成功!");
+      },
+      //添加or修改
+      showEditDialog(row) {
+        this.form = row;
+        this.title = "修改排班";
+        this.dialogVisible = true;
+      },
+      async handleSubmit() {
+        this.$refs.formRef.validate(async valid => {
+          if (!valid) return;
+          if (this.title === "修改排班") {
+            request({
+              url: "",
+              data: this.form
+            }).then(res => {
+              this.getTableList();
+              this.$message.success("修改数据成功!");
+            });
+            this.dialogVisible = false;
+          } else {
+            var a = sessionStorage.getItem("elderlyHomeId");
+            this.form.elderlyHomeId = a;
+            this.form.schedulingDay = this.dateFormat2;
+            request({
+              url: "",
+              data: this.form
+            }).then(res => {
+              this.getTableList();
+              this.$message.success("添加数据成功!");
+            });
+            this.dialogVisible = false;
+          }
+        });
+      },
+      handleSelectionChange(val) {
+        this.checkedList = val;
+      },
+      handleCurrentChange(newPage) {
+        this.queryInfo.pagenum = newPage;
+        this.getTableList();
+      }
+    }
+  };
+</script>
+<style>
+  .el-card__header{background: #cae6ff;}
+  .el-row {
+    margin-top: 20px;
+    margin-bottom: 20px;
+  &:last-child {
+     margin-bottom: 0;
+   }
+  }
+  .el-col {
+    border-radius: 4px;
+    padding:10px;
+  }
+  .bg-purple-dark {
+    background: #99a9bf;
+  }
+  .bg-purple {
+    background: #d3dce6;
+  }
+  .bg-purple-light {
+    background: #e5e9f2;
+  }
+  .grid-content {
+    border-radius: 4px;
+    min-height: 36px;
+  }
+  .row-bg {
+    padding: 10px 0;
+    background-color: #f9fafc;
+  }
+</style>

+ 11 - 4
src/views/system/officework/schedule/schedule.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container" v-if="isReloadData">
-    <FullCalendar v-loading="loading" defaultView="dayGridMonth" :options="calendarOptions" locale="zh-cn" firstDay="1" weekNumberCalculation="ISO"
+    <FullCalendar  defaultView="dayGridMonth" :options="calendarOptions" locale="zh-cn" firstDay="1" weekNumberCalculation="ISO"
                   showNonCurrentDates="false"
                   :eventTimeFormat="evnetTime"
                   :header="header"
@@ -247,6 +247,8 @@
            // if (response.code === 200) {
              this.msgSuccess("修改成功");
              this.schedule1=false;
+            this.calendarOptions.events = [];
+            this.toList();
            // }
          });
          this.resetForm();
@@ -259,7 +261,7 @@
          });
        },
       toList (){
-        this.loading = true;
+        // this.loading = true;
         selectList(this.formData).then(response => {
           console.log(response.rows)
           for(var i = 0; i < response.rows.length;i++){
@@ -271,9 +273,10 @@
               // allDay: arg.allDay
             });
           }
-          this.loading = false;
+
+          // this.loading = false;
           // this.toList();
-          console.log( this.calendarOptions.events)
+          // console.log( this.calendarOptions.events)
         })
       },
           // queding(){
@@ -327,6 +330,8 @@
                 this.msgSuccess("添加成功");
                 this.schedule=false;
                 // this.toList();
+                this.calendarOptions.events = [];
+                this.toList();
               }
             });
             this.resetForm();
@@ -347,6 +352,8 @@
               this.reload();
               this.msgSuccess("删除成功");
               this.schedule1 = false;
+              this.calendarOptions.events = [];
+              this.toList();
             }).catch(function() {});