index.vue 16.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
<template>
  <div class="app-container">
    <el-tabs v-model="activeName" type="card">
      <el-tab-pane label="主表" name="first">
        <div class="app-container">
          <el-form
            :model="queryParams"
            ref="queryForm"
            :inline="true"
            v-show="showSearch"
            label-width="100px"
          >
            <el-form-item label="容器编号" prop="containerCode">
              <el-input
                v-model="queryParams.containerCode"
                placeholder="请输入容器编号"
                clearable
                size="small"
                style="width: 240px"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="库位编号" prop="toLocation">
              <el-input
                v-model="queryParams.toLocation"
                placeholder="请输入库位编号"
                clearable
                size="small"
                style="width: 240px"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="任务类型" prop="taskType">
              <el-select
                v-model="queryParams.taskType"
                placeholder="任务类型"
                clearable
                size="small"
                style="width: 240px"
              >
                <el-option
                  v-for="dict in taskTypeOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="dict.dictValue"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="容器任务状态" prop="status">
              <el-select
                v-model="queryParams.status"
                placeholder="容器任务状态"
                clearable
                size="small"
                style="width: 240px"
              >
                <el-option
                  v-for="dict in containerStatusOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="dict.dictValue"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="创建人" prop="createdBy">
              <el-input
                v-model="queryParams.createdBy"
                placeholder="请输入创建人"
                clearable
                size="small"
                style="width: 240px"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="创建时间">
              <el-date-picker
                v-model="dateRange"
                size="small"
                style="width: 240px"
                value-format="yyyy-MM-dd"
                type="daterange"
                range-separator="-"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item>
              <el-button
                size="mini"
                type="cyan"
                icon="el-icon-search"
                @click="handleQuery"
                >搜索</el-button
              >
              <el-button size="mini" icon="el-icon-refresh" @click="resetQuery"
                >重置</el-button
              >
            </el-form-item>
          </el-form>
          <el-row :gutter="10" class="mb8">
            <right-toolbar
              :showSearch.sync="showSearch"
              @queryTable="getHeaderList"
              :col-data="colData"
              @selectData="selectData"
            ></right-toolbar>
          </el-row>
          <el-table v-loading="headerLoading" :data="HeaderList" ref="table">
            <el-table-column
              label="组盘头id"
              align="center"
              prop="id"
              width="100"
              sortable
              v-if="colData[0].istrue"
            />
            <el-table-column
              prop="containerCode"
              label="容器编号"
              align="center"
              width="180"
              sortable
              v-if="colData[1].istrue"
            />
            <el-table-column
              prop="toLocation"
              label="库位编号"
              align="center"
              width="180"
              sortable
              v-if="colData[2].istrue"
            />
            <el-table-column
              prop="taskType"
              label="任务类型"
              align="center"
              width="180"
              sortable
              v-if="colData[3].istrue"
            >
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  :type="scope.row.taskType | taskTypeFilter"
                  round
                  >{{ taskTypeFormat(scope.row, scope.column) }}</el-button
                >
              </template>
            </el-table-column>
            <el-table-column
              prop="status"
              label="容器任务状态"
              align="center"
              width="200"
              sortable
              v-if="colData[4].istrue"
            >
              <template slot-scope="scope">
               {{
                  containerStatusFormat(scope.row, scope.column)
                }}
              </template>
            </el-table-column>
            <el-table-column
              prop="created"
              label="创建时间"
              align="center"
              sortable
              width="200"
              v-if="colData[5].istrue"
            >
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.created) }}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="createdBy"
              label="创建人"
              sortable
              width="180"
              align="center"
              :show-overflow-tooltip="true"
              v-if="colData[6].istrue"
            />
            <el-table-column
              fixed="right"
              prop="center"
              label="操作"
              align="center"
              class-name="small-padding fixed-width"
              min-width="200"
              v-if="colData[7].istrue"
            >
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-my-detail"
                  @click="handleDetail(scope.row)"
                  v-hasPermi="['receipt:receiptContainer:list']"
                  >明细</el-button
                >
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit-outline"
                  v-if="scope.row.status < 10"
                  @click="createTask(scope.row)"
                  v-hasPermi="['receipt:receiptContainer:createTask']"
                  >生成任务</el-button
                >
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-close"
                  v-if="scope.row.status < 10"
                  @click="headerDelete(scope.row)"
                  v-hasPermi="['receipt:receiptContainer:remove']"
                  >取消配盘</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
        <pagination
          v-show="headerTotal > 0"
          :total="headerTotal"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getHeaderList"
        />
      </el-tab-pane>
      <el-tab-pane
        label="明细"
        name="second"
        v-if="queryDetailParams.receiptDetailId !== undefined"
      >
        <el-row :gutter="10" class="mb8">
          <right-toolbar
            :showSearch.sync="showDetailSearch"
            @queryTable="getDetailList"
            :no-search="noSearch"
            :col-data="colData2"
            @selectData="selectData2"
          ></right-toolbar>
        </el-row>
        <el-table v-loading="detailLoading" :data="detailList" ref="table">
          <el-table-column
            prop="id"
            label="明细id"
            align="center"
            min-width="100"
            v-if="colData2[0].istrue"
          />
          <el-table-column
            prop="headerId"
            label=" 组盘头标识"
            align="center"
            min-width="120"
            v-if="colData2[1].istrue"
          />
          <el-table-column
            prop="receiptDetailId"
            label=" 入库单明细标识"
            align="center"
            min-width="120"
            v-if="colData2[2].istrue"
          />
          <el-table-column
            prop="receiptCode"
            label="入库单号"
            align="center"
            min-width="180"
            sortable
            v-if="colData2[3].istrue"
          />
          <el-table-column
            prop="materialCode"
            label="物料编码"
            align="center"
            min-width="150"
            sortable
           
            v-if="colData2[4].istrue"
          />
          <el-table-column
            prop="materialName"
            label="物料名称"
            align="center"
            min-width="200"
            :show-overflow-tooltip="true"
            sortable
            v-if="colData2[5].istrue"
          />
          <el-table-column
            prop="materialSpec"
            label="物料规格"
            align="center"
            min-width="150"
            sortable
            v-if="colData2[6].istrue"
          />
          <el-table-column
            prop="project"
            label="项目号"
            align="center"
            min-width="130"
            v-if="colData2[7].istrue"
          />
          <el-table-column
            prop="qty"
            label="组盘数量"
            align="center"
            min-width="120"
            v-if="colData2[8].istrue"
          />
          <el-table-column
            prop="created"
            label="创建时间"
            align="center"
            min-width="160"
            sortable
            v-if="colData2[9].istrue"
          />
          <el-table-column
            prop="createdBy"
            label="创建用户"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
            sortable
            v-if="colData2[10].istrue"
          />
          
        </el-table>
        <pagination
          v-show="detailTotal > 0"
          :total="detailTotal"
          :page.sync="queryDetailParams.pageNum"
          :limit.sync="queryDetailParams.pageSize"
          @pagination="getDetailList"
        />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import {
  listreceiptContainerHeader,
  createTask,
  delHeader,
} from "@/api/receipt/receiptContainerHeader/header";
import { listReceiptDetail } from "@/api/receipt/receiptContainerHeader/detail";

