loulijun2021
2023-01-06 c054516a38a2613a4e7399ba62694fbd99a606fe
src/views/zzmx/gxdy.vue
@@ -1,13 +1,19 @@
<template>
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <div style="padding: 10px 5px 0 0">
      <div class="bodyTopButtonGroup">
        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <!--        <el-button type="primary" icon="el-icon-upload2" @click="upload">导入</el-button>-->
      </div>
      <div class="bodyTopFormGroup">
        <el-form
          ref="form"
          :model="form"
          label-width="80px"
          label-width="100px"
          inline
          style="display: flex;justify-content: space-between"
          style="display: flex;"
        >
          <div class="elForm">
            <el-form-item label="工序编码" style=" display: flex;">
@@ -17,7 +23,13 @@
              <el-input v-model="form.stepname" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="启用状态" style=" display: flex;">
              <el-select v-model="form.enable" :popper-append-to-body="false" style="width: 200px" placeholder="请选择">
              <el-select
                v-model="form.enable"
                filterable
                :popper-append-to-body="false"
                style="width: 200px"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in enableArr"
                  :key="item.code"
@@ -29,6 +41,7 @@
            <el-form-item label="工序类型" style=" display: flex;">
              <el-select
                v-model="form.steptypecode"
                filterable
                :popper-append-to-body="false"
                style="width: 200px"
                placeholder="请选择"
@@ -41,29 +54,43 @@
                />
              </el-select>
            </el-form-item>
            <el-form-item label="创建人员" style=" display: flex;">
            <el-form-item v-show="isExpandForm" label="创建人员" style=" display: flex;">
              <el-input v-model="form.createuser" style="width: 200px" placeholder="请输入" />
            </el-form-item>
          </div>
          <div style="display: flex;align-items: start;margin-top: 5px;z-index: 2">
          <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}">
            <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
            <el-button type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          </div>
        </el-form>
        <div
          class="bodyTopFormExpand"
        >
          <svg-icon
            v-show="mouseHoverType==='mouseout'"
            style="cursor: pointer"
            :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"
            @mouseenter="mouseHoverType=$event.type"
          />
          <svg-icon
            v-show="mouseHoverType==='mouseenter'"
            style="cursor: pointer"
            :icon-class="!isExpandForm?'doubleDown':'doubleUp'"
            @click="isExpandForm=!isExpandForm"
            @mouseout="mouseHoverType=$event.type"
          />
        </div>
      </div>
      <el-divider />
      <div style="margin-left: 10px;display: flex">
        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <el-button type="primary" icon="el-icon-upload2" @click="upload">导入</el-button>
      </div>
      <el-divider />
      <div class="elTableDiv">
        <el-table
          ref="tableDataRef"
          class="tableFixed"
          :data="tableData"
          :height="tableHeight"
          :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
          border
          stripe
          :style="{width: 100+'%',height:tableHeight+'px',}"
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
@@ -77,19 +104,26 @@
            prop="RowNum"
            width="50"
            label="序号"
            fixed
          />
          <el-table-column
            prop="stepcode"
            show-tooltip-when-overflow
            label="工序编码"
            min-width="150"
            sortable="custom"
          />
          <el-table-column
            prop="stepname"
            min-width="150"
            show-tooltip-when-overflow
            label="工序名称"
            sortable="custom"
          />
          <el-table-column
            prop="flwtype"
            min-width="150"
            show-tooltip-when-overflow
            label="工序类型"
            sortable="custom"
          >
