WXL
3 天以前 c7c591d6b52274c7d324dfccee5686632c153f6f
src/views/followvisit/satisfaction/index.vue
@@ -1,17 +1,859 @@
<template>
  <div>满意度调查</div>
  <div class="app-container">
    <el-row :gutter="20">
      <!--用户数据-->
      <el-form
        :model="topqueryParams"
        ref="queryForm"
        size="small"
        :inline="true"
        v-show="showSearch"
        label-width="98px"
      >
        <el-form-item label="病区名称">
          <el-input placeholder="请输入患者病区" v-model="topqueryParams.hospitaldistrictname"></el-input>
        </el-form-item>
        <el-form-item label="科室名称">
          <el-input placeholder="请输入患者科室" v-model="topqueryParams.deptname"></el-input>
        </el-form-item>
        <el-form-item label="患者名称">
          <el-input placeholder="请输入患者姓名" v-model="topqueryParams.patName"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="medium"
            @click="handleQuery"
            >搜索</el-button
          >
          <el-button icon="el-icon-refresh" size="medium" @click="resetQuery"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
      <el-divider></el-divider>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-select v-model="tasktopic" placeholder="请选择新增类型">
            <el-option
              v-for="item in taskoptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </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="1.5">
          <div class="documentf">
            <div class="document">
              <el-button
                type="warning"
                plain
                icon="el-icon-download"
                size="medium"
                @click="handleExport"
                v-hasPermi="['system:user:export']"
                >导出</el-button
              >
            </div>
          </div>
        </el-col>
        <!-- <el-col :span="1.5"> </el-col> -->
      </el-row>
      <!-- <right-toolbar
              :showSearch.sync="showSearch"
              @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="编号" align="center" key="id" prop="id" />
        <el-table-column
          label="病区"
          align="center"
          width="120"
          key="hospitaldistrictname"
          prop="hospitaldistrictname"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="科室"
          width="120"
          align="center"
          key="deptname"
          prop="deptname"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="姓名"
          align="center"
          key="patName"
          prop="patName"
          width="120"
        />
        <el-table-column
          label="联系电话"
          align="center"
          key="phone"
          prop="phone"
          width="150"
          show-overflow-tooltip
        />
        <el-table-column
          label="真实性(20)"
          align="center"
          key="authenticity"
          prop="authenticity"
          sortable
          width="120"
        >
          <template slot-scope="scope">
            <el-input-number
              v-if="scope.row.editing"
              v-model="scope.row.authenticity"
              :min="0"
              :max="20"
              size="small"
              controls-position="right"
            />
            <span v-else>{{ scope.row.authenticity }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="一周内完成(20)"
          align="center"
          key="weekFinish"
          prop="weekFinish"
          sortable
          width="150"
        >
          <template slot-scope="scope">
            <el-input-number
              v-if="scope.row.editing"
              v-model="scope.row.weekFinish"
              :min="0"
              :max="20"
              size="small"
              controls-position="right"
            />
            <span v-else>{{ scope.row.weekFinish }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="规范性(10)"
          align="center"
          key="standard"
          prop="standard"
          width="120"
          sortable
        >
          <template slot-scope="scope">
            <el-input-number
              v-if="scope.row.editing"
              v-model="scope.row.standard"
              :min="0"
              :max="20"
              size="small"
              controls-position="right"
            />
            <span v-else>{{ scope.row.standard }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="及时性(10)"
          align="center"
          key="timeliness"
          prop="timeliness"
          sortable
          width="150"
        >
          <template slot-scope="scope">
            <el-input-number
              v-if="scope.row.editing"
              v-model="scope.row.timeliness"
              :min="0"
              :max="20"
              size="small"
              controls-position="right"
            />
            <span v-else>{{ scope.row.timeliness }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="宣教情况(10)"
          align="center"
          key="library"
          prop="library"
          sortable
          width="150"
        >
          <template slot-scope="scope">
            <el-input-number
              v-if="scope.row.editing"
              v-model="scope.row.library"
              :min="0"
              :max="20"
              size="small"
              controls-position="right"
            />
            <span v-else>{{ scope.row.library }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="环境满意度(10)"
          align="center"
          key="environment"
          prop="environment"
          sortable
          width="150"
        >
          <template slot-scope="scope">
            <el-input-number
              v-if="scope.row.editing"
              v-model="scope.row.environment"
              :min="0"
              :max="20"
              size="small"
              controls-position="right"
            />
            <span v-else>{{ scope.row.environment }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="医生满意度(10)"
          align="center"
          key="doctorSatisfaction"
          prop="doctorSatisfaction"
          width="150"
          sortable
        >
          <template slot-scope="scope">
            <el-input-number
              v-if="scope.row.editing"
              v-model="scope.row.doctorSatisfaction"
              :min="0"
              :max="20"
              size="small"
              controls-position="right"
            />
            <span v-else>{{ scope.row.doctorSatisfaction }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="护士满意度(10)"
          align="center"
          key="nurseSatisfaction"
          prop="nurseSatisfaction"
          width="150"
          sortable
        >
          <template slot-scope="scope">
            <el-input-number
              v-if="scope.row.editing"
              v-model="scope.row.nurseSatisfaction"
              :min="0"
              :max="20"
              size="small"
              controls-position="right"
            />
            <span v-else>{{ scope.row.nurseSatisfaction }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="总分"
          fixed="right"
          align="center"
          key="total"
          prop="total"
          sortable
        >
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          fixed="right"
          width="200"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
            <el-button
              v-if="!scope.row.editing"
              size="medium"
              type="text"
              @click="handleDelete(scope.row)"
              ><span class="button-zx"
                ><i class="el-icon-delete"></i>删除</span
              ></el-button
            >
            <el-button
              size="medium"
              type="text"
              @click="toggleEdit(scope.row, scope.$index)"
            >
              <span class="button-textxga">
                <i
                  :class="scope.row.editing ? 'el-icon-check' : 'el-icon-edit'"
                ></i>
                {{ scope.row.editing ? "保存" : "编辑" }}
              </span>
            </el-button>
            <el-button
              v-if="scope.row.editing"
              size="medium"
              type="text"
              @click="handleCancel(scope.row, scope.$index)"
              >取消</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="topqueryParams.pageNum"
        :limit.sync="topqueryParams.pageSize"
        @pagination="getList"
      />
    </el-row>
  </div>
</template>
<script>
import {
  listsatisfaction,
  delsatisfaction,
  updatesatisfaction,
  changeUserStatus,
} from "@/api/AiCentre/index";
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"],
  components: { Treeselect },
  data() {
    return {};
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户表格数据
      userList: null,
      // 弹出层标题
      title: "新增影像随访",
      // 是否显示修改、添加弹出层
      addalteropen: false,
      // 部门名称
      deptName: undefined,
      // 默认密码
      initPassword: undefined,
      // 日期范围
      dateRange: [],
      // 岗位选项
      postOptions: [],
      taskoptions: [
        {
          value: "1",
          label: "门诊病人",
        },
        {
          value: "2",
          label: "出院病人",
        },
        {
          value: "3",
          label: "医护人员",
        },
      ],
      tasktopic: null, //新增类型
      // 角色选项
      roleOptions: [],
      dynamicTags: ["选项一", "选项二", "选项三"], //选项
      inputVisible: false,
      inputValue: "",
      previewVisible: false, //影像随访预览弹框
      radio: "",
      radios: [],
      previewtype: 2, //预览影像随访类型
      total: 0, // 总条数
      ImportQuantity: 999, //导影像随访数量
      //预览影像随访信息
      previewvalue: {
        username: "这个医生对你怎么样",
      },
      value: [],
      list: [],
      loading: false,
      states: [],
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", new Date());
            },
          },
          {
            text: "昨天",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24);
              picker.$emit("pick", date);
            },
          },
          {
            text: "一周前",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", date);
            },
          },
        ],
      },
      // 表单参数
      form: {
        phonenumber: "",
        totagid: "",
        types: "",
        nickName: "",
        qystatus: "",
        btstatus: "",
      },
      // 查询参数
      topqueryParams: {
        pageNum: 1,
        pageSize: 10,
        userName: undefined,
        tagid: undefined,
        topic: undefined,
      },
      propss: { multiple: true },
      options: [],
      topicoptions: [
        {
          value: 1,
          label: "待审核",
        },
        {
          value: 2,
          label: "执行中",
        },
        {
          value: 3,
          label: "执行完成",
        },
        {
          value: 4,
          label: "已停止",
        },
      ],
      // 表单校验
      rules: {
        userName: [
          { required: true, message: "用户名称不能为空", trigger: "blur" },
          {
            min: 2,
            max: 20,
            message: "用户名称长度必须介于 2 和 20 之间",
            trigger: "blur",
          },
        ],
        nickName: [
          { required: true, message: "用户昵称不能为空", trigger: "blur" },
        ],
        password: [
          { required: true, message: "用户密码不能为空", trigger: "blur" },
          {
            min: 5,
            max: 20,
            message: "用户密码长度必须介于 5 和 20 之间",
            trigger: "blur",
          },
        ],
        email: [
          {
            type: "email",
            message: "请输入正确的邮箱地址",
            trigger: ["blur", "change"],
          },
        ],
        phonenumber: [
          {
            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
            message: "请输入正确的手机号码",
            trigger: "blur",
          },
        ],
        IDnumber: [
          {
            pattern:
              /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/,
            message: "请输入正确的身份证号码",
            trigger: "blur",
          },
        ],
      },
    };
  },
  watch: {},
  created() {
    this.getList();
    this.getConfigKey("sys.user.initPassword").then((response) => {
      this.initPassword = response.msg;
    });
  },
  // 搜索
  mounted() {
    this.list = this.states.map((item) => {
      return { value: `value:${item}`, label: `label:${item}` };
    });
  },
  methods: {
    /** 查询影像随访列表 */
    getList() {
      this.loading = true;
      listsatisfaction(this.topqueryParams).then((response) => {
        this.userList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 查看影像随访详情
    Referencequestion(row) {
      this.previewVisible = true;
    },
    // 添加弹框搜索
    remoteMethod(query) {
      if (query !== "") {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          this.options = this.list.filter((item) => {
            return item.label.toLowerCase().indexOf(query.toLowerCase()) > -1;
          });
        }, 200);
      } else {
        this.options = [];
      }
    },
    // 取消按钮
    cancel() {
      this.addalteropen = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        userId: undefined,
        deptId: undefined,
        userName: undefined,
        nickName: undefined,
        password: undefined,
        phonenumber: undefined,
        email: undefined,
        sex: undefined,
        status: "0",
        remark: undefined,
        postIds: [],
        roleIds: [],
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.topqueryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.topqueryParams.deptId = undefined;
      this.$refs.tree.setCurrentKey(null);
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.userId);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    //删除选项
    handleClose(tag) {
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
    },
    //触发新增输入
    showInput() {
      this.inputVisible = true;
      this.$nextTick((_) => {
        this.$refs.saveTagInput.$refs.input.focus();
      });
    },
    //获取失去焦点触发
    handleInputConfirm() {
      let inputValue = this.inputValue;
      if (inputValue) {
        this.dynamicTags.push(inputValue);
      }
      this.inputVisible = false;
      this.inputValue = "";
    },
    /** 新增按钮操作 */
    handleAdd() {
      // this.reset();
      // this.addalteropen = true;
      this.$router.push({
        path: "/Intelligentcenter/satisfaction/particulars",
        query: { type: this.tasktopic },
      });
    },
    /** 修改按钮操作 */
    toggleEdit(row, index) {
      if (row.editing) {
        // 保存逻辑
        updatesatisfaction(row).then((response) => {
          this.$modal.msgSuccess("修改成功");
          this.$set(this.userList, index, {
            ...row,
            editing: false,
            // 计算总分
            total: this.calculateTotal(row),
          });
        });
  created() {},
        // 这里可以添加API调用保存数据
      } else {
        // 进入编辑模式
        this.$set(this.userList, index, {
          ...row,
          editing: true,
          // 保存原始数据用于可能的取消操作
          originalData: { ...row },
        });
      }
    },
    handleCancel(row, index) {
      this.$set(this.userList, index, row.originalData);
    },
    calculateTotal(row) {
      return (
        (row.authenticity || 0) +
        (row.weekFinish || 0) +
        (row.standard || 0) +
        (row.timeliness || 0) +
        (row.library || 0) +
        (row.environment || 0) +
        (row.doctorSatisfaction || 0) +
        (row.nurseSatisfaction || 0)
      );
    },
  methods: {},
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.userId != undefined) {
            updatesatisfaction(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const userIds = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除用户编号为"' + row.patName + '"的数据项?')
        .then(function () {
          return delsatisfaction(userIds);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "smartor/satisfaction/export",
        {
          ...this.topqueryParams,
        },
        `user_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.el-button--primary.is-plain {
  color: #ffffff;
  background: #409eff;
  border-color: #4fabe9;
}
.document {
  width: 100px;
  height: 50px;
}
.documentf {
  display: flex;
  justify-content: flex-end;
}
.download {
  text-align: center;
  .el-upload__tip {
    font-size: 23px;
  }
  .el-upload__text {
    font-size: 23px;
  }
}
.uploading {
  margin-top: 20px;
  margin: 20px;
  padding: 30px;
  background: #ffffff;
  border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
}
.el-tag + .el-tag {
  margin-left: 10px;
}
.button-new-tag {
  margin-left: 10px;
  height: 32px;
  line-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}
.input-new-tag {
  width: 90px;
  margin-left: 10px;
  vertical-align: bottom;
}
.drexamine {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: #daeaf5;
  img {
    width: 100px;
    height: 100px;
  }
}
.qrcode-dialo {
  // text-align: center;
  //   display: flex;
  margin: 20px;
  padding: 30px;
  background: #edf1f7;
  border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
  .topic-dev {
    margin-bottom: 25px;
    font-size: 20px !important;
    .dev-text {
      margin-bottom: 10px;
    }
  }
}
.button-bb {
  font-weight: 500;
  color: #2ba05c;
}
.button-xq {
  font-weight: 500;
  color: #409eff;
}
.button-sc {
  font-weight: 500;
  color: #dd302a;
}
// .button-zx {
//   background: #e94f4f;
//   padding: 5px;
//   border-radius: 1px;
//   color: #ffffff;
// }
.el-table .cell .el-input-number {
  width: 100%;
}
/* 按钮样式 */
.button-zx {
  color: #f56c6c;
}
.button-textxga {
  color: #409eff;
}
::v-deep.el-radio-group {
  span {
    font-size: 24px;
  }
}
::v-deep.el-checkbox-group {
  span {
    font-size: 24px;
  }
}
</style>