lining пре 6 година
родитељ
комит
93486d0ed8

+ 142 - 0
src/dashoo.cn/backend/api/controllers/lims/limscheckequipmentlist.go

@@ -356,3 +356,145 @@ func (this *LimsCheckEquipmentListController) DeleteEntity() {
 		this.ServeJSON()
 	}
 }
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object} []limscheckequipmentlist.LimsCheckEquipmentList
+// @router /warninglist [get]
+func (this *LimsCheckEquipmentListController) GetEntityWarningList() {
+
+	//获取分页信息
+	page := this.GetPageInfoForm()
+	where := " 1=1 "
+	orderby := "Id"
+	asc := false
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		}
+	}
+	Id := this.GetString("Id")
+	DepartmentId := this.GetString("DepartmentId")
+	OrderNo := this.GetString("OrderNo")
+	PositionCheckId := this.GetString("PositionCheckId")
+	PositionCheck := this.GetString("PositionCheck")
+	PositionID := this.GetString("PositionID")
+	Position := this.GetString("Position")
+	CustNo := this.GetString("CustNo")
+	Spec := this.GetString("Spec")
+	SpecId := this.GetString("SpecId")
+	Manufacturer := this.GetString("Manufacturer")
+	status := this.GetString("Status")
+
+	TemplateTypeId := this.GetString("TemplateTypeId")
+	PositionAllTypeId := this.GetString("PositionAllTypeId")
+	QueryCheckDate := this.GetString("QueryCheckDate")
+
+	if Id != "" {
+		where = where + " and Id like '%" + Id + "%'"
+	}
+
+	if DepartmentId != "" {
+		where = where + " and DepartmentId like '%" + DepartmentId + "%'"
+	}
+
+	if PositionAllTypeId != "" {
+		where = where + " and (PositionCheckId = '" + PositionAllTypeId + "' or PositionID = '" + PositionAllTypeId + "')"
+	}
+
+	if OrderNo != "" {
+		where = where + " and OrderNo like '%" + OrderNo + "%'"
+	}
+
+	if PositionCheckId != "" {
+		where = where + " and PositionCheckId = '" + PositionCheckId + "'"
+	}
+
+	if TemplateTypeId != "" {
+		where = where + " and TemplateTypeId = '" + TemplateTypeId + "'"
+	}
+
+	if PositionCheck != "" {
+		where = where + " and PositionCheck like '%" + PositionCheck + "%'"
+	}
+
+	if PositionID != "" {
+		where = where + " and PositionID = '" + PositionID + "'"
+	}
+
+	if Position != "" {
+		where = where + " and Position like '%" + Position + "%'"
+	}
+
+	if CustNo != "" {
+		where = where + " and CustNo like '%" + CustNo + "%'"
+	}
+
+	if Spec != "" {
+		where = where + " and Spec like '%" + Spec + "%'"
+	}
+
+	if SpecId != "" {
+		where = where + " and SpecId like '%" + SpecId + "%'"
+	}
+
+	if Manufacturer != "" {
+		where = where + " and Manufacturer like '%" + Manufacturer + "%'"
+	}
+
+	if status != "" {
+		where = where + " and Status like '%" + status + "%'"
+	}
+
+	if QueryCheckDate != "" {
+		where = where + " and  date_add(LastCheckDate, interval " + QueryCheckDate + " month) >= now()"
+	}
+	// 把安装位置取出来
+	strPositionList := ""
+	orgSvc := organize.GetOrganizeService(utils.DBE)
+	positionSvc := limscustomerposition.GetLimsCustomerpositionService(utils.DBE)
+	if this.User.UintThirdId > 0 {
+		var entitys []limscustomerposition.LimsCustomerPosition
+		entitys = positionSvc.GetPositionCheckList( this.User.AccCode + LimsCustomerpositionName, strconv.Itoa(this.User.UintThirdId) )
+		for _, value := range entitys {
+			strPositionList += strconv.Itoa(value.Id) + ","
+		}
+		strPositionList += "0"
+	} else if this.User.UnitId > 0 {
+		orgEntityList := orgSvc.GetAllThirdChildByTopId(strconv.Itoa(this.User.UnitId), this.User.Id)
+		//取消3级单位ID列表
+		thrOrgList := ""
+		for _, orgValue := range orgEntityList {
+			thrOrgList += strconv.Itoa(orgValue.Id) + ","
+		}
+		thrOrgList += "0"
+		var entitys []limscustomerposition.LimsCustomerPosition
+		entitys = positionSvc.GetPositionCheckList( this.User.AccCode + LimsCustomerpositionName, thrOrgList )
+		for _, value := range entitys {
+			strPositionList += strconv.Itoa(value.Id) + ","
+		}
+		strPositionList += "0"
+	}
+
+	if len(strPositionList) > 0 {
+		where = where + " and PositionCheckId in ('" + strPositionList + "')"
+	}
+
+	svc := limscheckequipmentlist.GetLimsCheckEquipmentListService(utils.DBE)
+	var list []limscheckequipmentlist.LimsCheckEquipmentList
+
+	where = where + " and CASE WHEN CycleUnit ='年' THEN DATE_ADD(LastCheckDate , INTERVAL Cycle YEAR) < NOW() || DATE_ADD(LastCheckDate , INTERVAL Cycle YEAR) < DATE_ADD(NOW(),INTERVAL 1 MONTH) " +
+		           "WHEN CycleUnit ='月' THEN DATE_ADD(LastCheckDate , INTERVAL Cycle MONTH) < NOW() || DATE_ADD(LastCheckDate , INTERVAL Cycle MONTH) < DATE_ADD(NOW(),INTERVAL 1 MONTH)" +
+					"WHEN CycleUnit ='天' THEN DATE_ADD(LastCheckDate , INTERVAL Cycle DAY) < NOW() || DATE_ADD(LastCheckDate , INTERVAL Cycle DAY) < DATE_ADD(NOW(),INTERVAL 1 MONTH) ELSE FALSE END"
+	total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, orderby, asc, &list, where)
+	var datainfo DataInfo
+	datainfo.Items = list
+	datainfo.CurrentItemCount = total
+	datainfo.PageIndex = page.CurrentPage
+	datainfo.ItemsPerPage = page.Size
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}