@@ -101,54 +135,97 @@
          </el-table-column>
          <el-table-column
            prop="descr"
            show-tooltip-when-overflow
            label="工序描述"
            sortable="custom"
          />
          <el-table-column
            prop="enable"
            label="启用状态"
            min-width="180"
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.enable==='Y'">是</div>
              <div v-if="row.enable==='N'">否</div>
              <div v-if="row.descr">{{ row.descr }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="enable"
            label="启用状态"
            show-tooltip-when-overflow
            sortable="custom"
            width="110"
          >
            <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-column
            prop="lm_user"
            label="创建人员"
            show-tooltip-when-overflow
            width="110"
            sortable="custom"
          />
          <el-table-column
            prop="lm_date"
            label="创建时间"
            show-tooltip-when-overflow
            width="160"
            sortable="custom"
          />
          <el-table-column
            label="关联工作站"
            prop="is_eqp"
            show-tooltip-when-overflow
            width="110"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <i class="el-icon-share" @click="workClick(row)" />
                <i v-if="row.is_eqp==='Y'" :style="{color:$store.state.settings.theme}" class="el-icon-share" @click="workClick(row)" />
                <i
                  v-if="row.is_eqp==='N'"
                  class="el-icon-share"
                  style="color: rgb(180 ,181, 185)"
                  @click="workClick(row)"
                />
              </div>
            </template>
          </el-table-column>
          <el-table-column
            label="关联缺陷"
            prop="is_defect"
            show-tooltip-when-overflow
            width="110"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <i class="el-icon-share" @click="defectClick(row)" />
                <i v-if="row.is_defect==='Y'" :style="{color:$store.state.settings.theme}" class="el-icon-share" @click="defectClick(row)" />
                <i
                  v-if="row.is_defect==='N'"
                  class="el-icon-share"
                  style="color:rgb(180 ,181, 185);"
                  @click="defectClick(row)"
                />
              </div>
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            fixed="right"
            width="120"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-button type="text" @click="edit('edit',row)">修改</el-button>
                <el-button type="text" @click="del(row)">删除</el-button>
                <el-tooltip class="item" effect="dark" content="编辑" placement="top">
                  <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" />
                </el-tooltip>
              </div>
            </template>
          </el-table-column>
@@ -156,12 +233,11 @@
      </div>
      <!--分页-->
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="prev, pager, next,sizes"
        layout="total,prev, pager, next,sizes"
        popper-class="select_bottom"
        @pagination="getStepSearch"
      />
@@ -169,9 +245,9 @@
    <!--新增修改对话框-->
    <el-dialog
      :title="operation==='add'?'新增':'修改'"
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="50%"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
@@ -179,30 +255,44 @@
    >
      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
        <el-form-item label="工序编码" prop="stepcode">
          <el-input v-model="dialogForm.stepcode" :disabled="operation!=='add'" style="width: 220px" />
          <el-input v-model="dialogForm.stepcode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="工序名称" prop="stepname">
          <el-input v-model="dialogForm.stepname" style="width: 220px" />
          <el-input v-model="dialogForm.stepname" style="width: 200px" />
        </el-form-item>
        <el-form-item prop="steptypecode" label="工序类型">
          <el-select
          <el-radio-group
            v-model="dialogForm.steptypecode"
            style="width: 220px"
            placeholder="请选择"
            :popper-append-to-body="false"
            style="width: 200px"
          >
            <el-option
            <el-radio
              v-for="item in steptypeArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
              :label="item.name"
            />
          </el-select>
          </el-radio-group>
          <!--          <el-select-->
          <!--            v-model="dialogForm.steptypecode"-->
          <!--            filterable-->
          <!--            style="width: 200px"-->
          <!--            placeholder="请选择"-->
          <!--            :popper-append-to-body="false"-->
          <!--          >-->
          <!--            <el-option-->
          <!--              v-for="item in steptypeArr"-->
          <!--              :key="item.code"-->
          <!--              :label="item.name"-->
          <!--              :value="item.code"-->
          <!--            />-->
          <!--          </el-select>-->
        </el-form-item>
        <el-form-item prop="enable" label="启用状态">
          <el-select
            v-model="dialogForm.enable"
            style="width: 220px"
            filterable
            style="width: 200px"
            placeholder="请选择"
            :popper-append-to-body="false"
          >
@@ -215,13 +305,18 @@
          </el-select>
        </el-form-item>
        <el-form-item label="工序描述" prop="description">
          <el-input v-model="dialogForm.description" type="textarea" style="width: 220px" />
          <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisibleCancel">取 消</el-button>
          <el-button type="primary" @click="dialogVisibleConfirm">确 定</el-button>
          <el-button
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleConfirm"
          >确 定</el-button>
        </div>
      </span>
    </el-dialog>
@@ -231,7 +326,7 @@
      title="关联工作站"
      :visible.sync="workDialogVisible"
      width="50%"
      top="15vh"
      :top="isIpad?'5vh': '15vh'"
      :close-on-click-modal="false"
      class="workDialogVisible"
      @closed="workHandleClose"
@@ -240,44 +335,57 @@
      <!--      @opened="handleOpenedRoles"-->
      <div>
        <i class="el-icon-s-comment" style="color:#42b983;" /> 工序名称:{{ workDialogForm.stepname }}
        <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 工序名称:{{ workDialogForm.stepname }}
      </div>
      <el-divider />
      <div>
        <div style="margin-bottom:20px">
          <i class="el-icon-s-operation" style="color:#42b983;" /> 工作站集合:
          <i class="el-icon-s-operation":style="{color:$store.state.settings.theme}" /> 工作站集合:
        </div>
        <div class="myCheckboxGroup">
          <div
            v-for="item in workDialogForm.workGatherArr"
            :key="item.code"
            :style="{border:item.isSelected1?'1px solid #42b983':'1px solid #eee'}"
            :style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme :'1px solid #eee'}"
            class="myCheckbox"
            @click="myCheckboxClick(item)"
          >
            <input
              class="myCheckboxInput"
              type="checkbox"
              :value="item.code"
              name="gather"
              :style="{color:item.isSelected2?'#42b983':'#fff'}"
              @click="myCheckboxInputClick(item)"
            >{{ item.name }}
            <!--            <input-->
            <!--              class="myCheckboxInput"-->
            <!--              type="checkbox"-->
            <!--              :value="item.code"-->
            <!--              name="gather"-->
            <!--              :style="{color:item.isSelected2?'#42b983':'#fff'}"-->
            <!--              @click="myCheckboxInputClick(item)"-->
            <!--            >{{ item.name }}-->
            <!--            父子点击事件不影响-->
            <!--            onClick="event.cancelBubble = true"-->
            <el-checkbox
              :key="item.code"
              v-model="item.isSelected2"
              class="myCheckboxInput"
              :value="item.code"
              :name="item.name"
              :label="item.name"
              :checked="item.isSelected2"
              @change="myCheckboxInputClick(item)"
            />
            <div class="myCheckboxInputLabel">{{ item.name }}</div>
          </div>
        </div>
      </div>
      <el-divider />
      <div>
        <div style="margin-bottom:20px">
          <i class="el-icon-s-operation" style="color:#42b983;" /> 工作站:
          <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 工作站:
        </div>
        <el-tree
          ref="workTree"
          :data="workDialogForm.workTreeArr"
          show-checkbox
          node-key="code"
          style="height: 280px;"
          default-expand-all
          :props="workTreeDefaultProps"
          @check="checkBoxClick"
