1
wwl
1 天以前 5017033ae6120a4fbf9d60f5c0e4c963799c0e54
1
1个文件已修改
2个文件已添加
709 ■■■■ 已修改文件
public/yuanqu.ini 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login copy.vue 392 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/tijian/index.vue 288 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/yuanqu.ini
New file
@@ -0,0 +1,29 @@
[development]
8094=pbkwyy
81=jdczgzyy
8095=jdczgzyy
8096=sqyy
8097=wbzxyy
8098=bjxjyy
8099=bjfhyy
8100=ssyjyy
8101=bjsqyy
[staging]
9013=pbkwyy
9014=jdczgzyy
9015=sqyy
9016=wbzxyy
9017=bjxjyy
9018=ssyjyy
9019=bjsqyy
[production]
8094=pbkwyy
8095=jdczgzyy
8096=sqyy
8097=wbzxyy
8098=bjxjyy
8099=bjfhyy
8100=ssyjyy
8101=bjsqyy
src/views/login copy.vue
New file
@@ -0,0 +1,392 @@
<template>
  <div class="login">
    <!-- <div style="padding-top: 130px;"> -->
    <div style="font-weight: 700;font-size: 50px;">智能健康体检管理系统</div>
    <!-- </div> -->
    <el-form :inline="true" ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
      <div class="img">
        <img class="image" src="../assets/images/ewm.png" alt="" />
      </div>
      <div class="card">
        <!-- <h3 class="title">路泰科技后台管理系统</h3> -->
        <el-form-item>
          <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号/手机号码/体检号"
            @keyup.enter.native="jumpInput">
            <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" @click="hide"
              @keyup.enter.native="jumpInput" />
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-input v-model="loginForm.password" :type="type" auto-complete="off" placeholder="密码" ref="barcodeMsg"
            @keyup.enter.native="handleLogin">
            <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
            <i slot="suffix" class="icon-style" :class="elIcon" autocomplete="auto" @click="flag = !flag" /></el-input>
          <!-- <img :src="openeye" class="show_hid" @click="changetype" > -->
        </el-form-item>
        <el-form-item prop="code" v-if="captchaEnabled">
          <el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
            @keyup.enter.native="handleLogin">
            <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
          </el-input>
          <div class="login-code">
            <img :src="codeUrl" @click="getCode" class="login-code-img" />
          </div>
        </el-form-item>
        <el-checkbox v-model="loginForm.rememberMe" style="margin:10px 0px 40px 0px;">记住密码</el-checkbox>
        <!-- <el-form-item style="margin-left:10px"  prop="mobile">
        <el-radio-group v-model="loginForm.mobile">
          <el-radio :label="true">员工登录</el-radio>
          <el-radio :label="false">用户登录</el-radio>
        </el-radio-group>
      </el-form-item> -->
        <el-form-item style="width:100%;">
          <el-button :loading="loading" size="medium" type="primary" style="width:310px;" @keyup.enter="keyDown(e)"
            @click.native.prevent="handleLogin">
            <span v-if="!loading">登 录</span>
            <span v-else>登 录 中...</span>
          </el-button>
          <div style="float: right;" v-if="register">
            <router-link class="link-type" :to="'/register'">立即注册</router-link>
          </div>
        </el-form-item>
      </div>
    </el-form>
    <!--  底部  -->
    <div class="el-login-footer">
      <span>Copyright © 2024-2025 All Rights Reserved.</span>
      <!-- <span>Copyright © 2022-2023龙美网络 All Rights Reserved.</span> -->
    </div>
  </div>
