设备管理-计量管理-量具保养-新增排序/权限

dev-scheduling
ysn 4 weeks ago
parent 353fdae2e6
commit b3bcad6287
  1. 170
      src/views/warehouseManagement/maintenancetools/index.vue

@ -1,10 +1,23 @@
<template>
<basic-container>
<!-- 计量管理 -->
<avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud"
@row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange" @on-load="onLoad">
<avue-crud
:option="option"
:table-loading="loading"
:data="data"
v-model="form"
v-model:page="page"
ref="crud"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
@sort-change="sortChange"
>
<template #menu-right>
<!-- <el-button type="warning" @click="handleAdd" plain>待申请</el-button>
<el-button type="success" @click="handleAdd" plain>已申请</el-button> -->
@ -16,17 +29,35 @@
<template #location="{ row }">{{ row.stRealtimeStock.storageLocation.location }}</template>
<template #quantity="{ row }">{{ row.stRealtimeStock.quantity }}</template> -->
<template #menu-left>
<el-button type="primary" @click="handleAdd">新增</el-button>
<el-button type="primary" @click="addApply">保养申请</el-button>
<el-button type="primary" @click="handleAdd" v-if="permission.maintenancetools_add">
新增
</el-button>
<el-button
type="primary"
@click="addApply"
v-if="permission.maintenancetools_maintenanceRequest"
>
保养申请
</el-button>
</template>
</avue-crud>
<el-dialog v-model="addDialog" append-to-body width="80%" title="新增">
<div style="display: flex;justify-content: flex-end;margin-bottom: 10px;">
<div style="display: flex; justify-content: flex-end; margin-bottom: 10px">
<el-button type="primary" @click="addMaintain">加入保养</el-button>
</div>
<avue-crud class="addOption-box" :option="addOption" :table-loading="loading" :data="addData" v-model="form" v-model:page="addPage" ref="addCrud"
@selection-change="addSelectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange"></avue-crud>
<avue-crud
class="addOption-box"
:option="addOption"
:table-loading="loading"
:data="addData"
v-model="form"
v-model:page="addPage"
ref="addCrud"
@selection-change="addSelectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
></avue-crud>
<!-- <el-table :data="addData">
<el-table-column type="selection"></el-table-column>
<el-table-column label="物料名称" align="center" prop="coGoods.goodsName"></el-table-column>
@ -44,7 +75,13 @@
</template>
<script>
import {getRecorderList,addRecorderList,addRecorder,applyRecorder} from "@/api/equiptManagement/maintenancetools"
import {
getRecorderList,
addRecorderList,
addRecorder,
applyRecorder,
} from '@/api/equiptManagement/maintenancetools';
import { mapGetters } from 'vuex';
export default {
data() {
return {
@ -113,6 +150,7 @@ export default {
labelWidth: 140,
overflow: true,
search: false,
sortable: 'custom',
rules: [
{
required: true,
@ -128,6 +166,7 @@ export default {
labelWidth: 140,
overflow: true,
search: true,
sortable: 'custom',
rules: [
{
required: true,
@ -143,6 +182,7 @@ export default {
labelWidth: 140,
overflow: true,
search: false,
sortable: 'custom',
rules: [
{
required: true,
@ -159,6 +199,7 @@ export default {
search: true,
width: 150,
searchLabelWidth: 100,
sortable: 'custom',
rules: [
{
required: true,
@ -174,6 +215,7 @@ export default {
overflow: true,
search: true,
searchLabelWidth: 60,
sortable: 'custom',
rules: [
{
required: true,
@ -188,6 +230,7 @@ export default {
span: 24,
overflow: true,
search: true,
sortable: 'custom',
rules: [
{
required: true,
@ -202,6 +245,7 @@ export default {
span: 24,
overflow: true,
search: false,
sortable: 'custom',
rules: [
{
required: true,
@ -216,6 +260,7 @@ export default {
span: 24,
overflow: true,
search: false,
sortable: 'custom',
rules: [
{
required: true,
@ -230,6 +275,7 @@ export default {
span: 24,
overflow: true,
search: false,
sortable: 'custom',
rules: [
{
required: true,
@ -244,6 +290,7 @@ export default {
span: 24,
overflow: true,
search: false,
sortable: 'custom',
rules: [
{
required: true,
@ -269,11 +316,11 @@ export default {
],
// 0 1
dicData: [
{ label: "新建", value: 0 },
{ label: "已申请", value: 1 },
]
{ label: '新建', value: 0 },
{ label: '已申请', value: 1 },
],
},
]
],
},
addOption: {
columnSort: true,
@ -448,26 +495,27 @@ export default {
},
],
},
]
}
}
],
},
mounted() {
};
},
computed: {
...mapGetters(['permission']),
},
mounted() {},
methods: {
handleAdd() {
addRecorderList().then(res => {
console.log('res-----------',res)
this.addData = res.data.data.records
this.addPage.total = res.data.data.total
this.addDialog = true
})
console.log('res-----------', res);
this.addData = res.data.data.records;
this.addPage.total = res.data.data.total;
this.addDialog = true;
});
},
addApply() {
if (this.selectionList.length == 0) {
this.$message.error('请至少选择一条数据')
return
this.$message.error('请至少选择一条数据');
return;
}
this.$confirm('确定进行保养申请吗?', {
confirmButtonText: '确定',
@ -475,60 +523,70 @@ export default {
type: 'warning',
}).then(() => {
applyRecorder({
ids:this.selectionList.map(item => item.id).join(',')
ids: this.selectionList.map(item => item.id).join(','),
}).then(res => {
if (res.data.code == 200) {
this.$message.success('申请成功')
this.onLoad()
this.$message.success('申请成功');
this.onLoad();
}
})
})
});
});
},
selectionChange(list) {
this.selectionList = list
this.selectionList = list;
},
addSelectionChange(list) {
this.addSelectionList = list
this.addSelectionList = list;
},
addMaintain() {
if (this.addSelectionList.length == 0) {
this.$message.error('请至少选择一条数据')
return
this.$message.error('请至少选择一条数据');
return;
}
addRecorder({
ids:this.addSelectionList.map(item => item.id).join(',')
ids: this.addSelectionList.map(item => item.id).join(','),
}).then(res => {
if (res.data.code == 200) {
this.$message.success('新增成功')
this.addDialog = false
this.onLoad()
this.$message.success('新增成功');
this.addDialog = false;
this.onLoad();
}
})
});
},
searchChange(params, done) {
this.page.currentPage = 1
this.query = params
this.onLoad()
done()
this.page.currentPage = 1;
this.query = params;
this.onLoad();
done();
},
searchReset() {
this.query = {}
this.onLoad()
this.query = {};
this.onLoad();
},
sortChange({ prop, order }) {
this.query.descs = undefined;
this.query.ascs = undefined;
let orderByFieldKey = order === 'descending' ? 'descs' : 'ascs';
this.query[orderByFieldKey] = !prop
? undefined
: prop.replace(/([a-z])([A-Z0-9])/g, '$1_$2').toUpperCase();
// //
this.onLoad();
},
onLoad() {
this.loading = true
this.loading = true;
getRecorderList({
current: this.page.currentPage,
size: this.page.pageSize,
...this.query
...this.query,
}).then(res => {
this.data = res.data.data.records
this.page.total = res.data.data.total
this.loading = false
})
}
}
}
this.data = res.data.data.records;
this.page.total = res.data.data.total;
this.loading = false;
});
},
},
};
</script>
<style lang="scss">

Loading…
Cancel
Save