@@ -288,7 +396,12 @@
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="workDialogVisibleCancel">取 消</el-button>
          <el-button type="primary" @click="workDialogVisibleConfirm">确 定</el-button>
          <el-button
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="workDialogVisibleConfirm"
          >确 定</el-button>
        </div>
      </span>
    </el-dialog>
@@ -298,7 +411,7 @@
      title="工序关联缺陷"
      :visible.sync="defectDialogVisible"
      width="50%"
      top="15vh"
      :top="isIpad?'5vh':'15vh'"
      :close-on-click-modal="false"
      class="defectDialogVisible"
      @closed="defectHandleClose"
@@ -307,7 +420,7 @@
      <!--      @opened="handleOpenedRoles"-->
      <div style="margin-bottom: 20px">
        <i class="el-icon-s-comment" style="color:#42b983;" /> 工序名称:{{ defectTreeName }}
        <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 工序名称:{{ defectTreeName }}
      </div>
      <div>
@@ -330,7 +443,12 @@
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="defectDialogVisibleCancel">取 消</el-button>
          <el-button type="primary" @click="defectDialogVisibleConfirm">确 定</el-button>
          <el-button
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="defectDialogVisibleConfirm"
          >确 定</el-button>
        </div>
      </span>
    </el-dialog>
@@ -340,8 +458,6 @@
<script>
import Pagination from '@/components/Pagination'
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import {
  AddUpdateStep,
  DeleteStep, SaveStepAssociationDefect,
@@ -351,26 +467,18 @@
  StepSearch
} from '@/api/zzmx'
import $ from 'jquery'
import { validateCode } from '@/utils/global'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
  name: 'Zzjg',
  name: 'GXDY',
  components: {
    Pagination
  },
  data() {
    const validateName = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('请输入编码'))
      } else {
        if (SER_HZ.test(value)) {
          return callback(new Error('编码不能为中文'))
        } else {
          callback()
        }
      }
    }
    return {
      mouseHoverType: 'mouseout',
      isExpandForm: false,
      isIpad: false,
      mainHeight: 0,
      tableHeight: 0,
      form: {
@@ -400,15 +508,15 @@
        'id': '',
        'stepcode': '',
        'stepname': '',
        'steptypecode': '',
        'enable': '',
        'steptypecode': '自制',
        'enable': 'Y',
        'description': '',
        'OperType': ''
      },
      operation: '',
      dialogFormRules: {
        stepcode: [
          { required: true, validator: validateName, trigger: ['blur', 'change'] }
          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
        ],
        stepname: [
          { required: true, message: '请输入名称', trigger: ['blur', 'change'] }
@@ -450,6 +558,9 @@
    this.getHeight()
  },
  methods: {
    tableRowClassName({ row, rowIndex }) {
      return 'custom-row'
    },
    async getStepSearch() {
      const res = await StepSearch(this.form)
      this.tableData = res.data
@@ -499,7 +610,7 @@
        this.dialogForm.id = row.id
        this.dialogForm.stepcode = row.stepcode
        this.dialogForm.stepname = row.stepname
        this.dialogForm.steptypecode = row.flwtype
        this.dialogForm.steptypecode = this.steptypeArr.find(item => item.code === row.flwtype).name
        this.dialogForm.description = row.descr
        this.dialogForm.enable = row.enable
      })
@@ -514,6 +625,9 @@
        DeleteStep({ stepcode: row.stepcode }).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            if (this.form.page > 1 && this.tableData.length === 1) {
              this.form.page--
            }
            this.getStepSearch()
          }
        })
