Commit 59860bde authored by sxl's avatar sxl 💬

fix:维修任务接口问题修复

parent daba6cf8
......@@ -88,7 +88,7 @@
</template>
<script>
import { listTask, getTask, delTask, addTask, updateTask, getInspectionUser } from '@/api/patrol/patrolProject';
import { listTask, delTask, addTask, updateTask, getInspectionUser } from '@/api/patrol/patrolProject';
import { listDevice as deviceTypeList } from '@/api/device/deviceType';
import { listDevice } from '@/api/device/device';
import { listDept } from '@/api/system/dept';
......
......@@ -65,7 +65,7 @@
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="handlePagination" />
<!-- 添加工单派遣对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
......@@ -134,7 +134,7 @@
<script>
import { listWorkOrder, getWorkOrder, addWorkOrder, updateWorkOrder } from '@/api/repair/repairProject';
import { listDevice as listDeviceType } from '@/api/device/deviceType';
import { listDevice as listDeviceName } from '@/api/device/device';
import { listDevice as listDeviceName, getDevice } from '@/api/device/device';
import { listUser } from '@/api/system/user';
import { listDept } from '@/api/system/dept';
import Treeselect from '@riophae/vue-treeselect';
......@@ -234,13 +234,29 @@ export default {
this.loading = true;
listWorkOrder(this.queryParams).then(response => {
this.workOrderList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 处理分页事件 */
handlePagination(data) {
this.queryParams.pageNum = data.page;
this.queryParams.pageSize = data.limit;
this.getList();
},
// 设备名称
getDeviceName(val) {
this.form._deviceName = null;
this.getDeviceTypeDept(val);
listDeviceName({ deviceType: val }).then(response => {
this.deviceNameList = response.rows;
});
this.form.deviceName = null;
this.form.deviceNo = null;
this.form.maintainDeptId = null;
},
// 根据设备类型id获取部门列表
getDeviceTypeDept(val) {
// 清空部门
this.deptOptions = [];
const typeDeptIds = this.deviceTypeList.find(item => item.id === val).typeDeptIds;
......@@ -266,13 +282,6 @@ export default {
console.error('获取部门数据失败:', error);
});
}
listDeviceName({ deviceType: val }).then(response => {
this.deviceNameList = response.rows;
});
this.form.deviceName = null;
this.form.deviceNo = null;
this.form.maintainDeptId = null;
},
// 取消按钮
cancel() {
......@@ -325,21 +334,34 @@ export default {
this.reset();
this.open = true;
this.title = '添加工单派遣';
// listDept().then((response) => {
// this.deptOptions = this.handleTree(response.data, 'deptId')
// })
},
/** 派单 */
handleUpdate(row) {
const id = row.id || this.ids;
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, 'deptId');
});
this.formpd = {
maintainDeptId: null,
maintainUserId: null,
};
// 维修单详情
getWorkOrder(id).then(response => {
this.form = response.data;
console.log(this.form);
if (!this.form.deviceId) {
this.$modal.msgWarning('该工单没有设备信息,请先确认设备信息');
return;
}
//通过设备详情,获取设备类型id
getDevice(this.form.deviceId).then(res => {
if (res.code === 200) {
if (res.data.deviceType) {
this.getDeviceTypeDept(res.data.deviceType);
this.openpd = true;
this.title = '派遣';
} else {
this.$modal.msgWarning('该设备没有设备类型,请先确认设备信息');
return;
}
}
});
});
},
// 查看
......@@ -381,7 +403,7 @@ export default {
this.form._deviceName = val;
this.form.deviceName = val.deviceName;
this.form.deviceNo = val.deviceNo;
this.form.deviceId = val.deviceId;
this.form.deviceId = val.id;
},
/** 提交按钮 */
submitForm() {
......
......@@ -2,18 +2,10 @@
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
<el-form-item label="月份查询" prop="month">
<el-date-picker
v-model="queryParams.month"
type="month"
placeholder="选择月份"
value-format="yyyy-MM"
@change="handleQuery"
/>
<el-date-picker v-model="queryParams.month" type="month" placeholder="选择月份" value-format="yyyy-MM" @change="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"
>搜索</el-button
>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
......@@ -21,45 +13,24 @@
<el-table :data="tableData" border style="width: 100%">
<el-table-column prop="id" label="序号" width="60" align="center" />
<el-table-column prop="date" label="月份" width="120" align="center" />
<el-table-column
prop="areaname"
label="名称"
width="150"
align="center"
/>
<el-table-column
prop="num"
label="月能耗(KWh)"
width="150"
align="center"
/>
<el-table-column
prop="total"
label="累计能耗(KWh)"
width="150"
align="center"
/>
<el-table-column prop="areaname" label="名称" width="150" align="center" />
<el-table-column prop="num" label="月能耗(KWh)" width="150" align="center" />
<el-table-column prop="total" label="累计能耗(KWh)" width="150" align="center" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
</div>
</template>
<script>
import { getPowerConsumptionList } from "@/api/tyler/PowerConsumptionAnalysis";
import { getPowerConsumptionList } from '@/api/tyler/PowerConsumptionAnalysis';
export default {
name: "PowerConsumptionAnalysis",
name: 'PowerConsumptionAnalysis',
data() {
return {
// 查询参数
queryParams: {
month: "",
month: '',
pageNum: 1,
pageSize: 10,
},
......@@ -75,8 +46,8 @@ export default {
methods: {
// 获取列表数据
getList() {
getPowerConsumptionList(this.queryParams).then((response) => {
this.tableData = response.rows.map((item) => {
getPowerConsumptionList(this.queryParams).then(response => {
this.tableData = response.rows.map(item => {
return {
...item,
date: new Date(item.date).toISOString().slice(0, 7),
......@@ -85,35 +56,6 @@ export default {
this.total = response.total;
});
// 模拟数据
this.tableData = [
{
month: "2023-01",
name: "采区能耗",
monthlyConsumption: 12500,
totalConsumption: 12500,
},
{
month: "2023-01",
name: "选厂能耗",
monthlyConsumption: 8500,
totalConsumption: 8500,
},
{
month: "2023-02",
name: "冶炼能耗",
monthlyConsumption: 11800,
totalConsumption: 24300,
},
{
month: "2023-02",
name: "尾矿库能耗",
monthlyConsumption: 7900,
totalConsumption: 16400,
},
];
this.total = this.tableData.length;
},
// 搜索按钮操作
handleQuery() {
......@@ -122,7 +64,7 @@ export default {
},
// 重置按钮操作
resetQuery() {
this.queryParams.month = "";
this.queryParams.month = '';
this.handleQuery();
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment