Commit 325bf29617634fb0951e73889eec3fb2faa50037
1 parent
79e52c92
测试完成采购流程
Showing
15 changed files
with
1955 additions
and
107 deletions
src/api/resource/returnStorehouseApplyManageApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 获取仓库列表 | |
| 4 | +export function listStorehouses(params) { | |
| 5 | + return new Promise((resolve, reject) => { | |
| 6 | + request({ | |
| 7 | + url: '/resourceStore.listStorehouses', | |
| 8 | + method: 'get', | |
| 9 | + params | |
| 10 | + }).then(response => { | |
| 11 | + const res = response.data | |
| 12 | + resolve(res) | |
| 13 | + }).catch(error => { | |
| 14 | + reject(error) | |
| 15 | + }) | |
| 16 | + }) | |
| 17 | +} | |
| 18 | + | |
| 19 | +// 获取物品类型列表 | |
| 20 | +export function listResourceStoreTypes(params) { | |
| 21 | + return new Promise((resolve, reject) => { | |
| 22 | + request({ | |
| 23 | + url: '/resourceStoreType.listResourceStoreTypes', | |
| 24 | + method: 'get', | |
| 25 | + params | |
| 26 | + }).then(response => { | |
| 27 | + const res = response.data | |
| 28 | + resolve(res) | |
| 29 | + }).catch(error => { | |
| 30 | + reject(error) | |
| 31 | + }) | |
| 32 | + }) | |
| 33 | +} | |
| 34 | + | |
| 35 | +// 获取用户可操作的物品列表 | |
| 36 | +export function listUserStorehouses(params) { | |
| 37 | + return new Promise((resolve, reject) => { | |
| 38 | + request({ | |
| 39 | + url: '/resourceStore.listUserStorehouses', | |
| 40 | + method: 'get', | |
| 41 | + params | |
| 42 | + }).then(response => { | |
| 43 | + const res = response.data | |
| 44 | + resolve({ | |
| 45 | + data: res.data, | |
| 46 | + total: res.total, | |
| 47 | + records: res.records | |
| 48 | + }) | |
| 49 | + }).catch(error => { | |
| 50 | + reject(error) | |
| 51 | + }) | |
| 52 | + }) | |
| 53 | +} | |
| 54 | + | |
| 55 | +// 提交退还申请 | |
| 56 | +export function saveAllocationStorehouse(data) { | |
| 57 | + return new Promise((resolve, reject) => { | |
| 58 | + request({ | |
| 59 | + url: '/resourceStore.saveAllocationStorehouse', | |
| 60 | + method: 'post', | |
| 61 | + data | |
| 62 | + }).then(response => { | |
| 63 | + const res = response.data | |
| 64 | + resolve(res) | |
| 65 | + }).catch(error => { | |
| 66 | + reject(error) | |
| 67 | + }) | |
| 68 | + }) | |
| 69 | +} | |
| 70 | + | |
| 71 | +// 获取当前社区ID | |
| 72 | +export function getCommunityId() { | |
| 73 | + return new Promise((resolve, reject) => { | |
| 74 | + request({ | |
| 75 | + url: '/community.getCommunityId', | |
| 76 | + method: 'get' | |
| 77 | + }).then(response => { | |
| 78 | + const res = response.data | |
| 79 | + resolve(res.data || '') | |
| 80 | + }).catch(error => { | |
| 81 | + reject(error) | |
| 82 | + }) | |
| 83 | + }) | |
| 84 | +} | |
| 0 | 85 | \ No newline at end of file | ... | ... |
src/api/resource/scrapGoodsStepApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 3 | + | |
| 4 | +// 获取用户仓库物品列表 | |
| 5 | +export function listUserStorehouses(params) { | |
| 6 | + return new Promise((resolve, reject) => { | |
| 7 | + request({ | |
| 8 | + url: '/resourceStore.listUserStorehouses', | |
| 9 | + method: 'get', | |
| 10 | + params: { | |
| 11 | + ...params, | |
| 12 | + communityId: getCommunityId() | |
| 13 | + } | |
| 14 | + }).then(response => { | |
| 15 | + resolve(response.data) | |
| 16 | + }).catch(error => { | |
| 17 | + reject(error) | |
| 18 | + }) | |
| 19 | + }) | |
| 20 | +} | |
| 21 | + | |
| 22 | +// 获取物品类型列表 | |
| 23 | +export function listResourceStoreTypes(params) { | |
| 24 | + return new Promise((resolve, reject) => { | |
| 25 | + request({ | |
| 26 | + url: '/resourceStoreType.listResourceStoreTypes', | |
| 27 | + method: 'get', | |
| 28 | + params: { | |
| 29 | + ...params, | |
| 30 | + communityId: getCommunityId() | |
| 31 | + } | |
| 32 | + }).then(response => { | |
| 33 | + resolve(response.data) | |
| 34 | + }).catch(error => { | |
| 35 | + reject(error) | |
| 36 | + }) | |
| 37 | + }) | |
| 38 | +} | |
| 39 | + | |
| 40 | +// 保存物品分配 | |
| 41 | +export function saveAllocationUserStorehouse(data) { | |
| 42 | + return new Promise((resolve, reject) => { | |
| 43 | + request({ | |
| 44 | + url: '/resourceStore.saveAllocationUserStorehouse', | |
| 45 | + method: 'post', | |
| 46 | + data: { | |
| 47 | + ...data, | |
| 48 | + communityId: getCommunityId() | |
| 49 | + } | |
| 50 | + }).then(response => { | |
| 51 | + resolve(response.data) | |
| 52 | + }).catch(error => { | |
| 53 | + reject(error) | |
| 54 | + }) | |
| 55 | + }) | |
| 56 | +} | |
| 0 | 57 | \ No newline at end of file | ... | ... |
src/api/resource/transferGoodsManageApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 3 | + | |
| 4 | +// 获取用户可转赠的物品列表 | |
| 5 | +export function listUserStorehouses(params) { | |
| 6 | + return new Promise((resolve, reject) => { | |
| 7 | + const communityId = getCommunityId() | |
| 8 | + request({ | |
| 9 | + url: '/resourceStore.listUserStorehouses', | |
| 10 | + method: 'get', | |
| 11 | + params: { | |
| 12 | + ...params, | |
| 13 | + communityId | |
| 14 | + } | |
| 15 | + }).then(response => { | |
| 16 | + const res = response.data | |
| 17 | + resolve(res) | |
| 18 | + }).catch(error => { | |
| 19 | + reject(error) | |
| 20 | + }) | |
| 21 | + }) | |
| 22 | +} | |
| 23 | + | |
| 24 | +// 获取物品类型列表 | |
| 25 | +export function listResourceStoreTypes(params) { | |
| 26 | + return new Promise((resolve, reject) => { | |
| 27 | + const communityId = getCommunityId() | |
| 28 | + request({ | |
| 29 | + url: '/resourceStoreType.listResourceStoreTypes', | |
| 30 | + method: 'get', | |
| 31 | + params: { | |
| 32 | + ...params, | |
| 33 | + communityId | |
| 34 | + } | |
| 35 | + }).then(response => { | |
| 36 | + const res = response.data | |
| 37 | + resolve(res) | |
| 38 | + }).catch(error => { | |
| 39 | + reject(error) | |
| 40 | + }) | |
| 41 | + }) | |
| 42 | +} | |
| 43 | + | |
| 44 | +// 获取组织树 | |
| 45 | +export function listOrgTree() { | |
| 46 | + return new Promise((resolve, reject) => { | |
| 47 | + const communityId = getCommunityId() | |
| 48 | + request({ | |
| 49 | + url: '/org.listOrgTree', | |
| 50 | + method: 'get', | |
| 51 | + params: { | |
| 52 | + communityId | |
| 53 | + } | |
| 54 | + }).then(response => { | |
| 55 | + const res = response.data | |
| 56 | + resolve(res) | |
| 57 | + }).catch(error => { | |
| 58 | + reject(error) | |
| 59 | + }) | |
| 60 | + }) | |
| 61 | +} | |
| 62 | + | |
| 63 | +// 查询员工信息 | |
| 64 | +export function queryStaffInfos(params) { | |
| 65 | + return new Promise((resolve, reject) => { | |
| 66 | + request({ | |
| 67 | + url: '/query.staff.infos', | |
| 68 | + method: 'get', | |
| 69 | + params | |
| 70 | + }).then(response => { | |
| 71 | + const res = response.data | |
| 72 | + resolve(res) | |
| 73 | + }).catch(error => { | |
| 74 | + reject(error) | |
| 75 | + }) | |
| 76 | + }) | |
| 77 | +} | |
| 78 | + | |
| 79 | +// 保存转赠信息 | |
| 80 | +export function saveAllocationUserStorehouse(data) { | |
| 81 | + return new Promise((resolve, reject) => { | |
| 82 | + const communityId = getCommunityId() | |
| 83 | + request({ | |
| 84 | + url: '/resourceStore.saveAllocationUserStorehouse', | |
| 85 | + method: 'post', | |
| 86 | + data: { | |
| 87 | + ...data, | |
| 88 | + communityId | |
| 89 | + } | |
| 90 | + }).then(response => { | |
| 91 | + const res = response.data | |
| 92 | + resolve(res) | |
| 93 | + }).catch(error => { | |
| 94 | + reject(error) | |
| 95 | + }) | |
| 96 | + }) | |
| 97 | +} | |
| 98 | + | |
| 99 | +export default { | |
| 100 | + listUserStorehouses, | |
| 101 | + listResourceStoreTypes, | |
| 102 | + listOrgTree, | |
| 103 | + queryStaffInfos, | |
| 104 | + saveAllocationUserStorehouse | |
| 105 | +} | |
| 0 | 106 | \ No newline at end of file | ... | ... |
src/components/resource/chooseResourceStaff.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog | |
| 3 | + :title="$t('transferGoodsManage.selectGoods')" | |
| 4 | + :visible.sync="visible" | |
| 5 | + width="80%" | |
| 6 | + @close="handleClose" | |
| 7 | + > | |
| 8 | + | |
| 9 | + <el-row :gutter="20"> | |
| 10 | + <el-col :span="6"> | |
| 11 | + <el-select | |
| 12 | + v-model="queryParams.parentRstId" | |
| 13 | + :placeholder="$t('transferGoodsManage.selectGoodsType')" | |
| 14 | + style="width: 100%" | |
| 15 | + @change="listResourceStoreSonTypes" | |
| 16 | + > | |
| 17 | + <el-option | |
| 18 | + v-for="item in resourceStoreTypes" | |
| 19 | + :key="item.rstId" | |
| 20 | + :label="item.name" | |
| 21 | + :value="item.rstId" | |
| 22 | + ></el-option> | |
| 23 | + </el-select> | |
| 24 | + </el-col> | |
| 25 | + <el-col :span="6"> | |
| 26 | + <el-select | |
| 27 | + v-model="queryParams.rstId" | |
| 28 | + :placeholder="$t('transferGoodsManage.selectSubCategory')" | |
| 29 | + style="width: 100%" | |
| 30 | + > | |
| 31 | + <el-option | |
| 32 | + v-for="item in resourceStoreSonTypes" | |
| 33 | + :key="item.rstId" | |
| 34 | + :label="item.name" | |
| 35 | + :value="item.rstId" | |
| 36 | + ></el-option> | |
| 37 | + </el-select> | |
| 38 | + </el-col> | |
| 39 | + <el-col :span="10"> | |
| 40 | + <el-input | |
| 41 | + v-model="queryParams._currentResourceStoreName" | |
| 42 | + :placeholder="$t('transferGoodsManage.inputGoodsName')" | |
| 43 | + style="width: 100%" | |
| 44 | + > | |
| 45 | + <el-button | |
| 46 | + slot="append" | |
| 47 | + icon="el-icon-search" | |
| 48 | + @click="queryResourceStores" | |
| 49 | + ></el-button> | |
| 50 | + </el-input> | |
| 51 | + </el-col> | |
| 52 | + <el-col :span="2"> | |
| 53 | + <el-button @click="resetResourceStores"> | |
| 54 | + {{ $t('common.reset') }} | |
| 55 | + </el-button> | |
| 56 | + </el-col> | |
| 57 | + </el-row> | |
| 58 | + | |
| 59 | + <el-table | |
| 60 | + :data="resourceStores" | |
| 61 | + style="width: 100%; margin-top: 20px" | |
| 62 | + @selection-change="handleSelectionChange" | |
| 63 | + > | |
| 64 | + <el-table-column type="selection" width="55" align="center"></el-table-column> | |
| 65 | + <el-table-column | |
| 66 | + prop="parentRstName" | |
| 67 | + :label="$t('transferGoodsManage.goodsType')" | |
| 68 | + align="center" | |
| 69 | + > | |
| 70 | + <template slot-scope="scope"> | |
| 71 | + {{ scope.row.parentRstName || '-' }} > | |
| 72 | + {{ scope.row.rstName || '-' }} | |
| 73 | + </template> | |
| 74 | + </el-table-column> | |
| 75 | + <el-table-column | |
| 76 | + prop="resName" | |
| 77 | + :label="$t('transferGoodsManage.goodsName')" | |
| 78 | + align="center" | |
| 79 | + /> | |
| 80 | + <el-table-column | |
| 81 | + prop="resCode" | |
| 82 | + :label="$t('transferGoodsManage.goodsCode')" | |
| 83 | + align="center" | |
| 84 | + /> | |
| 85 | + <el-table-column | |
| 86 | + prop="isFixedName" | |
| 87 | + :label="$t('transferGoodsManage.isFixedGoods')" | |
| 88 | + align="center" | |
| 89 | + /> | |
| 90 | + <el-table-column | |
| 91 | + :label="$t('transferGoodsManage.goodsStock')" | |
| 92 | + align="center" | |
| 93 | + > | |
| 94 | + <template slot-scope="scope"> | |
| 95 | + {{ scope.row.stock }}{{ scope.row.unitCodeName }} | |
| 96 | + </template> | |
| 97 | + </el-table-column> | |
| 98 | + <el-table-column | |
| 99 | + :label="$t('transferGoodsManage.miniStock')" | |
| 100 | + align="center" | |
| 101 | + > | |
| 102 | + <template slot-scope="scope"> | |
| 103 | + {{ scope.row.miniStock }}{{ scope.row.miniUnitCodeName }} | |
| 104 | + </template> | |
| 105 | + </el-table-column> | |
| 106 | + </el-table> | |
| 107 | + | |
| 108 | + <el-pagination | |
| 109 | + :current-page="pagination.current" | |
| 110 | + :page-sizes="[10, 20, 30, 50]" | |
| 111 | + :page-size="pagination.size" | |
| 112 | + :total="pagination.total" | |
| 113 | + layout="total, sizes, prev, pager, next, jumper" | |
| 114 | + @size-change="handleSizeChange" | |
| 115 | + @current-change="handleCurrentChange" | |
| 116 | + style="margin-top: 20px" | |
| 117 | + ></el-pagination> | |
| 118 | + | |
| 119 | + | |
| 120 | + <div slot="footer" class="dialog-footer"> | |
| 121 | + <el-button @click="visible = false"> | |
| 122 | + {{ $t('common.cancel') }} | |
| 123 | + </el-button> | |
| 124 | + <el-button type="primary" @click="submitSelected"> | |
| 125 | + {{ $t('common.submit') }} | |
| 126 | + </el-button> | |
| 127 | + </div> | |
| 128 | + </el-dialog> | |
| 129 | +</template> | |
| 130 | + | |
| 131 | +<script> | |
| 132 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 133 | +import {listUserStorehouses,listResourceStoreTypes} from '@/api/resource/transferGoodsManageApi' | |
| 134 | + | |
| 135 | +export default { | |
| 136 | + name: 'ChooseResourceStaff', | |
| 137 | + data() { | |
| 138 | + return { | |
| 139 | + visible: false, | |
| 140 | + queryParams: { | |
| 141 | + _currentResourceStoreName: '', | |
| 142 | + parentRstId: '', | |
| 143 | + rstId: '', | |
| 144 | + giveType: 1 | |
| 145 | + }, | |
| 146 | + resourceStores: [], | |
| 147 | + selectedResources: [], | |
| 148 | + resourceStoreTypes: [], | |
| 149 | + resourceStoreSonTypes: [], | |
| 150 | + pagination: { | |
| 151 | + current: 1, | |
| 152 | + size: 10, | |
| 153 | + total: 0 | |
| 154 | + } | |
| 155 | + } | |
| 156 | + }, | |
| 157 | + methods: { | |
| 158 | + open() { | |
| 159 | + this.visible = true | |
| 160 | + this.queryParams = { | |
| 161 | + _currentResourceStoreName: '', | |
| 162 | + parentRstId: '', | |
| 163 | + rstId: '', | |
| 164 | + giveType: 1 | |
| 165 | + } | |
| 166 | + this.loadAllResourceStaffInfo() | |
| 167 | + this.listResourceStoreTypes() | |
| 168 | + }, | |
| 169 | + handleClose() { | |
| 170 | + this.selectedResources = [] | |
| 171 | + }, | |
| 172 | + async loadAllResourceStaffInfo() { | |
| 173 | + try { | |
| 174 | + const params = { | |
| 175 | + page: this.pagination.current, | |
| 176 | + row: this.pagination.size, | |
| 177 | + communityId: getCommunityId(), | |
| 178 | + resName: this.queryParams._currentResourceStoreName, | |
| 179 | + parentRstId: this.queryParams.parentRstId, | |
| 180 | + rstId: this.queryParams.rstId, | |
| 181 | + giveType: this.queryParams.giveType | |
| 182 | + } | |
| 183 | + | |
| 184 | + const res = await listUserStorehouses( | |
| 185 | + params | |
| 186 | + ) | |
| 187 | + this.resourceStores = res.data | |
| 188 | + this.pagination.total = res.total | |
| 189 | + } catch (error) { | |
| 190 | + this.$message.error(this.$t('common.loadFailed')) | |
| 191 | + } | |
| 192 | + }, | |
| 193 | + async listResourceStoreTypes() { | |
| 194 | + try { | |
| 195 | + const params = { | |
| 196 | + page: 1, | |
| 197 | + row: 100, | |
| 198 | + communityId: getCommunityId(), | |
| 199 | + parentId: '0' | |
| 200 | + } | |
| 201 | + | |
| 202 | + const res = await listResourceStoreTypes( | |
| 203 | + params | |
| 204 | + ) | |
| 205 | + this.resourceStoreTypes = res.data | |
| 206 | + } catch (error) { | |
| 207 | + this.$message.error(this.$t('common.loadFailed')) | |
| 208 | + } | |
| 209 | + }, | |
| 210 | + async listResourceStoreSonTypes() { | |
| 211 | + this.queryParams.rstId = '' | |
| 212 | + this.resourceStoreSonTypes = [] | |
| 213 | + if (!this.queryParams.parentRstId) return | |
| 214 | + | |
| 215 | + try { | |
| 216 | + const params = { | |
| 217 | + page: 1, | |
| 218 | + row: 100, | |
| 219 | + communityId: getCommunityId(), | |
| 220 | + parentId: this.queryParams.parentRstId | |
| 221 | + } | |
| 222 | + | |
| 223 | + const res = await this.$api.resource.transferGoodsManageApi.listResourceStoreTypes( | |
| 224 | + params | |
| 225 | + ) | |
| 226 | + this.resourceStoreSonTypes = res.data | |
| 227 | + } catch (error) { | |
| 228 | + this.$message.error(this.$t('common.loadFailed')) | |
| 229 | + } | |
| 230 | + }, | |
| 231 | + queryResourceStores() { | |
| 232 | + this.pagination.current = 1 | |
| 233 | + this.loadAllResourceStaffInfo() | |
| 234 | + }, | |
| 235 | + resetResourceStores() { | |
| 236 | + this.queryParams = { | |
| 237 | + _currentResourceStoreName: '', | |
| 238 | + parentRstId: '', | |
| 239 | + rstId: '', | |
| 240 | + giveType: 1 | |
| 241 | + } | |
| 242 | + this.pagination.current = 1 | |
| 243 | + this.loadAllResourceStaffInfo() | |
| 244 | + }, | |
| 245 | + handleSelectionChange(val) { | |
| 246 | + this.selectedResources = val | |
| 247 | + }, | |
| 248 | + submitSelected() { | |
| 249 | + if (this.selectedResources.length === 0) { | |
| 250 | + this.$message.warning(this.$t('transferGoodsManage.selectGoodsFirst')) | |
| 251 | + return | |
| 252 | + } | |
| 253 | + this.$emit('setSelectResourceStores', this.selectedResources) | |
| 254 | + this.visible = false | |
| 255 | + }, | |
| 256 | + handleSizeChange(val) { | |
| 257 | + this.pagination.size = val | |
| 258 | + this.loadAllResourceStaffInfo() | |
| 259 | + }, | |
| 260 | + handleCurrentChange(val) { | |
| 261 | + this.pagination.current = val | |
| 262 | + this.loadAllResourceStaffInfo() | |
| 263 | + } | |
| 264 | + } | |
| 265 | +} | |
| 266 | +</script> | |
| 267 | + | |
| 268 | +<style scoped> | |
| 269 | +.el-select { | |
| 270 | + width: 100%; | |
| 271 | +} | |
| 272 | +</style> | |
| 0 | 273 | \ No newline at end of file | ... | ... |
src/components/resource/orgTreeShow.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="org-tree-show-container"> | |
| 3 | + <el-tree | |
| 4 | + :data="orgs" | |
| 5 | + :props="defaultProps" | |
| 6 | + node-key="id" | |
| 7 | + default-expand-all | |
| 8 | + highlight-current | |
| 9 | + @node-click="handleNodeClick" | |
| 10 | + ></el-tree> | |
| 11 | + </div> | |
| 12 | +</template> | |
| 13 | + | |
| 14 | +<script> | |
| 15 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 16 | + | |
| 17 | +export default { | |
| 18 | + name: 'OrgTreeShow', | |
| 19 | + props: { | |
| 20 | + callBackListener: { | |
| 21 | + type: String, | |
| 22 | + default: '' | |
| 23 | + } | |
| 24 | + }, | |
| 25 | + data() { | |
| 26 | + return { | |
| 27 | + orgs: [], | |
| 28 | + defaultProps: { | |
| 29 | + children: 'children', | |
| 30 | + label: 'text' | |
| 31 | + } | |
| 32 | + } | |
| 33 | + }, | |
| 34 | + created() { | |
| 35 | + this.loadOrgs() | |
| 36 | + }, | |
| 37 | + methods: { | |
| 38 | + async loadOrgs() { | |
| 39 | + try { | |
| 40 | + const params = { | |
| 41 | + communityId: getCommunityId() | |
| 42 | + } | |
| 43 | + | |
| 44 | + const res = await this.$api.resource.transferGoodsManageApi.listOrgTree( | |
| 45 | + params | |
| 46 | + ) | |
| 47 | + this.orgs = res.data | |
| 48 | + } catch (error) { | |
| 49 | + this.$message.error(this.$t('common.loadFailed')) | |
| 50 | + } | |
| 51 | + }, | |
| 52 | + handleNodeClick(data) { | |
| 53 | + if (this.callBackListener) { | |
| 54 | + this.$emit(this.callBackListener, 'switchOrg', { | |
| 55 | + orgId: data.id, | |
| 56 | + orgName: data.text | |
| 57 | + }) | |
| 58 | + } | |
| 59 | + }, | |
| 60 | + refreshTree() { | |
| 61 | + this.loadOrgs() | |
| 62 | + } | |
| 63 | + } | |
| 64 | +} | |
| 65 | +</script> | |
| 66 | + | |
| 67 | +<style scoped> | |
| 68 | +.org-tree-show-container { | |
| 69 | + padding: 10px; | |
| 70 | +} | |
| 71 | +</style> | |
| 0 | 72 | \ No newline at end of file | ... | ... |
src/components/resource/selectStaff.vue
| 1 | 1 | <template> |
| 2 | - <el-dialog :title="$t('selectStaff.title')" :visible.sync="visible" width="80%" @close="handleClose"> | |
| 3 | - <el-row> | |
| 4 | - <el-col :span="24"> | |
| 5 | - <el-card> | |
| 6 | - <el-row> | |
| 7 | - <el-col :span="12" class="border-right"> | |
| 8 | - <div class="text-center"> | |
| 9 | - <span>{{ $t('selectStaff.orgInfo') }}</span> | |
| 10 | - </div> | |
| 11 | - <div class="padding"> | |
| 12 | - <org-tree-show ref="orgTreeShow" @switchOrg="handleSwitchOrg"></org-tree-show> | |
| 13 | - </div> | |
| 14 | - </el-col> | |
| 15 | - <el-col :span="12"> | |
| 16 | - <div class="text-center"> | |
| 17 | - <span>{{ $t('selectStaff.staffInfo') }}</span> | |
| 18 | - </div> | |
| 19 | - <div class="padding"> | |
| 20 | - <div v-for="(item, index) in selectStaffInfo.staffs" :key="index" @click="_changeStaff(item)" | |
| 21 | - :class="{ 'select': selectStaffInfo.curStaffId == item.staffId }" | |
| 22 | - style="cursor:pointer;padding:10px;margin-bottom:5px;border-radius:4px"> | |
| 23 | - <div> | |
| 24 | - <i class="el-icon-user margin-right-xs"></i> | |
| 25 | - {{ item.name }} | |
| 26 | - </div> | |
| 27 | - <div>{{ item.tel }}</div> | |
| 28 | - </div> | |
| 2 | + <el-dialog | |
| 3 | + :title="$t('transferGoodsManage.selectRecipient')" | |
| 4 | + :visible.sync="visible" | |
| 5 | + width="60%" | |
| 6 | + > | |
| 7 | + <el-row :gutter="20"> | |
| 8 | + <el-col :span="12" class="border-right"> | |
| 9 | + <div class="text-center title"> | |
| 10 | + {{ $t('transferGoodsManage.orgInfo') }} | |
| 11 | + </div> | |
| 12 | + <div class="org-tree-container"> | |
| 13 | + <el-tree | |
| 14 | + :data="orgs" | |
| 15 | + :props="defaultProps" | |
| 16 | + @node-click="handleNodeClick" | |
| 17 | + node-key="id" | |
| 18 | + default-expand-all | |
| 19 | + highlight-current | |
| 20 | + ></el-tree> | |
| 21 | + </div> | |
| 22 | + </el-col> | |
| 23 | + <el-col :span="12"> | |
| 24 | + <div class="text-center title"> | |
| 25 | + {{ $t('transferGoodsManage.staffInfo') }} | |
| 26 | + </div> | |
| 27 | + <div class="staff-list-container"> | |
| 28 | + <el-scrollbar style="height: 400px"> | |
| 29 | + <div | |
| 30 | + v-for="item in staffs" | |
| 31 | + :key="item.userId" | |
| 32 | + class="staff-item" | |
| 33 | + :class="{ active: currentStaffId === item.userId }" | |
| 34 | + @click="selectStaff(item)" | |
| 35 | + > | |
| 36 | + <div> | |
| 37 | + <i class="el-icon-user"></i> | |
| 38 | + {{ item.userName }} | |
| 29 | 39 | </div> |
| 30 | - </el-col> | |
| 31 | - </el-row> | |
| 32 | - </el-card> | |
| 40 | + <div>{{ item.tel }}</div> | |
| 41 | + </div> | |
| 42 | + </el-scrollbar> | |
| 43 | + </div> | |
| 33 | 44 | </el-col> |
| 34 | 45 | </el-row> |
| 35 | 46 | |
| 36 | - <div | |
| 37 | - v-if="selectStaffInfo.staff.from == 'bpmn' || selectStaffInfo.staff.from == 'purchase' || selectStaffInfo.staff.from == 'contract'" | |
| 38 | - style="text-align:right;margin-top:20px"> | |
| 39 | - <el-button type="text" @click="_firstUser"> | |
| 40 | - {{ $t('selectStaff.submitter') }} | |
| 47 | + <div slot="footer" class="dialog-footer"> | |
| 48 | + <el-button @click="visible = false"> | |
| 49 | + {{ $t('common.cancel') }} | |
| 41 | 50 | </el-button> |
| 42 | - <el-button type="text" @click="_customUser"> | |
| 43 | - {{ $t('selectStaff.dynamicAssign') }} | |
| 51 | + <el-button type="primary" @click="confirmSelection"> | |
| 52 | + {{ $t('common.confirm') }} | |
| 44 | 53 | </el-button> |
| 45 | 54 | </div> |
| 46 | 55 | </el-dialog> |
| 47 | 56 | </template> |
| 48 | 57 | |
| 49 | 58 | <script> |
| 50 | -import OrgTreeShow from '@/components/org/OrgTreeShow' | |
| 51 | -import { queryStaffInfos } from '@/api/resource/addPurchaseApplyApi' | |
| 59 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 52 | 60 | |
| 53 | 61 | export default { |
| 54 | 62 | name: 'SelectStaff', |
| 55 | - components: { | |
| 56 | - OrgTreeShow | |
| 57 | - }, | |
| 58 | 63 | data() { |
| 59 | 64 | return { |
| 60 | 65 | visible: false, |
| 61 | - selectStaffInfo: { | |
| 62 | - flowId: '', | |
| 63 | - flowName: '', | |
| 64 | - describle: '', | |
| 65 | - staffs: [], | |
| 66 | - curStaffId: '', | |
| 67 | - curStaffName: '', | |
| 68 | - staff: {} | |
| 66 | + orgs: [], | |
| 67 | + staffs: [], | |
| 68 | + currentOrgId: '', | |
| 69 | + currentStaffId: '', | |
| 70 | + selectedStaff: null, | |
| 71 | + defaultProps: { | |
| 72 | + children: 'children', | |
| 73 | + label: 'text' | |
| 69 | 74 | } |
| 70 | 75 | } |
| 71 | 76 | }, |
| 72 | 77 | methods: { |
| 73 | - open(staff) { | |
| 78 | + open() { | |
| 74 | 79 | this.visible = true |
| 75 | - this.selectStaffInfo.staff = staff | |
| 76 | - this.$refs.orgTreeShow.refreshTree() | |
| 80 | + this.currentOrgId = '' | |
| 81 | + this.currentStaffId = '' | |
| 82 | + this.selectedStaff = null | |
| 83 | + this.loadOrgs() | |
| 77 | 84 | }, |
| 78 | - handleClose() { | |
| 79 | - this.visible = false | |
| 80 | - this.selectStaffInfo = { | |
| 81 | - flowId: '', | |
| 82 | - flowName: '', | |
| 83 | - describle: '', | |
| 84 | - staffs: [], | |
| 85 | - curStaffId: '', | |
| 86 | - curStaffName: '', | |
| 87 | - staff: {} | |
| 85 | + async loadOrgs() { | |
| 86 | + try { | |
| 87 | + const params = { | |
| 88 | + communityId: getCommunityId() | |
| 89 | + } | |
| 90 | + | |
| 91 | + const res = await this.$api.resource.transferGoodsManageApi.listOrgTree( | |
| 92 | + params | |
| 93 | + ) | |
| 94 | + this.orgs = res.data | |
| 95 | + } catch (error) { | |
| 96 | + this.$message.error(this.$t('common.loadFailed')) | |
| 88 | 97 | } |
| 89 | 98 | }, |
| 90 | - async loadStaff(_org) { | |
| 99 | + handleNodeClick(data) { | |
| 100 | + this.currentOrgId = data.id | |
| 101 | + this.loadStaffs(data.id) | |
| 102 | + }, | |
| 103 | + async loadStaffs(orgId) { | |
| 91 | 104 | try { |
| 92 | - const res = await queryStaffInfos({ | |
| 105 | + const params = { | |
| 93 | 106 | page: 1, |
| 94 | 107 | row: 50, |
| 95 | - orgId: _org.orgId | |
| 96 | - }) | |
| 97 | - this.selectStaffInfo.staffs = res.data.staffs | |
| 98 | - if (res.data.staffs.length > 0) { | |
| 99 | - this.selectStaffInfo.curStaffId = res.data.staffs[0].orgId | |
| 108 | + orgId: orgId | |
| 100 | 109 | } |
| 110 | + | |
| 111 | + const res = await this.$api.resource.transferGoodsManageApi.queryStaffInfos( | |
| 112 | + params | |
| 113 | + ) | |
| 114 | + this.staffs = res.staffs | |
| 101 | 115 | } catch (error) { |
| 102 | - console.error('请求失败:', error) | |
| 116 | + this.$message.error(this.$t('common.loadFailed')) | |
| 103 | 117 | } |
| 104 | 118 | }, |
| 105 | - _changeStaff(item) { | |
| 106 | - this.selectStaffInfo.curStaffId = item.staffId | |
| 107 | - this.$emit('change', { | |
| 108 | - userId: item.staffId, | |
| 109 | - userName: item.name, | |
| 110 | - tel: item.tel | |
| 111 | - }) | |
| 112 | - this.handleClose() | |
| 119 | + selectStaff(staff) { | |
| 120 | + this.currentStaffId = staff.userId | |
| 121 | + this.selectedStaff = staff | |
| 113 | 122 | }, |
| 114 | - _firstUser() { | |
| 115 | - this.$emit('change', { | |
| 116 | - userId: '${startUserId}', | |
| 117 | - userName: this.$t('selectStaff.submitter') | |
| 118 | - }) | |
| 119 | - this.handleClose() | |
| 120 | - }, | |
| 121 | - _customUser() { | |
| 122 | - this.$emit('change', { | |
| 123 | - userId: '${nextUserId}', | |
| 124 | - userName: this.$t('selectStaff.dynamicAssign') | |
| 125 | - }) | |
| 126 | - this.handleClose() | |
| 127 | - }, | |
| 128 | - handleSwitchOrg(org) { | |
| 129 | - this.loadStaff({ | |
| 130 | - orgId: org.orgId, | |
| 131 | - orgName: org.orgName | |
| 132 | - }) | |
| 123 | + confirmSelection() { | |
| 124 | + if (!this.selectedStaff) { | |
| 125 | + this.$message.warning(this.$t('transferGoodsManage.selectStaffFirst')) | |
| 126 | + return | |
| 127 | + } | |
| 128 | + this.$emit('chooseStaff', this.selectedStaff) | |
| 129 | + this.visible = false | |
| 133 | 130 | } |
| 134 | 131 | } |
| 135 | 132 | } |
| ... | ... | @@ -137,24 +134,41 @@ export default { |
| 137 | 134 | |
| 138 | 135 | <style scoped> |
| 139 | 136 | .border-right { |
| 140 | - border-right: 1px solid #eee; | |
| 137 | + border-right: 1px solid #ebeef5; | |
| 141 | 138 | } |
| 142 | 139 | |
| 143 | -.padding { | |
| 144 | - padding: 15px; | |
| 140 | +.title { | |
| 141 | + font-size: 16px; | |
| 142 | + font-weight: bold; | |
| 143 | + margin-bottom: 15px; | |
| 145 | 144 | } |
| 146 | 145 | |
| 147 | -.text-center { | |
| 148 | - text-align: center; | |
| 149 | - padding: 10px 0; | |
| 150 | - font-weight: bold; | |
| 146 | +.org-tree-container { | |
| 147 | + height: 400px; | |
| 148 | + overflow: auto; | |
| 151 | 149 | } |
| 152 | 150 | |
| 153 | -.select { | |
| 151 | +.staff-list-container { | |
| 152 | + height: 400px; | |
| 153 | +} | |
| 154 | + | |
| 155 | +.staff-item { | |
| 156 | + padding: 10px; | |
| 157 | + margin: 5px 0; | |
| 158 | + cursor: pointer; | |
| 159 | + border-radius: 4px; | |
| 160 | +} | |
| 161 | + | |
| 162 | +.staff-item:hover { | |
| 154 | 163 | background-color: #f5f7fa; |
| 155 | 164 | } |
| 156 | 165 | |
| 157 | -.margin-right-xs { | |
| 166 | +.staff-item.active { | |
| 167 | + background-color: #ecf5ff; | |
| 168 | + color: #409eff; | |
| 169 | +} | |
| 170 | + | |
| 171 | +.el-icon-user { | |
| 158 | 172 | margin-right: 5px; |
| 159 | 173 | } |
| 160 | 174 | </style> |
| 161 | 175 | \ No newline at end of file | ... | ... |
src/components/resource/viewResourceMyGoodsInfo.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-card class="box-card"> | |
| 3 | + <div slot="header" class="flex justify-between"> | |
| 4 | + <span>{{ $t('viewResourceMyGoodsInfo.goodsInfo') }}</span> | |
| 5 | + <div class="action-buttons"> | |
| 6 | + <el-button | |
| 7 | + type="primary" | |
| 8 | + size="small" | |
| 9 | + @click="handleGoBack"> | |
| 10 | + <i class="el-icon-close"></i> | |
| 11 | + {{ $t('viewResourceMyGoodsInfo.back') }} | |
| 12 | + </el-button> | |
| 13 | + <el-button | |
| 14 | + type="primary" | |
| 15 | + size="small" | |
| 16 | + @click="handleOpenSelectModal"> | |
| 17 | + <i class="el-icon-search"></i> | |
| 18 | + {{ $t('viewResourceMyGoodsInfo.selectGoods') }} | |
| 19 | + </el-button> | |
| 20 | + </div> | |
| 21 | + </div> | |
| 22 | + | |
| 23 | + <el-table | |
| 24 | + :data="resourceStores" | |
| 25 | + border | |
| 26 | + style="width: 100%"> | |
| 27 | + <el-table-column | |
| 28 | + prop="resName" | |
| 29 | + :label="$t('viewResourceMyGoodsInfo.goodsName')" | |
| 30 | + align="center" /> | |
| 31 | + <el-table-column | |
| 32 | + prop="resCode" | |
| 33 | + :label="$t('viewResourceMyGoodsInfo.goodsCode')" | |
| 34 | + align="center" /> | |
| 35 | + <el-table-column | |
| 36 | + :label="$t('viewResourceMyGoodsInfo.goodsType')" | |
| 37 | + align="center"> | |
| 38 | + <template slot-scope="scope"> | |
| 39 | + {{ scope.row.parentRstName || '-' }} > {{ scope.row.rstName || '-' }} | |
| 40 | + </template> | |
| 41 | + </el-table-column> | |
| 42 | + <el-table-column | |
| 43 | + prop="isFixedName" | |
| 44 | + :label="$t('viewResourceMyGoodsInfo.isFixedGoods')" | |
| 45 | + align="center" /> | |
| 46 | + <el-table-column | |
| 47 | + :label="$t('viewResourceMyGoodsInfo.goodsStock')" | |
| 48 | + align="center"> | |
| 49 | + <template slot-scope="scope"> | |
| 50 | + {{ scope.row.stock }}{{ scope.row.unitCodeName }} | |
| 51 | + </template> | |
| 52 | + </el-table-column> | |
| 53 | + <el-table-column | |
| 54 | + :label="$t('viewResourceMyGoodsInfo.miniStock')" | |
| 55 | + align="center"> | |
| 56 | + <template slot-scope="scope"> | |
| 57 | + {{ scope.row.miniStock }}{{ scope.row.miniUnitCodeName }} | |
| 58 | + </template> | |
| 59 | + </el-table-column> | |
| 60 | + <el-table-column | |
| 61 | + :label="$t('viewResourceMyGoodsInfo.lossQuantity')" | |
| 62 | + align="center"> | |
| 63 | + <template slot-scope="scope"> | |
| 64 | + <el-input-number | |
| 65 | + v-model="scope.row.giveQuantity" | |
| 66 | + :min="0" | |
| 67 | + :max="parseFloat(scope.row.miniStock)" | |
| 68 | + :precision="2" | |
| 69 | + controls-position="right" | |
| 70 | + style="width: 120px"> | |
| 71 | + </el-input-number> | |
| 72 | + {{ scope.row.miniUnitCodeName }} | |
| 73 | + </template> | |
| 74 | + </el-table-column> | |
| 75 | + <el-table-column | |
| 76 | + :label="$t('viewResourceMyGoodsInfo.usageType')" | |
| 77 | + align="center"> | |
| 78 | + <template slot-scope="scope"> | |
| 79 | + <el-select | |
| 80 | + v-model="scope.row.state" | |
| 81 | + style="width: 100%"> | |
| 82 | + <el-option | |
| 83 | + :label="$t('viewResourceMyGoodsInfo.selectUsageType')" | |
| 84 | + value=""></el-option> | |
| 85 | + <el-option | |
| 86 | + :label="$t('viewResourceMyGoodsInfo.scrapRecycle')" | |
| 87 | + value="1001"></el-option> | |
| 88 | + <el-option | |
| 89 | + :label="$t('viewResourceMyGoodsInfo.publicLoss')" | |
| 90 | + value="3003"></el-option> | |
| 91 | + </el-select> | |
| 92 | + </template> | |
| 93 | + </el-table-column> | |
| 94 | + <el-table-column | |
| 95 | + :label="$t('viewResourceMyGoodsInfo.remark')" | |
| 96 | + align="center"> | |
| 97 | + <template slot-scope="scope"> | |
| 98 | + <el-input | |
| 99 | + v-model="scope.row.purchaseRemark" | |
| 100 | + :placeholder="$t('viewResourceMyGoodsInfo.requiredRemark')"> | |
| 101 | + </el-input> | |
| 102 | + </template> | |
| 103 | + </el-table-column> | |
| 104 | + <el-table-column | |
| 105 | + :label="$t('viewResourceMyGoodsInfo.operation')" | |
| 106 | + align="center"> | |
| 107 | + <template slot-scope="scope"> | |
| 108 | + <el-button | |
| 109 | + type="danger" | |
| 110 | + size="mini" | |
| 111 | + @click="handleRemoveItem(scope.row.resId, scope.$index)"> | |
| 112 | + <i class="el-icon-delete"></i> | |
| 113 | + {{ $t('viewResourceMyGoodsInfo.remove') }} | |
| 114 | + </el-button> | |
| 115 | + </template> | |
| 116 | + </el-table-column> | |
| 117 | + </el-table> | |
| 118 | + | |
| 119 | + <choose-resource-staff | |
| 120 | + ref="chooseResourceStaff" | |
| 121 | + @setSelectResourceStores="handleSetSelectedStores"> | |
| 122 | + </choose-resource-staff> | |
| 123 | + </el-card> | |
| 124 | +</template> | |
| 125 | + | |
| 126 | +<script> | |
| 127 | +import ChooseResourceStaff from './chooseResourceStaff.vue' | |
| 128 | + | |
| 129 | +export default { | |
| 130 | + name: 'ViewResourceMyGoodsInfo', | |
| 131 | + components: { | |
| 132 | + ChooseResourceStaff | |
| 133 | + }, | |
| 134 | + props: { | |
| 135 | + callBackListener: { | |
| 136 | + type: String, | |
| 137 | + default: '' | |
| 138 | + }, | |
| 139 | + callBackFunction: { | |
| 140 | + type: String, | |
| 141 | + default: '' | |
| 142 | + } | |
| 143 | + }, | |
| 144 | + data() { | |
| 145 | + return { | |
| 146 | + resourceStores: [], | |
| 147 | + index: 0 | |
| 148 | + } | |
| 149 | + }, | |
| 150 | + methods: { | |
| 151 | + handleGoBack() { | |
| 152 | + this.$router.go(-1) | |
| 153 | + }, | |
| 154 | + handleOpenSelectModal() { | |
| 155 | + this.$refs.chooseResourceStaff.open() | |
| 156 | + }, | |
| 157 | + handleSetSelectedStores(resourceStores) { | |
| 158 | + this.resourceStores = resourceStores.map(item => { | |
| 159 | + return { | |
| 160 | + ...item, | |
| 161 | + state: '', | |
| 162 | + purchaseRemark: '', | |
| 163 | + giveQuantity: 0 | |
| 164 | + } | |
| 165 | + }) | |
| 166 | + this.$emit(this.callBackFunction, this.resourceStores) | |
| 167 | + }, | |
| 168 | + handleRemoveItem(resId, index) { | |
| 169 | + this.resourceStores.splice(index, 1) | |
| 170 | + this.$emit(this.callBackFunction, this.resourceStores) | |
| 171 | + this.$refs.chooseResourceStaff.removeSelectedItem(resId) | |
| 172 | + } | |
| 173 | + } | |
| 174 | +} | |
| 175 | +</script> | |
| 176 | + | |
| 177 | +<style scoped> | |
| 178 | +.action-buttons { | |
| 179 | + float: right; | |
| 180 | +} | |
| 181 | +</style> | |
| 0 | 182 | \ No newline at end of file | ... | ... |
src/i18n/resourceI18n.js
| ... | ... | @@ -27,6 +27,9 @@ import { messages as assetInventoryInStockMessages } from '../views/resource/ass |
| 27 | 27 | import { messages as assetInventoryEditMessages } from '../views/resource/assetInventoryEditLang' |
| 28 | 28 | import { messages as assetInventoryAuditMessages } from '../views/resource/assetInventoryAuditLang' |
| 29 | 29 | import { messages as printAssetInventoryInStockMessages } from '../views/resource/printAssetInventoryInStockLang' |
| 30 | +import { messages as returnStorehouseApplyManageMessages } from '../views/resource/returnStorehouseApplyManageLang' | |
| 31 | +import { messages as transferGoodsManageMessages } from '../views/resource/transferGoodsManageLang' | |
| 32 | +import { messages as scrapGoodsStepMessages } from '../views/resource/scrapGoodsStepLang' | |
| 30 | 33 | |
| 31 | 34 | export const messages = { |
| 32 | 35 | en: { |
| ... | ... | @@ -58,6 +61,9 @@ export const messages = { |
| 58 | 61 | ...assetInventoryEditMessages.en, |
| 59 | 62 | ...assetInventoryAuditMessages.en, |
| 60 | 63 | ...printAssetInventoryInStockMessages.en, |
| 64 | + ...returnStorehouseApplyManageMessages.en, | |
| 65 | + ...transferGoodsManageMessages.en, | |
| 66 | + ...scrapGoodsStepMessages.en, | |
| 61 | 67 | }, |
| 62 | 68 | zh: { |
| 63 | 69 | ...resourceAuditFlowMessages.zh, |
| ... | ... | @@ -88,5 +94,8 @@ export const messages = { |
| 88 | 94 | ...assetInventoryEditMessages.zh, |
| 89 | 95 | ...assetInventoryAuditMessages.zh, |
| 90 | 96 | ...printAssetInventoryInStockMessages.zh, |
| 97 | + ...returnStorehouseApplyManageMessages.zh, | |
| 98 | + ...transferGoodsManageMessages.zh, | |
| 99 | + ...scrapGoodsStepMessages.zh, | |
| 91 | 100 | } |
| 92 | 101 | } |
| 93 | 102 | \ No newline at end of file | ... | ... |
src/router/resourceRouter.js
| ... | ... | @@ -130,5 +130,20 @@ export default [ |
| 130 | 130 | name: '/pages/property/assetInventoryAudit', |
| 131 | 131 | component: () => import('@/views/resource/assetInventoryAuditList.vue') |
| 132 | 132 | }, |
| 133 | + { | |
| 134 | + path: '/pages/common/returnStorehouseApplyManage', | |
| 135 | + name: '/pages/common/returnStorehouseApplyManage', | |
| 136 | + component: () => import('@/views/resource/returnStorehouseApplyManageList.vue') | |
| 137 | + }, | |
| 138 | + { | |
| 139 | + path: '/pages/common/transferGoodsManage', | |
| 140 | + name: '/pages/common/transferGoodsManage', | |
| 141 | + component: () => import('@/views/resource/transferGoodsManageList.vue') | |
| 142 | + }, | |
| 143 | + { | |
| 144 | + path: '/pages/common/scrapGoodsStep', | |
| 145 | + name: '/pages/common/scrapGoodsStep', | |
| 146 | + component: () => import('@/views/resource/scrapGoodsStepList.vue') | |
| 147 | + }, | |
| 133 | 148 | |
| 134 | 149 | ] |
| 135 | 150 | \ No newline at end of file | ... | ... |
src/views/resource/returnStorehouseApplyManageLang.js
0 → 100644
| 1 | +export const messages = { | |
| 2 | + en: { | |
| 3 | + returnStorehouseApplyManage: { | |
| 4 | + title: 'Return Items', | |
| 5 | + back: 'Back', | |
| 6 | + selectItems: 'Select Items', | |
| 7 | + itemId: 'Item ID', | |
| 8 | + itemType: 'Item Type', | |
| 9 | + itemName: 'Item Name', | |
| 10 | + itemSpec: 'Item Specification', | |
| 11 | + stock: 'Stock', | |
| 12 | + miniStock: 'Minimum Stock', | |
| 13 | + targetWarehouse: 'Target Warehouse', | |
| 14 | + returnQuantity: 'Return Quantity', | |
| 15 | + operation: 'Operation', | |
| 16 | + cancelReturn: 'Cancel Return', | |
| 17 | + returnAll: 'Return All', | |
| 18 | + returnDescription: 'Return Description', | |
| 19 | + requiredDescription: 'Required, please fill in the return description', | |
| 20 | + submit: 'Submit', | |
| 21 | + descriptionRequired: 'Return description is required', | |
| 22 | + selectItemsRequired: 'Please select items', | |
| 23 | + quantityRequired: 'Please fill in the quantity', | |
| 24 | + targetWarehouseRequired: 'Please select target warehouse', | |
| 25 | + stockNotEnough: ' stock is not enough', | |
| 26 | + returnSuccess: 'Return successfully', | |
| 27 | + returnFailed: 'Return failed', | |
| 28 | + requiredSelect: 'Required, please select target warehouse' | |
| 29 | + }, | |
| 30 | + chooseResourceStaff: { | |
| 31 | + title: 'Select Items', | |
| 32 | + selectItemType: 'Please select item type', | |
| 33 | + selectSubType: 'Please select sub type', | |
| 34 | + inputItemName: 'Input item name', | |
| 35 | + itemType: 'Item Type', | |
| 36 | + itemName: 'Item Name', | |
| 37 | + itemCode: 'Item Code', | |
| 38 | + isFixed: 'Is Fixed', | |
| 39 | + stock: 'Stock', | |
| 40 | + miniStock: 'Minimum Stock', | |
| 41 | + selectItemsRequired: 'Please select items' | |
| 42 | + } | |
| 43 | + }, | |
| 44 | + zh: { | |
| 45 | + returnStorehouseApplyManage: { | |
| 46 | + title: '退还物品', | |
| 47 | + back: '返回', | |
| 48 | + selectItems: '选择物品', | |
| 49 | + itemId: '物品ID', | |
| 50 | + itemType: '物品类型', | |
| 51 | + itemName: '物品名称', | |
| 52 | + itemSpec: '物品规格', | |
| 53 | + stock: '库存', | |
| 54 | + miniStock: '最小计量总数', | |
| 55 | + targetWarehouse: '目标仓库', | |
| 56 | + returnQuantity: '退还数量', | |
| 57 | + operation: '操作', | |
| 58 | + cancelReturn: '取消退还', | |
| 59 | + returnAll: '全部退还', | |
| 60 | + returnDescription: '退还说明', | |
| 61 | + requiredDescription: '必填,请填写退还说明', | |
| 62 | + submit: '提交', | |
| 63 | + descriptionRequired: '退还说明不能为空', | |
| 64 | + selectItemsRequired: '请选择物品', | |
| 65 | + quantityRequired: '请填写数量', | |
| 66 | + targetWarehouseRequired: '请选择目标仓库', | |
| 67 | + stockNotEnough: '库存不足', | |
| 68 | + returnSuccess: '退还成功', | |
| 69 | + returnFailed: '退还失败', | |
| 70 | + requiredSelect: '必填,请选择目标仓库' | |
| 71 | + }, | |
| 72 | + chooseResourceStaff: { | |
| 73 | + title: '选择物品管理', | |
| 74 | + selectItemType: '请选择物品类型', | |
| 75 | + selectSubType: '请选择二级分类', | |
| 76 | + inputItemName: '输入物品管理名称', | |
| 77 | + itemType: '物品类型', | |
| 78 | + itemName: '物品名称', | |
| 79 | + itemCode: '物品编码', | |
| 80 | + isFixed: '是否是固定物品', | |
| 81 | + stock: '物品库存', | |
| 82 | + miniStock: '最小计量总数', | |
| 83 | + selectItemsRequired: '请选择需要转赠的物品' | |
| 84 | + } | |
| 85 | + } | |
| 86 | +} | |
| 0 | 87 | \ No newline at end of file | ... | ... |
src/views/resource/returnStorehouseApplyManageList.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="animated fadeInRight ecommerce padding"> | |
| 3 | + <el-row> | |
| 4 | + <el-col :span="24"> | |
| 5 | + <el-card> | |
| 6 | + <div slot="header" class="flex justify-between"> | |
| 7 | + <span>{{ $t('returnStorehouseApplyManage.title') }}</span> | |
| 8 | + <div class="ibox-tools" style="top:10px;"> | |
| 9 | + <el-button type="primary" size="small" @click="_goBack()"> | |
| 10 | + <i class="el-icon-close"></i> | |
| 11 | + <span>{{ $t('returnStorehouseApplyManage.back') }}</span> | |
| 12 | + </el-button> | |
| 13 | + <el-button type="primary" size="small" @click="_openReturnStorehouseModel()"> | |
| 14 | + <i class="el-icon-plus"></i> | |
| 15 | + <span>{{ $t('returnStorehouseApplyManage.selectItems') }}</span> | |
| 16 | + </el-button> | |
| 17 | + </div> | |
| 18 | + </div> | |
| 19 | + <div class=""> | |
| 20 | + <table class="custom-table"> | |
| 21 | + <thead> | |
| 22 | + <tr> | |
| 23 | + <th style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5; background-color: #fafafa;"> | |
| 24 | + {{ $t('returnStorehouseApplyManage.itemId') }} | |
| 25 | + </th> | |
| 26 | + <th style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5; background-color: #fafafa;"> | |
| 27 | + {{ $t('returnStorehouseApplyManage.itemType') }} | |
| 28 | + </th> | |
| 29 | + <th style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5; background-color: #fafafa;"> | |
| 30 | + {{ $t('returnStorehouseApplyManage.itemName') }} | |
| 31 | + </th> | |
| 32 | + <th style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5; background-color: #fafafa;"> | |
| 33 | + {{ $t('returnStorehouseApplyManage.itemSpec') }} | |
| 34 | + </th> | |
| 35 | + <th style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5; background-color: #fafafa;"> | |
| 36 | + {{ $t('returnStorehouseApplyManage.stock') }} | |
| 37 | + </th> | |
| 38 | + <th style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5; background-color: #fafafa;"> | |
| 39 | + {{ $t('returnStorehouseApplyManage.miniStock') }} | |
| 40 | + </th> | |
| 41 | + <th style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5; background-color: #fafafa;"> | |
| 42 | + {{ $t('returnStorehouseApplyManage.targetWarehouse') }} | |
| 43 | + </th> | |
| 44 | + <th style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5; background-color: #fafafa;"> | |
| 45 | + {{ $t('returnStorehouseApplyManage.returnQuantity') }} | |
| 46 | + </th> | |
| 47 | + <th style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5; background-color: #fafafa;"> | |
| 48 | + {{ $t('returnStorehouseApplyManage.operation') }} | |
| 49 | + </th> | |
| 50 | + </tr> | |
| 51 | + </thead> | |
| 52 | + <tbody> | |
| 53 | + <tr v-for="(item, index) in returnStorehouseManageInfo.resourceStores" :key="index" | |
| 54 | + style="border-bottom: 1px solid #ebeef5;"> | |
| 55 | + <td style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5;"> | |
| 56 | + {{ item.resId }} | |
| 57 | + </td> | |
| 58 | + <td style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5;"> | |
| 59 | + {{ item.parentRstName ? item.parentRstName : '-' }} > | |
| 60 | + {{ item.rstName ? item.rstName : '-' }} | |
| 61 | + </td> | |
| 62 | + <td style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5;"> | |
| 63 | + {{ item.resName }} | |
| 64 | + </td> | |
| 65 | + <td style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5;"> | |
| 66 | + {{ item.rssName ? item.rssName : '-' }} | |
| 67 | + </td> | |
| 68 | + <td style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5;"> | |
| 69 | + {{ item.stock }}{{ item.unitCodeName }} | |
| 70 | + </td> | |
| 71 | + <td style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5;"> | |
| 72 | + {{ item.miniStock }}{{ item.miniUnitCodeName }} | |
| 73 | + </td> | |
| 74 | + <td style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5;"> | |
| 75 | + <select v-model="item.shzId" class="custom-select"> | |
| 76 | + <option value="">{{ $t('returnStorehouseApplyManage.requiredSelect') }}</option> | |
| 77 | + <template v-for="(storehouse, storeIndex) in returnStorehouseManageInfo.storehouses" > | |
| 78 | + <option :key="storeIndex" :value="storehouse.shId" v-if="storehouse.shId != item.shId"> | |
| 79 | + {{ storehouse.shName }} | |
| 80 | + </option> | |
| 81 | + </template> | |
| 82 | + </select> | |
| 83 | + </td> | |
| 84 | + <td style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5;"> | |
| 85 | + <el-input-number v-model="item.curStock" :min="0" :max="item.miniStock" | |
| 86 | + style="width:70%;margin-right:10px" /> | |
| 87 | + {{ item.miniUnitCodeName }} | |
| 88 | + <el-button type="info" @click="_itemReturnAll(item)"> | |
| 89 | + {{ $t('returnStorehouseApplyManage.returnAll') }} | |
| 90 | + </el-button> | |
| 91 | + </td> | |
| 92 | + <td style="text-align: center; padding: 12px 8px; border: 1px solid #ebeef5;"> | |
| 93 | + <el-button type="text" @click="_openDeleteResourceStoreModel(item)"> | |
| 94 | + {{ $t('returnStorehouseApplyManage.cancelReturn') }} | |
| 95 | + </el-button> | |
| 96 | + </td> | |
| 97 | + </tr> | |
| 98 | + <tr v-if="returnStorehouseManageInfo.resourceStores.length === 0"> | |
| 99 | + <td colspan="9" style="text-align: center; padding: 20px; color: #909399;"> | |
| 100 | + {{ $t('common.noData') }} | |
| 101 | + </td> | |
| 102 | + </tr> | |
| 103 | + </tbody> | |
| 104 | + </table> | |
| 105 | + </div> | |
| 106 | + </el-card> | |
| 107 | + </el-col> | |
| 108 | + </el-row> | |
| 109 | + | |
| 110 | + <el-row class="margin-top"> | |
| 111 | + <el-col :span="24"> | |
| 112 | + <el-card> | |
| 113 | + <div slot="header" class="flex justify-between"> | |
| 114 | + <span>{{ $t('returnStorehouseApplyManage.returnDescription') }}</span> | |
| 115 | + </div> | |
| 116 | + <div class=""> | |
| 117 | + <el-form label-width="120px"> | |
| 118 | + <el-form-item :label="$t('returnStorehouseApplyManage.returnDescription')"> | |
| 119 | + <el-input type="textarea" v-model="returnStorehouseManageInfo.remark" | |
| 120 | + :placeholder="$t('returnStorehouseApplyManage.requiredDescription')" /> | |
| 121 | + </el-form-item> | |
| 122 | + </el-form> | |
| 123 | + </div> | |
| 124 | + </el-card> | |
| 125 | + </el-col> | |
| 126 | + </el-row> | |
| 127 | + | |
| 128 | + <el-row> | |
| 129 | + <el-col :span="24" style="text-align:right;margin-bottom:20px"> | |
| 130 | + <el-button type="primary" @click="_submitApply()"> | |
| 131 | + {{ $t('returnStorehouseApplyManage.submit') }} | |
| 132 | + </el-button> | |
| 133 | + </el-col> | |
| 134 | + </el-row> | |
| 135 | + | |
| 136 | + <choose-resource-staff ref="chooseResourceStaff" @setSelectResourceStores="handleSetSelectResourceStores" /> | |
| 137 | + </div> | |
| 138 | +</template> | |
| 139 | + | |
| 140 | +<script> | |
| 141 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 142 | +import ChooseResourceStaff from '@/components/resource/chooseResourceStaff.vue' | |
| 143 | +import { | |
| 144 | + listStorehouses, | |
| 145 | + saveAllocationStorehouse | |
| 146 | +} from '@/api/resource/returnStorehouseApplyManageApi' | |
| 147 | + | |
| 148 | +export default { | |
| 149 | + name: 'ReturnStorehouseApplyManageList', | |
| 150 | + components: { | |
| 151 | + ChooseResourceStaff | |
| 152 | + }, | |
| 153 | + data() { | |
| 154 | + return { | |
| 155 | + returnStorehouseManageInfo: { | |
| 156 | + resourceStores: [], | |
| 157 | + storehouses: [], | |
| 158 | + remark: '', | |
| 159 | + communityId: '', | |
| 160 | + apply_type: 20000 | |
| 161 | + } | |
| 162 | + } | |
| 163 | + }, | |
| 164 | + created() { | |
| 165 | + this.returnStorehouseManageInfo.communityId = getCommunityId() | |
| 166 | + this._listReturnStorehouse() | |
| 167 | + }, | |
| 168 | + methods: { | |
| 169 | + _openDeleteResourceStoreModel(resourceStore) { | |
| 170 | + this.returnStorehouseManageInfo.resourceStores = | |
| 171 | + this.returnStorehouseManageInfo.resourceStores.filter( | |
| 172 | + item => item.resId !== resourceStore.resId | |
| 173 | + ) | |
| 174 | + this.$refs.chooseResourceStaff.removeSelectItem(resourceStore.resId) | |
| 175 | + }, | |
| 176 | + _itemReturnAll(resourceStore) { | |
| 177 | + const item = this.returnStorehouseManageInfo.resourceStores.find( | |
| 178 | + item => item.resId === resourceStore.resId | |
| 179 | + ) | |
| 180 | + if (item) { | |
| 181 | + item.curStock = item.miniStock | |
| 182 | + } | |
| 183 | + }, | |
| 184 | + _openReturnStorehouseModel() { | |
| 185 | + this.$refs.chooseResourceStaff.open() | |
| 186 | + }, | |
| 187 | + async _listReturnStorehouse() { | |
| 188 | + try { | |
| 189 | + const params = { | |
| 190 | + page: 1, | |
| 191 | + row: 100, | |
| 192 | + isShow: true, | |
| 193 | + shType: '2807', | |
| 194 | + communityId: this.returnStorehouseManageInfo.communityId | |
| 195 | + } | |
| 196 | + const { data } = await listStorehouses(params) | |
| 197 | + this.returnStorehouseManageInfo.storehouses = data | |
| 198 | + } catch (error) { | |
| 199 | + console.error('请求失败:', error) | |
| 200 | + } | |
| 201 | + }, | |
| 202 | + _goBack() { | |
| 203 | + this.$router.go(-1) | |
| 204 | + }, | |
| 205 | + async _submitApply() { | |
| 206 | + if (!this.returnStorehouseManageInfo.remark) { | |
| 207 | + this.$message.error(this.$t('returnStorehouseApplyManage.descriptionRequired')) | |
| 208 | + return | |
| 209 | + } | |
| 210 | + | |
| 211 | + if (this.returnStorehouseManageInfo.resourceStores.length === 0) { | |
| 212 | + this.$message.error(this.$t('returnStorehouseApplyManage.selectItemsRequired')) | |
| 213 | + return | |
| 214 | + } | |
| 215 | + | |
| 216 | + let isValid = true | |
| 217 | + this.returnStorehouseManageInfo.resourceStores.forEach(item => { | |
| 218 | + item.curStock = parseFloat(item.curStock) | |
| 219 | + if (item.curStock <= 0) { | |
| 220 | + this.$message.error(this.$t('returnStorehouseApplyManage.quantityRequired')) | |
| 221 | + isValid = false | |
| 222 | + return | |
| 223 | + } | |
| 224 | + if (item.curStock > parseFloat(item.miniStock)) { | |
| 225 | + this.$message.error(`${item.resName}${this.$t('returnStorehouseApplyManage.stockNotEnough')}`) | |
| 226 | + isValid = false | |
| 227 | + return | |
| 228 | + } | |
| 229 | + if (!item.shzId) { | |
| 230 | + this.$message.error(this.$t('returnStorehouseApplyManage.targetWarehouseRequired')) | |
| 231 | + isValid = false | |
| 232 | + return | |
| 233 | + } | |
| 234 | + }) | |
| 235 | + | |
| 236 | + if (!isValid) return | |
| 237 | + | |
| 238 | + try { | |
| 239 | + const res = await saveAllocationStorehouse(this.returnStorehouseManageInfo) | |
| 240 | + if (res.code === 0) { | |
| 241 | + this.$message.success(this.$t('returnStorehouseApplyManage.returnSuccess')) | |
| 242 | + this._goBack() | |
| 243 | + } else { | |
| 244 | + this.$message.error(res.msg) | |
| 245 | + } | |
| 246 | + } catch (error) { | |
| 247 | + console.error('提交失败:', error) | |
| 248 | + this.$message.error(this.$t('returnStorehouseApplyManage.returnFailed')) | |
| 249 | + } | |
| 250 | + }, | |
| 251 | + handleSetSelectResourceStores(resourceStores) { | |
| 252 | + const oldList = this.returnStorehouseManageInfo.resourceStores | |
| 253 | + const newList = resourceStores.filter(newItem => | |
| 254 | + !oldList.some(oldItem => oldItem.resId === newItem.resId) | |
| 255 | + ) | |
| 256 | + newList.forEach(item => { | |
| 257 | + item.shaName = item.shName | |
| 258 | + item.shzId = '' | |
| 259 | + item.curStock = '0' | |
| 260 | + }) | |
| 261 | + this.returnStorehouseManageInfo.resourceStores = [...newList, ...oldList] | |
| 262 | + } | |
| 263 | + } | |
| 264 | +} | |
| 265 | +</script> | |
| 266 | + | |
| 267 | +<style scoped> | |
| 268 | +.ibox-tools { | |
| 269 | + position: absolute; | |
| 270 | + right: 15px; | |
| 271 | + top: 15px; | |
| 272 | +} | |
| 273 | + | |
| 274 | +.custom-table { | |
| 275 | + width: 100%; | |
| 276 | + border-collapse: collapse; | |
| 277 | + border: 1px solid #ebeef5; | |
| 278 | +} | |
| 279 | + | |
| 280 | +.custom-table th { | |
| 281 | + background-color: #fafafa; | |
| 282 | + color: #606266; | |
| 283 | + font-weight: 500; | |
| 284 | + font-size: 14px; | |
| 285 | +} | |
| 286 | + | |
| 287 | +.custom-table td { | |
| 288 | + color: #606266; | |
| 289 | + font-size: 14px; | |
| 290 | +} | |
| 291 | + | |
| 292 | +.custom-table tr:hover { | |
| 293 | + background-color: #f5f7fa; | |
| 294 | +} | |
| 295 | + | |
| 296 | +.custom-select { | |
| 297 | + width: 100%; | |
| 298 | + height: 32px; | |
| 299 | + line-height: 32px; | |
| 300 | + border: 1px solid #dcdfe6; | |
| 301 | + border-radius: 4px; | |
| 302 | + padding: 0 12px; | |
| 303 | + font-size: 14px; | |
| 304 | + color: #606266; | |
| 305 | + background-color: #fff; | |
| 306 | + transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); | |
| 307 | +} | |
| 308 | + | |
| 309 | +.custom-select:focus { | |
| 310 | + outline: none; | |
| 311 | + border-color: #409eff; | |
| 312 | +} | |
| 313 | + | |
| 314 | +.custom-select:hover { | |
| 315 | + border-color: #c0c4cc; | |
| 316 | +} | |
| 317 | +</style> | |
| 0 | 318 | \ No newline at end of file | ... | ... |
src/views/resource/scrapGoodsStepLang.js
0 → 100644
| 1 | +export const messages = { | |
| 2 | + en: { | |
| 3 | + scrapGoodsStep: { | |
| 4 | + lossDescription: 'Loss Description', | |
| 5 | + requiredRemark: 'Required, please fill in the loss description', | |
| 6 | + submit: 'Submit', | |
| 7 | + selectGoodsFirst: 'Please select goods first', | |
| 8 | + requiredQuantity: 'Please fill in the quantity', | |
| 9 | + stockNotEnough: ', stock is not enough', | |
| 10 | + requiredUsageType: 'Please select goods usage type', | |
| 11 | + requiredNote: 'Please fill in the note', | |
| 12 | + submitSuccess: 'Submit successfully', | |
| 13 | + submitFailed: 'Submit failed' | |
| 14 | + }, | |
| 15 | + viewResourceMyGoodsInfo: { | |
| 16 | + goodsInfo: 'Goods Information', | |
| 17 | + back: 'Back', | |
| 18 | + selectGoods: 'Select Goods', | |
| 19 | + goodsName: 'Goods Name', | |
| 20 | + goodsCode: 'Goods Code', | |
| 21 | + goodsType: 'Goods Type', | |
| 22 | + isFixedGoods: 'Is Fixed Goods', | |
| 23 | + goodsStock: 'Goods Stock', | |
| 24 | + miniStock: 'Mini Stock', | |
| 25 | + lossQuantity: 'Loss Quantity', | |
| 26 | + usageType: 'Usage Type', | |
| 27 | + selectUsageType: 'Please select usage type', | |
| 28 | + scrapRecycle: 'Scrap Recycle', | |
| 29 | + publicLoss: 'Public Loss', | |
| 30 | + remark: 'Remark', | |
| 31 | + requiredRemark: 'Required, please fill in the remark', | |
| 32 | + operation: 'Operation', | |
| 33 | + remove: 'Remove' | |
| 34 | + }, | |
| 35 | + }, | |
| 36 | + zh: { | |
| 37 | + scrapGoodsStep: { | |
| 38 | + lossDescription: '损耗说明', | |
| 39 | + requiredRemark: '必填,请填写损耗说明', | |
| 40 | + submit: '提交', | |
| 41 | + selectGoodsFirst: '请先选择物品', | |
| 42 | + requiredQuantity: '请填写数量', | |
| 43 | + stockNotEnough: ',库存不足', | |
| 44 | + requiredUsageType: '请选择物品使用类型', | |
| 45 | + requiredNote: '请填写备注', | |
| 46 | + submitSuccess: '提交成功', | |
| 47 | + submitFailed: '提交失败' | |
| 48 | + }, | |
| 49 | + viewResourceMyGoodsInfo: { | |
| 50 | + goodsInfo: '物品信息', | |
| 51 | + back: '返回', | |
| 52 | + selectGoods: '选择物品', | |
| 53 | + goodsName: '物品名称', | |
| 54 | + goodsCode: '物品编码', | |
| 55 | + goodsType: '物品类型', | |
| 56 | + isFixedGoods: '是否是固定物品', | |
| 57 | + goodsStock: '物品库存', | |
| 58 | + miniStock: '物品最小计量总数', | |
| 59 | + lossQuantity: '损耗数量', | |
| 60 | + usageType: '物品使用类型', | |
| 61 | + selectUsageType: '请选择物品使用类型', | |
| 62 | + scrapRecycle: '报废回收', | |
| 63 | + publicLoss: '公用损耗', | |
| 64 | + remark: '备注', | |
| 65 | + requiredRemark: '必填,请填写备注', | |
| 66 | + operation: '操作', | |
| 67 | + remove: '移除' | |
| 68 | + }, | |
| 69 | + } | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
src/views/resource/scrapGoodsStepList.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="scrap-goods-step-container"> | |
| 3 | + <el-card class="box-card"> | |
| 4 | + <div slot="header" class="flex justify-between"> | |
| 5 | + <span>{{ $t('viewResourceMyGoodsInfo.goodsInfo') }}</span> | |
| 6 | + <div class="action-buttons"> | |
| 7 | + <el-button type="primary" size="small" @click="handleGoBack"> | |
| 8 | + <i class="el-icon-close"></i> | |
| 9 | + {{ $t('viewResourceMyGoodsInfo.back') }} | |
| 10 | + </el-button> | |
| 11 | + <el-button type="primary" size="small" @click="handleOpenSelectModal"> | |
| 12 | + <i class="el-icon-search"></i> | |
| 13 | + {{ $t('viewResourceMyGoodsInfo.selectGoods') }} | |
| 14 | + </el-button> | |
| 15 | + </div> | |
| 16 | + </div> | |
| 17 | + | |
| 18 | + <el-table :data="form.resourceStores" border style="width: 100%"> | |
| 19 | + <el-table-column prop="resName" :label="$t('viewResourceMyGoodsInfo.goodsName')" align="center" /> | |
| 20 | + <el-table-column prop="resCode" :label="$t('viewResourceMyGoodsInfo.goodsCode')" align="center" /> | |
| 21 | + <el-table-column :label="$t('viewResourceMyGoodsInfo.goodsType')" align="center"> | |
| 22 | + <template slot-scope="scope"> | |
| 23 | + {{ scope.row.parentRstName || '-' }} > {{ scope.row.rstName || '-' }} | |
| 24 | + </template> | |
| 25 | + </el-table-column> | |
| 26 | + <el-table-column prop="isFixedName" :label="$t('viewResourceMyGoodsInfo.isFixedGoods')" align="center" /> | |
| 27 | + <el-table-column :label="$t('viewResourceMyGoodsInfo.goodsStock')" align="center"> | |
| 28 | + <template slot-scope="scope"> | |
| 29 | + {{ scope.row.stock }}{{ scope.row.unitCodeName }} | |
| 30 | + </template> | |
| 31 | + </el-table-column> | |
| 32 | + <el-table-column :label="$t('viewResourceMyGoodsInfo.miniStock')" align="center"> | |
| 33 | + <template slot-scope="scope"> | |
| 34 | + {{ scope.row.miniStock }}{{ scope.row.miniUnitCodeName }} | |
| 35 | + </template> | |
| 36 | + </el-table-column> | |
| 37 | + <el-table-column :label="$t('viewResourceMyGoodsInfo.lossQuantity')" align="center"> | |
| 38 | + <template slot-scope="scope"> | |
| 39 | + <el-input-number v-model="scope.row.giveQuantity" :min="0" :max="parseFloat(scope.row.miniStock)" | |
| 40 | + :precision="2" controls-position="right" style="width: 120px"> | |
| 41 | + </el-input-number> | |
| 42 | + {{ scope.row.miniUnitCodeName }} | |
| 43 | + </template> | |
| 44 | + </el-table-column> | |
| 45 | + <el-table-column :label="$t('viewResourceMyGoodsInfo.usageType')" align="center"> | |
| 46 | + <template slot-scope="scope"> | |
| 47 | + <el-select v-model="scope.row.state" style="width: 100%"> | |
| 48 | + <el-option :label="$t('viewResourceMyGoodsInfo.selectUsageType')" value=""></el-option> | |
| 49 | + <el-option :label="$t('viewResourceMyGoodsInfo.scrapRecycle')" value="1001"></el-option> | |
| 50 | + <el-option :label="$t('viewResourceMyGoodsInfo.publicLoss')" value="3003"></el-option> | |
| 51 | + </el-select> | |
| 52 | + </template> | |
| 53 | + </el-table-column> | |
| 54 | + <el-table-column :label="$t('viewResourceMyGoodsInfo.remark')" align="center"> | |
| 55 | + <template slot-scope="scope"> | |
| 56 | + <el-input v-model="scope.row.purchaseRemark" :placeholder="$t('viewResourceMyGoodsInfo.requiredRemark')"> | |
| 57 | + </el-input> | |
| 58 | + </template> | |
| 59 | + </el-table-column> | |
| 60 | + <el-table-column :label="$t('viewResourceMyGoodsInfo.operation')" align="center"> | |
| 61 | + <template slot-scope="scope"> | |
| 62 | + <el-button type="danger" size="mini" @click="handleRemoveItem(scope.row.resId, scope.$index)"> | |
| 63 | + <i class="el-icon-delete"></i> | |
| 64 | + {{ $t('viewResourceMyGoodsInfo.remove') }} | |
| 65 | + </el-button> | |
| 66 | + </template> | |
| 67 | + </el-table-column> | |
| 68 | + </el-table> | |
| 69 | + </el-card> | |
| 70 | + | |
| 71 | + <el-row> | |
| 72 | + <el-col :span="24"> | |
| 73 | + <el-card class="box-card"> | |
| 74 | + <div slot="header" class="flex justify-between"> | |
| 75 | + <span>{{ $t('scrapGoodsStep.lossDescription') }}</span> | |
| 76 | + </div> | |
| 77 | + <el-form :model="form" label-width="120px"> | |
| 78 | + <el-form-item :label="$t('scrapGoodsStep.lossDescription')"> | |
| 79 | + <el-input type="textarea" v-model="form.remark" :placeholder="$t('scrapGoodsStep.requiredRemark')" | |
| 80 | + :rows="4"> | |
| 81 | + </el-input> | |
| 82 | + </el-form-item> | |
| 83 | + </el-form> | |
| 84 | + </el-card> | |
| 85 | + </el-col> | |
| 86 | + </el-row> | |
| 87 | + | |
| 88 | + <el-row> | |
| 89 | + <el-col :span="22" :offset="2"> | |
| 90 | + <div class="action-buttons"> | |
| 91 | + <el-button type="primary" @click="handleSubmit"> | |
| 92 | + {{ $t('scrapGoodsStep.submit') }} | |
| 93 | + </el-button> | |
| 94 | + </div> | |
| 95 | + </el-col> | |
| 96 | + </el-row> | |
| 97 | + <choose-resource-staff ref="chooseResourceStaff" @setSelectResourceStores="handleSetSelectedStores"> | |
| 98 | + </choose-resource-staff> | |
| 99 | + </div> | |
| 100 | + | |
| 101 | +</template> | |
| 102 | + | |
| 103 | +<script> | |
| 104 | +import { saveAllocationUserStorehouse } from '@/api/resource/scrapGoodsStepApi' | |
| 105 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 106 | + | |
| 107 | +import ChooseResourceStaff from '@/components/resource/chooseResourceStaff' | |
| 108 | + | |
| 109 | +export default { | |
| 110 | + name: 'ScrapGoodsStepList', | |
| 111 | + components: { | |
| 112 | + ChooseResourceStaff | |
| 113 | + | |
| 114 | + }, | |
| 115 | + data() { | |
| 116 | + return { | |
| 117 | + form: { | |
| 118 | + resourceStores: [], | |
| 119 | + remark: '', | |
| 120 | + communityId: '', | |
| 121 | + acceptUserId: '', | |
| 122 | + acceptUserName: '', | |
| 123 | + flag: '1' | |
| 124 | + } | |
| 125 | + } | |
| 126 | + }, | |
| 127 | + created() { | |
| 128 | + this.form.communityId = getCommunityId() | |
| 129 | + }, | |
| 130 | + methods: { | |
| 131 | + handleGoBack() { | |
| 132 | + this.$router.go(-1) | |
| 133 | + }, | |
| 134 | + handleNotify(goodsInfo) { | |
| 135 | + this.form.resourceStores = goodsInfo | |
| 136 | + }, | |
| 137 | + handleOpenSelectModal() { | |
| 138 | + this.$refs.chooseResourceStaff.open() | |
| 139 | + }, | |
| 140 | + handleSetSelectedStores(resourceStores) { | |
| 141 | + this.form.resourceStores = resourceStores.map(item => { | |
| 142 | + return { | |
| 143 | + ...item, | |
| 144 | + state: '', | |
| 145 | + purchaseRemark: '', | |
| 146 | + giveQuantity: 0 | |
| 147 | + } | |
| 148 | + }) | |
| 149 | + }, | |
| 150 | + handleRemoveItem(resId, index) { | |
| 151 | + this.form.resourceStores.splice(index, 1) | |
| 152 | + this.$refs.chooseResourceStaff.removeSelectedItem(resId) | |
| 153 | + }, | |
| 154 | + handleSubmit() { | |
| 155 | + if (this.form.resourceStores.length === 0) { | |
| 156 | + this.$message.error(this.$t('scrapGoodsStep.selectGoodsFirst')) | |
| 157 | + return | |
| 158 | + } | |
| 159 | + | |
| 160 | + if (!this.form.remark) { | |
| 161 | + this.$message.error(this.$t('scrapGoodsStep.requiredRemark')) | |
| 162 | + return | |
| 163 | + } | |
| 164 | + | |
| 165 | + // 校验商品信息 | |
| 166 | + for (const item of this.form.resourceStores) { | |
| 167 | + if (!item.giveQuantity || parseFloat(item.giveQuantity) <= 0) { | |
| 168 | + this.$message.error(this.$t('scrapGoodsStep.requiredQuantity')) | |
| 169 | + return | |
| 170 | + } | |
| 171 | + | |
| 172 | + if (parseFloat(item.giveQuantity) > parseFloat(item.miniStock)) { | |
| 173 | + this.$message.error(`${item.resName} ${this.$t('scrapGoodsStep.stockNotEnough')}`) | |
| 174 | + return | |
| 175 | + } | |
| 176 | + | |
| 177 | + if (!item.state) { | |
| 178 | + this.$message.error(this.$t('scrapGoodsStep.requiredUsageType')) | |
| 179 | + return | |
| 180 | + } | |
| 181 | + | |
| 182 | + if (!item.purchaseRemark) { | |
| 183 | + this.$message.error(this.$t('scrapGoodsStep.requiredNote')) | |
| 184 | + return | |
| 185 | + } | |
| 186 | + } | |
| 187 | + | |
| 188 | + saveAllocationUserStorehouse(this.form) | |
| 189 | + .then(response => { | |
| 190 | + if (response.code === 0) { | |
| 191 | + this.$message.success(this.$t('scrapGoodsStep.submitSuccess')) | |
| 192 | + this.$router.push('/resource/myResourceStoreManage') | |
| 193 | + } else { | |
| 194 | + this.$message.error(response.msg) | |
| 195 | + } | |
| 196 | + }) | |
| 197 | + .catch(error => { | |
| 198 | + this.$message.error(this.$t('scrapGoodsStep.submitFailed')) | |
| 199 | + console.error(error) | |
| 200 | + }) | |
| 201 | + } | |
| 202 | + } | |
| 203 | +} | |
| 204 | +</script> | |
| 205 | + | |
| 206 | +<style lang="scss" scoped> | |
| 207 | +.scrap-goods-step-container { | |
| 208 | + padding: 20px; | |
| 209 | + | |
| 210 | + .box-card { | |
| 211 | + margin-bottom: 20px; | |
| 212 | + } | |
| 213 | + | |
| 214 | + .action-buttons { | |
| 215 | + text-align: right; | |
| 216 | + margin-bottom: 20px; | |
| 217 | + } | |
| 218 | +} | |
| 219 | +</style> | |
| 0 | 220 | \ No newline at end of file | ... | ... |
src/views/resource/transferGoodsManageLang.js
0 → 100644
| 1 | +export const messages = { | |
| 2 | + en: { | |
| 3 | + transferGoodsManage: { | |
| 4 | + recipient: 'Recipient', | |
| 5 | + requiredContact: 'Required, please fill in the contact', | |
| 6 | + selectRecipient: 'Select Recipient', | |
| 7 | + transferDescription: 'Transfer Description', | |
| 8 | + requiredDescription: 'Required, please fill in the transfer description', | |
| 9 | + goodsInfo: 'Goods Information', | |
| 10 | + selectGoods: 'Select Goods', | |
| 11 | + goodsName: 'Goods Name', | |
| 12 | + goodsCode: 'Goods Code', | |
| 13 | + goodsType: 'Goods Type', | |
| 14 | + isFixedGoods: 'Is Fixed Goods', | |
| 15 | + goodsStock: 'Goods Stock', | |
| 16 | + miniStock: 'Minimum Stock', | |
| 17 | + transferQuantity: 'Transfer Quantity', | |
| 18 | + remark: 'Remark', | |
| 19 | + operation: 'Operation', | |
| 20 | + remove: 'Remove', | |
| 21 | + submit: 'Submit', | |
| 22 | + selectGoodsType: 'Select Goods Type', | |
| 23 | + selectSubCategory: 'Select Sub Category', | |
| 24 | + inputGoodsName: 'Input Goods Name', | |
| 25 | + cannotTransferToSelf: 'Cannot transfer to yourself', | |
| 26 | + selectRecipientFirst: 'Please select recipient first', | |
| 27 | + fillDescriptionFirst: 'Please fill in description first', | |
| 28 | + selectGoodsFirst: 'Please select goods first', | |
| 29 | + fillQuantityFirst: 'Please fill in quantity first', | |
| 30 | + insufficientStock: 'Insufficient stock', | |
| 31 | + orgInfo: 'Organization Information', | |
| 32 | + staffInfo: 'Staff Information', | |
| 33 | + selectStaffFirst: 'Please select staff first' | |
| 34 | + } | |
| 35 | + }, | |
| 36 | + zh: { | |
| 37 | + transferGoodsManage: { | |
| 38 | + recipient: '受赠人', | |
| 39 | + requiredContact: '必填,请填写联系人', | |
| 40 | + selectRecipient: '选择受赠人', | |
| 41 | + transferDescription: '转赠说明', | |
| 42 | + requiredDescription: '必填,请填写转赠说明', | |
| 43 | + goodsInfo: '物品信息', | |
| 44 | + selectGoods: '选择物品', | |
| 45 | + goodsName: '物品名称', | |
| 46 | + goodsCode: '物品编码', | |
| 47 | + goodsType: '物品类型', | |
| 48 | + isFixedGoods: '是否是固定物品', | |
| 49 | + goodsStock: '物品库存', | |
| 50 | + miniStock: '最小计量总数', | |
| 51 | + transferQuantity: '转赠数量', | |
| 52 | + remark: '备注', | |
| 53 | + operation: '操作', | |
| 54 | + remove: '移除', | |
| 55 | + submit: '提交', | |
| 56 | + selectGoodsType: '请选择物品类型', | |
| 57 | + selectSubCategory: '请选择二级分类', | |
| 58 | + inputGoodsName: '输入物品名称', | |
| 59 | + cannotTransferToSelf: '不能转赠给自己', | |
| 60 | + selectRecipientFirst: '请先选择受赠人', | |
| 61 | + fillDescriptionFirst: '请先填写转赠说明', | |
| 62 | + selectGoodsFirst: '请先选择物品', | |
| 63 | + fillQuantityFirst: '请先填写数量', | |
| 64 | + insufficientStock: '库存不足', | |
| 65 | + orgInfo: '组织信息', | |
| 66 | + staffInfo: '员工信息', | |
| 67 | + selectStaffFirst: '请先选择员工' | |
| 68 | + } | |
| 69 | + } | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
src/views/resource/transferGoodsManageList.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="transfer-goods-manage-container"> | |
| 3 | + <el-card class="box-card"> | |
| 4 | + <div slot="header" class="flex justify-between"> | |
| 5 | + <span>{{ $t('transferGoodsManage.recipient') }}</span> | |
| 6 | + <el-button style="float: right; padding: 3px 0" type="text" @click="goBack"> | |
| 7 | + <i class="el-icon-close"></i> | |
| 8 | + {{ $t('common.back') }} | |
| 9 | + </el-button> | |
| 10 | + </div> | |
| 11 | + <el-form label-width="120px"> | |
| 12 | + <el-row> | |
| 13 | + <el-col :span="24"> | |
| 14 | + <el-form-item :label="$t('transferGoodsManage.recipient')"> | |
| 15 | + <el-col :span="8"> | |
| 16 | + <el-input v-model="transferGoodsManageInfo.endUserInfo.staffName" | |
| 17 | + :placeholder="$t('transferGoodsManage.requiredContact')"></el-input> | |
| 18 | + </el-col> | |
| 19 | + <el-col :span="4" :offset="1"> | |
| 20 | + <el-button type="primary" @click="chooseEndUser"> | |
| 21 | + <i class="el-icon-search"></i> | |
| 22 | + {{ $t('transferGoodsManage.selectRecipient') }} | |
| 23 | + </el-button> | |
| 24 | + </el-col> | |
| 25 | + </el-form-item> | |
| 26 | + </el-col> | |
| 27 | + </el-row> | |
| 28 | + | |
| 29 | + <el-row> | |
| 30 | + <el-col :span="24"> | |
| 31 | + <el-form-item :label="$t('transferGoodsManage.transferDescription')"> | |
| 32 | + <el-col :span="20"> | |
| 33 | + <el-input type="textarea" v-model="transferGoodsManageInfo.description" | |
| 34 | + :placeholder="$t('transferGoodsManage.requiredDescription')" rows="4"></el-input> | |
| 35 | + </el-col> | |
| 36 | + </el-form-item> | |
| 37 | + </el-col> | |
| 38 | + </el-row> | |
| 39 | + </el-form> | |
| 40 | + </el-card> | |
| 41 | + | |
| 42 | + <el-card class="box-card" style="margin-top: 20px"> | |
| 43 | + <div slot="header" class="flex justify-between"> | |
| 44 | + <span>{{ $t('transferGoodsManage.goodsInfo') }}</span> | |
| 45 | + <el-button style="float: right; padding: 3px 0" type="text" @click="openSelectResourceStaffInfoModel"> | |
| 46 | + <i class="el-icon-search"></i> | |
| 47 | + {{ $t('transferGoodsManage.selectGoods') }} | |
| 48 | + </el-button> | |
| 49 | + </div> | |
| 50 | + | |
| 51 | + <el-table :data="transferGoodsManageInfo.resourceStores" border style="width: 100%"> | |
| 52 | + <el-table-column prop="resName" :label="$t('transferGoodsManage.goodsName')" align="center" /> | |
| 53 | + <el-table-column prop="resCode" :label="$t('transferGoodsManage.goodsCode')" align="center" /> | |
| 54 | + <el-table-column :label="$t('transferGoodsManage.goodsType')" align="center"> | |
| 55 | + <template slot-scope="scope"> | |
| 56 | + {{ scope.row.parentRstName || '-' }} > | |
| 57 | + {{ scope.row.rstName || '-' }} | |
| 58 | + </template> | |
| 59 | + </el-table-column> | |
| 60 | + <el-table-column prop="isFixedName" :label="$t('transferGoodsManage.isFixedGoods')" align="center" /> | |
| 61 | + <el-table-column :label="$t('transferGoodsManage.goodsStock')" align="center"> | |
| 62 | + <template slot-scope="scope"> | |
| 63 | + {{ scope.row.stock }}{{ scope.row.unitCodeName }} | |
| 64 | + </template> | |
| 65 | + </el-table-column> | |
| 66 | + <el-table-column :label="$t('transferGoodsManage.miniStock')" align="center"> | |
| 67 | + <template slot-scope="scope"> | |
| 68 | + {{ scope.row.miniStock }}{{ scope.row.miniUnitCodeName }} | |
| 69 | + </template> | |
| 70 | + </el-table-column> | |
| 71 | + <el-table-column :label="$t('transferGoodsManage.transferQuantity')" align="center"> | |
| 72 | + <template slot-scope="scope"> | |
| 73 | + <el-input-number v-model="scope.row.giveQuantity" | |
| 74 | + controls-position="right" style="width: 120px"></el-input-number> | |
| 75 | + {{ scope.row.miniUnitCodeName }} | |
| 76 | + </template> | |
| 77 | + </el-table-column> | |
| 78 | + <el-table-column :label="$t('transferGoodsManage.remark')" align="center"> | |
| 79 | + <template slot-scope="scope"> | |
| 80 | + <el-input v-model="scope.row.purchaseRemark"></el-input> | |
| 81 | + </template> | |
| 82 | + </el-table-column> | |
| 83 | + <el-table-column :label="$t('common.operation')" align="center" width="120"> | |
| 84 | + <template slot-scope="scope"> | |
| 85 | + <el-button type="danger" size="mini" @click="removeSelectResourceStoreItem(scope.row.resId)"> | |
| 86 | + <i class="el-icon-delete"></i> | |
| 87 | + {{ $t('common.delete') }} | |
| 88 | + </el-button> | |
| 89 | + </template> | |
| 90 | + </el-table-column> | |
| 91 | + </el-table> | |
| 92 | + | |
| 93 | + <ChooseResourceStaff ref="chooseResourceStaff" @setSelectResourceStores="setSelectResourceStores" /> | |
| 94 | + </el-card> | |
| 95 | + | |
| 96 | + <el-row style="margin-top: 20px"> | |
| 97 | + <el-col :span="24" style="text-align: right"> | |
| 98 | + <el-button type="primary" @click="finishStep"> | |
| 99 | + {{ $t('common.submit') }} | |
| 100 | + </el-button> | |
| 101 | + </el-col> | |
| 102 | + </el-row> | |
| 103 | + | |
| 104 | + <SelectStaff ref="selectStaff" @selectStaff="setEndUserInfo" /> | |
| 105 | + </div> | |
| 106 | +</template> | |
| 107 | + | |
| 108 | +<script> | |
| 109 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 110 | +import ChooseResourceStaff from '@/components/resource/chooseResourceStaff' | |
| 111 | +import SelectStaff from '@/components/staff/SelectStaff' | |
| 112 | +import {getUserId} from '@/api/user/userApi' | |
| 113 | +import {saveAllocationUserStorehouse} from '@/api/resource/transferGoodsManageApi' | |
| 114 | + | |
| 115 | +export default { | |
| 116 | + name: 'TransferGoodsManageList', | |
| 117 | + components: { | |
| 118 | + ChooseResourceStaff, | |
| 119 | + SelectStaff | |
| 120 | + }, | |
| 121 | + data() { | |
| 122 | + return { | |
| 123 | + communityId: '', | |
| 124 | + transferGoodsManageInfo: { | |
| 125 | + description: '', | |
| 126 | + endUserInfo: { | |
| 127 | + staffId: '', | |
| 128 | + staffName: '', | |
| 129 | + staffTel: '' | |
| 130 | + }, | |
| 131 | + resourceStores: [] | |
| 132 | + } | |
| 133 | + } | |
| 134 | + }, | |
| 135 | + created() { | |
| 136 | + this.communityId = getCommunityId() | |
| 137 | + this.initStep() | |
| 138 | + }, | |
| 139 | + methods: { | |
| 140 | + initStep() { | |
| 141 | + this.transferGoodsManageInfo = { | |
| 142 | + description: '', | |
| 143 | + endUserInfo: { | |
| 144 | + staffId: '', | |
| 145 | + staffName: '', | |
| 146 | + staffTel: '' | |
| 147 | + }, | |
| 148 | + resourceStores: [] | |
| 149 | + } | |
| 150 | + }, | |
| 151 | + goBack() { | |
| 152 | + this.$router.go(-1) | |
| 153 | + }, | |
| 154 | + chooseEndUser() { | |
| 155 | + this.$refs.selectStaff.open() | |
| 156 | + }, | |
| 157 | + setEndUserInfo(staff) { | |
| 158 | + this.transferGoodsManageInfo.endUserInfo = { | |
| 159 | + staffId: staff.userId, | |
| 160 | + staffName: staff.userName, | |
| 161 | + staffTel: staff.tel | |
| 162 | + } | |
| 163 | + }, | |
| 164 | + openSelectResourceStaffInfoModel() { | |
| 165 | + this.$refs.chooseResourceStaff.open() | |
| 166 | + }, | |
| 167 | + setSelectResourceStores(resourceStores) { | |
| 168 | + // 保留用户之前输入的数量和备注 | |
| 169 | + const oldList = this.transferGoodsManageInfo.resourceStores | |
| 170 | + resourceStores.forEach(newItem => { | |
| 171 | + newItem.quantity = 0 | |
| 172 | + oldList.forEach(oldItem => { | |
| 173 | + if (oldItem.resId === newItem.resId) { | |
| 174 | + newItem.giveQuantity = oldItem.giveQuantity | |
| 175 | + newItem.price = oldItem.price | |
| 176 | + newItem.purchaseRemark = oldItem.purchaseRemark | |
| 177 | + } | |
| 178 | + }) | |
| 179 | + }) | |
| 180 | + this.transferGoodsManageInfo.resourceStores = resourceStores | |
| 181 | + }, | |
| 182 | + removeSelectResourceStoreItem(resId) { | |
| 183 | + this.transferGoodsManageInfo.resourceStores = this.transferGoodsManageInfo.resourceStores.filter( | |
| 184 | + item => item.resId !== resId | |
| 185 | + ) | |
| 186 | + }, | |
| 187 | + async finishStep() { | |
| 188 | + const postData = { | |
| 189 | + resourceStores: this.transferGoodsManageInfo.resourceStores, | |
| 190 | + description: this.transferGoodsManageInfo.description, | |
| 191 | + file: '', | |
| 192 | + acceptUserId: this.transferGoodsManageInfo.endUserInfo.staffId, | |
| 193 | + acceptUserName: this.transferGoodsManageInfo.endUserInfo.staffName, | |
| 194 | + communityId: this.communityId | |
| 195 | + } | |
| 196 | + | |
| 197 | + const currentUserId = getUserId() | |
| 198 | + if (currentUserId === postData.acceptUserId) { | |
| 199 | + this.$message.error(this.$t('transferGoodsManage.cannotTransferToSelf')) | |
| 200 | + return | |
| 201 | + } | |
| 202 | + | |
| 203 | + if (!postData.acceptUserId) { | |
| 204 | + this.$message.error(this.$t('transferGoodsManage.selectRecipientFirst')) | |
| 205 | + return | |
| 206 | + } | |
| 207 | + | |
| 208 | + if (!postData.description) { | |
| 209 | + this.$message.error(this.$t('transferGoodsManage.fillDescriptionFirst')) | |
| 210 | + return | |
| 211 | + } | |
| 212 | + | |
| 213 | + const _resourceStores = postData.resourceStores | |
| 214 | + if (_resourceStores.length <= 0) { | |
| 215 | + this.$message.error(this.$t('transferGoodsManage.selectGoodsFirst')) | |
| 216 | + return | |
| 217 | + } | |
| 218 | + | |
| 219 | + // 校验商品信息 | |
| 220 | + for (let i = 0; i < _resourceStores.length; i++) { | |
| 221 | + if ( | |
| 222 | + !Object.prototype.hasOwnProperty.call(_resourceStores[i], 'giveQuantity') || | |
| 223 | + parseFloat(_resourceStores[i].giveQuantity) <= 0 | |
| 224 | + ) { | |
| 225 | + this.$message.error(this.$t('transferGoodsManage.fillQuantityFirst')) | |
| 226 | + return | |
| 227 | + } | |
| 228 | + _resourceStores[i].giveQuantity = parseFloat(_resourceStores[i].giveQuantity) | |
| 229 | + if ( | |
| 230 | + _resourceStores[i].giveQuantity > | |
| 231 | + parseFloat(_resourceStores[i].miniStock) | |
| 232 | + ) { | |
| 233 | + this.$message.error( | |
| 234 | + `${_resourceStores[i].resName},${this.$t('transferGoodsManage.insufficientStock')}` | |
| 235 | + ) | |
| 236 | + return | |
| 237 | + } | |
| 238 | + } | |
| 239 | + | |
| 240 | + try { | |
| 241 | + const res = await saveAllocationUserStorehouse( | |
| 242 | + postData | |
| 243 | + ) | |
| 244 | + if (res.code === 0) { | |
| 245 | + this.$message.success(this.$t('common.operateSuccess')) | |
| 246 | + this.$router.push('/resource/myResourceStoreManage') | |
| 247 | + } else { | |
| 248 | + this.$message.error(res.msg) | |
| 249 | + } | |
| 250 | + } catch (error) { | |
| 251 | + this.$message.error(this.$t('common.operateFailed')) | |
| 252 | + } | |
| 253 | + } | |
| 254 | + } | |
| 255 | +} | |
| 256 | +</script> | |
| 257 | + | |
| 258 | +<style lang="scss" scoped> | |
| 259 | +.transfer-goods-manage-container { | |
| 260 | + padding: 20px; | |
| 261 | + | |
| 262 | + .box-card { | |
| 263 | + margin-bottom: 20px; | |
| 264 | + } | |
| 265 | + | |
| 266 | + .clearfix { | |
| 267 | + font-size: 18px; | |
| 268 | + font-weight: bold; | |
| 269 | + } | |
| 270 | + | |
| 271 | + .el-form-item { | |
| 272 | + margin-bottom: 22px; | |
| 273 | + } | |
| 274 | + | |
| 275 | + .el-input-number { | |
| 276 | + width: 120px; | |
| 277 | + } | |
| 278 | +} | |
| 279 | +</style> | |
| 0 | 280 | \ No newline at end of file | ... | ... |