Merge branch 'repair'

This commit is contained in:
Vinjor 2024-11-27 16:00:53 +08:00
commit 8d3f5c5cef
2 changed files with 70 additions and 21 deletions

View File

@ -504,7 +504,7 @@ export default {
const res = await getMapBySoIdAndQuery(this.soId, this.inItemsQuery)
this.inItems = Object.entries(res.data)
this.inItems = this.inItems.map(([key, value]) => {
return [key, value.filter(item => (!item.inCount && item.inCount !== item.goodsCount))]
return [key, value.filter(item => item.inCount < item.goodsCount)]
})
this.inItems = this.inItems.filter(([key, value]) => value.length > 0)
this.inItems.forEach(([key, value]) => {

View File

@ -94,11 +94,11 @@
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" v-if="type" @click="handlePass"
<el-button type="primary" v-if="type" @click="handlePassBefore"
:disabled="allSelectRows.length === 0 || allSelectRows.filter(item => !item.isStock).length !== 0">
通知领料
</el-button>
<el-button type="primary" v-else @click="handlePass"
<el-button type="primary" v-else @click="handlePassBefore"
:disabled="allSelectRows.length === 0 || allSelectRows.filter(item => !item.isStock).length !== 0">
通知退料
</el-button>
@ -156,7 +156,8 @@
</el-table-column>
<el-table-column label="分类" align="center" width="180" prop="wares.type">
<div class="item" slot-scope="scope">
<el-select class="item__input" clearable ref="selectTree" v-model="scope.row.wares.type" @change="save(scope.row)">
<el-select class="item__input" clearable ref="selectTree" v-model="scope.row.wares.type"
@change="save(scope.row)">
<el-option v-for="server in optionData(serverList)"
:key="server.value"
:label="server.label"
@ -167,7 +168,7 @@
highlight-current
@node-click="handleNodeClick($event, scope.row)"
:expand-on-click-node="expandOnClickNode"
default-expand-all />
default-expand-all/>
</el-select>
<span class="item__txt">{{ getTypeById(scope.row.wares.type) }}</span>
</div>
@ -244,6 +245,23 @@
</div>
</el-dialog>
<el-dialog :title="type ? '通知领料' : '通知退料'" :visible.sync="inPhoto" width="40%" v-dialogDrag append-to-body>
<el-form :inline="true" label-width="15rem">
<el-form-item :label="type ? '领料人' : '退料人'">
<el-select v-model="chooseStaff" multiple clearable filterable>
<el-option v-for="staff in staffs" :key="staff.id" :value="staff.userId" :label="staff.userName" />
</el-select>
</el-form-item>
<el-form-item label="图片上传">
<ImageUpload v-model="images"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handlePass">确定</el-button>
<el-button type="primary" @click="inPhoto = false">取消</el-button>
</div>
</el-dialog>
<TicketWaresShow ref="ticketWaresShow" :user-role="'repair_warehouse'" @success="getList" :type="false"/>
</div>
</template>
@ -262,6 +280,7 @@ import {getCusAndCarById} from "@/api/repair/tickets/Tickets";
import {getCarBrand} from "@/api/base/carbrand";
import {listGoods} from "@/views/partner/api/workOrder";
import {getBaseTypeList} from "@/api/base/type";
import {listByTicketId} from "@/api/repair/repairworker";
export default {
name: "WaresItem",
@ -302,26 +321,30 @@ export default {
ticketId: null,
expandOnClickNode: true,
serverList: [],
treeProps:{
treeProps: {
label: "name",
children: "children"
},
typeMap: null,
allSelectRows: [],
isRefresh: false
isRefresh: false,
inPhoto: false,
images: null,
chooseStaff: [],
staffs: [],
}
},
mounted() {
this.getList()
},
methods: {
getTypeById(id){
getTypeById(id) {
return this.typeMap.get(id)
},
async listServer(){
if (!this.serverList || this.serverList.length === 0){
async listServer() {
if (!this.serverList || this.serverList.length === 0) {
const res = await getBaseTypeList({type: "02"})
this.serverList = this.handleTree(res.data, 'id', 'parentId',"children","0")
this.serverList = this.handleTree(res.data, 'id', 'parentId', "children", "0")
this.typeMap = new Map()
this.extractNodesToMap(this.serverList, this.typeMap)
}
@ -334,14 +357,14 @@ export default {
}
});
},
handleNodeClick(data, scopeRow){
handleNodeClick(data, scopeRow) {
scopeRow.wares.type = data.id;
this.save(scopeRow)
},
optionData(array, result=[]){
optionData(array, result = []) {
array.forEach(item => {
result.push({label: item.name, value: item.id})
if (item.children && item.children.length !== 0){
if (item.children && item.children.length !== 0) {
this.optionData(item.children, result)
}
})
@ -376,8 +399,30 @@ export default {
getDictDatasToType(type) {
return this.getDictDatas(type)
},
handlePassBefore() {
this.chooseStaff = []
this.staffs = []
this.getTicketStaff()
this.images = null
this.inPhoto = true
},
async getTicketStaff(){
const res = await listByTicketId(this.ticketId)
this.staffs = res.data
this.chooseStaff.push(this.formData.repairId)
},
// truefalse
async handlePass() {
if (this.images) {
this.formData.images = this.images.split(",").map(item => {
return item.replace(process.env.VUE_APP_FILE_API, "")
}).join(",")
}
if ((!this.chooseStaff || this.chooseStaff.length === 0)){
this.$modal.msgError(`请选择${this.type ? '领' : '退'}料人!`)
return
}
// 退
this.formData.repairSo = {
soType: this.type ? "02" : "04",
@ -386,6 +431,7 @@ export default {
userName: this.formData.repairName,
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
soStatus: this.type ? "04" : "07",
userIds: this.chooseStaff.join(",")
// purchaseType: "01"
}
this.formData.repairSois = [...this.allSelectRows.map(item => {
@ -408,6 +454,7 @@ export default {
await this.getList()
} finally {
this.dialogVisible = false
this.inPhoto = false
}
},
// truefalse
@ -494,12 +541,12 @@ export default {
this.allSelectRows = [...this.allSelectRows, ...row]
//
//
if (!this.isRefresh){
if (!this.isRefresh) {
//
const ids = this.$refs.tableRef.data.map(item => item.id);
if (!row || row.length === 0){
if (!row || row.length === 0) {
this.allSelectRows = this.allSelectRows.filter(item => !ids.includes(item.id))
}else {
} else {
//
const rowIds = row.map(item => item.id)
const exIds = ids.filter(id => !rowIds.includes(id))
@ -510,9 +557,9 @@ export default {
//
this.allSelectRows = this.allSelectRows.reduce((acc, item) => {
const flag = acc.find(i => i.id === item.id)
if (!flag){
if (!flag) {
return acc.concat([item])
}else {
} else {
return acc
}
}, [])
@ -594,7 +641,7 @@ export default {
}
this.partList.forEach(([key, value]) => {
const flag = value.findIndex(f => f.id === row.id)
if (flag !== -1){
if (flag !== -1) {
row.totalPrice = row.waresCount * row.wares.price
this.$set(value, flag, row)
}
@ -667,11 +714,13 @@ export default {
}
})]
this.formData.waresList = [...values.map(item => {
if (item.wares.ware){
if (item.wares.ware) {
item.wares.warehouse = item.wares.ware.id
}
return item.wares
})]
this.formData.twId = this.twId
},
validateNull() {
const flag = this.partList.map(item => {