Browse Source

设备关联页面

lining 6 years ago
parent
commit
b894089b2d

+ 4 - 0
src/dashoo.cn/backend/api/business/limsdoctemplate/limstemplateenum.go

@@ -133,4 +133,8 @@ const (
 	DAYT_DRILLCOLLAR_DETAIL string = "DAYT.DrillCollar.Detail"
 	// 电动机报告
 	DAYT_LIMSREPORTMOTOR_REPORT string = "DAYT.LimsReportMotor.Report"
+	// 硫化氢气体检测仪检定证书
+	DAYT_REPORTDETECTORHSGAS_REPORT string= "DAYT.ReportDetectorHSGas.Report"
+	// 电化学氧测定仪检定证书
+	DAYT_REPORTDETECTORELECTOXYGEN_REPORT string= "DAYT.ReportDetectorElectOxygen.Report"
 )

+ 400 - 0
src/dashoo.cn/frontend_web/src/pages/setting/instrumentgroup/index.vue

@@ -0,0 +1,400 @@
+<template>
+  <div v-loading="downloading" element-loading-text="数据拼命准备中,请稍候。。。">
+    <el-breadcrumb class="heading">
+      <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
+      <el-breadcrumb-item :to="{ path: '/setting/instrumentgroup' }">设备管理</el-breadcrumb-item>
+    </el-breadcrumb>
+    <el-card class="box-card">
+      <div slot="header" class="clearfix">
+        <span>
+          <i class="icon icon-table2"> 设备关联管理列表</i>
+        </span>
+        <span style="float: right; margin-top: -5px" class="cardrightform">
+          <!-- <router-link :to="'/setting/doctemplate/add/operation'">
+            <el-button type="primary" size="small">添加</el-button>
+          </router-link> -->
+          <el-button type="primary" class="el-button--small" @click="opendatadialog(1,null)">添加</el-button>
+        </span>
+      </div>
+      <el-row :gutter="24">
+        <el-col :span="24">
+          <el-table :data="datalist" border style="width: 100%" @sort-change="orderby">
+            <el-table-column label="操作" width="120" align="center" header-align="center">
+              <template slot-scope="scope">
+                <el-button type="text" title="编辑" size="medium" style="margin-left:3px;" @click="opendatadialog(2,scope.row)">
+                  编辑
+                </el-button>
+                <el-button size="medium" style="margin-left:3px;" type="text" title="删除" @click="deleteEntity(scope.row)">
+                  删除
+                </el-button>
+              </template>
+            </el-table-column>
+            <el-table-column prop="SAD" label="安全附件检测仪" align="center" header-align="center" show-overflow-tooltip></el-table-column>
+            <el-table-column prop="GasFlowMeter" label="热式气体质量流量计" align="center" header-align="center" show-overflow-tooltip></el-table-column>
+            <el-table-column prop="DifPressTran" label="差压变送器" align="center" header-align="center"  show-overflow-tooltip></el-table-column>
+            <el-table-column prop="Remark" label="备注" align="center" header-align="center" show-overflow-tooltip></el-table-column>
+          </el-table>
+          <el-pagination  @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
+          :page-size="size" :page-sizes="[10, 15, 20 ]" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
+          </el-pagination>
+        </el-col>
+      </el-row>
+    </el-card>
+
+    <el-dialog :title="dialogtitle" :visible.sync="datadialogVisible" top="5vh">
+      <el-form :model="formData" ref="formData">
+        <el-row>
+          <el-col :span="8">
+            <el-form-item prop="SADID" label="安全附件检测仪" label-width="130px" style="width: 100%" :rules="[{ required: true, message: '安全附件检测仪不能为空'}]">
+              <el-select ref="selectSAD" v-model="formData.SADID" filterable default-first-option placeholder="请选择" style="width: 100%">
+                <el-option
+                      v-for="item in SafAccDetectorOptions"
+                      :key="item.Id"
+                      :value="item.Id"
+                      :label="item.Code">
+                    </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item prop="GasFlowMeterID" label="热式气体质量流量计" label-width="150px" style="width: 100%" :rules="[{ required: true, message: '热式气体质量流量计不能为空'}]">
+              <el-select ref="selectGasFlowMeter" v-model="formData.GasFlowMeterID" filterable default-first-option placeholder="请选择" style="width: 100%" >
+                <el-option
+                  v-for="item in GasFlowMeterOptions"
+                  :key="item.Id"
+                  :value="item.Id"
+                  :label="item.Code">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="差压变送器" prop="DifPressTranID" label-width="120px" style="width: 100%" :rules="[{ required: true, message: '差压变送器不能为空'}]">
+              <el-select ref="selectDifPressTran" v-model="formData.DifPressTranID" filterable default-first-option placeholder="请选择" style="width: 100%">
+                <el-option
+                  v-for="item in DifPressTranOptions"
+                  :key="item.Id"
+                  :value="item.Id"
+                  :label="item.Code">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="备注" prop="Remark" label-width="80px">
+              <el-input v-model="formData.Remark" placeholder="请输入备注"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="datadialogVisible = false">取 消</el-button>
+        <el-button v-if="this.service_flag=='add'" type="primary" @click="addData()">保 存</el-button>
+        <el-button v-if="this.service_flag=='edit'" type="primary" @click="editData()">保 存</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  // import Vue from 'vue'
+  import axios from 'axios'
+  import uploadajax from '../../../assets/js/uploadajax.js'
+  import {
+    mapGetters
+  } from 'vuex'
+  export default {
+    computed: {
+      ...mapGetters({
+        authUser: 'authUser'
+      })
+    },
+    data () {
+      return {
+        SafAccDetectorOptions: [],
+        GasFlowMeterOptions: [],
+        DifPressTranOptions: [],
+
+
+        downloading: false,
+        currentItemCount: 0,
+        currentPage: 1,
+        size: 10,
+        datadialogVisible: false,
+        datalist: [],
+        operatingitem: 0,
+        // 列表排序
+        Column: {
+          Order: '',
+          Prop: ''
+        },
+        dialogtitle: '',
+        service_flag: '',
+        formData: {
+          Id: '',
+          SADID: '',
+          GasFlowMeterID: '',
+          DifPressTranID: '',
+          SAD: '',
+          GasFlowMeter: '',
+          DifPressTran: '',
+          Remark: ''
+        }
+      }
+    },
+    created () {
+      this.initData()
+      this.getDictOptions()
+    },
+    methods: {
+      opendatadialog (item, v) {
+        // this.operatingitem = item
+        this.datadialogVisible = true
+
+        // this.clearorganizeform()
+        if (item === 1) {
+          this.formData.Id = 0
+          this.service_flag = 'add'
+          this.dialogtitle = `新增`
+        } else if (item === 2) {
+          this.service_flag = 'edit'
+          this.formData.Id = v.Id
+          this.formData.SADID = v.SADID
+          this.formData.GasFlowMeterID = v.GasFlowMeterID
+          this.formData.DifPressTranID = v.DifPressTranID
+          this.formData.SAD = v.SAD
+          this.formData.GasFlowMeter = v.GasFlowMeter
+          this.formData.DifPressTran = v.DifPressTran
+          this.formData.Remark = v.Remark
+          this.dialogtitle = `编辑`
+        }
+      },
+
+      initData () {
+        // 分页及列表条件
+        let params = {
+          _currentPage: this.currentPage,
+          _size: this.size,
+          Order: this.Column.Order,
+          Prop: this.Column.Prop
+        }
+        this.$axios.get('/instrument/instrumentgrouplist', params)
+          .then(res => {
+            this.datalist = res.data.items
+            this.currentItemCount = res.data.currentItemCount
+          })
+          .catch(function (error) {
+            console.log(error)
+          })
+      },
+      getDictOptions () {
+        this.$axios.get('/instrument/dictlist/').then(res => {
+          this.SafAccDetectorOptions = res.data.items['SafAccDetector']
+          this.GasFlowMeterOptions = res.data.items['GasFlowMeter']
+          this.DifPressTranOptions = res.data.items['DifPressTran']
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+
+      addData () {
+        this.$refs['formData'].validate((valid) => {
+          if (valid) {
+            this.formData.SAD = this.$refs.selectSAD.selectedLabel + ''
+            this.formData.GasFlowMeter = this.$refs.selectGasFlowMeter.selectedLabel + ''
+            this.formData.DifPressTran = this.$refs.selectDifPressTran.selectedLabel + ''
+            this.$axios.post('/instrument/addinstrumentgroup', this.formData).then(res => {
+              // response
+              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)
+              })
+          } else {
+            return false
+          }
+        })
+      },
+      editData () {
+        this.$refs['formData'].validate((valid) => {
+          if (valid) {
+            this.formData.SAD = this.$refs.selectSAD.selectedLabel + ''
+            this.formData.GasFlowMeter = this.$refs.selectGasFlowMeter.selectedLabel + ''
+            this.formData.DifPressTran = this.$refs.selectDifPressTran.selectedLabel + ''
+            this.$axios.post('/instrument/updateinstrumentgroup/' + this.formData.Id, this.formData).then(res => {
+              // response
+              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)
+              })
+          } else {
+            return false
+          }
+        })
+      },
+      deleteEntity (val) {
+        let _this = this
+        _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            _this.$axios.delete('instrument/deleteinstrumentgroup/' + val.Id, {})
+              .then(function (response) {
+                // response
+                if (response.data.code === 0) {
+                  _this.$message({
+                    type: 'success',
+                    message: response.data.message
+                  })
+                  // 更新界面
+                  _this.initData()
+                } else {
+                  _this.$message({
+                    type: 'warning',
+                    message: response.data.message
+                  })
+                }
+              })
+              .catch(function (error) {
+                console.log(error)
+              })
+          })
+          .catch(() => {})
+      },
+
+      // //清空查询结构体
+      // clearSearch() {
+      //   this.searchForm.Name = ''
+      //   this.initData()
+      // },
+      seachdata () {
+        this.currentPage = 1
+        this.initData()
+      },
+      orgtreeNodeClick (data) {
+        if (data.id === 61) {
+          this.exId = ''
+        } else {
+          this.exId = data.id + ''
+        }
+        this.currentPage = 1
+        this.initData()
+      },
+      handleSizeChange (val) {
+        this.size = val
+        this.currentPage = 1
+        this.initData()
+      },
+      handleCurrentChange (val) {
+        this.currentPage = val
+        this.initData()
+      },
+      // 列表排序功能
+      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.initData()
+      },
+      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, 19)
+        }
+      }
+    }
+  }
+</script>
+
+<style lang="scss">
+  .el-pagination {
+    margin: 1rem 0 2rem;
+    text-align: right;
+  }
+
+  /*.triggerone {*/
+    /*font-size: 13px;*/
+    /*margin-left: 80px;*/
+  /*}*/
+
+  /*.plab {*/
+    /*font-size: 13px;*/
+    /*color: #999;*/
+  /*}*/
+
+  /*.lookuptable {*/
+    /*font-size: 20px;*/
+
+    /*td {*/
+      /*padding-left: 10px;*/
+    /*}*/
+
+    /*tr:nth-child(even) {*/
+      /*background: #FFFFFF*/
+    /*}*/
+
+    /*tr:nth-child(odd) {*/
+      /*background: #F0F0F0*/
+    /*}*/
+  /*}*/
+    /*<!--.attach-uploader .el-upload {-->*/
+    /*<!--border: 1px dashed #63B8FF;-->*/
+    /*<!--cursor: pointer;-->*/
+    /*<!--position: relative;-->*/
+    /*<!--overflow: hidden;-->*/
+    /*<!--margin-bottom: -20px;-->*/
+  /*<!--}-->*/
+
+  /*.attach-uploader .el-upload:hover {*/
+    /*border-color: #228B22;*/
+  /*}*/
+    /*.attach-uploader-icon {*/
+    /*font-size: 25px;*/
+    /*color: #63B8FF;*/
+    /*width: 50px;*/
+    /*height: 50px;*/
+    /*line-height: 50px;*/
+    /*text-align: center;*/
+  /*}*/
+
+  /*.attach-uploader-icon:hover {*/
+    /*color: #228B22;*/
+  /*}*/
+
+</style>