巡检计划相关修改

dev_ksck2.0
anthonywj 11 months ago
parent 24abcee7e9
commit 5fc6e1cb3d

@ -1,40 +1,53 @@
import axios from "@/utils/request";
export function devicePlanDetailItemPage(query) {
return axios(
{
url: "/udi/device/plan/detail/item/page",
method: "POST",
data: query
}
)
return axios(
{
url: "/udi/device/plan/detail/item/page",
method: "POST",
data: query
}
)
}
export function devicePlanDetailItemAdd(query) {
return axios(
{
url: "/udi/device/plan/detail/item/add",
method: "POST",
data: query
}
)
return axios(
{
url: "/udi/device/plan/detail/item/add",
method: "POST",
data: query
}
)
}
export function devicePlanDetailItemDel(planId,productId,itemCode) {
return axios(
{
url: `/udi/device/plan/detail/item/delByProductId/${planId}/${productId}/${itemCode}`,
method: "DELETE"
}
)
export function devicePlanDetailItemBatchAdd(query) {
return axios(
{
url: "/udi/device/plan/detail/item/batch/add",
method: "POST",
data: query
}
)
}
export function devicePlanDetailItemByDeviceCodeDel(planId,deviceCode,itemCode) {
return axios(
{
url: `/udi/device/plan/detail/item/delByDeviceCode/${planId}/${deviceCode}/${itemCode}`,
method: "DELETE"
}
)
export function devicePlanDetailItemDel(planId, productId, itemCode) {
return axios(
{
url: `/udi/device/plan/detail/item/delByProduct/${planId}/${productId}/${itemCode}`,
method: "DELETE"
}
)
}
export function devicePlanDetailItemByDeviceCodeDel(planId, deviceCode, itemCode) {
return axios(
{
url: `/udi/device/plan/detail/item/delByDevice/${planId}/${deviceCode}/${itemCode}`,
method: "DELETE"
}
)
}

@ -0,0 +1,158 @@
<template>
<div>
<el-card>
<el-form :model="query" v-if="showSearch" label-width="auto">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="设备编码">
<el-input v-model="query.deviceCode" clearable/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="设备名称">
<el-input v-model="query.productName" clearable/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn">
<el-button-group>
<el-button icon="el-icon-view" type="primary" @click="showSearch = !showSearch">显示/隐藏搜索栏</el-button>
<el-button
type="primary"
icon="el-icon-refresh"
@click="onReset"
>重置
</el-button>
<el-button type="primary" icon="el-icon-search" @click="query.page=1;getList()"
>查询
</el-button>
<el-button type="primary" icon="el-icon-plus" @click="chooseDevice"
>选入
</el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table :data="list" v-loading="loading" @selection-change="(val)=>{selectChangeFunc(val)}"
@row-click="(row)=>{$refs.table.toggleRowSelection(row)}" ref="table" row-key="deviceCode">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="科室" width="150" prop="deptName"/>
<el-table-column label="设备编码" width="150" prop="deviceCode"/>
<el-table-column label="最小销售标识" width="150" prop="nameCode"/>
<el-table-column label="名称" width="150" prop="productName"/>
<el-table-column label="规格型号" width="160" prop="ggxh"/>
<el-table-column label="变更次数" width="100" prop="changeCount"/>
<el-table-column label="维修次数" width="100" prop="repairCount"/>
<el-table-column label="巡检次数" width="100" prop="checkCount"/>
<el-table-column label="计量单位" width="100" prop="measname"/>
<el-table-column label="生产企业" width="180" prop="manufactory"/>
<el-table-column label="批次号" width="100" prop="batchNo"/>
<el-table-column label="序列号" width="100" prop="serialNo"/>
<el-table-column label="生产日期" width="140" prop="productionDate"/>
<el-table-column label="过期时间" width="140" prop="expireDate"/>
<el-table-column label="供应商" width="100" prop="supName"/>
<el-table-column label="udi码" width="150" prop="udi"/>
<el-table-column label="注册/备案号" width="150" prop="zczbhhzbapzbh"/>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="query.page"
:limit.sync="query.limit"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import {deviceDetailInfo} from "@/api/dev/deviceInfoApi";
import {getLoading} from "@/utils";
import {devicePlanDetailAdd} from "@/api/dev/devicePlanDetailApi";
let query = {
page: 1,
limit: 10,
productName: null,
deviceCode: null,
planId: null,
}
export default {
name: "deviceAdd",
props: {
planId: {required: true},
selectChangeFunc: {required: true, type: Function},
closeAddDevice: {required: true, type: Function},
planData: {
type: Object,
required: true
},
},
data() {
return {
showSearch: true,
loading: false,
query: {...query},
list: [],
total: 0,
}
},
created() {
this.query = {...query, planId: this.planId}
this.getList()
},
methods: {
onReset() {
this.query = {...query, planId: this.planId}
this.getList()
},
chooseDevice() {
let selectList = this.$refs.table.selection
if (selectList.length == 0) {
this.$message.error("请选择设备")
return
}
let deviceCodes = selectList.map(item => item.deviceCode)
let param = {
planId: this.planId,
deviceCodes: deviceCodes,
devicePlanParam: this.planData
}
devicePlanDetailAdd(param).then(res => {
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.closeAddDevice(res.data);
}).catch(e => {
})
},
getList() {
this.loading = true
deviceDetailInfo(this.query)
.then((res) => {
this.loading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.list = res.data.list || [];
this.total = res.data.total || 0;
})
.catch(() => {
this.loading = false
this.list = [];
this.total = 0;
});
},
},
}
</script>
<style scoped>
</style>

@ -1,7 +1,7 @@
<template>
<div>
<!-- 巡检计划主表-->
<el-card>
<el-form :model="query" v-if="showSearch" label-width="auto">
<el-row :gutter="20">
<el-col :span="6">
@ -28,48 +28,51 @@
<el-button type="primary" icon="el-icon-search" @click="search"
>查询
</el-button>
<el-button type="primary" icon="el-icon-plus" @click="openCreate(null)"
<el-button type="primary" icon="el-icon-plus" @click="openCreate(null,null)"
>新增
</el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table :data="list" @row-click="rowClick" v-loading="loading" click-row-light
highlight-current-row>
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="计划名称" width="150" prop="name"/>
<el-table-column label="负责部门" width="150" prop="chargeDeptName"/>
<el-table-column label="设备数量" width="150" prop="deviceCount"/>
<el-table-column label="执行情况" width="150" prop="chargeDeptName">
<el-table-column label="负责部门" width="120" prop="chargeDeptName"/>
<el-table-column label="设备数量" width="120" prop="deviceCount"/>
<el-table-column label="单据状态" width="120" prop="chargeDeptName">
<template slot-scope="scope">
<el-tag v-if="scope.row.status==1" type="warning">稿</el-tag>
<el-tag v-if="scope.row.status==2" type="success"></el-tag>
</template>
</el-table-column>
<el-table-column label="执行状态" width="120" prop="chargeDeptName">
<template slot-scope="scope">
<el-tag v-if="scope.row.isActive==true" type="success"></el-tag>
<el-tag v-if="scope.row.isActive==false" type="info"></el-tag>
<el-tag v-if="scope.row.isActive==true" type="success"></el-tag>
<el-tag v-if="scope.row.isActive==false" type="info"></el-tag>
</template>
</el-table-column>
<el-table-column label="开始日期" width="150" prop="startDate"/>
<el-table-column label="结束日期" width="150" prop="endDate"/>
<el-table-column label="执行周期(次)" width="160" prop="frequency">
<el-table-column label="执行频率" width="160" prop="frequency">
<template slot-scope="scope">
{{ `${scope.row.frequency}` }}
</template>
</el-table-column>
<el-table-column label="已执行次数" width="200" prop="execCount"/>
<el-table-column label="备注" width="200" prop="remark"/>
<el-table-column label="操作" width="240" fixed="right">
<el-table-column label="操作" width="200" fixed="right">
<template slot-scope="scope">
<el-button type="text" @click.stop="openCreate(scope.row.planId)">
<el-button type="text" @click.stop="openCreate(scope.row.planId,scope.row)">
编辑
</el-button>
<el-button type="text" @click.stop="openCreate(scope.row.planId,null,1)">
添加巡检设备
<el-button type="text" @click="deviceCheckGenFunc(scope.row)"
>生成任务单
</el-button>
<el-button type="text" @click.stop="delplan(scope.row)">
删除
</el-button>
<el-button type="text" @click="deviceCheckGenFunc(scope.row)"
>生成任务单
</el-button>
</template>
</el-table-column>
</el-table>
@ -82,91 +85,32 @@
/>
</el-card>
<!-- 巡检计划设备明细-->
<el-card>
<div slot="header" class="clearfix">
<div class="fl">
{{ `计划详情 ${clickRow ? '——' + clickRow.name : ''}` }}
</div>
<div class="fr" v-if="clickRow">
<el-button type="primary" @click="openCreate(clickRow.planId,null,1)"></el-button>
<el-button type="" @click="getDetailList"></el-button>
</div>
</div>
<el-table :data="detailList" v-loading="detailLoading" ref="table" row-key="productId"
@row-click="(row)=>{$refs.table.toggleRowExpansion(row)}" @expand-change="handleExpendRow"
:expandRowKeys="expandRowKeys">
<el-table-column type="expand">
<template slot-scope="scope">
<el-card class="mb10" v-if="scope.row.detailData!=null">
<el-form :model="scope.row.detailData.query" inline>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="设备编号">
<el-input v-model="scope.row.detailData.query.deviceCode" clearable/>
</el-form-item>
<el-button-group>
<el-button
type="primary"
icon="el-icon-refresh"
@click="onReset"
>重置
</el-button>
<el-button type="primary" icon="el-icon-search"
@click="scope.row.detailData.query.page=1;getRowDetailList(scope.row.detailData)"
>查询
</el-button>
</el-button-group>
</el-col>
</el-row>
</el-form>
<el-table :data="scope.row.detailData.list"
v-loading="scope.row.detailData.loading">
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="科室名称" prop="deptName"/>
<el-table-column label="设备编号" prop="deviceCode"/>
<el-table-column label="最小销售标识" prop="nameCode"/>
<el-table-column label="名称" prop="productName"/>
<el-table-column label="规格型号" prop="ggxh"/>
<el-table-column label="计量单位" prop="measname"/>
<el-table-column label="生产企业" prop="manufactory"/>
<el-table-column label="注册/备案号" prop="zczbhhzbapzbh"/>
<el-table-column label="操作" width="120">
<template slot-scope="prop">
<el-button type="text" @click="openCreate(prop.row.planId,prop.row,2,true)"
>巡检项目
</el-button>
<el-button type="text" @click="delDetail(prop.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="scope.row.detailData.total>0"
:total="scope.row.detailData.total"
:page.sync="scope.row.detailData.query.page"
:limit.sync="scope.row.detailData.query.limit"
@pagination="getRowDetailList(scope.row.detailData)"
/>
</el-card>
</template>
</el-table-column>
<el-table :data="detailList" @row-click="rowClick" v-loading="detailLoading" click-row-light
highlight-current-row>
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="科室名称" prop="deptName"/>
<el-table-column label="设备编号" prop="deviceCode"/>
<el-table-column label="最小销售标识" prop="nameCode"/>
<el-table-column label="名称" prop="productName"/>
<el-table-column label="规格型号" prop="ggxh"/>
<el-table-column label="计量单位" prop="measname"/>
<el-table-column label="数量" prop="count"/>
<el-table-column label="生产企业" prop="manufactory"/>
<el-table-column label="注册/备案号" prop="zczbhhzbapzbh"/>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button type="text" @click.stop="openCreate(scope.row.planId,scope.row,2)"
<template slot-scope="prop">
<el-button type="text" @click="setProject(prop.row)"
>巡检项目
</el-button>
<el-button type="text" @click.stop="delDetail(scope.row)"
>删除
</el-button>
<!-- <el-button type="text" @click="delDetail(prop.row)"-->
<!-- >移除-->
<!-- </el-button>-->
</template>
</el-table-column>
</el-table>
@ -177,253 +121,572 @@
:limit.sync="detailQuery.limit"
@pagination="getDetailList"
/>
</el-card>
<el-dialog
:title="`编辑巡检计划信息${planData.planId?'--('+planData.name+')':''}`"
:title="planEditTitle"
:visible="true"
v-if="createFlag"
@close="createFlag = false"
width="80%"
>
<el-card>
<div slot="header" class="clearfix">
<div class="fl"><span style="color: red;">* 巡检任务单将于执行周期的00:05分生成</span></div>
<div class="fr">
<el-button v-if="createActive==0" @click="changeActive(true)" type="primary"></el-button>
<el-button v-else @click="changeActive(false)" type="primary">上一步</el-button>
<el-button @click="createFlag = false;query.page=1;getList()">关闭</el-button>
<el-button type="success" v-if="createActive==2" @click="changeActive(false)"></el-button>
</div>
</div>
<div>
<el-steps align-center :active="createActive" finish-status="success" process-status="finish">
<el-step title="基础信息"/>
<el-step title="选择设备"/>
<el-step title="选择巡检项目" :description="createActive==2?itemQuery.title:''"/>
</el-steps>
</div>
<el-form v-if="createActive==0" :model="planData" :rules="formRule" ref="saveForm" label-width="auto">
<el-row :gutter="20">
<el-col>
<el-form-item label="计划名称" prop="name">
<el-input v-model.trim="planData.name" show-word-limit maxlength="100" clearable/>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="负责部门" prop="chargeDeptCode">
<deptSelect :value.sync="planData.chargeDeptCode"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="执行区间" prop="dateInterval">
<el-date-picker
style="width: 100%"
v-model.trim="planData.dateInterval"
type="daterange"
align="right"
editable
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
</el-col>
<el-col>
<el-form-item prop="frequency">
<template slot="label">
执行周期
<el-tooltip class="item" effect="dark" content="执行周期每30天执行一次"
placement="top">
<el-icon class="el-icon-question"/>
</el-tooltip>
</template>
<el-input-number :min="1" :max="999999" v-model.trim="planData.frequency"/>
<span class="ml10"></span>
<span class="ml10">快捷选项</span>
<el-button type="" @click="planData.frequency=30"></el-button>
<el-button type="" @click="planData.frequency=30*3"></el-button>
<el-button type="" @click="planData.frequency=30*6"></el-button>
<el-button type="" @click="planData.frequency=365"></el-button>
<el-button type="" @click="planData.frequency=365*2"></el-button>
<el-button type="" @click="planData.frequency=365*3"></el-button>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="备注">
<el-input type="textarea" v-model.trim="planData.remark" resize="none" :autosize="{minRows:8,maxRows:8}"
show-word-limit maxlength="500" clearable/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-card v-show="createActive==1">
<div slot="header" class="clearfix">
<div class="fr">
<el-button type="primary" @click="chooseDeviceFlag=true"></el-button>
<el-button type="" @click="getDetailList"></el-button>
</div>
</div>
<el-table :data="detailList" v-loading="detailLoading" ref="dialogTable"
:row-key="row=>{return row.productId+'_'+row.planId}"
@row-click="(row)=>{$refs.dialogTable.toggleRowExpansion(row)}" @expand-change="handleExpendRow"
:expandRowKeys="dialogExpandRowKeys">
<el-table-column type="expand">
<template slot-scope="scope">
<el-card class="mb10" v-if="scope.row.detailData">
<el-form :model="scope.row.detailData.query" inline>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="设备编号">
<el-input v-model="scope.row.detailData.query.deviceCode" clearable/>
</el-form-item>
<el-button-group>
<el-button
type="primary"
icon="el-icon-refresh"
@click="onReset"
>重置
</el-button>
<el-button type="primary" icon="el-icon-search"
@click="scope.row.detailData.query.page=1;getRowDetailList(scope.row.detailData)"
>查询
</el-button>
</el-button-group>
</el-col>
</el-row>
</el-form>
<el-table :data="scope.row.detailData.list"
v-loading="scope.row.detailData.loading" row-key="deviceCode">
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="科室名称" prop="deptName"/>
<el-table-column label="设备编号" prop="deviceCode"/>
<el-table-column label="最小销售标识" prop="nameCode"/>
<el-table-column label="名称" prop="productName"/>
<el-table-column label="规格型号" prop="ggxh"/>
<el-table-column label="计量单位" prop="measname"/>
<el-table-column label="生产企业" prop="manufactory"/>
<el-table-column label="注册/备案号" prop="zczbhhzbapzbh"/>
<el-table-column label="操作" width="120">
<template slot-scope="prop">
<el-button type="text" @click="openCreate(prop.row.planId,prop.row,2,true)"
>巡检项目
</el-button>
<el-button type="text" @click="delDetail(prop.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="scope.row.detailData.total>0"
:total="scope.row.detailData.total"
:page.sync="scope.row.detailData.query.page"
:limit.sync="scope.row.detailData.query.limit"
@pagination="getRowDetailList(scope.row.detailData)"
/>
</el-card>
</template>
</el-table-column>
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="最小销售标识" prop="nameCode"/>
<el-table-column label="名称" prop="productName"/>
<el-table-column label="规格型号" prop="ggxh"/>
<el-table-column label="计量单位" prop="measname"/>
<el-table-column label="数量" prop="count"/>
<el-table-column label="生产企业" prop="manufactory"/>
<el-table-column label="注册/备案号" prop="zczbhhzbapzbh"/>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button type="text" @click.stop="changeActive(true,scope.row)"
>巡检项目
</el-button>
<el-button type="text" @click.stop="delDetail(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="detailQuery.page"
:limit.sync="detailQuery.limit"
@pagination="getDetailList"
/>
</el-card>
<el-card v-show="createActive == 2">
<div slot="header" class="clearfix">
<div class="fr">
<el-button type="primary" @click="chooseItemList=[];chooseDetailItemFlag=true"></el-button>
<el-button type="" @click="getDetailItemList"></el-button>
</div>
</div>
<el-table :data="itemList" ref="itemTable" v-loading="itemLoading" row-key="itemCode">
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="项目编码" width="150" prop="itemCode"/>
<el-table-column label="项目名称" width="150" prop="name"/>
<el-table-column label="项目内容" width="500" prop="content"/>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button type="text"
v-if="!itemQuery.deviceCode&&!scope.row.deviceCode || itemQuery.deviceCode&&scope.row.deviceCode"
@click="delDetailItem(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="itemTotal>0"
:total="itemTotal"
:page.sync="itemQuery.page"
:limit.sync="itemQuery.limit"
@pagination="getDetailItemList"
/>
</el-card>
</el-card>
<devicePlanEdit :originData="planData"
:closePlanEdit="closePlanEdit"
:createFlag="createFlag"/>
</el-dialog>
<el-dialog width="80%" title="选择设备"
:visible="true"
v-if="chooseDeviceFlag"
@close="chooseDeviceFlag = false"
<el-dialog
title="编辑巡检项目"
:visible="true"
v-if="projectVisible"
@close="projectVisible = false"
width="80%"
>
<el-card>
<div class="align-right" v-if="chooseDeviceList&&chooseDeviceList.length>0">
<el-button class="mr20" style="font-size: 20px" type="primary" @click="chooseDevice"></el-button>
</div>
<planChooseDevice style="margin: 0" :planId="detailQuery.planId" :selectChangeFunc="deviceSelectChangFunc"/>
</el-card>
<DevicePlanProject style="margin: 0"
:planId="detailQuery.planId"
:projectItem="projectItem"
:closeAddDevice="closeAddDevice"/>
</el-dialog>
<el-dialog width="80%" title="选择巡检项目"
:visible="true"
v-if="chooseDetailItemFlag"
@close="chooseDetailItemFlag = false"
>
<el-card>
<div class="align-right" v-if="chooseItemList&&chooseItemList.length>0">
<el-button class="mr20" style="font-size: 20px" type="primary" @click="chooseDetailItem"></el-button>
</div>
<DeviceCheckItemDict style="margin: 0" :is-choose="true" :selectChangFunc="itemSelectChangFunc"/>
</el-card>
</el-dialog>
</div>
</template>
<script src="./js/devicePlan.js"/>
<script>
import {devicePlanDel, devicePlanInfo, devicePlanPage, devicePlanSave} from "@/api/dev/devicePlanApi";
import {
devicePlanDetailDel,
devicePlanDetailPage, devicePlanDetailDelByDeviceCode
} from "@/api/dev/devicePlanDetailApi";
import {getLoading} from "@/utils";
import product from "@/views/basic/product/product.vue";
import {
devicePlanDetailItemAdd, devicePlanDetailItemByDeviceCodeDel,
devicePlanDetailItemDel,
devicePlanDetailItemPage
} from "@/api/dev/devicePlanDetailItemApi";
import DeviceCheckItemDict from "@/views/dev/deviceCheckItemDict";
import {deviceCheckGenByPlanId} from "@/api/dev/deviceCheckApi";
import DevicePlanProject from "@/views/dev/devicePlanProject";
import devicePlanEdit from "@/views/dev/devicePlanEdit";
let query = {
page: 1,
limit: 10,
name: null,
chargeDeptCode: null,
}
let detailQuery = {
page: 1,
limit: 10,
planId: null,
}
let rowDeltailQuery = {
page: 1,
limit: 10,
planId: null,
productId: null,
}
let itemQuery = {
page: 1,
limit: 10,
planId: null,
productId: null,
}
let planData = {
name: null,
chargeDeptCode: null,
startDate: null,
endDate: null,
frequency: 1,
dateInterval: null,
remark: null,
}
export default {
name: "devicePlan",
components: {DeviceCheckItemDict, product, devicePlanEdit, DevicePlanProject},
computed: {},
data() {
return {
clickRow: null,
showSearch: true,
loading: false,
total: .0,
list: [],
query: {...query},
//=============================================
detailLoading: false,
detailQuery: {...detailQuery},
detailList: [],
detailTotal: 0,
//=============================================
itemQuery: {...itemQuery},
itemList: [],
itemTotal: 0,
itemLoading: false,
chooseDetailItemFlag: false,
chooseDeviceList: [],
chooseItemList: [],
///===================================================
planEditTitle: "新增计划",
createActive: 0,
createFlag: false,
chooseDeviceFlag: false,
expandRowKeys: [],
dialogExpandRowKeys: [],
planData: {...planData},
formRule: {
name: [{required: true, message: "计划名称不能为空", trigger: ["change", "blur"]}],
chargeDeptCode: [{required: true, message: "负责部门不能为空", trigger: ["change", "blur"]}],
dateInterval: [{required: true, message: "计划执行区间不能为空", trigger: ["change", "blur"]}],
frequency: [{
required: true,
message: "计划执行频率不能为空",
trigger: ["change", "blur"]
}],
},
dateInterval: null,
pickerOptions: {
disabledDate: time => {
let nowDate = new Date().getTime();
let pickDate = new Date(time).getTime();
return (nowDate >= pickDate);
},
shortcuts: [{
text: '一个月(30天)',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() + 3600 * 1000 * 24);
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
}, {
text: '三个月(90天)',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() + 3600 * 1000 * 24);
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30 * 3);
picker.$emit('pick', [start, end]);
}
}, {
text: '半年(180天)',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() + 3600 * 1000 * 24);
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30 * 6);
picker.$emit('pick', [start, end]);
}
}, {
text: '一年(365天)',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() + 3600 * 1000 * 24);
end.setTime(start.getTime() + 3600 * 1000 * 24 * 365);
picker.$emit('pick', [start, end]);
}
}]
},
projectVisible: false,
projectItem: null,
}
},
watch: {
planData(v) {
if (v.planId != null) {
this.$set(v, "dateInterval", [v.startDate, v.endDate])
}
},
"planData.dateInterval"(v) {
if (v != null && v.length > 0) {
this.planData.startDate = v[0]
this.planData.endDate = v[1]
}
},
"$refs.dialogTable"(v) {
this.$refs.dialogTable?.doLayout()
}
},
created() {
this.getList()
},
methods: {
handleExpendRow(row, expandedRows) {
if (expandedRows.length == 0) {
return
}
this.$set(row, "detailData", {
loading: false,
showSearch: true,
list: [],
total: 0,
query: {...rowDeltailQuery, planId: row.planId, productId: row.productId}
})
this.getRowDetailList(row.detailData)
},
getRowDetailList(data) {
data.loading = true
devicePlanDetailPage(data.query).then(res => {
data.loading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
data.list = res.data.list || []
data.total = res.data.total || 0
}).catch(() => {
data.loading = false
data.list = []
data.total = 0
})
},
deviceCheckGenFunc(row) {
this.$confirm("此操作将会创建一个任务单,是否继续", "提示", {
confirmButtonText: "继续",
cancelButtonText: "取消"
}).then(() => {
let load = getLoading(this)
deviceCheckGenByPlanId(row.planId).then(res => {
load.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.getList()
}).catch(() => {
load.close()
})
})
},
delplan(row) {
this.$confirm("此操作将会永久删除该计划,现有任务不受影响,是否继续", "提示", {
confirmButtonText: "继续",
cancelButtonText: "取消"
}).then(() => {
let load = getLoading(this)
devicePlanDel(row.planId).then(res => {
load.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.query.page = 1
this.getList()
if (this.clickRow && this.clickRow.planId == row.planId) {
this.clickRow = null
this.detailTotal = 0
this.detailList = []
}
}).catch(() => {
load.close()
})
})
},
openItem(row) {
this.itemQuery = {
...itemQuery,
planId: row.planId,
productId: row.productId,
deviceCode: row.deviceCode,
title: `${row.deviceCode ? row.deviceCode + '--' : ''}${row.productName}(${row.nameCode})`
}
this.getDetailItemList()
},
getDetailItemList() {
this.itemLoading = true
devicePlanDetailItemPage(this.itemQuery).then(res => {
this.itemLoading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.itemList = res.data.list || []
this.itemTotal = res.data.total || 0
}).catch(e => {
this.itemList = []
this.itemTotal = 0
this.itemLoading = false
})
},
delDetailItem(row) {
this.$confirm("此操作将会永久删除该条明细,且将在下一次任务生效,现有任务不受影响,是否继续", "提示", {
confirmButtonText: "继续",
cancelButtonText: "取消"
}).then(() => {
let load = getLoading(this)
if (!row.deviceCode) {
devicePlanDetailItemDel(row.planId, row.productId, row.itemCode).then(res => {
load.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.itemQuery.page = 1
this.getDetailItemList()
}).catch(() => {
load.close()
})
} else {
devicePlanDetailItemByDeviceCodeDel(row.planId, row.deviceCode, row.itemCode).then(res => {
load.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.itemQuery.page = 1
this.getDetailItemList()
}).catch(() => {
load.close()
})
}
})
},
delDetail(row) {
this.$confirm("此操作将会永久删除该条明细,且将在下一次任务生效,现有任务不受影响,是否继续", "提示", {
confirmButtonText: "继续",
cancelButtonText: "取消"
}).then(() => {
let load = getLoading(this)
if (row.deviceCode) {
devicePlanDetailDelByDeviceCode(row.planId, row.deviceCode).then(res => {
load.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.detailQuery.page = 1
this.getDetailList()
}).catch(() => {
load.close()
})
} else {
devicePlanDetailDel(row.planId, row.productId).then(res => {
load.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.detailQuery.page = 1
this.getDetailList()
}).catch(() => {
load.close()
})
}
})
},
rowClick(row) {
this.clickRow = row
this.detailQuery = {...detailQuery, planId: row.planId}
this.getDetailList()
},
getDetailList() {
this.detailLoading = true
this.expandRowKeys = []
this.dialogExpandRowKeys = []
devicePlanDetailPage(this.detailQuery).then(res => {
this.detailLoading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.detailList = res.data.list || []
this.detailTotal = res.data.total || 0
}).catch(e => {
this.detailList = []
this.detailTotal = 0
this.detailLoading = false
})
},
changeActive(isNext, row) {
let load = getLoading(this)
if (isNext) {
if (this.createActive == 0) {
this.$refs.saveForm.validate(b => {
if (!b) {
load.close()
return
}
devicePlanSave(this.planData).then(res => {
load.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.planData.planId = res.data
this.detailQuery = {...detailQuery, planId: this.planData.planId}
this.getDetailList()
this.createActive += 1
}).catch(e => {
load.close()
})
})
} else if (this.createActive == 1) {
this.openItem(row)
load.close()
this.createActive += 1
}
} else {
if (this.createActive == 2) {
this.planData = {...this.planData}
this.detailQuery = {...detailQuery, planId: this.itemQuery.planId}
this.getDetailList()
load.close()
this.createActive -= 1
} else if (this.createActive == 1) {
devicePlanInfo(this.planData.planId).then(res => {
load.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.planData = {...res.data}
this.createActive -= 1
}).catch(e => {
load.close()
})
}
}
load.close()
},
itemSelectChangFunc(list) {
this.chooseItemList = list.map(i => i.code)
},
chooseDetailItem() {
let loading = getLoading(this)
let param = {
planId: this.itemQuery.planId,
productId: this.itemQuery.productId,
deviceCode: this.itemQuery.deviceCode,
itemCodes: this.chooseItemList
}
devicePlanDetailItemAdd(param).then(res => {
loading.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.chooseItemList = []
this.$message.success(res.message)
this.chooseDetailItemFlag = false
this.itemQuery.page = 1
this.getDetailItemList()
}).catch(e => {
loading.close()
})
},
closePlanEdit() {
this.createFlag = false;
this.getList()
},
deviceSelectChangFunc(list) {
this.chooseDeviceList = list.map(i => i.deviceCode)
},
//
openCreate(planId, row) {
if (planId != null) {
this.planEditTitle = `编辑巡检计划信息${row.planId ? '--(' + row.name + ')' : ''}`;
this.planData = row;
} else {
this.planEditTitle = "新增计划";
this.planData = {};
}
this.createFlag = true;
// this.createActive = 0
// if (createActive != null) {
// this.createActive = createActive
// }
// if (planId != null) {
// devicePlanInfo(planId).then(res => {
// if (res.code != 20000) {
// this.$message.error(res.message)
// return
// }
// this.planData = {...res.data}
// this.createFlag = true
// if (createActive == 1) {
// this.detailQuery = {...detailQuery, planId: planId}
// this.getDetailList()
// } else if (createActive == 2) {
// this.itemQuery = {
// ...detailQuery,
// planId: planId,
// productId: row.productId,
// deviceCode: row.deviceCode,
// title: `${row.deviceCode ? row.deviceCode + '--' : ''}${row.productName}(${row.nameCode})`
// }
// this.getDetailItemList()
// }
// })
// } else {
// this.planData = {...planData}
// this.createFlag = true
// }
},
search() {
this.query.page = 1
this.getList()
},
onReset() {
this.query = {...query}
this.getList()
},
getList() {
this.loading = true
devicePlanPage(this.query).then(res => {
this.loading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.list = res.data.list || []
this.total = res.data.total || 0
}).catch(e => {
this.loading = false
})
},
setProject(row) {
this.projectVisible = true
this.projectItem = row
},
}
}
</script>
<style scoped>

