Browse Source

1.协议客户分页功能,2.样本检测编辑功能

hanmj 6 years ago
parent
commit
af73be4f92

+ 2 - 2
src/dashoo.cn/backend/api/business/samplescustomer/samplescustomorService.go

@@ -28,10 +28,10 @@ func (s *SamplesCustomorService) GetCustomorProtocollist(pageIndex, itemsPerPage
 		where = " 1=1 "
 	}
 	//获取总记录数
-	sqlCount := `select count(*) from ` + samplescustomor + ` where ` + where
+	sqlCount := `select count(*) from ` + samplescustomor + ` b where ` + where
 	var sql string
 	sql = `select a.*,b.ProtocolNo,b.PId from ` + samplescustomor +
-		` a left join ` + samplesprotocol + ` b on a.IDCard=b.IDCard` +
+		` a left join ` + samplesprotocol + ` b on a.Id=b.CustomorId` +
 		` where ` + where + ` order by ` + order + ` limit ` + utils.ToStr((pageIndex-1)*itemsPerPage) + "," + utils.ToStr(itemsPerPage)
 
 	List := make([]SamplesCustomorModel, 0)

+ 82 - 86
src/dashoo.cn/frontend_web/src/pages/biobank/book/_opera/operation.vue

@@ -159,12 +159,12 @@
                 </el-option>
               </el-select>
             </el-form-item>
-            <!-- <el-form-item label="样本条码" prop="SampleCode">
+            <el-form-item label="样本条码" prop="SampleCode">
               <el-input v-model="transportForm.SampleCode" placeholder="样本条码" style="width: 100%"></el-input>
-            </el-form-item> -->
-            <el-form-item label="样本条码" prop="BarCode">
-              <el-input v-model="transportForm.BarCode" placeholder="样本条码" style="width: 100%"></el-input>
             </el-form-item>
+            <!-- <el-form-item label="样本条码" prop="BarCode">
+              <el-input v-model="transportForm.BarCode" placeholder="样本条码" style="width: 100%"></el-input>
+            </el-form-item> -->
             <el-form-item label="样本量" prop="SampleSize">
               <el-input v-model="transportForm.SampleSize" placeholder="样本量" style="width: 49%"></el-input>
               <el-select ref="reftube" v-model="transportForm.SampleUnit" placeholder="样本单位" style="width: 49%;float:right">
@@ -260,7 +260,7 @@
       })
     },
     name: 'materialdetect',
