<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="产品编号" prop="productNo">
        <el-input
          v-model="queryParams.productNo"
          placeholder="请输入产品编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="品名" prop="productName">
        <el-input
          v-model="queryParams.productName"
          placeholder="请输入品名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="产品规格" prop="productSpecifications">-->
<!--        <el-input-->
<!--          v-model="queryParams.productSpecifications"-->
<!--          placeholder="请输入产品规格"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="批号" prop="batchNumber">
        <el-input
          v-model="queryParams.batchNumber"
          placeholder="请输入批号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="色泽" prop="colours">
        <el-input
          v-model="queryParams.colours"
          placeholder="请输入色泽"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="机台" prop="machineTool">
        <el-input
          v-model="queryParams.machineTool"
          placeholder="请输入机台"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="卷数" prop="js">-->
<!--        <el-input-->
<!--          v-model="queryParams.js"-->
<!--          placeholder="请输入卷数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="毛重" prop="standby">-->
<!--        <el-input-->
<!--          v-model="queryParams.standby"-->
<!--          placeholder="请输入毛重"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="皮重" prop="standby1">-->
<!--        <el-input-->
<!--          v-model="queryParams.standby1"-->
<!--          placeholder="请输入皮重"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="净重" prop="standby2">-->
<!--        <el-input-->
<!--          v-model="queryParams.standby2"-->
<!--          placeholder="请输入净重"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="任务号" prop="standby3">-->
<!--        <el-input-->
<!--          v-model="queryParams.standby3"-->
<!--          placeholder="请输入任务号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="领料车间" prop="workshop">-->
<!--        <el-input-->
<!--          v-model="queryParams.workshop"-->
<!--          placeholder="请输入领料车间"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="领料人" prop="recipient">-->
<!--        <el-input-->
<!--          v-model="queryParams.recipient"-->
<!--          placeholder="请输入领料人"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="领料时间" prop="collectTime">-->
<!--        <el-input-->
<!--          v-model="queryParams.collectTime"-->
<!--          placeholder="请输入领料时间"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="确认人" prop="confirm">-->
<!--        <el-input-->
<!--          v-model="queryParams.confirm"-->
<!--          placeholder="请输入确认人"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="确认时间" prop="confirmTime">-->
<!--        <el-input-->
<!--          v-model="queryParams.confirmTime"-->
<!--          placeholder="请输入确认时间"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</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="1.5">-->
<!--        <el-button-->
<!--          type="primary"-->
<!--          plain-->
<!--          icon="el-icon-plus"-->
<!--          size="mini"-->
<!--          @click="handleAdd"-->
<!--          v-hasPermi="['lineSideCabin:lineSideCabin:add']"-->
<!--        >新增</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="success"-->
<!--          plain-->
<!--          icon="el-icon-edit"-->
<!--          size="mini"-->
<!--          :disabled="single"-->
<!--          @click="handleUpdate"-->
<!--          v-hasPermi="['lineSideCabin:lineSideCabin:edit']"-->
<!--        >修改</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="danger"-->
<!--          plain-->
<!--          icon="el-icon-delete"-->
<!--          size="mini"-->
<!--          :disabled="multiple"-->
<!--          @click="handleDelete"-->
<!--          v-hasPermi="['lineSideCabin:lineSideCabin:remove']"-->
<!--        >删除</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="warning"-->
<!--          plain-->
<!--          icon="el-icon-download"-->
<!--          size="mini"-->
<!--          @click="handleExport"-->
<!--          v-hasPermi="['lineSideCabin:lineSideCabin:export']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
<!--      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
<!--    </el-row>-->

    <el-table v-loading="loading" :data="lineSideCabinList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="编号" align="center" prop="id" />
      <el-table-column label="产品编号" align="center" prop="productNo" />
      <el-table-column label="品名" align="center" prop="productName" />
      <el-table-column label="产品规格" align="center" prop="productSpecifications" />
