no message
							parent
							
								
									bf360febbe
								
							
						
					
					
						commit
						df31755799
					
				| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
  <div class="crud-opts">
 | 
			
		||||
    <span class="crud-opts-left">
 | 
			
		||||
      <!--左侧插槽-->
 | 
			
		||||
      <slot name="left" />
 | 
			
		||||
      <slot name="left"/>
 | 
			
		||||
      <el-button
 | 
			
		||||
        v-if="crud.optShow.add"
 | 
			
		||||
        v-permission="permission.add"
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +51,7 @@
 | 
			
		|||
        @click="crud.doExport"
 | 
			
		||||
      >导出</el-button>
 | 
			
		||||
      <!--右侧-->
 | 
			
		||||
      <slot name="right" />
 | 
			
		||||
      <slot name="right"/>
 | 
			
		||||
    </span>
 | 
			
		||||
    <el-button-group class="crud-opts-right">
 | 
			
		||||
      <el-button
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +106,7 @@
 | 
			
		|||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import CRUD, { crud } from '@crud/crud'
 | 
			
		||||
import CRUD, {crud} from '@crud/crud'
 | 
			
		||||
import crudTableConfig from '@/api/tableConfig'
 | 
			
		||||
import Sortable from 'sortablejs'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -130,22 +130,28 @@ export default {
 | 
			
		|||
  props: {
 | 
			
		||||
    permission: {
 | 
			
		||||
      type: Object,
 | 
			
		||||
      default: () => { return {} }
 | 
			
		||||
      default: () => {
 | 
			
		||||
        return {}
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    ignoreColumns: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      default: () => { return [] }
 | 
			
		||||
      default: () => {
 | 
			
		||||
        return []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    tableKey: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: () => { return '' }
 | 
			
		||||
      default: () => {
 | 
			
		||||
        return ''
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      hiddenColumns:[],
 | 
			
		||||
      table_configs:[],
 | 
			
		||||
      table_configs_xs:[],
 | 
			
		||||
      hiddenColumns: [],
 | 
			
		||||
      table_configs: [],
 | 
			
		||||
      table_configs_xs: [],
 | 
			
		||||
      tableColumns: [],
 | 
			
		||||
      allColumnsSelected: true,
 | 
			
		||||
      allColumnsSelectedIndeterminate: false,
 | 
			
		||||
| 
						 | 
				
			
			@ -180,83 +186,57 @@ export default {
 | 
			
		|||
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
 | 
			
		||||
    initcolumn() {
 | 
			
		||||
      this.updateTableColumns()
 | 
			
		||||
      const strHidden = sessionStorage.getItem(this.tableKey)
 | 
			
		||||
 | 
			
		||||
      // 检查 sessionStorage 值是否存在
 | 
			
		||||
      if (!strHidden) {
 | 
			
		||||
        this.hiddenColumns = []
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // 安全解析 JSON 数据
 | 
			
		||||
      try {
 | 
			
		||||
        this.hiddenColumns = JSON.parse(strHidden) || []
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        this.hiddenColumns = []
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (this.hiddenColumns.length > 0) {
 | 
			
		||||
      this.hiddenColumns = JSON.parse(strHidden);
 | 
			
		||||
      if (this.hiddenColumns) {
 | 
			
		||||
        const table = this.crud.props.table
 | 
			
		||||
 | 
			
		||||
        // 预先构建 label 到 column 的映射,提高查找效率
 | 
			
		||||
        const labelToColumnMap = {}
 | 
			
		||||
        if (table && table.$children) {
 | 
			
		||||
          table.$children.forEach(child => {
 | 
			
		||||
            if (child.label) {
 | 
			
		||||
              labelToColumnMap[child.label] = child
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.table_configs_xs.forEach((column, index) => {
 | 
			
		||||
          const vm = labelToColumnMap[column.label]
 | 
			
		||||
 | 
			
		||||
          // 检查元素是否存在
 | 
			
		||||
          if (!vm) {
 | 
			
		||||
            return
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          const vm = table.$children.find(e => e.label === column.label)
 | 
			
		||||
          const columnConfig = vm.columnConfig
 | 
			
		||||
 | 
			
		||||
          // 检查 columnConfig 是否有效
 | 
			
		||||
          if (!columnConfig) {
 | 
			
		||||
            return
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          if (vm.owner && vm.owner.store) {
 | 
			
		||||
            vm.owner.store.commit('removeColumn', columnConfig, null)
 | 
			
		||||
          }
 | 
			
		||||
          vm.owner.store.commit('removeColumn', columnConfig, null)
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        this.ignoreNextTableColumnsChange = false
 | 
			
		||||
 | 
			
		||||
        setTimeout(() => {
 | 
			
		||||
          // 方法区
 | 
			
		||||
          this.showcolumn()
 | 
			
		||||
          this.showcolumn();
 | 
			
		||||
        }, 200)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    showcolumn() {
 | 
			
		||||
      console.log("------显示列------")
 | 
			
		||||
      const strHidden=sessionStorage.getItem(this.tableKey)
 | 
			
		||||
      this.hiddenColumns= JSON.parse(strHidden);
 | 
			
		||||
      const table = this.crud.props.table
 | 
			
		||||
      this.hiddenColumns.forEach((column,index) => {
 | 
			
		||||
 | 
			
		||||
        const vm = table.$children.find(e => e.prop === column.property)
 | 
			
		||||
        const columnConfig = vm.columnConfig
 | 
			
		||||
        console.log(columnConfig.label)
 | 
			
		||||
        if(column.visible){
 | 
			
		||||
          columnConfig.width=column.width
 | 
			
		||||
          columnConfig.visible=column.visible
 | 
			
		||||
          vm.owner.store.commit('insertColumn', columnConfig, index+1  , null)
 | 
			
		||||
      try {
 | 
			
		||||
        // 从sessionStorage安全地获取并解析hiddenColumns
 | 
			
		||||
        const strHidden = sessionStorage.getItem(this.tableKey)
 | 
			
		||||
        if (strHidden) {
 | 
			
		||||
          this.hiddenColumns = JSON.parse(strHidden);
 | 
			
		||||
        } else {
 | 
			
		||||
          // 如果没有找到相应的存储信息,可以初始化为空数组或相应的默认值
 | 
			
		||||
          this.hiddenColumns = [];
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      console.log("------显示列完成------")
 | 
			
		||||
      this. updateTableColumns();
 | 
			
		||||
 | 
			
		||||
        const table = this.crud.props.table
 | 
			
		||||
        // 优化循环中的条件判断和错误处理
 | 
			
		||||
        this.hiddenColumns.forEach((column, index) => {
 | 
			
		||||
          const vm = table.$children.find(e => e && e.prop === column.property)
 | 
			
		||||
          if (vm) {
 | 
			
		||||
            const columnConfig = vm.columnConfig;
 | 
			
		||||
            // 确保columnConfig存在
 | 
			
		||||
            if (columnConfig) {
 | 
			
		||||
              if (column.visible) {
 | 
			
		||||
                // 仅当列需要显示时,才更新其配置
 | 
			
		||||
                columnConfig.width = column.width;
 | 
			
		||||
                columnConfig.visible = column.visible;
 | 
			
		||||
                vm.owner.store.commit('insertColumn', columnConfig, index + 1, null);
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
        this.updateTableColumns();
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        console.error("处理列配置时发生错误:", error);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    //列拖拽
 | 
			
		||||
    columnDrop() {
 | 
			
		||||
| 
						 | 
				
			
			@ -266,51 +246,51 @@ export default {
 | 
			
		|||
        delay: 0,
 | 
			
		||||
        onEnd: evt => {
 | 
			
		||||
          // 根据中文label进行拖拉
 | 
			
		||||
          this.ColumnsDrop(evt.item.innerText,evt.newIndex)
 | 
			
		||||
          this.ColumnsDrop(evt.item.innerText, evt.newIndex)
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    //新加方法
 | 
			
		||||
    ColumnsDrop(oldText,newIndex) {
 | 
			
		||||
    ColumnsDrop(oldText, newIndex) {
 | 
			
		||||
      const table = this.crud.props.table
 | 
			
		||||
      let myindex = -1 //空格
 | 
			
		||||
      let oldIndex1 = 0
 | 
			
		||||
      let  step = -1
 | 
			
		||||
      let step = -1
 | 
			
		||||
      let count = 0
 | 
			
		||||
      //
 | 
			
		||||
      this.tableColumns.some((column,index) => {
 | 
			
		||||
        if(column.visible) {
 | 
			
		||||
      this.tableColumns.some((column, index) => {
 | 
			
		||||
        if (column.visible) {
 | 
			
		||||
          count++
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      // 定位拖拉中文表头位置以及在该字段之前隐藏字段数量
 | 
			
		||||
      this.tableColumns.some((column,index) => {
 | 
			
		||||
        if(column.label === oldText) {
 | 
			
		||||
      this.tableColumns.some((column, index) => {
 | 
			
		||||
        if (column.label === oldText) {
 | 
			
		||||
          oldIndex1 = index
 | 
			
		||||
          return true
 | 
			
		||||
        }else{
 | 
			
		||||
        } else {
 | 
			
		||||
          // 空格在字段前面
 | 
			
		||||
          if(step>index){
 | 
			
		||||
          if (step > index) {
 | 
			
		||||
            myindex++
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        step++
 | 
			
		||||
      })
 | 
			
		||||
      if (myindex === -1  ) {
 | 
			
		||||
      if (myindex === -1) {
 | 
			
		||||
        myindex = 0
 | 
			
		||||
      }
 | 
			
		||||
      let item= this.tableColumns[oldIndex1]
 | 
			
		||||
      let item = this.tableColumns[oldIndex1]
 | 
			
		||||
      const vm = table.$children.find(e => e.prop === item.property)
 | 
			
		||||
      const columnConfig = vm.columnConfig
 | 
			
		||||
      /*this.tableColumns.splice(oldIndex1-1, 1)
 | 
			
		||||
      this.tableColumns.splice(myindex-1, 0, item)*/
 | 
			
		||||
      if(oldIndex1 <newIndex){ // 从左至右拖动
 | 
			
		||||
        vm.owner.store.commit('insertColumn', columnConfig, newIndex+myindex  , null)
 | 
			
		||||
      if (oldIndex1 < newIndex) { // 从左至右拖动
 | 
			
		||||
        vm.owner.store.commit('insertColumn', columnConfig, newIndex + myindex, null)
 | 
			
		||||
        vm.owner.store.commit('removeColumn', columnConfig, null)
 | 
			
		||||
      }else { //从右至左拖动
 | 
			
		||||
      } else { //从右至左拖动
 | 
			
		||||
        vm.owner.store.commit('removeColumn', columnConfig, null)
 | 
			
		||||
        vm.owner.store.commit('insertColumn', columnConfig, newIndex+myindex  , null)
 | 
			
		||||
        vm.owner.store.commit('insertColumn', columnConfig, newIndex + myindex, null)
 | 
			
		||||
      }
 | 
			
		||||
      // 列重新排序
 | 
			
		||||
      this.ignoreNextTableColumnsChange = false
 | 
			
		||||
| 
						 | 
				
			
			@ -381,7 +361,7 @@ export default {
 | 
			
		|||
      })
 | 
			
		||||
      if (selectedCount === 0) {
 | 
			
		||||
        this.crud.notify('请至少选择一列', CRUD.NOTIFICATION_TYPE.WARNING)
 | 
			
		||||
        this.$nextTick(function() {
 | 
			
		||||
        this.$nextTick(function () {
 | 
			
		||||
          item.visible = true
 | 
			
		||||
        })
 | 
			
		||||
        return
 | 
			
		||||
| 
						 | 
				
			
			@ -404,8 +384,8 @@ export default {
 | 
			
		|||
      crudTableConfig.add(post_table_config)*/
 | 
			
		||||
      //this.postToTableConfig();
 | 
			
		||||
    },
 | 
			
		||||
    postToTableConfig(){
 | 
			
		||||
      this. updateTableColumns();
 | 
			
		||||
    postToTableConfig() {
 | 
			
		||||
      this.updateTableColumns();
 | 
			
		||||
      const columns = []
 | 
			
		||||
      this.tableColumns.forEach(column => {
 | 
			
		||||
        const table_config = {
 | 
			
		||||
| 
						 | 
				
			
			@ -421,11 +401,11 @@ export default {
 | 
			
		|||
        tableType: this.tableKey
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      this.crud.loading=true
 | 
			
		||||
      this.crud.loading = true
 | 
			
		||||
      crudTableConfig.add(post_table_config).then(res => {
 | 
			
		||||
        setTimeout(() => {
 | 
			
		||||
          // 方法区
 | 
			
		||||
          this.crud.loading=false
 | 
			
		||||
          this.crud.loading = false
 | 
			
		||||
        }, 500)
 | 
			
		||||
 | 
			
		||||
      })
 | 
			
		||||
| 
						 | 
				
			
			@ -440,7 +420,7 @@ export default {
 | 
			
		|||
      if (item.visible) {
 | 
			
		||||
        // 找出合适的插入点
 | 
			
		||||
        const columnIndex = this.tableColumns.indexOf(item)
 | 
			
		||||
        vm.owner.store.commit('insertColumn', columnConfig, columnIndex+1, null)
 | 
			
		||||
        vm.owner.store.commit('insertColumn', columnConfig, columnIndex + 1, null)
 | 
			
		||||
      } else {
 | 
			
		||||
        vm.owner.store.commit('removeColumn', columnConfig, null)
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			@ -460,9 +440,11 @@ export default {
 | 
			
		|||
  display: flex;
 | 
			
		||||
  align-items: center;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.crud-opts .crud-opts-right {
 | 
			
		||||
  margin-left: auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.crud-opts .crud-opts-right span {
 | 
			
		||||
  float: left;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,9 +5,11 @@
 | 
			
		|||
      <!--      查询操作-->
 | 
			
		||||
      <el-form ref="form" :inline="true" :model="form" label-width="70px">
 | 
			
		||||
 | 
			
		||||
          <el-input v-model="query.itemCode" clearable placeholder="品番" style="width: 140px;"  class="filter-item"
 | 
			
		||||
                    @keyup.enter.native="crud.toQuery"/>
 | 
			
		||||
        <el-select v-model="query.status" clearable placeholder="状态" value-key="id"  class="filter-item" style="width: 150px"
 | 
			
		||||
        <el-input v-model="query.itemCode" clearable placeholder="品番" style="width: 140px;" class="filter-item"
 | 
			
		||||
                  @keyup.enter.native="crud.toQuery"
 | 
			
		||||
        />
 | 
			
		||||
        <el-select v-model="query.status" clearable placeholder="状态" value-key="id" class="filter-item"
 | 
			
		||||
                   style="width: 150px"
 | 
			
		||||
                   @keyup.enter.native="crud.toQuery"
 | 
			
		||||
        >
 | 
			
		||||
          <el-option
 | 
			
		||||
| 
						 | 
				
			
			@ -19,11 +21,15 @@
 | 
			
		|||
          >
 | 
			
		||||
          </el-option>
 | 
			
		||||
        </el-select>
 | 
			
		||||
        <AreaSelect v-model="query.area"  />
 | 
			
		||||
        <PointCodeSelect :value-key="'id'" :point_type="'CH'" v-model="query.itemCode2" />
 | 
			
		||||
        <AreaCodeSelect v-model="query.ckAreaCode" :bexb="false"  class="filter-item"  filterable placeholder="拣货库区" style="width: 155px;"/>
 | 
			
		||||
        <AreaCodeSelect v-model="query.rkAreaCode" @keyup.enter.native="crud.toQuery" :bexb="true"  class="filter-item"  filterable placeholder="叫料库区" style="width: 155px;"/>
 | 
			
		||||
        <date-range-picker v-model="query.createTime" class="date-item" style="width: 100px" />
 | 
			
		||||
        <AreaSelect v-model="query.ckAreaCode" :return-type="'value'" :return-value-key="'code'" :bexb="false"
 | 
			
		||||
                    class="filter-item" placeholder="拣货库区" style="width: 155px;"
 | 
			
		||||
 | 
			
		||||
        />
 | 
			
		||||
        <AreaSelect v-model="query.rkAreaCode" :return-type="'value'" :return-value-key="'code'" :bexb="true"
 | 
			
		||||
                    class="filter-item" placeholder="叫料库区" style="width: 155px;"
 | 
			
		||||
 | 
			
		||||
        />
 | 
			
		||||
        <date-range-picker v-model="query.createTime" class="date-item" style="width: 100px"/>
 | 
			
		||||
        <!--        搜索-->
 | 
			
		||||
        <rrOperation :crud="crud"/>
 | 
			
		||||
        <!--        重置-->
 | 
			
		||||
| 
						 | 
				
			
			@ -92,13 +98,14 @@
 | 
			
		|||
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small"
 | 
			
		||||
                style="width: 100%;"
 | 
			
		||||
                height="58vh"
 | 
			
		||||
                @selection-change="selectionChangeHandlerTwo" border>
 | 
			
		||||
                @selection-change="selectionChangeHandlerTwo" border
 | 
			
		||||
      >
 | 
			
		||||
        <el-table-column type="selection" width="50"/>
 | 
			
		||||
        <el-table-column prop="id" label="序号"/>
 | 
			
		||||
       <!-- <el-table-column prop="shArea.gcCode" label="工厂" width="150px"/>-->
 | 
			
		||||
        <!-- <el-table-column prop="shArea.gcCode" label="工厂" width="150px"/>-->
 | 
			
		||||
 | 
			
		||||
        <el-table-column  prop="item.code" label="品番" width="150px"/>
 | 
			
		||||
        <el-table-column  prop="item.name" label="品名"/>
 | 
			
		||||
        <el-table-column prop="item.code" label="品番" width="150px"/>
 | 
			
		||||
        <el-table-column prop="item.name" label="品名"/>
 | 
			
		||||
        <el-table-column prop="status" label="状态">
 | 
			
		||||
          <template slot-scope="scope">
 | 
			
		||||
            {{ dict.label.pick_status[scope.row.status] }}
 | 
			
		||||
| 
						 | 
				
			
			@ -113,26 +120,25 @@
 | 
			
		|||
        <el-table-column prop="xdPf" label="箱单品番" width="100px"/>
 | 
			
		||||
        <el-table-column prop="orderQty" label="订单数量"/>
 | 
			
		||||
        <el-table-column prop="allocatedQty" label="分配数量"/>
 | 
			
		||||
        <el-table-column prop="pickedQty" label="拣货数量"/>
 | 
			
		||||
        <el-table-column prop="pickedQty" label="拣货数量"/>
 | 
			
		||||
        <el-table-column prop="remark" label="备注"/>
 | 
			
		||||
 | 
			
		||||
        <el-table-column prop="createBy" label="创建人"/>
 | 
			
		||||
        <el-table-column prop="createTime" width="150px" label="创建时间"/>
 | 
			
		||||
        <el-table-column label="操作" width="150px" align="center">
 | 
			
		||||
 | 
			
		||||
          <template slot-scope="scope">
 | 
			
		||||
            <el-button size="mini" :disabled="scope.row.status!='OPEN'" type="primary" icon="el-icon-edit"
 | 
			
		||||
                       @click="editPick(scope.row)"/>
 | 
			
		||||
                       @click="editPick(scope.row)"
 | 
			
		||||
            />
 | 
			
		||||
            <template>
 | 
			
		||||
              <el-popconfirm
 | 
			
		||||
                title="确定删除吗?"
 | 
			
		||||
                icon='el-icon-delete'
 | 
			
		||||
                icon-color='red'
 | 
			
		||||
                icon="el-icon-delete"
 | 
			
		||||
                icon-color="red"
 | 
			
		||||
                @confirm="deletePick(scope.row)"
 | 
			
		||||
              >
 | 
			
		||||
                <el-button slot="reference" :disabled="scope.row.status!='OPEN'" size="mini" type="danger"
 | 
			
		||||
                           icon="el-icon-delete"/>
 | 
			
		||||
                           icon="el-icon-delete"
 | 
			
		||||
                />
 | 
			
		||||
              </el-popconfirm>
 | 
			
		||||
            </template>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -144,25 +150,25 @@
 | 
			
		|||
      <XdTask ref="xdTask"/>
 | 
			
		||||
 | 
			
		||||
      <!--表单组件-->
 | 
			
		||||
        <el-dialog title="制造叫料" :visible.sync="cxjlFromFlag" width="500px" >
 | 
			
		||||
      <el-dialog title="制造叫料" :visible.sync="cxjlFromFlag" width="500px">
 | 
			
		||||
        <el-form ref="cxjlFrom" :model="cxjlFrom" :rules="rules" size="small" label-width="80px">
 | 
			
		||||
          <el-form-item label="制造库位" prop="zzkwCode">
 | 
			
		||||
               <BomAccountPointSelect v-model="cxjlFrom.zzkw_code" :value-key="'bom_account_id'" @change="getChangeVule"/>
 | 
			
		||||
            <BomAccountPointSelect v-model="cxjlFrom.zzkw_code" :value-key="'bom_account_id'" @change="getChangeVule"/>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item label="品番">
 | 
			
		||||
            <el-input v-model="cxjlFrom.item_code" />
 | 
			
		||||
            <el-input v-model="cxjlFrom.item_code"/>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item label="品名">
 | 
			
		||||
            <el-input  v-model="cxjlFrom.item_name"  />
 | 
			
		||||
            <el-input v-model="cxjlFrom.item_name"/>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item label="数量">
 | 
			
		||||
            <el-input v-model="cxjlFrom.order_qty" />
 | 
			
		||||
            <el-input v-model="cxjlFrom.order_qty"/>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item label="税别">
 | 
			
		||||
            <el-input v-model="cxjlFrom.bonded"/>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item label="叫料库区">
 | 
			
		||||
            <el-input  v-model="cxjlFrom.gw_name" />
 | 
			
		||||
            <el-input v-model="cxjlFrom.gw_name"/>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item label="箱单品番">
 | 
			
		||||
            <el-checkbox v-model="cxjlFrom.beXdPf"/>
 | 
			
		||||
| 
						 | 
				
			
			@ -187,24 +193,24 @@
 | 
			
		|||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import crudPickDetail,{zzjl,allocatePickDetail,cancelAllocatePickDetail} from '@/api/pickDetail'
 | 
			
		||||
import CRUD, {presenter, header, form, crud} from '@crud/crud'
 | 
			
		||||
import crudPickDetail, { zzjl, allocatePickDetail, cancelAllocatePickDetail } from '@/api/pickDetail'
 | 
			
		||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
 | 
			
		||||
import rrOperation from '@crud/RR.operation.vue'
 | 
			
		||||
import crudOperation from '@crud/CRUD.operation.vue'
 | 
			
		||||
import udOperation from '@crud/UD.operation.vue'
 | 
			
		||||
import pagination from '@crud/Pagination.vue'
 | 
			
		||||
import {queryBomAccountPoints} from "@/api/bomAccount"
 | 
			
		||||
import {getItems} from "@/api/item"
 | 
			
		||||
import PickTask from "@/views/business-pick/pickDetail/pickTicketTask.vue"
 | 
			
		||||
import XdTask from "@/views/business-pick/pickDetail/xdTask.vue"
 | 
			
		||||
import DateRangePicker from "@/components/DateRangePicker/index.vue";
 | 
			
		||||
import { queryBomAccountPoints } from '@/api/bomAccount'
 | 
			
		||||
import { getItems } from '@/api/item'
 | 
			
		||||
import PickTask from '@/views/business-pick/pickDetail/pickTicketTask.vue'
 | 
			
		||||
import XdTask from '@/views/business-pick/pickDetail/xdTask.vue'
 | 
			
		||||
import DateRangePicker from '@/components/DateRangePicker/index.vue'
 | 
			
		||||
import { formatDate } from '@/utils/commonUtils'
 | 
			
		||||
import ItemSelect from "@/views/generic-component/ItemSelect.vue";
 | 
			
		||||
import BomAccountPointSelect from "@/views/generic-component/BomAccountPointSelect.vue";
 | 
			
		||||
import {queryPickDetailXd} from "@/api/inventory";
 | 
			
		||||
import AreaCodeSelect from "@/views/generic-component/AreaCodeSelect.vue";
 | 
			
		||||
import AreaSelect from "@/views/generic-component/AreaSelect.vue";
 | 
			
		||||
import PointCodeSelect from "@/views/generic-component/PointCodeSelect.vue";
 | 
			
		||||
import ItemSelect from '@/views/generic-component/ItemSelect.vue'
 | 
			
		||||
import BomAccountPointSelect from '@/views/generic-component/BomAccountPointSelect.vue'
 | 
			
		||||
import { queryPickDetailXd } from '@/api/inventory'
 | 
			
		||||
import AreaCodeSelect from '@/views/generic-component/AreaCodeSelect.vue'
 | 
			
		||||
import AreaSelect from '@/views/generic-component/AreaSelect.vue'
 | 
			
		||||
import PointCodeSelect from '@/views/generic-component/PointCodeSelect.vue'
 | 
			
		||||
 | 
			
		||||
const defaultForm = {
 | 
			
		||||
  id: null,
 | 
			
		||||
| 
						 | 
				
			
			@ -218,7 +224,8 @@ export default {
 | 
			
		|||
    AreaCodeSelect,
 | 
			
		||||
    XdTask,
 | 
			
		||||
    BomAccountPointSelect,
 | 
			
		||||
    ItemSelect, DateRangePicker, PickTask,pagination, crudOperation, rrOperation, udOperation},
 | 
			
		||||
    ItemSelect, DateRangePicker, PickTask, pagination, crudOperation, rrOperation, udOperation
 | 
			
		||||
  },
 | 
			
		||||
  mixins: [presenter(), header(), form(defaultForm), crud()],
 | 
			
		||||
  dicts: ['pick_status'],
 | 
			
		||||
  cruds() {
 | 
			
		||||
| 
						 | 
				
			
			@ -227,7 +234,7 @@ export default {
 | 
			
		|||
      url: 'api/pickDetail/queryPickDetailZsc',
 | 
			
		||||
      idField: 'id',
 | 
			
		||||
      sort: 'id,desc',
 | 
			
		||||
      crudMethod: {...crudPickDetail},
 | 
			
		||||
      crudMethod: { ...crudPickDetail },
 | 
			
		||||
      optShow: {
 | 
			
		||||
        add: false,
 | 
			
		||||
        edit: false,
 | 
			
		||||
| 
						 | 
				
			
			@ -235,7 +242,7 @@ export default {
 | 
			
		|||
        reset: false,
 | 
			
		||||
        download: true
 | 
			
		||||
      }
 | 
			
		||||
    },)
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
| 
						 | 
				
			
			@ -245,29 +252,41 @@ export default {
 | 
			
		|||
      radio3: '未拣货',
 | 
			
		||||
      items: [],
 | 
			
		||||
      cxjlFromFlag: false,
 | 
			
		||||
      cxjlFrom: { bom_account_id: null,order_qty:0, item_code:null, item_name:null, zzkw_id:null, bonded:null,zzkw_code:null, gw_code:null, gw_name:null, status:null, remark:null,srs:0,beXdPf:false  },
 | 
			
		||||
      permission: {
 | 
			
		||||
 | 
			
		||||
      cxjlFrom: {
 | 
			
		||||
        bom_account_id: null,
 | 
			
		||||
        order_qty: 0,
 | 
			
		||||
        item_code: null,
 | 
			
		||||
        item_name: null,
 | 
			
		||||
        zzkw_id: null,
 | 
			
		||||
        bonded: null,
 | 
			
		||||
        zzkw_code: null,
 | 
			
		||||
        gw_code: null,
 | 
			
		||||
        gw_name: null,
 | 
			
		||||
        status: null,
 | 
			
		||||
        remark: null,
 | 
			
		||||
        srs: 0,
 | 
			
		||||
        beXdPf: false
 | 
			
		||||
      },
 | 
			
		||||
      permission: {},
 | 
			
		||||
      rules: {
 | 
			
		||||
        item: [
 | 
			
		||||
          {required: true, message: '品番必填', trigger: 'blur'}
 | 
			
		||||
          { required: true, message: '品番必填', trigger: 'blur' }
 | 
			
		||||
        ],
 | 
			
		||||
        zzkwCode: [
 | 
			
		||||
          {required: true, message: '制造库位必填', trigger: 'blur'}
 | 
			
		||||
          { required: true, message: '制造库位必填', trigger: 'blur' }
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      itemListData: [],
 | 
			
		||||
      //品番
 | 
			
		||||
      itemOptions: [],
 | 
			
		||||
      zzkwPointOptions: [],
 | 
			
		||||
      loading_add:false
 | 
			
		||||
      loading_add: false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    //初始化数据
 | 
			
		||||
    this.getItem();
 | 
			
		||||
    this.getItem()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
 | 
			
		||||
| 
						 | 
				
			
			@ -276,7 +295,7 @@ export default {
 | 
			
		|||
    },
 | 
			
		||||
    getItem() {
 | 
			
		||||
      getItems({}).then(res => {
 | 
			
		||||
        this.items = res.content.map(function (obj) {
 | 
			
		||||
        this.items = res.content.map(function(obj) {
 | 
			
		||||
          if (obj.hasChildren) {
 | 
			
		||||
            obj.children = null
 | 
			
		||||
          }
 | 
			
		||||
| 
						 | 
				
			
			@ -292,49 +311,48 @@ export default {
 | 
			
		|||
    selectionChangeHandlerTwo(val) {
 | 
			
		||||
      this.crud.selections = val
 | 
			
		||||
      if (this.crud.selections.length == 0) {
 | 
			
		||||
        this.show_jh = true;
 | 
			
		||||
        this.show_fp = true;
 | 
			
		||||
        this.show_cancelfp = true;
 | 
			
		||||
        return;
 | 
			
		||||
        this.show_jh = true
 | 
			
		||||
        this.show_fp = true
 | 
			
		||||
        this.show_cancelfp = true
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const status = [];
 | 
			
		||||
      const status = []
 | 
			
		||||
      for (let i = 0; i < val.length; i++) {
 | 
			
		||||
        status.push(this.crud.selections[i].status)
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (this.isAllEqual(status) && status[0] == "OPEN") {
 | 
			
		||||
        this.show_jh = true;
 | 
			
		||||
        this.show_fp = false;
 | 
			
		||||
        return;
 | 
			
		||||
      if (this.isAllEqual(status) && status[0] == 'OPEN') {
 | 
			
		||||
        this.show_jh = true
 | 
			
		||||
        this.show_fp = false
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (this.isAllEqual(status) && status[0] == "ALLOCATE") {
 | 
			
		||||
        this.show_jh = true;
 | 
			
		||||
        this.show_fp = false;
 | 
			
		||||
        this.show_cancelfp = false;
 | 
			
		||||
      if (this.isAllEqual(status) && status[0] == 'ALLOCATE') {
 | 
			
		||||
        this.show_jh = true
 | 
			
		||||
        this.show_fp = false
 | 
			
		||||
        this.show_cancelfp = false
 | 
			
		||||
      }
 | 
			
		||||
      //拣货
 | 
			
		||||
      if (this.crud.selections.length == 1 && this.crud.selections[0].orderQty == this.crud.selections[0].allocatedQty) {
 | 
			
		||||
        this.show_jh = false;
 | 
			
		||||
        this.show_fp = true;
 | 
			
		||||
        return;
 | 
			
		||||
        this.show_jh = false
 | 
			
		||||
        this.show_fp = true
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
    btnAllocate(datas) {
 | 
			
		||||
        const ids = [];
 | 
			
		||||
        for (let i = 0; i < datas.length; i++) {
 | 
			
		||||
          ids.push(datas[i].id)
 | 
			
		||||
        }
 | 
			
		||||
        console.log(ids)
 | 
			
		||||
        allocatePickDetail(ids).then(res => {
 | 
			
		||||
          this.crud.toQuery()
 | 
			
		||||
        })
 | 
			
		||||
      const ids = []
 | 
			
		||||
      for (let i = 0; i < datas.length; i++) {
 | 
			
		||||
        ids.push(datas[i].id)
 | 
			
		||||
      }
 | 
			
		||||
      console.log(ids)
 | 
			
		||||
      allocatePickDetail(ids).then(res => {
 | 
			
		||||
        this.crud.toQuery()
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    btnCancelAllocate(datas) {
 | 
			
		||||
      const ids = [];
 | 
			
		||||
      const ids = []
 | 
			
		||||
      for (let i = 0; i < datas.length; i++) {
 | 
			
		||||
        ids.push(datas[i].id)
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			@ -353,25 +371,25 @@ export default {
 | 
			
		|||
      this.$refs.xdTask.queryPickDetailXd(id)
 | 
			
		||||
    },
 | 
			
		||||
    shuaxin() {
 | 
			
		||||
      this.crud.toQuery();
 | 
			
		||||
      this.crud.toQuery()
 | 
			
		||||
    },
 | 
			
		||||
    clickChange(lab) {
 | 
			
		||||
      if (lab === "全部") {
 | 
			
		||||
        this.crud.resetQuery();
 | 
			
		||||
        this.crud.toQuery();
 | 
			
		||||
      } else if (lab === "未拣货") {
 | 
			
		||||
        this.query.status ='OPEN'
 | 
			
		||||
        this.crud.toQuery();
 | 
			
		||||
      } else if (lab === "已拣未发") {
 | 
			
		||||
      if (lab === '全部') {
 | 
			
		||||
        this.crud.resetQuery()
 | 
			
		||||
        this.crud.toQuery()
 | 
			
		||||
      } else if (lab === '未拣货') {
 | 
			
		||||
        this.query.status = 'OPEN'
 | 
			
		||||
        this.crud.toQuery()
 | 
			
		||||
      } else if (lab === '已拣未发') {
 | 
			
		||||
        this.query.status = 'PICK_ALL'
 | 
			
		||||
        this.crud.toQuery();
 | 
			
		||||
      } else if (lab === "已发未收") {
 | 
			
		||||
        this.crud.toQuery()
 | 
			
		||||
      } else if (lab === '已发未收') {
 | 
			
		||||
        this.query.status = 'SHIP_ALL'
 | 
			
		||||
        this.crud.toQuery();
 | 
			
		||||
        this.crud.toQuery()
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    resetQuery() {
 | 
			
		||||
      this.radio3 = '未拣货';
 | 
			
		||||
      this.radio3 = '未拣货'
 | 
			
		||||
      this.crud.resetQuery()
 | 
			
		||||
    },
 | 
			
		||||
    editPick(data) {
 | 
			
		||||
| 
						 | 
				
			
			@ -381,24 +399,24 @@ export default {
 | 
			
		|||
      this.crud.doDelete(data)
 | 
			
		||||
    }, isAllEqual(array) {
 | 
			
		||||
      if (array.length > 0) {
 | 
			
		||||
        return !array.some(function (value, index) {
 | 
			
		||||
          return value !== array[0];
 | 
			
		||||
        });
 | 
			
		||||
        return !array.some(function(value, index) {
 | 
			
		||||
          return value !== array[0]
 | 
			
		||||
        })
 | 
			
		||||
      } else {
 | 
			
		||||
        return true;
 | 
			
		||||
        return true
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    getChangeVule(dben) {
 | 
			
		||||
      this.cxjlFrom.order_qty=dben.srs;
 | 
			
		||||
      this.cxjlFrom.item_code=dben.item_code;
 | 
			
		||||
      this.cxjlFrom.item_name=dben.item_name;
 | 
			
		||||
      this.cxjlFrom.gw_code=dben.gw_code;
 | 
			
		||||
      this.cxjlFrom.gw_name=dben.gw_name;
 | 
			
		||||
      this.cxjlFrom.bom_account_id=dben.bom_account_id
 | 
			
		||||
      this.cxjlFrom.item_id=dben.item_id;
 | 
			
		||||
      this.cxjlFrom.zzkw_id=dben.zzkw_id;
 | 
			
		||||
      this.cxjlFrom.rk_id=dben.rk_id;
 | 
			
		||||
      this.cxjlFrom.bonded=dben.bonded;
 | 
			
		||||
      this.cxjlFrom.order_qty = dben.srs
 | 
			
		||||
      this.cxjlFrom.item_code = dben.item_code
 | 
			
		||||
      this.cxjlFrom.item_name = dben.item_name
 | 
			
		||||
      this.cxjlFrom.gw_code = dben.gw_code
 | 
			
		||||
      this.cxjlFrom.gw_name = dben.gw_name
 | 
			
		||||
      this.cxjlFrom.bom_account_id = dben.bom_account_id
 | 
			
		||||
      this.cxjlFrom.item_id = dben.item_id
 | 
			
		||||
      this.cxjlFrom.zzkw_id = dben.zzkw_id
 | 
			
		||||
      this.cxjlFrom.rk_id = dben.rk_id
 | 
			
		||||
      this.cxjlFrom.bonded = dben.bonded
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    btnZzjl() {
 | 
			
		||||
| 
						 | 
				
			
			@ -414,14 +432,14 @@ export default {
 | 
			
		|||
      })
 | 
			
		||||
    },
 | 
			
		||||
    //日期格式化
 | 
			
		||||
    getFormatDate(data){
 | 
			
		||||
      return  formatDate(data);
 | 
			
		||||
    getFormatDate(data) {
 | 
			
		||||
      return formatDate(data)
 | 
			
		||||
    },
 | 
			
		||||
    //重置表单
 | 
			
		||||
    resetForm() {
 | 
			
		||||
      this.$refs['cxjlFrom'].resetFields()
 | 
			
		||||
      this.$data.cxjlFrom = JSON.parse(JSON.stringify(this.$options.data().cxjlFrom))
 | 
			
		||||
    },
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,7 +91,8 @@ export default {
 | 
			
		|||
        {key: 'true', display_name: '成功'},
 | 
			
		||||
        {key: 'false', display_name: '失败'}
 | 
			
		||||
      ],
 | 
			
		||||
      tsakSelectData: []
 | 
			
		||||
      tsakSelectData: [],
 | 
			
		||||
      dialogTableHight: 0
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,55 +16,48 @@
 | 
			
		|||
      v-for="item in items"
 | 
			
		||||
      :key="item.id"
 | 
			
		||||
      :label="item.code"
 | 
			
		||||
      :value="item"
 | 
			
		||||
      :value="returnType === 'object' ? item : item[returnValueKey]"
 | 
			
		||||
    >
 | 
			
		||||
 | 
			
		||||
    <span>{{ item.code }}</span>
 | 
			
		||||
      <span>{{ item.code }}</span>
 | 
			
		||||
      <span>{{ item.name }}</span>
 | 
			
		||||
    </el-option>
 | 
			
		||||
 | 
			
		||||
  </el-select>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import curdArea from '@/api/area'
 | 
			
		||||
import CRUD from '@crud/crud'
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'AreaSelect',
 | 
			
		||||
  props: {
 | 
			
		||||
    // 选中值,支持 v-model
 | 
			
		||||
    value: {
 | 
			
		||||
      type: [String, Number, Boolean, Array],
 | 
			
		||||
      type: [String, Number, Boolean, Array, Object],
 | 
			
		||||
      default: ''
 | 
			
		||||
    },
 | 
			
		||||
    width: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: '200px'
 | 
			
		||||
    },
 | 
			
		||||
    // 占位文本
 | 
			
		||||
    placeholder: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: '请选择'
 | 
			
		||||
    },
 | 
			
		||||
    // 是否禁用
 | 
			
		||||
    disabled: {
 | 
			
		||||
      type: Boolean,
 | 
			
		||||
      default: false
 | 
			
		||||
    },
 | 
			
		||||
    // 是否可清空
 | 
			
		||||
    clearable: {
 | 
			
		||||
      type: Boolean,
 | 
			
		||||
      default: false
 | 
			
		||||
      default: true
 | 
			
		||||
    },
 | 
			
		||||
    // 是否支持多选
 | 
			
		||||
    multiple: {
 | 
			
		||||
      type: Boolean,
 | 
			
		||||
      default: false
 | 
			
		||||
    },
 | 
			
		||||
    // 是否可搜索
 | 
			
		||||
    filterable: {
 | 
			
		||||
      type: Boolean,
 | 
			
		||||
      default: false
 | 
			
		||||
      default: true
 | 
			
		||||
    },
 | 
			
		||||
    valueKey: {
 | 
			
		||||
      type: String,
 | 
			
		||||
| 
						 | 
				
			
			@ -74,10 +67,23 @@ export default {
 | 
			
		|||
      type: Boolean,
 | 
			
		||||
      default: true
 | 
			
		||||
    },
 | 
			
		||||
    bexb:{
 | 
			
		||||
    bexb: {
 | 
			
		||||
      type: Boolean,
 | 
			
		||||
      default: true
 | 
			
		||||
    },
 | 
			
		||||
    // 新增:返回类型控制
 | 
			
		||||
    returnType: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: 'object', // 'object' | 'value'
 | 
			
		||||
      validator: function(value) {
 | 
			
		||||
        return ['object', 'value'].includes(value)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 新增:当returnType为'value'时,指定返回哪个字段的值
 | 
			
		||||
    returnValueKey: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: 'id'
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
| 
						 | 
				
			
			@ -86,7 +92,6 @@ export default {
 | 
			
		|||
    }
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    // 处理 v-model 双向绑定
 | 
			
		||||
    selectedValue: {
 | 
			
		||||
      get() {
 | 
			
		||||
        return this.value
 | 
			
		||||
| 
						 | 
				
			
			@ -96,12 +101,19 @@ export default {
 | 
			
		|||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  // 组件挂载时加载数据
 | 
			
		||||
  watch: {
 | 
			
		||||
    // 监听returnType变化,重新初始化选中值
 | 
			
		||||
    returnType: {
 | 
			
		||||
      handler() {
 | 
			
		||||
        this.handleReturnTypeChange()
 | 
			
		||||
      },
 | 
			
		||||
      immediate: true
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    this.initData()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    // 获取数据
 | 
			
		||||
    async initData() {
 | 
			
		||||
      this.loading = true
 | 
			
		||||
      try {
 | 
			
		||||
| 
						 | 
				
			
			@ -115,17 +127,52 @@ export default {
 | 
			
		|||
        this.loading = false
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 选中值变化时触发
 | 
			
		||||
 | 
			
		||||
    handleChange(val) {
 | 
			
		||||
      this.$emit('change', val)
 | 
			
		||||
      let emitValue = val
 | 
			
		||||
 | 
			
		||||
      // 根据返回类型处理数据
 | 
			
		||||
      if (this.returnType === 'value' && val) {
 | 
			
		||||
        if (this.multiple) {
 | 
			
		||||
          // 多选情况
 | 
			
		||||
          emitValue = Array.isArray(val) ? val.map(item =>
 | 
			
		||||
            typeof item === 'object' ? item[this.returnValueKey] : item
 | 
			
		||||
          ) : []
 | 
			
		||||
        } else {
 | 
			
		||||
          // 单选情况
 | 
			
		||||
          emitValue = typeof val === 'object' ? val[this.returnValueKey] : val
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      this.$emit('change', emitValue)
 | 
			
		||||
    },
 | 
			
		||||
    // 清空选中值时触发
 | 
			
		||||
 | 
			
		||||
    handleClear() {
 | 
			
		||||
      this.$emit('clear')
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // 处理返回类型变化
 | 
			
		||||
    handleReturnTypeChange() {
 | 
			
		||||
      if (this.returnType === 'value') {
 | 
			
		||||
        // 从对象转换为值
 | 
			
		||||
        if (this.multiple) {
 | 
			
		||||
          const values = Array.isArray(this.value) ? this.value.map(item => typeof item === 'object' ? item[this.returnValueKey] : item) : []
 | 
			
		||||
          this.$emit('input', values)
 | 
			
		||||
        } else {
 | 
			
		||||
          const value = typeof this.value === 'object' ? this.value[this.returnValueKey] : this.value
 | 
			
		||||
          this.$emit('input', value)
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
        // 默认对象
 | 
			
		||||
        if (this.multiple) {
 | 
			
		||||
          const objects = Array.isArray(this.value) ? this.value.map(val => this.items.find(item => item[this.returnValueKey] === val) || val) : []
 | 
			
		||||
          this.$emit('input', objects)
 | 
			
		||||
        } else {
 | 
			
		||||
          const object = this.items.find(item => item[this.returnValueKey] === this.value) || this.value
 | 
			
		||||
          this.$emit('input', object)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
<style scoped>
 | 
			
		||||
/* 可根据需要添加组件样式 */
 | 
			
		||||
</style>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue