lkk
2024-12-16 c7b33db117fd2893d7d1c93bf5d46e87d33e44d0
src/views/reservation/groupcheck/index.vue
@@ -64,29 +64,16 @@
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8" style="margin: 5px 20px">
      <el-col :span="1.5">
    <el-row :gutter="20" style="margin: 5px 20px">
      <el-col :span="12" style="margin-left: 50%">
        <el-button
          type="primary"
          class="btn"
          icon="el-icon-thumb"
          :disabled="isdisabled"
          size="mini"
          @click="submitForm"
          @click="submitforms"
        >
          批量签到</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          class="btn"
          icon="el-icon-thumb"
          :disabled="isdisabled"
          size="mini"
          @click="submitForm"
        >
          批量打印导检单</el-button
        >
      </el-col>
    </el-row>
@@ -99,6 +86,7 @@
            :data="userList"
            @selection-change="handleSelectionChange"
            border
            height="490"
          >
            <el-table-column
              type="selection"
@@ -195,62 +183,147 @@
            <el-table-column label="分组" align="center" prop="groupingName" />
            <el-table-column label="项目收费" align="center" prop="ysPrice" />
          </el-table>
          <div class="pag">
      <div class="pag1">
        <pagination v-show="total > 0" :total="total" :page.sync="objs.page"
          :limit.sync="objs.pageSize" @pagination="handleQuery" />
      </div>
    </div>
          <!-- <div class="pag">
            <div class="pag1">
              <pagination
                v-show="total > 0"
                :total="total"
                :page.sync="objs.page"
                :limit.sync="objs.pageSize"
                @pagination="handleQuery"
              />
            </div>
          </div> -->
        </div>
      </el-col>
      <el-col :span="12">
        <el-table
            :data="selectList"
            border
      <el-col :span="12">
        <el-table :data="selectList" border height="490">
          <el-table-column
            label="单位名称"
            align="center"
            prop="company"
            width="200"
          />
          <el-table-column
            label="工号"
            align="center"
            prop="jobNo"
            width="80"
          />
          <el-table-column label="姓名" align="center" prop="name" width="75" />
          <el-table-column label="性别" align="center" prop="sex" width="75">
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.sys_user_sex"
                :value="scope.row.sex"
              />
            </template>
          </el-table-column>
          <el-table-column
            label="身份证号"
            align="center"
            prop="idCard"
            width="200"
          />
          <el-table-column label="年龄" align="center" prop="age" width="75" />
          <el-table-column
            label="出生日期"
            align="center"
            prop="birthday"
            width="100"
          />
          <el-table-column label="职位" align="center" prop="position" />
          <el-table-column label="部门" align="center" prop="department" />
          <el-table-column
            label="部门编号"
            align="center"
            prop="departmentId"
          />
          <el-table-column
            label="联系电话"
            align="center"
            prop="phoe"
            width="120"
          />
          <el-table-column label="地址" align="center" prop="address" />
          <el-table-column
            label="婚姻状况"
            align="center"
            prop="marriage"
            key="marriage"
          >
            <el-table-column
              label="工号"
              align="center"
              prop="jobNo"
              width="80"
            />
            <el-table-column
              label="姓名"
              align="center"
              prop="name"
              width="75"
            />
            <el-table-column label="性别" align="center" prop="sex" width="75">
              <template slot-scope="scope">
                <dict-tag
                  :options="dict.type.sys_user_sex"
                  :value="scope.row.sex"
                />
              </template>
            </el-table-column>
            <el-table-column
              label="身份证号"
              align="center"
              prop="idCard"
              width="200"
            />
            <el-table-column
              label="联系电话"
              align="center"
              prop="phoe"
              width="120"
            />
            <el-table-column label="分组" align="center" prop="groupingName" />
            <el-table-column label="项目收费" align="center" prop="ysPrice" />
            <el-table-column fixed="right" label="操作" align="center" width="90px" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
            title="删除"></el-button>
        </template>
      </el-table-column>
          </el-table>
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.dict_user_marry"
                :value="scope.row.marriage"
              />
            </template>
          </el-table-column>
          <el-table-column
            label="民族"
            align="center"
            prop="nation"
            key="nation"
          >
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.dict_user_national"
                :value="scope.row.nation"
              />
            </template>
          </el-table-column>
          <el-table-column label="联系邮箱" align="center" prop="email" />
          <!-- <el-table-column label="体检类别" align="center" prop="tjCategory" /> -->
          <el-table-column label="分组" align="center" prop="groupingName" />
          <el-table-column label="项目收费" align="center" prop="ysPrice" />
          <el-table-column
            fixed="right"
            label="操作"
            align="center"
            width="90px"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                title="删除"
              ></el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
    </el-row>
    <el-dialog
      :title="title"
      :visible.sync="open2"
      width="800px"
      append-to-body
    >
      <el-form ref="form" :model="forms" label-width="100px" :inline="true">
        <el-form-item label="体检类别">
          <el-select
            style="width: 150px"
            v-model="forms.tjCategory"
            placeholder="请选择体检类别"
          >
            <el-option
              v-for="dict in dict.type.dict_tjtype"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer2">
        <el-button type="primary" @click="submitType">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 添加或修改体检单位信息维护对话框 -->
    <div class="dia">
