WXL
2024-09-11 b5a56d53e44c426fa188ba3e4e1db3eb779e2fd9
src/views/followvisit/tasklist/index.vue
@@ -12,12 +12,18 @@
        label-width="98px"
      >
        <el-form-item label="任务名称">
          <el-input v-model="topqueryParams.name"></el-input>
          <el-input
            v-model="topqueryParams.taskName"
            @keyup.enter.native="handleQuery"
          ></el-input>
        </el-form-item>
        <el-form-item label="审核人">
          <el-input v-model="topqueryParams.name"></el-input>
        <el-form-item label="创建人">
          <el-input
            v-model="topqueryParams.createBy"
            @keyup.enter.native="handleQuery"
          ></el-input>
        </el-form-item>
        <el-form-item label="审核时间">
        <el-form-item label="创建时间">
          <el-date-picker
            v-model="dateRange"
            style="width: 240px"
@@ -28,32 +34,17 @@
            end-placeholder="结束日期"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="随访类型" prop="status">
          <el-select v-model="topqueryParams.topic" placeholder="请选择">
            <el-option
              v-for="item in topicoptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        <el-form-item label="服务项目" prop="status">
          <el-input
            v-model="topqueryParams.templatename"
            @keyup.enter.native="handleQuery"
          ></el-input>
        </el-form-item>
        <el-form-item label="模版" prop="status">
          <el-select v-model="topqueryParams.topic" placeholder="请选择">
        <el-form-item label="任务状态" prop="status">
          <el-select v-model="topqueryParams.sendState" placeholder="请选择">
            <el-option
              v-for="item in topicoptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="门诊随访状态" prop="status">
          <el-select v-model="topqueryParams.topic" placeholder="请选择">
            <el-option
              v-for="item in topicoptions"
              v-for="item in dict.type.task_status"
              :key="item.value"
              :label="item.label"
              :value="item.value"
@@ -77,7 +68,11 @@
      <el-divider></el-divider>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-select v-model="tasktopic" placeholder="请选择新增类型">
          <el-select
            @change="handleQuery"
            v-model="tasktopic"
            placeholder="请选择新增类型"
          >
            <el-option
              v-for="item in taskoptions"
              :key="item.value"
@@ -97,30 +92,7 @@
            >新增</el-button
          >
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="success"
            plain
            icon="el-icon-edit"
            size="medium"
            :disabled="single"
            @click="handleUpdate"
            >修改</el-button
          >
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="danger"
            plain
            icon="el-icon-delete"
            size="medium"
            :disabled="multiple"
            @click="handleDelete"
            v-hasPermi="['system:user:remove']"
            >删除</el-button
          >
        </el-col>
        <el-col :span="19">
          <div class="documentf">
            <div class="document">
@@ -143,19 +115,19 @@
              @queryTable="getList"
              :columns="columns"
            ></right-toolbar> -->
      <el-table
        v-loading="loading"
        :data="userList"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="50" align="center" />
        <el-table-column label="序号" fixed align="center" key="taskid" prop="taskid" />
      <el-table v-loading="loading" :data="userList">
        <!-- <el-table-column
          label="序号"
          fixed
          align="center"
          key="taskid"
          prop="taskid"
        /> -->
        <el-table-column
          label="任务名称"
          fixed
          align="center"
          sortable
          key="taskName"
          prop="taskName"
          :show-overflow-tooltip="true"
@@ -167,14 +139,19 @@
          prop="taskDesc"
        />
        <el-table-column
          label="服务项目"
          align="center"
          key="templatename"
          prop="templatename"
        />
        <el-table-column
          label="待执行/总任务"
          align="center"
          key="nickName"
          prop="nickName"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.wfs}}/{{ scope.row.yfs }}</span>
            <span>{{ scope.row.wfs }}/{{ scope.row.yfs }}</span>
          </template>
        </el-table-column>
        <el-table-column
