Procházet zdrojové kódy

bug

Signed-off-by: lijunqing <lijunqing@dashoo.cn>
lijunqing před 6 roky
rodič
revize
1ce98baec0

+ 34 - 5
src/dashoo.cn/frontend_web/src/pages/lims/checkequipmentlist/index.vue

@@ -164,7 +164,7 @@
           <el-input v-model="formData.CustNo" style="width:100%" placeholder="请输入"></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-select ref="refProjectTypeId" v-model="formData.TemplateTypeId" style="width:100%" filterable placeholder="请选择" @change="changeDetectionCycle">
             <el-option v-for="item in projectTypeList" :key="item.id" :label="item.FullName" :value="item.Id"></el-option>
           </el-select>
         </el-form-item>
@@ -190,8 +190,8 @@
           <!--<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-input v-model="formData.Cycle" class="input-with-select" @change="CheckCycleDate" readonly>
+            <el-select v-model="formData.CycleUnit" slot="append" placeholder="请选择" style="width: 85px" disabled>
               <el-option label="年" value="年"></el-option>
               <el-option label="月" value="月"></el-option>
               <el-option label="天" value="天"></el-option>
@@ -236,6 +236,7 @@
           value: '0',
           label: '正常'
         }],
+        detectionCycleList: [],
         statusValue: '',
         addoredittitle: '添加',
         QueryProjectTypeId: '',
@@ -380,8 +381,33 @@
       this.getProjectType()
       this.getCustomerInfo()
       // this.getDictOptions()