@ -0,0 +1,387 @@
<template>
<div>
<el-card>
<div slot="header" class="clearfix">
<div class="fr">
<el-button size="mini" type="primary" @click.native="saveOrder(1)"
>草稿保存
</el-button>
<el-button size="mini" type="primary" @click.native="saveOrder(2)"
>立即提交
</el-button>
</div>
</div>
<el-form :model="planData" :rules="formRule" ref="dataForm" label-width="auto">
<el-row :gutter="20">
<el-col :span="11">
<el-form-item label="计划名称" prop="name">
<el-input v-model.trim="planData.name" show-word-limit maxlength="100" clearable/>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="负责部门" prop="chargeDeptCode">
<deptSelect :value.sync="planData.chargeDeptCode"/>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="执行区间" prop="dateInterval">
<el-date-picker
style="width: 100%"
v-model.trim="planData.dateInterval"
type="daterange"
align="right"
editable
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item prop="frequency">
<template slot="label">
执行频率
</template>
<el-input-number :min="1" :max="999999" v-model.trim="planData.frequency"/>
<span class="ml10">
<el-tooltip class="item" effect="dark" content="执行频率每30天执行一次"
placement="top">
<el-icon class="el-icon-question"/>
</el-tooltip></span>
<!-- <span class="ml10">快捷选项</span>-->
<!-- <el-button type="" @click="planData.frequency=30"></el-button>-->
<!-- <el-button type="" @click="planData.frequency=30*3"></el-button>-->
<!-- <el-button type="" @click="planData.frequency=30*6"></el-button>-->
<!-- <el-button type="" @click="planData.frequency=365"></el-button>-->
<!-- <el-button type="" @click="planData.frequency=365*2"></el-button>-->
<!-- <el-button type="" @click="planData.frequency=365*3"></el-button>-->
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="备注">
<el-input type="textarea" v-model.trim="planData.remark" resize="none" :autosize="{minRows:1,maxRows:8}"
show-word-limit maxlength="500" clearable/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card>
<div slot="header" class="clearfix">
<div class="fr">
<el-button type="primary" @click="addDevice()"></el-button>
<el-button type="primary" @click="batchSetProject()"></el-button>
<el-button type="" @click="getDetailList"></el-button>
</div>
</div>
<el-table :data="detailList" v-loading="detailLoading" click-row-light
highlight-current-row>
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="科室名称" prop="deptName"/>
<el-table-column label="设备编号" prop="deviceCode"/>
<el-table-column label="最小销售标识" prop="nameCode"/>
<el-table-column label="名称" prop="productName"/>
<el-table-column label="规格型号" prop="ggxh"/>
<el-table-column label="计量单位" prop="measname"/>
<el-table-column label="生产企业" prop="manufactory"/>
<el-table-column label="注册/备案号" prop="zczbhhzbapzbh"/>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button type="text" @click="setProject(scope.row)"
>巡检项目
</el-button>
<el-button type="text" @click="delProject(scope.row)"
>移除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="detailQuery.page"
:limit.sync="detailQuery.limit"
@pagination="getDetailList"
/>
</el-card>
<el-dialog
title="添加设备"
:visible="true"
v-if="chooseDeviceFlag"
@close="chooseDeviceFlag = false"
width="80%"
>
<DeviceAdd style="margin: 0"
:planId="detailQuery.planId"
:planData="planData"
:closeAddDevice="closeAddDevice"/>
</el-dialog>
<el-dialog
title="编辑巡检项目"
:visible="true"
v-if="projectVisible"
@close="projectVisible = false"
width="80%"
>
<DevicePlanProject style="margin: 0"
:planId="detailQuery.planId"
:projectItem="projectItem"
:closeAddDevice="closeAddDevice"/>
</el-dialog>
<el-dialog
title="批量设置巡检项目"
:visible="true"
v-if="chooseDetailItemFlag"
@close="chooseDetailItemFlag = false"
width="80%"
>
<deviceProjectAdd style="margin: 0"
:planId="planData.planId"
:type="2"
:closeAddDevice="closeBatchSetProject"/>
</el-dialog>
</div>
</template>
<script>
import {
devicePlanDetailAdd, devicePlanDetailDel,
devicePlanDetailDelByDeviceCode,
devicePlanDetailPage
} from "@/api/dev/devicePlanDetailApi";
import {getLoading} from "@/utils";
import DeviceAdd from "@/views/dev/deviceAdd";
import {devicePlanDetailItemAdd} from "@/api/dev/devicePlanDetailItemApi";
import DevicePlanProject from "@/views/dev/devicePlanProject";
import {devicePlanSave} from "@/api/dev/devicePlanApi";
import deviceProjectAdd from "@/views/dev/deviceProjectAdd";
export default {
name: "devicePlanEdit",
components: {DevicePlanProject, DeviceAdd, deviceProjectAdd},
props: {
originData: {
type: Object,
required: true
},
closePlanEdit: {required: false, type: Function}
},
data() {
return {
planData: {},
formRule: {
name: [{required: true, message: "计划名称不能为空", trigger: ["change", "blur"]}],
chargeDeptCode: [{required: true, message: "负责部门不能为空", trigger: ["change", "blur"]}],
dateInterval: [{required: true, message: "计划执行区间不能为空", trigger: ["change", "blur"]}],
frequency: [{
required: true,
message: "计划执行频率不能为空",
trigger: ["change", "blur"]
}],
},
detailList: [],
detailTotal: 0,
detailQuery: {},
detailLoading: false,
chooseDeviceList: [],
chooseDeviceFlag: false,
pickerOptions: {
disabledDate: time => {
let nowDate = new Date().getTime();
let pickDate = new Date(time).getTime();
return (nowDate >= pickDate);
},
shortcuts: [{
text: '一个月(30天)',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() + 3600 * 1000 * 24);
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
}, {
text: '三个月(90天)',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() + 3600 * 1000 * 24);
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30 * 3);
picker.$emit('pick', [start, end]);
}
}, {
text: '半年(180天)',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() + 3600 * 1000 * 24);
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30 * 6);
picker.$emit('pick', [start, end]);
}
}, {
text: '一年(365天)',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() + 3600 * 1000 * 24);
end.setTime(start.getTime() + 3600 * 1000 * 24 * 365);
picker.$emit('pick', [start, end]);
}
}]
},
chooseItemList: [],
//
projectVisible: false,
projectItem: null,
chooseDetailItemFlag: false,
}
},
methods: {
getDetailList() {
this.detailLoading = true
devicePlanDetailPage(this.detailQuery).then(res => {
this.detailLoading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.detailList = res.data.list || []
this.detailTotal = res.data.total || 0
}).catch(e => {
this.detailList = []
this.detailTotal = 0
this.detailLoading = false
})
},
addDevice() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
this.chooseDeviceFlag = true
}
});
},
closeAddDevice(data) {
this.chooseDeviceFlag = false
this.planData = data
this.getDetailList()
},
batchSetProject() {
this.chooseDetailItemFlag = true;
},
closeBatchSetProject() {
this.chooseDetailItemFlag = false;
},
setProject(row) {
this.projectVisible = true
this.projectItem = row
},
delProject(row) {
this.$confirm("此操作将会永久删除该条明细,且将在下一次任务生效,现有任务不受影响,是否继续", "提示", {
confirmButtonText: "继续",
cancelButtonText: "取消"
}).then(() => {
let load = getLoading(this)
devicePlanDetailDelByDeviceCode(row.planId, row.deviceCode).then(res => {
load.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.detailQuery.page = 1
this.getDetailList()
}).catch(() => {
load.close()
})
})
},
saveOrder(status) {
this.planData.status = status;
devicePlanSave(this.planData).then(res => {
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.closePlanEdit();
this.$message.success("保存成功!")
}).catch(e => {
})
},
chooseDevice(multiData) {
let loading = getLoading(this)
let param = {
planId: this.planData.planId,
deviceCodes: multiData
}
devicePlanDetailAdd(param).then(res => {
loading.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.chooseDeviceList = []
this.$message.success(res.message)
this.chooseDeviceFlag = false
this.detailQuery.page = 1
this.getDetailList()
}).catch(e => {
loading.close()
})
},
},
created() {
if (this.originData != null) {
this.planData = this.originData;
}
this.detailQuery = {
planId: this.planData.planId,
page: 1,
limit: 10
}
this.getDetailList()
},
watch: {
planData(v) {
if (v.planId != null) {
this.$set(v, "dateInterval", [v.startDate, v.endDate])
}
},
"planData.dateInterval"(v) {
if (v != null && v.length > 0) {
this.planData.startDate = v[0]
this.planData.endDate = v[1]
}
},
"$refs.dialogTable"(v) {
this.$refs.dialogTable?.doLayout()
}
},
}
</script>
<style scoped>
</style>

