编辑工单和删除工单

This commit is contained in:
xiaofajia 2024-11-01 20:21:34 +08:00
parent 2a0c04175d
commit 50113c1dca
3 changed files with 47 additions and 3 deletions

View File

@ -167,3 +167,11 @@ export function updateTicket(data){
data data
}) })
} }
// 删除工单
export function removeTicketById(id){
return request({
url: preUrl + "/remove?id=" + id,
method: 'delete'
})
}

View File

@ -44,6 +44,12 @@
<el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)" <el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)"
>查看 >查看
</el-button> </el-button>
<el-button size="mini" type="text" icon="el-icon-setting" @click="handleEditTicket(scope.row)">
编辑工单
</el-button>
<el-button size="mini" type="text" icon="el-icon-remove" @click="handleRemove(scope.row)">
删除
</el-button>
<el-button v-if="userRole === 'service_advisor' && isFinish" size="mini" type="text" icon="el-icon-refresh" @click="handleEditRecord(scope.row)"> <el-button v-if="userRole === 'service_advisor' && isFinish" size="mini" type="text" icon="el-icon-refresh" @click="handleEditRecord(scope.row)">
维修记录设置 维修记录设置
</el-button> </el-button>
@ -151,11 +157,12 @@
</el-dialog> </el-dialog>
<RecordSetting ref="recordSet" /> <RecordSetting ref="recordSet" />
<EditTickets ref="editTickets" @success="listTickets"/>
</div> </div>
</template> </template>
<script> <script>
import {getPageType, updateTake, getTicketsById} from "@/api/repair/tickets/Tickets"; import {getPageType, updateTake, getTicketsById, removeTicketById} from "@/api/repair/tickets/Tickets";
import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue"; import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue";
import UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue"; import UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue";
import TWOperate from "@/views/repair/tickets/form/TWOperate.vue"; import TWOperate from "@/views/repair/tickets/form/TWOperate.vue";
@ -165,10 +172,11 @@ import {getIfLeader} from "@/api/repair/repairworker";
import UpdateRecord from "@/views/repair/tickets/form/UpdateRecord.vue"; import UpdateRecord from "@/views/repair/tickets/form/UpdateRecord.vue";
import {getUserProfile} from "@/api/system/user"; import {getUserProfile} from "@/api/system/user";
import RecordSetting from "@/views/repair/tickets/form/RecordSetting.vue"; import RecordSetting from "@/views/repair/tickets/form/RecordSetting.vue";
import EditTickets from "@/views/repair/tickets/form/EditTickets.vue";
export default { export default {
name: "TicketManagerItem", name: "TicketManagerItem",
components: {RecordSetting, UpdateRecord, TWOperate, UpdateRepair, TicketsShow}, components: {EditTickets, RecordSetting, UpdateRecord, TWOperate, UpdateRepair, TicketsShow},
props: { props: {
isFinish: { isFinish: {
type: Boolean, type: Boolean,
@ -401,6 +409,20 @@ export default {
handleEditRecord(row){ handleEditRecord(row){
this.$refs.recordSet.open(row.id) this.$refs.recordSet.open(row.id)
}, },
handleEditTicket(row){
this.$refs.editTickets.open(row)
},
async handleRemove(row){
try {
const id = row.id
if (id){
await this.$modal.confirm("确认删除工单" + row.ticketNo + "吗?")
await removeTicketById(id)
await this.listTickets()
this.$modal.msgSuccess("删除成功")
}
}catch{}
}
} }
} }
</script> </script>

View File

@ -122,6 +122,9 @@
<el-button size="mini" type="text" icon="el-icon-setting" @click="handleEditTicket(scope.row)"> <el-button size="mini" type="text" icon="el-icon-setting" @click="handleEditTicket(scope.row)">
编辑工单 编辑工单
</el-button> </el-button>
<el-button size="mini" type="text" icon="el-icon-remove" @click="handleRemove(scope.row)">
删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -178,7 +181,7 @@
</template> </template>
<script> <script>
import {setTicketsVoid, setTicketsPaid, setTicketsPrint} from '@/api/repair/tickets/Tickets' import {setTicketsVoid, setTicketsPaid, setTicketsPrint, removeTicketById} from '@/api/repair/tickets/Tickets'
import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue"; import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue";
import {getByNameAndMobile} from "@/api/base/customer"; import {getByNameAndMobile} from "@/api/base/customer";
import EditTickets from "@/views/repair/tickets/form/EditTickets.vue"; import EditTickets from "@/views/repair/tickets/form/EditTickets.vue";
@ -297,6 +300,17 @@ export default {
}, },
returnSuccess(){ returnSuccess(){
this.$emit("success") this.$emit("success")
},
async handleRemove(row){
try {
const id = row.id
if (id){
await this.$modal.confirm("确认删除工单" + row.ticketNo + "吗?")
await removeTicketById(id)
await this.listTickets()
this.$modal.msgSuccess("删除成功")
}
}catch{}
} }
} }
} }