| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form |
| | | :model="queryParams" |
| | | ref="queryForm" |
| | | size="small" |
| | | :inline="true" |
| | | v-show="showSearch" |
| | | label-width="68px" |
| | | > |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form-item label="体检号" prop="tjNumber"> |
| | | <el-input |
| | | ref="inputName" |
| | | v-model="queryParams.tjNumber" |
| | | placeholder="请输入体检号" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | @blur="hb" |
| | | style="width: 170px" |
| | | /> |
| | | <el-input ref="inputName" v-model="queryParams.tjNumber" placeholder="请输入体检号" clearable |
| | | @keyup.enter.native="handleQuery" @blur="hb" style="width: 170px" /> |
| | | </el-form-item> |
| | | <el-form-item label="姓名" prop="name"> |
| | | <el-input |
| | | v-model="queryParams.name" |
| | | placeholder="请输入姓名" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | style="width: 110px" |
| | | /> |
| | | <el-input v-model="queryParams.name" placeholder="请输入姓名" clearable @keyup.enter.native="handleQuery" |
| | | style="width: 110px" /> |
| | | </el-form-item> |
| | | <el-form-item label="申请时间" prop="applicationTime"> |
| | | <el-date-picker |
| | | v-model="createTimeList" |
| | | @change="dateChangebirthday1" |
| | | :default-time="['00:00:00', '23:00:00']" |
| | | format="yyyy-MM-dd HH:mm:ss" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | :picker-options="pickerOptions" |
| | | ></el-date-picker> |
| | | <el-date-picker v-model="createTimeList" @change="dateChangebirthday1" :default-time="['00:00:00', '23:00:00']" |
| | | format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" range-separator="-" |
| | | start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="单位名称" prop="compName" style="margin-left: 20px; margin-right: 500px"> |
| | | <el-select :remote-method="getRemoteData" v-model="queryParams.tjCompName" value-key="drugManufacturerId" |
| | | style="width: 200px" remote filterable placeholder="请选择单位名称" clearable @change="searchSelect"> |
| | | <el-option v-for="dict in CompanyList" :key="dict.drugManufacturerId" :label="dict.cnName" :value="dict" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="是否采样" prop="isSignFor"> |
| | | <el-select style="width:100px" v-model="queryParams.isSignFor" placeholder="是否采样"> |
| | | <el-select1 style="width:100px" v-model="queryParams.isSignFor" placeholder="是否采样"> |
| | | <el-option v-for="dict in dict.type.sampling_type" :key="dict.value" :label="dict.label" |
| | | :value="dict.value"></el-option> |
| | | </el-select> |
| | | </el-select1> |
| | | </el-form-item> --> |
| | | <!-- <el-form-item label="体检时间" prop="tjTime"> |
| | | <el-date-picker clearable v-model="queryParams.tjTime" type="date" value-format="yyyy-MM-dd" |
| | |
| | | <el-input v-model="queryParams.proName" placeholder="请输入项目名称" clearable @keyup.enter.native="handleQuery" style="width: 140px;"/> |
| | | </el-form-item> --> |
| | | <el-form-item> |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-search" |
| | | size="mini" |
| | | @click="handleQuery" |
| | | >查询</el-button |
| | | > |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button> |
| | | <!-- <el-button |
| | | type="primary" |
| | | icon="el-icon-thumb" |
| | |
| | | @click="Confirmreceipt" |
| | | >确认采样</el-button |
| | | > --> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" |
| | | >重置</el-button |
| | | > |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="10"> |
| | | <el-radio-group |
| | | v-model="tjStatus" |
| | | @input="radioChange" |
| | | style="margin: 10px 15px" |
| | | > |
| | | <el-radio-group v-model="tjStatus" @input="radioChange" style="margin: 10px 15px"> |
| | | <el-radio-button label="1" :disabled="qiehuan && disabledId === 0">未采样</el-radio-button> |
| | | <el-radio-button label="0" :disabled="qiehuan && disabledId === 1">已采样</el-radio-button> |
| | | </el-radio-group> |
| | | </el-col> |
| | | <el-col |
| | | :span="12" |
| | | style="margin: 10px 15px" |
| | | v-if="samplingList.length > 0 && tjStatus == 1" |
| | | > |
| | | <el-col :span="12" style="margin: 10px 15px" v-if="samplingList.length > 0 && tjStatus == 1"> |
| | | <el-button type="primary" @click="Merging">合并项目</el-button> |
| | | <!-- <el-button |
| | | type="primary" |
| | |
| | | @click="Confirmreceipt" |
| | | >确认采样</el-button |
| | | > --> |
| | | <el-button type="primary" :disabled="!disabled" @click="Cancellation" |
| | | >撤销合并</el-button |
| | | > |
| | | <el-button type="primary" @click="Confirmreceipt">采样打码</el-button> |
| | | <el-button type="primary" :disabled="!disabled" @click="Cancellation">撤销合并</el-button> |
| | | <el-button type="primary" @click="Confirmreceipt" :disabled="!selectList.length">采样打码</el-button> |
| | | <el-button type="primary" @click="piliangPrint" :disabled="!isAllSelected">批量打印</el-button> |
| | | </el-col> |
| | | <el-col |
| | | :span="12" |
| | | style="margin: 10px 15px" |
| | | v-show="samplingList.length > 0 && tjStatus == 0" |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | :disabled="!selectList.length" |
| | | @click="Collection" |
| | | >补打条码</el-button |
| | | > |
| | | <el-button type="primary" :disabled="!disabled" @click="Cancellation" |
| | | >撤销合并</el-button |
| | | > |
| | | <el-col :span="12" style="margin: 10px 15px" v-show="samplingList.length > 0 && tjStatus == 0"> |
| | | <el-button type="primary" :disabled="!selectList.length" @click="buda">补打条码</el-button> |
| | | <!-- @click="Collection" --> |
| | | <el-button type="primary" :disabled="!disabled" @click="Cancellation">撤销合并</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <div style="width: 100%; margin-left: 10px; display: flex"> |
| | | <div style="width: 40%; margin-right: 20px"> |
| | | <el-table |
| | | id="ta" |
| | | v-loading="loading1" |
| | | ref="tb" |
| | | :data="samplingList" |
| | | @selection-change="handleSelectionChange" |
| | | border |
| | | height="520px" |
| | | :row-class-name="tableRowClassName" |
| | | > |
| | | <el-table-column type="selection" width="40" align="center" /> |
| | | <el-table-column |
| | | label="体检号" |
| | | align="center" |
| | | prop="tjNumber" |
| | | width="160px" |
| | | /> |
| | | <el-table-column |
| | | label="姓名" |
| | | align="center" |
| | | prop="cusName" |
| | | width="80px" |
| | | /> |
| | | <el-table-column |
| | | label="性别" |
| | | align="center" |
| | | prop="cusSex" |
| | | width="60px" |
| | | > |
| | | <el-table id="ta" v-loading="loading1" ref="tb" :data="samplingList" @selection-change="handleSelectionChange" |
| | | border height="520px" :row-class-name="tableRowClassName"> |
| | | <el-table-column type="selection" width="40" align="center" :selectable="selectable" /> |
| | | <el-table-column label="体检号" align="center" prop="tjNumber" width="160px" /> |
| | | <el-table-column label="姓名" align="center" prop="cusName" width="80px" /> |
| | | <el-table-column label="性别" align="center" prop="cusSex" width="60px"> |
| | | <!-- <template slot-scope="scope"> |
| | | {{ scope.row.customer.cusSex === 0 ? "男" : "女" }} |
| | | </template> --> |
| | |
| | | <span v-if="scope.row.cusSex == '2'">未知</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="手机号" |
| | | align="center" |
| | | prop="cusPhone" |
| | | width="120px" |
| | | /> |
| | | <el-table-column |
| | | label="申请时间" |
| | | align="center" |
| | | prop="applicationTime" |
| | | width="210" |
| | | > |
| | | <el-table-column label="手机号" align="center" prop="cusPhone" width="120px" /> |
| | | <el-table-column label="单位名称" align="center" prop="compName" width="120px" /> |
| | | <el-table-column label="申请时间" align="center" prop="applicationTime" width="210"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.applicationTime) }}</span> |
| | | </template> |
| | |
| | | </el-table> |
| | | </div> |
| | | <div style="width: 50%"> |
| | | <!-- :default-sort="{ prop: 'specimenType', order: 'ascending' }" :default-sort="{ prop: 'specimenType', order: 'ascending' }" |
| | | @sort-change="handleSortChange" |
| | | :span-method="objectSpanMethod" |
| | | @selection-change="handleChange" ref="tab1" |
| | | :row-class-name="tableRowClassName"--> |
| | | <el-table |
| | | v-loading="loading" |
| | | :data="tableList" |
| | | @selection-change="handleChange" |
| | | :span-method="objectSpanMethod" |
| | | ref="tab1" |
| | | :row-class-name="tableRowClassName" |
| | | border |
| | | height="520px" |
| | | > |
| | | <!-- v-if="this.rightTabShow" --> |
| | | <el-table :row-key="getRowKey" v-if="tableList.length > 0" v-loading="loading" :data="tableList" @selection-change="handleChange" |
| | | :span-method="objectSpanMethod" ref="tab1" :row-class-name="tableRowClassName" border height="520px"> |
| | | <el-table-column type="selection" width="40" align="center" /> |
| | | <!-- :selectable="selectEnable" --> |
| | | <!-- <el-table-column label="是否签收" align="center" prop="isSignFor" /> --> |
| | |
| | | <span>{{ parseTime(scope.row.tjTime, '{y}-{m}-{d}') }}</span> |
| | | </template> |
| | | </el-table-column> --> |
| | | <el-table-column |
| | | label="标本类型" |
| | | align="center" |
| | | prop="specimenType" |
| | | width="120" |
| | | > |
| | | <el-table-column label="标本类型" align="center" prop="specimenType" width="120"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="采样编号" |
| | | align="center" |
| | | prop="jyxh" |
| | | :show-overflow-tooltip="true" |
| | | width="120" |
| | | /> |
| | | <el-table-column label="采样编号" align="center" prop="jyxh" :show-overflow-tooltip="true" width="120" /> |
| | | <el-table-column label="项目名称" align="center" prop="proName" /> |
| | | <!-- <el-table-column |
| | | label="性别" |
| | |
| | | prop="proSex" |
| | | width="90" |
| | | /> --> |
| | | <el-table-column |
| | | label="是否合并" |
| | | align="center" |
| | | prop="isMerge" |
| | | width="90" |
| | | > |
| | | <el-table-column label="是否合并" align="center" prop="isMerge" width="90"> |
| | | <template slot-scope="scope"> |
| | | <span |
| | | :style="{ color: scope.row.isMerge === 0 ? '' : '#409EFF' }" |
| | | > |
| | | <span :style="{ color: scope.row.isMerge === 0 ? '' : '#409EFF' }"> |
| | | {{ scope.row.isMerge === 0 ? "未合并" : "已合并" }} |
| | | </span> |
| | | </template> |
| | |
| | | :limit.sync="queryParams.pageSize" @pagination="getList" /> |
| | | </div> --> |
| | | |
| | | <div style="margin-right: 70%"> |
| | | <div style="margin-right: 50%"> |
| | | <!-- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :pager-count="5" :current-page.sync="currentPage1" :current-page="page" |
| | | :page-sizes="pageSize" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="total"> |
| | | </el-pagination> --> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" /> |
| | | </div> |
| | | |
| | | <!-- 添加或修改体检采样管理对话框 --> |
| | | <!-- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="申请时间" prop="applicationTime"> |
| | | <el-date-picker clearable v-model="form.applicationTime" type="date" value-format="yyyy-MM-dd" |
| | | placeholder="请选择申请时间"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="项目id父项" prop="proId"> |
| | | <el-input v-model="form.proId" placeholder="请输入项目id父项" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目名称" prop="proName"> |
| | | <el-input v-model="form.proName" placeholder="请输入项目名称" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确 定</el-button> |
| | | <el-button @click="cancel">取 消</el-button> |
| | | </div> |
| | | </el-dialog> --> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | } from "@/api/sampling/sampling"; |
| | | import { getNewDateList } from "@/api/hosp/order"; |
| | | import moment from "moment"; |
| | | |
| | | import { |
| | | SubmitCompany, |
| | | getCompany, |
| | | queryCompany, |
| | | addbatch, |
| | | } from "@/api/team/tuanti"; |
| | | export default { |
| | | dicts: [ |
| | | "sys_user_sex", |
| | |
| | | name: "Sampling", |
| | | data() { |
| | | return { |
| | | CheckBox: {}, |
| | | |
| | | CompanyList: [], |
| | | piliangList: [], |
| | | msg: "", |
| | | getNumbr: null, |
| | | valueUrl: "ws://127.0.0.1/websocket", |
| | | webSocket: null, |
| | | list: [], |
| | | selectList: [], |
| | | selectedRows: [], |
| | |
| | | ids: [], |
| | | // 绑定单选按钮 |
| | | tjStatus: "1", |
| | | dayinData: [], |
| | | jsonObj: {}, |
| | | |
| | | // 非单个禁用 |
| | | single: true, |
| | | // 非多个禁用 |
| | |
| | | form: {}, |
| | | // 表单校验 |
| | | rules: {}, |
| | | // rightTabShow: false |
| | | allSelected: false, |
| | | disableSelections: false, // 控制选择禁用状态 |
| | | }; |
| | | }, |
| | | created() { |
| | | // this.getNowTime(); |
| | | getTxmmccd().then((res) => { |
| | | this.msg = Number(res.msg); |
| | | console.log(res, 444); |
| | | }); |
| | | getCompany(this.queryParams).then((response) => { |
| | | this.CompanyList = response.data; |
| | | |
| | | this.loading = false; |
| | | }); |
| | | this.getdate(); |
| | | }, |
| | |
| | | ); |
| | | }, |
| | | qiehuan() { |
| | | return ( |
| | | this.selectList.length > 0 |
| | | ); |
| | | return this.selectList.length > 0; |
| | | }, |
| | | disabledId() { |
| | | return ( |
| | | this.tjStatus == "1" ? 1 : 0 |
| | | ); |
| | | return this.tjStatus == "1" ? 1 : 0; |
| | | }, |
| | | isAllSelected() { |
| | | return this.samplingList.length > 0 && this.selectedRows.length === this.samplingList.length; |
| | | }, |
| | | }, |
| | | |
| | | methods: { |
| | | |
| | | // 选框数据 |
| | | searchSelect(val) { |
| | | this.CheckBox = val; |
| | | this.queryParams.dw = this.CheckBox.drugManufacturerId; |
| | | console.log(this.CheckBox, 9999); |
| | | }, |
| | | getRemoteData(query) { |
| | | if (query) { |
| | | let compName = query; |
| | | queryCompany(compName).then((response) => { |
| | | this.CompanyList = response.data; |
| | | this.CompanyList.forEach((item) => { |
| | | this.queryParams = item; |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | async piliangPrint() { |
| | | // 检查是否有选中的数据 |
| | | if (this.piliangList.length === 0) { |
| | | this.$message.warning('请先选择要打印的数据'); |
| | | return; |
| | | } |
| | | |
| | | const loadingInstance = this.$loading({ |
| | | lock: true, |
| | | text: '打印中...', |
| | | spinner: 'el-icon-loading', |
| | | background: 'rgba(255, 255, 255, 0.7)' |
| | | }); |
| | | |
| | | try { |
| | | for (const item of this.piliangList) { |
| | | try { |
| | | // 获取数据,并等待数据更新完成 |
| | | const tableList = await this.fetchData(item.tjNumber); |
| | | |
| | | // 检查 tableList 是否有数据 |
| | | if (!tableList || tableList.length === 0) { |
| | | console.error(`体检号 ${item.tjNumber} 无相关数据`); |
| | | continue; |
| | | } |
| | | |
| | | // 直接使用所有数据 |
| | | this.selectList = tableList; |
| | | |
| | | // 检查 selectList 是否有数据 |
| | | if (this.selectList.length === 0) { |
| | | console.error(`体检号 ${item.tjNumber} 的 selectList 为空,跳过 WebSocket 操作`); |
| | | continue; |
| | | } |
| | | |
| | | // 使用更新后的 tableList 获取 ids |
| | | let ids = this.selectList.map(row => row.id); |
| | | if (ids.length === 0) { |
| | | console.error(`体检号 ${item.tjNumber} 无有效 ID`); |
| | | continue; |
| | | } |
| | | |
| | | // 确认采样 |
| | | await this.Confirmreceipt1(ids); |
| | | |
| | | // 等待一段时间 |
| | | await new Promise(resolve => setTimeout(resolve, 5000)); |
| | | } catch (error) { |
| | | console.error(`处理体检号 ${item.tjNumber} 时出错:`, error); |
| | | } |
| | | } |
| | | } finally { |
| | | this.ids = []; // 清空 ids |
| | | this.selectList = []; // 清空 selectList |
| | | loadingInstance.close(); |
| | | } |
| | | }, |
| | | getTruncatedName(proName) { |
| | | // 去掉所有空格 |
| | | const trimmedProName = proName.replace(/\s+/g, ""); |
| | |
| | | return ""; // 如果 applicationTime 无效,返回空字符串 |
| | | }, |
| | | /** 查询体检采样管理列表 */ |
| | | getList() { |
| | | this.loading1 = true; |
| | | this.queryParams.isSignFor = this.tjStatus; |
| | | /** 查询体检采样管理列表 */ |
| | | getList() { |
| | | this.queryParams.compId = this.CheckBox.drugManufacturerId; |
| | | this.loading1 = true; |
| | | this.queryParams.isSignFor = this.tjStatus; |
| | | |
| | | if (this.createTimeList) { |
| | | this.queryParams.beginTime = this.createTimeList[0]; |
| | | this.queryParams.endTime = this.createTimeList[1]; |
| | | } else if (this.createTimeList == null) { |
| | | this.queryParams.beginTime = null; |
| | | this.queryParams.endTime = null; |
| | | if (this.createTimeList) { |
| | | this.queryParams.beginTime = this.createTimeList[0]; |
| | | this.queryParams.endTime = this.createTimeList[1]; |
| | | } else { |
| | | this.queryParams.beginTime = null; |
| | | this.queryParams.endTime = null; |
| | | } |
| | | |
| | | getList(this.queryParams).then((response) => { |
| | | this.loading1 = false; |
| | | if (response.data && response.data.list && response.data.list.length > 0) { |
| | | this.samplingList = response.data.list; |
| | | this.total = response.data.total; |
| | | // 移除默认选中第一行的逻辑 |
| | | // this.$nextTick(() => { |
| | | // this.$refs.tb.toggleRowSelection(this.samplingList[0], true); // 默认选中第一行 |
| | | // this.fetchData(this.samplingList[0].tjNumber); // 刷新右侧表格 |
| | | // }); |
| | | } else { |
| | | this.samplingList = []; |
| | | this.tableList = []; |
| | | this.selectList = []; // 清空 selectList |
| | | this.ids = []; // 清空 ids |
| | | if (this.$refs.tab1) { |
| | | this.$refs.tab1.clearSelection(); // 清空右侧表格选中状态 |
| | | } |
| | | getList(this.queryParams).then((response) => { |
| | | this.loading1 = false; |
| | | if (response.data) { |
| | | if (!response.data.list || response.data.list.length === 0) { |
| | | this.samplingList = []; |
| | | this.tableList = []; |
| | | this.loading1 = false; |
| | | this.loading = false; |
| | | return; |
| | | } else { |
| | | this.samplingList = response.data.list; |
| | | // console.log(this.samplingList, 888); |
| | | // 判断是否需要刷新右边表格 |
| | | this.$nextTick(() => { |
| | | this.$refs.tb.toggleRowSelection(this.samplingList[0], true); |
| | | // this.fetchData(this.samplingList[0].tjNumber); |
| | | }); |
| | | } |
| | | this.total = response.data.total; |
| | | this.loading1 = false; |
| | | } else { |
| | | this.samplingList = []; |
| | | this.tableList = []; |
| | | this.loading1 = false; |
| | | } |
| | | }); |
| | | |
| | | /* getList(this.queryParams).then((response) => { |
| | | if (response.data) { |
| | | if (response.data.list == null) { |
| | | this.samplingList = []; |
| | | this.tableList = []; |
| | | this.loading = false; |
| | | } else { |
| | | this.samplingList = response.data.list; |
| | | console.log(this.samplingList,888); |
| | | |
| | | this.loading = false; |
| | | if (this.samplingList.length != 0) { |
| | | this.$nextTick(() => { |
| | | this.$refs.tb.toggleRowSelection(this.samplingList[0], true); |
| | | }); |
| | | } else { |
| | | this.$refs.tb.clearSelection(); |
| | | } |
| | | } |
| | | this.total = response.data.total; |
| | | this.loading = false; |
| | | } else { |
| | | this.samplingList = []; |
| | | this.tableList = []; |
| | | this.loading = false; |
| | | } |
| | | }); */ |
| | | }, |
| | | } |
| | | this.loading1 = false; |
| | | }); |
| | | }, |
| | | // 取消按钮 |
| | | cancel() { |
| | | this.open = false; |
| | |
| | | }, |
| | | /** 重置按钮操作 */ |
| | | resetQuery() { |
| | | this.createTimeList = []; |
| | | this.handleQuery(); |
| | | }, |
| | | // 单选框选中数据 |
| | | /* handleSelectionChange(selection) { |
| | | this.selectList = selection; |
| | | selection.forEach((element) => { |
| | | this.tableList = element.list; |
| | | console.log(this.tableList, 111); |
| | | |
| | | if (this.tableList.length != 0) { |
| | | this.$nextTick(() => { |
| | | this.$refs.tab1.toggleAllSelection(this.tableList, true); |
| | | }); |
| | | } else { |
| | | this.$refs.tab1.clearSelection(); |
| | | } |
| | | }); |
| | | // this.ids = selection.map(item => item.id) |
| | | if (selection.length > 1) { |
| | | let del_row = selection.shift(); |
| | | this.$refs.tb.toggleRowSelection(del_row, false); //设置这一行取消选中 |
| | | this.createTimeList = []; // 清空日期范围 |
| | | this.queryParams.tjNumber = null; // 清空体检号 |
| | | this.queryParams.name = null; // 清空姓名 |
| | | this.queryParams.tjCompName = null; // 清空单位名称 |
| | | this.selectList = []; // 清空右侧选中项 |
| | | this.selectedRows = []; // 清空左侧选中项 |
| | | this.tableList = []; // 清空右侧表格数据 |
| | | this.ids = []; // 清空选中的 ID |
| | | this.$refs.tb.clearSelection(); // 清空左侧表格选中状态 |
| | | if (this.$refs.tab1) { |
| | | this.$refs.tab1.clearSelection(); // 清空右侧表格选中状态 |
| | | } |
| | | this.single = selection.length !== 1; |
| | | this.multiple = !selection.length; |
| | | }, */ |
| | | this.handleQuery(); // 重新查询 |
| | | }, |
| | | |
| | | handleSelectionChange(selection) { |
| | | // 清空右侧表格的数据 |
| | | this.tableList = []; |
| | | this.piliangList = selection; |
| | | const selectedCount = selection.length; |
| | | const totalCount = this.samplingList.length; |
| | | |
| | | // 只有一个人被选中时进行操作 |
| | | if (selection.length === 1) { |
| | | const selectedPerson = selection[0]; // 获取选中的那个人 |
| | | const tjNumber = selectedPerson.tjNumber; |
| | | console.log(selectedPerson.tjNumber, 6363); |
| | | |
| | | // 如果只有一条数据,不要禁用选择,并展示右侧列表 |
| | | if (selectedCount === 1) { |
| | | this.disableSelections = false; |
| | | const selectedPerson = selection[0]; |
| | | const tjNumber = selectedPerson.tjNumber; |
| | | console.log(`选中的体检号: ${tjNumber}`); |
| | | this.fetchData(tjNumber); |
| | | } else if (selectedCount === totalCount && selectedCount > 1) { |
| | | // 全选时禁用选择新行 |
| | | this.disableSelections = true; |
| | | this.tableList = []; |
| | | this.$message.info('已全选所有行'); |
| | | } else { |
| | | // 如果选中多人,则取消选中 |
| | | if (selection.length > 1) { |
| | | // 非全选时启用选择 |
| | | this.disableSelections = false; |
| | | if (selectedCount > 1) { |
| | | // 保留单选功能,取消多选 |
| | | let del_row = selection.shift(); |
| | | this.$refs.tb.toggleRowSelection(del_row, false); // 设置这一行取消选中 |
| | | this.$refs.tb.toggleRowSelection(del_row, false); |
| | | } |
| | | } |
| | | |
| | | // 更新选择状态 |
| | | this.single = selection.length === 1; |
| | | this.multiple = selection.length === 0; |
| | | if (selectedCount === 0) { |
| | | this.tableList = []; |
| | | } |
| | | |
| | | // 更新单选和多选状态 |
| | | this.single = selectedCount === 1; |
| | | this.multiple = selectedCount === 0; |
| | | |
| | | // 更新选中的行 |
| | | this.selectedRows = selection; |
| | | |
| | | // 调试日志 |
| | | console.log(`当前选中数量: ${selectedCount}`); |
| | | console.log(`是否禁用选择: ${this.disableSelections}`); |
| | | }, |
| | | |
| | | getRowKey(row) { |
| | | return row.id; // 必须唯一且稳定 |
| | | }, |
| | | |
| | | fetchData(tjNumber) { |
| | | this.loading = true; // 显示加载状态 |
| | | |
| | | getCusCyList(tjNumber, this.tjStatus) // 调用API获取数据 |
| | | .then((response) => { |
| | | if (response.data) { |
| | | console.log(response, 2525); |
| | | |
| | | this.tableList = response.data; // 确认 list 存在后再进行赋值 |
| | | } else { |
| | | // 如果没有数据或 list 为空,清空表格并提示 |
| | | this.tableList = []; |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.error("Error fetching data:", error); |
| | | }) |
| | | .finally(() => { |
| | | this.loading = false; // 隐藏加载状态 |
| | | }); |
| | | return new Promise((resolve, reject) => { |
| | | this.loading = true; |
| | | getCusCyList(tjNumber, this.tjStatus) |
| | | .then((response) => { |
| | | if (response.data) { |
| | | this.tableList = response.data; |
| | | this.$nextTick(() => { |
| | | if (this.$refs.tab1) { |
| | | this.$refs.tab1.doLayout(); // 修改为正确的 ref 名称 |
| | | this.$refs.tab1.clearSelection(); // 清空选中状态 |
| | | } |
| | | }); |
| | | resolve(this.tableList); |
| | | } else { |
| | | this.tableList = []; |
| | | this.selectList = []; |
| | | this.ids = []; |
| | | if (this.$refs.tab1) { |
| | | this.$refs.tab1.clearSelection(); |
| | | } |
| | | resolve([]); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.error("Error fetching data:", error); |
| | | reject(error); |
| | | }) |
| | | .finally(() => { |
| | | this.loading = false; |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | /* 点击合并按钮 */ |
| | |
| | | this.$message.success("合并成功。"); |
| | | // console.log("合并的行:", this.selectedRows); |
| | | // this.getList(); |
| | | this.fetchData(this.selectedRows[0].cusId); |
| | | this.fetchData(this.selectedRows[0].tjNumber); |
| | | }); |
| | | } else { |
| | | this.$message.error("标本类型不一致,无法合并!"); |
| | |
| | | this.$message.success("撤销成功!"); |
| | | // 刷新数据列表或进行其他操作 |
| | | // this.getList(); |
| | | this.fetchData(this.selectedRows[0].cusId); |
| | | this.fetchData(this.selectedRows[0].tjNumber); |
| | | } else { |
| | | this.$message.error(res.msg || "撤销失败,请重试!"); |
| | | } |
| | |
| | | |
| | | /** 点击补打条码按钮 **/ |
| | | async Collection() { |
| | | // console.log("selectList:", this.selectList); |
| | | const jyxh = this.selectList.map((item) => item.jyxh); |
| | | console.log("jyxh:", jyxh); |
| | | console.log("jyxh:", jyxh); |
| | | try { |
| | | // 请求接口并获取宽度值 |
| | | const widthResponse = await getTxmkd(); |
| | | const barcodeWidth = `${Number(widthResponse.msg)}%` || "70%"; // 获取宽度值,默认使用 70% |
| | | |
| | | // const jyxh = this.selectList.map((item) => item.jyxh); |
| | | |
| | | // await this.$nextTick(); // 确保 DOM 更新 |
| | | |
| | | jyxh.forEach((number, index) => { |
| | | const barcodeContent = number; // 确保 jyxh 是有效的 |
| | |
| | | const newWindow = window.open("", "_blank", "width=800,height=600"); |
| | | const printContents = document.getElementById("printSection").innerHTML; |
| | | |
| | | // console.log(printContents); |
| | | console.log(printContents); |
| | | newWindow.document.write(` |
| | | <html> |
| | | <head> |
| | |
| | | } |
| | | .last p { |
| | | // font-weight: bold; |
| | | margin-left: 10px; |
| | | margin-left: 1px; |
| | | // font-family: "Arial Black", sans-serif !important; |
| | | } |
| | | p { |
| | | margin-left: 10px; |
| | | margin-left: 1px; |
| | | // font-weight: bold; |
| | | // font-family: "Arial Black", sans-serif !important; |
| | | } |
| | |
| | | font-family: "Arial Black", sans-serif !important; |
| | | } |
| | | .tj span { |
| | | margin-left: 10px; |
| | | margin-left: 1px; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | }, |
| | | |
| | | handleChange(selection) { |
| | | // console.log(selection); |
| | | |
| | | this.selectList = selection; |
| | | console.log(this.selectList, 5555); |
| | | |
| | | this.ids = selection.map((item) => item.id); |
| | | var array = selection; |
| | | this.ids = array.map((item) => item.id); |
| | | }, |
| | | buda() { |
| | | var websocket = null; |
| | | var url = this.valueUrl; |
| | | if ("WebSocket" in window) { |
| | | websocket = new WebSocket(url); |
| | | } else if ("MozWebSocket" in window) { |
| | | websocket = new MozWebSocket(url); |
| | | } |
| | | if (websocket == null) { |
| | | alert("创建WebSocket对象失败"); |
| | | } |
| | | websocket.onerror = function () { |
| | | alert("请检查读卡器连接是否正常"); |
| | | }; |
| | | websocket.onopen = () => { |
| | | this.websocket = websocket; |
| | | console.log(this.selectList, "this.selectList") |
| | | this.dayinData = this.selectList.map((item) => ({ |
| | | jyxh: item.jyxh, |
| | | proName: item.proName, |
| | | cusName: item.cusName, |
| | | cusSex: item.customer.cusSex, |
| | | age: item.customer.age, |
| | | cardId: item.cardId, |
| | | tjTime: item.createTime, |
| | | })); |
| | | |
| | | // 禁选 |
| | | // selectEnable(row, rowIndex) { |
| | | // if(row.isSignFor === "0"){ |
| | | // return false |
| | | // }else{ |
| | | // return true |
| | | // } |
| | | // }, |
| | | |
| | | // 确定按钮 |
| | | submitForm() {}, |
| | | // 连接设备 |
| | | this.jsonObj = { |
| | | type: "3", |
| | | array: { |
| | | data: this.dayinData, |
| | | }, |
| | | }; |
| | | var jStr = JSON.stringify(this.jsonObj); |
| | | console.log(jStr, "jStr"); |
| | | |
| | | this.websocket.send(jStr); |
| | | this.$refs.tab1.clearSelection(); // 清除右侧表格的选中状态 |
| | | this.selectList = []; // 清空 selectList |
| | | this.ids = []; // 清空 ids |
| | | this.jsonObj = {}; |
| | | // this.dialogVisible = false; |
| | | }; |
| | | // this.getList(); |
| | | }, |
| | | // 确认采样 |
| | | Confirmreceipt() { |
| | | let data = this.ids; |
| | | console.log(this.ids, 999); |
| | | |
| | | const loadingInstance = this.$loading({ |
| | | lock: true, // 锁定屏幕 |
| | | text: "加载中...", // 加载文本 |
| | | spinner: "el-icon-loading", // 自定义加载图标 |
| | | background: "rgba(255, 255, 255, 0.7)", // 背景颜色 |
| | | lock: true, |
| | | text: "加载中...", |
| | | spinner: "el-icon-loading", |
| | | background: "rgba(255, 255, 255, 0.7)", |
| | | }); |
| | | confirmSampling(this.ids) |
| | | .then((res) => { |
| | | if (res.code === 200) { |
| | | // this.$modal.msgSuccess("采样成功"); |
| | | this.buda(); // 打印条码 |
| | | |
| | | this.Collection(); |
| | | this.getList(); |
| | | this.getList(); // 刷新左侧表格 |
| | | console.log("采样后 - selectList:", this.selectList, "qiehuan:", this.qiehuan); |
| | | } else { |
| | | this.$message.error(res.msg); |
| | | } |
| | | // this.getList(); |
| | | }) |
| | | .catch((error) => { |
| | | this.$message.error("采样失败"); |
| | | console.error("采样失败:", error); |
| | | }) |
| | | .finally(() => { |
| | | loadingInstance.close(); |
| | | }); |
| | | }, |
| | | |
| | | // 单选按钮 |
| | | radioChange(value) { |
| | | |
| | | if (this.selectList.length > 0) { |
| | | alert("已选中后禁止切换"); |
| | | |
| | | } else { |
| | | console.log("切换"); |
| | | |
| | | this.loading = true; |
| | | this.queryParams.isSignFor = value; |
| | | getList(this.queryParams).then((response) => { |
| | | if (response.data) { |
| | | if (response.data.list == null) { |
| | | this.samplingList = []; |
| | | this.tableList = []; |
| | | this.loading = false; |
| | | } else { |
| | | this.samplingList = response.data.list; |
| | | this.loading = false; |
| | | if (this.samplingList.length != 0) { |
| | | this.$nextTick(() => { |
| | | this.$refs.tb.toggleRowSelection(this.samplingList[0], true); |
| | | }); |
| | | } else { |
| | | this.$refs.tb.clearSelection(); |
| | | } |
| | | } |
| | | this.total = response.data.total; |
| | | this.loading = false; |
| | | Confirmreceipt1(ids) { |
| | | confirmSampling(ids) |
| | | .then((res) => { |
| | | if (res.code === 200) { |
| | | this.buda(); |
| | | this.getList(); |
| | | } else { |
| | | this.samplingList = []; |
| | | this.tableList = []; |
| | | this.loading = false; |
| | | this.$message.error(res.msg); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | }) |
| | | .finally(() => { |
| | | loadingInstance.close(); |
| | | }); |
| | | } |
| | | }, |
| | | // 单选按钮 |
| | | // 单选按钮 |
| | | radioChange(value) { |
| | | this.loading = true; |
| | | this.queryParams.isSignFor = value; |
| | | getList(this.queryParams).then((response) => { |
| | | if (response.data) { |
| | | if (response.data.list == null) { |
| | | this.samplingList = []; |
| | | this.tableList = []; |
| | | this.loading = false; |
| | | } else { |
| | | this.samplingList = response.data.list; |
| | | this.loading = false; |
| | | // 移除默认选中第一行的逻辑 |
| | | // if (this.samplingList.length != 0) { |
| | | // this.$nextTick(() => { |
| | | // this.$refs.tb.toggleRowSelection(this.samplingList[0], true); |
| | | // }); |
| | | // } else { |
| | | // this.$refs.tb.clearSelection(); |
| | | // } |
| | | } |
| | | this.total = response.data.total; |
| | | this.loading = false; |
| | | } else { |
| | | this.samplingList = []; |
| | | this.tableList = []; |
| | | this.loading = false; |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 默认接受四个值 { 当前行的值, 当前列的值, 行的下标, 列的下标 } |
| | | objectSpanMethod({ row, column, rowIndex, columnIndex }) { |
| | |
| | | }, |
| | | |
| | | // 导出 |
| | | handleExport() {}, |
| | | handleExport() { }, |
| | | |
| | | /** 控制行是否可选 */ |
| | | selectable(row, index) { |
| | | if (this.disableSelections) { |
| | | // 仅允许取消已选中的行 |
| | | return this.selectedRows.some(selectedRow => selectedRow.id === row.id); |
| | | } |
| | | return true; // 允许选择所有行 |
| | | }, |
| | | |
| | | resetSelection() { |
| | | this.$refs.tb.clearSelection(); |
| | | this.disableSelections = false; |
| | | this.selectedRows = []; |
| | | this.single = false; |
| | | this.multiple = true; |
| | | this.tableList = []; |
| | | |
| | | // 调试日志 |
| | | console.log(`重置选择,是否禁用选择: ${this.disableSelections}`); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | #ta .el-table__header-wrapper .el-checkbox { |
| | | display: none; |
| | | /* display: none; */ |
| | | } |
| | | |
| | | .el-table .warning-row { |