出库单-整单分配,取消分配

main
bbl\baobl 2024-03-25 13:48:40 +08:00
parent 9c86b08e0c
commit ff99e3ed28
2 changed files with 84 additions and 3 deletions

View File

@ -23,5 +23,19 @@ export function edit(data) {
data data
}) })
} }
export function allocate(ids) {
return request({
url: 'api/pick/allocate',
method: 'post',
data: ids
})
}
export default { add, edit, del } export function cancelAllocate(ids) {
return request({
url: 'api/pick/cancelAllocate',
method: 'post',
data: ids
})
}
export default { add, edit, del, allocate ,cancelAllocate }

View File

@ -19,7 +19,31 @@
<rrOperation :crud="crud"/> <rrOperation :crud="crud"/>
</div> </div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'--> <!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" :tableKey="tableKey"/> <crudOperation :permission="permission" :tableKey="tableKey">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-edit"
size="mini"
:disabled="crud.selections.length !== 1 || this.crud.selections[0].orderQty<=this.crud.selections[0].allocatedQty"
@click="allocate(crud.selections)"
>
分配
</el-button>
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-edit"
size="mini"
:loading="crud.delAllLoading"
:disabled="crud.selections.length !== 1 || this.crud.selections[0].status!=='ALLOCATE' || this.crud.selections[0].status!=='PICKUP'"
@click="cancelAllocate(crud.selections)"
>
取消分配
</el-button>
</crudOperation>
<!--表单组件--> <!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
@ -97,12 +121,13 @@
</template> </template>
<script> <script>
import crudPick from '@/api/pick' import crudPick, { allocate,cancelAllocate } from '@/api/pick'
import CRUD, { presenter, header, form, crud } from '@crud/crud' import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation' import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation' import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation' import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
import crudPickDetail from "@/api/pickDetail";
const defaultForm = { id: null, deptId: null, billType: null, orderOrigin: null, priority: null, owner: null, relatedBill1: null, relatedBill2: null, sourceName: null, status: null, address: null, dispatchDate: null, erTime: null, createBy: null, updateBy: null, createTime: null, updateTime: null, orderDate: null } const defaultForm = { id: null, deptId: null, billType: null, orderOrigin: null, priority: null, owner: null, relatedBill1: null, relatedBill2: null, sourceName: null, status: null, address: null, dispatchDate: null, erTime: null, createBy: null, updateBy: null, createTime: null, updateTime: null, orderDate: null }
export default { export default {
@ -131,6 +156,48 @@ export default {
// false // false
[CRUD.HOOK.beforeRefresh]() { [CRUD.HOOK.beforeRefresh]() {
return true return true
},
allocate(datas) {
this.$confirm(`选中的${datas.length}条数据分配确认?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const ids = []
for (let i = 0; i < datas.length; i++) {
ids.push(datas[i].id)
}
crudPick.allocate(ids).then(res => {
this.crud.notify(res.message, res.status)
this.crud.toQuery()
}).catch(() => {
this.crud.toQuery()
})
}).catch(() => {
this.$refs.table.clearSelection()
this.crud.notify('取消成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
},
cancelAllocate(datas) {
this.$confirm(`选中的${datas.length}条数据取消分配确认?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const ids = []
for (let i = 0; i < datas.length; i++) {
ids.push(datas[i].id)
}
crudPick.cancelAllocate(ids).then(res => {
this.crud.notify(res.message, res.status)
this.crud.toQuery()
}).catch(() => {
})
}).catch(() => {
this.$refs.table.clearSelection()
this.crud.notify('取消成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
} }
} }
} }