小小儁爺
2025-11-17 37a4c07ff2ae84f2119bcfa6be6bc4b01904d63f
1.存货批量绑定工艺路线功能实现
已修改3个文件
742 ■■■■ 文件已修改
src/api/ProductModel.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/styles/global.css 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/materialManager/inventoryList.vue 717 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/ProductModel.js
@@ -133,3 +133,20 @@
  })
}
// 存货档案关联工艺(工艺路线/工序)查询多存货
export function TMaterielFileAssociationRouteList(data) {
  return request({
    url: 'ProductModel/TMaterielFileAssociationRouteList',
    method: 'post',
    data
  })
}
// 存货档案关联工艺(工艺路线或工序)提交多存货
export function SaveTMaterielFileList(data) {
  return request({
    url: 'ProductModel/SaveTMaterielFileList',
    method: 'post',
    data
  })
}
src/styles/global.css
@@ -180,8 +180,8 @@
高宽分别对应横竖滚动条的尺寸
*/
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
  width: 10px;
  height: 10px;
  /*background-color: white;*/
  background-color: #f8f8fa;
}
@@ -198,11 +198,11 @@
/*解决表格固定列时的压样式问题*/
.el-table__fixed {
  height: calc(100% - 7px) !important;
  height: calc(100% - 10px) !important;
}
.el-table__fixed-right {
  height: calc(100% - 12px) !important;
  height: calc(100% - 10px) !important;
}
.el-table__fixed-right::before,
src/views/materialManager/inventoryList.vue
@@ -62,16 +62,39 @@
          style=" width:calc(100% - 300px);"
        >
          <div class="bodyTopButtonGroup" style="justify-content: space-between">
            <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
            <el-button
              v-waves
              :size="buttonSize"
              type="primary"
              icon="el-icon-circle-plus-outline"
              @click="add('add')"
            >新增
            </el-button>
            <div style="display: flex">
              <el-button
                v-waves
                :size="buttonSize"
                type="success"
                icon="el-icon-help"
                :disabled="multipleSelection.length===0"
                @click="batchRouteClick"
              >批量绑定工艺
              </el-button>
              <el-button
                v-waves
                type="success"
                :size="buttonSize"
                icon="el-icon-download"
                @click="$router.push('./../systemSetting/dataImport?fileCode=8')"
              >导入
              </el-button>
              <el-button v-waves icon="el-icon-refresh-right" @click="syncERP">同步存货档案</el-button>
              <el-button
                v-waves
                :size="buttonSize"
                icon="el-icon-refresh-right"
                @click="syncERP"
              >同步存货档案
              </el-button>
            </div>
          </div>
@@ -79,19 +102,31 @@
            <el-form
              ref="form"
              :model="form"
              label-width="100px"
              :label-width="buttonSize==='medium'?'100px':'80px'"
              inline
              style="display: flex;"
            >
              <div class="elForm">
                <el-form-item label="存货编码" style=" display: flex;">
                  <el-input v-model="form.partcode" placeholder="请输入" style="width: 200px" />
                  <el-input
                    v-model="form.partcode"
                    placeholder="请输入"
                    :style="{minWidth:'100px',width:formItemWidth+'px'}"
                  />
                </el-form-item>
                <el-form-item label="存货名称" style=" display: flex;">
                  <el-input v-model="form.partname" placeholder="请输入" style="width: 200px" />
                  <el-input
                    v-model="form.partname"
                    placeholder="请输入"
                    :style="{minWidth:'100px',width:formItemWidth+'px'}"
                  />
                </el-form-item>
                <el-form-item label="存货规格" style=" display: flex;">
                  <el-input v-model="form.partspec" placeholder="请输入" style="width: 200px" />
                  <el-input
                    v-model="form.partspec"
                    placeholder="请输入"
                    :style="{minWidth:'100px',width:formItemWidth+'px'}"
                  />
                </el-form-item>
                <!--                <el-form-item label="用户编码" style=" display: flex;">-->
                <!--                  <el-input v-model="form.usercode" placeholder="请输入" style="width: 200px" />-->