<!--      <el-table-column label="类型" align="center" prop="productType" />-->
      <el-table-column label="批号" align="center" prop="batchNumber" />
      <el-table-column label="色泽" align="center" prop="colours" />
      <el-table-column label="机台" align="center" prop="machineTool" />
      <el-table-column label="卷数" align="center" prop="js" />
<!--      <el-table-column label="状态" align="center" prop="status" />-->
      <el-table-column label="毛重" align="center" prop="standby" />
      <el-table-column label="皮重" align="center" prop="standby1" />
      <el-table-column label="净重" align="center" prop="standby2" />
      <el-table-column label="丝车号" align="center" prop="scid" />
      <el-table-column label="入库时间" align="center" prop="createTime" />
      <el-table-column label="操作人" align="center" prop="createBy" />
<!--      <el-table-column label="任务号" align="center" prop="standby3" />-->
      <el-table-column label="领料车间" align="center" prop="workshop" />
      <el-table-column label="领料人" align="center" prop="recipient" />
      <el-table-column label="领料时间" align="center" prop="collectTime" />
      <el-table-column label="确认人" align="center" prop="confirm" />
      <el-table-column label="确认时间" align="center" prop="confirmTime" />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-dropdown>
            <el-button type="warning" plain size="small">
              操作<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleUpdate(scope.row)"
                >修改</el-button>
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-delete"
                  @click="handleDelete(scope.row)"
                >删除</el-button>
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-printer"
                  @click="handlePrint(scope.row)"
                >打印</el-button>
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改线边舱库存对话框 -->
    <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="productNo">
<!--          <el-input v-model="form.productNo" placeholder="请输入产品编号" />-->
          <span>{{form.productName}}--{{form.productSpecifications}}</span>
        </el-form-item>
        <el-form-item label="色泽:" prop="colours">
<!--          <el-input v-model="form.colours" placeholder="请输入色泽" />-->
          <span>{{form.colours}}</span>
        </el-form-item>
        <el-form-item label="批号" prop="batchNumber">
<!--          <el-input v-model="form.batchNumber" placeholder="请输入批号" />-->
          <span>{{form.batchNumber}}</span>
        </el-form-item>
        <el-form-item label="机台" prop="machineTool">
<!--          <el-input v-model="form.machineTool" placeholder="请输入机台" />-->
          <span>{{form.machineTool}}</span>
        </el-form-item>
        <el-form-item label="卷数" prop="js">
<!--          <el-input v-model="form.js" placeholder="请输入卷数" />-->
          <span>{{form.js}}</span>
        </el-form-item>
        <el-form-item label="毛重" prop="standby">
<!--          <el-input v-model="form.standby" placeholder="请输入毛重" />-->
          <span>{{form.standby}}</span>
        </el-form-item>
        <el-form-item label="皮重" prop="standby1">
<!--          <el-input v-model="form.standby1" placeholder="请输入皮重" />-->
          <span>{{form.standby1}}</span>
        </el-form-item>
        <el-form-item label="净重" prop="standby2">
<!--          <el-input v-model="form.standby2" placeholder="请输入净重" />-->
          <span>{{form.standby2}}</span>
        </el-form-item>
        <el-form-item label="丝车" prop="scid">
          <!--          <el-input v-model="form.standby2" placeholder="请输入净重" />-->
          <span>{{form.scid}}</span>
        </el-form-item>
        <el-form-item label="领料车间" prop="workshop">
          <el-select v-model="form.workshop" placeholder="请选择领料车间">
            <el-option label="纺丝车间" value="纺丝车间"/>
            <el-option label="加弹南车间" value="加弹南车间"/>
            <el-option label="加弹北车间" value="加弹北车间"/>
            <el-option label="调丝车间" value="调丝车间"/>
          </el-select>
        </el-form-item>