@@ -352,6 +425,20 @@
        </div>
      </el-dialog>
    </div>
    <el-dialog
      title="PDF 预览"
      :visible.sync="dialogVisible"
      :close-on-click-modal="false"
    >
      <div class="main">
        <iframe
          id="printIframe"
          :src="url"
          frameborder="0"
          style="width: 100%; height: 100%"
        ></iframe>
      </div>
    </el-dialog>
  </div>
</template>
  
@@ -359,9 +446,10 @@
import {
  addDept,
  addComp,
  Deptlist,getCusTomterListByCompId
  addPlOrderAndDetail,
  getCusTomterListByCompId,
} from "@/api/system/comp";
import {  getCompany, queryCompany } from "@/api/team/tuanti";
import { getCompany, queryCompany } from "@/api/team/tuanti";
export default {
  dicts: [
@@ -369,6 +457,7 @@
    "dict_user_marry",
    "sys_yes_no",
    "sys_user_sex",
    "dict_tjtype",
    "reservation_pay_type",
    "sys_normal_disable",
  ],
@@ -396,7 +485,7 @@
        },
      },
      CompanyList: [],
      selectList:[],
      selectList: [],
      tableData: [], // 表数据
      form: {
        company: "",
@@ -407,8 +496,10 @@
        discount: "",
      },
      size: "",
      url: "",
      // 套餐提交按钮
      confirm: false,
      dialogVisible: false,
      deptList: [],
      data: {
        dwId: "",
@@ -420,8 +511,6 @@
        compId: null,
        name: null,
        reservationTime: null,
        page:1,
        pageSize:10
      },
      // 非单个禁用
      single: true,