@@ -118,12 +153,20 @@
              >
                <el-button
                  v-waves
                  :size="buttonSize"
                  type="primary"
                  icon="el-icon-search"
                  @click="getTMaterielData($refs.treeLeftRef.getCurrentNode())"
                >查询
                </el-button>
                <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
                <el-button
                  v-waves
                  :size="buttonSize"
                  type="info"
                  icon="el-icon-refresh"
                  @click="reset"
                >重置
                </el-button>
              </div>
            </el-form>
            <div
@@ -158,12 +201,21 @@
              highlight-current-row
              :header-cell-style="this.$headerCellStyle"
              :cell-style="this.$cellStyle"
              row-key="partcode"
              @sort-change="sortChange"
              @select="handleSelectionChange"
              @select-all="handleAllChange"
            >
              <!--            prop="RowNum"-->
              <el-table-column
                prop="rowNum"
                type="selection"
                width="50"
                :reserve-selection="true"
                fixed
              />
              <el-table-column
                prop="rowNum"
                width="70"
                fixed
                label="序号"
              />
@@ -190,68 +242,6 @@
                  {{ row.partspec ? row.partspec : '/' }}
                </template>
              </el-table-column>
<!--              <el-table-column-->
<!--                prop="priuserdefnvc1"-->
<!--                label="客户名称"-->
<!--                width="110"-->
<!--                sortable="custom"-->
<!--              >-->
<!--                <template slot-scope="{row}">-->
<!--                  {{ row.priuserdefnvc1 ? row.priuserdefnvc1 : '/' }}-->
<!--                </template>-->
<!--              </el-table-column>-->
<!--              <el-table-column-->
<!--                prop="priuserdefnvc6"-->
<!--                label="客户编码"-->
<!--                width="110"-->
<!--                sortable="custom"-->
<!--              >-->
<!--                <template slot-scope="{row}">-->
<!--                  {{ row.priuserdefnvc6 ? row.priuserdefnvc6 : '/' }}-->
<!--                </template>-->
<!--              </el-table-column>-->
<!--              <el-table-column-->
<!--                prop="priuserdefnvc2"-->
<!--                label="对内名称"-->
<!--                width="110"-->
<!--                sortable="custom"-->
<!--              >-->
<!--                <template slot-scope="{row}">-->
<!--                  {{ row.priuserdefnvc2 ? row.priuserdefnvc2 : '/' }}-->
<!--                </template>-->
<!--              </el-table-column>-->
<!--              <el-table-column-->
<!--                prop="priuserdefnvc3"-->
<!--                label="CTP日期"-->
<!--                width="110"-->
<!--                sortable="custom"-->
<!--              >-->
<!--                <template slot-scope="{row}">-->
<!--                  {{ row.priuserdefnvc3 ? row.priuserdefnvc3 : '/' }}-->
<!--                </template>-->
<!--              </el-table-column>-->
<!--              <el-table-column-->
<!--                prop="priuserdefnvc4"-->
<!--                label="钢刀编号"-->
<!--                width="110"-->
<!--                sortable="custom"-->
<!--              >-->
<!--                <template slot-scope="{row}">-->
<!--                  {{ row.priuserdefnvc4 ? row.priuserdefnvc4 : '/' }}-->
<!--                </template>-->
<!--              </el-table-column>-->
<!--              <el-table-column-->
<!--                prop="priuserdefnvc5"-->
<!--                label="盒型"-->
<!--                width="110"-->
<!--                sortable="custom"-->
<!--              >-->
<!--                <template slot-scope="{row}">-->
<!--                  {{ row.priuserdefnvc5 ? row.priuserdefnvc5 : '/' }}-->
<!--                </template>-->
<!--              </el-table-column>-->
              <el-table-column
                prop="idinventoryclassname"
                label="所属类别"
@@ -415,9 +405,14 @@
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisibleClassCancel">取 消</el-button>
          <el-button
            v-waves
            :size="buttonSize"
            @click="dialogVisibleClassCancel"
          >取 消</el-button>
          <el-button
            v-waves
            :size="buttonSize"
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
@@ -646,9 +641,14 @@
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisibleCancel">取 消</el-button>
          <el-button
            v-waves
            :size="buttonSize"
            @click="dialogVisibleCancel"
          >取 消</el-button>
          <el-button
            v-waves
            :size="buttonSize"
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
@@ -686,7 +686,7 @@
          :key="item.code"
          :style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme:'1px solid #eee'}"
          class="myCheckbox"
          @click="myCheckboxClick(item)"
          @click="myCheckboxClick(item,'single')"
        >
          <!--          <input-->
          <!--            class="myCheckboxInput"-->