<!--        <el-form-item label="领料人" prop="recipient">-->
<!--          <el-input v-model="form.recipient" placeholder="请输入领料人" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="领料时间" prop="collectTime">-->
<!--          <el-input v-model="form.collectTime" placeholder="请输入领料时间" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="确认人" prop="confirm">-->
<!--          <el-input v-model="form.confirm" placeholder="请输入确认人" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="确认时间" prop="confirmTime">-->
<!--          <el-input v-model="form.confirmTime" 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>

    <!-- 确认领料对话框 -->
    <el-dialog :title="title" :visible.sync="opens" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="产品:" prop="productNo">
          <!--          <el-input v-model="form.productNo" placeholder="请输入产品编号" />-->
          <span>{{form.productName}}--{{form.productSpecifications}}</span>
        </el-form-item>
        <el-form-item label="色泽:" prop="colours">
          <!--          <el-input v-model="form.colours" placeholder="请输入色泽" />-->
          <span>{{form.colours}}</span>
        </el-form-item>
        <el-form-item label="批号" prop="batchNumber">
          <!--          <el-input v-model="form.batchNumber" placeholder="请输入批号" />-->
          <span>{{form.batchNumber}}</span>
        </el-form-item>
        <el-form-item label="机台" prop="machineTool">
          <!--          <el-input v-model="form.machineTool" placeholder="请输入机台" />-->
          <span>{{form.machineTool}}</span>
        </el-form-item>
        <el-form-item label="卷数" prop="js">
          <!--          <el-input v-model="form.js" placeholder="请输入卷数" />-->
          <span>{{form.js}}</span>
        </el-form-item>
        <el-form-item label="毛重" prop="standby">
          <!--          <el-input v-model="form.standby" placeholder="请输入毛重" />-->
          <span>{{form.standby}}</span>
        </el-form-item>
        <el-form-item label="皮重" prop="standby1">
          <!--          <el-input v-model="form.standby1" placeholder="请输入皮重" />-->
          <span>{{form.standby1}}</span>
        </el-form-item>
        <el-form-item label="净重" prop="standby2">
          <!--          <el-input v-model="form.standby2" placeholder="请输入净重" />-->
          <span>{{form.standby2}}</span>
        </el-form-item>
        <el-form-item label="丝车" prop="scid">
          <!--          <el-input v-model="form.standby2" placeholder="请输入净重" />-->
          <span>{{form.scid}}</span>
        </el-form-item>
        <el-form-item label="领料车间" prop="workshop">
          <span>{{form.workshop}}</span>
        </el-form-item>
        <!--        <el-form-item label="领料人" prop="recipient">-->
        <!--          <el-input v-model="form.recipient" placeholder="请输入领料人" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="领料时间" prop="collectTime">-->
        <!--          <el-input v-model="form.collectTime" placeholder="请输入领料时间" />-->
        <!--        </el-form-item>-->
                <el-form-item label="确认出库" prop="status">
                  <label>
                    <input type="radio"  value="3" >
                  </label>
                </el-form-item>

        <!--        <el-form-item label="确认时间" prop="confirmTime">-->
        <!--          <el-input v-model="form.confirmTime" placeholder="请输入确认时间" />-->
        <!--        </el-form-item>-->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormqr">确 定</el-button>
        <el-button @click="cancels">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog :title="title" :visible.sync="prinopens" width="800px" height="500px" append-to-body>
      <div class="print-preview" id="printSection">
        <div class="label-container">
          <div class="title">物料流转单</div>
          <div class="content">
            <div class="info-item">
              <span class="label">丝车号</span>
              <span class="value">{{form.scid}}</span>
            </div>
            <div class="info-item">
              <span class="label">机台号：</span>
              <span class="value">{{form.machineTool}}</span>
            </div>
            <div class="info-item">
              <span class="label">产品信息：</span>
              <span class="value">{{form.productName}} - {{form.productSpecifications}}</span>
            </div>
            <div class="info-item">
              <span class="label">色泽：</span>
              <span class="value">{{form.colours}}</span>
            </div>
            <div class="info-item">
              <span class="label">批号：</span>
              <span class="value">{{form.batchNumber}}</span>
            </div>
            <div class="info-item">
              <span class="label">卷数：</span>
              <span class="value">{{form.js}}</span>
            </div>
            <div class="info-item">
              <span class="label">净重：</span>
              <span class="value">{{form.standby2}} KG</span>
            </div>
            <div class="info-item">
              <span class="label">领料车间：</span>
              <span class="value">{{form.workshop}}</span>
            </div>
            <div class="info-item">
              <span class="label">送达人：</span>
              <span class="value-line"></span>
            </div>
            <div class="info-item">
              <span class="label">接收人：</span>
              <span class="value-line"></span>
            </div>
            <div class="info-item">
              <span class="label">日期：</span>
              <span class="value-line"></span>
              <span class="shift">(日班/夜班)</span>
            </div>
          </div>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" v-print="printViewInfo">打 印</el-button>
        <el-button @click="cancelprint">取 消</el-button>
      </div>
    </el-dialog>

   
  </div>
