配件申请单子项可以搜索、可以设置给不给保险公司看

This commit is contained in:
xiaofajia 2024-11-18 16:15:26 +08:00
parent 12916957f6
commit c36226d14c
3 changed files with 147 additions and 21 deletions

View File

@ -63,3 +63,20 @@ export function passBackTicketWares(data){
data
})
}
// 修改是否传给保险公司
export function updateSafe(data){
return request({
url: preUrl + "/updateSafe",
method: "post",
data
})
}
// 查单个配件申请单的信息
export function getById(id){
return request({
url: preUrl + "/getById?id=" + id,
method: 'get'
})
}

View File

@ -29,7 +29,7 @@
<el-table-column label="申请人" align="center" prop="repairName" width="180"/>
<el-table-column label="岗位" align="center" prop="repairWork" width="180">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.REPAIR_WORK_TYPE" :value="scope.row.repairWork" />
<dict-tag :type="DICT_TYPE.REPAIR_WORK_TYPE" :value="scope.row.repairWork"/>
</template>
</el-table-column>
<el-table-column label="服务顾问" align="center" prop="adviserName" width="180"/>
@ -46,11 +46,21 @@
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination style="margin-bottom: 2rem" v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
<pagination style="margin-bottom: 2rem" 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-form :inline="true">
<el-form-item label="名称" prop="query">
<el-input v-model="query"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="searchByQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click=resetByQuery>重置</el-button>
</el-form-item>
</el-form>
<el-table
@cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave"
@ -64,7 +74,7 @@
>
<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="wares.model" width="180"/>-->
<el-table-column label="领料数量" v-if="type" align="center" prop="waresCount" width="180">
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.waresCount"
@ -139,7 +149,8 @@
<el-table-column label="单位" align="center" width="150" prop="unit">
<div class="item" slot-scope="scope">
<el-select class="item__input" v-model="scope.row.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-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"/>
@ -234,13 +245,26 @@ export default {
editProp: ['warehouse', 'count', 'newPrice', 'remark', 'code', 'waresCount', 'model', 'unit'],
remark: null,
tableKey: 0,
query: null,
twId: null,
}
},
mounted() {
this.getList()
},
methods: {
getDictDatasToType(type){
searchByQuery(){
const data = {
twId: this.twId,
query: this.query
}
this.getTwitemList(data)
},
resetByQuery() {
this.query = null
this.searchByQuery()
},
getDictDatasToType(type) {
return this.getDictDatas(type)
},
// truefalse
@ -310,15 +334,27 @@ export default {
this.resetForm('queryForm')
this.handleQuery()
},
async handleDispose(row) {
handleDispose(row) {
this.formData = {}
this.formData = {
...row
}
this.dialogVisible = true
try {
this.dialogLoading = true
const data = {twId: row.id}
this.twId = row.id
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 {
const res = await listTwItem(data)
this.items = res.data
this.items = this.items.filter(item => item.waresStatus === '1')
@ -328,8 +364,7 @@ export default {
item.isStock = this.type ? count <= item.wares.stock : true
})
this.items = this.items.filter(item => this.type ? item.waresCount > 0 : item.waresAlreadyCount > 0)
} finally {
this.dialogLoading = false
} catch {
}
},
getRowClass(row) {
@ -443,7 +478,7 @@ export default {
const isNull = this.validateNull();
if (!isNull) return;
const names = this.validateZero()
if (names){
if (names) {
await this.$modal.confirm("确认配件:" + names + "的采购价格为0吗")
}
await this.createInit()
@ -484,36 +519,36 @@ export default {
}
})]
},
validateNull(){
validateNull() {
const flag = this.partList.map(item => {
const price = item.newPrice
if (price === null || price === ""){
if (price === null || price === "") {
this.$modal.msgError("配件:" + item.name + "采购价格为空")
return false
}else {
} else {
return true
}
})
let count = 0
flag.forEach(item => {
if (!item){
if (!item) {
count++
}
})
return count === 0
},
validateZero(){
validateZero() {
const flag = this.partList.map(item => {
const price = parseFloat(item.newPrice)
if (price === 0){
if (price === 0) {
return item.name
}else {
} else {
return ""
}
})
return flag.filter(item => item !== "").join(",")
},
handleView(row){
handleView(row) {
this.$refs.ticketWaresShow.open(row)
}
}

View File

@ -95,6 +95,9 @@
<el-button size="small" type="primary" @click="handleAddWares">
添加配件
</el-button>
<el-button size="small" type="primary" @click="handleSetting">
设置可见
</el-button>
</div>
</div>
<!-- 卡片内容 -->
@ -166,12 +169,56 @@
</el-dialog>
<TWIAdd ref="twiAdd" @success="handleSuccess" />
<el-dialog title="设置" width="40%" :visible.sync="settingDialog" v-dialogDrag append-to-body>
<el-form v-model="settingForm" :inline="true" label-width="20rem">
<el-row :gutter="1">
<el-col :span="24">
<el-form-item label="是否传给保险公司" prop="toSafe">
<el-switch
v-model="settingForm.toSafe"
active-text="是"
active-value="1"
inactive-text="否"
inactive-value="0"
>
</el-switch>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="1">
<el-col :span="24">
<el-form-item label="保险公司名称" prop="safeName">
<el-input :disabled="settingForm.toSafe !== '1'" v-model="settingForm.safeName" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="1">
<el-col :span="24">
<el-form-item label="联系人" prop="safeContact">
<el-input :disabled="settingForm.toSafe !== '1'" v-model="settingForm.safeContact" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="1">
<el-col :span="24">
<el-form-item label="联系电话" prop="safeMobile">
<el-input :disabled="settingForm.toSafe !== '1'" v-model="settingForm.safeMobile" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSetting">确认</el-button>
<el-button @click="settingDialog = false" >取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getTicketsById} from "@/api/repair/tickets/Tickets";
import {auditTicketWares} from "@/api/repair/tickets/TicketWares";
import {auditTicketWares, updateSafe, getById} from "@/api/repair/tickets/TicketWares";
import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
import DiscountInput from "@/views/repair/tickets/Components/DiscountInput.vue";
import item from "@/layout/components/Sidebar/Item.vue";
@ -203,10 +250,37 @@ export default {
editProp: ['wares.price'],
dialogLoading: null,
selectRow:[],
imageUrls: []
imageUrls: [],
settingDialog: false,
settingForm: {
safeName: null,
safeContact: null,
safeMobile: null,
toSafe: null,
id: null
}
}
},
methods: {
async doSetting(){
try {
await updateSafe(this.settingForm)
this.settingDialog = false
this.$modal.msgSuccess("设置成功")
await this.open(this.formData)
}catch{}
},
async handleSetting(){
try {
const res = await getById(this.formData.id)
this.settingForm.id = this.formData.id
this.settingForm.toSafe = res.data.toSafe
this.settingForm.safeName = res.data.safeName
this.settingForm.safeContact = res.data.safeContact
this.settingForm.safeMobile = res.data.safeMobile
this.settingDialog = true
}catch{}
},
handleSuccess(){
this.open(this.formData)
},