You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udiwms-vue-frame/src/views/inventory/DeviceInspectOrderNew.vue

387 lines
12 KiB
Vue

<template>
<div>
<el-card class="el-card">
<el-form :model="filterQuery" class="query-form" label-width="100px" v-show="showSearch">
<el-row>
<el-col :span="8">
<el-form-item class="query-form-item" label="部门:">
<el-select v-model="filterQuery.deptCode" style="width: 90%" placeholder="请选择部门" clearable="true"
@change="deptChange"
>
<el-option
v-for="item in deptList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item class="query-form-item" label="仓库:">
<el-select v-model="filterQuery.invCode" style="width: 90%" placeholder="请选择仓库" clearable="true"
>
<el-option
v-for="item in invList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item class="query-form-item" label="维保记录号:">
<el-input v-model="filterQuery.orderId" style="width: 90%" placeholder="请输入报修记录号"
clearable="true"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item class="query-form-item" label="资产编码:">
<el-input v-model="filterQuery.code" style="width: 90%" placeholder="请输入资产编码"
clearable="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item class="query-form-item" label="维保类型:">
<el-select v-model="filterQuery.type" style="width: 90%" placeholder="请选择维保类型" clearable="true"
>
<el-option :value="1" label="报修"/>
<el-option :value="2" label="计划"/>
<el-option :value="3" label="手动"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item class="query-form-item" label="设备状态:">
<el-select v-model="filterQuery.deviceStatus" style="width: 90%" placeholder="请选择设备状态"
clearable="true"
>
<el-option :value="0" label="异常"/>
<el-option :value="1" label="正常"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn">
<el-button-group style="margin-left: 10px;display:flex;">
<el-button icon="el-icon-view" type="primary" @click="hideSearch">显示/隐藏搜索栏</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="onReset">重置</el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit">查询</el-button>
<el-button type="primary" icon="el-icon-plus" @click="addInspectOrder">新增维保记录</el-button>
</el-button-group>
</div>
<el-table v-loading="loading" :data="list" style="width: 100%" highlight-current-row
border>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="设备维保记录号" prop="orderId"></el-table-column>
<el-table-column label="部门" prop="deptName"></el-table-column>
<el-table-column label="仓库" prop="invName"></el-table-column>
<el-table-column label="设备名称" prop="deviceName"></el-table-column>
<el-table-column label="资产编码" prop="code"></el-table-column>
<el-table-column label="规格型号" prop="ggxh"></el-table-column>
<el-table-column label="批次号" prop="batchNo"></el-table-column>
<el-table-column label="上级单号" prop="lastOrderId"></el-table-column>
<el-table-column label="创建时间" prop="createTime"></el-table-column>
<el-table-column label="创建人" prop="createUserName"></el-table-column>
<el-table-column label="维保类型" prop="type">
<template slot-scope="scope">
<el-tag>{{ typeMap[scope.row.type] }}</el-tag>
</template>
</el-table-column>
<el-table-column label="养护说明" prop="remark"></el-table-column>
<el-table-column label="设备状态" prop="status" show-overflow-tooltip width="120">
<template slot-scope="scope">
<el-tag>{{ statusMap[scope.row.deviceStatus] }}</el-tag>
</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">
<el-tag>{{ statusMap[scope.row.status] }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.stop="editOrder(scope.row)"
>编辑
</el-button
>
<el-button
type="text"
size="small"
@click.native.stop="submitAudit(scope.row)"
>提交审核
</el-button
>
<el-button
type="text"
size="small"
@click.native.stop="deleteDialog(scope.row.id)"
>删除
</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:limit.sync="filterQuery.limit"
:page.sync="filterQuery.page"
@pagination="getList"
></pagination>
</el-card>
<el-dialog
:title="formMap[formName]"
:visible.sync="formVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="60%"
v-if="formVisible"
>
<DeviceInspectOrderModify
:inspectOrder="deviceInspectOrder"
:closeDialog="closeDialog"
></DeviceInspectOrderModify>
</el-dialog>
</div>
</template>
<script>
import {getDeptListByUser} from "@/api/auth/authDept";
import {findInvByUser} from "@/api/system/invSubWarehouse";
import {getInvSpaceList} from "@/api/inventory/invSpace";
import {getDeviceInspectOrderList, submitAudit, deleteDeviceInspectOrder} from "@/api/inventory/deviceInspectOrder";
import DeviceInspectOrderModify from "@/views/inventory/DeviceInspectOrderModify.vue";
export default {
name: "DeviceReceiveOrderNew",
data() {
return {
filterQuery: {
orderId: null,
deptCode: this.$store.getters.locDeptCode,
invCode: null,
code: null,
status: 0,
type: 1,
deviceStatus: 1,
page: 1,
limit: 20,
},
list: [],
total: 0,
deptList: [],
invList: [],
spaceList: [],
loading: false,
formVisible: false,
statusMap: {
0: "草稿",
1: "未审核",
2: "已审核 ",
},
deviceStatusMap: {
0: "正常",
1: "异常",
},
typeMap: {
1: "报修",
2: "计划",
3: "手动"
},
formName: null,
formMap: {
add: "新增维保记录",
edit: "编辑维保记录"
},
deviceInspectOrder: {
orderId: null,
deptCode: null,
invCode: null,
code: null,
lastOrderId: null,
type: 3,
deviceStatus: 1,
remark: null
},
showSearch: true
};
},
methods: {
hideSearch() {
this.showSearch = !this.showSearch;
},
onReset() {
this.$router.push({
path: "",
});
this.filterQuery = {
orderId: null,
deptCode: this.$store.getters.locDeptCode,
invCode: null,
code: null,
status: 0,
page: 1,
limit: 20,
};
this.getList();
},
onSubmit() {
this.filterQuery.page = 1;
this.getList();
},
getList() {
this.loading = true;
getDeviceInspectOrderList(this.filterQuery).then((res) => {
this.loading = false;
if (res.code === 20000) {
this.list = res.data.list || [];
this.total = res.data.total || 0;
} else {
this.$message.error(res.message);
this.list = [];
this.total = 0;
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
this.list = [];
this.total = 0;
})
},
deptChange() {
this.invList = [];
this.spaceList = [];
this.filterQuery.fromInvCode = null;
this.filterQuery.fromInvSpaceCode = null;
this.getInvList();
},
getDeptList() {
getDeptListByUser().then((res) => {
this.deptList = res.data || [];
this.getInvList();
this.getList();
});
},
invChange() {
this.spaceList = [];
this.filterQuery.fromInvSpaceCode = null;
this.getSpaceList();
},
getInvList() {
let params = {deptCode: this.filterQuery.deptCode};
findInvByUser(params)
.then((response) => {
this.invList = response.data || [];
this.getList();
})
.catch(() => {
});
},
getSpaceList() {
let params = {
invWarehouseCode: this.filterQuery.fromInvCode,
invStorageCode: this.filterQuery.fromInvCode.deptCode,
status: 1
};
getInvSpaceList(params).then((res) => {
this.spaceList = res.data.list || [];
this.getList();
})
},
addInspectOrder() {
this.formVisible = true;
this.formName = 'add';
this.deviceInspectOrder = {
id: null,
orderId: null,
deptCode: this.$store.getters.locDeptCode,
invCode: null,
code: null,
lastOrderId: null,
type: 3,
deviceStatus: 1,
remark: null
};
},
editOrder(row) {
this.formVisible = true;
this.formName = 'edit';
this.deviceInspectOrder = row;
},
submitAudit(row) {
let params = {orderId: row.orderId};
submitAudit(params).then((res) => {
if (res.code === 20000) {
this.$message.success("提交成功!");
this.getList();
} else {
this.$message.error(res.message);
}
}).catch((error) => {
this.$message.error(error.message);
});
},
deleteDialog(rowId) {
this.$confirm('此操作将永久删除该领用记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = {id: rowId};
this.loading = true;
deleteDeviceInspectOrder(params).then((res) => {
this.loading = false;
if (res.code === 20000) {
this.$message.success("删除成功!");
this.getList();
} else {
this.$message.error(res.message);
}
}).catch(() => {
this.loading = false;
});
});
},
closeDialog() {
this.formVisible = false;
this.getList();
},
},
components: {
DeviceInspectOrderModify
},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
},
created() {
this.getDeptList();
},
};
</script>
<style type="text/scss" lang="scss">
</style>