+      // 获得默认检测周期
+      this.getDetectionCycle()
     },
     methods: {
+      changeDetectionCycle (val) {
+        let _this = this
+        _this.formData.Cycle = 0
+        _this.formData.CycleUnit = '年'
+        for (let index = 0; index < _this.detectionCycleList.length; index++) {
+          if (_this.detectionCycleList[index].Pid === val) {
+            _this.formData.Cycle = _this.detectionCycleList[index].DetectionNum
+            _this.formData.CycleUnit = _this.detectionCycleList[index].DetectionUnit
+          }
+        }
+      },
+      getDetectionCycle () {
+        let _this = this
+        const params = { _currentPage: 1, _size: 10000 }
+
+        _this.$axios.get('/items/getdetectionmodel/', { params })
+          .then(res => {
+            _this.detectionCycleList = res.data.items
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
       ProjectTypeChangeHandler () {
         this.initDatas()
       },
@@ -605,6 +631,8 @@
         this.dialogFormVisible = true
         this.PositionList = []
         this.formData.Id = 0
+        this.formData.Cycle = 0
+        this.formData.CycleUnit = '年'
         this.formData.DepartmentId = 0
         this.formData.DepartmentName = ''
         this.formData.OrderNo = 0
@@ -614,7 +642,8 @@
         this.formData.Position = ''
         this.formData.CustNo = ''
         this.formData.DeviceName = ''
-        this.formData.TemplateTypeId = this.projectTypeList[0].Id
+        // this.formData.TemplateTypeId = this.projectTypeList[0].Id
+        this.formData.TemplateTypeId = ''
         this.formData.TemplateTypeName = ''
         this.formData.Spec = ''
         this.formData.SpecId = 0
@@ -630,7 +659,7 @@
       },
       exportExcel () {
         let params = {
-          PositionAllTypeId: this.selectNodeId + '',
+          PositionAllTypeId: this.selectNodeId + ''
         }
         api.exportExcelAll(params, this.$axios).then(res => {
           this.loading = false

+ 84 - 74
src/dashoo.cn/frontend_web/src/pages/setting/systemitems/_opera/detectioncycleitemsdetail.vue

@@ -22,8 +22,9 @@
       </div>
 
       <el-table :data="list"
+      size="mini"
                 border
-                style="width: 100%">
+                style="width: 100%" height="calc(100vh - 260px)">
         <el-table-column label="操作"
                          width="65">
           <template slot-scope="scope">
@@ -45,27 +46,36 @@
                          show-overflow-tooltip></el-table-column>
         <el-table-column label="检测周期"
                          show-overflow-tooltip>
-                          <template slot-scope="scope">
-                            {{scope.row.DetectionNum+scope.row.DetectionUnit}}
-                          </template>
-                         </el-table-column>
+          <template slot-scope="scope">
+            {{scope.row.DetectionNum+scope.row.DetectionUnit}}
+          </template>
+        </el-table-column>
       </el-table>
+
+      <el-pagination @size-change="handleSizeChange"
+                     @current-change="handleCurrentChange"
+                     :current-page="currentPage"
+                     :page-sizes="[10, 20, 30]"
+                     :page-size="size"
+                     layout="total, sizes, prev, pager, next, jumper"
+                     :total="currentItemCount">
+      </el-pagination>
     </el-card>
 
     <el-dialog :title="dialogtitle"
                :visible.sync="datadialogVisible">
       <el-form :model="itemsdetailinfoform"
-              
                ref="itemsdetailinfoform">
         <el-form-item label="设备分类"
-                      label-width="120px" required>
-          <el-select v-model="projectTypeId"
+                      label-width="120px"
+                      required>
+          <el-select v-model="itemsdetailinfoform.Pid"
                      :disabled="disableFlag"
                      @change="projectTypeChange"
                      style="width:100%"
                      clearable
                      filterable
-                     placeholder="请选择设备分类" >
+                     placeholder="请选择设备分类">
             <el-option v-for="item in projectTypeList"
                        :key="item.Id"
                        :label="item.FullName"
@@ -74,16 +84,17 @@
         </el-form-item>
 
         <el-form-item label="检测周期数值"
-                      label-width="120px" required>
+                      label-width="120px"
+                      required>
           <el-input-number v-model="itemsdetailinfoform.DetectionNum"
                            :min="1"
                            style="width:100%"></el-input-number>
         </el-form-item>
 
         <el-form-item label="检测周期单位"
-                      label-width="120px" required>
-          <el-select v-model="detectionUnit"
-                     @change="detectionUnitChange"
+                      label-width="120px"
+                      required>
+          <el-select v-model="itemsdetailinfoform.DetectionUnit"
                      style="width:100%"
                      placeholder="请选择">
             <el-option v-for="item in detectionUnitOptions"
@@ -111,7 +122,6 @@ export default {
   name: 'itemsdetail',
   data () {
     return {
-      projectTypeId: '',
       Id: 0,
       testTypeList: [],
       projectTypeList: [],
@@ -120,7 +130,6 @@ export default {
       currentItemCount: 0,
       currentPage: 1,
       size: 10,
-      detectionUnit: '天',
 
       detectionUnitOptions: [{
         value: '天',
@@ -136,16 +145,13 @@ export default {
       dialogtitle: '',
       itemsdetailinfoform: {
         Name: '',
-        pid: 0,
+        Pid: '',
         DetectionNum: 1,
-        DetectionUnit: ''
+        DetectionUnit: ''
 
       },
       list: [],
       datadialogVisible: false
-      // rulesitemsdetailinfoform: {
-
-      // }
     }
   },
   created () {
@@ -158,19 +164,25 @@ export default {
     _this.getProjectType()
   },
   methods: {
+
+    handleSizeChange (value) {
+      this.size = value
+      this.currentPage = 1
+      this.initData()
+    },
+    handleCurrentChange (value) {
+      this.currentPage = value
+      this.initData()
+    },
     projectTypeChange (val) {
       let _this = this
-      _this.itemsdetailinfoform.pid = val
       let obj = {}
       obj = _this.projectTypeList.find((item) => {
         return item.Id === val
       })
       _this.itemsdetailinfoform.Name = obj.FullName
     },
-    detectionUnitChange (val) {
-      let _this = this
-      _this.itemsdetailinfoform.DetectionUnit = val
-    },
+
     getProjectType () {
       let _this = this
       _this.$axios.get('/testtype/testypetreeall', {})
@@ -195,7 +207,6 @@ export default {
 
       _this.$axios.get('/items/getdetectionmodel/', { params })
         .then(res => {
-          console.log(res)
           _this.list = res.data.items
           _this.currentItemCount = res.data.currentItemCount
         })
@@ -205,8 +216,8 @@ export default {
     },
     clearitemsdetailinfoform () {
       let _this = this
-      _this.projectTypeId = ''
-      _this.detectionUnit = '天'
+      _this.itemsdetailinfoform.Pid = ''
+      _this.itemsdetailinfoform.DetectionUnit = '天'
       _this.itemsdetailinfoform.DetectionNum = 1
     },
     deletedata (val) {
@@ -245,63 +256,62 @@ export default {
       } else if (item === 2) {
         _this.dialogtitle = `编辑`
         _this.Id = v.Id
-        _this.projectTypeId = v.Pid
+        _this.itemsdetailinfoform.Pid = v.Pid
         _this.disableFlag = true
-        _this.detectionUnit = v.DetectionUnit
-
         _this.itemsdetailinfoform.DetectionUnit = v.DetectionUnit
         _this.itemsdetailinfoform.DetectionNum = v.DetectionNum
       }
     },
     savedata (formName) {
       let _this = this
-      this.$refs[formName].validate((valid) => {
-        if (valid) {
-          if (_this.operatingitem === 1) {
-            this.$axios.post('/items/adddetectionmodel', _this.itemsdetailinfoform)
-              .then(res => {
-                if (res.data.code === 0) {
-                  _this.$message({
-                    type: 'success',
-                    message: res.data.message
-                  })
-                  _this.datadialogVisible = false
-                  this.initData()
-                } else {
-                  _this.$message({
-                    type: 'warning',
-                    message: res.data.message
-                  })
-                }
+
+      if (_this.itemsdetailinfoform.Pid === '') {
+        _this.$message({
+          type: 'warning',
+          message: '请选择设备分类'
+        })
+        return
+      }
+      if (_this.operatingitem === 1) {
+        this.$axios.post('/items/adddetectionmodel', _this.itemsdetailinfoform)
+          .then(res => {
+            if (res.data.code === 0) {
+              _this.$message({
+                type: 'success',
+                message: res.data.message
+              })
+              _this.datadialogVisible = false
+              this.initData()
+            } else {
+              _this.$message({
+                type: 'warning',
+                message: res.data.message
               })
-              .catch(err => {
-                console.error(err)
+            }
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      } else if (_this.operatingitem === 2) {
+        _this.$axios.post('items/editdetectionmodel/' + _this.Id, _this.itemsdetailinfoform)
+          .then(res => {
+            if (res.data.code === 0) {
+              _this.$message({
+                type: 'success',
+                message: res.data.message
               })
-          } else if (_this.operatingitem === 2) {
-            _this.$axios.post('items/editdetectionmodel/' + _this.Id, _this.itemsdetailinfoform)
-              .then(res => {
-                if (res.data.code === 0) {
-                  _this.$message({
-                    type: 'success',
-                    message: res.data.message
-                  })
-                  _this.datadialogVisible = false
-                  this.initData()
-                } else {
-                  _this.$message({
-                    type: 'warning',
-                    message: res.data.message
-                  })
-                }
+              _this.datadialogVisible = false
+              this.initData()
+            } else {
+              _this.$message({
+                type: 'warning',
+                message: res.data.message
               })
-              .catch(() => { })
-          }
-        } else {
-          return false
-        }
-      })
+            }
+          })
+          .catch(() => { })
+      }
     }
-
   }
 }
 </script>