zhaowei
8 天以前 3db6d5c4d17ab9942a5c89a167c1f06ca485f355
src/views/system/WorkshopSignageManagement.vue
@@ -7,17 +7,19 @@
          <!-- 搜索区域 -->
          <a-form layout="inline" @keyup.enter.native="searchQuery">
            <a-row :gutter="24">
              <a-col :md="12" :sm="8">
                <a-form-item label="车间名称" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
              <a-col :md="8" :sm="8">
                <a-form-item label="车间名称" :labelCol="{ span: 5 }" :wrapperCol="{ span: 19}">
                  <a-input placeholder="" v-model="queryParam.workshopName"></a-input>
                </a-form-item>
              </a-col>
              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-col :md="12" :sm="24">
               <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 21px">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </a-col>
          </span>
              <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
                <a-col>
                  <a-space>
                    <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                    <a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
                  </a-space>
                </a-col>
              </span>
            </a-row>
          </a-form>
        </div>
@@ -26,15 +28,17 @@
          <a-button @click="handleAdd" type="primary" icon="plus">新建车间</a-button>
        </div>
        <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
          <i class="anticon anticon-info-circle ant-alert-icon">
          </i> 已选择 <a><b>{{ selectedRowKeys1.length }}</b></a>项
        <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
          <i class="anticon anticon-info-circle ant-alert-icon"> </i> 已选择
          <a
            ><b>{{ selectedRowKeys1.length }}</b></a
          >项
          <a style="margin-left: 24px" @click="onClearSelected1">清空</a>
        </div>
        <div style="margin-top: 15px">
          <a-table
            style="height:500px"
            style="height: 500px"
            ref="table"
            size="middle"
            bordered
@@ -43,85 +47,86 @@
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            :rowSelection="{selectedRowKeys: selectedRowKeys1, onChange: onSelectChange1, type:'radio'}"
            @change="handleTableChange">
            <template slot="backgroundImage" slot-scope="text,record">
              <img :src="getImgView(record.backgroundImage)" width="50" height="50">
            :rowSelection="{ selectedRowKeys: selectedRowKeys1, onChange: onSelectChange1, type: 'radio' }"
            @change="handleTableChange"
          >
            <template slot="backgroundImage" slot-scope="text, record">
              <img :src="getImgView(record.backgroundImage)" width="50" height="50" />
            </template>
            <span slot="action" slot-scope="text, record">
            <a @click="handleOpen(record)">车间</a>
            <a-divider type="vertical"/>
            <a-dropdown>
              <a class="ant-dropdown-link">
                更多 <a-icon type="down"/>
              </a>
              <a-menu slot="overlay">
                <a-menu-item>
                  <a @click="handleEdit(record)">编辑</a>
                </a-menu-item>
                <a-menu-item>
                  <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete1(record.id)">
                    <a>删除</a>
                  </a-popconfirm>
                </a-menu-item>
              </a-menu>
            </a-dropdown>
        </span>
              <a @click="handleOpen(record)">设备</a>
              <a-divider type="vertical" />
              <a-dropdown>
                <a class="ant-dropdown-link"> 更多 <a-icon type="down" /> </a>
                <a-menu slot="overlay">
                  <a-menu-item>
                    <a @click="handleEdit(record)">编辑</a>
                  </a-menu-item>
                  <a-menu-item>
                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete1(record.id)">
                      <a>删除</a>
                    </a-popconfirm>
                  </a-menu-item>
                </a-menu>
              </a-dropdown>
            </span>
          </a-table>
        </div>
      </a-card>
    </a-col>
    <a-col :md="rightColMd" :sm="24" v-if="this.rightcolval == 1">
      <a-card :bordered="false">
        <div style="text-align: right;">
          <a-icon type="close-circle" @click="hideUserList"/>
        <div @click="hideUserList" class="close-circle">
          <a-icon type="close-circle"/>
        </div>
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
          <a-form layout="inline">
            <a-row :gutter="24">
              <a-col :md="12" :sm="12">
                <a-form-item label="设备编码">
                <a-form-item label="统一编码">
                  <a-input placeholder="" v-model="queryParam2.equipmentId"></a-input>
                </a-form-item>
              </a-col>
              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-col :md="9" :sm="24">
             <a-button type="primary" @click="searchQuery2" icon="search" style="margin-left: 21px">查询</a-button>
              <a-button type="primary" @click="searchReset2" icon="reload" style="margin-left: 8px">重置</a-button>
            </a-col>
          </span>
              <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
                <a-col :md="9" :sm="24">
                  <a-button type="primary" @click="searchQuery2" icon="search" style="margin-left: 21px">查询</a-button>
                  <a-button type="primary" @click="searchReset2" icon="reload" style="margin-left: 8px">重置</a-button>
                </a-col>
              </span>
            </a-row>
          </a-form>
        </div>
        <!-- 操作按钮区域 -->
        <div class="table-operator" :md="24" :sm="24">
          <a-button @click="handleAddDeviceInWorkshop" type="primary" icon="plus" style="margin-top: 16px">已有设备
          <a-button @click="handleAddDeviceInWorkshop" type="primary" icon="plus"  style="margin: 5px 0 10px 2px"
            >已有设备
          </a-button>
          <a-dropdown v-if="selectedRowKeys2.length > 0">
            <a-menu slot="overlay">
              <a-menu-item key="1" @click="batchDel2">
                <a-icon type="delete"/>
                <a-icon type="delete" />
                删除
              </a-menu-item>
            </a-menu>
            <a-button style="margin-left: 8px"> 批量操作
              <a-icon type="down"/>
            <a-button style="margin-left: 8px">
              批量操作
              <a-icon type="down" />
            </a-button>
          </a-dropdown>
        </div>
        <!-- table区域-begin -->
        <div>
          <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
            <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
            selectedRowKeys2.length }}</a>项
          <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
            <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
            <a style="font-weight: 600">{{ selectedRowKeys2.length }}</a
            >项
            <a style="margin-left: 24px" @click="onClearSelected2">清空</a>
          </div>
          <a-table
            style="height:500px"
            style="height: 500px"
            ref="table2"
            bordered
            size="middle"
