cuikaidong
2 天以前 d9aab92fa25860c6682debe50e10770dc7db42a0
组合刀模块增加
已添加5个文件
已修改1个文件
1335 ■■■■■ 文件已修改
src/views/flowable/workflow/leanOut/EquipmentLeanOutApprovalModal.vue 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/combinationKnife/ToolCombinationDetailList.vue 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/combinationKnife/ToolCombinationList.vue 266 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/combinationKnife/modules/InboundOrderModel.vue 463 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/combinationKnife/modules/JSelectToolingModal.vue 275 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/combinationKnife/modules/ToolCombinationDetailModal.vue 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/flowable/workflow/leanOut/EquipmentLeanOutApprovalModal.vue
@@ -52,7 +52,7 @@
            </a-form-model-item>
          </a-col>
        </a-row>
        <div v-if="confirmDisable">
        <div v-if="approvalDisable">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> ç®¡ç†å‘˜å®¡æ‰¹
          </a-divider>
          <a-row :gutter="24">
@@ -64,7 +64,7 @@
            </a-col>
            <a-col :span="12">
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="approvalComment" label="确认意见">
                <a-textarea placeholder="请输入确认意见" v-model="model.confirmComment"
                <a-textarea placeholder="请输入确认意见" v-model="model.approvalComment"
                            :disabled="disableSubmit || returnDisable" />
              </a-form-model-item>
            </a-col>
@@ -83,19 +83,7 @@
<!--            </a-col>-->
<!--          </a-row>-->
<!--        </div>-->
        <div v-if="confirmDisable">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> ç®¡ç†å‘˜ç¡®è®¤
          </a-divider>
          <a-row :gutter="24">
            <a-col :span="24">
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="confirmComment"
                                 label="确认意见">
                <a-textarea placeholder="请输入意见" v-model="model.confirmComment"
                            :disabled="disableSubmit || completionDisable" />
              </a-form-model-item>
            </a-col>
          </a-row>
        </div>
      </a-form-model>
    </a-spin>
  </j-modal>
