| | |
| | | |
| | | <a-col :md="8" :sm="8"> |
| | | <a-form-item label="配送小组"> |
| | | <a-select v-model="teamCodes" placeholder="请选择配送小组" mode="multiple" :maxTagCount="3" |
| | | <a-select :value="teamCodes" placeholder="请选择配送小组" mode="multiple" :maxTagCount="3" |
| | | @change="handleDeliverGroupSelectChange" allowClear> |
| | | <a-select-option v-for="item in deliveryGroupList" :key="item.key">{{ item.title }}</a-select-option> |
| | | </a-select> |
| | |
| | | <a-col :md="2" :sm="2"> |
| | | <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> |
| | | </a-row> |
| | |
| | | }, |
| | | productionIds: [],//班组 |
| | | teamCodes: [],//配送小组 |
| | | centerList: [], |
| | | groupList: [], |
| | | deliveryGroupList: [] |
| | | centerList: [],//中心列表 |
| | | groupList: [],//班组列表 |
| | | deliveryGroupList: []//配送小组列表 |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | * @param isInitLoad 是否为初始化加载 |
| | | */ |
| | | getGroupListByApi(productionId, isInitLoad = false) { |
| | | this.groupList = [] |
| | | const that = this |
| | | mdcApi.getCenterOrGroupListApi(productionId) |
| | | .then(res => { |
| | | if (res.success) { |
| | | that.groupList = res.result |
| | | that.groupList = res.result ? res.result : [] |
| | | that.handleGroupSelectChange(res.result && res.result.length > 0 && isInitLoad ? [res.result[0].value] : []) |
| | | if (!isInitLoad) return |
| | | that.handleGroupSelectChange([res.result[0].value]) |
| | | that.loadData() |
| | | } |
| | | }) |
| | |
| | | * @param isReduceSelectOption 是否减少班组选中项 |
| | | */ |
| | | getDeliveryGroupListByApi(productionId, isReduceSelectOption = false) { |
| | | this.deliveryGroupList = [] |
| | | const that = this |
| | | mdcApi.getDeliveryGroupListApi(productionId) |
| | | .then(res => { |
| | | if (res.success) { |
| | | that.deliveryGroupList = res.result |
| | | that.deliveryGroupList = res.result ? res.result : [] |
| | | |
| | | // 仅减少勾选项时才进行下一步 |
| | | if (!isReduceSelectOption) return |
| | | that.teamCodes.forEach((key, keyIndex, self) => { |
| | | // 如果将唯一一组包含选中配送小组项的班组取消勾选后应将已勾选的配送小组一并取消勾选 |
| | | if (that.deliveryGroupList.findIndex(item => item.key === key) === -1) self.splice(keyIndex, 1) |
| | | }) |
| | | // 保留改变后的配送小组列表中之前已勾选的配送小组 |
| | | const filterTeamCodes = that.teamCodes.filter(item => that.deliveryGroupList.map(item => item.key).includes(item)) |
| | | that.handleDeliverGroupSelectChange(filterTeamCodes) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | * @param value 改变后的中心Id |
| | | */ |
| | | handleCenterSelectChange(value) { |
| | | if (this.productionIds.length > 0) { |
| | | this.groupList = [] |
| | | this.productionIds = [] |
| | | delete this.queryParam.productionIds |
| | | } |
| | | if (this.teamCodes.length > 0) { |
| | | this.deliveryGroupList = [] |
| | | this.teamCodes = [] |
| | | delete this.queryParam.teamCodes |
| | | } |
| | | this.getGroupListByApi(value) |
| | | }, |
| | | |
| | |
| | | * @param value 改变后的配送小组Id |
| | | */ |
| | | handleDeliverGroupSelectChange(value) { |
| | | this.teamCodes = value |
| | | this.queryParam.teamCodes = value.join(',') |
| | | }, |
| | | |