</template>

<script>
import { listLineSideCabin, getLineSideCabin, delLineSideCabin, addLineSideCabin, updateLineSideCabin } from "@/api/lineSideCabin/lineSideCabin";

export default {
  name: "LineSideCabin",
  data() {
    return {
      abc:false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 线边舱库存表格数据
      lineSideCabinList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,//领料
      opens:false,//确认领料
      prinopens:false,//打印详情
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        productNo: null,
        productName: null,
        productSpecifications: null,
        productType: null,
        batchNumber: null,
        colours: null,
        machineTool: null,
        js: null,
        status: null,
        standby: null,
        standby1: null,
        standby2: null,
        standby3: null,
        workshop: null,
        recipient: null,
        collectTime: null,
        confirm: null,
        confirmTime: null,
        scid:null,
        createTime:null,
        createBy:null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },
      msg: "打印",
      printViewInfo: {
        id: "printSection", //打印区域的唯一的id属性
        // popTitle: '配置页眉标题', // 页眉文字 （不设置时显示undifined）（页眉页脚可以在打印页面的更多设置的选项中取消勾选）
        // extraHead: '打印，印刷', // 最左上方的头部文字，附加在head标签上的额外标签，使用逗号分割
        preview: false, // 是否启动预览模式，默认是false （开启预览模式ture会占满整个屏幕，不建议开启，除非业务需要）
        // previewTitle: '预览的标题', // 打印预览的标题(预览模式preview为true时才显示)
        // previewPrintBtnLabel: '预览结束，开始打印', // 打印预览的标题下方的按钮文本，点击可进入打印(预览模式preview为true时才显示)
        zIndex: 20002, // 预览窗口的z-index，默认是20002，最好比默认值更高
        previewBeforeOpenCallback (that) { console.log('正在加载预览窗口！'); console.log(that.msg, this) 
        }, // 预览窗口打开之前的callback (预览模式preview为true时才执行) （that可以取到data里的变量值）
        previewOpenCallback () { console.log('已经加载完预览窗口，预览打开了！') }, // 预览窗口打开时的callback (预览模式preview为true时才执行)
        beforeOpenCallback () { console.log('开始打印之前！') }, // 开始打印之前的callback
        openCallback () { console.log('执行打印了！') 
        }, // 调用打印时的callback
        closeCallback () { console.log('关闭了打印工具！') ;}, // 关闭打印的callback(无法区分确认or取消)
        clickMounted () { console.log('点击v-print绑定的按钮了！')},
        // url: 'http://localhost:8080/', // 打印指定的URL，确保同源策略相同
        // asyncUrl (reslove) {
        //   setTimeout(() => {
        //     reslove('http://localhost:8080/')
        //   }, 2000)
        // },
        standard: '',
        extarCss: '',
        isDataLoaded: false,
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询线边舱库存列表 */
    getList() {
      this.loading = true;
      listLineSideCabin(this.queryParams).then(response => {
        this.lineSideCabinList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.opens = false;
      this.reset();
    },
    // 取消按钮
    cancels() {
      this.opens = false;
      this.reset();
    },
    // 取消按钮
    cancelprint() {
      this.prinopens = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        productNo: null,
        productName: null,
        productSpecifications: null,
        productType: null,
        batchNumber: null,
        colours: null,
        machineTool: null,
        js: null,
        status: null,
        standby: null,
        standby1: null,
        standby2: null,
        standby3: null,
        workshop: null,
        recipient: null,
        collectTime: null,
        confirm: null,
        confirmTime: null,
        scid:null,
        createTime:null,
        createBy:null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加线边舱库存";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getLineSideCabin(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.form.status=2;//领料状态
        this.title = "领料出库登记";
      });
    },
    //出库确认弹窗
    handleUpdateConfirm(row) {
      this.reset();
      const id = row.id || this.ids
      getLineSideCabin(id).then(response => {
        this.form = response.data;
        this.opens = true;
        this.title = "领料出库登记";
      });
    },
    /** 打印流转单 */
    handleUpdateConfirmPrint(row) {
      this.reset();
      const id = row.id || this.ids
      getLineSideCabin(id).then(response => {
        this.form = response.data;
        this.prinopens = true;
        this.title = "物料流转转打印";
      });
    },

    /** 确认出库提交按钮 */
    submitFormqr() {
      this.$refs["form"].validate(valid => {
        this.form.status=3;
        if (valid) {
          if (this.form.id != null) {
            updateLineSideCabin(this.form).then(response => {
              this.$modal.msgSuccess("提交成功");
              this.open = false;
              this.getList();
              this.cancels();
            });
          } else {
            addLineSideCabin(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateLineSideCabin(this.form).then(response => {
              this.$modal.msgSuccess("领取成功");
              this.open = false;
              this.getList();
            });
          } else {
            addLineSideCabin(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除线边舱库存编号为"' + ids + '"的数据项？').then(function() {
        return delLineSideCabin(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('lineSideCabin/lineSideCabin/export', {
        ...this.queryParams
      }, `lineSideCabin_${new Date().getTime()}.xlsx`)
    },
    /** 打印按钮操作 */
    handlePrint(row) {
      this.reset();
      const id = row.id || this.ids
      getLineSideCabin(id).then(response => {
        this.form = response.data;
        this.prinopens = true;
        this.title = "物料流转转打印";
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.print-preview {
  background: #fff;
  padding: 20px;
  
  .label-container {
    width: 100%;
    min-height: 280mm;
    border: 2px solid #000;
    padding: 15mm;
    box-sizing: border-box;
    
    .title {
      font-size: 22px;
      font-weight: bold;
      text-align: center;
      margin-bottom: 15mm;
      padding-bottom: 8px;
      border-bottom: 2px solid #000;
    }
    
    .content {
      padding: 0 10mm;
      
      .info-item {
        margin-bottom: 12mm;
        display: flex;
        align-items: center;
        min-height: 25px;
        
        .label {
          min-width: 85px;
          font-weight: bold;
        }
        
        .value {
          flex: 1;
          font-size: 16px;
        }
        
        .value-line {
          flex: 1;
          border-bottom: 1px solid #000;
          height: 20px;
          margin-right: 10px;
        }
        
        .shift {
          margin-left: 10px;
          font-size: 14px;
        }
      }
    }
  }
}

@media print {
  .print-preview {
    width: 210mm;
    height: 297mm;
    padding: 0;
    margin: 0 auto;
    
    .label-container {
      width: 100%;
      height: 100%;
      border: 2px solid #000;
      padding: 20mm;
      
      .title {
        font-size: 24px;
        margin-bottom: 20mm;
      }
      
      .content {
        padding: 0 15mm;
        
        .info-item {
          margin-bottom: 15mm;
          font-size: 16px;
          
          .label {
            min-width: 90px;
          }
          
          .value {
            font-size: 16px;
          }
          
          .value-line {
            height: 25px;
          }
        }
      }
    }
  }
  
  @page {
    size: A4;
    margin: 0;
  }
}
</style>
