仓库处理申请、员工确认领料
This commit is contained in:
parent
a839658d75
commit
2d70581fff
@ -36,3 +36,21 @@ export function auditTicketWares(data){
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 仓库通知领料
|
||||
export function pass(data){
|
||||
return request({
|
||||
url: preUrl + '/pass',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 员工确认领料
|
||||
export function repairPassTicketWares(data){
|
||||
return request({
|
||||
url: preUrl + "/repairPass",
|
||||
method: "post",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ export default {
|
||||
/** 保存数据 */
|
||||
save(row) {
|
||||
if (!this.soByType && row.stock < row.count){
|
||||
row.count = 1
|
||||
row.count = 0
|
||||
this.$modal.msgError("库存数量不足")
|
||||
}
|
||||
// 更新表格的数据
|
||||
|
218
src/views/repair/stockOperate/Components/WaresItem.vue
Normal file
218
src/views/repair/stockOperate/Components/WaresItem.vue
Normal file
@ -0,0 +1,218 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
|
||||
<el-form-item label="关键字" prop="query">
|
||||
<el-input style="width: 20rem" type="text" placeholder="工单号、车牌号、联系电话" v-model="queryParams.query"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 操作 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<right-toolbar :showSearch.sync="showSearch"></right-toolbar>
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="序号" align="center" width="80">
|
||||
<template scope="scope">
|
||||
<span>{{ scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单据号" align="center" prop="no" />
|
||||
<el-table-column label="服务顾问" align="center" prop="adviserName" />
|
||||
<el-table-column label="申请人" align="center" prop="repairName" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :type="DICT_TYPE.TICKET_WARES_STATUS" v-model="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="handleDispose(scope.row)" icon="el-icon-edit">
|
||||
处理
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<el-dialog title="单据处理" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
|
||||
<el-table el-table v-loading="dialogLoading" :data="items" :stripe="true" :show-overflow-tooltip="true" :row-class-name="getClass" @selection-change="handleSelect">
|
||||
<el-table-column type="selection" width="80" align="center" />
|
||||
<el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="规格" align="center" prop="wares.model" width="180"/>
|
||||
<el-table-column label="申请数量" align="center" prop="waresCount" width="180"/>
|
||||
<el-table-column label="库存数量" align="center" prop="wares.stock" width="180"/>
|
||||
</el-table>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handlePass(false)" :disabled="selections.length === 0 || selections.filter(item => !item.isStock).length !== 0">通过选择</el-button>
|
||||
<el-button type="success" @click="handlePass(true)"
|
||||
:disabled="this.items.filter(item => !item.isStock).length !== 0"
|
||||
:title="this.items.filter(item => !item.isStock).length !== 0 ? '有配件库存不足':''">通过全部</el-button>
|
||||
<el-button type="primary" @click="handleCreate(false)" :disabled="selections.length === 0">选择生成采购单</el-button>
|
||||
<el-button type="primary" @click="handleCreate(true)">全部生成采购单</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getPage, pass} from "@/api/repair/tickets/TicketWares";
|
||||
import {listTwItem} from "@/api/repair/tickets/TWItem";
|
||||
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
|
||||
import {parseTime} from "@/utils/ruoyi";
|
||||
|
||||
export default {
|
||||
name: "WaresItem",
|
||||
props:{
|
||||
type: Boolean,
|
||||
},
|
||||
data(){
|
||||
return{
|
||||
queryParams:{
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
query: null,
|
||||
type: this.type ? "01" : "02"
|
||||
},
|
||||
showSearch: true,
|
||||
loading: false,
|
||||
list:[],
|
||||
total: 0,
|
||||
dialogVisible: false,
|
||||
items:[],
|
||||
dialogLoading: false,
|
||||
selections:[],
|
||||
formData:{}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods:{
|
||||
// 通过 true是全部、false是选择
|
||||
async handlePass(flag){
|
||||
// 生成领料单
|
||||
this.formData.repairSo = {
|
||||
soType: "02",
|
||||
soNo: createUniqueCodeByHead("LL"),
|
||||
userId: this.formData.repairId,
|
||||
userName: this.formData.repairName,
|
||||
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
|
||||
soStatus: "04",
|
||||
purchaseType: "01"
|
||||
}
|
||||
if (flag){
|
||||
this.formData.repairSois = [...this.items.map(item => {
|
||||
return {
|
||||
soiType: '02',
|
||||
goodsId: item.waresId,
|
||||
goodsCount: item.waresCount,
|
||||
}
|
||||
})]
|
||||
this.formData.items = [...this.items.map(item => {
|
||||
return {
|
||||
id: item.id,
|
||||
waresStatus: "04"
|
||||
}
|
||||
})]
|
||||
}else {
|
||||
this.formData.repairSois = [...this.selections.map(item => {
|
||||
return {
|
||||
soiType: '02',
|
||||
goodsId: item.waresId,
|
||||
goodsCount: item.waresCount,
|
||||
}
|
||||
})]
|
||||
this.formData.items = [...this.selections.map(item => {
|
||||
return {
|
||||
id: item.id,
|
||||
waresStatus: "04"
|
||||
}
|
||||
})]
|
||||
}
|
||||
try {
|
||||
await pass(this.formData)
|
||||
this.$modal.msgSuccess("处理成功")
|
||||
await this.getList()
|
||||
}finally {
|
||||
this.dialogVisible = false
|
||||
}
|
||||
},
|
||||
// todo 生成采购 true是全部、false是选择
|
||||
async handleCreate(flag){
|
||||
if (flag){
|
||||
|
||||
}else {
|
||||
|
||||
}
|
||||
},
|
||||
async getList(){
|
||||
try {
|
||||
this.loading = true
|
||||
const res = await getPage(this.queryParams)
|
||||
if (res.data){
|
||||
this.list = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
}finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
handleQuery(){
|
||||
this.queryParams.pageNo = 1
|
||||
this.getList()
|
||||
},
|
||||
resetQuery(){
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
async handleDispose(row){
|
||||
this.formData = {}
|
||||
this.formData = {
|
||||
...row
|
||||
}
|
||||
this.dialogVisible = true
|
||||
try {
|
||||
this.dialogLoading = true
|
||||
const res = await listTwItem({twId: row.twId})
|
||||
this.items = res.data
|
||||
// 库存判断
|
||||
this.items.forEach(item => {
|
||||
item.isStock = item.waresCount <= item.wares.stock
|
||||
})
|
||||
// 只要未领料的
|
||||
if (this.type){
|
||||
this.items = this.items.filter(item => item.waresStatus === '02')
|
||||
}else {
|
||||
// 未领料的不要
|
||||
this.items = this.items.filter(item => item.waresStatus !== '02')
|
||||
}
|
||||
}finally {
|
||||
this.dialogLoading = false
|
||||
}
|
||||
},
|
||||
getClass(row){
|
||||
if (this.type && !row.row.isStock){
|
||||
return 'stock'
|
||||
}
|
||||
return ''
|
||||
},
|
||||
handleSelect(row){
|
||||
this.selections = row
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
::v-deep .el-table .stock td{
|
||||
background-color: #ff0000 !important; /* 红色背景 */
|
||||
}
|
||||
</style>
|
33
src/views/repair/stockOperate/WaresAudit.vue
Normal file
33
src/views/repair/stockOperate/WaresAudit.vue
Normal file
@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-tabs v-model="activeTab">
|
||||
<el-tab-pane label="领料申请" name="get">
|
||||
<WaresItem :type="true"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="退料申请" name="back">
|
||||
<WaresItem :type="false"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import WaresItem from "@/views/repair/stockOperate/Components/WaresItem.vue";
|
||||
|
||||
export default {
|
||||
name: "WaresAudit",
|
||||
components: {WaresItem},
|
||||
data(){
|
||||
return{
|
||||
activeTab: "get"
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
@ -42,8 +42,8 @@
|
||||
<el-button v-if="userRole === 1 || userRole === 2 && scope.row.status === '01'" @click="handleAudit(scope.row)" type="text" size="mini" icon="el-icon-s-check">
|
||||
审核
|
||||
</el-button>
|
||||
<el-button v-if="userRole === 3 || userRole === 4 && scope.row.status !== '01'" type="text" size="mini" icon="el-icon-finished">
|
||||
完成
|
||||
<el-button @click="handleGet(scope.row)" v-if="userRole === 3 || userRole === 4 && scope.row.status !== '01'" type="text" size="mini" icon="el-icon-finished">
|
||||
领料
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -53,12 +53,26 @@
|
||||
@pagination="getList"
|
||||
/>
|
||||
<TicketWaresShow ref="ticketWaresShow" :user-role="userRole" @success="getList"/>
|
||||
|
||||
<el-dialog title="领料确认" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
|
||||
<el-table el-table v-loading="dialogLoading" :data="items" :stripe="true" :show-overflow-tooltip="true" @selection-change="handleSelect">
|
||||
<el-table-column type="selection" width="80" align="center" />
|
||||
<el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="规格" align="center" prop="wares.model" width="180"/>
|
||||
<el-table-column label="数量" align="center" prop="waresCount" width="180"/>
|
||||
</el-table>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handleDoGet(false)" :disabled="selections.length === 0">领料选择</el-button>
|
||||
<el-button type="primary" @click="handleDoGet(true)">领料全部</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getPage} from "@/api/repair/tickets/TicketWares";
|
||||
import {getPage, repairPassTicketWares} from "@/api/repair/tickets/TicketWares";
|
||||
import TicketWaresShow from "@/views/repair/tickets/Components/TicketWaresShow.vue";
|
||||
import {listTwItem} from "@/api/repair/tickets/TWItem";
|
||||
|
||||
export default {
|
||||
name: "TicketWares",
|
||||
@ -79,7 +93,12 @@ export default {
|
||||
showSearch: true,
|
||||
loading: false,
|
||||
list: [],
|
||||
total: 0
|
||||
total: 0,
|
||||
dialogVisible: false,
|
||||
dialogLoading: false,
|
||||
items: [],
|
||||
selections: [],
|
||||
formData:{},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -111,6 +130,52 @@ export default {
|
||||
},
|
||||
handleAudit(row){
|
||||
this.handleShow(row)
|
||||
},
|
||||
async handleGet(row){
|
||||
this.formData = {
|
||||
id: row.id,
|
||||
}
|
||||
this.dialogVisible = true
|
||||
try {
|
||||
this.dialogLoading = true
|
||||
const res = await listTwItem({twId: row.twId})
|
||||
this.items = res.data
|
||||
// 只要可领料的
|
||||
if (this.type){
|
||||
this.items = this.items.filter(item => item.waresStatus === '04')
|
||||
}else {
|
||||
// 只要已领料
|
||||
this.items = this.items.filter(item => item.waresStatus === '01')
|
||||
}
|
||||
}finally {
|
||||
this.dialogLoading = false
|
||||
}
|
||||
},
|
||||
handleSelect(val){
|
||||
this.selections = val
|
||||
},
|
||||
async handleDoGet(flag){
|
||||
if (flag){
|
||||
this.formData.items = [...this.items.map(item => {
|
||||
return {
|
||||
id: item.id,
|
||||
waresStatus: "01"
|
||||
}
|
||||
})]
|
||||
}else {
|
||||
this.formData.items = [...this.selections.map(item => {
|
||||
return {
|
||||
id: item.id,
|
||||
waresStatus: "01"
|
||||
}
|
||||
})]
|
||||
}
|
||||
try {
|
||||
await repairPassTicketWares(this.formData)
|
||||
this.dialogVisible = false
|
||||
this.$modal.msgSuccess("领料成功")
|
||||
await this.getList()
|
||||
}catch{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user