src/views/tms/combinationKnife/ToolCombinationDetailList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,180 @@
<template>
  <a-card :bordered="false" :class="'cust-erp-sub-tab'">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            ä¸‹è½½
          </a-button>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <toolCombinationDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></toolCombinationDetail-modal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ToolCombinationDetailModal from './modules/ToolCombinationDetailModal'
  export default {
    name: "ToolCombinationDetailList",
    mixins:[JeecgListMixin],
    components: { ToolCombinationDetailModal },
    props:{
      mainId:{
        type:String,
        default:'',
        required:false
      }
    },
    watch:{
      mainId:{
        immediate: true,
        handler(val) {
          if(!this.mainId){
            this.clearList()
          }else{
            this.queryParam['combinationId'] = val
            this.loadData(1);
          }
        }
      }
    },
    data () {
      return {
        description: '组合刀记录主表管理页面',
        disableMixinCreated:true,
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'刀柄号',
            align:"center",
            dataIndex: 'hiltCode'
          },
          {
            title: '工具类型',
            align: 'center',
            dataIndex: 'applicationType_dictText'
          },
          // {
          //   title: '工具编号',
          //   align: 'center',
          //   dataIndex: 'toolId'
          // },
          {
            title: '中文名称',
            align: 'center',
            dataIndex: 'chineseName'
          },
          {
            title: '工具参数标识',
            align: 'center',
            dataIndex: 'paramaTableName_dictText'
          },
          {
            title: '型号/图号',
            align: 'center',
            dataIndex: 'toolModel'
          },
          {
            title: '分类名称',
            align: 'center',
            dataIndex: 'typeName'
          },
          // {
          //   title: '操作',
          //   dataIndex: 'action',
          //   align:"center",
          //   fixed:"right",
          //   width:147,
          //   scopedSlots: { customRender: 'action' },
          // }
        ],
        url: {
          list: "/tms/toolCombination/listToolCombinationDetailByMainId",
          delete: "/tms/toolCombination/deleteToolCombinationDetail",
          deleteBatch: "/tms/toolCombination/deleteBatchToolCombinationDetail",
          exportXlsUrl: "/tms/toolCombination/exportToolCombinationDetail",
          importUrl: "/tms/toolCombination/importToolCombinationDetail",
        },
        dictOptions:{
         status:[],
        }
      }
    },
    created() {
    },
    computed: {
      importExcelUrl(){
        return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`;
      }
    },
    methods: {
      clearList(){
        this.dataSource=[]
        this.selectedRowKeys=[]
        this.ipagination.current = 1
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>
src/views/tms/combinationKnife/ToolCombinationList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,266 @@
<template>
  <a-card :bordered='false'>
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class='table-page-search-wrapper'>
      <a-form layout='inline' @keyup.enter.native='searchQuery'>
        <a-row :gutter='24'>
          <a-col :lg='7' :md='8' :sm='24' :xl='6'>
            <a-form-item label='刀柄号'>
              <a-input v-model='queryParam.hiltCode' placeholder='请输入刀柄号'></a-input>
            </a-form-item>
          </a-col>
          <a-col :lg='7' :md='8' :sm='24' :xl='6'>
            <a-form-item label='状态'>
              <j-dict-select-tag v-model='queryParam.status' dictCode='combined_knife_state' placeholder='请选择状态' />
            </a-form-item>
          </a-col>
          <a-col :lg='7' :md='8' :sm='24' :xl='6'>
            <span class='table-page-search-submitButtons' style='float: left;overflow: hidden;'>
              <a-button icon='search' type='primary' @click='searchQuery'>查询</a-button>
              <a-button icon='reload' style='margin-left: 8px' type='primary' @click='searchReset'>重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class='table-operator'>
      <a-button icon='plus' type='primary' @click='handleAdd'>刀具组装</a-button>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table
        ref='table'
        :columns='columns'
        :customRow='clickThenSelect'
        :dataSource='dataSource'
        :loading='loading'
        :pagination='ipagination'
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
        :scroll='{x:true}'
        bordered
        class='j-table-force-nowrap'
        rowKey='id'
        size='middle'
        @change='handleTableChange'>
        <template slot='htmlSlot' slot-scope='text'>
          <div v-html='text'></div>
        </template>
        <template slot='imgSlot' slot-scope='text,record'>
          <span v-if='!text' style='font-size: 12px;font-style: italic;'>无图片</span>
          <img v-else :preview='record.id' :src='getImgView(text)' alt='' height='25px'
               style='max-width:80px;font-size: 12px;font-style: italic;' />
        </template>
        <template slot='fileSlot' slot-scope='text'>
          <span v-if='!text' style='font-size: 12px;font-style: italic;'>无文件</span>
          <a-button
            v-else
            :ghost='true'
            icon='download'
            size='small'
            type='primary'
            @click='downloadFile(text)'>
            ä¸‹è½½
          </a-button>
        </template>
        <span slot='action' slot-scope='text, record'>
              <a-popconfirm title='确定拆卸吗?' @confirm='() => handleDelete(record.id)'>
                  <a>刀具拆卸</a>
                </a-popconfirm>
        </span>
      </a-table>
    </div>
    <a-tabs defaultActiveKey='1'>
      <a-tab-pane key='1' tab='组合刀记录'>
        <ToolCombinationDetailList :mainId='toolCombinationDetailMainId' />
      </a-tab-pane>
    </a-tabs>
<!--    <toolCombination-modal ref='modalForm' @ok='modalFormOk'></toolCombination-modal>-->
    <inbound-order-model ref="modalForm" @ok="modalFormOk"></inbound-order-model>
  </a-card>
</template>
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import InboundOrderModel from './modules/InboundOrderModel'
// import ToolCombinationModal from './modules/ToolCombinationModal'
import { getAction } from '@/api/manage'
import ToolCombinationDetailList from './ToolCombinationDetailList'
import '@/assets/less/TableExpand.less'
export default {
  name: 'ToolCombinationList',
  mixins: [JeecgListMixin],
  components: {
    InboundOrderModel,
    ToolCombinationDetailList,
    // ToolCombinationModal
  },
  data() {
    return {
      description: '组合刀记录主表管理页面',
      // è¡¨å¤´
      columns: [
        {
          title: '刀柄号',
          align: 'center',
          dataIndex: 'hiltCode'
        },
        {
          title: '状态',
          align: 'center',
          dataIndex: 'status_dictText'
        },
        {
          title: '组装人',
          align: 'center',
          dataIndex: 'bindPerson'
        },
        {
          title: '组装时间',
          align: 'center',
          dataIndex: 'bindDate',
          customRender: function(text) {
            return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '拆卸人',
          align: 'center',
          dataIndex: 'disassemblePerson'
        },
        {
          title: '拆卸时间',
          align: 'center',
          dataIndex: 'disassembleDate',
          customRender: function(text) {
            return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          fixed: 'right',
          width: 147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/tms/toolCombination/list',
        delete: '/tms/toolCombination/delete',
        deleteBatch: '/tms/toolCombination/deleteBatch',
        exportXlsUrl: '/tms/toolCombination/exportXls',
        importExcelUrl: 'tms/toolCombination/importExcel'
      },
      dictOptions: {
        status: []
      },
      /* åˆ†é¡µå‚æ•° */
      ipagination: {
        current: 1,
        pageSize: 5,
        pageSizeOptions: ['5', '10', '50'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' å…±' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      selectedMainId: '',
      superFieldList: [],
      toolCombinationDetailMainId: ''
    }
  },
  created() {
    this.getSuperFieldList()
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    initDictConfig() {
    },
    clickThenSelect(record) {
      return {
        on: {
          click: () => {
            this.onSelectChange(record.id.split(','), [record])
          }
        }
      }
    },
    onClearSelected() {
      this.selectedRowKeys = []
      this.selectionRows = []
      this.selectedMainId = ''
    },
    onSelectChange(selectedRowKeys, selectionRows) {
      this.selectedMainId = selectedRowKeys[0]
      this.selectedRowKeys = selectedRowKeys
      this.selectionRows = selectionRows
      this.toolCombinationDetailMainId = selectionRows[0]['id']
    },
    loadData(arg) {
      if (!this.url.list) {
        this.$message.error('请设置url.list属性!')
        return
      }
      //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
      if (arg === 1) {
        this.ipagination.current = 1
      }
      this.onClearSelected()
      var params = this.getQueryParams()//查询条件
      this.loading = true
      getAction(this.url.list, params).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records
          this.ipagination.total = res.result.total
          // å­è¡¨ä¿¡æ¯å±•示
          if (this.dataSource.length !== 0) {
            // åˆ·æ–°å­è¡¨æ ¼
            this.selectedMainId = this.dataSource[0].id
            this.selectedRowKeys.push(this.dataSource[0].id);
            this.selectionRows = this.dataSource[0]
            this.toolCombinationDetailMainId = this.dataSource[0].id
          } else {
            // åˆ·æ–°å­è¡¨æ ¼
            this.toolCombinationDetailMainId = ''
          }
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false
      })
    },
    getSuperFieldList() {
      let fieldList = []
      fieldList.push({ type: 'string', value: 'id', text: '主键', dictCode: '' })
      fieldList.push({ type: 'string', value: 'hiltCode', text: '刀柄号', dictCode: '' })
      fieldList.push({ type: 'string', value: 'status', text: '状态', dictCode: 'combined_knife_state' })
      fieldList.push({ type: 'string', value: 'bindPerson', text: '组装人', dictCode: '' })
      fieldList.push({ type: 'date', value: 'bindDate', text: '组装时间' })
      fieldList.push({ type: 'string', value: 'disassemblePerson', text: '拆卸人', dictCode: '' })
      fieldList.push({ type: 'date', value: 'disassembleDate', text: '拆卸时间' })
      this.superFieldList = fieldList
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
src/views/tms/combinationKnife/modules/InboundOrderModel.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,463 @@
<template>
  <a-modal
    :title="title"
    :visible="visible"
    :fullScreen="true"
    :width="1200"
    @ok="handleOk"
    @cancel="handleCancel"
  >
    <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()" >选择工具</a-button>
    <a-table
      ref="table"
      bordered
      size="middle"
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
       @change="handleTableChange"
    >
      <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index">
        <div :key="col.dataIndex">
          <a-input-number
            v-if="col.dataIndex == 'inStorageQuantity'"
            :disabled="record.accuracyClass == '1'"
            :value="text"
            @change="(e) => handleChange(e, record.key, col, index)"
            :min="1"
          />
          <a-select
            v-if="col.dataIndex == 'goodsShelvesId'"
            :disabled="disableSubmit"
            :triggerChange="true"
            :value="text"
            show-search
            :filter-option="filterOption"
            style="width: 100%"
            :options="locationCodeOptions"
            @change="(e) => handleChange(e, record.key, col, index)"
          />
        </div>
      </template>
      <span slot="action" slot-scope="text, record, index">
        <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record, index)" :disabled="disableSubmit">
          <a>删除</a>
        </a-popconfirm>
      </span>
    </a-table>
    <template slot="footer" v-if="disableSubmit == false">
      <a-button :style="{ marginRight: '8px' }" @click="handleCancel">关闭</a-button>
      <a-button @click="handleOk" :disabled="isDisabled" type="primary">确定</a-button>
    </template>
    <template slot="footer" v-if="disableSubmit == true">
      <a-button :style="{ marginRight: '8px' }" @click="handleCancel">关闭</a-button>
    </template>
    <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk"></j-select-tooling-modal>
<!--    <j-select-return-list-modal ref="returnModalForm" @ok="modalFormOk"></j-select-return-list-modal>-->
<!--    <j-select-sharpen-list-modal ref="sharpenModalForm" @ok="modalFormOk"></j-select-sharpen-list-modal>-->
  </a-modal>
</template>
<script>
import pick from 'lodash.pick'
import JSelectToolingModal from './JSelectToolingModal'
import { ajaxGetDictItems } from '@/api/api'
import moment from 'moment'
import { getAction, postAction, requestPut } from '@/api/manage'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
import { filterObj } from '@/utils/util'
// import JSelectReturnListModal from './JSelectReturnListModal'
// import JSelectSharpenListModal from './JSelectSharpenListModal'
import store from '@/store'
export default {
  name: 'InboundOrderModel',
  components: {
    JSelectToolingModal,
    JMultiSelectTag,
    JDictSelectTag,
    // JSelectReturnListModal,
    JSearchSelectTag,
    // JSelectSharpenListModal,
    store
  },
  data() {
    return {
     /* åˆ†é¡µå‚æ•° */
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' å…±' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      isDisabled: false,
      selectedRowKeys: {},
      state: {
        show: false,
        maintenanceValue: 1,
        checkValue: 1,
        maintenanceState: false,
        checkState: false,
      },
      inboundDate: '',
      applicationDate: '',
      supplierShow: false,
      disableSubmit: false,
      numDisable:false,
      quantityDisable:false,
      onlyCodeDisable:true,
      toolingShow:false,
      addDisable:false,
      toolinngOptions:[],
      title: '操作',
      visible: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
      },
      confirmLoading: false,
      loading: false,
      form: this.$form.createForm(this),
      dataSource: [],
      toolingTreeData:[],
      warehouseOptions:[],
      locationOptions:[],
      allToolingList:[],
      param: {},
      barcodeCurrentType: false,
      inboundOrderId:'',
      url: {
        add: '/tms/toolCombination/add/combination',
        edit: '/tms/inboundOrder/edit',
        toolingList:'/tms/baseTools/list',
        querySharpenList:'/tms/toolLedgerDetail/list',
        queryReturnList:'/tms/toolLedgerDetail/list',
        detailList:'/tms/inboundDetail/list',
      },
      toolingOptions:[],
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
           width: 50,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '工具编码',
          align: 'center',
          dataIndex: 'toolId'
        },
        {
          title: '工具类型',
          align: 'center',
          dataIndex: 'applicationType_dictText'
        },
        // {
        //   title: '工具编号',
        //   align: 'center',
        //   dataIndex: 'toolId'
        // },
        {
          title: '中文名称',
          align: 'center',
          dataIndex: 'chineseName'
        },
        {
          title: '工具参数标识',
          align: 'center',
          dataIndex: 'paramaTableName_dictText'
        },
        {
          title: '型号/图号',
          align: 'center',
          dataIndex: 'toolModel'
        },
        {
          title: '分类名称',
          align: 'center',
          dataIndex: 'typeName'
        },
        //  {
        //   title: '库位号',
        //   align: 'center',
        //   dataIndex: 'goodsShelvesId',
        //   scopedSlots: { customRender: 'goodsShelvesId' },
        // },
        // {
        //   title: '入库数量',
        //   align: 'center',
        //   dataIndex: 'inStorageQuantity',
        //   scopedSlots: { customRender: 'inStorageQuantity' },
        // },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
        },
      ],
      locationCodeOptions:[]
    }
  },
  created() {
    ajaxGetDictItems("tms_goods_shelves,location_code,id", null).then((res) => {
        if (res.success) {
          this.locationCodeOptions = res.result
        }
      })
  },
  methods: {
    modalFormOk() {
    },
    filterOption(input, option) {
      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
    },
    getQueryParams() {
      this.param.pageNo = this.ipagination.current
      this.param.pageSize = this.ipagination.pageSize
      return filterObj(this.param)
    },
    add() {
      this.hafilterOptionndle = store.getters.userInfo.username
      this.edit({})
    },
    edit(record) {
      let that = this
      this.form.resetFields()
      this.model = Object.assign({}, record)
      this.visible = true
      this.isDisabled = false
      this.disableSubmit = false
      if (record.id) {
        if(record.inStorehouseType == "1"){
          this.toolingShow = true
        }
        this.inboundOrderId = record.id
        this.detailList(this.inboundOrderId)
      }
      this.$nextTick(() => {
        this.form.setFieldsValue(
          pick(this.model, 'inboundNum', 'inStorehouseType', 'inboundTime', 'applicationReason', 'handler','approvalDate','reviewer','approvalOpinion','remark')
        )
      })
    },
    handleChange(value, key, column, index) {
      //let t = (this.ipaginationm.current - 1) * this.ipaginationm.pageSize + index
      const temp = [...this.dataSource]
      const target = temp.filter(item => key === item.key)[index];
      if (target) {
        target[column.dataIndex] = value
        if(column.dataIndex === 'inStorageQuantity'){
          if(target['quantity']<value){
            this.$message.error('入库数量不能大于出库数量!')
            this.isDisabled = true
          }else{
            this.isDisabled = false
          }
        }
        this.dataSource = temp
      }
    },
    close() {
      this.$emit('close')
      this.dataSource = []
      this.visible = false
      this.supplierShow = false,
       this.disableSubmit = false,
       this.numDisable = false,
      this.quantityDisable = false,
       this.onlyCodeDisable = true,
       this.toolingShow = false,
       this.addDisable = false
    },
    handleTableChange(pagination, filters, sorter) {
      this.ipagination = pagination
      this.detailList(this.inboundOrderId);
    },
    handleOk() {
      const that = this
      // æ£€æŸ¥æ•°ç»„是否为空
      if (!this.dataSource || this.dataSource.length === 0) {
        that.$message.warning('请选择工具')
        return;
      }
      // éªŒè¯æ˜¯å¦æœ‰åˆ€æŸ„
      if (!this.checkHasSingleHandle()) {
        that.$message.warning('请选择一把刀柄信息')
        return;
      }
      if (this.dataSource.length < 2) {
        that.$message.warning('请选择至少一把刀具')
        return;
      }
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true
          let formData = Object.assign(this.model, values)
          formData.detailData = this.dataSource
          let http = ''
          if(this.model.id){
            http = this.url.edit
          }else{
            http = this.url.add
          }
          postAction(http, formData)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok', new Date())
              } else {
                that.$message.warning(res.message)
              }
            })
            .finally(() => {
              that.confirmLoading = false
              that.close()
            })
        }
      })
    },
    handleCancel() {
      this.close()
    },
    // æ£€æŸ¥æ˜¯å¦æœ‰ä¸”仅有一条typeName为"刀柄"的数据
    checkHasSingleHandle() {
      // å…ˆç¡®ä¿dataSource是数组且不为空
      if (!Array.isArray(this.dataSource) || this.dataSource.length === 0) {
        return false;
      }
      // ç­›é€‰å‡ºtypeName为"刀柄"的条目
      const handleItems = this.dataSource.filter(
        item => item && item.typeName === '刀柄'
      );
      // æ£€æŸ¥æ˜¯å¦åˆšå¥½æœ‰ä¸€æ¡ç¬¦åˆæ¡ä»¶çš„æ•°æ®
      return handleItems.length === 1;
    },
    //选择工具
    selectTooling: function () {
      let ids = []
      for (let i = 0; i < this.dataSource.length; i++) {
        ids.push(this.dataSource[i].id)
      }
      this.$refs.toolingModalForm.showModal(ids)
      this.$refs.toolingModalForm.title = '选择工具'
      this.$refs.toolingModalForm.disableSubmit = false
    },
    //选择归还工具
    selectReturnList: function () {
      let ids = []
      for (let i = 0; i < this.dataSource.length; i++) {
        ids.push(this.dataSource[i].id)
      }
      this.$refs.returnModalForm.showModal(ids)
      this.$refs.returnModalForm.title = '选择归还工具'
      this.$refs.returnModalForm.disableSubmit = false
    },
    //选择刃磨工具
    selectSharpenList: function () {
      let ids = []
      for (let i = 0; i < this.dataSource.length; i++) {
        ids.push(this.dataSource[i].id)
      }
      this.$refs.sharpenModalForm.showModal(ids)
      this.$refs.sharpenModalForm.title = '选择刃磨工具'
      this.$refs.sharpenModalForm.disableSubmit = false
    },
    handleDelete(record, index) {
      this.dataSource.splice(index, 1)
    },
    onChange() {},
    //手选人员值
    selectCurrentUserChange(e) {
      console.log('当前手选', e)
      // this.form.setFieldsValue({
      //   // userName: e,
      //   userNameId: e,
      // })
    },
    detailList(inboundOrderId) {
      this.param.inboundOrderId = inboundOrderId
      getAction(this.url.detailList, this.getQueryParams()).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records
          this.ipagination.total = res.result.total;
        }
      })
    },
     filterOption(input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      );
    },
  },
  watch: {},
  mounted() {
    this.$bus.$on('selectionRows', (data) => {
      //getCurrSelected äº‹ä»¶ æŽ¥æ”¶ç»„件传递的参数
      for (let i = 0; i < data.length; i++) {
        this.dataSource.push({
          id:data[i].id,
          applicationType_dictText: data[i].applicationType_dictText,
          typeName: data[i].typeName,
          paramaTableName_dictText: data[i].paramaTableName_dictText,
          toolCodeId: data[i].toolCodeId,
          toolId: data[i].toolId,
          chineseName: data[i].chineseName,
          toolModel: data[i].toolModel,
          applicationType: data[i].applicationTypeName,
          onlyCode:data[i].onlyCode,
          quantity:data[i].quantity,
          inStorageQuantity:data[i].storageQuantity || data[i].quantity || 1,
          accuracyClass:data[i].accuracyClass
        })
      }
      //this.ipaginationm.total = this.dataSource.length
    })
  },
}
</script>
<style  lang="less" scoped>
.ant-btn {
  padding: 0 10px;
  margin-left: 3px;
}
.ant-form-item-control {
  line-height: 0px;
}
/** ä¸»è¡¨å•行间距 */
.ant-form .ant-form-item {
  margin-bottom: 10px;
}
/** Tab页面行间距 */
.ant-tabs-content .ant-form-item {
  margin-bottom: 0px;
}
/deep/ .notshow {
  display: none;
}
</style>
src/views/tms/combinationKnife/modules/JSelectToolingModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,275 @@
<template>
  <!--支持全屏缩放-->
  <j-modal
    :visible="visible"
    :title="title"
    switchFullscreen
    :width="1200"
    @ok="handleSubmit"
    @cancel="close"
    style="top: 50px"
    cancelText="关闭"
  >
    <a-card :bordered="false">
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="工具编码">
                <a-input placeholder="请输入工具编码,支持模糊查询" v-model="queryParam.toolCode"></a-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="中文名称">
                <a-input placeholder="请输入中文名称,支持模糊查询" v-model="queryParam.chineseName"></a-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="型号/图号">
                <a-input placeholder="请输入规格型号,支持模糊查询" v-model="queryParam.toolModel"></a-input>
              </a-form-item>
            </a-col>
            <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
            <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
          </a-row>
        </a-form>
      </div>
      <!--工具列表-->
      <a-table
        ref="table"
        :scroll="scrollTrigger"
        size="middle"
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :rowSelection="rowSelection"
        :loading="loading"
        @change="handleTableChange"
      >
      </a-table>
    </a-card>
  </j-modal>
</template>
<script>
import { filterObj } from '@/utils/util'
import { getAction } from '@/api/manage'
export default {
  name: 'JSelectToolingModal',
  components: {},
  props: {
    classifyId:{
        type:String
      }
  },
  data() {
    return {
      queryParam: {},
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 50,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '工具编码',
          align: 'center',
          dataIndex: 'toolId'
        },
        {
          title: '工具类型',
          align: 'center',
          dataIndex: 'applicationType_dictText'
        },
        // {
        //   title: '工具编号',
        //   align: 'center',
        //   dataIndex: 'toolId'
        // },
        {
          title: '中文名称',
          align: 'center',
          dataIndex: 'chineseName'
        },
        {
          title: '工具参数标识',
          align: 'center',
          dataIndex: 'paramaTableName_dictText'
        },
        {
          title: '型号/图号',
          align: 'center',
          dataIndex: 'toolModel'
        },
        {
          title: '型号/图号',
          align: 'center',
          dataIndex: 'toolModel'
        },
        {
          title: '分类名称',
          align: 'center',
          dataIndex: 'typeName'
        },
      ],
      selectedRowKeys: [],
      oldSlelectRows: [],
      scrollTrigger: {},
      dataSource: [],
      selectionRows: [],
      title: '根据查询结果选择工具',
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['5', '10', '20'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' å…±' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0,
      },
      isorter: {
        column: 'toolCode',
        order: 'desc',
      },
      departTree: [],
      visible: false,
      loading: false,
      url: {
        // list: '/base/tooling/list',
        list: '/tms/baseTools/listWithSharpedAndConfig/combination'
      },
    }
  },
  computed: {
    rowSelection() {
      return {
        type: 'checkbox',
        onChange: (selectedRowKeys, selectedRows) => {
          this.selectedRowKeys = selectedRowKeys
          this.onSelectChange(selectedRows)
        },
        getCheckboxProps: (record) => ({
          props: {
            disabled: record.distable,
          },
        }),
        selectedRowKeys: this.selectedRowKeys,
      }
    },
  },
  watch: {},
  created() {},
  methods: {
    async loadData(arg) {
      if (arg === 1) {
        this.ipagination.current = 1
      }
      let that = this
      this.loading = true
      let params = this.getQueryParams() //查询条件
      params.classifyId = this.classifyId
      await getAction(this.url.list, params).then((res) => {
        if (res.success) {
          for (let i = 0; i < res.result.records.length; i++) {
            if (that.oldSlelectRows.indexOf(res.result.records[i].id) > -1) {
              res.result.records[i].distable = true
            } else {
              res.result.records[i].distable = false
            }
          }
          this.dataSource = res.result.records
          this.ipagination.total = res.result.total
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false
      })
    },
    showModal(oldSlelectRows) {
      this.oldSlelectRows = oldSlelectRows
      this.visible = true
      this.loadData(1)
    },
    getQueryParams() {
      let param = Object.assign({}, this.queryParam, this.isorter)
      param.field = this.getQueryField()
      param.pageNo = this.ipagination.current
      param.pageSize = this.ipagination.pageSize
      return filterObj(param)
    },
    //查询条件处理
    getQueryField() {
      let str = 'id,'
      for (let a = 0; a < this.columns.length; a++) {
        str += ',' + this.columns[a].dataIndex
      }
      return str
    },
    searchReset(num) {
      let that = this
      if (num !== 0) {
        that.loadData(1)
      }
      that.selectborrowIds = []
    },
    close() {
      this.searchReset(0)
      this.selectedRowKeys = []
      this.visible = false
    },
    handleTableChange(pagination, filters, sorter) {
      //TODO ç­›é€‰
      if (Object.keys(sorter).length > 0) {
        this.isorter.column = sorter.field
        this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
      }
      this.ipagination = pagination
      this.loadData()
    },
    handleSubmit() {
      this.$bus.$emit('selectionRows', this.selectionRows)
      this.searchReset(0)
      this.close()
    },
    onSelectChange(selectionRows) {
      this.selectionRows = selectionRows
    },
    onSearch() {
      this.loadData(1)
    },
     searchQuery() {
      this.loadData(1);
    },
    searchReset() {
      this.queryParam = {}
      this.loadData(1)
    },
  },
}
</script>
<style scoped>
.ant-table-tbody .ant-table-row td {
  padding-top: 10px;
  padding-bottom: 10px;
}
#components-layout-demo-custom-trigger .trigger {
  font-size: 18px;
  line-height: 64px;
  padding: 0 24px;
  cursor: pointer;
  transition: color 0.3s;
}
</style>
src/views/tms/combinationKnife/modules/ToolCombinationDetailModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,133 @@
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validatorRules">
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="刀柄号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hiltCode">
              <a-input v-model="model.hiltCode"placeholder="请输入刀柄号" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="组合刀id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="combinationId">
              <a-input v-model="model.combinationId"placeholder="请输入组合刀id" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="刀具唯一编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="onlyCode">
              <a-input v-model="model.onlyCode"placeholder="请输入刀具唯一编码" ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
  import { httpAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'
  export default {
    name: "ToolCombinationDetailModal",
    components: {
    },
    props:{
      mainId:{
        type:String,
        required:false,
        default:''
      }
    },
    data () {
      return {
        title:"操作",
        width:800,
        visible: false,
        model:{
        },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
        },
        url: {
          add: "/tms/toolCombination/addToolCombinationDetail",
          edit: "/tms/toolCombination/editToolCombinationDetail",
        }
      }
    },
    created () {
    //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model));
    },
    methods: {
      add () {
        this.edit(this.modelDefault);
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      close () {
        this.$emit('close');
        this.visible = false;
        this.$refs.form.clearValidate();
      },
      handleOk () {
        const that = this;
        // è§¦å‘表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            this.model['combinationId'] = this.mainId
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.close();
            })
          }else{
             return false
          }
        })
      },
      handleCancel () {
        this.close()
      },
    }
  }
</script>