@@ -525,8 +639,8 @@
    handleClose() {
      this.dialogForm.stepcode = ''
      this.dialogForm.stepname = ''
      this.dialogForm.steptypecode = ''
      this.dialogForm.enable = ''
      this.dialogForm.steptypecode = '自制'
      this.dialogForm.enable = 'Y'
      this.dialogForm.description = ''
      this.$refs.dialogForm.clearValidate()
    },
@@ -538,20 +652,22 @@
    dialogVisibleConfirm() {
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          this.$store.state.app.buttonIsDisabled = true
          const data = {
            id: this.dialogForm.id,
            stepcode: this.dialogForm.stepcode,
            stepname: this.dialogForm.stepname,
            steptypecode: this.dialogForm.steptypecode,
            steptypecode: this.steptypeArr.find(item => item.name === this.dialogForm.steptypecode).code,
            enable: this.dialogForm.enable,
            description: this.dialogForm.description,
            OperType: this.operation === 'add' ? 'Add' : 'Update'
          }
          AddUpdateStep(data).then(res => {
            if (res.code === '200') {
              this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.dialogVisible = false
              this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.getStepSearch()
              this.$store.state.app.buttonIsDisabled = false
            } else {
              this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
            }
@@ -562,61 +678,83 @@
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 250
        this.tableHeight = this.mainHeight - 100
        // this.mainHeight = window.innerHeight - 250
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 255
        if (window.innerHeight < 769) {
          this.tableHeight = this.tableHeight - 40
        }
        this.isIpad = window.innerHeight < 769 && window.innerWidth < 1367
        this.$refs.tableDataRef.doLayout()
      })
    },
    /* 关联工作站模块*/
    // 关联工作站点击
    async workClick(row) {
      this.workDialogVisible = true
    workClick(row) {
      const loading = this.$loading({
        lock: true,
        text: '正在加载数据,请稍等...',
        spinner: 'el-icon-loading',
        customClass: 'osloading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
      this.workDialogForm.stepcode = row.stepcode
      this.workDialogForm.stepname = row.stepname
      const { data: res } = await StepAssociationEqp({ stepcode: this.workDialogForm.stepcode })
      this.workDialogForm.workArr = res
      let workGatherArr = []
      if (row.flwtype === 'W') { // 外协情况下
        workGatherArr = this.workDialogForm.workArr.filter(item => item.type === 'W')
      } else if (row.flwtype === 'Z') { // 自制情况下
        workGatherArr = this.workDialogForm.workArr.filter(item => item.type === 'E')
      } else { // 自制+外协
        workGatherArr = this.workDialogForm.workArr
      }
      // this.workDialogForm.workArr[1].children = []
      const nodeKey = []// 需要树形数显的值
      workGatherArr.forEach((item, index) => {
        this.workDialogForm.workGatherArr.push({
          isSelected1: index === 0,
          isSelected2: item.flag === 'Y',
          code: item.code,
          name: item.name,
          type: item.type,
          flag: item.flag
        })
        if (item.flag === 'Y' && item.children && item.children.length > 0) {
          this.$nextTick(() => {
            $("input[name='gather']").eq(index).prop('checked', true)// 自定义单选框回显
          })
          item.children.forEach(it => {
            if (it.flag === 'Y') {
              nodeKey.push(it.code)
            }
          })
        }
        if (index === 0) {
          if (item.children && item.children.length > 0) {
            this.workDialogForm.workTreeArr = this.workDialogForm.workArr.filter(it => it.code === item.code)
            this.workDialogForm.workTreeArr[0].name = '全部'
          }
        }
        // item.flag === 'Y'&&item
      })
      console.log(nodeKey, 1)
      this.$refs.workTree.setCheckedKeys(nodeKey)
      this.workDialogForm.workTreeSelectedArr = nodeKey
      StepAssociationEqp({ stepcode: this.workDialogForm.stepcode }).then(res => {
        if (res.code === '200') {
          setTimeout(() => {
            loading.close()
            this.workDialogVisible = true
      console.log(this.workDialogForm.workGatherArr, 6)
      console.log(this.workDialogForm.workTreeArr, 7)
            this.workDialogForm.workArr = res.data.filter(item => item.children.length !== 0)
            let workGatherArr = []
            if (row.flwtype === 'W') { // 外协情况下
              workGatherArr = this.workDialogForm.workArr.filter(item => item.type === 'W')
            } else if (row.flwtype === 'Z') { // 自制情况下
              workGatherArr = this.workDialogForm.workArr.filter(item => item.type === 'E')
            } else { // 自制+外协
              workGatherArr = this.workDialogForm.workArr
            }
            const nodeKey = []// 需要树形数显的值
            workGatherArr.forEach((item, index) => {
              this.workDialogForm.workGatherArr.push({
                isSelected1: index === 0,
                isSelected2: item.flag === 'Y',
                code: item.code,
                name: item.name,
                type: item.type,
                flag: item.flag
              })
              if (item.flag === 'Y' && item.children && item.children.length > 0) {
                this.$nextTick(() => {
                  $("input[name='gather']").eq(index).prop('checked', true)// 自定义单选框回显
                })
                item.children.forEach(it => {
                  if (it.flag === 'Y') {
                    nodeKey.push(it.code)
                  }
                })
              }
              if (index === 0) {
                if (item.children && item.children.length > 0) {
                  this.workDialogForm.workTreeArr = this.workDialogForm.workArr.filter(it => it.code === item.code)
                  this.workDialogForm.workTreeArr[0].name = '全部'
                }
              }
              // item.flag === 'Y'&&item
            })
            this.$nextTick(() => {
              this.$refs.workTree.setCheckedKeys(nodeKey)
            })
            this.workDialogForm.workTreeSelectedArr = nodeKey
          }, 1000)
        } else {
          loading.close()
        }
      })
    },
    // 大盒子点击事件
    myCheckboxClick(val) {
@@ -636,7 +774,7 @@
    },
    // 小盒子点击事件
    myCheckboxInputClick(val) {
      val.isSelected2 = !val.isSelected2
      val.isSelected2 = !!val.isSelected2
      console.log(val.code, 1)
      this.workDialogForm.workCodeSelectedGatherArr = [...new Set(this.workDialogForm.workCodeSelectedGatherArr)]
      // 1.第一种情况  小盒子从没选中到选中
@@ -794,7 +932,7 @@
        console.log('3.第三种情况  半叶为零  全叶不为零')
        console.log(obj.code, 12)
        this.workDialogForm.workGatherArr.forEach((item, index) => {
          if (item.code === obj.code) {
          if (item.code === checkedFatherCode) {
            this.workDialogForm.workGatherArr[index].isSelected2 = true
            this.workDialogForm.workCodeSelectedGatherArr.push(obj.code)
            this.$nextTick(() => {
@@ -835,8 +973,7 @@
    // 确认
    async workDialogVisibleConfirm() {
      this.workDialogForm.workTreeSelectedArr = [...new Set(this.workDialogForm.workTreeSelectedArr)]
      console.log(this.workDialogForm.workTreeSelectedArr, 18)
      console.log(this.workDialogForm.workArr, 20)
      const data = []
      this.workDialogForm.workArr.forEach(item => {
        if (item.flag === 'Y' && item.children && item.children.length > 0) {
@@ -847,33 +984,51 @@
          })
        }
      })
      console.log(data)
      this.$store.state.app.buttonIsDisabled = true
      const res = await SaveStepAssociationEqp(this.workDialogForm.stepcode, data)
      if (res.code === '200') {
        this.$message.success('保存成功!')
        this.workDialogVisible = false
        this.$message.success('保存成功!')
        await this.getStepSearch()
        this.$store.state.app.buttonIsDisabled = false
      }
    },
    /* 关联缺陷*/
    //  关联缺陷点击
    async defectClick(row) {
    defectClick(row) {
      const loading = this.$loading({
        lock: true,
        text: '正在加载数据,请稍等...',
        spinner: 'el-icon-loading',
        customClass: 'osloading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
      this.defectTreeCode = row.stepcode
      this.defectTreeName = row.stepname
      this.defectDialogVisible = true
      const { data: res } = await StepAssociationDefect({ stepcode: row.stepcode })
      // this.defectTree = res
      this.defectTree.push({ code: 'QB', name: '全部', children: res, flag: 'N' })
      console.log(this.defectTree, 6)
      const nokeKey = []
      this.defectTree[0].children.forEach(item => {
        if (item.flag === 'Y') {
          nokeKey.push(item.code)
      StepAssociationDefect({ stepcode: row.stepcode }).then(res => {
        if (res.code === '200') {
          setTimeout(() => {
            loading.close()
            this.defectDialogVisible = true
            this.defectTree.push({ code: 'QB', name: '全部', children: res.data, flag: 'N' })
            const nokeKey = []
            this.defectTree[0].children.forEach(item => {
              if (item.flag === 'Y') {
                nokeKey.push(item.code)
              }
            })
            this.$nextTick(() => {
              this.$refs.defectTree.setCheckedKeys(nokeKey)
            })
          }, 1000)
        } else {
          loading.close()
        }
      })
      console.log(nokeKey, 2)
      this.$nextTick(() => {
        this.$refs.defectTree.setCheckedKeys(nokeKey)
      })
    },
    // 关闭
@@ -885,7 +1040,7 @@
      this.defectDialogVisible = false
    },
    // 确认
    async  defectDialogVisibleConfirm() {
    async defectDialogVisibleConfirm() {
      const nodeKey = this.$refs.defectTree.getCheckedKeys()
      const data = []
      this.defectTree[0].children.forEach(item => {
@@ -894,80 +1049,22 @@
          data.push({ code: item.code, name: item.name })
        }
      })
      this.$store.state.app.buttonIsDisabled = true
      const res = await SaveStepAssociationDefect(this.defectTreeCode, data)
      if (res.code === '200') {
        this.$message.success('保存成功!')
        this.defectDialogVisible = false
        this.$message.success('保存成功!')
        await this.getStepSearch()
        this.$store.state.app.buttonIsDisabled = false
      }
    }
  }
}
</script>
<style lang="scss" scoped>
$main_color: #42b983;
::v-deep .el-button--primary {
  background-color: $main_color !important;
  height: 30px;
  display: flex;
  align-items: center;
  //border: 1px solid $main_color;
  border: none;
  padding: 0 20px;
}
::v-deep .el-button--primary:hover {
  border: none;
}
::v-deep .el-button--info {
  height: 30px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}
::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: $main_color !important;
}
::v-deep .el-dialog__footer {
  display: flex;
  justify-content: flex-end;
}
.footerButton {
  display: flex;
  justify-content: end;
}
::v-deep .el-button--default {
  background-color: #ffffff !important;
  height: 30px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}
::v-deep .el-button--default:hover {
  color: #606266;
}
::v-deep .el-dialog__body {
  padding: 20px 100px !important;
}
.defectDialogVisible {
  ::v-deep .el-dialog__body {
    padding: 20px 20px !important;
  }
}
.workDialogVisible {
  ::v-deep .el-dialog__body {
    padding: 20px 20px !important;
  }
  .myCheckboxGroup {
    display: flex;
    flex-wrap: wrap;
@@ -980,10 +1077,19 @@
      margin: 10px 30px 0 0;
      border-radius: 5px;
      cursor: default;
      position: relative;
      .myCheckboxInput {
        margin: 1px 5px 0 0;
        cursor: pointer;
      }
      .myCheckboxInputLabel {
        position: absolute;
        left: 29px;
        padding: 5px;
        top: 6px;
        color: transparent;
      }
    }
@@ -1021,27 +1127,60 @@
  }
}
::v-deep .el-radio__input.is-checked .el-radio__inner {
  background-color: $main_color;
  border-color: $main_color;
</style>
<!--公共页面样式-->
<style lang="scss" scoped>
$main_color: #42b983;
.el-icon-share, .el-icon-delete, .el-icon-edit-outline {
  color: $main_color;
  cursor: pointer;
}
::v-deep .el-radio__input.is-checked + .el-radio__label {
  color: $main_color !important;
.el-icon-edit-outline {
  margin-right: 15px;
}
::v-deep .el-checkbox__input.is-checked .el-checkbox__inner {
  border-color: $main_color;
  background-color: $main_color;
::v-deep .el-button--primary, .el-button--default, .el-button--info {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 15px;
}
::v-deep .el-button--primary {
  //background-color: $main_color !important;
}
::v-deep .el-button--default {
  background-color: #f8f8fa;
  border: none;
}
::v-deep .el-input__inner {
  height: 30px;
  line-height: 30px;
  height: 34px;
  line-height: 34px;
  //color: #a7a7a7;
}
::v-deep .el-input__inner:focus {
  border-color: $main_color;
::v-deep .el-dialog__body {
  padding: 20px 100px !important;
}
::v-deep .workDialogVisible .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .defectDialogVisible .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .importPickerClass .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .el-dialog__footer {
  display: flex;
  justify-content: flex-end;
}
::v-deep .el-table .caret-wrapper {
@@ -1049,57 +1188,25 @@
}
::v-deep .cell {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}
::v-deep .el-button--text {
  color: $main_color;
  font-size: 14px;
  cursor: pointer;
}
.operationClass {
  height: 23px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  justify-content: space-between;
}
.el-icon-share {
  color: $main_color;
  cursor: pointer;
::v-deep .el-table::before {
  height: 0;
}
.el-checkbox.is-bordered.is-checked {
  border-color: $main_color;
::v-deep .el-table__body-wrapper {
  background-color: #f8f8fa;
}
::v-deep .el-radio__input.is-checked .el-radio__inner {
  border-color: $main_color;
  background: $main_color;
::v-deep .el-table__body .el-table__row.hover-row td {
  background-color: #eaecef;
}
::v-deep .el-checkbox__input.is-indeterminate .el-checkbox__inner {
  border-color: $main_color;
  background: $main_color;
}
::v-deep .el-checkbox__input.is-checked + .el-checkbox__label {
  color: $main_color !important;
}
::v-deep .el-checkbox.is-bordered + .el-checkbox.is-bordered {
  margin: 10px 30px 0px 0;
}
::v-deep .el-radio__input.is-checked + .el-radio__label {
  color: $main_color;
}
::v-deep .el-radio.is-bordered + .el-radio.is-bordered {
  margin: 10px 30px 0px 0;
::v-deep .el-form--inline .el-form-item__label {
  color: #a7a7a7;
}
.body ::v-deep .el-divider {
@@ -1112,24 +1219,29 @@
  margin-bottom: 0;
}
::v-deep .el-input__inner:focus {
  border-color: $main_color;
.userDialogVisible ::v-deep .el-form-item {
  margin-bottom: 0;
}
::v-deep .el-select .el-input__inner:focus {
  border-color: $main_color;
.tableFixed {
  ::v-deep .el-table__fixed-right {
    height: 100% !important;
  }
  ::v-deep .el-table__fixed {
    height: 100% !important;
  }
}
</style>
<style>
.osloading{
  font-size: 26px !important;
}
::v-deep .el-select-dropdown__item.selected {
  color: $main_color;
.el-loading-text{
  font-size: 26px !important;
}
::v-deep .el-checkbox__inner:hover {
  border-color: $main_color;
.el-table .custom-row {
  background: #f8f8fa;
}
::v-deep .el-textarea__inner:focus {
  border-color: $main_color;
}
</style>