Bladeren bron

添加检测计划时,要按近1个月,近2个月...近1年到期等条件过滤,生成检测计划的设备列表

yuedefeng 6 jaren geleden
bovenliggende
commit
fffd941ed9

+ 3 - 0
src/dashoo.cn/backend/api/business/limscheckequipmentlist/limscheckequipmentlist.go

@@ -21,6 +21,9 @@ type LimsCheckEquipmentList struct {
 	SpecId          string    `json:"SpecId" xorm:"comment('规格型号Id') VARCHAR(255) 'SpecId'"`
 	Manufacturer    string    `json:"Manufacturer" xorm:"comment('制造厂家') VARCHAR(255) 'Manufacturer'"`
 	Status          string    `json:"Status" xorm:"comment('产品状态') VARCHAR(255) 'Status'"`
+	LastCheckDate   time.Time `json:"LastCheckDate" xorm:"comment('最后一次检测时间') DATETIME 'LastCheckDate'"`
+	Cycle           float32   `json:"Cycle" xorm:"comment('检测周期') FLOAT(10,2) 'Cycle'"`
+	CycleUnit       string    `json:"CycleUnit" xorm:"comment('检测周期单位') VARCHAR(255) 'CycleUnit'"`
 	Remark          string    `xorm:VARCHAR(255)`       //描述
 	CreateOn        time.Time `xorm:"DATETIME created"` //创建时间
 	CreateUserId    int       `xorm:"INT(10)"`

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

@@ -55,6 +55,7 @@ func (this *LimsCheckEquipmentListController) GetEntityList() {
 
 	TemplateTypeId := this.GetString("TemplateTypeId")
 	PositionAllTypeId := this.GetString("PositionAllTypeId")
+	QueryCheckDate := this.GetString("QueryCheckDate")
 
 	if Id != "" {
 		where = where + " and Id like '%" + Id + "%'"
@@ -111,6 +112,10 @@ func (this *LimsCheckEquipmentListController) GetEntityList() {
 	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)
@@ -285,6 +290,12 @@ func (this *LimsCheckEquipmentListController) UpdateEntity() {
 
 		"Status",
 
+		"LastCheckDate",
+
+		"Cycle",
+
+		"CycleUnit",
+
 		"Remark",
 
 		"CreateOn",

+ 4 - 0
src/dashoo.cn/backend/api/controllers/lims/limsentrust.go

@@ -272,12 +272,16 @@ func (this *LimsEnturstController) AddEntrust() {
 	//		this.AddSampleType(strconv.Itoa(model.Id), SampleCode)
 	//	}
 	// 保存设备明细
+	queryCheckDate := this.GetString("querycheckdate")
 	insertEquipmentSQL := "INSERT INTO " + this.User.AccCode + LimsEntrustEquipmentName
 	insertEquipmentSQL += "(Entrustmainid, Departmentid, Departmentname, Orderno, Positioncheckid, Positioncheck, Positionid, Position, Custno, Devicename, Templatetypeid, Templatetypename, Spec, Specid, Manufacturer, Status, Remark, CreateOn, CreateUserId, CreateBy)"
 	insertEquipmentSQL += " SELECT '" + strconv.Itoa(model.Id) + "' as EntrustMainId, Departmentid, Departmentname, Orderno, Positioncheckid, Positioncheck, Positionid, Position, Custno, Devicename, Templatetypeid, Templatetypename, Spec, Specid, Manufacturer, Status, Remark, now() as CreateOn, '" + this.User.Id + "' as CreateUserId, '" + this.User.Realname + "' as CreateBy FROM "
 	insertEquipmentSQL += this.User.AccCode + LimsCheckEquipmentListName
 	insertEquipmentSQL += " WHERE PositionCheckId=" + strconv.Itoa(model.AddressId)
 	insertEquipmentSQL += " and TemplateTypeId=" + strconv.Itoa(model.ProjectTypeId)
+	if queryCheckDate != "" {
+		insertEquipmentSQL = insertEquipmentSQL + " and  date_add(LastCheckDate, interval " + queryCheckDate + " month) >= now()"
+	}
 
 	svc.DBE.Exec(insertEquipmentSQL)
 

+ 2 - 2
src/dashoo.cn/frontend_web/nuxt.config.ignore.js

@@ -170,8 +170,8 @@ module.exports = {
      'pages/lims/oiltestingdaily/**/*.*',
      'pages/lims/preparation/**/*.*',
      'pages/lims/tasksbalance/**/*.*',
-     'pages/system/**/*.*',
-      'pages/setting/**/*.*',
+     // 'pages/system/**/*.*',
+     // 'pages/setting/**/*.*',
      'pages/prototype/**/*.*',
      'pages/material/**/*.*',
      'pages/report/**/*.*',

+ 62 - 6
src/dashoo.cn/frontend_web/src/pages/lims/checkequipmentlist/index.vue

@@ -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>

+ 10 - 10
src/dashoo.cn/frontend_web/src/pages/lims/principal/subdata/customerposition.vue

@@ -6,9 +6,9 @@
           <i class="icon icon-table2">位置树</i>
         </span>
         <span style="float: right;">
-          <el-select ref="refQueryProjectType" style="margin-right:10px; margin-top: -4px;" size="mini" v-model="QueryProjectTypeId" clearable filterable placeholder="按设备类型查询" @change="ProjectTypeChangeHandler" @clear="ProjectTypeClearHandler">
+          <!--<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-select>-->
           <el-button type="primary" size="mini" style="margin-right:10px; margin-top: -4px;" @click="newEntity">新增检测地点</el-button>
           <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="newPositionEntity">新增安装位置</el-button>
         </span>
@@ -81,11 +81,11 @@
           </el-select>
         </el-form-item>
 
-        <el-form-item label="设备类型" prop="ProjectTypeId" required>
+        <!--<el-form-item label="设备类型" prop="ProjectTypeId" required>
           <el-select ref="refProjectTypeId" v-model="formData.ProjectTypeId" 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>-->
 
         <el-form-item label="位置名称" required>
           <el-input v-model="formData.PositionName" placeholder="请输入"  style="width: 100%"></el-input>
@@ -258,11 +258,11 @@
             sort: true
           },
 
-          {
+          /*{
             prop: "ProjectType",
             label: '设备类型',
             sort: true
-          },
+          },*/
 
           {
             prop: "SortCode",
@@ -375,13 +375,13 @@
           })
           return
         }
-        if (!this.formData.ProjectTypeId) {
+        /*if (!this.formData.ProjectTypeId) {
           this.$message({
             type: 'warning',
             message: '设备类型不能为空'
           })
           return
-        }
+        }*/
         if (!this.formData.PositionName) {
           this.$message({
             type: 'warning',
@@ -394,7 +394,7 @@
             this.formData.CustomerId = this.CustomerId
             this.formData.PositionType = '安装位置'
             this.formData.PositionTypeId = '2'
-            this.formData.ProjectType = this.$refs['refProjectTypeId'].selectedLabel
+            // this.formData.ProjectType = this.$refs['refProjectTypeId'].selectedLabel
             if (!this.formData.Id) {
               this.addEntity()
             } else {
@@ -647,7 +647,7 @@
         return y + '-' + m + '-' + d + ' ' + h + ':' + minute;
       },
 
-      //设备类型
+      // 设备类型
       getProjectType() {
         let _this = this
         _this.$axios.get('/testtype/testypetreeall', {})

+ 22 - 2
src/dashoo.cn/frontend_web/src/pages/lims/taskplan/_opera/operation.vue

@@ -159,6 +159,24 @@
       </el-form>
 
       <div v-if="mainForm.Id <= 0">
+        <el-form>
+          <el-form-item label="到期时间查询:" :label-width="formLabelWidth">
+            <el-select v-model="QueryCheckDate" placeholder="请选择到期时间" style="width: 350px" @change="SampleTypeChangeHandler">
+              <el-option label="近1个月" value="1"></el-option>
+              <el-option label="近2个月" value="2"></el-option>
+              <el-option label="近3个月" value="3"></el-option>
+              <el-option label="近4个月" value="4"></el-option>
+              <el-option label="近5个月" value="5"></el-option>
+              <el-option label="近6个月" value="6"></el-option>
+              <el-option label="近7个月" value="7"></el-option>
+              <el-option label="近8个月" value="8"></el-option>
+              <el-option label="近9个月" value="9"></el-option>
+              <el-option label="近10个月" value="10"></el-option>
+              <el-option label="近11个月" value="11"></el-option>
+              <el-option label="近12个月" value="12"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
         <el-table :data="entityList" border height="calc(100vh - 243px)" style="width: 100%" @sort-change="orderby">
           <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>
@@ -204,6 +222,7 @@
     name: 'limsentrustdetail',
     data () {
       return {
+        QueryCheckDate: '',
         typevalue: [],
         EntrustSampleId: '',
         currentPage: 1,
@@ -657,7 +676,7 @@
             _this.mainForm.DetectSampleId = parseInt(_this.selectedorg[_this.selectedorg.length - 1])
             _this.mainForm.DetectSample = _this.getDetectSampleName(_this.mainForm.DetectSampleId)
             _this.mainForm.Samplelist = _this.selectedorg.join(',')
-            _this.$axios.post('/limsentrust/addentrust', _this.mainForm)
+            _this.$axios.post('/limsentrust/addentrust?querycheckdate=' + this.QueryCheckDate, _this.mainForm)
               .then(res => {
                 // response
                 if (res.data.code === 0) {
@@ -984,7 +1003,8 @@
             Order: this.Column.Order,
             Prop: this.Column.Prop,
             TemplateTypeId: tmpTypeId,
-            PositionCheckId: this.mainForm.AddressId
+            PositionCheckId: this.mainForm.AddressId,
+            QueryCheckDate: this.QueryCheckDate
           }
           // 访问接口
           checkEquipmentApi.getList('', params, this.$axios).then(res => {