@@ -706,7 +706,7 @@
            :name="item.name"
            :label="item.name"
            :checked="item.isSelected2"
            @change="myCheckboxInputClick(item)"
            @change="myCheckboxInputClick(item,'single')"
          />
          <div class="myCheckboxInputLabel">{{ item.name }}</div>
@@ -785,10 +785,15 @@
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="routeDialogVisibleCancel">取 消</el-button>
          <el-button
            v-waves
            :size="buttonSize"
            @click="routeDialogVisibleCancel"
          >取 消</el-button>
          <el-button
            v-waves
            type="primary"
            :size="buttonSize"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="routeDialogVisibleConfirm"
@@ -900,9 +905,14 @@
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="stepDialogVisibleCancel">取 消</el-button>
          <el-button
            v-waves
            :size="buttonSize"
            @click="stepDialogVisibleCancel"
          >取 消</el-button>
          <el-button
            v-waves
            :size="buttonSize"
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
@@ -911,6 +921,290 @@
        </div>
      </span>
    </el-dialog>
    <!--    批量绑定工艺路线对话框-->
    <el-dialog
      v-el-drag-dialog
      :close-on-click-modal="false"
      title="批量关联工艺路线"
      :visible.sync="dialogVisibleBatchRoute"
      width="1430px"
      top="5vh"
      class="dialogVisibleRoute"
      @closed="handleCloseBatchRoute"
      @close="handleCloseBatchRoute"
    >
      <div style="display: flex">
        <div style="width:600px;height: 600px;overflow: auto;margin-right: 30px">
          <div style="margin-bottom: 10px;">
            <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 产品名称:
          </div>
          <div class="batchPortCode">
            <el-button
              v-for="(i,index) in batchRouteData"
              :key="i.partcode"
              :type="!i.defalutroutecode?'warning':'success'"
              :plain="batchRouteDataSelectedIndex!==index"
              style="margin-bottom: 10px"
              @click="partcodeSelected(i,index)"
            >{{ i.partname }}
            </el-button>
            <!--            <el-button v-for="i in 100" type="success" plain style="margin-bottom: 10px">成功按钮{{ i }}</el-button>-->
          </div>
        </div>
        <div style="width:calc(100% - 460px)">
          <div style="margin-bottom: 10px">
            <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 工艺路线集合
          </div>
          <div class="myCheckboxGroup">
            <!--            v-for="item in batchRouteDataSelected"-->
            <div
              v-for="item in batchRouteDataSelected"
              :key="item.routecode"
              class="myCheckbox"
              :style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme:'1px solid #eee'}"
              @click="myCheckboxClick(item,'batch')"
            >
              <!--          <input-->
              <!--            class="myCheckboxInput"-->
              <!--            type="checkbox"-->
              <!--            :value="item.code"-->
              <!--            :name="item.name"-->
              <!--            :style="{color:item.isSelected2?'#42b983':'#fff'}"-->
              <!--            @click="myCheckboxInputClick(item)"-->
              <!--          >{{ item.name }}-->
              <!--            父子点击事件不影响-->
              <!--            onClick="event.cancelBubble = true"-->
              <el-checkbox
                :key="item.routecode"
                v-model="item.isSelected2"
                :checked="item.isSelected2"
                class="myCheckboxInput"
                :value="item.routecode"
                :name="item.routename"
                :label="item.routename"
                @change="myCheckboxInputClick(item,'batch')"
              />
              <div class="myCheckboxInputLabel">{{ item.routename }}</div>
            </div>
          </div>
          <el-divider />
          <div>
            <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 默认工艺路线
          </div>
          <div style="margin-top: 20px">
            <el-select
              v-model="defaultroute_code"
              filterable
              style="width: 200px;"
              placeholder="请选择"
              class="defaultroute_code"
              @change="batchRouteChange"
            >
              <el-option
                v-for="item in defaultroute_codeArr"
                :key="item.routecode"
                :label="item.routename"
                :value="item.routecode"
              />
            </el-select>
          </div>
          <el-divider />
          <div style="margin-bottom: 10px">
            <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 工序列表
          </div>
          <div style="overflow-y: scroll">
            <el-table
              ref="projectTableData"
              :data="projectTableData"
              border
              height="280"
              :row-class-name="tableRowClassName"
              highlight-current-row
              :header-cell-style="this.$headerCellStyle"
              :cell-style="this.$cellStyle"
            >
              <el-table-column
                prop="seq"
                width="100"
                label="工序序号"
                fixed
              />
              <el-table-column
                prop="stepcode"
                show-tooltip-when-overflow
                label="工序编码"
              />
              <el-table-column
                prop="stepname"
                label="工序名称"
                show-tooltip-when-overflow
              />
              <el-table-column
                prop="enable"
                label="启用状态"
                show-tooltip-when-overflow
                fixed="right"
              >
                <template slot-scope="{row}">
                  <div v-if="row.enable==='Y'">
                    <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
                    是
                  </div>
                  <div v-if="row.enable==='N'">
                    <i class="el-icon-info" style="margin-right: 2px" />
                    否
                  </div>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button
            v-waves
            :size="buttonSize"
            @click="batchRouteDialogVisibleCancel"
          >取 消</el-button>
          <el-button
            v-waves
            type="primary"
            :size="buttonSize"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="batchRouteDialogVisibleConfirm"
          >确 定</el-button>
        </div>
      </span>
    </el-dialog>
    <!--    按工艺走   批量绑定工艺  按工序走对话框-->
    <el-dialog
      v-el-drag-dialog
      :close-on-click-modal="false"
      title="关联工序"
      :visible.sync="dialogVisibleBatchStep"
      width="1430px"
      top="5vh"
      class="dialogVisibleStep"
      @closed="handleCloseBatchStep"
      @close="handleCloseBatchStep"
    >
      <div style="display: flex">
        <div style="width:600px;height: 600px;overflow: auto;margin-right: 30px">
          <div style="margin-bottom: 10px;">
            <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 产品名称:
          </div>
          <div class="batchPortCode">
            <el-button
              v-for="(i,index) in batchRouteData"
              :key="i.partcode"
              :type="i.children.length===0?'warning':'success'"
              :plain="batchRouteDataSelectedIndex!==index"
              style="margin-bottom: 10px"
              @click="partcodeStepSelected(i,index)"
            >{{ i.partname }}
            </el-button>
          </div>
        </div>
        <div>
          <div style="display: flex;align-items: center">
            <div style="font-weight: bolder">工序选择:</div>
            <!--            <el-drag-select-->
            <el-select
              v-model="batchStepSelectedValue"
              style="width:570px;"
              multiple
              placeholder="请选择相对应工序"
              @change="batchStepSelectedValueChange"
            >
              <el-option
                v-for="item in stepSelectArr"
                :key="item.stepcode"
                :label="item.stepname"
                :value="item.stepcode"
              />
            </el-select>
          </div>
          <el-table
            ref="stepTableDataRef"
            :data="stepTableData"
            border
            :row-class-name="tableRowClassName"
            height="300"
            style="width: 100%;margin-top: 15px;"
            highlight-current-row
            :header-cell-style="this.$headerCellStyle"
            :cell-style="this.$cellStyle"
            row-key="stepcode"
          >
            <el-table-column
              type="index"
              label="序号"
              width="50"
            />
            <el-table-column
              prop="step_code"
              show-tooltip-when-overflow
              label="工序编码"
            />
            <el-table-column
              prop="step_name"
              label="工序名称"
              show-tooltip-when-overflow
            />
            <el-table-column
              label="操作"
              width="120"
            >
              <template slot-scope="{row}">
                <div class="operationClass">
                  <!--                  <i-->
                  <!--                    class="el-icon-rank"-->
                  <!--                    :style="{color:$store.state.settings.theme}"-->
                  <!--                    style="cursor: move"-->
                  <!--                  />-->
                  <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                    <i
                      class="el-icon-delete"
                      :style="{color:$store.state.settings.theme}"
                      style="margin-left: 15px;"
                      @click="batchStepDel(row)"
                    />
                  </el-tooltip>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button
            v-waves
            :size="buttonSize"
            @click="batchStepDialogVisibleCancel"
          >取 消</el-button>
          <el-button
            v-waves
            :size="buttonSize"
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="batchStepDialogVisibleConfirm"
          >确 定</el-button>
        </div>
      </span>
    </el-dialog>
  </div>