-    data() {
+    data () {
       var checkCapacity = (rule, value, callback) => {
         if (!isNaN(parseFloat(value)) && !isNaN(value)) {
           if (parseFloat(value) < 0) {
@@ -268,7 +268,6 @@
           } else {
             if (this.mainForm.SampleUnit == '') {
               callback(new Error('请选择样本单位'))
-              return
             } else {
               callback()
             }
@@ -286,13 +285,13 @@
         attrlist: [],
         SampleTypeIdnow: '',
         list: [],
-        pagetitle: '', //界面标题
+        pagetitle: '', // 界面标题
         ServiceId: '',
         Id: '',
         total: '',
-        samplebooklist: [], //检测样本列表
+        samplebooklist: [], // 检测样本列表
         activities: [],
-        sampletypeliste: [], //样本类型
+        sampletypeliste: [], // 样本类型
         sampeunitlist: [],
         mainForm: {
           SourceId: '',
@@ -313,8 +312,8 @@
         },
         Book_flag: false,
         authoer_flag: false,
-        bookdetailShow: false, //执行信息弹窗
-        samplesDetailTitle: '', //执行信息弹窗标题
+        bookdetailShow: false, // 执行信息弹窗
+        samplesDetailTitle: '', // 执行信息弹窗标题
         ParentId: '',
         transportForm: {
           SampleType: '',
@@ -334,7 +333,7 @@
           Name: '',
           IDCard: '',
           ProtocolStart: new Date(),
-          ConUserBy: '',
+          ConUserBy: ''
         },
         protocolShow: false,
         searchform: {
@@ -342,7 +341,7 @@
           ProtocolName: '',
           Name: ''
         },
-        //列表排序
+        // 列表排序
         Column: {
           Order: '',
           Prop: ''
@@ -351,10 +350,10 @@
           SuccessStatus: 0,
           AuditorRemark: ''
         },
-        auditorShow: false, //审核信息弹窗
+        auditorShow: false // 审核信息弹窗
       }
     },
-    created() {
+    created () {
       let _this = this
       this.ServiceId = this.$route.params.opera
       this.getsampleUnit()
@@ -376,8 +375,8 @@
       }
     },
     methods: {
-      //获取采集信息
-      getcollectioninfo(ServiceId) {
+      // 获取采集信息
+      getcollectioninfo (ServiceId) {
         let _this = this
         // request
         _this.$axios.get('/samplesbook/getcollectioninfo/' + _this.ServiceId, {})
@@ -395,15 +394,15 @@
             console.error(err)
           })
       },
-      savedata() {
+      savedata () {
         if (this.ServiceId == 'addbook' || this.ServiceId <= '0') {
           this.savebook()
         } else {
           this.editbook()
         }
       },
-      //添加采集信息主表
-      savebook() {
+      // 添加采集信息主表
+      savebook () {
         let _this = this
         _this.mainForm.State = parseInt(_this.mainForm.State)
         _this.$axios.post('/samplesbook/addbook/', _this.mainForm)
@@ -412,7 +411,7 @@
             if (res.data.code === 0) {
               _this.$message({
                 type: 'success',
-                message: res.data.message,
+                message: res.data.message
               })
               _this.ServiceId = res.data.item
               _this.Book_flag = true
@@ -428,10 +427,9 @@
             // handle error
             console.error(err)
           })
-
       },
-      //编辑采集主表信息
-      editbook() {
+      // 编辑采集主表信息
+      editbook () {
         let _this = this
         _this.mainForm.State = parseInt(_this.mainForm.State)
         _this.$axios.put('/samplesbook/editbook/' + _this.ServiceId, _this.mainForm)
@@ -456,11 +454,11 @@
             console.error(err)
           })
       },
-      //获取样本列表
-      getsampleList() {
+      // 获取样本列表
+      getsampleList () {
         let _this = this
         // request
-        this.$axios.get("/samplesbook/getsamplebooklist/" + _this.ServiceId, {})
+        this.$axios.get('/samplesbook/getsamplebooklist/' + _this.ServiceId, {})
           .then(res => {
             _this.samplebooklist = res.data.items
           })
@@ -469,9 +467,9 @@
             console.error(err)
           })
       },
-      //添加的弹窗
-      bookdetailshow() {
-        this.bookdetailShow = true //弹窗
+      // 添加的弹窗
+      bookdetailshow () {
+        this.bookdetailShow = true // 弹窗
         this.samplesDetailTitle = '新增样本信息'
         this.detail_flag = 'adddetail'
         this.transportForm = {
@@ -485,14 +483,14 @@
           Id: ''
         }
       },
-      //保存采集样本
-      savedetail() {
+      // 保存采集样本
+      savedetail () {
         let _this = this
         _this.transportForm.ParentId = parseInt(_this.ServiceId)
         _this.transportForm.SampleType = parseInt(_this.transportForm.SampleType)
         _this.transportForm.SampleTypeName = _this.$refs.samptype.selectedLabel + ''
         _this.transportForm.SampleSize = parseFloat(_this.transportForm.SampleSize)
-        this.$axios.post("/samplesbook/bookdetailadd", _this.transportForm)
+        this.$axios.post('/samplesbook/bookdetailadd', _this.transportForm)
           .then(res => {
             if (res.data.code == 0) {
               _this.$message({
@@ -517,7 +515,7 @@
       // nullReceive() {
       //   this.mainForm.ReceiveDate = new Date()
       // },
-      editsamples(val) {
+      editsamples (val) {
         this.bookdetailShow = true
         this.detail_flag = 'editdetail'
         this.samplesDetailTitle = '编辑样本信息'
@@ -528,8 +526,8 @@
         this.transportForm.SampleSize = val.SampleSize
         this.transportForm.SampleUnit = val.SampleUnit
       },
-      //编辑采集主表信息
-      editdetail() {
+      // 编辑采集主表信息
+      editdetail () {
         let _this = this
         _this.transportForm.SampleType = parseInt(_this.transportForm.SampleType)
         _this.transportForm.SampleTypeName = _this.$refs.samptype.selectedLabel + ''
@@ -557,49 +555,48 @@
             // handle error
             console.error(err)
           })
-
       },
-      deletesamples(val) {
-        let _this = this;
-        _this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          })
+      deletesamples (val) {
+        let _this = this
+        _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
           .then(() => {
             _this.$axios.delete('samplesbook/sampledelete/' + val.Id, {})
               .then(function (response) {
                 // response
                 if (response.data.code === 0) {
                   _this.$message({
-                    type: "success",
+                    type: 'success',
                     message: response.data.message
-                  });
+                  })
                   // 更新界面
-                  _this.getsampleList();
+                  _this.getsampleList()
                 } else {
                   _this.$message({
-                    type: "warning",
+                    type: 'warning',
                     message: response.data.message
-                  });
+                  })
                 }
               })
               .catch(function (error) {
-                console.log(error);
-              });
+                console.log(error)
+              })
           })
-          .catch(() => {});
+          .catch(() => {})
       },
 
-      auditor() {
+      auditor () {
         let _this = this
         _this.$refs['mainForm'].validate((valid) => {
           if (valid) {
-            _this.$confirm("确定审核该采集单?审核后所有信息将不可修改!", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning"
-              })
+            _this.$confirm('确定审核该采集单?审核后所有信息将不可修改!', '提示', {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+            })
               .then(() => {
                 if (_this.shenheForm.SuccessStatus == 0) {
                   _this.mainForm.BookStatus = 1
@@ -617,7 +614,7 @@
           }
         })
       },
-      saveauditor(mainForm) {
+      saveauditor (mainForm) {
         let _this = this
         _this.$axios.put('/samplesbook/auditorbook/' + _this.ServiceId, _this.mainForm)
           .then(res => {
@@ -641,9 +638,9 @@
           })
       },
 
-      //获取协议列表
-      getprotocollist() {
-        let _this = this;
+      // 获取协议列表
+      getprotocollist () {
+        let _this = this
         const params = {
           _currentPage: this.currentPage,
           _size: this.size,
@@ -652,26 +649,26 @@
         }
         Object.assign(params, this.searchform)
         _this.$axios.get('/samplesbook/getprotocollist', {
-            params
-          })
+          params
+        })
           .then(function (response) {
             _this.activities = response.data.items
             _this.currentItemCount = response.data.currentItemCount
           })
           .catch(function (error) {
-            console.log(error);
-          });
+            console.log(error)
+          })
       },
-      handleselect(val) {
+      handleselect (val) {
         this.mainForm.ProtocolNo = val.ProtocolNo
         this.mainForm.Name = val.Name
         this.mainForm.IdCard = val.IDCard
         this.protocolShow = false
       },
-      seachdata() {
+      seachdata () {
         this.getprotocollist()
       },
-      getsampleType() {
+      getsampleType () {
         let _this = this
         _this.$axios.get('/sampletype/list', {})
           .then(res => {
@@ -687,7 +684,7 @@
             }
           })
       },
-      getsampleUnit() {
+      getsampleUnit () {
         // 获取样本单位
         let _this = this
         _this.$axios.get('/sampletype/sunitajax', {})
@@ -696,10 +693,10 @@
           })
       },
       // 自动获取样本编码
-      choosetype() {
+      choosetype () {
         let _this = this
         _this.$axios.get('/sampleoperation/getbarcodeandsampletype?SampleType=' + _this.transportForm
-            .SampleType, {})
+          .SampleType, {})
           .then(res => {
             // response
             _this.transportForm.SampleSize = res.data.DefaultCapacity + ''
@@ -708,32 +705,31 @@
             _this.transportForm.BarCode = res.data.AutoCodeModel
           })
       },
-      jstimehandle(val) {
+      jstimehandle (val) {
         if (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);
+          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)
           }
         }
       },
-      handleCurrentChange(value) {
+      handleCurrentChange (value) {
         this.currentPage = value
         this.initdata()
       },
-      handleSizeChange(value) {
+      handleSizeChange (value) {
         this.size = value
         this.currentPage = 1
         this.initdata()
-      },
+      }
     }
   }
-
 </script>
 
 <style lang="scss">

+ 119 - 121
src/dashoo.cn/frontend_web/src/pages/biobank/sampletest/_opera/operation.vue

@@ -137,7 +137,7 @@
       </el-row>
       <el-row :gutter="20">
         <el-form :model="mainForm" label-width="100px">
-          <el-col :span="testdetail.length > 1 ? 12:24">
+          <el-col :span="testdetail && testdetail.length > 1 ? 12:24">
             <el-card v-if="mainForm.PackageId != ''" class="box-card sampletestmaincard">
               <div slot="header">
                 <legend style="color:#436EEE"></legend>
@@ -157,7 +157,7 @@
           </el-col>
 
           <el-col :span="12">
-            <el-card v-if="mainForm.PackageId != '' && testdetail.length > 1" class="box-card sampletestmaincard">
+            <el-card v-if="mainForm.PackageId != '' && testdetail &&  testdetail.length > 1" class="box-card sampletestmaincard">
               <div slot="header">
                 <legend style="color:#436EEE"></legend>
                 <i class="icon icon-paragraph-justify"> {{testdetail[1].TestName}}</i>
@@ -287,56 +287,56 @@
     computed: mapGetters({
       authUser: 'authUser'
     }),
-    data() {
+    data () {
       return {
-        breadcrumb: '', //面包屑标题
-        MainId: '', //检测主单ID
-        pageflag: '', //页面新增或编辑标志位
+        breadcrumb: '', // 面包屑标题
+        MainId: '', // 检测主单ID
+        pageflag: '', // 页面新增或编辑标志位
         currentItemCount: 0,
         currentPage: 1,
         size: 10,
         CurrentItemCount: 0,
         CurrentPage: 1,
         Size: 10,
-        mainForm: { //主表信息
-          InspectionNum: '', //检测单号
-          ProtocolNo: '', //协议号
-          SourceId: '', //样本来源ID
-          SourceIdCard: '', //身份证
-          SourceName: '', //样本源姓名
-          Sex: '', //性别
-          Telephone: '', //样本来源手机号
-          SampleCode: '', //样本编码
-          BarCode: '', //样本条码
-          SampleType: '', //样本类型
+        mainForm: { // 主表信息
+          InspectionNum: '', // 检测单号
+          ProtocolNo: '', // 协议号
+          SourceId: '', // 样本来源ID
+          SourceIdCard: '', // 身份证
+          SourceName: '', // 样本源姓名
+          Sex: '', // 性别
+          Telephone: '', // 样本来源手机号
+          SampleCode: '', // 样本编码
+          BarCode: '', // 样本条码
+          SampleType: '', // 样本类型
           SampleTypeName: '',
-          SamplingOrgan: '', //组织器官
+          SamplingOrgan: '', // 组织器官
           SamplingOrganName: '',
-          SamplingSite: '', //取材部位
+          SamplingSite: '', // 取材部位
           SamplingSiteName: '',
-          PackageId: '', //套餐
-          CheckTime: new Date(), //检测时间
-          CheckUserId: '', //检测人ID
-          CheckUserName: '', //检测人
-          HandleFlag: '', //是否处理,是否结果已出:0,未处理;1,结果已出
-          JudgmentFlag: '', //异常标志,结果里是否有异常项:0,正常;1,异常
-          AuditorFlag: '', //审核状态:0:未审核;1:审核通过
+          PackageId: '', // 套餐
+          CheckTime: new Date(), // 检测时间
+          CheckUserId: '', // 检测人ID
+          CheckUserName: '', // 检测人
+          HandleFlag: '', // 是否处理,是否结果已出:0,未处理;1,结果已出
+          JudgmentFlag: '', // 异常标志,结果里是否有异常项:0,正常;1,异常
+          AuditorFlag: '', // 审核状态:0:未审核;1:审核通过
           AuditorRemark: '',
-          AuditorOn: new Date(), //审核时间
-          AuditorUserId: '', //审核人ID
-          AuditorBy: '', //审核人
+          AuditorOn: new Date(), // 审核时间
+          AuditorUserId: '', // 审核人ID
+          AuditorBy: '', // 审核人
           CreateBy: '',
-          Remark: '' //备注
+          Remark: '' // 备注
         },
-        searchform: { //协议弹窗查找
-          ProtocolNo: '', //协议编码
-          IDCard: '' //身份证号
+        searchform: { // 协议弹窗查找
+          ProtocolNo: '', // 协议编码
+          IDCard: '' // 身份证号
         },
-        searchForm: { //协议弹窗查找
-          BarCode: '', //协议编码
-          Name: '' //姓名
+        searchForm: { // 协议弹窗查找
+          BarCode: '', // 协议编码
+          Name: '' // 姓名
         },
-        protocolsourcelist: [], //选择样本来源弹窗表格
+        protocolsourcelist: [], // 选择样本来源弹窗表格
         BarCodelist: [],
         detailForm: {
           TestItems: [{
@@ -347,15 +347,15 @@
           }]
         },
         testdetail: [{
-          TestItems: [], //检验项目
-          TestName: '', //检验名称
-          Total: '' //总数
+          TestItems: [], // 检验项目
+          TestName: '', // 检验名称
+          Total: '' // 总数
         }],
-        packagelist: [], //套餐下拉
-        sampletypelist: [], //样本类型下拉
+        packagelist: [], // 套餐下拉
+        sampletypelist: [], // 样本类型下拉
         choosesourcedialog: false,
         searchBarCodedialog: false,
-        searchProtocoldialog: false, //选择协议弹窗
+        searchProtocoldialog: false, // 选择协议弹窗
         mainrules: {
           InspectionNum: [{
             required: true,
@@ -419,11 +419,11 @@
           SuccessStatus: 0,
           AuditorRemark: ''
         },
-        auditorShow: false, //审核信息弹窗
-        authoer_flag: false,
+        auditorShow: false, // 审核信息弹窗
+        authoer_flag: false
       }
     },
-    mounted() {
+    mounted () {
       let _this = this
       _this.MainId = _this.$route.params.opera
       _this.DonorsId = this.$route.query.Id
@@ -431,30 +431,30 @@
         _this.breadcrumb = '新增样本检测'
         _this.pageflag = 'addsampletest'
         _this.mainForm.CreateBy = this.authUser.Profile.Realname
-        _this.getInspectionNum() //获取检测单号
-        _this.getallpackage() //获取检验套餐
-      } else if (typeof (_this.MainId) != 'undefined' && _this.MainId != '0') {
+        _this.getInspectionNum() // 获取检测单号
+        _this.getallpackage() // 获取检验套餐
+      } else if (typeof (_this.MainId) !== 'undefined' && _this.MainId != '0') {
         _this.breadcrumb = '编辑样本检测'
         _this.pageflag = 'editsampletest'
-        _this.getsampletestmain() //根据主表Id获取主单信息
+        _this.getsampletestmain() // 根据主表Id获取主单信息
       }
-      _this.getsampletype() //样本类型下拉
+      _this.getsampletype() // 样本类型下拉
     },
     methods: {
-      //获取检测单号
-      getInspectionNum() {
+      // 获取检测单号
+      getInspectionNum () {
         let _this = this
         this.$axios.get('/orderadd/getOrderNumgene?ordertype=2')
           .then(function (response) {
             _this.mainForm.InspectionNum = response.data.items + ''
             if (_this.DonorsId && _this.DonorsId != 0) {
               _this.back_flat = 1
-              _this.getDonorsBasic() //获取样本来源信息
+              _this.getDonorsBasic() // 获取样本来源信息
             }
           })
       },
-      //初始化套餐列表
-      getallpackage() {
+      // 初始化套餐列表
+      getallpackage () {
         let _this = this
         _this.$axios.get('/inspection/getallpackage')
           .then(res => {
@@ -473,8 +473,8 @@
             console.error(err)
           })
       },
-      //样本类型下拉
-      getsampletype() {
+      // 样本类型下拉
+      getsampletype () {
         let _this = this
         _this.$axios.get('/sampletype/list', {})
           .then(res => {
@@ -488,11 +488,10 @@
                 value: res.data.items[i].Id + ''
               })
             }
-
           })
       },
-      //根据主表Id获取主单信息
-      getsampletestmain() {
+      // 根据主表Id获取主单信息
+      getsampletestmain () {
         let _this = this
         _this.$axios.get('/sampletest/getsampletestmain/' + _this.MainId, {})
           .then(function (response) {
@@ -506,18 +505,18 @@
             _this.getsampletestitems()
           })
           .catch(function (error) {
-            console.log(error);
-          });
+            console.log(error)
+          })
       },
-      //获取样本检验子表检验项
-      getsampletestitems() {
+      // 获取样本检验子表检验项
+      getsampletestitems () {
         let _this = this
         let params = {
           InspectionNum: _this.mainForm.InspectionNum
         }
         _this.$axios.get('/sampletest/getsampletestlist/', {
-            params
-          })
+          params
+        })
           .then(res => {
             _this.testdetail = res.data.items
           })
@@ -525,15 +524,15 @@
             console.error(err)
           })
       },
-      //根据样本来源ID获取样本来源信息
-      getDonorsBasic() {
+      // 根据样本来源ID获取样本来源信息
+      getDonorsBasic () {
         let _this = this // request
         let params = {
           Id: this.DonorsId
         }
         _this.$axios.get('/sampletest/getdonorsbasic', {
-            params
-          })
+          params
+        })
           .then(res => {
             _this.mainForm.ProtocolNo = res.data.items.ProtocolNo
             _this.mainForm.SourceIdCard = res.data.items.IdCard
@@ -551,12 +550,12 @@
           })
       },
 
-      //保存信息
-      savemain() {
-        this.$refs["mainForm"].validate((valid) => {
+      // 保存信息
+      savemain () {
+        this.$refs['mainForm'].validate((valid) => {
           if (valid) {
             let _this = this
-            //处理检验项目结果
+            // 处理检验项目结果
             _this.detailForm.TestItems = []
             if (_this.testdetail && _this.testdetail.length > 0) {
               for (var i = 0; i < _this.testdetail.length; i++) {
@@ -565,7 +564,7 @@
                     Code: _this.testdetail[i].TestItems[j].Code,
                     ItemName: _this.testdetail[i].TestItems[j].ItemName,
                     Reference: _this.testdetail[i].TestItems[j].Reference,
-                    ResultData: _this.testdetail[i].TestItems[j].ResultData,
+                    ResultData: _this.testdetail[i].TestItems[j].ResultData
                   }
                   _this.detailForm.TestItems.push(items)
                 }
@@ -576,7 +575,7 @@
               _this.mainForm = Object.assign(_this.mainForm, _this.detailForm)
             }
             // _this.mainForm.SampleType = parseInt(_this.mainForm.SampleType)
-            //_this.mainForm.SampleTypeName = _this.$refs.refsampletype.selectedLabel
+            // _this.mainForm.SampleTypeName = _this.$refs.refsampletype.selectedLabel
             // _this.mainForm.Sex = parseInt(_this.mainForm.Sex)
             _this.$axios.post('/sampletest/addsampletestmain', _this.mainForm)
               .then(function (response) {
@@ -597,17 +596,17 @@
                 console.log(error)
               })
           } else {
-            console.log('error submit!!');
-            return false;
+            console.log('error submit!!')
+            return false
           }
         })
       },
-      //编辑信息
-      editmain() {
-        this.$refs["mainForm"].validate((valid) => {
+      // 编辑信息
+      editmain () {
+        this.$refs['mainForm'].validate((valid) => {
           if (valid) {
             let _this = this
-            //处理检验项目结果
+            // 处理检验项目结果
             _this.detailForm.TestItems = []
             if (_this.testdetail && _this.testdetail.length > 0) {
               for (var i = 0; i < _this.testdetail.length; i++) {
@@ -616,7 +615,7 @@
                     Code: _this.testdetail[i].TestItems[j].Code,
                     ItemName: _this.testdetail[i].TestItems[j].ItemName,
                     Reference: _this.testdetail[i].TestItems[j].Reference,
-                    ResultData: _this.testdetail[i].TestItems[j].ResultData,
+                    ResultData: _this.testdetail[i].TestItems[j].ResultData
                   }
                   _this.detailForm.TestItems.push(items)
                 }
@@ -625,7 +624,7 @@
             }
             _this.mainForm.SampleType = parseInt(_this.mainForm.SampleType)
             _this.mainForm.SampleTypeName = _this.mainForm.SampleType + ''
-            //_this.mainForm.SampleTypeName = _this.$refs.refsampletype.selectedLabel
+            // _this.mainForm.SampleTypeName = _this.$refs.refsampletype.selectedLabel
             // _this.mainForm.Sex = parseInt(_this.mainForm.Sex)
             _this.$axios.post('/sampletest/editsampletestmain/' + _this.MainId, _this.mainForm)
               .then(function (response) {
@@ -646,15 +645,15 @@
                 console.log(error)
               })
           } else {
-            console.log('error submit!!');
-            return false;
+            console.log('error submit!!')
+            return false
           }
         })
       },
-      //获取套餐检验项
-      getpackageitems() {
+      // 获取套餐检验项
+      getpackageitems () {
         let _this = this
-        //_this.detailForm.TestItems = []
+        // _this.detailForm.TestItems = []
         _this.$axios.get('/sampletest/getpackagelist/' + _this.mainForm.PackageId)
           .then(res => {
             _this.testdetail = res.data.items
@@ -663,8 +662,8 @@
             console.error(err)
           })
       },
-      //选择样本来源弹窗关闭
-      customsampsourceDialogCallback(val) {
+      // 选择样本来源弹窗关闭
+      customsampsourceDialogCallback (val) {
         if (val && (val.Id != 0 || val.Id != '')) {
           this.mainForm.SourceId = parseInt(val.Id)
           this.mainForm.SourceIdCard = val.IdCard
@@ -673,8 +672,8 @@
           this.mainForm.Telephone = val.Telephone
         }
       },
-      //查找已审核的协议表单
-      searchdata() {
+      // 查找已审核的协议表单
+      searchdata () {
         let _this = this
         _this.searchProtocoldialog = true
         let params = {
@@ -684,17 +683,17 @@
           idcard: _this.searchform.IDCard
         }
         _this.$axios.get('/samplesprotocol/getprotocollist', {
-            params
-          })
+          params
+        })
           .then(function (response) {
             _this.protocolsourcelist = response.data.items
             _this.currentItemCount = response.data.currentItemCount
           })
           .catch(function (error) {
-            console.log(error);
-          });
+            console.log(error)
+          })
       },
-      searchBarCode() {
+      searchBarCode () {
         let _this = this
         _this.searchBarCodedialog = true
         let params = {
@@ -704,17 +703,17 @@
           IDCard: _this.searchForm.IDCard
         }
         _this.$axios.get('/samplesbook/getbarcodelist', {
-            params
-          })
+          params
+        })
           .then(function (response) {
             _this.BarCodelist = response.data.items
             _this.CurrentItemCount = response.data.currentItemCount
           })
           .catch(function (error) {
-            console.log(error);
-          });
+            console.log(error)
+          })
       },
-      handleselect(val) {
+      handleselect (val) {
         let _this = this
         _this.mainForm.ProtocolNo = val.ProtocolNo
         _this.mainForm.SourceId = val.Id
@@ -728,7 +727,7 @@
         _this.mainForm.SampleTypeName = val.SampleTypeName
         _this.searchProtocoldialog = false
       },
-      Handleselect(val) {
+      Handleselect (val) {
         let _this = this
         _this.mainForm.ProtocolNo = val.ProtocolNo
         _this.mainForm.SourceId = val.SourceId
@@ -743,15 +742,15 @@
         _this.searchBarCodedialog = false
       },
 
-      auditor() {
+      auditor () {
         let _this = this
         _this.$refs['mainForm'].validate((valid) => {
           if (valid) {
-            _this.$confirm("确定审核该检测单?审核后所有信息将不可修改!", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning"
-              })
+            _this.$confirm('确定审核该检测单?审核后所有信息将不可修改!', '提示', {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+            })
               .then(() => {
                 if (_this.shenheForm.SuccessStatus == 0) {
                   _this.mainForm.AuditorFlag = 1
@@ -769,7 +768,7 @@
           }
         })
       },
-      saveauditor(mainForm) {
+      saveauditor (mainForm) {
         let _this = this
         _this.$axios.put('/sampletest/auditortest/' + _this.MainId, _this.mainForm)
           .then(res => {
@@ -793,26 +792,26 @@
           })
       },
 
-      handleSizeChange(value) {
+      handleSizeChange (value) {
         this.size = value
         this.currentPage = 1
         this.searchdata()
       },
-      handleCurrentChange(value) {
+      handleCurrentChange (value) {
         this.currentPage = value
         this.searchdata()
       },
-      HandleSizeChange(value) {
+      HandleSizeChange (value) {
         this.Size = value
         this.CurrentPage = 1
         this.searchBarCode()
       },
-      HandleCurrentChange(value) {
+      HandleCurrentChange (value) {
         this.CurrentPage = value
         this.searchBarCode()
       },
-      //返回按钮
-      goback() {
+      // 返回按钮
+      goback () {
         if (this.$route.query.size) {
           this.$router.push({
             name: this.$route.query.pname,
@@ -825,16 +824,15 @@
           this.$router.go(-1)
         }
       },
-      jssexhandle(val) {
+      jssexhandle (val) {
         if (val === '0') {
           return '男'
         } else if (val === '1') {
           return '女'
         }
-      },
+      }
     }
   }
-
 </script>
 
 <style lang="scss">

+ 128 - 128
src/dashoo.cn/frontend_web/src/pages/setting/sampletype/sampletypeadd.vue

@@ -77,7 +77,7 @@
           <div style="border: 1px solid rgb(204, 204, 204); overflow: auto; height: 120px;" label-width="130px">
             <el-checkbox-group v-model="selectdevices">
               <el-checkbox v-for="v in devicelist" @change="handleCheckeddeviceChange" style="margin-left:8px;"
-                :label="v.Id+''" :key="v">{{v.Name}}</el-checkbox>
+                :label="v.Id+''" :key="v.Id">{{v.Name}}</el-checkbox>
             </el-checkbox-group>
           </div>
           <el-checkbox style="margin-left:0px" v-model="checkAll" :indeterminate="isIndeterminate"
@@ -88,10 +88,10 @@
           <el-radio class="radio" v-model="imgtype" label="1">上传图片【图片格式:分辨率50*50,png类型。否则会影响显示效果】</el-radio>
           <div v-show="imgtype === '0'">
             <el-row>
-              <el-col :span="2" v-for="item in systemqiguanimglist" :key="item">
+              <el-col :span="2" v-for="item in systemqiguanimglist" :key="item.Id">
                 <div class="sampletypelist" v-bind:class="{'sampleselectedcss': selectsametyped == item.Id}"
-                  @click="selectsampletype(item.Id, item.ImgAddr)">
-                  <img :src="imghost + item.ImgAddr">
+                  @click="selectsampletype(item.Id, item.ImgAddr)" :key="item.Id">
+                  <img :src="imghost + item.ImgAddr" :key="item.Id">
                 </div>
               </el-col>
             </el-row>
@@ -109,20 +109,20 @@
 </template>
 <script>
   export default {
-    name: "sampletypeadd",
-    data() {
+    name: 'sampletypeadd',
+    data () {
       return {
-        imghost: "",
+        imghost: '',
         rulessampletypeinfo: {
           Code: [{
             required: true,
-            message: "请输入编码",
-            trigger: "blur"
+            message: '请输入编码',
+            trigger: 'blur'
           }],
           Name: [{
             required: true,
-            message: "请输入姓名",
-            trigger: "blur"
+            message: '请输入姓名',
+            trigger: 'blur'
           }]
         },
         currentItemCount: 0,
@@ -131,63 +131,63 @@
         list: [],
         devicelist: [],
         checkAll: false,
-        keyword: "",
-        dialogtitle: "",
+        keyword: '',
+        dialogtitle: '',
         operatingitem: 0,
         isIndeterminate: false,
         selectdevices: [],
         showquerydiv: false,
         systemqiguanimglist: [],
-        imgtype: "0",
+        imgtype: '0',
         selectsametyped: 0,
-        imageUrl: "",
+        imageUrl: '',
         SampleTypeForm: {
-          Name: "",
-          Code: "",
-          DefaultCapacity: "",
-          Unit: "",
+          Name: '',
+          Code: '',
+          DefaultCapacity: '',
+          Unit: '',
           ValidityHours: 0,
           Timelong: false,
           id: 0,
-          Remark: "",
+          Remark: '',
           Sensors: [],
-          Photo: "",
+          Photo: '',
           PhotoType: 0,
-          SubpackageCapacity: "", // 分装容量
-          SubpackageNum: 1,
+          SubpackageCapacity: '', // 分装容量
+          SubpackageNum: 1
         },
         checked: false,
         num1: 1,
         sampeunitlist: [] // 样本单位
-      };
-    },
-    created() {
-      this.imghost = process.env.imgserverhost;
+      }
+  },
+    created () {
+      this.imghost = process.env.imgserverhost
       // initial data
-      this.initData();
+      this.initData()
       // 加载单位
-      this.getsampetypeunit();
-    },
+      // this.getsampetypeunit()
+  },
     methods: {
-      initData() {
-        let _this = this;
+      initData () {
+        let _this = this
         const params = {
           _currentPage: this.currentPage,
           _size: this.size,
           keyword: this.keyword
-        };
+        }
         this.$axios
-          .get("sampletype/list", {
+          .get('sampletype/list', {
             params
           })
           .then(res => {
-            _this.list = res.data.items;
-            _this.currentItemCount = res.data.currentItemCount;
+            _this.list = res.data.items
+            _this.currentItemCount = res.data.currentItemCount
           })
           .catch(err => {
-            console.error(err);
-          });
-        this.$axios.get("/equipment/elist", {})
+            console.error(err)
+          })
+        this.$axios.get('/equipment/elist', {})
           .then(res => {
             for (var i = 0; i < res.data.items.length / 2; i++) {
               _this.devicelist.push({
@@ -196,172 +196,172 @@
               })
             }
           })
-          .catch(() => {});
+          .catch(() => {})
         this.$axios
-          .get("sampletype/imglist", {
+          .get('sampletype/imglist', {
             _currentPage: -1
           })
           .then(res => {
-            _this.systemqiguanimglist = res.data;
+            _this.systemqiguanimglist = res.data
           })
-          .catch(() => {});
+          .catch(() => {})
         this.$axios
-          .get("channels/list", {
+          .get('channels/list', {
             _currentPage: -1
           })
           .then(res => {
-            _this.devices = res.data.items;
+            _this.devices = res.data.items
             _this.devices.forEach((item, k) => {
-              _this.devicesallid.push(item.Id);
-            });
+              _this.devicesallid.push(item.Id)
+            })
           })
-          .catch(() => {});
+          .catch(() => {})
+        console.log(2222)
       },
-      getsampetypeunit() {
+      getsampetypeunit () {
         // 获取样本单位
-        let _this = this;
-        _this.$axios.get("sampletype/sunitajax", {}).then(res => {
-          _this.sampeunitlist = res.data;
-        });
+        let _this = this
+        _this.$axios.get('sampletype/sunitajax', {}).then(res => {
+          _this.sampeunitlist = res.data
+        })
       },
-      handleAvatarSuccess(res, file) {
-        this.SampleTypeForm.Photo = res;
-        this.imageUrl = URL.createObjectURL(file.raw);
+      handleAvatarSuccess (res, file) {
+        this.SampleTypeForm.Photo = res
+        this.imageUrl = URL.createObjectURL(file.raw)
       },
-      beforeAvatarUpload(file) {
-        const isimg = file.type.indexOf("image/") === 0;
-        const isLt50k = file.size / 1024 / 50 < 1;
+      beforeAvatarUpload (file) {
+        const isimg = file.type.indexOf('image/') === 0
+        const isLt50k = file.size / 1024 / 50 < 1
         if (!isimg) {
-          this.$message.error("上传图片只能是 图片 格式!");
-          return false;
+          this.$message.error('上传图片只能是 图片 格式!')
+          return false
         }
         if (!isLt50k) {
-          this.$message.error("上传图片大小不能超过 50kb!");
-          return false;
+          this.$message.error('上传图片大小不能超过 50kb!')
+          return false
         }
-        return true;
+        return true
       },
-      selectsampletype(v, imgpath) {
+      selectsampletype (v, imgpath) {
         if (v === this.selectsametyped) {
-          this.selectsametyped = 0;
-          this.SampleTypeForm.Photo = "";
+          this.selectsametyped = 0
+          this.SampleTypeForm.Photo = ''
         } else {
-          this.selectsametyped = v;
-          this.SampleTypeForm.Photo = imgpath;
+          this.selectsametyped = v
+          this.SampleTypeForm.Photo = imgpath
         }
       },
-      resetForm(formName) {
-        this.$refs[formName].resetFields();
+      resetForm (formName) {
+        this.$refs[formName].resetFields()
       },
-      clearForm() {
+      clearForm () {
         this.SampleTypeForm = {
-          Code: "",
-          Name: "",
-          DefaultCapacity: "",
-          Unit: "",
-          ValidityHours: "",
-          Remark: "",
+          Code: '',
+          Name: '',
+          DefaultCapacity: '',
+          Unit: '',
+          ValidityHours: '',
+          Remark: '',
           Sensors: [],
           Timelong: false,
-          SubpackageCapacity: "", // 分装容量
-          SubpackageNum: 1,
-        };
+          SubpackageCapacity: '', // 分装容量
+          SubpackageNum: 1
+        }
       },
-      savedata(formName) {
-        let _this = this;
+      savedata (formName) {
+        let _this = this
         this.$refs[formName].validate(valid => {
           if (valid) {
-            if (_this.SampleTypeForm.Photo === "") {
+            if (_this.SampleTypeForm.Photo === '') {
               _this.$message({
-                type: "warning",
-                message: "请选择样本图片!"
-              });
-              return;
+                type: 'warning',
+                message: '请选择样本图片!'
+              })
+              return
             }
-            _this.SampleTypeForm.Sensors = _this.selectdevices;
-            _this.SampleTypeForm.PhotoType = parseInt(_this.imgtype);
+            _this.SampleTypeForm.Sensors = _this.selectdevices
+            _this.SampleTypeForm.PhotoType = parseInt(_this.imgtype)
             _this.SampleTypeForm.DefaultCapacity = parseFloat(
               _this.SampleTypeForm.DefaultCapacity
-            );
+            )
             _this.SampleTypeForm.SubpackageCapacity = parseFloat(
               _this.SampleTypeForm.SubpackageCapacity
-            );
+            )
             _this.$axios
-              .post("sampletype", _this.SampleTypeForm)
+              .post('sampletype', _this.SampleTypeForm)
               .then(res => {
                 // response
                 if (res.data.code === 0) {
                   _this.$message({
-                    type: "success",
+                    type: 'success',
                     message: res.data.message
-                  });
-                  window.history.go(-1);
+                  })
+                  window.history.go(-1)
                 } else {
                   _this.$message({
-                    type: "warning",
+                    type: 'warning',
                     message: res.data.message
-                  });
+                  })
                 }
               })
               .catch(err => {
                 // handle error
-                console.error(err);
-              });
+                console.error(err)
+              })
           } else {
-            return false;
+            return false
           }
-        });
+        })
       },
-      deletedata(val) {
-        let _this = this;
+      deletedata (val) {
+        let _this = this
         _this
-          .$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
+          .$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
           })
           .then(() => {
             _this.$axios
-              .delete("sampletype" + val.Id, null)
+              .delete('sampletype' + val.Id, null)
               .then(res => {
                 // response
                 if (res.data.code === 0) {
                   _this.$message({
-                    type: "success",
+                    type: 'success',
                     message: res.data.message
-                  });
+                  })
                   // 更新界面
-                  this.initData();
+                  this.initData()
                 } else {
                   _this.$message({
-                    type: "warning",
+                    type: 'warning',
                     message: res.data.message
-                  });
+                  })
                 }
               })
-              .catch(() => {});
+              .catch(() => {})
           })
-          .catch(() => {});
+          .catch(() => {})
       },
-      handleCheckeddeviceChange() {
-        let checkedCount = this.selectdevices.length;
-        this.checkAll = checkedCount === this.devicelist.length;
+      handleCheckeddeviceChange () {
+        let checkedCount = this.selectdevices.length
+        this.checkAll = checkedCount === this.devicelist.length
         this.isIndeterminate =
-          checkedCount > 0 && checkedCount < this.devicelist.length;
+          checkedCount > 0 && checkedCount < this.devicelist.length
       },
-      handleCheckAllChange(val) {
-        let _this = this;
-        _this.selectdevices = [];
+      handleCheckAllChange (val) {
+        let _this = this
+        _this.selectdevices = []
         if (val) {
           _this.devicelist.forEach((item, k) => {
-            _this.selectdevices.push(item.Id + "");
-          });
+            _this.selectdevices.push(item.Id + '')
+          })
         }
-        this.isIndeterminate = false;
+        this.isIndeterminate = false
       }
     }
-  };
-
+  }
 </script>
 
 <style>