@@ -429,7 +518,7 @@
      multiple: true,
      // 用户表格数据
      userList: null,
      userList: [],
      // 查询参数
      queryParam: {
@@ -437,7 +526,7 @@
        pageSize: 10,
      },
      // 表单参数
      form: {},
      forms: {},
      // 表单校验
      rules: {
@@ -545,6 +634,7 @@
      // 是否显示弹出层
      open: false,
      open1: false,
      open2: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
@@ -570,10 +660,11 @@
  },
  methods: {
    handleQuery() {
      getCusTomterListByCompId(this.objs).then(res => {
        this.userList = res.data.records
        this.total = res.data.total
      })
      this.loading = true;
      getCusTomterListByCompId(this.objs).then((res) => {
        this.userList = res.data;
        this.loading = false;
      });
    },
    // 保存部门
    handleAddDept() {
@@ -599,18 +690,109 @@
    //     });
    //   }
    // },
      // 多选框选中数据
      handleSelectionChange(selection) {
        console.log(selection)
    // 多选框选中数据
    handleSelectionChange(selection) {
      selection.forEach((item) => {
        this.selectList.push(item);
        this.userList.forEach((item1, index) => {
          if (item.idCard == item1.idCard) {
            this.userList.splice(index, selection.length);
          }
        });
      });
      for (var i = 0; i < this.selectList.length; i++) {
        // 首次遍历数组
        for (var j = i + 1; j < this.selectList.length; j++) {
          // 再次遍历数组
          if (this.selectList[i].idCard == this.selectList[j].idCard) {
            // 判断连个值是否相等
            this.selectList.splice(j, 1); // 相等删除后者
            j--;
          }
        }
      }
      return this.selectList;
      // console.log(this.selectList);
      // this.ids = selection.map((item) => item.cusId);
      // this.single = selection.length !== 1;
      // this.multiple = !selection.length;
    },
    handleDelete(row){
    handleDelete(row) {
      this.selectList.forEach((item, index) => {
        if (item == row) {
          this.selectList.splice(index, 1);
        }
      });
      this.userList.push(row);
    },
    submitforms() {
      this.open2 = true;
    },
    base64ToBlob({ b64data = "", contentType = "", sliceSize = 512 } = {}) {
      return new Promise((resolve, reject) => {
        // 使用 atob() 方法将数据解码
        let byteCharacters = atob(b64data);
        let byteArrays = [];
        for (
          let offset = 0;
          offset < byteCharacters.length;
          offset += sliceSize
        ) {
          let slice = byteCharacters.slice(offset, offset + sliceSize);
          let byteNumbers = [];
          for (let i = 0; i < slice.length; i++) {
            byteNumbers.push(slice.charCodeAt(i));
          }
          // 8 位无符号整数值的类型化数组。内容将初始化为 0。
          // 如果无法分配请求数目的字节,则将引发异常。
          byteArrays.push(new Uint8Array(byteNumbers));
        }
        let result = new Blob(byteArrays, {
          type: contentType,
        });
        result = Object.assign(result, {
          // jartto: 这里一定要处理一下 URL.createObjectURL
          preview: URL.createObjectURL(result),
          // name: `图片示例.png`,
        });
        resolve(result);
      });
    },
    submitType() {
      let cusIds = [];
      this.selectList.forEach((item) => {
        cusIds.push(item.idCard);
      });
      let data = {
        cusIds: cusIds,
        tjCategory: this.forms.tjCategory,
      };
      addPlOrderAndDetail(data).then((res) => {
        this.open2 = false;
        this.$modal.msgSuccess("签到成功");
        let base64 = res.file;
        this.base64ToBlob({
          b64data: base64,
          contentType: "application/pdf",
        }).then((res) => {
          this.dialogVisible = true;
          // 转后后的blob对象
          console.log("blob", res.preview);
         try {
          this.url =res.preview;
         } catch (error) {
          this.url = window.webkitURL.createObjectURL(res.preview);
         }
                });
        this.handleQuery();
        this.selectList = [];
      });
    },
    // 搜索
    getRemoteData(query) {
      if (query) {
@@ -636,6 +818,7 @@
    cancel() {
      this.open = false;
      this.open1 = false;
      this.open2 = false;
      this.reset();
    },
    /** 新增按钮操作 */
@@ -678,9 +861,11 @@
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.objs.drugManufacturerId = "";
      this.objs.dwDeptName = "";
      this.objs.compId = "";
      this.objs.name = "";
      this.objs.reservationTime = "";
      this.userList = [];
      this.selectList = [];
      this.form = {};
    },
@@ -688,16 +873,18 @@
    selectTime(val) {
      this.objs.reservationTime = val;
    },
    /** 确认按钮 */
    submitForm() {},
    doPrint(val) {
      var ordonnance = document.getElementById(val).contentWindow;
      setTimeout(() => {
        ordonnance.print();
      }, 100);
    },
  },
};
</script>
  
  
  <style>
.pag {
  width: 100%;
  display: flex;
@@ -725,9 +912,14 @@
  display: flex;
}
.main {
  height: 700px;
  overflow: hidden;
}
.dialog-footer2 {
  width: 960px;
  height: 36px;
  /* width: 960px;
  height: 36px; */
  display: flex;
  justify-content: center;
}