</template>
@@ -920,12 +1214,12 @@
import { validateCode } from '@/utils/global'
import elDragDialog from '@/directive/el-drag-dialog'
import {
  SaveTMaterielFile,
  SaveTMaterielFile, SaveTMaterielFileList,
  TMaterielAddUpdate,
  TMaterielClassTree,
  TMaterielClassTreeAddUpdate,
  TMaterielClassTreeDelete,
  TMaterielData, TMaterielDelete, TMaterielFileAssociationRoute
  TMaterielData, TMaterielDelete, TMaterielFileAssociationRoute, TMaterielFileAssociationRouteList
} from '@/api/ProductModel'
import arrayToTree from 'array-to-tree'
import { StepData, UnitSerch, WareHouse } from '@/api/GeneralBasicData'
@@ -946,6 +1240,8 @@
      isExpandForm: false,
      mainHeight: 0,
      tableHeight: 0,
      buttonSize: '',
      formItemWidth: 0,
      operation: '',
      treeLeft: [
@@ -1056,7 +1352,16 @@
      stepTableData: [],
      sortable: null,
      stepSelectArr: [], // 工序下拉数据
      stepSelectedValue: [] // 工序下拉选中值
      stepSelectedValue: [], // 工序下拉选中值
      multipleSelection: [], // 用于批量绑定工艺路线
      dialogVisibleBatchRoute: false,
      batchRouteData: [], // 批量工艺路线产品名称
      batchRouteDataSelected: [], // 左侧产品选中值 带出右侧工艺路线
      batchRouteDataSelectedIndex: 0, // 左侧产品选中值 带出右侧工艺路线
      dialogVisibleBatchStep: false,
      batchStepSelectedValue: []
    }
  },
  watch: {
@@ -1081,12 +1386,6 @@
    }
  },
  activated() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
    this.getTMaterielClassTree()
    this.getSelectApi()
  },
  created() {
  },