@@ -130,366 +135,401 @@
            :dataSource="dataSource2"
            :pagination="ipagination2"
            :loading="loading2"
            :rowSelection="{selectedRowKeys: selectedRowKeys2, onChange: onSelectChange2}"
            @change="handleTableChange2">
            :rowSelection="{ selectedRowKeys: selectedRowKeys2, onChange: onSelectChange2 }"
            @change="handleTableChange2"
          >
            <span slot="action" slot-scope="text, record">
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete2(record.equipmentId)">
                  <a>删除</a>
          </a-popconfirm>
        </span>
              <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete2(record.equipmentId)">
                <a>删除</a>
              </a-popconfirm>
            </span>
          </a-table>
        </div>
      </a-card>
    </a-col>
    <!-- 表单区域 -->
    <workshop-modal ref="modalForm" @ok="modalFormOk"></workshop-modal> <!--新增车间-->
    <select-device-modal ref="selectUserModal" @selectFinished="selectOK"></select-device-modal> <!--已有设备-->
    <workshop-modal ref="modalForm" @ok="modalFormOk"></workshop-modal>
    <!--新增车间-->
    <select-device-drawer ref="selectDeviceDrawer" @selectFinished="selectOK" :title="'添加已有设备'"></select-device-drawer>
    <!--已有设备-->
  </a-row>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { deleteAction, postAction, getAction } from '@/api/manage'
  import SelectDeviceModal from './modules/SelectDeviceModal'
  import WorkshopModal from './modules/WorkshopModal'
  import { filterObj } from '@/utils/util'
  import moment from 'moment'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { deleteAction, postAction, getAction } from '@/api/manage'