export default {
  name: "receiptContainerHeader",
  data() {
    return {
      activeName: "first",
      // 主表遮罩层
      headerLoading: true,
      // 主表显示搜索条件
      showSearch: true,
      // 主表总条数
      headerTotal: 0,
      // 主表表格数据
      HeaderList: [],

      // 主表是否显示弹出层
      open: false,
      // 任务类型数据字典
      taskTypeOptions: [],
      // 容器任务状态数据字典
      containerStatusOptions: [],
      // 主表日期范围
      dateRange: [],
      // 主表查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        containerCode: undefined,
        toLocation: undefined,
        taskType: undefined,
        status: undefined,
        createdBy: undefined,
      },

      // 明细遮罩层
      detailLoading: true,
      // 明细显示搜索条件
      showDetailSearch: true,
      // 明细总条数
      detailTotal: 0,
      // 明细表格数据
      detailList: [],
      // 明细弹出层标题
      detailTitle: "",
      // 明细是否显示弹出层
      detailOpen: false,
      // 明细查询参数
      queryDetailParams: {
        receiptDetailId: undefined,
        pageNum: 1,
        pageSize: 10,
      },
      colData: [
        { title: "组盘头id", istrue: false },
        { title: "容器编号", istrue: true },
        { title: "库位编号", istrue: true },
        { title: "任务类型", istrue: true },
        { title: "容器任务状态", istrue: true },
        { title: "创建时间", istrue: true },
        { title: "创建人", istrue: true },
        { title: "操作", istrue: true, disabled: true },
      ],
      colData2: [
        { title: "明细id", istrue: false },
        { title: "组盘头标识", istrue: false },
        { title: "入库单明细标识", istrue: false },
        { title: "入库单号", istrue: true },
        { title: "物料编码", istrue: true },
        { title: "物料名称", istrue: true },
        { title: "物料规格", istrue: true },
        { title: "项目号", istrue: true },
        { title: "组盘数量", istrue: true },
        { title: "创建时间", istrue: true },
        { title: "创建用户", istrue: true,disabled:true },
        
      ],
      noSearch: false,
    };
  },
  created() {
    this.getHeaderList();
    //任务类型
    this.getDicts("taskType").then((response) => {
      this.taskTypeOptions = response.data;
    });
    //容器任务状态
    this.getDicts("receiptContainerHeaderStatus").then((response) => {
      this.containerStatusOptions = response.data;
    });
  },
  beforeUpdate() {
    this.$nextTick(() => {
      this.$refs["table"].doLayout();
    });
  },
  methods: {
    /** 主表查询参数列表 */
    getHeaderList() {
      this.headerLoading = true;
      listreceiptContainerHeader(
        this.addDateRange(this.queryParams, this.dateRange)
      ).then((response) => {
        this.HeaderList = response.rows;
        this.headerTotal = response.total;
        this.headerLoading = false;
      });
    },

    // 任务类型字典翻译
    taskTypeFormat(row, column) {
      return this.selectDictLabel(this.taskTypeOptions, row.taskType);
    },
    // 容器任务状态字典翻译
    containerStatusFormat(row, column) {
      return this.selectDictLabel(this.containerStatusOptions, row.status);
    },
    /** 主表搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getHeaderList();
    },
    /** 主表重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 主表多选框选中数据
    handleSelectionChange(selection) {
      this.headerIds = selection.map((item) => item.id);
      this.headerSingle = selection.length != 1;
      this.headerMultiple = !selection.length;
    },
    // 主表明细按钮操作
    handleDetail(row) {
      this.queryDetailParams.receiptDetailId = row.id;
      this.activeName = "second";

      this.getDetailList();
    },
    /** 查询明细列表 */
    getDetailList() {
      this.detailLoading = true;
      listReceiptDetail(this.queryDetailParams).then((response) => {
        this.detailList = response.rows;
        this.detailTotal = response.total;
        this.detailLoading = false;
      });
    },
    //生成任务
    createTask(row) {
      createTask(row.id).then((response) => {
        if (response.code == 200) {
          this.msgSuccess(response.msg);
          this.getHeaderList();
        } else {
          this.msgError(response.msg);
        }
      });
    },

    /** 主表删除按钮操作 */
    headerDelete(row) {
      const id = row.id;
      this.$confirm(
        row.id
        ? "是否确认删除该条入库组盘头信息吗?"
        :'是否确认取消组盘头id为"' + id + '"的数据项?', "警告",
        {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      })
        .then(function () {
          return delHeader(id);
        })
        .then(() => {
          this.getHeaderList();
          this.msgSuccess("取消成功");
        })
        .catch(function () {});
    },
    /** 表格切换字段显示操作 */
    selectData(val) {
      if (val) {
        this.colData.filter((i) => {
          if (val.indexOf(i.title) !== -1) {
            i.istrue = true;
          } else {
            i.istrue = false;
          }
        });
      }
    },
    /** 明细表格切换字段显示操作 */
    selectData2(val) {
      if (val) {
        this.colData2.filter((i) => {
          if (val.indexOf(i.title) !== -1) {
            i.istrue = true;
          } else {
            i.istrue = false;
          }
        });
      }
    },
  },
};
</script>