第二版:增加备件批量修改状态

This commit is contained in:
龙运模 2025-04-30 14:53:57 +08:00
parent c76332c59f
commit c4ff355d1e
4 changed files with 95 additions and 22 deletions

22
LICENSE

File diff suppressed because one or more lines are too long

View File

@ -285,6 +285,13 @@ export default {
return await http.post(this.url, data); return await http.post(this.url, data);
}, },
}, },
partsStatus:{
url: `${config.API_URL}/spare.parts.edit.status`,
name: "批量编辑备件最终状态",
post: async function (data) {
return await http.post(this.url, data);
},
},
import:{ import:{
url: `${config.API_URL}/spare.parts.failure.rate.batch.import`, url: `${config.API_URL}/spare.parts.failure.rate.batch.import`,
name: "备件故障导入", name: "备件故障导入",

View File

@ -4,6 +4,7 @@
<div class="left-panel"> <div class="left-panel">
<el-button type="primary" v-auth="'sparePartsAdd'" :size="size" icon="el-icon-plus" @click="add">新增备件</el-button> <el-button type="primary" v-auth="'sparePartsAdd'" :size="size" icon="el-icon-plus" @click="add">新增备件</el-button>
<el-button type="danger" v-auth="'sparePartsDelete'" :size="size" plain @click="batch_del" :disabled="selection.length==0?true:false">删除</el-button> <el-button type="danger" v-auth="'sparePartsDelete'" :size="size" plain @click="batch_del" :disabled="selection.length==0?true:false">删除</el-button>
<el-button v-auth="'sparePartsEditStatus'" type="primary" :size="size" plain @click="finalStatusClick" :disabled="selection.length===0">批量修改最终状态</el-button>
<scImport ref="scImport" :size="size" :httpDisabled="httpDisabled" type="28" title="批量导入备件" @parentParams="importUpload" @importSuccess="importSuccess"> <scImport ref="scImport" :size="size" :httpDisabled="httpDisabled" type="28" title="批量导入备件" @parentParams="importUpload" @importSuccess="importSuccess">
<template #header> <template #header>
<el-button v-auth="'sparePartsImport'" type="primary" :size="size" plain @click="importFile">批量导入</el-button> <el-button v-auth="'sparePartsImport'" type="primary" :size="size" plain @click="importFile">批量导入</el-button>
@ -54,15 +55,18 @@
</el-container> </el-container>
<librarySave v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" @closed="dialog.save=false"></librarySave> <librarySave v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" @closed="dialog.save=false"></librarySave>
<finalStatusSave v-if="dialog.finalStatusSave" ref="finalStatusDialog" @success="handleSaveSuccess" @closed="dialog.finalStatusSave=false"></finalStatusSave>
</template> </template>
<script> <script>
import librarySave from "../librarySave"; import librarySave from "../librarySave";
import finalStatusSave from "../finalStatusSave";
import {eventBus} from "@/utils/eventBus"; import {eventBus} from "@/utils/eventBus";
export default { export default {
name: "library", name: "library",
components:{ components:{
librarySave librarySave,
finalStatusSave
}, },
data(){ data(){
return{ return{
@ -73,6 +77,7 @@ export default {
}, },
dialog: { dialog: {
save: false, save: false,
finalStatusSave:false
}, },
list:{ list:{
apiObj: this.$API.system.spare.list, apiObj: this.$API.system.spare.list,
@ -268,6 +273,13 @@ export default {
}) })
}, },
finalStatusClick(){
this.dialog.finalStatusSave = true;
this.$nextTick(()=>{
let ids = this.selection.map(em=>em.id);
this.$refs.finalStatusDialog.open('add').setData(ids);
})
},
// //
selectionChange(selection){ selectionChange(selection){
this.selection = selection; this.selection = selection;

View File

@ -0,0 +1,74 @@
<template>
<el-dialog :title="titleMap[mode]" v-model="visible" :width="450" destroy-on-close @closed="$emit('closed')">
<el-form :model="form" :rules="rules" ref="dialogForm" label-width="90px">
<el-form-item label="最终状态" prop="final_status">
<el-input v-model="form.final_status" placeholder="请输入最终状态" clearable></el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible=false" > </el-button>
<el-button type="primary" :loading="isSave" @click="submit()"> </el-button>
</template>
</el-dialog>
</template>
<script>
export default {
name: "finalStatusSave",
emits: ['success', 'closed'],
data() {
return {
mode: "show",
titleMap: {
add: '最终状态',
},
visible: false,
isSave: false,
//
form: {
ids:"",
final_status: "",
},
//
rules: {
final_status: [
{required: true, message: '最终状态不能为空'}
],
},
}
},
mounted() {
},
methods: {
//
open(mode='show'){
this.mode = mode;
this.visible = true;
return this
},
//
submit(){
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSave = true;
const res = await this.$API.setup.spare.partsStatus.post(this.form);
this.isSave = false;
if(res.code === 200){
this.visible = false;
this.$emit('success', '', this.mode);
}
}
})
},
//
setData(ids) {
this.form.ids = ids;
}
}
}
</script>
<style scoped>
</style>