Commit 59860bde authored by sxl's avatar sxl 💬

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

parent daba6cf8
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
</template> </template>
<script> <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 as deviceTypeList } from '@/api/device/deviceType';
import { listDevice } from '@/api/device/device'; import { listDevice } from '@/api/device/device';
import { listDept } from '@/api/system/dept'; import { listDept } from '@/api/system/dept';
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</el-table-column> </el-table-column>
</el-table> </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> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
<script> <script>
import { listWorkOrder, getWorkOrder, addWorkOrder, updateWorkOrder } from '@/api/repair/repairProject'; import { listWorkOrder, getWorkOrder, addWorkOrder, updateWorkOrder } from '@/api/repair/repairProject';
import { listDevice as listDeviceType } from '@/api/device/deviceType'; 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 { listUser } from '@/api/system/user';
import { listDept } from '@/api/system/dept'; import { listDept } from '@/api/system/dept';
import Treeselect from '@riophae/vue-treeselect'; import Treeselect from '@riophae/vue-treeselect';
...@@ -234,13 +234,29 @@ export default { ...@@ -234,13 +234,29 @@ export default {
this.loading = true; this.loading = true;
listWorkOrder(this.queryParams).then(response => { listWorkOrder(this.queryParams).then(response => {
this.workOrderList = response.rows; this.workOrderList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
/** 处理分页事件 */
handlePagination(data) {
this.queryParams.pageNum = data.page;
this.queryParams.pageSize = data.limit;
this.getList();
},
// 设备名称 // 设备名称
getDeviceName(val) { 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 = []; this.deptOptions = [];
const typeDeptIds = this.deviceTypeList.find(item => item.id === val).typeDeptIds; const typeDeptIds = this.deviceTypeList.find(item => item.id === val).typeDeptIds;
...@@ -266,13 +282,6 @@ export default { ...@@ -266,13 +282,6 @@ export default {
console.error('获取部门数据失败:', error); 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() { cancel() {
...@@ -325,21 +334,34 @@ export default { ...@@ -325,21 +334,34 @@ export default {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = '添加工单派遣'; this.title = '添加工单派遣';
// listDept().then((response) => {
// this.deptOptions = this.handleTree(response.data, 'deptId')
// })
}, },
/** 派单 */ /** 派单 */
handleUpdate(row) { handleUpdate(row) {
const id = row.id || this.ids; const id = row.id || this.ids;
listDept().then(response => { this.formpd = {
this.deptOptions = this.handleTree(response.data, 'deptId'); maintainDeptId: null,
}); maintainUserId: null,
};
// 维修单详情
getWorkOrder(id).then(response => { getWorkOrder(id).then(response => {
this.form = response.data; 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.openpd = true;
this.title = '派遣'; this.title = '派遣';
} else {
this.$modal.msgWarning('该设备没有设备类型,请先确认设备信息');
return;
}
}
});
}); });
}, },
// 查看 // 查看
...@@ -381,7 +403,7 @@ export default { ...@@ -381,7 +403,7 @@ export default {
this.form._deviceName = val; this.form._deviceName = val;
this.form.deviceName = val.deviceName; this.form.deviceName = val.deviceName;
this.form.deviceNo = val.deviceNo; this.form.deviceNo = val.deviceNo;
this.form.deviceId = val.deviceId; this.form.deviceId = val.id;
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
......
...@@ -2,18 +2,10 @@ ...@@ -2,18 +2,10 @@
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
<el-form-item label="月份查询" prop="month"> <el-form-item label="月份查询" prop="month">
<el-date-picker <el-date-picker v-model="queryParams.month" type="month" placeholder="选择月份" value-format="yyyy-MM" @change="handleQuery" />
v-model="queryParams.month"
type="month"
placeholder="选择月份"
value-format="yyyy-MM"
@change="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery" <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
>搜索</el-button
>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -21,45 +13,24 @@ ...@@ -21,45 +13,24 @@
<el-table :data="tableData" border style="width: 100%"> <el-table :data="tableData" border style="width: 100%">
<el-table-column prop="id" label="序号" width="60" align="center" /> <el-table-column prop="id" label="序号" width="60" align="center" />
<el-table-column prop="date" label="月份" width="120" align="center" /> <el-table-column prop="date" label="月份" width="120" align="center" />
<el-table-column <el-table-column prop="areaname" label="名称" width="150" align="center" />
prop="areaname" <el-table-column prop="num" label="月能耗(KWh)" width="150" align="center" />
label="名称" <el-table-column prop="total" label="累计能耗(KWh)" width="150" align="center" />
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> </el-table>
<pagination <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div> </div>
</template> </template>
<script> <script>
import { getPowerConsumptionList } from "@/api/tyler/PowerConsumptionAnalysis"; import { getPowerConsumptionList } from '@/api/tyler/PowerConsumptionAnalysis';
export default { export default {
name: "PowerConsumptionAnalysis", name: 'PowerConsumptionAnalysis',
data() { data() {
return { return {
// 查询参数 // 查询参数
queryParams: { queryParams: {
month: "", month: '',
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}, },
...@@ -75,8 +46,8 @@ export default { ...@@ -75,8 +46,8 @@ export default {
methods: { methods: {
// 获取列表数据 // 获取列表数据
getList() { getList() {
getPowerConsumptionList(this.queryParams).then((response) => { getPowerConsumptionList(this.queryParams).then(response => {
this.tableData = response.rows.map((item) => { this.tableData = response.rows.map(item => {
return { return {
...item, ...item,
date: new Date(item.date).toISOString().slice(0, 7), date: new Date(item.date).toISOString().slice(0, 7),
...@@ -85,35 +56,6 @@ export default { ...@@ -85,35 +56,6 @@ export default {
this.total = response.total; 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() { handleQuery() {
...@@ -122,7 +64,7 @@ export default { ...@@ -122,7 +64,7 @@ export default {
}, },
// 重置按钮操作 // 重置按钮操作
resetQuery() { resetQuery() {
this.queryParams.month = ""; this.queryParams.month = '';
this.handleQuery(); 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