@ -0,0 +1,175 @@
<template>
<div>
<el-card>
<div slot="header" class="clearfix">
<div class="fr">
<el-button type="primary" @click="chooseItemList=[];chooseDetailItemFlag=true"></el-button>
<el-button type="" @click="getDetailItemList"></el-button>
</div>
</div>
<el-table :data="itemList" ref="itemTable" v-loading="itemLoading" row-key="itemCode">
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="项目编码" width="150" prop="itemCode"/>
<el-table-column label="项目名称" width="200" prop="name"/>
<el-table-column label="项目内容" width="250" prop="content"/>
<el-table-column label="操作" width="150">
<template slot-scope="scope">
<el-button type="text"
@click="delDetailItem(scope.row)"
>移除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- <pagination-->
<!-- v-show="itemTotal>0"-->
<!-- :total="itemTotal"-->
<!-- :page.sync="itemQuery.page"-->
<!-- :limit.sync="itemQuery.limit"-->
<!-- @pagination="getDetailItemList"-->
<!-- />-->
</el-card>
<el-dialog
title="添加巡检项目"
:visible="true"
v-if="chooseDetailItemFlag"
@close="chooseDetailItemFlag = false"
width="80%"
>
<deviceProjectAdd style="margin: 0"
:planId="projectItem.planId"
:projectItem="projectItem"
:closeAddDevice="closeAddDevice"/>
</el-dialog>
</div>
</template>
<script>
import {
devicePlanDetailItemAdd,
devicePlanDetailItemByDeviceCodeDel,
devicePlanDetailItemDel,
devicePlanDetailItemPage
} from "@/api/dev/devicePlanDetailItemApi";
import {getLoading} from "@/utils";
import deviceProjectAdd from "@/views/dev/deviceProjectAdd";
export default {
name: "devicePlanProject",
props: {
projectItem: {
type: Object,
required: true
},
planId: {
type: Object,
required: true
},
},
data() {
return {
itemList: [],
itemTotal: 0,
itemLoading: false,
itemQuery: {
planId: null,
page: 1,
limit: 10,
deviceCode: '',
itemCode: '',
name: '',
content: '',
},
chooseItemList: [],
chooseDetailItemFlag: false,
}
},
methods: {
getDetailItemList() {
this.itemLoading = true
this.itemQuery.deviceCode = this.projectItem.deviceCode
this.itemQuery.planId = this.projectItem.planId
devicePlanDetailItemPage(this.itemQuery).then(res => {
this.itemLoading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.itemList = res.data.list || []
this.itemTotal = res.data.total || 0
}).catch(e => {
this.itemList = []
this.itemTotal = 0
this.itemLoading = false
})
},
delDetailItem(row) {
this.$confirm("此操作将会永久删除该条明细,且将在下一次任务生效,现有任务不受影响,是否继续", "提示", {
confirmButtonText: "继续",
cancelButtonText: "取消"
}).then(() => {
let load = getLoading(this)
devicePlanDetailItemByDeviceCodeDel(row.planId, row.deviceCode, row.itemCode).then(res => {
load.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.itemQuery.page = 1
this.getDetailItemList()
}).catch(() => {
load.close()
})
})
},
chooseDetailItem() {
let loading = getLoading(this)
let param = {
planId: this.itemQuery.planId,
productId: this.itemQuery.productId,
deviceCode: this.itemQuery.deviceCode,
itemCodes: this.chooseItemList
}
devicePlanDetailItemAdd(param).then(res => {
loading.close()
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.chooseItemList = []
this.$message.success(res.message)
this.chooseDetailItemFlag = false
this.itemQuery.page = 1
this.getDetailItemList()
}).catch(e => {
loading.close()
})
},
itemSelectChangFunc(list) {
this.chooseItemList = list.map(i => i.code)
},
closeAddDevice() {
this.chooseDetailItemFlag = false;
this.getDetailItemList()
},
},
created() {
this.getDetailItemList()
},
components: {
deviceProjectAdd
}
,
}
</script>
<style scoped>
</style>

