|
@@ -112,11 +112,12 @@
|
|
|
<div class="table-operator" v-if="$auth('repair-application-forms-finish')">
|
|
|
<a-button type="primary" @click="handleSpareStoreSelect(1)">
|
|
|
<a-icon type="plus"/>
|
|
|
- 添加专用备件
|
|
|
+ 专用备件
|
|
|
</a-button>
|
|
|
+ <a-divider type="vertical" />
|
|
|
<a-button type="primary" @click="handleSpareStoreSelect(0)">
|
|
|
<a-icon type="plus"/>
|
|
|
- 添加常用备件
|
|
|
+ 常用备件
|
|
|
</a-button>
|
|
|
</div>
|
|
|
<a-table
|
|
@@ -127,11 +128,14 @@
|
|
|
rowKey="id">
|
|
|
<span slot="actionSpare" slot-scope="record">
|
|
|
<template>
|
|
|
- <a v-if="$auth('repair-application-forms-finish')" @click="handleEditSpare(record)">修改</a>
|
|
|
- <a-divider type="vertical" />
|
|
|
+<!-- <a v-if="$auth('repair-application-forms-finish')" @click="handleEditSpare(record)">修改</a>-->
|
|
|
+ <a-popconfirm v-if="$auth('repair-application-forms-finish')" title="是否替换该备件?" @confirm="updateSpare(record)">
|
|
|
+ <a>更换备件</a>
|
|
|
+ </a-popconfirm>
|
|
|
+<!-- <a-divider type="vertical" />
|
|
|
<a-popconfirm v-if="$auth('repair-application-forms-finish')" title="是否要删除该条数据?" @confirm="batchDeleteSpare(record.id)">
|
|
|
<a>删除</a>
|
|
|
- </a-popconfirm>
|
|
|
+ </a-popconfirm>-->
|
|
|
</template>
|
|
|
</span>
|
|
|
</a-table>
|
|
@@ -226,6 +230,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { stringify } from 'qs'
|
|
|
import DetailList from '@/components/tools/DetailList'
|
|
|
import { fetchRepairApplicationForm, examine, approve, receive } from '@/api/repair/application-form'
|
|
|
import CheckForm from './CheckForm'
|
|
@@ -241,7 +246,7 @@ import RepairProjectSelectModal from '@/views/repair/repairproject/modules/Repai
|
|
|
import { queryRepairProject, fetchRepairProject, deleteRepairProjects } from '@/api/repair/repairproject'
|
|
|
import SparePartInfoSelectModal from '@/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModal'
|
|
|
import BaseFormForRepair from '@/views/sqarepartmanage/sparepartused/modules/BaseFormForRepair'
|
|
|
-import { selectSparePartUsedListByRepairId, addSparePartUsedBatch, deleteSparePartUseds } from '@/api/sqarepartmanage/sparepartused'
|
|
|
+import { selectSparePartUsedListBySbId, addSparePartUsedBatch, deleteSparePartUseds, updateSpare } from '@/api/sqarepartmanage/sparepartused'
|
|
|
import SpareStoreSelectModal from '@/views/store/sparestore/modules/SpareStoreSelectModal'
|
|
|
import BaseTool from '@/utils/tool'
|
|
|
import FeeBaseForm from '@/views/repair/fee/modules/BaseForm'
|
|
@@ -527,7 +532,10 @@ export default {
|
|
|
queryRepairProject({ repairId: this.model.id }).then(res => {
|
|
|
this.data = res.data
|
|
|
})
|
|
|
- selectSparePartUsedListByRepairId({ id: this.model.id }).then(res => {
|
|
|
+ /*selectSparePartUsedListByRepairId({ id: this.model.id }).then(res => {
|
|
|
+ this.dataSpare = res.data
|
|
|
+ })*/
|
|
|
+ selectSparePartUsedListBySbId({ id: this.model.sbId }).then(res => {
|
|
|
this.dataSpare = res.data
|
|
|
})
|
|
|
queryRepairFee({ repairId: this.model.id }).then(res => {
|
|
@@ -764,17 +772,29 @@ export default {
|
|
|
const modal = this.$refs.baseFormForRepair
|
|
|
modal.base(record)
|
|
|
},
|
|
|
+ updateSpare (record) {
|
|
|
+ updateSpare(record).then(res => {
|
|
|
+ this.$message.info('更换成功')
|
|
|
+ selectSparePartUsedListBySbId({ id: this.model.sbId }).then(res => {
|
|
|
+ this.dataSpare = res.data
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
handleSpareStoreSelect (isSpecial) {
|
|
|
- this.$refs.spareStoreSelectModal.base({}, { storeId: this.storeId, isSpecial: isSpecial, sbId: this.model.sbId })
|
|
|
+ //this.$refs.spareStoreSelectModal.base({}, { storeId: this.storeId, isSpecial: isSpecial, sbId: this.model.sbId })
|
|
|
+ this.$refs.spareStoreSelectModal.base({}, { storeId: this.storeId, isSpecial: isSpecial })
|
|
|
},
|
|
|
handleSpareStoreSelected (record, keys, rows) {
|
|
|
const data = []
|
|
|
for (let i = 0; i < rows.length; i++) {
|
|
|
- data.push({ sbId: this.model.sbId, spareId: rows[i].spareId, repairId: this.model.id, num: 1, price: rows[i].price, totalPrice: rows[i].price, startDate: BaseTool.Date.formatter(new Date(), BaseTool.Date.PICKER_NORM_DATE_PATTERN) })
|
|
|
+ data.push({ isSpecial: record.isSpecial, sbId: this.model.sbId, spareId: rows[i].spareId, repairId: this.model.id, num: 1, price: rows[i].price, totalPrice: rows[i].price, startDate: BaseTool.Date.formatter(new Date(), BaseTool.Date.PICKER_NORM_DATE_PATTERN) })
|
|
|
}
|
|
|
addSparePartUsedBatch(data)
|
|
|
.then((response) => {
|
|
|
- this.$message.info('添加成功')
|
|
|
+ this.$message.info('成功添加个数:' + response.data[0] + ',添加失败个数:' + response.data[1])
|
|
|
+ if (response.data[1] > 0) {
|
|
|
+ this.$message.error('失败原因:该备件已存在更换列表,请点击更换备件')
|
|
|
+ }
|
|
|
this.handleOk()
|
|
|
}).catch(() => {
|
|
|
this.confirmLoading = false
|