import SelectDeviceDrawer from './modules/SelectDeviceDrawer'
import WorkshopModal from './modules/WorkshopModal'
import { filterObj } from '@/utils/util'
import moment from 'moment'
  export default {
    name: 'WorkshopSignageManagement',
    mixins: [JeecgListMixin],
    components: {
      SelectDeviceModal,
      WorkshopModal,
      moment
export default {
  name: 'WorkshopSignageManagement',
  mixins: [JeecgListMixin],
  components: {
    SelectDeviceDrawer,
    WorkshopModal,
    moment,
  },
  data() {
    return {
      model1: {},
      model2: {},
      currentRoleId: '',
      currentWorkshopId: '',
      queryParam1: {},
      queryParam2: {},
      dataSource1: [],
      dataSource2: [],
      ipagination1: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0,
      },
      ipagination2: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0,
      },
      isorter1: {
        column: 'createTime',
        order: 'desc',
      },
      isorter2: {
        column: 'createTime',
        order: 'desc',
      },
      filters1: {},
      filters2: {},
      loading1: false,
      loading2: false,
      selectedRowKeys1: [],
      selectedRowKeys2: [],
      selectionRows1: [],
      selectionRows2: [],
      test: {},
      rightcolval: 0,
      columns: [
        {
          title: '车间名称',
          align: 'center',
          dataIndex: 'workshopName',
        },
        {
          title: '车间背景图',
          dataIndex: 'backgroundImage',
          align: 'center',
          scopedSlots: { customRender: 'backgroundImage' },
        },
        {
          title: '设备编号颜色',
          dataIndex: 'equipmentIdColor',
          align: 'center',
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
        },
      ],
      columns2: [
        {
          title: '统一编码',
          align: 'center',
          dataIndex: 'equipmentId',
          width: 120,
        },
        {
          title: '设备名称',
          align: 'center',
          width: 100,
          dataIndex: 'equipmentName',
        },
        {
          title: '设备类型',
          align: 'center',
          width: 80,
          dataIndex: 'equipmentType',
        },
        {
          title: '操作',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          width: 120,
        },
      ],
      // 高级查询参数
      superQueryParams2: '',
      // 高级查询拼接条件
      superQueryMatchType2: 'and',
      url: {
        list: '/mdc/mdcWorkshopInfo/list',
        delete: '/mdc/mdcWorkshopInfo/delete',
        list2: '/mdc/mdcWorkshopInfo/workshopEquipmentList',
        addDeviceInWorkshop: '/mdc/mdcWorkshopInfo/addWorkshopEquipment',
        delete2: '/mdc/mdcWorkshopInfo/deleteWorkshopEquipment',
        deleteBatch2: '/mdc/mdcWorkshopInfo/deleteWorkshopEquipmentBatch',
      },
    }
  },
  computed: {
    leftColMd() {
      return this.selectedRowKeys1.length === 0 ? 24 : 12
    },
    data() {
      return {
        model1: {},
        model2: {},
        currentRoleId: '',
        currentWorkshopId: '',
        queryParam1: {},
        queryParam2: {},
        dataSource1: [],
        dataSource2: [],
        ipagination1: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' 共' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        ipagination2: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' 共' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        isorter1: {
          column: 'createTime',
          order: 'desc'
        },
        isorter2: {
          column: 'createTime',
          order: 'desc'
        },
        filters1: {},
        filters2: {},
        loading1: false,
        loading2: false,
        selectedRowKeys1: [],
        selectedRowKeys2: [],
        selectionRows1: [],
        selectionRows2: [],
        test: {},
        rightcolval: 0,
        columns: [
          {
            title: '车间名称',
            align: 'center',
            dataIndex: 'workshopName'
          },
          {
            title: '车间背景图',
            dataIndex: 'backgroundImage',
            align: 'center',
            scopedSlots: { customRender: 'backgroundImage' }
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            scopedSlots: { customRender: 'action' }
          }
        ],
        columns2: [
          {
            title: '设备编码',
            align: 'center',
            dataIndex: 'equipmentId',
            width: 120
          },
          {
            title: '设备名称',
            align: 'center',
            width: 100,
            dataIndex: 'equipmentName'
          },
          {
            title: '设备类型',
            align: 'center',
            width: 80,
            dataIndex: 'equipmentType'
          },
          {
            title: '操作',
            dataIndex: 'action',
            scopedSlots: { customRender: 'action' },
            align: 'center',
            width: 120
          }],
        // 高级查询参数
        superQueryParams2: '',
        // 高级查询拼接条件
        superQueryMatchType2: 'and',
        url: {
          list: '/mdc/mdcWorkshopInfo/list',
          delete: '/mdc/mdcWorkshopInfo/delete',
          list2: '/mdc/mdcWorkshopInfo/workshopEquipmentList',
          addDeviceInWorkshop: '/mdc/mdcWorkshopInfo/addWorkshopEquipment',
          delete2: '/mdc/mdcWorkshopInfo/deleteWorkshopEquipment',
          deleteBatch2: '/mdc/mdcWorkshopInfo/deleteWorkshopEquipmentBatch'
        }
    rightColMd() {
      return this.selectedRowKeys1.length === 0 ? 0 : 12
    },
  },
  methods: {
    onSelectChange2(selectedRowKeys, selectionRows) {
      this.selectedRowKeys2 = selectedRowKeys
      this.selectionRows2 = selectionRows
    },
    onClearSelected2() {
      this.selectedRowKeys2 = []
      this.selectionRows2 = []
    },
    onClearSelected1() {
      this.selectedRowKeys1 = []
      this.selectionRows1 = []
    },
    onSelectChange1(selectedRowKeys, selectionRows) {
      this.rightcolval = 1
      this.selectedRowKeys1 = selectedRowKeys
      this.selectionRows1 = selectionRows
      this.model1 = Object.assign({}, selectionRows[0])
      this.currentWorkshopId = selectedRowKeys[0]
      this.loadData2()
    },
    getQueryParams2() {
      //获取查询条件
      let sqp = {}
      if (this.superQueryParams2) {
        sqp['superQueryParams'] = encodeURI(this.superQueryParams2)
        sqp['superQueryMatchType'] = this.superQueryMatchType2
      }
      var param = Object.assign(sqp, this.queryParam2, this.isorter2, this.filters2)
      param.field = this.getQueryField2()
      param.pageNo = this.ipagination2.current
      param.pageSize = this.ipagination2.pageSize
      return filterObj(param)
    },
    computed: {
      leftColMd() {
        return this.selectedRowKeys1.length === 0 ? 24 : 12
      },
      rightColMd() {
        return this.selectedRowKeys1.length === 0 ? 0 : 12
    getQueryField2() {
      //TODO 字段权限控制
      var str = 'id,'
      this.columns2.forEach(function (value) {
        str += ',' + value.dataIndex
      })
      return str
    },
    modalFormOk2() {
      // 新增/修改 成功时,重载列表
      this.loadData2()
    },
    loadData2(arg) {
      if (!this.url.list2) {
        this.$message.error('请设置url.list2属性!')
        return
      }
      //加载数据 若传入参数1则加载第一页的内容
      if (arg === 1) {
        this.ipagination2.current = 1
      }
      if (this.currentWorkshopId === '') return
      let params = this.getQueryParams2() //查询条件
      params.workshopId = this.currentWorkshopId
      this.loading2 = true
      getAction(this.url.list2, params).then((res) => {
        if (res.success) {
          this.dataSource2 = res.result.records
          this.ipagination2.total = res.result.total
        }else{
          this.dataSource2=[]
        }
        this.loading2 = false
      })
    },
    methods: {
      onSelectChange2(selectedRowKeys, selectionRows) {
        this.selectedRowKeys2 = selectedRowKeys
        this.selectionRows2 = selectionRows
      },
      onClearSelected2() {
        this.selectedRowKeys2 = []
        this.selectionRows2 = []
      },
      onClearSelected1() {
        this.selectedRowKeys1 = []
        this.selectionRows1 = []
      },
      onSelectChange1(selectedRowKeys, selectionRows) {
        this.rightcolval = 1
        this.selectedRowKeys1 = selectedRowKeys
        this.selectionRows1 = selectionRows
        this.model1 = Object.assign({}, selectionRows[0])
        this.currentWorkshopId = selectedRowKeys[0]
        this.loadData2()
      },
      getQueryParams2() {
        //获取查询条件
        let sqp = {}
        if (this.superQueryParams2) {
          sqp['superQueryParams'] = encodeURI(this.superQueryParams2)
          sqp['superQueryMatchType'] = this.superQueryMatchType2
        }
        var param = Object.assign(sqp, this.queryParam2, this.isorter2, this.filters2)
        param.field = this.getQueryField2()
        param.pageNo = this.ipagination2.current
        param.pageSize = this.ipagination2.pageSize
        return filterObj(param)
      },
      getQueryField2() {
        //TODO 字段权限控制
        var str = 'id,'
        this.columns2.forEach(function(value) {
          str += ',' + value.dataIndex
        })
        return str
      },
      modalFormOk2() {
        // 新增/修改 成功时,重载列表
        this.loadData2()
      },
      loadData2(arg) {
        if (!this.url.list2) {
          this.$message.error('请设置url.list2属性!')
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination2.current = 1
        }
        if (this.currentWorkshopId === '') return
        let params = this.getQueryParams2()//查询条件
        params.workshopId = this.currentWorkshopId
        this.loading2 = true
        getAction(this.url.list2, params).then((res) => {
          if (res.success) {
            this.dataSource2 = res.result.records
            this.ipagination2.total = res.result.total
          }
          this.loading2 = false
        })
      },
      handleDelete1: function(id) {
        this.handleDelete(id)
        this.dataSource2 = []
        this.currentRoleId = ''
      },
    handleDelete1: function (id) {
      this.handleDelete(id)
      this.dataSource2 = []
      this.currentRoleId = ''
    },
      /**
       * 点击设备表格中的删除按钮后触发删除单个车间与设备的关系
       * @param equipmentId 当前行的设备编号
       */
      handleDelete2: function(equipmentId) {
        if (!this.url.delete2) {
          this.$message.error('请设置url.delete2属性!')
          return
    /**
     * 点击设备表格中的删除按钮后触发删除单个车间与设备的关系
     * @param equipmentId 当前行的设备编号
     */
    handleDelete2: function (equipmentId) {
      if (!this.url.delete2) {
        this.$notification.error({
          message:'消息',
          description:'请设置url.delete2属性!'
        });
        return
      }
      var that = this
      deleteAction(that.url.delete2, { workshopId: this.currentWorkshopId, equipmentId }).then((res) => {
        if (res.success) {
          that.$notification.success({
            message:'消息',
            description:res.message
          });
          that.loadData2()
        } else {
          that.$notification.warning({
            message:'消息',
            description:res.message
          });
        }
      })
    },
    /**
     * 批量删除车间与设备的关系
     */
    batchDel2: function () {
      if (!this.url.deleteBatch2) {
        this.$message.error('请设置url.deleteBatch2属性!')
        return
      }
      if (this.selectedRowKeys2.length <= 0) {
        // this.$message.warning('请选择一条记录!')
        this.$notification.warning({
          message: '消息',
          description: '请选择一条记录',
        })
        return
      } else {
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys2.length; a++) {
          ids += this.selectedRowKeys2[a] + ','
        }
        var that = this
        deleteAction(that.url.delete2, { workshopId: this.currentWorkshopId, equipmentId }).then((res) => {
          if (res.success) {
            that.$message.success(res.message)
            that.loadData2()
          } else {
            that.$message.warning(res.message)
          }
        this.$confirm({
          title: '确认删除',
          content: '是否删除选中数据?',
          onOk: function () {
            deleteAction(that.url.deleteBatch2, {
              workshopId: that.currentWorkshopId,
              equipmentIds: ids,
            }).then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.loadData2()
                that.onClearSelected2()
              } else {
                that.$message.warning(res.message)
              }
            })
          },
        })
      },
      /**
       * 批量删除车间与设备的关系
       */
      batchDel2: function() {
        if (!this.url.deleteBatch2) {
          this.$message.error('请设置url.deleteBatch2属性!')
          return
        }
        if (this.selectedRowKeys2.length <= 0) {
          // this.$message.warning('请选择一条记录!')
          this.$notification.warning({
            message: '消息',
            description: '请选择一条记录'
          })
          return
        } else {
          var ids = ''
          for (var a = 0; a < this.selectedRowKeys2.length; a++) {
            ids += this.selectedRowKeys2[a] + ','
          }
          var that = this
          this.$confirm({
            title: '确认删除',
            content: '是否删除选中数据?',
            onOk: function() {
              deleteAction(that.url.deleteBatch2, {
                workshopId: that.currentWorkshopId,
                equipmentIds: ids
              }).then((res) => {
                if (res.success) {
                  that.$message.success(res.message)
                  that.loadData2()
                  that.onClearSelected()
                } else {
                  that.$message.warning(res.message)
                }
              })
            }
          })
        }
      },
      /**
       * 选择已有设备后点击确定时触发
       * @param data 已选择的设备
       */
      selectOK(data) {
        let params = {}
        params.workshopId = this.currentWorkshopId
        params.equipmentIdList = []
        for (var a = 0; a < data.length; a++) {
          params.equipmentIdList.push(data[a])
        }
        console.log(params)
        postAction(this.url.addDeviceInWorkshop, params).then((res) => {
          if (res.success) {
            this.loadData2()
            this.$message.success(res.message)
          } else {
            this.$message.warning(res.message)
          }
        })
      },
      /**
       * 点击已有设备按钮触发
       */
      handleAddDeviceInWorkshop() {
        if (this.currentWorkshopId == '') {
          this.$message.error('请选择一个车间!')
        } else {
          this.$refs.selectUserModal.visible = true
          this.$refs.selectUserModal.selectedRowKeys = []
          this.$refs.selectUserModal.selectedRows = []
        }
      },
      /**
       * 点击当前行车间选项后触发事件
       * @param record 当前行数据
       */
      handleOpen(record) {
        this.rightcolval = 1
        this.selectedRowKeys1 = [record.id]
        this.model1 = Object.assign({}, record)
        this.currentWorkshopId = record.id
        this.onClearSelected2()
        this.loadData2()
      },
      searchQuery2() {
        this.loadData2(1)
      },
      searchReset2() {
        this.queryParam2 = {}
        this.loadData2(1)
      },
      handleTableChange2(pagination, filters, sorter) {
        //分页、排序、筛选变化时触发
        //TODO 筛选
        if (Object.keys(sorter).length > 0) {
          this.isorter2.column = sorter.field
          this.isorter2.order = 'ascend' == sorter.order ? 'asc' : 'desc'
        }
        this.ipagination2 = pagination
        this.loadData2()
      },
      hideUserList() {
        //this.rightcolval = 0
        this.selectedRowKeys1 = []
      }
    }
  }
    },
    /**
     * 选择已有设备后点击确定时触发
     * @param data 已选择的设备
     */
    selectOK(data) {
      let params = {}
      params.workshopId = this.currentWorkshopId
      params.equipmentIdList = []
      for (var a = 0; a < data.length; a++) {
        params.equipmentIdList.push(data[a])
      }
      console.log(params)
      postAction(this.url.addDeviceInWorkshop, params).then((res) => {
        if (res.success) {
          this.loadData2()
          this.$notification.success({
            message:'消息',
            description:res.message
          });
        } else {
          this.$notification.warning({
            message:'消息',
            description:res.message
          });
        }
      })
    },
    /**
     * 点击已有设备按钮触发
     */
    handleAddDeviceInWorkshop() {
      if (this.currentWorkshopId == '') {
        this.$message.error('请选择一个车间!')
      } else {
        this.$refs.selectDeviceDrawer.visible = true
        this.$refs.selectDeviceDrawer.selectedRowKeys = []
        this.$refs.selectDeviceDrawer.selectedRows = []
        this.$refs.selectDeviceDrawer.checkedKeys = []
        this.$refs.selectDeviceDrawer.expandAll()
      }
    },
    /**
     * 点击当前行车间选项后触发事件
     * @param record 当前行数据
     */
    handleOpen(record) {
      this.rightcolval = 1
      this.selectedRowKeys1 = [record.id]
      this.model1 = Object.assign({}, record)
      this.currentWorkshopId = record.id
      this.onClearSelected2()
      this.loadData2()
    },
    searchQuery2() {
      this.loadData2(1)
    },
    searchReset2() {
      this.queryParam2 = {}
      this.loadData2(1)
    },
    handleTableChange2(pagination, filters, sorter) {
      //分页、排序、筛选变化时触发
      //TODO 筛选
      if (Object.keys(sorter).length > 0) {
        this.isorter2.column = sorter.field
        this.isorter2.order = 'ascend' == sorter.order ? 'asc' : 'desc'
      }
      this.ipagination2 = pagination
      this.loadData2()
    },
    hideUserList() {
      //this.rightcolval = 0
      this.selectedRowKeys1 = []
    },
  },
}
</script>
<style scoped>
  /** Button按钮间距 */
  .ant-btn {
    margin-left: 8px
/** Button按钮间距 */
.ant-btn {
  margin-left: 8px;
}
  .close-circle{
    position: absolute;
    z-index: 1;
    right: 15px;
    top: 15px;
    cursor: pointer;
  }
</style>