Ver código fonte

设备管理台账

yuedefeng 6 anos atrás
pai
commit
94d382c9de

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

@@ -7,12 +7,16 @@ import (
 type LimsCheckEquipmentList struct {
 	Id              int       `json:"Id" xorm:"not null pk autoincr INT(10) 'Id'"`
 	DepartmentId    int       `json:"DepartmentId" xorm:"comment('二级单位ID') INT(10) 'DepartmentId'"`
+	Departmentname   string    `json:"DepartmentName" xorm:"comment('二级单位名称') VARCHAR(500) 'DepartmentName'"`
 	OrderNo         int       `json:"OrderNo" xorm:"comment('序号') INT(10) 'OrderNo'"`
 	PositionCheckId int       `json:"PositionCheckId" xorm:"comment('检测地点ID') INT(11) 'PositionCheckId'"`
 	PositionCheck   string    `json:"PositionCheck" xorm:"comment('检测地点') VARCHAR(255) 'PositionCheck'"`
 	PositionID      int       `json:"PositionID" xorm:"comment('安装位置ID') INT(11) 'PositionID'"`
 	Position        string    `json:"Position" xorm:"comment('安装位置') VARCHAR(255) 'Position'"`
 	CustNo          string    `json:"CustNo" xorm:"comment('编号') VARCHAR(255) 'CustNo'"`
+	DeviceName       string    `json:"DeviceName" xorm:"comment('设备名称') VARCHAR(255) 'DeviceName'"`
+	TemplateTypeId   string    `json:"TemplateTypeId" xorm:"comment('模板分类ID') VARCHAR(255) 'TemplateTypeId'"`
+	TemplateTypeName string    `json:"TemplateTypeName" xorm:"comment('模板分类名称') VARCHAR(255) 'TemplateTypeName'"`
 	Spec            string    `json:"Spec" xorm:"comment('规格型号') VARCHAR(255) 'Spec'"`
 	SpecId          string    `json:"SpecId" xorm:"comment('规格型号Id') VARCHAR(255) 'SpecId'"`
 	Manufacturer    string    `json:"Manufacturer" xorm:"comment('制造厂家') VARCHAR(255) 'Manufacturer'"`

+ 4 - 1
src/dashoo.cn/backend/api/controllers/lims/limscheckequipmentlist.go

@@ -221,6 +221,7 @@ func (this *LimsCheckEquipmentListController) UpdateEntity() {
 		"Id",
 
 		"DepartmentId",
+		"DepartmentName",
 
 		"OrderNo",
 
@@ -233,7 +234,9 @@ func (this *LimsCheckEquipmentListController) UpdateEntity() {
 		"Position",
 
 		"CustNo",
-
+		"DeviceName",
+		"TemplateTypeId",
+		"TemplateTypeName",
 		"Spec",
 
 		"SpecId",

+ 251 - 79
src/dashoo.cn/frontend_web/src/pages/lims/checkequipmentlist/index.vue

@@ -2,19 +2,17 @@
 
 <template>
   <div>
-    <el-breadcrumb class="heading">
+    <!--<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-breadcrumb>-->
     <el-card class="box-card" style="height: calc(100vh - 115px);">
       <div slot="header">
         <span>
-          <i class="icon icon-table2"></i> 二级单位设备台账
+          <i class="icon icon-table2"></i> 设备台账
         </span>
         <span style="float: right;">
-          <router-link :to="'/lims/s5ovelimscheckequipmentlist/add/operation'">
-            <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;">添加</el-button>
-          </router-link>
+          <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="上报时间">
@@ -36,25 +34,8 @@
       <el-table :data="entityList" border height="calc(100vh - 243px)" style="width: 100%" @sort-change="orderby">
         <el-table-column label="操作" min-width="100" align="center" fixed>
           <template slot-scope="scope">
-            <router-link :to="'/lims/s5ovelimscheckequipmentlist/' + scope.row.Id + '/operation'">
-              <el-button type="text" title="编辑" size="small" icon="el-icon-edit"></el-button>
-            </router-link>
-
-            <el-popover placement="top" title="提示" v-model="scope.row.deleteConfirmFlag">
-              <el-alert
-                title=""
-                description="确认要删除吗?"
-                type="warning"
-                :closable="false">
-              </el-alert>
-              <br/>
-              <div style="text-align: right; margin: 0">
-                <el-button type="primary" size="mini" @click="deleteEntity(scope.row)">删除</el-button>
-              </div>
-              <el-button slot="reference" type="text" title="删除" style="margin-left:3px" size="small" @click="scope.row.deleteConfirmFlag = true">
-                <i class="el-icon-delete"></i>
-              </el-button>
-            </el-popover>
+            <el-button type="text" title="编辑" size="small" icon="el-icon-edit" @click="ShowEntityDialog(scope.row.Id)"></el-button>
+            <el-button size="small" style="margin-left:10px;" type="text" icon="el-icon-delete" title="删除" @click="deleteConfirm(scope.row)"></el-button>
           </template>
         </el-table-column>
 
@@ -137,11 +118,6 @@
             </el-form-item>
           </el-col>
 
-          <el-col :span="12">
-            <el-form-item label="规格型号Id">
-              <el-input size="mini" v-model="searchForm.SpecId" style="width:100%" placeholder="请输入"></el-input>
-            </el-form-item>
-          </el-col>
 
           <el-col :span="12">
             <el-form-item label="制造厂家">
@@ -163,11 +139,50 @@
       </span>
     </el-dialog>
 
+    <el-dialog title="编辑" :visible.sync="dialogFormVisible">
+      <el-form :model="formData" ref="EntityForm">
+        <el-form-item label="序号" :label-width="formLabelWidth">
+          <el-input v-model="formData.OrderNo" autocomplete="off"></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
+            v-model="formData.PositionCheckId" 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-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">确 定</el-button>
+      </div>
+    </el-dialog>
+
+
   </div>
 </template>
 <script>
-  import { mapGetters } from 'vuex';
-  import api from '@/api/lims/limscheckequipmentlist';
+  import { mapGetters } from 'vuex'
+  import api from '@/api/lims/limscheckequipmentlist'
+  import positionApi from '@/api/lims/customerposition'
 
   export default {
     computed: {
@@ -180,6 +195,7 @@
     data() {
       return {
         dialogVisible: false,
+        dialogFormVisible: false,
         //列表数据
         entityList: [],
         //分页参数
@@ -210,100 +226,117 @@
           Status: '',
 
         },
+        testTypeList: [],
+        projectTypeList: [],
+        customerTreeList: [],
         tableColumns: [
 
           {
-            prop: "Id",
-            label: '',
+            prop: 'Id',
+            label: 'ID',
             width: 100,
             sort: true
           },
 
           {
-            prop: "DepartmentId",
-            label: '二级单位ID',
-            width: 100,
-            sort: true
-          },
-
-          {
-            prop: "OrderNo",
+            prop: 'OrderNo',
             label: '序号',
             width: 100,
             sort: true
           },
 
           {
-            prop: "PositionCheckId",
-            label: '检测地点ID',
-            width: 100,
-            sort: true
-          },
-
-          {
-            prop: "PositionCheck",
-            label: '检测地点',
-            width: 100,
-            sort: true
-          },
-
-          {
-            prop: "PositionID",
-            label: '安装位置ID',
+            prop: 'CustNo',
+            label: '编号',
             width: 100,
             sort: true
           },
 
           {
-            prop: "Position",
-            label: '安装位置',
+            prop: 'Spec',
+            label: '规格型号',
             width: 100,
             sort: true
           },
 
           {
-            prop: "CustNo",
-            label: '编号',
+            prop: 'Manufacturer',
+            label: '制造厂家',
             width: 100,
             sort: true
           },
 
           {
-            prop: "Spec",
-            label: '规格型号',
+            prop: 'Status',
+            label: '产品状态',
             width: 100,
             sort: true
           },
 
           {
-            prop: "SpecId",
-            label: '规格型号Id',
+            prop: 'PositionCheckId',
+            label: '检测地点',
             width: 100,
             sort: true
           },
 
           {
-            prop: "Manufacturer",
-            label: '制造厂家',
+            prop: 'Position',
+            label: '安装位置',
             width: 100,
             sort: true
           },
 
           {
-            prop: "Status",
-            label: '产品状态',
+            prop: 'Department',
+            label: '二级单位',
             width: 100,
             sort: true
           },
 
-        ]
+        ],
+        formData: {
+          Id: '',
+          DepartmentId: '',
+          DepartmentName: '',
+          OrderNo: '',
+          PositionCheckId: '',
+          PositionCheck: '',
+          PositionID: '',
+          Position: '',
+          CustNo: '',
+          DeviceName: '',
+          TemplateTypeId: '',
+          TemplateTypeName: '',
+          Spec: '',
+          SpecId: '',
+          Manufacturer: '',
+          Status: '',
+          Remark: '',
+          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);
+      Object.assign(this.searchFormReset, this.searchForm)
       //查询列表
-      this.initDatas();
+      this.initDatas()
+      this.getProjectType()
+      this.getCustomerInfo()
       //this.getDictOptions()
     },
     methods: {
@@ -382,7 +415,16 @@
         this.currentPage = 1
         this.initDatas()
       },
-      deleteEntity(row) {
+      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) {
@@ -403,7 +445,53 @@
         });
       },
 
-      jstimehandle(val) {
+      // 检测报告
+      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') {
@@ -416,7 +504,7 @@
         }
       },
 
-      formatDateTime(date) {
+      formatDateTime (date) {
         var y = date.getFullYear();
         var m = date.getMonth() + 1;
         m = m < 10 ? ('0' + m) : m;
@@ -426,12 +514,96 @@
         var minute = date.getMinutes();
         minute = minute < 10 ? ('0' + minute) : minute;
         return y + '-' + m + '-' + d + ' ' + h + ':' + minute;
+      },
+
+      NewEntity () {
+        this.dialogFormVisible = true
+        this.formData.Id = 0
+      },
+
+      handlePositionChange (value) {
+        this.formData.PositionCheckId = value[0]
+        this.formData.PositionID = value[1]
+      },
+      ShowEntityDialog (entityId) {
+        this.dialogFormVisible = true
+        this.initEntity(entityId)
+      },
+      initEntity (entityId) {
+        if (entityId) {
+          api.getEntity(entityId, this.$axios).then(res => {
+            this.formData = res.data
+          }).catch(err => {
+            console.error(err)
+          })
+        }
+      },
+
+      // 保存信息
+      saveEntity () {
+        this.$refs['EntityForm'].validate((valid) => {
+          if (valid) {
+            this.formData.TemplateTypeName = this.$refs.refProjectTypeId.selectedLabel + ''
+
+            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.initDatas()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+
+      updateEntity () {
+        api.updateEntity(this.formData.Id, this.formData, 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)
+        })
       }
     }
   }
-
 </script>
 
-<style lang="scss">
-
+<style lang='scss'>
+  .el-pagination {
+    margin: 1rem 0 2rem;
+    text-align: right;
+  }
 </style>

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

@@ -534,8 +534,7 @@
         }
         api.customerCheckBuildList(params, this.$axios).then(res => {
           this.customerOrigList = res.data.items
-        })
-        .catch(err => {
+        }).catch(err => {
           // handle error
           console.error(err)
         })
@@ -543,7 +542,7 @@
 
       gettreelist() {
         let params = {
-          CustomerId: this.CustomerId + "",
+          CustomerId: this.CustomerId + '',
         };
 
         api.customerPositionTree(params, this.$axios).then(res => {