|
|
@@ -42,7 +42,7 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
- <el-table :data="entityList" border height="calc(100vh - 243px)" style="width: 100%" @sort-change="orderby">
|
|
|
+ <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>
|
|
|
@@ -53,11 +53,17 @@
|
|
|
<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>
|
|
|
+ <el-table-column prop="CreateOn" sortable min-width="150" label="上次检测日期" align="center" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
- {{ jstimehandle(scope.row.CreateOn+'') }}
|
|
|
+ {{ jstimehandle(scope.row.LastCheckDate+'') }}
|
|
|
</template>
|
|
|
- </el-table-column>-->
|
|
|
+ </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">
|
|
|
@@ -154,6 +160,20 @@
|
|
|
<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>
|
|
|
@@ -259,7 +279,7 @@
|
|
|
{
|
|
|
prop: 'PositionCheck',
|
|
|
label: '检测地点',
|
|
|
- width: 200,
|
|
|
+ width: 280,
|
|
|
sort: true
|
|
|
},
|
|
|
|
|
|
@@ -296,6 +316,9 @@
|
|
|
Manufacturer: '',
|
|
|
Status: '',
|
|
|
Remark: '',
|
|
|
+ Cycle: 0,
|
|
|
+ CycleUnit: '年',
|
|
|
+ LastCheckDate: new Date(),
|
|
|
CreateOn: '',
|
|
|
CreateUserId: '',
|
|
|
CreateBy: '',
|
|
|
@@ -330,6 +353,31 @@
|
|
|
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 + ''
|
|
|
@@ -584,7 +632,7 @@
|
|
|
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 {
|
|
|
@@ -649,4 +697,12 @@
|
|
|
margin: 1rem 0 2rem;
|
|
|
text-align: right;
|
|
|
}
|
|
|
+
|
|
|
+ .el-table .warning-row {
|
|
|
+ background: burlywood;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-table .error-row {
|
|
|
+ background: indianred;
|
|
|
+ }
|
|
|
</style>
|