@@ -1185,6 +1484,199 @@
      return 'custom-row'
    },
    // 批量绑定工序
    handleCloseBatchStep() {
    },
    batchStepSelectedValueChange(val) {
      console.log(val)
      this.batchRouteData[this.batchRouteDataSelectedIndex].children = [{ Data: [] }]
      val.forEach(i => {
        this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.push(
          {
            step_code: i,
            step_name: this.stepSelectArr.find(j => j.stepcode === i).stepname
            // stepprice: arrStepcode.includes(i) ? arr.find(j => j.stepcode === i).stepprice : 0
          }
        )
      })
      this.stepTableData = this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data
    },
    batchStepDel(row) {
      const index = this.batchStepSelectedValue.findIndex(i => i === row.step_code)
      this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.splice(index, 1)
      if (this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.length > 0) {
        this.batchStepSelectedValue = this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.map(i => i.step_code)
      } else {
        this.batchStepSelectedValue = []
      }
    },
    batchStepDialogVisibleCancel() {
      this.dialogVisibleBatchStep = false
    },
    async  batchStepDialogVisibleConfirm() {
      let flag = false
      const data = []
      this.batchRouteData.forEach(i => {
        if (i.children.length === 0 || i.children[0].Data.length === 0) {
          flag = true
        }
        const children = []
        if (i.children.length > 0 && i.children[0].Data.length > 0) {
          i.children[0].Data.forEach((it, index) => {
            children.push({
              'code': it.step_code,
              'name': it.step_name,
              'seq': index + 1,
              'isbott': index === 0 ? 'Y' : 'N',
              'isend': index === i.children[0].Data.length - 1 ? 'Y' : 'N'
            })
          })
        }
        data.push({
          partcode: i.partcode,
          'defaultroute_code': '',
          children
        })
      })
      if (flag) {
        return this.$message('有存货未绑定工艺,请先绑定!')
      }
      this.$store.state.app.buttonIsDisabled = true
      const res = await SaveTMaterielFileList(data)
      if (res.code === '200') {
        this.$store.state.app.buttonIsDisabled = false
        this.dialogVisibleBatchStep = false
        this.$message.success('保存成功!')
        // await this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode())
        this.$refs.tableDataRef.clearSelection() // 清空复选框选择
        await this.getTMaterielClassTree()
      }
    },
    partcodeStepSelected(val, index) {
      this.batchRouteDataSelectedIndex = index
      this.batchStepSelectedValue = this.batchRouteData[this.batchRouteDataSelectedIndex].children.length > 0 ? this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.map(i => i.step_code) : ''
      this.stepTableData = this.batchRouteData[this.batchRouteDataSelectedIndex].children.length > 0 ? this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data : []
    },
    // 批量绑定工艺路线
    async batchRouteClick() {
      const res = await TMaterielFileAssociationRouteList(this.multipleSelection.map(i => i.partcode))
      if (res.code === '200') {
        if (this.mesSetting.route) { // 按工艺路线
          this.batchRouteData = res.data
          this.batchRouteDataSelected = this.batchRouteData[0].children
          this.batchRouteDataSelectedIndex = 0
          this.batchRouteData[this.batchRouteDataSelectedIndex].children.forEach((item, index) => {
            item.isSelected1 = false
            item.isSelected2 = false
            if (index === 0) {
              item.isSelected1 = true
              this.projectTableData = item.Data
            }
            // if (item.flag === 'Y' || item.flag) {
            if (item.flag === 'Y') {
              item.isSelected2 = true
              this.$nextTick(() => {
                $('input:checkbox').eq(index).prop('checked', true)
              })
            }
          })
          this.defaultroute_codeArr = this.batchRouteData[this.batchRouteDataSelectedIndex].children.filter(item => item.isSelected2)
          this.defaultroute_code = this.batchRouteData[this.batchRouteDataSelectedIndex].defalutroutecode
          this.dialogVisibleBatchRoute = true
        }
        if (!this.mesSetting.route) { // 按工序
          this.batchRouteData = res.data
          this.batchRouteDataSelectedIndex = 0
          this.batchStepSelectedValue = this.batchRouteData[this.batchRouteDataSelectedIndex].children.length > 0 ? this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data.map(i => i.step_code) : ''
          this.stepTableData = this.batchRouteData[this.batchRouteDataSelectedIndex].children.length > 0 ? this.batchRouteData[this.batchRouteDataSelectedIndex].children[0].Data : []
          this.dialogVisibleBatchStep = true
        }
      }
    },
    batchRouteDialogVisibleCancel() {
      this.dialogVisibleBatchRoute = false
    },
    async batchRouteDialogVisibleConfirm() {
      const data = []
      const descr = []
      this.batchRouteData.forEach(i => {
        if (!i.defalutroutecode) {
          descr.push(i.partcode + '  ' + i.partname)
        }
        const children = []
        if (i.children && i.children.length) {
          i.children.forEach(it => {
            if (it.flag === 'Y' || it.flag === true) {
              children.push({
                code: it.routecode,
                name: it.routename
              })
            }
          })
        }
        data.push({ partcode: i.partcode, defaultroute_code: i.defalutroutecode, children })
      })
      if (descr.length > 0) {
        // return this.$message(descr.toString() + '未绑定默认工艺路线,请先绑定!')
        return this.$message('有存货未绑定默认工艺路线,请先绑定!')
      }
      this.$store.state.app.buttonIsDisabled = true
      const res = await SaveTMaterielFileList(data)
      if (res.code === '200') {
        this.$store.state.app.buttonIsDisabled = false
        this.dialogVisibleBatchRoute = false
        this.$message.success('提交成功!')
        this.$refs.tableDataRef.clearSelection() // 清空复选框选择
        await this.getTMaterielClassTree()
      }
    },
    handleCloseBatchRoute() {
      this.defaultroute_code = ''
      this.defaultroute_codeArr = []
      this.batchRouteData = []
    },
    partcodeSelected(val, index) {
      this.batchRouteDataSelected = val.children
      this.batchRouteDataSelectedIndex = index
      this.batchRouteData[this.batchRouteDataSelectedIndex].children.forEach((item, index) => {
        item.isSelected1 = false
        item.isSelected2 = false
        if (index === 0) {
          item.isSelected1 = true
          this.projectTableData = item.Data
        }
        if (item.flag === 'Y' || item.flag === true) {
          item.isSelected2 = true
          this.$nextTick(() => {
            $('input:checkbox').eq(index).prop('checked', true)
          })
        }
      })
      this.defaultroute_codeArr = this.batchRouteData[this.batchRouteDataSelectedIndex].children.filter(item => item.isSelected2)
      this.defaultroute_code = this.batchRouteData[this.batchRouteDataSelectedIndex].defalutroutecode
      // this.$forceUpdate()
    },
    batchRouteChange(val) {
      this.batchRouteData[this.batchRouteDataSelectedIndex].defalutroutecode = val
    },
    // 这里是做单项选择与单项反选的 选择:打勾或取消
    handleSelectionChange(selected, row) {
      this.multipleSelection = selected
    },
    // 全选、取消全选(原理同上面的单选)
    handleAllChange(selected) {
      this.multipleSelection = selected
    },
    /* 点击关联工艺路线模块*/
    // 工艺路线点击
    routeClick(row) {
@@ -1281,19 +1773,28 @@
      }
    },
    // 大盒子点击事件
    myCheckboxClick(val) {
    myCheckboxClick(val, type) {
      console.log(val, 1)
      if (type === 'single') {
      this.dialogFormRoute.routeOperationArr.forEach(item => {
        item.isSelected1 = val.code === item.code
      })
      }
      if (type === 'batch') {
        this.batchRouteData[this.batchRouteDataSelectedIndex].children.forEach(item => {
          item.isSelected1 = val.routecode === item.routecode
        })
      }
      this.projectTableData = val.Data
    },
    // 小盒子点击事件
    myCheckboxInputClick(val) {
      // console.log(val, 2)
    myCheckboxInputClick(val, type) {
      val.isSelected2 = !!val.isSelected2
      console.log(val, 2)
      if (type === 'single') {
      this.dialogFormRoute.routeOperationArr.forEach((item, index) => {
        if (val.code === item.code) {
          item.flag = !item.flag
@@ -1303,6 +1804,25 @@
        this.defaultroute_code = ''
      }
      this.defaultroute_codeArr = this.dialogFormRoute.routeOperationArr.filter(item => item.isSelected2)
      }
      if (type === 'batch') {
        this.batchRouteData[this.batchRouteDataSelectedIndex].children.forEach(item => {
          if (val.routecode === item.routecode) {
            item.flag = val.isSelected2
          }
        })
        if (val.routecode === this.defaultroute_code) {
          this.defaultroute_code = ''
          this.batchRouteData[this.batchRouteDataSelectedIndex].defalutroutecode = ''
        }
        this.defaultroute_codeArr = this.batchRouteData[this.batchRouteDataSelectedIndex].children.filter(item => item.isSelected2)
      }
      this.$forceUpdate()
      console.log(JSON.parse(JSON.stringify(this.batchRouteData[this.batchRouteDataSelectedIndex].children)), 999)
      console.log(JSON.parse(JSON.stringify(this.batchRouteData)), 998)
    },
    async getSelectApi() {
@@ -1357,6 +1877,13 @@
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 280
        this.formItemWidth = window.innerWidth / 10
        if (window.innerWidth <= 1500 || window.innerHeight <= 900) {
          this.buttonSize = 'small'
        } else {
          this.buttonSize = 'medium'
        }
        this.$refs.tableDataRef.doLayout()
      })
    },
@@ -1771,4 +2298,16 @@
  align-items: center !important;
}
.batchPortCode {
  display: flex;
  flex-wrap: wrap;
  margin-left: -10px;
}
.batchPortCode {
  ::v-deep button {
    margin-left: 10px !important;
  }
}
</style>