@ -0,0 +1,219 @@
<template>
<div>
<el-card>
<el-form :model="query" v-if="showSearch" label-width="auto">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="项目编码">
<el-input v-model="query.code" clearable/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="项目名称">
<el-input v-model="query.name" clearable/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn">
<el-button-group>
<el-button icon="el-icon-view" type="primary" @click="showSearch = !showSearch">显示/隐藏搜索栏</el-button>
<el-button
type="primary"
icon="el-icon-refresh"
@click="onReset"
>重置
</el-button>
<el-button type="primary" icon="el-icon-search" @click="search"
>查询
</el-button>
<el-button type="primary" icon="el-icon-plus" @click="combine"
>选入
</el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table :data="list"
v-loading="loading" ref="table"
click-row-light>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="项目编码" width="150" prop="code"/>
<el-table-column label="项目名称" width="200" prop="name"/>
<el-table-column label="项目内容" width="250" prop="content"/>
<el-table-column label="创建人" width="120" prop="createUserName"/>
<el-table-column label="创建时间" width="140" prop="createTime"/>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="query.page"
:limit.sync="query.limit"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import {
deviceCheckItemDictPage,
} from "@/api/dev/deviceCheckItemDictApi";
import {devicePlanDetailItemAdd, devicePlanDetailItemBatchAdd} from "@/api/dev/devicePlanDetailItemApi";
import {getLoading} from "@/utils";
import {devicePlanDetailDelByDeviceCode} from "@/api/dev/devicePlanDetailApi";
let query = {
page: 1,
limit: 10,
name: null,
code: null,
}
let saveData = {
code: null,
name: null,
content: null,
}
export default {
name: "deviceCheckItemDict",
props: {
projectItem: {
type: Object,
required: true
},
planId: {
type: Object,
required: true
},
type: {
type: Object,
required: true
},
isChoose: {required: false, default: false, type: Boolean},
closeAddDevice: {required: false, type: Function}
},
data() {
return {
showSearch: true,
loading: false,
total: .0,
list: [],
query: {...query},
createFlag: false,
saveData: {...saveData},
formRule: {
code: [{required: true, message: "项目编码不能为空", trigger: "change"}],
name: [{required: true, message: "项目名称不能为空", trigger: "change"}],
content: [{required: true, message: "项目内容不能为空", trigger: "change"}]
},
chooseItemList: [],
}
},
created() {
this.getList()
},
methods: {
search() {
this.query.page = 1
this.getList()
},
onReset() {
this.query = {...query}
this.getList()
},
getList() {
this.loading = true
deviceCheckItemDictPage(this.query).then(res => {
this.loading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.list = res.data.list || []
this.total = res.data.total || 0
}).catch(e => {
this.loading = false
})
},
combine() {
let selectList = this.$refs.table.selection
if (selectList.length == 0) {
this.$message.error("请选择巡检项目")
return
}
if (this.type == 2) {
this.$confirm("此操作将会批量添加或覆盖该计划下所有设备巡检项目,是否继续", "提示", {
confirmButtonText: "继续",
cancelButtonText: "取消"
}).then(() => {
this.addProject()
})
} else {
this.addProject()
}
},
addProject() {
let selectList = this.$refs.table.selection
if (selectList.length == 0) {
this.$message.error("请选择巡检项目")
return
}
this.chooseItemList = selectList.map(item => item.code)
if (this.type == 2) {
let param = {
planId: this.planId,
itemCodes: this.chooseItemList
}
devicePlanDetailItemBatchAdd(param).then(res => {
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.closeAddDevice()
}).catch(e => {
})
} else {
let param = {
planId: this.projectItem.planId,
productId: this.projectItem.productId,
deviceCode: this.projectItem.deviceCode,
itemCodes: this.chooseItemList
}
devicePlanDetailItemAdd(param).then(res => {
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.closeAddDevice()
}).catch(e => {
})
}
},
}
}
</script>
<style scoped>
/deep/ .el-dialog__body {
padding: 0 0 20px 0;
}
</style>

