第二版:增加备件批量修改状态
This commit is contained in:
parent
c76332c59f
commit
c4ff355d1e
@ -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: "备件故障导入",
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
74
src/views/setting/partsMag/finalStatusSave.vue
Normal file
74
src/views/setting/partsMag/finalStatusSave.vue
Normal 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>
|
||||||
Loading…
Reference in New Issue
Block a user