| | |
| | | </el-table> |
| | | </div> |
| | | <div style="width: 50%"> |
| | | <!-- v-if="this.rightTabShow" v-if="tableList.length > 0"--> |
| | | <el-table v-loading="loading" :data="tableList" @selection-change="handleChange" :span-method="objectSpanMethod" |
| | | ref="elTable" :row-class-name="tableRowClassName" border height="520px"> |
| | | <!-- v-if="this.rightTabShow" --> |
| | | <el-table 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" /> --> |
| | |
| | | if (this.createTimeList) { |
| | | this.queryParams.beginTime = this.createTimeList[0]; |
| | | this.queryParams.endTime = this.createTimeList[1]; |
| | | } else if (this.createTimeList == null) { |
| | | } else { |
| | | this.queryParams.beginTime = null; |
| | | this.queryParams.endTime = null; |
| | | } |
| | | |
| | | 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; |
| | | // 判断是否需要刷新右边表格 |
| | | this.$nextTick(() => { |
| | | this.$refs.tb.toggleRowSelection(this.samplingList[0], true); |
| | | // 检查是否全选 |
| | | if (this.samplingList.length === this.selectedRows.length) { |
| | | this.disableSelections = true; |
| | | } else { |
| | | this.disableSelections = false; |
| | | } |
| | | }); |
| | | } |
| | | if (response.data && response.data.list && response.data.list.length > 0) { |
| | | this.samplingList = response.data.list; |
| | | this.total = response.data.total; |
| | | this.loading1 = false; |
| | | this.$nextTick(() => { |
| | | this.$refs.tb.toggleRowSelection(this.samplingList[0], true); // 默认选中第一行 |
| | | this.fetchData(this.samplingList[0].tjNumber); // 刷新右侧表格 |
| | | }); |
| | | } else { |
| | | this.samplingList = []; |
| | | this.tableList = []; |
| | | this.loading1 = false; |
| | | this.selectList = []; // 清空 selectList |
| | | this.ids = []; // 清空 ids |
| | | if (this.$refs.tab1) { |
| | | this.$refs.tab1.clearSelection(); // 清空右侧表格选中状态 |
| | | } |
| | | } |
| | | 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; |
| | | } |
| | | }); */ |
| | | }, |
| | | // 取消按钮 |
| | | cancel() { |
| | |
| | | if (response.data) { |
| | | this.tableList = response.data; |
| | | this.$nextTick(() => { |
| | | this.$refs.elTable.doLayout(); // 通过 ref 调用表格方法 |
| | | }); |
| | | this.$refs.elTable.doLayout(); // 通过 ref 调用表格方法 |
| | | if (this.$refs.tab1) { |
| | | this.$refs.tab1.clearSelection(); // 清空之前的选中状态 |
| | | } |
| | | }); |
| | | resolve(this.tableList); |
| | | } else { |
| | | this.tableList = []; |
| | | this.selectList = []; |
| | | this.ids = []; |
| | | if (this.$refs.tab1) { |
| | | this.$refs.tab1.clearSelection(); |
| | | } |
| | | resolve([]); |
| | | } |
| | | }) |
| | |
| | | // 确认采样 |
| | | Confirmreceipt() { |
| | | 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) => { |
| | | console.log(this.selectList, 2222); |
| | | |
| | | if (res.code === 200) { |
| | | this.buda(); |
| | | this.getList(); |
| | | this.buda(); // 打印条码 |
| | | this.$refs.tab1.clearSelection(); // 清除右侧表格的选中状态 |
| | | this.selectList = []; // 清空 selectList |
| | | this.ids = []; // 清空 ids |
| | | this.getList(); // 刷新左侧表格 |
| | | console.log("采样后 - selectList:", this.selectList, "qiehuan:", this.qiehuan); |
| | | } else { |
| | | this.$message.error(res.msg); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.error("采样失败:", error); |
| | | }) |
| | | .finally(() => { |
| | | loadingInstance.close(); |