@ -370,7 +370,7 @@ export default {
this.detailLoading = true
this.expandRowKeys = []
this.dialogExpandRowKeys = []
devicePlanDetailGroupPage(this.detailQuery).then(res => {
devicePlanDetailPage(this.detailQuery).then(res => {
this.detailLoading = false
if (res.code != 20000) {
this.$message.error(res.message)
@ -490,36 +490,41 @@ export default {
})
},
openCreate(planId, row, createActive) {
this.createActive = 0
if (createActive != null) {
this.createActive = createActive
}
if (planId != null) {
devicePlanInfo(planId).then(res => {
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.planData = {...res.data}
this.createFlag = true
if (createActive == 1) {
this.detailQuery = {...detailQuery, planId: planId}
this.getDetailList()
} else if (createActive == 2) {
this.itemQuery = {
...detailQuery,
planId: planId,
productId: row.productId,
deviceCode: row.deviceCode,
title: `${row.deviceCode ? row.deviceCode + '--' : ''}${row.productName}(${row.nameCode})`
}
this.getDetailItemList()
}
})
} else {
this.planData = {...planData}
this.createFlag = true
}
// this.createActive = 0
// if (createActive != null) {
// this.createActive = createActive
// }
// if (planId != null) {
// devicePlanInfo(planId).then(res => {
// if (res.code != 20000) {
// this.$message.error(res.message)
// return
// }
// this.planData = {...res.data}
// this.createFlag = true
// if (createActive == 1) {
// this.detailQuery = {...detailQuery, planId: planId}
// this.getDetailList()
// } else if (createActive == 2) {
// this.itemQuery = {
// ...detailQuery,
// planId: planId,
// productId: row.productId,
// deviceCode: row.deviceCode,
// title: `${row.deviceCode ? row.deviceCode + '--' : ''}${row.productName}(${row.nameCode})`
// }
// this.getDetailItemList()
// }
// })
// } else {
// this.planData = {...planData}
// this.createFlag = true
// }
},
search() {
this.query.page = 1

@ -24,6 +24,8 @@
placeholder="账号"
name="username"
autocomplete="on"
readonly
onfocus="this.removeAttribute('readonly');"
v-model="loginForm.username"
>
<i slot="prefix" class="el-input__icon">

Loading…
Cancel
Save