</template>
<script>
import { getCodeImg, getconfigKey } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
import ini from 'ini';
import fs from 'fs'; // Node.js 文件系统模块
export default {
  name: "Login",
  data() {
    return {
      codeUrl: "",
      loginForm: {
        username: "",
        password: "",
        mobile: false,
        hospId: "",
        // username:"13800138008",
        // password:"888888",
        rememberMe: false,
        code: "",
        uuid: "",
        // type: false,
      },
      loginRules: {
        username: [
          { required: true, trigger: "blur", message: "" }
        ],
        password: [
          { required: true, trigger: "blur", message: "" }
        ],
        code: [{ required: true, trigger: "change", message: "" }],
        mobile: [
          { required: true, trigger: "change", message: "" }
        ]
      },
      pwdtype: 'password',
      openeye: require('../assets/images/by.png'),
      flag: false,
      loading: false,
      configKey: "captcha_switch",
      // // 验证码开关
      captchaEnabled: true,
      // 注册开关
      register: false,
      redirect: undefined
    };
  },
  computed: {
    type() {
      return this.flag ? "text" : "password";
    },
    elIcon() {
      return this.flag ? "el-icon-minus" : "el-icon-view";
    }
  },
  mounted() {
    // 绑定监听事件
    window.addEventListener("keydown", this.keyDown);
  },
  destroyed() {
    // 销毁事件
    window.removeEventListener("keydown", this.keyDown, false);
  },
  watch: {
    $route: {
      handler: function (route) {
        this.redirect = route.query && route.query.redirect;
      },
      immediate: true
    }
  },
  created() {
    this.getstate();
    this.getCookie();
    this.loadAll();
  },
  methods: {
    getstate() {
      getconfigKey().then(res => {
        if (res.msg == "Y") {
          this.captchaEnabled = true
          this.getCode();
        } else if (res.msg == "N") {
          this.captchaEnabled = false
        }
      })
    },
    loadAll() {
      const env = process.env.VUE_APP_ENV;
      const port = window.location.port;
      // yuanqu.ini加载hospId
      fetch('/yuanqu.ini')
        .then(response => {
          if (!response.ok) {
            throw new Error('Failed to fetch config.ini');
          }
          return response.text();
        })
        .then(text => {
          const config = ini.parse(text);
          if (config[env] && config[env][port]) {
            this.loginForm.hospId = config[env][port];
            Cookies.set("hospId", this.loginForm.hospId);
          } else {
            console.error(`No hospId found for environment ${env} and port ${port}`);
            this.$message.error(`配置错误:未找到环境 ${env} 和端口 ${port} 对应的医院ID`);
          }
        })
        .catch(error => {
          console.error('Error fetching or parsing config.ini:', error);
          this.$message.error('无法加载配置文件,请联系管理员');
        });
    },
    hide() {
      // this.loginForm.username = "10001";
      // this.loginForm.password = "admin123";
    },
    changetype() {
      this.pwdtype = this.pwdtype === 'password' ? 'text' : 'password'
      this.openeye = this.openeye === require('../assets/images/by.png') ? require('../assets/images/zy.png') : require('../assets/images/by.png')
    },
    getCode() {
      getCodeImg().then(res => {
        this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
        if (this.captchaEnabled) {
          this.codeUrl = "data:image/gif;base64," + res.img;
          this.loginForm.uuid = res.uuid;
        }
      });
    },
    getCookie() {
      const username = Cookies.get("username");
      const password = Cookies.get("password");
      const rememberMe = Cookies.get('rememberMe')
      this.loginForm = {
        username: username === undefined ? this.loginForm.username : username,
        password: password === undefined ? this.loginForm.password : decrypt(password),
        rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
      };
    },
    jumpInput() {
      if (this.loginForm.password) {
        this.handleLogin(); // 定义的登录方法
      } else {
        this.$refs.barcodeMsg.focus(); // 自动获取焦点
      }
    },
    handleLogin() {
      if (this.loginForm.username.length < 12) {
        this.loginForm.mobile = true;
        this.$router.push({ path: this.redirect || "/" }).catch(() => { });
      } else {
        this.$router.push({ path: this.redirect || "/404" }).catch(() => { });
        this.loginForm.mobile = false;
      }
      this.$refs.loginForm.validate(valid => {
        if (valid) {
          this.loading = true;
          if (this.loginForm.rememberMe) {
            Cookies.set("username", this.loginForm.username, { expires: 30 });
            Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
            Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
          } else {
            Cookies.remove("username");
            Cookies.remove("password");
            Cookies.remove('rememberMe');
          }
          this.$store.dispatch("Login", this.loginForm).then((res) => {
            if (res.msg == "该账号正在使用中") {
              this.$confirm('该账号正在使用中,是否强制登陆?', '温馨提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                this.loginForm.type = true
                this.$store.dispatch("Login", this.loginForm).then((res) => {
                  this.$router.push({ path: this.redirect || "/" }).catch(() => { });
                })
              }).catch(() => {
                this.loading = false;
              });
            } else {
              const securitMessage = JSON.parse(localStorage.getItem("securitMessage"));
              if (securitMessage) {
                if (securitMessage != null) {
                  this.$message({
                    message: securitMessage,
                    type: 'success'
                  });
                  localStorage.removeItem("securitMessage");
                }
              }
              this.$router.push({ path: this.redirect || "/" }).catch(() => { });
              location.reload();
            }
          }).catch(() => {
            this.loading = false;
            if (this.captchaEnabled) {
              this.getCode();
            }
          });
        }
      });
    }
  }
};
</script>
<style rel="stylesheet/scss" lang="scss">
.login {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  height: 100%;
  // background-image: url("../assets/images/login-background.jpg");
  background-size: cover;
  flex-direction: column;
  margin-top: 170px;
}
.card {
  width: 519px;
  padding-left: 100px;
  border-left: 1px solid #ededed;
  display: flex;
  flex-direction: column;
  // margin-left: 100px;
}
.show_hid {
  width: 25px;
  height: 25px;
}
.img {
  width: 506px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.image {
  width: 200px;
  height: 200px;
}
.title {
  margin: 0px auto 30px auto;
  text-align: center;
  color: #707070;
}
.login-form {
  border-radius: 6px;
  background: #ffffff;
  width: 90%;
  padding: 25px 25px 5px 25px;
  // margin-left: 800px;
  margin-top: 100px;
  display: flex;
  justify-content: space-around;
  // justify-content: space-evenly;
  .el-input {
    height: 38px;
    input {
      width: 300px;
      height: 38px;
    }
  }
  .input-icon {
    height: 39px;
    width: 14px;
    margin-left: 2px;
  }
}
.login-tip {
  font-size: 13px;
  text-align: center;
  color: #bfbfbf;
}
.login-code {
  width: 33%;
  height: 38px;
  margin-top: 5px;
  // float: right;
  img {
    cursor: pointer;
    vertical-align: middle;
  }
}
.el-login-footer {
  height: 40px;
  line-height: 40px;
  position: fixed;
  bottom: 0;
  width: 100%;
  text-align: center;
  color: black;
  font-family: Arial;
  font-size: 12px;
  letter-spacing: 1px;
}
.login-code-img {
  height: 38px;
}
</style>
src/views/system/tijian/index.vue
@@ -427,7 +427,7 @@
            <el-form-item label="姓名" prop="pacName">
              <el-input v-model="queryParam.pacName" placeholder="请输入姓名" clearable @keyup.enter.native="handle" />
            </el-form-item>
             <el-form-item label="身份证" prop="pacName">
            <el-form-item label="身份证" prop="pacName">
              <el-input v-model="queryParam.pacName" placeholder="请输入身份证" clearable @keyup.enter.native="handle" />
            </el-form-item>
            <el-form-item>
@@ -952,7 +952,7 @@
      // 显示搜索条件
      showSearch: true,
      tjtype: false,
      sftj:null,
      sftj: null,
      activeNames: "first",
      // 树状形状
      Treedata: [],
@@ -984,12 +984,10 @@
        pacName: null,
        pacRemark: null,
      },
      // valueUrl: "ws://127.0.0.1:18890",
      // valueUrl: "ws://192.168.1.3:6789/websocket",
      valueUrl: "ws://127.0.0.1:6789/websocket",
      valueUrls: "ws://127.0.0.1:6789/websocket",
      // valueUrls: "ws://"+getIp() +":6789/websocket",
      // valueUrl: "ws://127.0.0.1:6789/websocket",
      // valueUrls: "ws://127.0.0.1:6789/websocket",
      valueUrl: "ws://192.168.1.244:6789/websocket",
      valueUrls: "ws://192.168.1.244:6789/websocket",
      webSocket: null,
      // 身份证需要
      // socket: null,
