Commit e577792690fba383bc3d2843a79960f02c47102a
1 parent
e5d43009
优化工作办理
Showing
11 changed files
with
1067 additions
and
0 deletions
src/api/resource/editPurchaseApplyApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 3 | + | ||
| 4 | +// 获取采购申请列表 | ||
| 5 | +export function listPurchaseApplys(params) { | ||
| 6 | + return new Promise((resolve, reject) => { | ||
| 7 | + request({ | ||
| 8 | + url: '/purchaseApply.listPurchaseApplys', | ||
| 9 | + method: 'get', | ||
| 10 | + params: { | ||
| 11 | + ...params, | ||
| 12 | + communityId: getCommunityId() | ||
| 13 | + } | ||
| 14 | + }).then(response => { | ||
| 15 | + const res = response.data | ||
| 16 | + resolve(res) | ||
| 17 | + }).catch(error => { | ||
| 18 | + reject(error) | ||
| 19 | + }) | ||
| 20 | + }) | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +// 更新采购申请 | ||
| 24 | +export function updatePurchaseApply(data) { | ||
| 25 | + return new Promise((resolve, reject) => { | ||
| 26 | + request({ | ||
| 27 | + url: '/purchaseApply.updatePurchaseApply', | ||
| 28 | + method: 'post', | ||
| 29 | + data: { | ||
| 30 | + ...data, | ||
| 31 | + communityId: getCommunityId() | ||
| 32 | + } | ||
| 33 | + }).then(response => { | ||
| 34 | + const res = response.data | ||
| 35 | + resolve(res) | ||
| 36 | + }).catch(error => { | ||
| 37 | + reject(error) | ||
| 38 | + }) | ||
| 39 | + }) | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +// 获取仓库列表 | ||
| 43 | +export function listStorehouses(params) { | ||
| 44 | + return new Promise((resolve, reject) => { | ||
| 45 | + request({ | ||
| 46 | + url: '/resourceStore.listStorehouses', | ||
| 47 | + method: 'get', | ||
| 48 | + params: { | ||
| 49 | + ...params, | ||
| 50 | + communityId: getCommunityId() | ||
| 51 | + } | ||
| 52 | + }).then(response => { | ||
| 53 | + const res = response.data | ||
| 54 | + resolve(res) | ||
| 55 | + }).catch(error => { | ||
| 56 | + reject(error) | ||
| 57 | + }) | ||
| 58 | + }) | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +// 获取物品类型列表 | ||
| 62 | +export function listResourceStoreTypes(params) { | ||
| 63 | + return new Promise((resolve, reject) => { | ||
| 64 | + request({ | ||
| 65 | + url: '/resourceStoreType.listResourceStoreTypes', | ||
| 66 | + method: 'get', | ||
| 67 | + params: { | ||
| 68 | + ...params, | ||
| 69 | + communityId: getCommunityId() | ||
| 70 | + } | ||
| 71 | + }).then(response => { | ||
| 72 | + const res = response.data | ||
| 73 | + resolve(res) | ||
| 74 | + }).catch(error => { | ||
| 75 | + reject(error) | ||
| 76 | + }) | ||
| 77 | + }) | ||
| 78 | +} | ||
| 79 | + | ||
| 80 | +// 获取物品列表 | ||
| 81 | +export function listResourceStores(params) { | ||
| 82 | + return new Promise((resolve, reject) => { | ||
| 83 | + request({ | ||
| 84 | + url: '/resourceStore.listResourceStores', | ||
| 85 | + method: 'get', | ||
| 86 | + params: { | ||
| 87 | + ...params, | ||
| 88 | + communityId: getCommunityId() | ||
| 89 | + } | ||
| 90 | + }).then(response => { | ||
| 91 | + const res = response.data | ||
| 92 | + resolve(res) | ||
| 93 | + }).catch(error => { | ||
| 94 | + reject(error) | ||
| 95 | + }) | ||
| 96 | + }) | ||
| 97 | +} | ||
| 0 | \ No newline at end of file | 98 | \ No newline at end of file |
src/api/resource/myAuditOrdersApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 获取待审核订单列表 | ||
| 4 | +export function listAuditOrders(params) { | ||
| 5 | + return new Promise((resolve, reject) => { | ||
| 6 | + request({ | ||
| 7 | + url: '/auditUser.listAuditOrders', | ||
| 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 listWorkflowStepStaffs(params) { | ||
| 21 | + return new Promise((resolve, reject) => { | ||
| 22 | + request({ | ||
| 23 | + url: '/workflow.listWorkflowStepStaffs', | ||
| 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 auditOrderInfo(data) { | ||
| 37 | + return new Promise((resolve, reject) => { | ||
| 38 | + request({ | ||
| 39 | + url: '/auditUser.notifyAudit', | ||
| 40 | + method: 'post', | ||
| 41 | + data | ||
| 42 | + }).then(response => { | ||
| 43 | + const res = response.data | ||
| 44 | + resolve(res) | ||
| 45 | + }).catch(error => { | ||
| 46 | + reject(error) | ||
| 47 | + }) | ||
| 48 | + }) | ||
| 49 | +} | ||
| 0 | \ No newline at end of file | 50 | \ No newline at end of file |
src/api/resource/resourceEnterManageApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 获取采购申请列表 | ||
| 4 | +export function listPurchaseApplys(params) { | ||
| 5 | + return new Promise((resolve, reject) => { | ||
| 6 | + request({ | ||
| 7 | + url: '/purchaseApply.listPurchaseApplys', | ||
| 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 listResourceSuppliers(params) { | ||
| 21 | + return new Promise((resolve, reject) => { | ||
| 22 | + request({ | ||
| 23 | + url: '/resourceSupplier.listResourceSuppliers', | ||
| 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 resourceEnter(data) { | ||
| 37 | + return new Promise((resolve, reject) => { | ||
| 38 | + request({ | ||
| 39 | + url: '/purchase/resourceEnter', | ||
| 40 | + method: 'post', | ||
| 41 | + data | ||
| 42 | + }).then(response => { | ||
| 43 | + const res = response.data | ||
| 44 | + resolve(res) | ||
| 45 | + }).catch(error => { | ||
| 46 | + reject(error) | ||
| 47 | + }) | ||
| 48 | + }) | ||
| 49 | +} | ||
| 0 | \ No newline at end of file | 50 | \ No newline at end of file |
src/i18n/resourceI18n.js
| @@ -30,6 +30,9 @@ import { messages as printAssetInventoryInStockMessages } from '../views/resourc | @@ -30,6 +30,9 @@ import { messages as printAssetInventoryInStockMessages } from '../views/resourc | ||
| 30 | import { messages as returnStorehouseApplyManageMessages } from '../views/resource/returnStorehouseApplyManageLang' | 30 | import { messages as returnStorehouseApplyManageMessages } from '../views/resource/returnStorehouseApplyManageLang' |
| 31 | import { messages as transferGoodsManageMessages } from '../views/resource/transferGoodsManageLang' | 31 | import { messages as transferGoodsManageMessages } from '../views/resource/transferGoodsManageLang' |
| 32 | import { messages as scrapGoodsStepMessages } from '../views/resource/scrapGoodsStepLang' | 32 | import { messages as scrapGoodsStepMessages } from '../views/resource/scrapGoodsStepLang' |
| 33 | +import { messages as myAuditOrdersMessages } from '../views/resource/myAuditOrdersLang' | ||
| 34 | +import { messages as resourceEnterManageMessages } from '../views/resource/resourceEnterManageLang' | ||
| 35 | +import { messages as editPurchaseApplyMessages } from '../views/resource/editPurchaseApplyLang' | ||
| 33 | 36 | ||
| 34 | export const messages = { | 37 | export const messages = { |
| 35 | en: { | 38 | en: { |
| @@ -64,6 +67,9 @@ export const messages = { | @@ -64,6 +67,9 @@ export const messages = { | ||
| 64 | ...returnStorehouseApplyManageMessages.en, | 67 | ...returnStorehouseApplyManageMessages.en, |
| 65 | ...transferGoodsManageMessages.en, | 68 | ...transferGoodsManageMessages.en, |
| 66 | ...scrapGoodsStepMessages.en, | 69 | ...scrapGoodsStepMessages.en, |
| 70 | + ...myAuditOrdersMessages.en, | ||
| 71 | + ...resourceEnterManageMessages.en, | ||
| 72 | + ...editPurchaseApplyMessages.en, | ||
| 67 | }, | 73 | }, |
| 68 | zh: { | 74 | zh: { |
| 69 | ...resourceAuditFlowMessages.zh, | 75 | ...resourceAuditFlowMessages.zh, |
| @@ -97,5 +103,8 @@ export const messages = { | @@ -97,5 +103,8 @@ export const messages = { | ||
| 97 | ...returnStorehouseApplyManageMessages.zh, | 103 | ...returnStorehouseApplyManageMessages.zh, |
| 98 | ...transferGoodsManageMessages.zh, | 104 | ...transferGoodsManageMessages.zh, |
| 99 | ...scrapGoodsStepMessages.zh, | 105 | ...scrapGoodsStepMessages.zh, |
| 106 | + ...myAuditOrdersMessages.zh, | ||
| 107 | + ...resourceEnterManageMessages.zh, | ||
| 108 | + ...editPurchaseApplyMessages.zh, | ||
| 100 | } | 109 | } |
| 101 | } | 110 | } |
| 102 | \ No newline at end of file | 111 | \ No newline at end of file |
src/router/resourceRouter.js
| @@ -145,5 +145,20 @@ export default [ | @@ -145,5 +145,20 @@ export default [ | ||
| 145 | name: '/pages/common/scrapGoodsStep', | 145 | name: '/pages/common/scrapGoodsStep', |
| 146 | component: () => import('@/views/resource/scrapGoodsStepList.vue') | 146 | component: () => import('@/views/resource/scrapGoodsStepList.vue') |
| 147 | }, | 147 | }, |
| 148 | + { | ||
| 149 | + path: '/pages/admin/myAuditOrders', | ||
| 150 | + name: '/pages/admin/myAuditOrders', | ||
| 151 | + component: () => import('@/views/resource/myAuditOrdersList.vue') | ||
| 152 | + }, | ||
| 153 | + { | ||
| 154 | + path: '/views/resource/resourceEnterManage', | ||
| 155 | + name: '/views/resource/resourceEnterManage', | ||
| 156 | + component: () => import('@/views/resource/resourceEnterManageList.vue') | ||
| 157 | + }, | ||
| 158 | + { | ||
| 159 | + path: '/pages/resource/editPurchaseApply', | ||
| 160 | + name: '/pages/resource/editPurchaseApply', | ||
| 161 | + component: () => import('@/views/resource/editPurchaseApplyList.vue') | ||
| 162 | + }, | ||
| 148 | 163 | ||
| 149 | ] | 164 | ] |
| 150 | \ No newline at end of file | 165 | \ No newline at end of file |
src/views/resource/editPurchaseApplyLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + editPurchaseApply: { | ||
| 4 | + title: 'Edit Purchase Apply', | ||
| 5 | + back: 'Back', | ||
| 6 | + contactPerson: 'Contact Person', | ||
| 7 | + contactPersonPlaceholder: 'Required, please enter contact person', | ||
| 8 | + contactPhone: 'Contact Phone', | ||
| 9 | + contactPhonePlaceholder: 'Required, please enter contact phone', | ||
| 10 | + applyDescription: 'Apply Description', | ||
| 11 | + applyDescriptionPlaceholder: 'Required, please enter apply description', | ||
| 12 | + purchaseItems: 'Purchase Items', | ||
| 13 | + select: 'Select', | ||
| 14 | + itemType: 'Item Type', | ||
| 15 | + itemName: 'Item Name(Code)', | ||
| 16 | + itemSpec: 'Item Specification', | ||
| 17 | + price: 'Price', | ||
| 18 | + selectPrice: 'Select Price', | ||
| 19 | + itemStock: 'Item Stock', | ||
| 20 | + applyQuantity: 'Apply Quantity', | ||
| 21 | + applyQuantityPlaceholder: 'Required, please enter apply quantity', | ||
| 22 | + remark: 'Remark', | ||
| 23 | + remarkPlaceholder: 'Optional, please enter remark', | ||
| 24 | + operation: 'Operation', | ||
| 25 | + remove: 'Remove', | ||
| 26 | + submit: 'Submit', | ||
| 27 | + noItemsSelected: 'No items selected', | ||
| 28 | + updateSuccess: 'Update success', | ||
| 29 | + updateFailed: 'Update failed' | ||
| 30 | + } | ||
| 31 | + }, | ||
| 32 | + zh: { | ||
| 33 | + editPurchaseApply: { | ||
| 34 | + title: '编辑采购申请', | ||
| 35 | + back: '返回', | ||
| 36 | + contactPerson: '联系人', | ||
| 37 | + contactPersonPlaceholder: '必填,请填写联系人', | ||
| 38 | + contactPhone: '联系电话', | ||
| 39 | + contactPhonePlaceholder: '必填,请填写联系电话', | ||
| 40 | + applyDescription: '申请说明', | ||
| 41 | + applyDescriptionPlaceholder: '必填,请填写申请说明', | ||
| 42 | + purchaseItems: '采购物品', | ||
| 43 | + select: '选择', | ||
| 44 | + itemType: '物品类型', | ||
| 45 | + itemName: '物品名称(编码)', | ||
| 46 | + itemSpec: '物品规格', | ||
| 47 | + price: '价格', | ||
| 48 | + selectPrice: '请选择价格', | ||
| 49 | + itemStock: '物品库存', | ||
| 50 | + applyQuantity: '申请数量', | ||
| 51 | + applyQuantityPlaceholder: '必填,请填写申请数量', | ||
| 52 | + remark: '备注', | ||
| 53 | + remarkPlaceholder: '选填,请填写备注', | ||
| 54 | + operation: '操作', | ||
| 55 | + remove: '移除', | ||
| 56 | + submit: '提交', | ||
| 57 | + noItemsSelected: '未选择采购物品', | ||
| 58 | + updateSuccess: '修改成功', | ||
| 59 | + updateFailed: '修改失败' | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | +} | ||
| 0 | \ No newline at end of file | 63 | \ No newline at end of file |
src/views/resource/editPurchaseApplyList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="edit-purchase-apply-container"> | ||
| 3 | + <el-card class="box-card"> | ||
| 4 | + <div slot="header" class="clearfix"> | ||
| 5 | + <span>{{ $t('editPurchaseApply.title') }}</span> | ||
| 6 | + <div class="header-tools"> | ||
| 7 | + <el-button type="primary" size="small" @click="goBack"> | ||
| 8 | + <i class="el-icon-close"></i> | ||
| 9 | + {{ $t('editPurchaseApply.back') }} | ||
| 10 | + </el-button> | ||
| 11 | + </div> | ||
| 12 | + </div> | ||
| 13 | + | ||
| 14 | + <el-row :gutter="20"> | ||
| 15 | + <el-col :span="24"> | ||
| 16 | + <el-card> | ||
| 17 | + <el-form label-width="120px"> | ||
| 18 | + <el-form-item :label="$t('editPurchaseApply.contactPerson')"> | ||
| 19 | + <el-input v-model="editPurchaseApplyInfo.endUserName" | ||
| 20 | + :placeholder="$t('editPurchaseApply.contactPersonPlaceholder')" clearable> | ||
| 21 | + </el-input> | ||
| 22 | + </el-form-item> | ||
| 23 | + | ||
| 24 | + <el-form-item :label="$t('editPurchaseApply.contactPhone')"> | ||
| 25 | + <el-input v-model="editPurchaseApplyInfo.endUserTel" | ||
| 26 | + :placeholder="$t('editPurchaseApply.contactPhonePlaceholder')" clearable> | ||
| 27 | + </el-input> | ||
| 28 | + </el-form-item> | ||
| 29 | + | ||
| 30 | + <el-form-item :label="$t('editPurchaseApply.applyDescription')"> | ||
| 31 | + <el-input type="textarea" v-model="editPurchaseApplyInfo.description" | ||
| 32 | + :placeholder="$t('editPurchaseApply.applyDescriptionPlaceholder')" :rows="3"> | ||
| 33 | + </el-input> | ||
| 34 | + </el-form-item> | ||
| 35 | + </el-form> | ||
| 36 | + </el-card> | ||
| 37 | + </el-col> | ||
| 38 | + </el-row> | ||
| 39 | + | ||
| 40 | + <el-row :gutter="20" style="margin-top: 20px;"> | ||
| 41 | + <el-col :span="24"> | ||
| 42 | + <el-card> | ||
| 43 | + <div slot="header" class="clearfix"> | ||
| 44 | + <span>{{ $t('editPurchaseApply.purchaseItems') }}</span> | ||
| 45 | + <div class="header-tools"> | ||
| 46 | + <el-button type="primary" size="small" @click="openSelectResourceStoreDialog"> | ||
| 47 | + <i class="el-icon-search"></i> | ||
| 48 | + {{ $t('editPurchaseApply.select') }} | ||
| 49 | + </el-button> | ||
| 50 | + </div> | ||
| 51 | + </div> | ||
| 52 | + | ||
| 53 | + <el-table :data="editPurchaseApplyInfo.resourceStores" border style="width: 100%"> | ||
| 54 | + <el-table-column prop="type" :label="$t('editPurchaseApply.itemType')" align="center"> | ||
| 55 | + <template slot-scope="scope"> | ||
| 56 | + {{ scope.row.parentRstName || '-' }} > {{ scope.row.rstName || '-' }} | ||
| 57 | + </template> | ||
| 58 | + </el-table-column> | ||
| 59 | + | ||
| 60 | + <el-table-column prop="name" :label="$t('editPurchaseApply.itemName')" align="center"> | ||
| 61 | + <template slot-scope="scope"> | ||
| 62 | + {{ scope.row.resName }}({{ scope.row.resCode }}) | ||
| 63 | + </template> | ||
| 64 | + </el-table-column> | ||
| 65 | + | ||
| 66 | + <el-table-column prop="spec" :label="$t('editPurchaseApply.itemSpec')" align="center"> | ||
| 67 | + <template slot-scope="scope"> | ||
| 68 | + {{ scope.row.rssName || '-' }} | ||
| 69 | + </template> | ||
| 70 | + </el-table-column> | ||
| 71 | + | ||
| 72 | + <el-table-column prop="price" :label="$t('editPurchaseApply.price')" align="center"> | ||
| 73 | + <template slot-scope="scope"> | ||
| 74 | + <el-select v-model="scope.row.timesId" @change="changeTimesId($event, scope.$index)" | ||
| 75 | + style="width: 100%"> | ||
| 76 | + <el-option :value="''" :label="$t('editPurchaseApply.selectPrice')"> | ||
| 77 | + </el-option> | ||
| 78 | + <el-option v-for="time in scope.row.times" :key="time.timesId" :value="time.timesId" | ||
| 79 | + :label="time.price"> | ||
| 80 | + </el-option> | ||
| 81 | + </el-select> | ||
| 82 | + </template> | ||
| 83 | + </el-table-column> | ||
| 84 | + | ||
| 85 | + <el-table-column prop="stock" :label="$t('editPurchaseApply.itemStock')" align="center"> | ||
| 86 | + <template slot-scope="scope"> | ||
| 87 | + {{ getTimesStock(scope.row) }}{{ scope.row.unitCodeName }} | ||
| 88 | + </template> | ||
| 89 | + </el-table-column> | ||
| 90 | + | ||
| 91 | + <el-table-column prop="quantity" :label="$t('editPurchaseApply.applyQuantity')" align="center"> | ||
| 92 | + <template slot-scope="scope"> | ||
| 93 | + <el-input-number v-model="scope.row.quantity" | ||
| 94 | + :placeholder="$t('editPurchaseApply.applyQuantityPlaceholder')" :min="1" controls-position="right" | ||
| 95 | + style="width: 120px"> | ||
| 96 | + </el-input-number> | ||
| 97 | + {{ scope.row.unitCodeName }} | ||
| 98 | + </template> | ||
| 99 | + </el-table-column> | ||
| 100 | + | ||
| 101 | + <el-table-column prop="remark" :label="$t('editPurchaseApply.remark')" align="center"> | ||
| 102 | + <template slot-scope="scope"> | ||
| 103 | + <el-input v-model="scope.row.remark" :placeholder="$t('editPurchaseApply.remarkPlaceholder')" | ||
| 104 | + clearable> | ||
| 105 | + </el-input> | ||
| 106 | + </template> | ||
| 107 | + </el-table-column> | ||
| 108 | + | ||
| 109 | + <el-table-column :label="$t('editPurchaseApply.operation')" align="center" width="120"> | ||
| 110 | + <template slot-scope="scope"> | ||
| 111 | + <el-button type="danger" size="mini" @click="removeSelectResourceStoreItem(scope.row.resId)"> | ||
| 112 | + {{ $t('editPurchaseApply.remove') }} | ||
| 113 | + </el-button> | ||
| 114 | + </template> | ||
| 115 | + </el-table-column> | ||
| 116 | + </el-table> | ||
| 117 | + </el-card> | ||
| 118 | + </el-col> | ||
| 119 | + </el-row> | ||
| 120 | + | ||
| 121 | + <el-row style="margin-top: 20px;"> | ||
| 122 | + <el-col :span="24" style="text-align: right;"> | ||
| 123 | + <el-button type="primary" @click="editApplyPurchaseSummit"> | ||
| 124 | + <i class="el-icon-check"></i> | ||
| 125 | + {{ $t('editPurchaseApply.submit') }} | ||
| 126 | + </el-button> | ||
| 127 | + </el-col> | ||
| 128 | + </el-row> | ||
| 129 | + | ||
| 130 | + <choose-resource-store2 ref="chooseResourceStoreDialog" @setSelectResourceStores="handleSelectResourceStores"> | ||
| 131 | + </choose-resource-store2> | ||
| 132 | + </el-card> | ||
| 133 | + </div> | ||
| 134 | +</template> | ||
| 135 | + | ||
| 136 | +<script> | ||
| 137 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 138 | +import { listPurchaseApplys, updatePurchaseApply } from '@/api/resource/editPurchaseApplyApi' | ||
| 139 | +import ChooseResourceStore2 from '@/components/resource/chooseResourceStore2' | ||
| 140 | + | ||
| 141 | +export default { | ||
| 142 | + name: 'EditPurchaseApplyList', | ||
| 143 | + components: { | ||
| 144 | + ChooseResourceStore2 | ||
| 145 | + }, | ||
| 146 | + data() { | ||
| 147 | + return { | ||
| 148 | + editPurchaseApplyInfo: { | ||
| 149 | + applyOrderId: '', | ||
| 150 | + resourceStores: [], | ||
| 151 | + description: '', | ||
| 152 | + endUserName: '', | ||
| 153 | + endUserTel: '', | ||
| 154 | + resOrderType: '10000', | ||
| 155 | + communityId: getCommunityId() | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + }, | ||
| 159 | + created() { | ||
| 160 | + this.editPurchaseApplyInfo.applyOrderId = this.$route.query.applyOrderId | ||
| 161 | + this.editPurchaseApplyInfo.resOrderType = this.$route.query.resOrderType || '10000' | ||
| 162 | + this.listPurchaseApply() | ||
| 163 | + }, | ||
| 164 | + methods: { | ||
| 165 | + async listPurchaseApply() { | ||
| 166 | + try { | ||
| 167 | + const params = { | ||
| 168 | + page: 1, | ||
| 169 | + row: 1, | ||
| 170 | + applyOrderId: this.editPurchaseApplyInfo.applyOrderId, | ||
| 171 | + resOrderType: this.editPurchaseApplyInfo.resOrderType | ||
| 172 | + } | ||
| 173 | + const { data } = await listPurchaseApplys(params) | ||
| 174 | + if (data && data.length > 0) { | ||
| 175 | + const purchaseApply = data[0] | ||
| 176 | + Object.assign(this.editPurchaseApplyInfo, purchaseApply) | ||
| 177 | + this.editPurchaseApplyInfo.resourceStores = purchaseApply.purchaseApplyDetailVo || [] | ||
| 178 | + } | ||
| 179 | + } catch (error) { | ||
| 180 | + console.error('获取采购申请详情失败:', error) | ||
| 181 | + } | ||
| 182 | + }, | ||
| 183 | + openSelectResourceStoreDialog() { | ||
| 184 | + this.$refs.chooseResourceStoreDialog.open({ | ||
| 185 | + shId: this.editPurchaseApplyInfo.shId | ||
| 186 | + }) | ||
| 187 | + }, | ||
| 188 | + handleSelectResourceStores(resourceStores) { | ||
| 189 | + const oldList = this.editPurchaseApplyInfo.resourceStores | ||
| 190 | + // 过滤重复选择的商品 | ||
| 191 | + const newItems = resourceStores.filter(newItem => { | ||
| 192 | + return !oldList.some(oldItem => oldItem.resId === newItem.resId && (!newItem.times || newItem.times.length < 2)) | ||
| 193 | + }) | ||
| 194 | + this.editPurchaseApplyInfo.resourceStores = [...newItems, ...oldList] | ||
| 195 | + }, | ||
| 196 | + async editApplyPurchaseSummit() { | ||
| 197 | + if (!this.editPurchaseApplyInfo.resourceStores || this.editPurchaseApplyInfo.resourceStores.length === 0) { | ||
| 198 | + this.$message.warning(this.$t('editPurchaseApply.noItemsSelected')) | ||
| 199 | + return | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + try { | ||
| 203 | + await updatePurchaseApply(this.editPurchaseApplyInfo) | ||
| 204 | + this.$message.success(this.$t('editPurchaseApply.updateSuccess')) | ||
| 205 | + this.goBack() | ||
| 206 | + } catch (error) { | ||
| 207 | + console.error('提交采购申请失败:', error) | ||
| 208 | + this.$message.error(error.message || this.$t('editPurchaseApply.updateFailed')) | ||
| 209 | + } | ||
| 210 | + }, | ||
| 211 | + removeSelectResourceStoreItem(resId) { | ||
| 212 | + this.editPurchaseApplyInfo.resourceStores = this.editPurchaseApplyInfo.resourceStores.filter( | ||
| 213 | + item => item.resId !== resId | ||
| 214 | + ) | ||
| 215 | + }, | ||
| 216 | + changeTimesId(timesId, index) { | ||
| 217 | + const times = this.editPurchaseApplyInfo.resourceStores[index].times | ||
| 218 | + const selectedTime = times.find(time => time.timesId === timesId) | ||
| 219 | + if (selectedTime) { | ||
| 220 | + this.editPurchaseApplyInfo.resourceStores[index].selectedStock = selectedTime.stock | ||
| 221 | + } | ||
| 222 | + }, | ||
| 223 | + getTimesStock(resourceStore) { | ||
| 224 | + if (!resourceStore.timesId) return '-' | ||
| 225 | + if (!resourceStore.times) return 0 | ||
| 226 | + | ||
| 227 | + const selectedTime = resourceStore.times.find(time => time.timesId === resourceStore.timesId) | ||
| 228 | + return selectedTime ? selectedTime.stock : 0 | ||
| 229 | + }, | ||
| 230 | + goBack() { | ||
| 231 | + this.$router.go(-1) | ||
| 232 | + } | ||
| 233 | + } | ||
| 234 | +} | ||
| 235 | +</script> | ||
| 236 | + | ||
| 237 | +<style lang="scss" scoped> | ||
| 238 | +.edit-purchase-apply-container { | ||
| 239 | + padding: 20px; | ||
| 240 | + | ||
| 241 | + .box-card { | ||
| 242 | + margin-bottom: 20px; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + .header-tools { | ||
| 246 | + float: right; | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + .el-form-item { | ||
| 250 | + margin-bottom: 20px; | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + .el-select { | ||
| 254 | + width: 100%; | ||
| 255 | + } | ||
| 256 | +} | ||
| 257 | +</style> | ||
| 0 | \ No newline at end of file | 258 | \ No newline at end of file |
src/views/resource/myAuditOrdersLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + myAuditOrders: { | ||
| 4 | + todoList: 'Todo List', | ||
| 5 | + back: 'Back', | ||
| 6 | + refresh: 'Refresh', | ||
| 7 | + orderNumber: 'Order Number', | ||
| 8 | + orderType: 'Order Type', | ||
| 9 | + orderStatus: 'Order Status', | ||
| 10 | + applicant: 'Applicant', | ||
| 11 | + createTime: 'Create Time', | ||
| 12 | + operation: 'Operation', | ||
| 13 | + view: 'View', | ||
| 14 | + edit: 'Edit', | ||
| 15 | + procurement: 'Procurement', | ||
| 16 | + audit: 'Audit' | ||
| 17 | + } | ||
| 18 | + }, | ||
| 19 | + zh: { | ||
| 20 | + myAuditOrders: { | ||
| 21 | + todoList: '待办单', | ||
| 22 | + back: '返回', | ||
| 23 | + refresh: '刷新', | ||
| 24 | + orderNumber: '订单号', | ||
| 25 | + orderType: '订单类型', | ||
| 26 | + orderStatus: '订单状态', | ||
| 27 | + applicant: '申请人', | ||
| 28 | + createTime: '创建时间', | ||
| 29 | + operation: '操作', | ||
| 30 | + view: '查看', | ||
| 31 | + edit: '修改', | ||
| 32 | + procurement: '采购入库', | ||
| 33 | + audit: '审批' | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | +} | ||
| 0 | \ No newline at end of file | 37 | \ No newline at end of file |
src/views/resource/myAuditOrdersList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="animated fadeInRight ecommerce"> | ||
| 3 | + <el-row> | ||
| 4 | + <el-col :span="24"> | ||
| 5 | + <el-card> | ||
| 6 | + <div slot="header" class="flex justify-between"> | ||
| 7 | + <div>{{ $t('myAuditOrders.todoList') }}</div> | ||
| 8 | + <div class="ibox-tools" style="float: right;"> | ||
| 9 | + <el-button type="primary" size="small" @click="goBack"> | ||
| 10 | + <i class="el-icon-close"></i> | ||
| 11 | + {{ $t('myAuditOrders.back') }} | ||
| 12 | + </el-button> | ||
| 13 | + <el-button type="primary" size="small" @click="_queryAuditOrdersMethod"> | ||
| 14 | + <i class="el-icon-refresh"></i> | ||
| 15 | + {{ $t('myAuditOrders.refresh') }} | ||
| 16 | + </el-button> | ||
| 17 | + </div> | ||
| 18 | + </div> | ||
| 19 | + <div class=""> | ||
| 20 | + <el-table :data="auditOrdersInfo.auditOrders" style="width: 100%" border stripe | ||
| 21 | + :default-sort="{ prop: 'createTime', order: 'descending' }"> | ||
| 22 | + <el-table-column prop="applyOrderId" :label="$t('myAuditOrders.orderNumber')" | ||
| 23 | + align="center"></el-table-column> | ||
| 24 | + <el-table-column prop="resOrderTypeName" :label="$t('myAuditOrders.orderType')" | ||
| 25 | + align="center"></el-table-column> | ||
| 26 | + <el-table-column prop="stateName" :label="$t('myAuditOrders.orderStatus')" | ||
| 27 | + align="center"></el-table-column> | ||
| 28 | + <el-table-column prop="userName" :label="$t('myAuditOrders.applicant')" align="center"></el-table-column> | ||
| 29 | + <el-table-column prop="createTime" :label="$t('myAuditOrders.createTime')" align="center" | ||
| 30 | + sortable></el-table-column> | ||
| 31 | + <el-table-column :label="$t('myAuditOrders.operation')" align="center" width="300"> | ||
| 32 | + <template slot-scope="scope"> | ||
| 33 | + <el-button-group> | ||
| 34 | + <el-button size="mini" @click="_openDetailPurchaseApplyModel(scope.row)"> | ||
| 35 | + {{ $t('myAuditOrders.view') }} | ||
| 36 | + </el-button> | ||
| 37 | + <el-button size="mini" v-if="scope.row.createUserId == auditOrdersInfo.currentUserId" | ||
| 38 | + @click="_openEditPurchaseModel(scope.row)"> | ||
| 39 | + {{ $t('myAuditOrders.edit') }} | ||
| 40 | + </el-button> | ||
| 41 | + <el-button size="mini" v-if="scope.row.curTaskName == '仓库管理员'" | ||
| 42 | + @click="_procureEnterOrder(scope.row)"> | ||
| 43 | + {{ $t('myAuditOrders.procurement') }} | ||
| 44 | + </el-button> | ||
| 45 | + <el-button size="mini" v-else @click="_openAuditOrderModel(scope.row)"> | ||
| 46 | + {{ $t('myAuditOrders.audit') }} | ||
| 47 | + </el-button> | ||
| 48 | + </el-button-group> | ||
| 49 | + </template> | ||
| 50 | + </el-table-column> | ||
| 51 | + </el-table> | ||
| 52 | + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" | ||
| 53 | + :current-page="currentPage" :page-sizes="[10, 20, 30, 50]" :page-size="pageSize" | ||
| 54 | + layout="total, sizes, prev, pager, next, jumper" :total="total" style="margin-top: 20px;"></el-pagination> | ||
| 55 | + </div> | ||
| 56 | + </el-card> | ||
| 57 | + </el-col> | ||
| 58 | + </el-row> | ||
| 59 | + </div> | ||
| 60 | +</template> | ||
| 61 | + | ||
| 62 | +<script> | ||
| 63 | +import { listAuditOrders, listWorkflowStepStaffs } from '@/api/resource/myAuditOrdersApi' | ||
| 64 | +//import { getCommunityId } from '@/api/community/communityApi' | ||
| 65 | + | ||
| 66 | +export default { | ||
| 67 | + name: 'MyAuditOrdersList', | ||
| 68 | + data() { | ||
| 69 | + return { | ||
| 70 | + DEFAULT_PAGE: 1, | ||
| 71 | + DEFAULT_ROWS: 10, | ||
| 72 | + auditOrdersInfo: { | ||
| 73 | + auditOrders: [], | ||
| 74 | + total: 0, | ||
| 75 | + records: 1, | ||
| 76 | + moreCondition: false, | ||
| 77 | + userName: '', | ||
| 78 | + currentUserId: '', | ||
| 79 | + conditions: { | ||
| 80 | + AuditOrdersId: '', | ||
| 81 | + userName: '', | ||
| 82 | + auditLink: '', | ||
| 83 | + page: 1, | ||
| 84 | + row: 10 | ||
| 85 | + }, | ||
| 86 | + orderInfo: '', | ||
| 87 | + procure: false, | ||
| 88 | + audit: '1' | ||
| 89 | + }, | ||
| 90 | + currentPage: 1, | ||
| 91 | + pageSize: 10, | ||
| 92 | + total: 0 | ||
| 93 | + } | ||
| 94 | + }, | ||
| 95 | + created() { | ||
| 96 | + this._initMethod() | ||
| 97 | + }, | ||
| 98 | + mounted() { | ||
| 99 | + this._initEvent() | ||
| 100 | + }, | ||
| 101 | + methods: { | ||
| 102 | + _initMethod() { | ||
| 103 | + this._listAuditOrders(this.DEFAULT_PAGE, this.DEFAULT_ROWS) | ||
| 104 | + this._loadStepStaff() | ||
| 105 | + }, | ||
| 106 | + _initEvent() { | ||
| 107 | + | ||
| 108 | + }, | ||
| 109 | + async _listAuditOrders(_page, _rows) { | ||
| 110 | + this.auditOrdersInfo.audit = '1' | ||
| 111 | + this.auditOrdersInfo.conditions.page = _page | ||
| 112 | + this.auditOrdersInfo.conditions.row = _rows | ||
| 113 | + try { | ||
| 114 | + const res = await listAuditOrders(this.auditOrdersInfo.conditions) | ||
| 115 | + const _auditOrdersInfo = res.data | ||
| 116 | + this.auditOrdersInfo.total = _auditOrdersInfo.total | ||
| 117 | + this.auditOrdersInfo.records = _auditOrdersInfo.records | ||
| 118 | + this.auditOrdersInfo.auditOrders = _auditOrdersInfo.data | ||
| 119 | + this.total = _auditOrdersInfo.records | ||
| 120 | + this.currentPage = _page | ||
| 121 | + } catch (error) { | ||
| 122 | + console.error('请求失败:', error) | ||
| 123 | + } | ||
| 124 | + }, | ||
| 125 | + _openAuditOrderModel(_purchaseApply) { | ||
| 126 | + this.$router.push({ | ||
| 127 | + path: '/views/resource/purchaseApplyDetail', | ||
| 128 | + query: { | ||
| 129 | + applyOrderId: _purchaseApply.applyOrderId, | ||
| 130 | + resOrderType: _purchaseApply.resOrderType, | ||
| 131 | + action: 'audit', | ||
| 132 | + taskId: _purchaseApply.taskId, | ||
| 133 | + flowId: _purchaseApply.flowId | ||
| 134 | + } | ||
| 135 | + }) | ||
| 136 | + }, | ||
| 137 | + _queryAuditOrdersMethod() { | ||
| 138 | + this._listAuditOrders(this.DEFAULT_PAGE, this.DEFAULT_ROWS) | ||
| 139 | + }, | ||
| 140 | + _openDetailPurchaseApplyModel(_purchaseApply) { | ||
| 141 | + this.$router.push({ | ||
| 142 | + path: '/views/resource/purchaseApplyDetaill', | ||
| 143 | + query: { | ||
| 144 | + applyOrderId: _purchaseApply.applyOrderId, | ||
| 145 | + resOrderType: _purchaseApply.resOrderType | ||
| 146 | + } | ||
| 147 | + }) | ||
| 148 | + }, | ||
| 149 | + async _loadStepStaff() { | ||
| 150 | + try { | ||
| 151 | + const res = await listWorkflowStepStaffs({ | ||
| 152 | + page: 1, | ||
| 153 | + row: 1, | ||
| 154 | + staffId: this.auditOrdersInfo.currentUserId, | ||
| 155 | + staffRole: '2002', | ||
| 156 | + requestType: 'purchaseHandle' | ||
| 157 | + }) | ||
| 158 | + if (res.data.length > 0) { | ||
| 159 | + this.auditOrdersInfo.procure = true | ||
| 160 | + } | ||
| 161 | + } catch (error) { | ||
| 162 | + console.error('请求失败:', error) | ||
| 163 | + } | ||
| 164 | + }, | ||
| 165 | + _procureEnterOrder(_purchaseApply) { | ||
| 166 | + this.$router.push({ | ||
| 167 | + path: '/views/resource/resourceEnterManage', | ||
| 168 | + query: { | ||
| 169 | + applyOrderId: _purchaseApply.applyOrderId, | ||
| 170 | + resOrderType: _purchaseApply.resOrderType, | ||
| 171 | + taskId: _purchaseApply.taskId | ||
| 172 | + } | ||
| 173 | + }) | ||
| 174 | + }, | ||
| 175 | + _openEditPurchaseModel(_purchaseApply) { | ||
| 176 | + this.$router.push({ | ||
| 177 | + path: '/pages/resource/editPurchaseApply', | ||
| 178 | + query: { | ||
| 179 | + applyOrderId: _purchaseApply.applyOrderId, | ||
| 180 | + resOrderType: _purchaseApply.resOrderType | ||
| 181 | + } | ||
| 182 | + }) | ||
| 183 | + }, | ||
| 184 | + handleSizeChange(val) { | ||
| 185 | + this.pageSize = val | ||
| 186 | + this._listAuditOrders(this.currentPage, val) | ||
| 187 | + }, | ||
| 188 | + handleCurrentChange(val) { | ||
| 189 | + this.currentPage = val | ||
| 190 | + this._listAuditOrders(val, this.pageSize) | ||
| 191 | + }, | ||
| 192 | + goBack() { | ||
| 193 | + this.$router.go(-1) | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | +} | ||
| 197 | +</script> | ||
| 198 | + | ||
| 199 | +<style lang="scss" scoped> | ||
| 200 | +.ecommerce { | ||
| 201 | + padding: 20px; | ||
| 202 | +} | ||
| 203 | + | ||
| 204 | +.ibox-tools { | ||
| 205 | + display: inline-block; | ||
| 206 | + float: right; | ||
| 207 | + margin-top: 0; | ||
| 208 | + position: relative; | ||
| 209 | + padding: 0; | ||
| 210 | +} | ||
| 211 | + | ||
| 212 | +.clearfix:before, | ||
| 213 | +.clearfix:after { | ||
| 214 | + display: table; | ||
| 215 | + content: ""; | ||
| 216 | +} | ||
| 217 | + | ||
| 218 | +.clearfix:after { | ||
| 219 | + clear: both; | ||
| 220 | +} | ||
| 221 | +</style> | ||
| 0 | \ No newline at end of file | 222 | \ No newline at end of file |
src/views/resource/resourceEnterManageLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + resourceEnterManage: { | ||
| 4 | + orderId: 'Order ID', | ||
| 5 | + itemType: 'Item Type', | ||
| 6 | + itemName: 'Item Name', | ||
| 7 | + itemSpec: 'Item Specification', | ||
| 8 | + itemCode: 'Item Code', | ||
| 9 | + itemStock: 'Item Stock', | ||
| 10 | + referencePrice: 'Reference Price', | ||
| 11 | + applyQuantity: 'Apply Quantity', | ||
| 12 | + purchaseQuantity: 'Purchase Quantity', | ||
| 13 | + purchaseQuantityPlaceholder: 'Required, please enter purchase quantity', | ||
| 14 | + purchasePrice: 'Purchase Price', | ||
| 15 | + purchasePricePlaceholder: 'Required, please enter purchase price', | ||
| 16 | + supplier: 'Supplier', | ||
| 17 | + selectSupplier: 'Please select', | ||
| 18 | + remark: 'Remark', | ||
| 19 | + remarkPlaceholder: 'Optional, please enter remark', | ||
| 20 | + submit: 'Submit', | ||
| 21 | + selectItemError: 'Please select items to enter', | ||
| 22 | + purchaseQuantityError: 'Purchase quantity is required and must be positive', | ||
| 23 | + purchasePriceError: 'Purchase price is required and must be positive', | ||
| 24 | + submitSuccess: 'Operation successful', | ||
| 25 | + submitError: 'Operation failed' | ||
| 26 | + } | ||
| 27 | + }, | ||
| 28 | + zh: { | ||
| 29 | + resourceEnterManage: { | ||
| 30 | + orderId: '单号', | ||
| 31 | + itemType: '物品类型', | ||
| 32 | + itemName: '物品名称', | ||
| 33 | + itemSpec: '物品规格', | ||
| 34 | + itemCode: '物品编码', | ||
| 35 | + itemStock: '物品库存', | ||
| 36 | + referencePrice: '参考单价', | ||
| 37 | + applyQuantity: '申请数量', | ||
| 38 | + purchaseQuantity: '采购数量', | ||
| 39 | + purchaseQuantityPlaceholder: '必填,请填写采购数量', | ||
| 40 | + purchasePrice: '采购单价', | ||
| 41 | + purchasePricePlaceholder: '必填,请填写采购单价', | ||
| 42 | + supplier: '供应商', | ||
| 43 | + selectSupplier: '请选择', | ||
| 44 | + remark: '备注', | ||
| 45 | + remarkPlaceholder: '可填,请填写备注', | ||
| 46 | + submit: '提交', | ||
| 47 | + selectItemError: '请选择入库物品', | ||
| 48 | + purchaseQuantityError: '采购数量未填写或填写不正确', | ||
| 49 | + purchasePriceError: '单价未填写或填写不正确', | ||
| 50 | + submitSuccess: '操作成功', | ||
| 51 | + submitError: '操作失败' | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | +} | ||
| 0 | \ No newline at end of file | 55 | \ No newline at end of file |
src/views/resource/resourceEnterManageList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="resource-enter-manage-container"> | ||
| 3 | + <el-card class="box-card"> | ||
| 4 | + <div slot="header" class="clearfix"> | ||
| 5 | + <span>{{ $t('resourceEnterManage.orderId') }}:{{resourceEnterManageInfo.applyOrderId}}</span> | ||
| 6 | + </div> | ||
| 7 | + | ||
| 8 | + <el-row :gutter="20"> | ||
| 9 | + <el-col :span="24"> | ||
| 10 | + <el-table | ||
| 11 | + :data="resourceEnterManageInfo.purchaseApplyDetailVo" | ||
| 12 | + border | ||
| 13 | + style="width: 100%" | ||
| 14 | + class="table-wrapper" | ||
| 15 | + > | ||
| 16 | + <el-table-column type="selection" width="55" align="center" @selection-change="handleSelectionChange" /> | ||
| 17 | + <el-table-column prop="rstName" :label="$t('resourceEnterManage.itemType')" align="center"> | ||
| 18 | + <template slot-scope="scope"> | ||
| 19 | + {{scope.row.rstName || '-'}} | ||
| 20 | + </template> | ||
| 21 | + </el-table-column> | ||
| 22 | + <el-table-column prop="resName" :label="$t('resourceEnterManage.itemName')" align="center" /> | ||
| 23 | + <el-table-column prop="specName" :label="$t('resourceEnterManage.itemSpec')" align="center"> | ||
| 24 | + <template slot-scope="scope"> | ||
| 25 | + {{scope.row.specName || '-'}} | ||
| 26 | + </template> | ||
| 27 | + </el-table-column> | ||
| 28 | + <el-table-column prop="resCode" :label="$t('resourceEnterManage.itemCode')" align="center" /> | ||
| 29 | + <el-table-column prop="stock" :label="$t('resourceEnterManage.itemStock')" align="center" /> | ||
| 30 | + <el-table-column prop="standardPrice" :label="$t('resourceEnterManage.referencePrice')" align="center"> | ||
| 31 | + <template slot-scope="scope"> | ||
| 32 | + ¥{{scope.row.standardPrice}} | ||
| 33 | + </template> | ||
| 34 | + </el-table-column> | ||
| 35 | + <el-table-column prop="quantity" :label="$t('resourceEnterManage.applyQuantity')" align="center" /> | ||
| 36 | + <el-table-column :label="$t('resourceEnterManage.purchaseQuantity')" align="center"> | ||
| 37 | + <template slot-scope="scope"> | ||
| 38 | + <el-input | ||
| 39 | + v-model.number="scope.row.purchaseQuantity" | ||
| 40 | + type="number" | ||
| 41 | + :placeholder="$t('resourceEnterManage.purchaseQuantityPlaceholder')" | ||
| 42 | + /> | ||
| 43 | + </template> | ||
| 44 | + </el-table-column> | ||
| 45 | + <el-table-column :label="$t('resourceEnterManage.purchasePrice')" align="center"> | ||
| 46 | + <template slot-scope="scope"> | ||
| 47 | + <el-input | ||
| 48 | + v-model.number="scope.row.price" | ||
| 49 | + type="number" | ||
| 50 | + :placeholder="$t('resourceEnterManage.purchasePricePlaceholder')" | ||
| 51 | + /> | ||
| 52 | + </template> | ||
| 53 | + </el-table-column> | ||
| 54 | + <el-table-column :label="$t('resourceEnterManage.supplier')" align="center"> | ||
| 55 | + <template slot-scope="scope"> | ||
| 56 | + <el-select | ||
| 57 | + v-model="scope.row.rsId" | ||
| 58 | + :placeholder="$t('resourceEnterManage.selectSupplier')" | ||
| 59 | + style="width:100%" | ||
| 60 | + > | ||
| 61 | + <el-option | ||
| 62 | + v-for="supplier in resourceEnterManageInfo.resourceSuppliers" | ||
| 63 | + :key="supplier.rsId" | ||
| 64 | + :label="supplier.supplierName" | ||
| 65 | + :value="supplier.rsId" | ||
| 66 | + /> | ||
| 67 | + </el-select> | ||
| 68 | + </template> | ||
| 69 | + </el-table-column> | ||
| 70 | + <el-table-column :label="$t('resourceEnterManage.remark')" align="center"> | ||
| 71 | + <template slot-scope="scope"> | ||
| 72 | + <el-input | ||
| 73 | + v-model="scope.row.purchaseRemark" | ||
| 74 | + type="text" | ||
| 75 | + :placeholder="$t('resourceEnterManage.remarkPlaceholder')" | ||
| 76 | + /> | ||
| 77 | + </template> | ||
| 78 | + </el-table-column> | ||
| 79 | + </el-table> | ||
| 80 | + </el-col> | ||
| 81 | + </el-row> | ||
| 82 | + | ||
| 83 | + <el-row :gutter="20" class="footer-wrapper"> | ||
| 84 | + <el-col :span="22" :offset="2"> | ||
| 85 | + <el-button type="primary" @click="handleSubmit">{{ $t('resourceEnterManage.submit') }}</el-button> | ||
| 86 | + </el-col> | ||
| 87 | + </el-row> | ||
| 88 | + </el-card> | ||
| 89 | + </div> | ||
| 90 | +</template> | ||
| 91 | + | ||
| 92 | +<script> | ||
| 93 | +import { listPurchaseApplys, listResourceSuppliers, resourceEnter } from '@/api/resource/resourceEnterManageApi' | ||
| 94 | + | ||
| 95 | +export default { | ||
| 96 | + name: 'ResourceEnterManageList', | ||
| 97 | + data() { | ||
| 98 | + return { | ||
| 99 | + resourceEnterManageInfo: { | ||
| 100 | + purchaseApplyDetailVo: [], | ||
| 101 | + resourceSuppliers: [], | ||
| 102 | + selectResIds: [], | ||
| 103 | + applyOrderId: '', | ||
| 104 | + taskId: '', | ||
| 105 | + resOrderType: '' | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + }, | ||
| 109 | + created() { | ||
| 110 | + this.resourceEnterManageInfo.applyOrderId = this.$route.query.applyOrderId | ||
| 111 | + this.resourceEnterManageInfo.resOrderType = this.$route.query.resOrderType | ||
| 112 | + this.resourceEnterManageInfo.taskId = this.$route.query.taskId | ||
| 113 | + this.loadData() | ||
| 114 | + }, | ||
| 115 | + methods: { | ||
| 116 | + async loadData() { | ||
| 117 | + await this.listPurchaseApply() | ||
| 118 | + await this.loadResourceSuppliers() | ||
| 119 | + }, | ||
| 120 | + async listPurchaseApply() { | ||
| 121 | + try { | ||
| 122 | + const params = { | ||
| 123 | + page: 1, | ||
| 124 | + row: 10, | ||
| 125 | + applyOrderId: this.resourceEnterManageInfo.applyOrderId, | ||
| 126 | + resOrderType: this.resourceEnterManageInfo.resOrderType | ||
| 127 | + } | ||
| 128 | + const { data } = await listPurchaseApplys(params) | ||
| 129 | + const purchaseApply = data.purchaseApplys[0] | ||
| 130 | + Object.assign(this.resourceEnterManageInfo, purchaseApply) | ||
| 131 | + this.resourceEnterManageInfo.purchaseApplyDetailVo.forEach(item => { | ||
| 132 | + item.purchaseQuantity = '' | ||
| 133 | + item.price = '' | ||
| 134 | + item.purchaseRemark = '' | ||
| 135 | + item.rsId = '' | ||
| 136 | + }) | ||
| 137 | + } catch (error) { | ||
| 138 | + console.error('Failed to load purchase apply:', error) | ||
| 139 | + } | ||
| 140 | + }, | ||
| 141 | + async loadResourceSuppliers() { | ||
| 142 | + try { | ||
| 143 | + const params = { page: 1, row: 50 } | ||
| 144 | + const { data } = await listResourceSuppliers(params) | ||
| 145 | + this.resourceEnterManageInfo.resourceSuppliers = data | ||
| 146 | + } catch (error) { | ||
| 147 | + console.error('Failed to load resource suppliers:', error) | ||
| 148 | + } | ||
| 149 | + }, | ||
| 150 | + handleSelectionChange(selection) { | ||
| 151 | + this.resourceEnterManageInfo.selectResIds = selection.map(item => item.resId) | ||
| 152 | + }, | ||
| 153 | + async handleSubmit() { | ||
| 154 | + // Validation | ||
| 155 | + let msg = '' | ||
| 156 | + const selectedItems = this.resourceEnterManageInfo.purchaseApplyDetailVo.filter(item => | ||
| 157 | + this.resourceEnterManageInfo.selectResIds.includes(item.resId) | ||
| 158 | + ) | ||
| 159 | + | ||
| 160 | + if (selectedItems.length < 1) { | ||
| 161 | + this.$message.error(this.$t('resourceEnterManage.selectItemError')) | ||
| 162 | + return | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + for (const item of selectedItems) { | ||
| 166 | + if (!item.purchaseQuantity || parseInt(item.purchaseQuantity) < 0) { | ||
| 167 | + msg = this.$t('resourceEnterManage.purchaseQuantityError') | ||
| 168 | + break | ||
| 169 | + } | ||
| 170 | + item.purchaseQuantity = parseInt(item.purchaseQuantity) | ||
| 171 | + | ||
| 172 | + if (!item.price || parseFloat(item.price) <= 0) { | ||
| 173 | + msg = this.$t('resourceEnterManage.purchasePriceError') | ||
| 174 | + break | ||
| 175 | + } | ||
| 176 | + item.price = parseFloat(item.price) | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + if (msg) { | ||
| 180 | + this.$message.error(msg) | ||
| 181 | + return | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + try { | ||
| 185 | + const response = await resourceEnter(this.resourceEnterManageInfo) | ||
| 186 | + if (response.code === 0) { | ||
| 187 | + this.$message.success(this.$t('resourceEnterManage.submitSuccess')) | ||
| 188 | + this.$router.go(-1) | ||
| 189 | + } else { | ||
| 190 | + this.$message.error(response.msg) | ||
| 191 | + } | ||
| 192 | + } catch (error) { | ||
| 193 | + console.error('Submit failed:', error) | ||
| 194 | + this.$message.error(this.$t('resourceEnterManage.submitError')) | ||
| 195 | + } | ||
| 196 | + } | ||
| 197 | + } | ||
| 198 | +} | ||
| 199 | +</script> | ||
| 200 | + | ||
| 201 | +<style lang="scss" scoped> | ||
| 202 | +.resource-enter-manage-container { | ||
| 203 | + padding: 20px; | ||
| 204 | + | ||
| 205 | + .box-card { | ||
| 206 | + margin-bottom: 20px; | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + .table-wrapper { | ||
| 210 | + margin-top: 20px; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + .footer-wrapper { | ||
| 214 | + margin-top: 20px; | ||
| 215 | + text-align: right; | ||
| 216 | + } | ||
| 217 | +} | ||
| 218 | +</style> | ||
| 0 | \ No newline at end of file | 219 | \ No newline at end of file |