@@ -193,18 +170,24 @@
          width="160"
        >
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createTime) }}</span>
            <span>{{ formatTime(scope.row.createTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="状态"
          fixed="right"
          align="center"
          key="phonenumber"
          prop="phonenumber"
          key="sendState"
          prop="sendState"
          width="120"
        />
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.task_status"
              :value="scope.row.sendState"
            />
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          fixed="right"
@@ -214,21 +197,27 @@
        >
          <template slot-scope="scope">
            <el-button
              v-if="scope.row.sendState == 1 || scope.row.sendState == 3"
              size="medium"
              type="text"
              @click="handleUpdate(scope.row)"
              @click="sponsor(scope.row)"
              ><span class="button-zx"
                ><i class="el-icon-s-promotion"></i>任务发起</span
              ></el-button
            >
            <el-button size="medium" type="text" @click="newAdd(scope.row)"
              ><span class="button-xj"
                ><i class="el-icon-circle-plus-outline"></i>任务终止</span
              ></el-button
            >
            <el-button
              v-if="scope.row.sendState == 2"
              size="medium"
              type="text"
              @click="handleUpdate(scope.row)"
              ><span class="button-zx"
                ><i class="el-icon-s-promotion"></i>依照新增</span
              @click="stop(scope.row)"
              ><span class="button-zt"
                ><i class="el-icon-circle-plus-outline"></i>暂停任务</span
              ></el-button
            >
          </template>
@@ -267,58 +256,78 @@
        @pagination="getList"
      />
    </el-row>
    <!-- 添加或修改门诊随访对话框 -->
    <!-- 确认发起对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="addalteropen"
      width="700px"
      append-to-body
      title="任务发起确认"
      :visible.sync="taskformVisible"
      width="50%"
      :before-close="handleClose"
    >
      <el-form ref="form" :model="form" label-width="100px">
        <el-row :gutter="20">
          <el-col :span="12"
            ><el-form-item label="任务名称">
              <el-input v-model="form.taskName"></el-input> </el-form-item
          ></el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24"
            ><el-form-item label="所属科室">
              <el-select v-model="form.region" placeholder="请选择科室">
                <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option>
              </el-select> </el-form-item></el-col
        ></el-row>
        <el-row :gutter="20">
          <el-col :span="24"
            ><el-form-item label="随访类型">
              <el-select v-model="form.region" placeholder="请选择随访类型">
                <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option>
              </el-select> </el-form-item
          ></el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item label="服务模块">
              <el-select v-model="form.region" placeholder="请选择模块">
                <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item label="门诊随访要求">
              <el-input type="textarea" v-model="form.desc"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">提 交</el-button>
        <el-button @click="cancel">返 回</el-button>
      <el-tabs type="border-card" v-model="activname">
        <el-tab-pane>
          <span slot="label"><i class="el-icon-date"></i> 正常发起</span>
          <div style="font-size: 20px; color: red; margin-bottom: 20px">
            请确认任务"{{ taskform.taskName }}"的执行时间
          </div>
          <div
            style="font-size: 18px; margin-bottom: 20px"
            v-if="taskform.showDate"
          >
            执行日期:<span
              style="font-size: 18px; color: #2376b7; margin-bottom: 20px"
              >{{ taskform.showDate[0] }} 至 {{ taskform.showDate[1] }}</span
            >
          </div>
          <div
            style="font-size: 18px; margin-bottom: 20px"
            v-if="taskform.showTimeMorn[0]"
          >
            第一时间段:<span
              style="font-size: 18px; color: #2376b7; margin-bottom: 20px"
              >{{ taskform.showTimeMorn[0] }} 至
              {{ taskform.showTimeMorn[1] }}</span
            >
          </div>
          <div
            style="font-size: 18px; margin-bottom: 20px"
            v-if="taskform.showTimeNight[0]"
          >
            第二时间段:<span
              style="font-size: 18px; color: #2376b7; margin-bottom: 20px"
              >{{ taskform.showTimeNight[0] }} 至
              {{ taskform.showTimeNight[1] }}</span
            >
          </div>
          <div
            style="font-size: 18px; margin-bottom: 20px"
            v-if="taskform.showTimeNoon[0]"
          >
            第三时间段:<span
              style="font-size: 18px; color: #2376b7; margin-bottom: 20px"
              >{{ taskform.showTimeNoon[0] }} 至
              {{ taskform.showTimeNoon[1] }}</span
            >
          </div>
        </el-tab-pane>
        <el-tab-pane label="立即执行">
          <div style="font-size: 20px; color: red; margin-bottom: 20px">
            此操作将立即发起并执行任务:{{ taskform.taskName }},请谨慎操作!
          </div>
        </el-tab-pane>
      </el-tabs>
      <div style="text-align: right; margin: 20px 0">
        <el-button style="margin-right: 20px" @click="taskformVisible = false"
          >取 消</el-button
        >
        <el-button
          style="margin-right: 20px"
          type="success"
          @click="confirmSponsor(taskform)"
          >确认执行</el-button
        >
        <el-button type="primary" @click="handleUpdate(taskform)"
          >前往修改</el-button
        >
      </div>
    </el-dialog>
  </div>
@@ -333,14 +342,24 @@
  resetUserPwd,
  changeUserStatus,
} from "@/api/system/user";
import { getTasklist, getTaskInfo } from "@/api/AiCentre/index";
import {
  getTasklist,
  getTaskInfo,
  Editsingletask,
  delTaskInfo,
  Questionnairetasklist,
  Questionnairetaskget,
  Questionnairetasksponsor,
  TaskTemplateSendExecution,
} from "@/api/AiCentre/index";
import store from "@/store";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
  name: "User",
  dicts: ["sys_normal_disable", "sys_user_sex"],
  dicts: ["sys_normal_disable", "sys_user_sex", "task_status"],
  components: { Treeselect },
  data() {
    return {
@@ -372,10 +391,18 @@
      postOptions: [],
      // 角色选项
      roleOptions: [],
      taskform: {
        showDate: [],
        showTimeMorn: [],
        showTimeNight: [],
        showTimeNoon: [],
      },
      taskformVisible: false,
      dynamicTags: ["选项一", "选项二", "选项三"], //选项
      inputVisible: false,
      inputValue: "",
      previewVisible: false, //门诊随访预览弹框
      TaskOperation: {},
      radio: "",
      radios: [],
      previewtype: 2, //预览门诊随访类型
@@ -388,30 +415,40 @@
      taskoptions: [
        {
          value: "1",
          label: "宣教服务",
          label: "监测评估",
        },
        {
          value: "2",
          label: "门诊随访",
        },
        {
          value: "3",
          label: "出院随访",
        },
        {
          value: "3",
          label: "门诊随访",
        },
        {
          value: "4",
          label: "复诊服务",
          label: "宣教关怀",
        },
        {
          value: "5",
          label: "体检通知",
          label: "复诊管理",
        },
        {
          value: "6",
          label: "问卷服务",
          label: "满意度调查",
        },
        {
          value: "7",
          label: "患者报告",
        },
        {
          value: "8",
          label: "其他通知",
        },
      ],
      tasktopic: null, //新增类型
      tasktopic: "2", //新增类型
      activname: "",
      value: [],
      list: [],
      loading: false,
@@ -509,6 +546,7 @@
      topqueryParams: {
        pageNum: 1,
        pageSize: 10,
        type: 3,
        userName: undefined,
        tagid: undefined,
        topic: undefined,
@@ -584,10 +622,14 @@
  },
  watch: {},
  created() {
    this.tasktopic = this.$route.query.tasktopic
      ? this.$route.query.tasktopic
      : this.tasktopic;
    this.getList();
    this.getConfigKey("sys.user.initPassword").then((response) => {
      this.initPassword = response.msg;
    });
    // this.taskoptions = store.getters.Serviceauthority;
  },
  // 搜索
  mounted() {
@@ -598,12 +640,39 @@
  methods: {
    /** 查询任务列表 */
    getList() {
      // this.loading = true;
      getTasklist(this.topqueryParams).then((response) => {
        this.userList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
      this.loading = true;
      let type = this.$route.query.type;
      this.topqueryParams.serviceType = Number(this.tasktopic);
      this.topqueryParams.type = Number(this.type);
      if (
        this.tasktopic == 2 ||
        this.tasktopic == 3 ||
        this.tasktopic == 1 ||
        this.tasktopic == 7 ||
        this.tasktopic == 6
      ) {
        this.topqueryParams.type = 2;
        this.TaskOperation.taskType = 2;
      } else if (this.tasktopic == 4 || this.tasktopic == 8) {
        this.topqueryParams.type = 3;
        this.TaskOperation.taskType = 3;
      } else if (this.tasktopic == 5) {
        this.topqueryParams.type = 1;
        this.TaskOperation.taskType = 1;
      }
      // this.topqueryParams.typename = this.findLabelByValue(
      //   this.taskoptions,
      //   this.tasktopic
      // );
      getTasklist(this.addDateRange(this.topqueryParams, this.dateRange)).then(
        (response) => {
          this.userList = response.rows;
          this.total = response.total;
          this.$forceUpdate();
          this.loading = false;
        }
      );
    },
    // 查看门诊随访详情
    Referencequestion(row) {
@@ -623,26 +692,7 @@
        this.options = [];
      }
    },
    // 门诊随访状态修改
    handleStatusChange(row) {
      let text = row.status === "0" ? "启用" : "停用";
      this.$modal
        .confirm('确认要"' + text + '""' + row.userName + '"用户吗?')
        .then(function () {
          return changeUserStatus(row.userId, row.status);
        })
        .then(() => {
          this.$modal.msgSuccess(text + "成功");
        })
        .catch(function () {
          row.status = row.status === "0" ? "1" : "0";
        });
    },
    // 取消按钮
    cancel() {
      this.addalteropen = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
@@ -702,35 +752,212 @@
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.$router.push({
        path: "/followvisit/particty",
        query: { type: this.tasktopic },
      });
      if (this.topqueryParams.type == 1) {
        this.$router.push({
          path: "/followvisit/particty",
          query: {
            type: this.topqueryParams.type,
            serviceType: this.tasktopic,
          },
        });
      } else if (this.topqueryParams.type == 2) {
        this.$router.push({
          path: "/followvisit/QuestionnaireTask",
          query: {
            type: this.topqueryParams.type,
            serviceType: this.tasktopic,
          },
        });
      } else if (this.topqueryParams.type == 3) {
        this.$router.push({
          path: "/followvisit/Missioncreation",
          query: {
            type: this.topqueryParams.type,
            serviceType: this.tasktopic,
          },
        });
      }
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.$router.push({
        path: "/followvisit/particty",
        query: { type: row.hospType, id: row.taskid },
      });
      if (this.topqueryParams.type == 1) {
        this.$router.push({
          path: "/followvisit/particty",
          query: {
            id: row.taskid,
            type: this.topqueryParams.type,
            serviceType: this.tasktopic,
          },
        });
      } else if (this.topqueryParams.type == 2) {
        this.$router.push({
          path: "/followvisit/QuestionnaireTask",
          query: {
            id: row.taskid,
            type: this.topqueryParams.type,
            serviceType: this.tasktopic,
          },
        });
      } else if (this.topqueryParams.type == 3) {
        this.$router.push({
          path: "/followvisit/Missioncreation",
          query: {
            id: row.taskid,
            type: this.topqueryParams.type,
            serviceType: this.tasktopic,
          },
        });
      }
    },
    // 删除任务
    deletefn(){},
    /** 重置密码按钮操作 */
    handleResetPwd(row) {
      this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        closeOnClickModal: false,
        inputPattern: /^.{5,20}$/,
        inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
      })
        .then(({ value }) => {
          resetUserPwd(row.userId, value).then((response) => {
            this.$modal.msgSuccess("修改成功,新密码是:" + value);
    deletefn(row) {
      this.$modal
        .confirm(
          '是否删除任务名称为"' +
            row.taskName +
            '"的数据项,删除后不可撤回!是否继续'
        )
        .then(() => {
          delTaskInfo(row.taskid).then((res) => {
            if (res.code == 200) {
              this.getList();
              this.$modal.msgSuccess("删除成功");
            }
          });
        })
        .catch(() => {});
    },
    // 任务发起
    sponsor(row) {
      console.log(row, "任务信息");
      this.taskform = row;
      if (this.taskform.showDate && this.taskform.sendType != 2) {
        this.taskform.showDate = this.taskform.showDate.split(",");
      }
      if (this.taskform.showTimeMorn && this.taskform.sendType != 2) {
        this.taskform.showTimeMorn = this.taskform.showTimeMorn.split(",");
      } else {
        this.taskform.showTimeMorn = [];
      }
      if (this.taskform.showTimeNight && this.taskform.sendType != 2) {
        this.taskform.showTimeNight = this.taskform.showTimeNight.split(",");
      } else {
        this.taskform.showTimeNight = [];
      }
      if (this.taskform.showTimeNoon && this.taskform.sendType != 2) {
        this.taskform.showTimeNoon = this.taskform.showTimeNoon.split(",");
      } else {
        this.taskform.showTimeNoon = [];
      }
      if (this.taskform.sendState != 2 && this.taskform.sendType != 2) {
        this.taskformVisible = true;
      } else if (this.taskform.sendState != 2 && this.taskform.sendType == 2) {
        this.TaskOperation.taskId = row.taskid;
        this.TaskOperation.sendState = 2;
        this.TaskOperation.sendType = 2;
        this.$modal
          .confirm(
            '当前选中任务名称为"' +
              row.taskName +
              '"的数据项为立即执行任务,发起执行后不可撤回!是否继续'
          )
          .then(() => {
            TaskTemplateSendExecution(this.TaskOperation).then((res) => {
              if (res.code == 200) {
                this.getList();
                this.$modal.msgSuccess("任务已立即执行");
              }
            });
          })
          .catch(() => {});
      } else {
        this.$modal.msgError("任务已发起,不可再次发起");
      }
    },
    // 确认发起
    confirmSponsor(row) {
      if (this.activname == 0) {
        this.TaskOperation.taskId = row.taskid;
        this.TaskOperation.sendState = 2;
        TaskTemplateSendExecution(this.TaskOperation).then((res) => {
          if (res.code == 200) {
            this.$modal.msgSuccess("任务已成功加入执行队列");
            this.taskformVisible = false;
            this.getList();
          }
        });
      } else if (this.activname == 1) {
        this.immediateExecution(row);
      }
    },
    // 立即执行
    immediateExecution(row) {
      console.log(row, "任务信息");
      if (row.sendState != 2) {
        this.TaskOperation.taskId = row.taskid;
        this.TaskOperation.sendState = 2;
        this.TaskOperation.sendType = 2;
        this.$modal
          .confirm(
            '是否立即执行任务名称为为"' +
              row.taskName +
              '"的数据项?发起执行后不可撤回!'
          )
          .then(() => {
            TaskTemplateSendExecution(this.TaskOperation).then((res) => {
              if (res.code == 200) {
                this.getList();
                this.$modal.msgSuccess("任务已立即执行");
              }
            });
          })
          .then(() => {})
          .catch(() => {});
      }
    },
    // 依照新增
    newAdd(row) {
      this.$modal
        .confirm("是否依照当前任务创建新任务?")
        .then(() => {
          if (this.tasktopic == 5) {
            this.$router.push({
              path: "/followvisit/particty",
              query: { type: 1, id: row.taskid, nhh: 1 },
            });
          } else if (
            this.tasktopic == 2 ||
            this.tasktopic == 3 ||
            this.tasktopic == 6
          ) {
            this.$router.push({
              path: "/followvisit/QuestionnaireTask",
              query: { type: 2, id: row.taskid, nhh: 1 },
            });
          } else if (this.tasktopic == 8 || this.tasktopic == 4) {
            this.$router.push({
              path: "/followvisit/Missioncreation",
              query: { type: 3, id: row.taskid, nhh: 1 },
            });
          }
        })
        .catch(() => {});
    },
    // 暂停
    stop(row) {
      console.log(row);
      if (row.sendState == 2) {
        this.TaskOperation.taskId = row.taskid;
        this.TaskOperation.sendState = 3;
        this.TaskOperation.sendType = "";
        this.TaskOperation.taskType = row.type;
        TaskTemplateSendExecution(this.TaskOperation).then((res) => {
          this.$modal.msgSuccess("任务已暂停");
          this.getList();
        });
      }
    },
    /** 提交按钮 */
@@ -776,6 +1003,10 @@
        },
        `user_${new Date().getTime()}.xlsx`
      );
    },
    findLabelByValue(data, value) {
      const item = data.find((item) => item.value === value);
      return item ? item.label : null;
    },
  },
};
@@ -888,6 +1119,24 @@
  border-radius: 1px;
  color: #ffffff;
}
.button-lj {
  background: #e9614f;
  padding: 5px;
  border-radius: 1px;
  color: #ffffff;
}
.button-xj {
  background: #815c94;
  padding: 5px;
  border-radius: 1px;
  color: #ffffff;
}
.button-zt {
  background: #f9c116;
  padding: 5px;
  border-radius: 1px;
  color: #ffffff;
}
::v-deep.el-radio-group {
  span {
@@ -895,6 +1144,9 @@
  }
}
::v-deep.el-button + .el-button {
  margin-left: 0;
}
::v-deep.el-checkbox-group {
  span {
    font-size: 24px;