<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="编排对照编码"  prop="arrangeRuleCode">
        <el-input
          v-model="queryParams.arrangeRuleCode"
          placeholder="请输入编排对照编码"

          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="产品类别名称" width="150" prop="itemTypeName">
        <el-input
          v-model="queryParams.itemTypeName"
          placeholder="请输入产品类别名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工序名称" prop="processName">
        <el-input
          v-model="queryParams.processName"
          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="['pro:ProWorkOrderArrangeRule: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="['pro:ProWorkOrderArrangeRule: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="['pro:ProWorkOrderArrangeRule: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="['pro:ProWorkOrderArrangeRule:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="ProWorkOrderArrangeRuleList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="编排对照编码" align="center" width="150" prop="arrangeRuleCode" />
      <el-table-column label="产品类别名称" align="center" width="150" prop="itemTypeName" />
      <el-table-column label="工序名称" align="center" prop="processName" />
      <el-table-column label="交期间隔天数" align="center" prop="requestDateInterval" />
      <el-table-column label="交期间隔最小数量" align="center" prop="requestDateIntervalMinNum" />
      <el-table-column label="工艺路线" align="center" prop="routeCode" >
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.routeCode"/>
        </template>
      </el-table-column>
        <el-table-column label="工艺要求" align="center" prop="routeDesc" >
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.routeDesc"/>
        </template>
      </el-table-column>
      <el-table-column label="品牌" align="center" prop="brandCode" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.brandCode"/>
        </template>
      </el-table-column>
      <el-table-column label="产品编码" align="center" prop="itemCode" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.itemCode"/>
        </template>
      </el-table-column>
      <el-table-column label="长度" align="center" prop="length" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.length"/>
        </template>
      </el-table-column>
      <el-table-column label="宽度" align="center" prop="width" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.width"/>
        </template>
      </el-table-column>
        <el-table-column label="产品材料" align="center" prop="productMaterial" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.productMaterial"/>
        </template>
      </el-table-column>
       <el-table-column label="原材料编码" width="150" align="center" prop="processCode" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.processCode"/>
        </template>
      </el-table-column>
    <el-table-column label="上下间距" align="center" prop="spacing" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.spacing"/>
        </template>
      </el-table-column>
      <el-table-column label="正面颜色" align="center" prop="frontImg" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.frontImg"/>
        </template>
      </el-table-column>
        <el-table-column label="版具" align="center" prop="toolList" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.toolList"/>
        </template>
      </el-table-column>
       <el-table-column label="形状" align="center" prop="shape" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.shape"/>
        </template>
      </el-table-column>
        <el-table-column label="Inlay" align="center" prop="inlay" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.shape"/>
        </template>
      </el-table-column>
       <el-table-column label="吹膜宽度" align="center" prop="blownFilmWidth" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.blownFilmWidth"/>
        </template>
      </el-table-column>
      <el-table-column label="吹膜厚度" align="center" prop="blownFilmThickness" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.blownFilmThickness"/>
        </template>
      </el-table-column>
      <el-table-column label="印刷尺寸" align="center" prop="printingWidth" >
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.printingWidth"/>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="150px" fixed="right" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['pro:ProWorkOrderArrangeRule:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['pro:ProWorkOrderArrangeRule:remove']"
          >删除</el-button>
        </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="960px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="110px">
        <el-row>
          <el-col :span="12">
        <el-form-item label="编排对照编码" prop="arrangeRuleCode">
          <el-input
          v-model="form.arrangeRuleCode"
          placeholder="自动生成"
          disabled
          />
        </el-form-item>
          </el-col>
          <el-col :span="12">
        <el-form-item label="产品类别" prop="itemTypeName">
          <el-input v-model="form.itemTypeName" placeholder="请输入产品类别" >
              <el-button
                  slot="append"
                  icon="el-icon-search"
                  @click="handleBrandSelect"
                ></el-button>
          </el-input>
             <BrandSelect
              ref="brSelect"
              @onSelected="onBrandSelected"
            ></BrandSelect>
        </el-form-item>
          </el-col>
        </el-row>
        <el-row>
        <el-col :span="12">
        <el-form-item label="工序名称" prop="processName">
          <el-input v-model="form.processName" placeholder="请输入工序名称" >
            <el-button
                  slot="append"
                  icon="el-icon-search"
                  @click="handleProcess"
                ></el-button>
           </el-input>
                 <ProcessSelect
              ref="brSelectpro"
              @onSelected="onBrandProcess"
            ></ProcessSelect>
        </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="交期间隔天数" prop="requestDateInterval">
            <el-input-number v-model="form.requestDateInterval" :min="0" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="交期间隔最小数量" prop="requestDateIntervalMinNum" label-width="130px">
            <el-input-number v-model="form.requestDateIntervalMinNum" :min="0" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
      <el-form-item label="工艺路线" label-width="120px">
              <el-radio-group v-model="form.routeCode" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.routeCode" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
        </el-col>
        </el-row>
        <el-row>
           <el-col :span="12">
            <el-form-item label="工艺要求" label-width="120px">
              <el-radio-group v-model="form.routeDesc" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.routeDesc" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
           </el-col>
           <el-col :span="12">
            <el-form-item label="品牌" label-width="120px">
              <el-radio-group v-model="form.brandCode" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.brandCode" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
           </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
                <el-form-item label="产品编码" label-width="120px">
              <el-radio-group v-model="form.itemCode" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.itemCode" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-form-item label="长度" label-width="120px">
              <el-radio-group v-model="form.length" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.length" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
      <el-form-item label="宽度" label-width="120px">
              <el-radio-group v-model="form.width" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.width" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
     <el-form-item label="产品材料" label-width="120px">
              <el-radio-group v-model="form.productMaterial" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.productMaterial" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
     <el-form-item label="原材料编码" label-width="120px">
              <el-radio-group v-model="form.processCode" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.processCode" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-form-item label="上下间距" label-width="120px">
              <el-radio-group v-model="form.spacing" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.spacing" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
     <el-form-item label="正面颜色" label-width="120px">
              <el-radio-group v-model="form.frontImg" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.frontImg" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
         <el-form-item label="版具" label-width="120px">
              <el-radio-group v-model="form.toolList" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.toolList" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
    <el-form-item label="形状" label-width="120px">
              <el-radio-group v-model="form.shape" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.shape" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
    <el-form-item label="Inlay" label-width="120px">
              <el-radio-group v-model="form.inlay" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.inlay" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="吹膜宽度" label-width="120px">
              <el-radio-group v-model="form.blownFilmWidth" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.blownFilmWidth" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
             <el-form-item label="吹膜厚度" label-width="120px">
              <el-radio-group v-model="form.blownFilmThickness" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.blownFilmThickness" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item label="印刷尺寸" label-width="120px">
              <el-radio-group v-model="form.printingWidth" disabled v-if="optType=='view'">
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.printingWidth" v-else>
                <el-radio
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </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>

<script>

import {
listProWorkOrderArrangeRule,
getProWorkOrderArrangeRule,
delProWorkOrderArrangeRule,
addProWorkOrderArrangeRule,
updateProWorkOrderArrangeRule } from "@/api/mes/pro/arrangeRule";
import { genCode } from "@/api/system/autocode/rule";
import BrandSelect from "@/components/itemType/single.vue";
import ProcessSelect from "@/components/process/taskSelectSingle.vue";
export default {
  components: {BrandSelect,ProcessSelect},
  name: "ProWorkOrderArrangeRule",
  dicts: ["sys_yes_no"],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 编排单对照表表格数据
      ProWorkOrderArrangeRuleList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        arrangeRuleCode: null,
        itemTypeId: null,
        itemTypeName: null,
        processId: null,
        processName: null,
        routeCode: null,
        routeDesc: null,
        brandCode: null,
        itemCode: null,
        length: null,
        width: null,
        productMaterial: null,
        processCode: null,
        spacing: null,
        frontImg: null,
        toolList: null,
        shape: null,
        inlay: null,
        blownFilmWidth: null,
        blownFilmThickness: null,
        printingWidth: null
        },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        arrangeRuleCode: [
          { required: true, message: "编排对照编码不能为空", trigger: "blur" }
        ],        itemTypeId: [
          { required: true, message: "产品类别不能为空", trigger: "blur" }
        ],        itemTypeName: [
          { required: true, message: "产品类别名称不能为空", trigger: "blur" }
        ],      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询编排单对照表列表 */
    getList() {
      this.loading = true;
      listProWorkOrderArrangeRule(this.queryParams).then(response => {
        this.ProWorkOrderArrangeRuleList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    //代码生产器
    gCode(){
      genCode("ARRANGE_RULE").then((response) => {
         this.form.arrangeRuleCode = response;
      });
    },
   // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        arrangeRuleId: null,
        arrangeRuleCode: null,
        itemTypeId: null,
        itemTypeName: null,
        processId: null,
        processName: null,
        routeCode: null,
        routeDesc: null,
        brandCode: null,
        itemCode: null,
        length: null,
        width: null,
        requestDateIntervalMinNum: 0,
        requestDateInterval: 0,
        productMaterial: null,
        processCode: null,
        spacing: null,
        frontImg: null,
        toolList: null,
        shape: null,
        inlay: null,
        blownFilmWidth: null,
        blownFilmThickness: null,
        printingWidth: null
        };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    handleBrandSelect(){
      this.$refs.brSelect.showFlag = true;
    },
    onBrandSelected(row){
     if (row != undefined && row != null) {
        this.form.itemTypeId = row.itemTypeId;
        this.form.itemTypeName = row.itemTypeName;
      }
    },


    handleProcess(){
      this.$refs.brSelectpro.showFlag = true;
    },
    onBrandProcess(row){
     if (row != undefined && row != null) {
         this.form.processId = row.processId;
        this.form.processName = row.processName;

      }
    },


    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.arrangeRuleId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加编排单对照表";
      this.gCode();
      this.optType = "add";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const arrangeRuleId = row.arrangeRuleId || this.ids
      getProWorkOrderArrangeRule(arrangeRuleId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改编排单对照表";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.arrangeRuleId != null) {
            updateProWorkOrderArrangeRule(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addProWorkOrderArrangeRule(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const arrangeRuleIds = row.arrangeRuleId || this.ids;
      this.$modal.confirm('是否确认删除编排单对照表编号为"' + arrangeRuleIds + '"的数据项？').then(function() {
        return delProWorkOrderArrangeRule(arrangeRuleIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('pro/ProWorkOrderArrangeRule/export', {
        ...this.queryParams
      }, `ProWorkOrderArrangeRule_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