+ 7 - 0
src/dashoo.cn/frontend_web/src/api/lims/limscheckequipmentlist.js

@@ -38,4 +38,11 @@ export default {
       method: 'delete'
     })
   },
+  getWarningList (CreateOn, params, myAxios) {
+    return myAxios({
+      url: '/limscheckequipmentlist/warninglist?CreateOn=' + CreateOn,
+      method: 'GET',
+      params: params
+    })
+  }
 }

+ 24 - 25
src/dashoo.cn/frontend_web/src/pages/lims/checkequipmentlist/index.vue

@@ -393,11 +393,11 @@
           Order: this.Column.Order,
           Prop: this.Column.Prop,
           TemplateTypeId: this.QueryProjectTypeId + '',
-          PositionAllTypeId: this.selectNodeId + '',
+          PositionAllTypeId: this.selectNodeId + ''
         }
         let myCreateOn = []
         // 解析时间
-        if (this.CreateOn && this.CreateOn.length == 2) {
+        if (this.CreateOn && this.CreateOn.length === 2) {
           this.CreateOn[1].setHours(23)
           this.CreateOn[1].setMinutes(59)
           this.CreateOn[1].setSeconds(59)
@@ -426,17 +426,17 @@
       },
 
       searchCommand (command) {
-        if (command == 'search') {
+        if (command === 'search') {
           this.dialogVisible = true
-        } else if (command == 'clear') {
+        } else if (command === 'clear') {
           this.clearSearch()
         }
       },
       // 列表排序功能
       orderby (column) {
-        if (column.order == 'ascending') {
+        if (column.order === 'ascending') {
           this.Column.Order = 'asc'
-        } else if (column.order == 'descending') {
+        } else if (column.order === 'descending') {
           this.Column.Order = 'desc'
         }
         this.Column.Prop = column.prop
@@ -444,14 +444,14 @@
       },
       clearSearch () {
         Object.assign(this.searchForm, this.searchFormReset)
-      //this.searchForm = this.searchFormReset;
-      this.CreateOn = ''
+        // this.searchForm = this.searchFormReset;
+        this.CreateOn = ''
         this.initDatas()
       },
       handleSearch () {
         this.currentPage = 1
-      this.dialogVisible = false
-      this.initDatas()
+        this.dialogVisible = false
+        this.initDatas()
       },
       handleCurrentChange (value) {
         this.currentPage = value
@@ -473,24 +473,23 @@
       },
       deleteEntity (row) {
         row.deleteConfirmFlag = false
-      api.deleteEntity(row.Id, this.$axios).then(res => {
+        api.deleteEntity(row.Id, this.$axios).then(res => {
           if (res.data.code === 0) {
             this.initDatas()
             this.$message({
               type: 'success',
               message: res.data.message
             })
-
-        } else {
+          } else {
             this.$message({
               type: 'warning',
               message: res.data.message
             })
-        }
+          }
         }).catch(err => {
           console.error(err)
         })
-    },
+      },
 
       // 设备类型
       getProjectType () {
@@ -520,7 +519,7 @@
         positionApi.customerPositionTree(params, this.$axios).then(res => {
           this.customerTreeList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId',
             'Id,CustomerId,ParentId,PositionName,PositionCode,PositionType,PositionTypeId')
-      })
+        })
           .catch(err => {
             // handle error
             console.error(err)
@@ -553,15 +552,15 @@
 
       formatDateTime (date) {
         var y = date.getFullYear()
-      var m = date.getMonth() + 1
-      m = m < 10 ? ('0' + m) : m
-      var d = date.getDate()
-      d = d < 10 ? ('0' + d) : d
-      var h = date.getHours()
-      var minute = date.getMinutes()
-      minute = minute < 10 ? ('0' + minute) : minute
-      return y + '-' + m + '-' + d + ' ' + h + ':' + minute
-    },
+        var m = date.getMonth() + 1
+        m = m < 10 ? ('0' + m) : m
+        var d = date.getDate()
+        d = d < 10 ? ('0' + d) : d
+        var h = date.getHours()
+        var minute = date.getMinutes()
+        minute = minute < 10 ? ('0' + minute) : minute
+        return y + '-' + m + '-' + d + ' ' + h + ':' + minute
+      },
 
       NewEntity () {
         this.dialogFormVisible = true

+ 707 - 0
src/dashoo.cn/frontend_web/src/pages/lims/checkequipmentlist/warning.vue

@@ -0,0 +1,707 @@
+<template>
+  <div>
+    <!--<el-breadcrumb class="heading">
+      <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
+      <el-breadcrumb-item :to="{ path: '/lims/s5ovelimscheckequipmentlist' }">二级单位设备台账表</el-breadcrumb-item>
+    </el-breadcrumb>-->
+    <el-row :gutter="20">
+      <el-col :span="6">
+        <el-tree style="height: calc(100vh - 243px); overflow: auto;" draggable highlight-current :expand-on-click-node="true" node-key="id" :data="customerTreeList" :props="orgtreeprops"
+                  @node-click="orgtreeNodeClick" ref="orgmanagetree">
+        </el-tree>
+      </el-col>
+      <el-col :span="18">
+        <el-card class="box-card" style="height: calc(100vh - 90px);">
+          <div slot="header">
+        <span>
+          <i class="icon icon-table2"></i> 设备台账
+        </span>
+            <span style="float: right;">
+          <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="NewEntity">添加</el-button>
+        </span>
+            <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
+              <el-form-item label="生成时间">
+                <el-date-picker size="mini" style="width: 220px" v-model="CreateOn" type="daterange" range-separator="至"
+                                start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
+              </el-form-item>
+
+              <el-form-item label="设备分类">
+                <el-select ref="refQueryProjectType" style="margin-right:10px; margin-top: -4px;" size="mini" v-model="QueryProjectTypeId" clearable filterable placeholder="按设备分类查询" @change="ProjectTypeChangeHandler" @clear="ProjectTypeClearHandler">
+                  <el-option v-for="item in projectTypeList" :key="item.id" :label="item.FullName" :value="item.Id"></el-option>
+                </el-select>
+              </el-form-item>
+
+              <el-form-item>
+                <el-dropdown split-button type="primary" size="mini" @click="handleSearch" @command="searchCommand">
+                  查询
+                  <el-dropdown-menu slot="dropdown">
+                    <el-dropdown-item command="search">高级查询</el-dropdown-item>
+                    <el-dropdown-item command="clear">查询重置</el-dropdown-item>
+                  </el-dropdown-menu>
+                </el-dropdown>
+              </el-form-item>
+            </el-form>
+          </div>
+          <el-table :data="entityList" border height="calc(100vh - 243px)" style="width: 100%" @sort-change="orderby" :row-class-name="tableRowClassName" size="mini">
+            <el-table-column label="操作" width="160px" align="center" fixed>
+              <template slot-scope="scope">
+                <el-button type="primary" title="编辑" size="small" plain @click="ShowEntityDialog(scope.row.Id)">编辑</el-button>
+                <el-button type="plain" plain title="删除" size="small" style="margin-left:10px;" @click="deleteConfirm(scope.row)">删除</el-button>
+              </template>
+            </el-table-column>
+
+            <el-table-column v-for="column in tableColumns" :key="column.Id"
+                             v-if="column.prop != 'CreateOn'" :prop="column.prop" sortable min-width="100" :label="column.label" align="center" show-overflow-tooltip></el-table-column>
+
+            <el-table-column prop="CreateOn" sortable min-width="150" label="上次检测日期" align="center" show-overflow-tooltip>
+              <template slot-scope="scope">
+                {{ jstimehandle(scope.row.LastCheckDate+'') }}
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="Cycle" sortable min-width="100" label="检测周期" align="center" show-overflow-tooltip>
+              <template slot-scope="scope">
+                {{ scope.row.Cycle + ' ' + scope.row.CycleUnit }}
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
+                         :page-sizes="[10, 15, 20, 25]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
+          </el-pagination>
+        </el-card>
+      </el-col>
+    </el-row>
+
+    <el-dialog title="高级查询" :visible.sync="dialogVisible" width="720px">
+      <el-form ref="advancedsearchForm" label-width="110px">
+        <el-row>
+
+          <el-col :span="12">
+            <el-form-item label="生成时间">
+              <el-date-picker size="mini" v-model="CreateOn" type="daterange" style="width:100%" range-separator="至"
+                              start-placeholder="生成日期" end-placeholder="结束日期"></el-date-picker>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="序号">
+              <el-input v-model="searchForm.OrderNo" style="width:100%" placeholder="请输入"></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="编号">
+              <el-input size="mini" v-model="searchForm.CustNo" style="width:100%" placeholder="请输入"></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="检测地点">
+              <el-input size="mini" v-model="searchForm.PositionCheck" style="width:100%" placeholder="请输入"></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="安装位置">
+              <el-input size="mini" v-model="searchForm.Position" style="width:100%" placeholder="请输入"></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="规格型号">
+              <el-input size="mini" v-model="searchForm.Spec" style="width:100%" placeholder="请输入"></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="制造厂家">
+              <el-input size="mini" v-model="searchForm.Manufacturer" style="width:100%" placeholder="请输入"></el-input>
+            </el-form-item>
+          </el-col>
+
+        </el-row>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
+        <el-button size="mini" type="primary" @click="handleSearch">查 询</el-button>
+      </span>
+    </el-dialog>
+
+    <el-dialog title="编辑" :visible.sync="dialogFormVisible">
+      <el-form :model="formData" ref="EntityForm">
+        <el-form-item label="序号" :label-width="formLabelWidth">
+          <el-input-number v-model="formData.OrderNo" :min="1" style="width:100%" placeholder="请输入"></el-input-number>
+        </el-form-item>
+
+        <el-form-item label="编号" :label-width="formLabelWidth">
+          <el-input v-model="formData.CustNo" style="width:100%" placeholder="请输入"></el-input>
+        </el-form-item>
+
+        <el-form-item label="设备名称" :label-width="formLabelWidth">
+          <el-input v-model="formData.DeviceName" autocomplete="off"></el-input>
+        </el-form-item>
+        <el-form-item label="设备类型" :label-width="formLabelWidth" prop="TemplateTypeId" required>
+          <el-select ref="refProjectTypeId" v-model="formData.TemplateTypeId" style="width:100%" filterable placeholder="请选择">
+            <el-option v-for="item in projectTypeList" :key="item.id" :label="item.FullName" :value="item.Id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="安装地点" :label-width="formLabelWidth" required>
+          <el-cascader
+            ref="cascaderPosition"
+            v-model="PositionList" placeholder="请选择安装地点"
+            :options="customerTreeList"
+            :props="orgtreeprops"
+            style="width: 100%;"
+            @change="handlePositionChange"></el-cascader>
+        </el-form-item>
+        <el-form-item label="生产厂家" :label-width="formLabelWidth">
+          <el-input v-model="formData.Manufacturer" autocomplete="off"></el-input>
+        </el-form-item>
+        <el-form-item label="设备型号" :label-width="formLabelWidth">
+          <el-input v-model="formData.Spec" autocomplete="off"></el-input>
+        </el-form-item>
+        <el-form-item label="上次检测日期" :label-width="formLabelWidth">
+          <el-date-picker v-model="formData.LastCheckDate" type="date" placeholder="选择日期" style="width: 100%;">
+          </el-date-picker>
+          <!--<el-input v-model="formData.LastCheckDate" autocomplete="off" v-if="formData.Id" readonly></el-input>-->
+        </el-form-item>
+        <el-form-item label="检测周期" :label-width="formLabelWidth">
+          <el-input v-model="formData.Cycle" class="input-with-select" @change="CheckCycleDate">
+          <el-select v-model="formData.CycleUnit" slot="append" placeholder="请选择" style="width: 85px">
+            <el-option label="年" value="年"></el-option>
+            <el-option label="月" value="月"></el-option>
+            <el-option label="天" value="天"></el-option>
+          </el-select>
+          </el-input>
+        </el-form-item>
+        <el-form-item label="备注" :label-width="formLabelWidth">
+          <el-input v-model="formData.Remark" autocomplete="off"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogFormVisible=false">取 消</el-button>
+        <el-button type="primary" @click="saveEntity" :loading="saveLoading">确 定</el-button>
+      </div>
+    </el-dialog>
+
+
+  </div>
+</template>
+<script>
+  import { mapGetters } from 'vuex'
+  import api from '@/api/lims/limscheckequipmentlist'
+  import positionApi from '@/api/lims/customerposition'
+
+  export default {
+    computed: {
+      ...mapGetters({
+        authUser: 'authUser'
+      })
+    },
+    name: 'CheckEquipmentList',
+
+    data () {
+      return {
+        QueryProjectTypeId: '',
+        dialogVisible: false,
+        dialogFormVisible: false,
+        saveLoading: false,
+        selectNodeId: '',
+        // 列表数据
+        entityList: [],
+        PositionList: [],
+        // 分页参数
+        size: 10,
+        currentPage: 1,
+        currentItemCount: 0,
+        // 列表排序
+        Column: {
+          Order: '',
+          Prop: ''
+        },
+        // 查询时间
+        CreateOn: [new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000), new Date()],
+        // 查询项
+        searchFormReset: {},
+        searchForm: {
+          Id: '',
+          DepartmentId: '',
+          OrderNo: '',
+          PositionCheckId: '',
+          PositionCheck: '',
+          PositionID: '',
+          Position: '',
+          CustNo: '',
+          Spec: '',
+          SpecId: '',
+          Manufacturer: '',
+          Status: ''
+
+        },
+        testTypeList: [],
+        projectTypeList: [],
+        customerTreeList: [],
+        tableColumns: [
+          {
+            prop: 'TemplateTypeName',
+            label: '设备类型',
+            width: 200,
+            sort: true
+          },
+
+          {
+            prop: 'OrderNo',
+            label: '序号',
+            width: 100,
+            sort: true
+          },
+
+          {
+            prop: 'CustNo',
+            label: '编号',
+            width: 100,
+            sort: true
+          },
+
+          {
+            prop: 'Spec',
+            label: '规格型号',
+            width: 100,
+            sort: true
+          },
+
+          {
+            prop: 'Manufacturer',
+            label: '制造厂家',
+            width: 200,
+            sort: true
+          },
+          {
+            prop: 'PositionCheck',
+            label: '检测地点',
+            width: 280,
+            sort: true
+          },
+
+          {
+            prop: 'Position',
+            label: '安装位置',
+            width: 200,
+            sort: true
+          },
+
+          {
+            prop: 'DepartmentName',
+            label: '所属单位',
+            width: 200,
+            sort: true
+          }
+
+        ],
+        formData: {
+          Id: 0,
+          DepartmentId: 0,
+          DepartmentName: '',
+          OrderNo: 0,
+          PositionCheckId: 0,
+          PositionCheck: '',
+          PositionID: 0,
+          Position: '',
+          CustNo: '',
+          DeviceName: '',
+          TemplateTypeId: 0,
+          TemplateTypeName: '',
+          Spec: '',
+          SpecId: '',
+          Manufacturer: '',
+          Status: '',
+          Remark: '',
+          Cycle: 0,
+          CycleUnit: '年',
+          LastCheckDate: new Date(),
+          CreateOn: '',
+          CreateUserId: '',
+          CreateBy: '',
+          ModifiedOn: '',
+          ModifiedUserId: '',
+          ModifiedBy: ''
+        },
+        formLabelWidth: '120px',
+        orgtreeprops: {
+          value: 'id',
+          label: 'PositionName',
+          children: 'children'
+        },
+        customerForm: [],
+        CustomerId: 0
+      }
+    },
+    created () {
+      // 查询条件初始值备份
+      Object.assign(this.searchFormReset, this.searchForm)
+      // 查询列表
+      this.initDatas()
+      this.getProjectType()
+      this.getCustomerInfo()
+      // this.getDictOptions()
+    },
+    methods: {
+      ProjectTypeChangeHandler () {
+        this.initDatas()
+      },
+
+      ProjectTypeClearHandler () {
+        this.initDatas()
+      },
+
+      tableRowClassName ({row}) {
+        let lastDate = new Date(row.LastCheckDate)
+        let cycleDate = new Date()
+        if (row.CycleUnit === '年') {
+          cycleDate = new Date((lastDate.getFullYear() + row.Cycle * 1.0), lastDate.getMonth(), lastDate.getDate())
+        } else if (row.CycleUnit === '月') {
+          cycleDate = new Date(lastDate.getFullYear(), (lastDate.getMonth() + row.Cycle * 1.0), lastDate.getDate())
+        } else if (row.CycleUnit === '天') {
+          cycleDate = new Date(lastDate.getFullYear(), lastDate.getMonth(), (lastDate.getDate() + row.Cycle * 1.0))
+        }
+        let curDate = new Date()
+        let nearCycleDate = new Date(curDate.getFullYear(), (curDate.getMonth() + 1), curDate.getDate())
+        if (cycleDate <= new Date()) {
+          return 'error-row'
+        } else if (cycleDate <= nearCycleDate) {
+          return 'warning-row'
+        }
+        return ''
+      },
+
+      CheckCycleDate () {
+        this.formData.Cycle = this.formData.Cycle.replace(/[^0-9./]/g, '')
+      },
+
+      orgtreeNodeClick (data) {
+        this.selectNodeId = data.id + ''
+        this.selectNodeName = data.PositionName + ''
+
+        this.currentPage = 1
+        this.initDatas()
+      },
+      initDatas () {
+        // 分页及列表条件
+        let params = {
+          _currentPage: this.currentPage,
+          _size: this.size,
+          Order: this.Column.Order,
+          Prop: this.Column.Prop,
+          TemplateTypeId: this.QueryProjectTypeId + '',
+          PositionAllTypeId: this.selectNodeId + ''
+        }
+        let myCreateOn = []
+        // 解析时间
+        if (this.CreateOn && this.CreateOn.length === 2) {
+          this.CreateOn[1].setHours(23)
+          this.CreateOn[1].setMinutes(59)
+          this.CreateOn[1].setSeconds(59)
+          myCreateOn.push(this.formatDateTime(this.CreateOn[0]))
+          myCreateOn.push(this.formatDateTime(this.CreateOn[1]))
+        }
+        // 查询条件
+        Object.assign(params, this.searchForm)
+        // 访问接口
+        api.getWarningList(myCreateOn.join(','), params, this.$axios).then(res => {
+          this.entityList = res.data.items
+          this.currentItemCount = res.data.currentItemCount
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+
+      getDictOptions () {
+        api.getDictList(this.$axios).then(res => {
+          // this.dictOptions.customerList = res.data.items['customerList']
+          // this.dictOptions.projectList = res.data.items['projectList']
+
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+
+      searchCommand (command) {
+        if (command === 'search') {
+          this.dialogVisible = true
+        } else if (command === 'clear') {
+          this.clearSearch()
+        }
+      },
+      // 列表排序功能
+      orderby (column) {
+        if (column.order === 'ascending') {
+          this.Column.Order = 'asc'
+        } else if (column.order === 'descending') {
+          this.Column.Order = 'desc'
+        }
+        this.Column.Prop = column.prop
+        this.initDatas()
+      },
+      clearSearch () {
+        Object.assign(this.searchForm, this.searchFormReset)
+        // this.searchForm = this.searchFormReset;
+        this.CreateOn = ''
+        this.initDatas()
+      },
+      handleSearch () {
+        this.currentPage = 1
+        this.dialogVisible = false
+        this.initDatas()
+      },
+      handleCurrentChange (value) {
+        this.currentPage = value
+        this.initDatas()
+      },
+      handleSizeChange (value) {
+        this.size = value
+        this.currentPage = 1
+        this.initDatas()
+      },
+      deleteConfirm (row) {
+        this.$confirm('此操作将永久删除该设备, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.deleteEntity(row)
+        })
+      },
+      deleteEntity (row) {
+        row.deleteConfirmFlag = false
+        api.deleteEntity(row.Id, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            this.initDatas()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+
+      // 设备类型
+      getProjectType () {
+        let _this = this
+        _this.$axios.get('/testtype/testypetreeall', {})
+          .then(res => {
+            _this.testTypeList = res.data.items
+            if (!_this.testTypeList) {
+              return false
+            }
+            for (var i = 0; i < _this.testTypeList.length; i++) {
+              if (_this.testTypeList[i].ParentId == 0) {
+                _this.projectTypeList.push(_this.testTypeList[i])
+              }
+            }
+          })
+          .catch(err => {
+            // handle error
+            console.error(err)
+          })
+      },
+
+      gettreelist () {
+        let params = {
+          CustomerId: this.CustomerId + ''
+        }
+        positionApi.customerPositionTree(params, this.$axios).then(res => {
+          this.customerTreeList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId',
+            'Id,CustomerId,ParentId,PositionName,PositionCode,PositionType,PositionTypeId')
+        })
+          .catch(err => {
+            // handle error
+            console.error(err)
+          })
+      },
+      getCustomerInfo () {
+        let _this = this
+        this.$axios.get('customer/getcustomerbydepartid', {})
+          .then(res => {
+            _this.customerForm = res.data.items
+            _this.CustomerId = _this.customerForm.Id
+            _this.gettreelist()
+          }).catch(err => {
+            console.error(err)
+          })
+      },
+
+      jstimehandle (val) {
+        if (val === '') {
+          return '----'
+        } else if (val === '0001-01-01T08:00:00+08:00') {
+          return '----'
+        } else if (val === '5000-01-01T23:59:59+08:00') {
+          return '永久'
+        } else {
+          val = val.replace('T', ' ')
+          return val.substring(0, 10)
+        }
+      },
+
+      formatDateTime (date) {
+        var y = date.getFullYear()
+        var m = date.getMonth() + 1
+        m = m < 10 ? ('0' + m) : m
+        var d = date.getDate()
+        d = d < 10 ? ('0' + d) : d
+        var h = date.getHours()
+        var minute = date.getMinutes()
+        minute = minute < 10 ? ('0' + minute) : minute
+        return y + '-' + m + '-' + d + ' ' + h + ':' + minute
+      },
+
+      NewEntity () {
+        this.dialogFormVisible = true
+        this.PositionList = []
+        this.formData.Id = 0
+        this.formData.DepartmentId = 0
+        this.formData.DepartmentName = ''
+        this.formData.OrderNo = 0
+        this.formData.PositionCheckId = 0
+        this.formData.PositionCheck = ''
+        this.formData.PositionID = 0
+        this.formData.Position = ''
+        this.formData.CustNo = ''
+        this.formData.DeviceName = ''
+        this.formData.TemplateTypeId = ''
+        this.formData.TemplateTypeName = ''
+        this.formData.Spec = ''
+        this.formData.SpecId = 0
+        this.formData.Manufacturer = ''
+        this.formData.Status = ''
+        this.formData.Remark = ''
+        this.formData.CreateOn = ''
+        this.formData.CreateUserId = 0
+        this.formData.CreateBy = ''
+        this.formData.ModifiedOn = ''
+        this.formData.ModifiedUserId = 0
+        this.formData.ModifiedBy = ''
+      },
+
+      handlePositionChange (value) {
+        this.formData.PositionCheckId = value[0]
+        this.formData.PositionID = value[1]
+      },
+      ShowEntityDialog (entityId) {
+        this.initEntity(entityId)
+        this.dialogFormVisible = true
+      },
+      initEntity (entityId) {
+        if (entityId) {
+          api.getEntity(entityId, this.$axios).then(res => {
+            this.formData = res.data
+            this.PositionList = [ this.formData.PositionCheckId, this.formData.PositionID ]
+          }).catch(err => {
+            console.error(err)
+          })
+        }
+      },
+
+      // 保存信息
+      saveEntity () {
+        if (this.$refs.refProjectTypeId.selectedLabel <= 0) {
+          this.$message({
+            type: 'warning',
+            message: '请选择设备类型'
+          })
+          return
+        }
+        if (this.PositionList.length <= 0) {
+          this.$message({
+            type: 'warning',
+            message: '请选择安装位置'
+          })
+          return
+        }
+        this.$refs['EntityForm'].validate((valid) => {
+          if (valid) {
+            this.saveLoading = true
+            this.formData.TemplateTypeName = this.$refs.refProjectTypeId.selectedLabel + ''
+            this.formData.PositionCheck = this.$refs.cascaderPosition.presentText.split('/')[0]
+            this.formData.Position = this.$refs.cascaderPosition.presentText.split('/')[1]
+            this.formData.Cycle = parseFloat(this.formData.Cycle)
+            if (!this.formData.Id) {
+              this.addEntity()
+            } else {
+              this.updateEntity()
+            }
+          } else {
+            return false
+          }
+        })
+      },
+
+      addEntity () {
+        api.addEntity(this.formData, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            // 保存成功后,初始化数据,变成修改
+            this.formData.Id = res.data.item
+            this.dialogFormVisible = false
+            this.initDatas()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+          this.saveLoading = false
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+
+      updateEntity () {
+        api.updateEntity(this.formData.Id, this.formData, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            // 保存成功后,初始化数据,变成修改
+            this.dialogFormVisible = false
+            this.initDatas()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+          this.saveLoading = false
+        }).catch(err => {
+          console.error(err)
+        })
+      }
+    }
+  }
+</script>
+
+<style lang='scss'>
+  .el-pagination {
+    margin: 1rem 0 2rem;
+    text-align: right;
+  }
+
+  .el-table .warning-row {
+    background: burlywood;
+  }
+
+  .el-table .error-row {
+    background: indianred;
+  }
+</style>