选择配件生成采购单展示的数据、展示修改为折叠框
This commit is contained in:
parent
c36226d14c
commit
8c1c1f6e60
@ -80,3 +80,11 @@ export function getById(id){
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据选择的配件生成采购单需要的数据
|
||||
export function getByIds(ids){
|
||||
return request({
|
||||
url: preUrl + "/getByIds?ids=" + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
@ -192,3 +192,11 @@ export function overOrder(data){
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据工单ID查客户和车辆信息
|
||||
export function getCusAndCarById(id){
|
||||
return request({
|
||||
url: preUrl + "/getCusAndCarById?id=" + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
@ -71,6 +71,7 @@
|
||||
:row-class-name="getRowClass"
|
||||
@selection-change="handleSelect"
|
||||
:key="tableKey"
|
||||
ref="tableRef"
|
||||
>
|
||||
<el-table-column type="selection" width="80" align="center"/>
|
||||
<el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
|
||||
@ -108,8 +109,30 @@
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="采购单" :visible.sync="inStockDialog" width="80%" v-dialogDrag append-to-body>
|
||||
<el-descriptions class="margin-top" title="车辆信息" :column="3" border>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
车牌号
|
||||
</template>
|
||||
{{carInfo.licenseNumber}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
品牌
|
||||
</template>
|
||||
{{carInfo.carBrand}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
型号
|
||||
</template>
|
||||
{{carInfo.carModel}}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-collapse>
|
||||
<el-collapse-item v-for="[key, value] in partList" :title="key">
|
||||
<el-table
|
||||
:data="partList"
|
||||
:data="value"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
show-summary
|
||||
@ -123,53 +146,53 @@
|
||||
<span>{{ scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" align="center" prop="name" width="200"/>
|
||||
<el-table-column label="规格" align="center" width="180" prop="model">
|
||||
<el-table-column label="商品名称" align="center" prop="waresName" width="200"/>
|
||||
<el-table-column label="规格" align="center" width="180" prop="wares.model">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.model"
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.wares.model"
|
||||
placeholder="请输入规格"></el-input>
|
||||
<span class="item__txt">{{ scope.row.model }}</span>
|
||||
<span class="item__txt">{{ scope.row.wares.model }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品编码" align="center" width="180" prop="code">
|
||||
<el-table-column label="商品编码" align="center" width="180" prop="wares.code">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.code"
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.wares.code"
|
||||
placeholder="请输入内容"></el-input>
|
||||
<span class="item__txt">{{ scope.row.code }}</span>
|
||||
<span class="item__txt">{{ scope.row.wares.code }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库" align="center" width="150" prop="warehouse">
|
||||
<el-table-column label="仓库" align="center" width="150" prop="wares.warehouse">
|
||||
<div class="item" slot-scope="scope">
|
||||
<WarehouseChoose @input-blur="save(scope.row)" class="item__input" v-model="scope.row.ware"
|
||||
<WarehouseChoose @input-blur="save(scope.row)" class="item__input" v-model="scope.row.wares.ware"
|
||||
@change="changeWare(scope.row)"/>
|
||||
<span class="item__txt">{{ scope.row.warehouseName }}</span>
|
||||
<span class="item__txt">{{ scope.row.wares.warehouseName }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存" align="center" width="150" prop="stock"/>
|
||||
<el-table-column label="单位" align="center" width="150" prop="unit">
|
||||
<el-table-column label="库存" align="center" width="150" prop="wares.stock"/>
|
||||
<el-table-column label="单位" align="center" width="150" prop="wares.unit">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-select class="item__input" v-model="scope.row.unit" @blur="save(scope.row)">
|
||||
<el-select class="item__input" v-model="scope.row.wares.unit" @blur="save(scope.row)">
|
||||
<el-option v-for="dict in getDictDatasToType(DICT_TYPE.REPAIR_UNIT)" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value"/>
|
||||
</el-select>
|
||||
<span class="item__txt">
|
||||
<dict-tag :type="DICT_TYPE.REPAIR_UNIT" v-model="scope.row.unit"/>
|
||||
<dict-tag :type="DICT_TYPE.REPAIR_UNIT" v-model="scope.row.wares.unit"/>
|
||||
</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" align="center" width="150" prop="count">
|
||||
<el-table-column label="数量" align="center" width="150" prop="waresCount">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.count"
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.waresCount"
|
||||
placeholder="请输入内容"></el-input>
|
||||
<span class="item__txt">{{ scope.row.count }}</span>
|
||||
<span class="item__txt">{{ scope.row.waresCount }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column label="上次进价" align="center" width="150" prop="purPrice"/>
|
||||
<el-table-column label="采购单价" align="center" width="150" prop="newPrice">
|
||||
<el-table-column label="上次进价" align="center" width="150" prop="wares.purPrice"/>
|
||||
<el-table-column label="采购单价" align="center" width="150" prop="wares.newPrice">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.newPrice"
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.wares.newPrice"
|
||||
placeholder="请输入内容"></el-input>
|
||||
<span class="item__txt">{{ scope.row.newPrice }}</span>
|
||||
<span class="item__txt">{{ scope.row.wares.newPrice }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column label="采购金额" align="center" width="150" prop="totalPrice"/>
|
||||
@ -188,14 +211,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-row :gutter="1" style="margin-top: 1rem">
|
||||
<el-col :span="24">
|
||||
<el-input v-model="remark" placeholder="备注"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</el-dialog>
|
||||
|
||||
<TicketWaresShow ref="ticketWaresShow" :user-role="'repair_warehouse'" @success="getList" :type="false"/>
|
||||
@ -203,7 +220,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getPage, pass, passBackTicketWares} from "@/api/repair/tickets/TicketWares";
|
||||
import {getPage, pass, passBackTicketWares, getByIds} from "@/api/repair/tickets/TicketWares";
|
||||
import {listTwItem} from "@/api/repair/tickets/TWItem";
|
||||
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
|
||||
import {parseTime} from "@/utils/ruoyi";
|
||||
@ -212,6 +229,8 @@ import WarehouseChoose from "@/views/repair/Components/WarehouseChoose.vue";
|
||||
import {createRepairSo} from "@/api/repair/stockOperate/stockOperate";
|
||||
import {getUserProfile} from "@/api/system/user";
|
||||
import TicketWaresShow from "@/views/repair/tickets/Components/TicketWaresShow.vue";
|
||||
import {getCusAndCarById} from "@/api/repair/tickets/Tickets";
|
||||
import {getCarBrand} from "@/api/base/carbrand";
|
||||
|
||||
export default {
|
||||
name: "WaresItem",
|
||||
@ -235,6 +254,7 @@ export default {
|
||||
items: [],
|
||||
dialogLoading: false,
|
||||
selections: [],
|
||||
selectionIds: [],
|
||||
formData: {},
|
||||
inStockDialog: false,
|
||||
partList: [],
|
||||
@ -242,11 +262,13 @@ export default {
|
||||
// 保存进入编辑的cell
|
||||
clickCellMap: {},
|
||||
// 需要编辑的属性
|
||||
editProp: ['warehouse', 'count', 'newPrice', 'remark', 'code', 'waresCount', 'model', 'unit'],
|
||||
editProp: ['warehouse', 'count', 'newPrice', 'remark', 'code', 'waresCount', 'wares.model', 'unit'],
|
||||
remark: null,
|
||||
tableKey: 0,
|
||||
query: null,
|
||||
twId: null,
|
||||
carInfo: {},
|
||||
ticketId: null,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -258,7 +280,19 @@ export default {
|
||||
twId: this.twId,
|
||||
query: this.query
|
||||
}
|
||||
this.getTwitemList(data)
|
||||
this.getTwitemList(data).then(() => {
|
||||
this.setSelectedRows();
|
||||
})
|
||||
},
|
||||
setSelectedRows() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tableRef.clearSelection(); // 清除所有选择
|
||||
this.items.forEach(row => {
|
||||
if (this.selectionIds.includes(row.id)) {
|
||||
this.$refs.tableRef.toggleRowSelection(row, true); // 选中行
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
resetByQuery() {
|
||||
this.query = null
|
||||
@ -303,16 +337,19 @@ export default {
|
||||
},
|
||||
// 生成采购 true是全部、false是选择
|
||||
async handleCreate() {
|
||||
this.inStockDialog = true
|
||||
this.partList = [...this.selections.map(item => {
|
||||
return {
|
||||
...item.wares,
|
||||
count: item.waresCount,
|
||||
newPrice: item.wares.purPrice,
|
||||
totalPrice: item.waresCount * item.wares.purPrice
|
||||
try {
|
||||
const carRes = await getCusAndCarById(this.ticketId)
|
||||
this.carInfo = carRes.data.carInfo
|
||||
if (this.carInfo.carBrand){
|
||||
const brandRes = await getCarBrand(this.carInfo.carBrand)
|
||||
this.carInfo.carBrand = brandRes.data.brandName
|
||||
}
|
||||
})]
|
||||
const ids = this.selections.map(item => item.id)
|
||||
const res = await getByIds(ids)
|
||||
this.partList = Object.entries(res.data)
|
||||
this.inStockDialog = true
|
||||
this.dialogVisible = false
|
||||
}catch{}
|
||||
},
|
||||
async getList() {
|
||||
try {
|
||||
@ -342,16 +379,8 @@ export default {
|
||||
this.dialogVisible = true
|
||||
const data = {twId: row.id}
|
||||
this.twId = row.id
|
||||
this.ticketId = row.ticketId
|
||||
this.getTwitemList(data)
|
||||
// const res = await listTwItem(data)
|
||||
// this.items = res.data
|
||||
// this.items = this.items.filter(item => item.waresStatus === '1')
|
||||
// this.items.forEach(item => {
|
||||
// const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount
|
||||
// item.waresCount = this.type ? count : item.waresAlreadyCount
|
||||
// item.isStock = this.type ? count <= item.wares.stock : true
|
||||
// })
|
||||
// this.items = this.items.filter(item => this.type ? item.waresCount > 0 : item.waresAlreadyCount > 0)
|
||||
},
|
||||
async getTwitemList(data) {
|
||||
try {
|
||||
@ -375,6 +404,9 @@ export default {
|
||||
},
|
||||
handleSelect(row) {
|
||||
this.selections = row
|
||||
if (row && row.length > 0){
|
||||
this.selectionIds = row.map(item => item.id);
|
||||
}
|
||||
},
|
||||
// 设置不统计的字段
|
||||
getSummaries(param) {
|
||||
|
Loading…
Reference in New Issue
Block a user