@@ -1742,57 +1740,57 @@
    },
    /** 登记提交按钮 */
    /** 登记提交按钮 */
  submitForm() {
  let _this = this;
  if (!this.form.cusPhone || !this.form.cusName) {
    this.$message.warning("请填选必填项");
    return;
  }
  this.$refs["form"].validate((valid) => {
    if (valid) {
      // 创建表单数据的副本并去除空格
      const formData = { ...this.form };
      formData.cusName = formData.cusName ? formData.cusName.replace(/\s/g, '') : '';
      formData.cusPhone = formData.cusPhone ? formData.cusPhone.replace(/\s/g, '') : '';
      formData.cusIdcard = formData.cusIdcard ? formData.cusIdcard.replace(/\s/g, '') : '';
      // 添加 sfzImg 字段
      formData.sfzImg = this.imageUrl || ''; // 使用 base64 格式的头像数据,若为空则传空字符串
      // 处理性别值
      if (formData.cusSex === "女") {
        formData.cusSex = 1;
      }
      if (formData.cusSex === "男") {
        formData.cusSex = 0;
      }
      if (formData.cusSex === "未知") {
        formData.cusSex = 2;
      }
      if (formData.tjType === "") {
        formData.tjType = this.dict.type.dict_team[0].value;
    submitForm() {
      let _this = this;
      if (!this.form.cusPhone || !this.form.cusName) {
        this.$message.warning("请填选必填项");
        return;
      }
      // 可选:检查 sfzImg 是否存在
      // if (!formData.sfzImg) {
      //   this.$message.warning("请先获取身份证头像");
      //   return;
      // }
      this.$refs["form"].validate((valid) => {
        if (valid) {
          // 创建表单数据的副本并去除空格
          const formData = { ...this.form };
          formData.cusName = formData.cusName ? formData.cusName.replace(/\s/g, '') : '';
          formData.cusPhone = formData.cusPhone ? formData.cusPhone.replace(/\s/g, '') : '';
          formData.cusIdcard = formData.cusIdcard ? formData.cusIdcard.replace(/\s/g, '') : '';
          // 添加 sfzImg 字段
          formData.sfzImg = this.imageUrl || ''; // 使用 base64 格式的头像数据,若为空则传空字符串
      addCustomer(formData).then((response) => {
        this.responseList = response.data;
        this.form.tjType = this.dict.type.dict_team[0].value;
        this.$modal.msgSuccess("新增成功");
        _this.tcShow = true;
        _this.isDisabled = true;
        _this.top = false;
      }).catch((error) => {
        this.$modal.msgError("登记失败,请检查数据");
        console.error("Error in addCustomer:", error);
          // 处理性别值
          if (formData.cusSex === "女") {
            formData.cusSex = 1;
          }
          if (formData.cusSex === "男") {
            formData.cusSex = 0;
          }
          if (formData.cusSex === "未知") {
            formData.cusSex = 2;
          }
          if (formData.tjType === "") {
            formData.tjType = this.dict.type.dict_team[0].value;
          }
          // 可选:检查 sfzImg 是否存在
          // if (!formData.sfzImg) {
          //   this.$message.warning("请先获取身份证头像");
          //   return;
          // }
          addCustomer(formData).then((response) => {
            this.responseList = response.data;
            this.form.tjType = this.dict.type.dict_team[0].value;
            this.$modal.msgSuccess("新增成功");
            _this.tcShow = true;
            _this.isDisabled = true;
            _this.top = false;
          }).catch((error) => {
            this.$modal.msgError("登记失败,请检查数据");
            console.error("Error in addCustomer:", error);
          });
        }
      });
    }
  });
},
    },
    getmailType() {
      if (this.getType == "2") {
@@ -2978,7 +2976,7 @@
    // 处理订单项目
    processOrderItems(cusId) {
      getTransitionList1(cusId).then((response) => {
       this.tableData1 = response.data;
        this.tableData1 = response.data;
        // if (response.data.tjCategory != null) {
        //   this.tjCategory = response.data.tjCategory;
        // }
@@ -3288,100 +3286,100 @@
    },
    // 最后提交按钮
  submitPrice() {
  let _this = this;
  this.loadingSubmit = true;
  if (_this.tjCategory !== "") {
    let List = _this.tableData1; // 单个项目信息
    if (this.responseList.cusId) {
      var userId = this.responseList.cusId;
    } else {
      var userId = _this.form.cusId;
    }
    let tjType = _this.form.tjType;
    if (this.tableData[0]) {
      var pacId = this.tableData[0].pacId;
    }
    // tjOrderList 处理
    List.forEach((item) => {
      if (item.list) {
        item.list.forEach((item1) => {
          this.tjOrderList.push({
            proName: item1.proName,
            proPrice: item1.nowPrice,
            proId: item1.proId,
          });
        });
      } else if (item.tjProjectList) {
        item.tjProjectList.forEach((item1) => {
          this.tjOrderList.push({
            proName: item1.proName,
            proPrice: item1.priceNow,
            proId: item1.proId,
          });
        });
      } else {
        this.tjOrderList.push({
          proName: item.proName,
          proPrice: item.ysPrice,
          proId: item.proId,
        });
      }
    });
    let copeWith = this.TotalPrice1;
    let paidIn = this.TotalPrice.toString();
    let discount = this.discount;
    this.tjFlowingWater = { copeWith, paidIn, discount };
    const newArray = this.tableData1
      .filter((item) => item.discount < 10)
      .map((item) => ({
        discount: item.discount,
        parentProId: item.parentProId,
        cusIdCard: item.cusId,
        yhj: item.nowPrice,
      }));
    gaibianzhekou(newArray).then((res) => {
      this.loadingSubmit = false;
      if (res.code === 200) {
        let data;
        if (pacId || this.tjOrderList.length > 0) {
          data = {
            photo: this.srcUrl, // 保留原有 photo 字段(如果后端仍需要)
            sfzImg: this.imageUrl, // 添加 sfzImg 字段,优先使用服务器URL,若无则使用base64
            pacId,
            tjOrderList: this.tjOrderList,
            tjFlowingWater: this.tjFlowingWater,
            userId,
            tjType,
            tjCategory: this.tjCategory,
            firmId: this.form.firmId,
            firmName: this.form.firmName,
            firmDeptName: this.form.firmDeptName,
          };
          this.listgetOrder(data);
    submitPrice() {
      let _this = this;
      this.loadingSubmit = true;
      if (_this.tjCategory !== "") {
        let List = _this.tableData1; // 单个项目信息
        if (this.responseList.cusId) {
          var userId = this.responseList.cusId;
        } else {
          this.loadingSubmit = false;
          this.$message({
            type: "warning",
            message: "请选择套餐!",
          });
          var userId = _this.form.cusId;
        }
        let tjType = _this.form.tjType;
        if (this.tableData[0]) {
          var pacId = this.tableData[0].pacId;
        }
        // tjOrderList 处理
        List.forEach((item) => {
          if (item.list) {
            item.list.forEach((item1) => {
              this.tjOrderList.push({
                proName: item1.proName,
                proPrice: item1.nowPrice,
                proId: item1.proId,
              });
            });
          } else if (item.tjProjectList) {
            item.tjProjectList.forEach((item1) => {
              this.tjOrderList.push({
                proName: item1.proName,
                proPrice: item1.priceNow,
                proId: item1.proId,
              });
            });
          } else {
            this.tjOrderList.push({
              proName: item.proName,
              proPrice: item.ysPrice,
              proId: item.proId,
            });
          }
        });
        let copeWith = this.TotalPrice1;
        let paidIn = this.TotalPrice.toString();
        let discount = this.discount;
        this.tjFlowingWater = { copeWith, paidIn, discount };
        const newArray = this.tableData1
          .filter((item) => item.discount < 10)
          .map((item) => ({
            discount: item.discount,
            parentProId: item.parentProId,
            cusIdCard: item.cusId,
            yhj: item.nowPrice,
          }));
        gaibianzhekou(newArray).then((res) => {
          this.loadingSubmit = false;
          if (res.code === 200) {
            let data;
            if (pacId || this.tjOrderList.length > 0) {
              data = {
                photo: this.srcUrl, // 保留原有 photo 字段(如果后端仍需要)
                sfzImg: this.imageUrl, // 添加 sfzImg 字段,优先使用服务器URL,若无则使用base64
                pacId,
                tjOrderList: this.tjOrderList,
                tjFlowingWater: this.tjFlowingWater,
                userId,
                tjType,
                tjCategory: this.tjCategory,
                firmId: this.form.firmId,
                firmName: this.form.firmName,
                firmDeptName: this.form.firmDeptName,
              };
              this.listgetOrder(data);
            } else {
              this.loadingSubmit = false;
              this.$message({
                type: "warning",
                message: "请选择套餐!",
              });
            }
          } else {
            this.loadingSubmit = false;
            this.$modal.msgError("改变折扣错误");
          }
        });
      } else {
        this.loadingSubmit = false;
        this.$modal.msgError("改变折扣错误");
        this.$modal.msgError("请选择体检类别");
      }
    });
  } else {
    this.loadingSubmit = false;
    this.$modal.msgError("请选择体检类别");
  }
},
    },
  },
};
</script>