Browse Source

添加班级和人员

liuyang 5 years ago
parent
commit
5a91a37dc4

+ 3 - 3
backend/src/dashoo.cn/modi_webapi/app/api/class/class.go

@@ -107,9 +107,6 @@ func (c *Controller) GetOneClass(r *ghttp.Request) {
 // 修改一条班级信息
 func (c *Controller) UpdateClass(r *ghttp.Request) {
 	Class := new(class.Entity)
-	if Class.Id == 0 {
-		response.Json(r, -1, "Id不能为空")
-	}
 
 	if err := r.Parse(Class); err != nil {
 		// 数据验证错误
@@ -121,6 +118,9 @@ func (c *Controller) UpdateClass(r *ghttp.Request) {
 		response.Json(r, -1, err.Error())
 		r.ExitAll()
 	}
+	if Class.Id == 0 {
+		response.Json(r, -1, "Id不能为空")
+	}
 
 	realName := r.GetParamVar("realname").String()
 	currentTime := gtime.Now()

+ 5 - 30
frontend_web/src/views/class/components/classadd.vue

@@ -51,8 +51,6 @@
 
 <script>
 import ClassApi from '@/api/class'
-import axios from 'axios'
-import uploadajax from '@/assets/js/uploadajax.js'
 export default {
   name: 'classadd',
   data () {
@@ -69,19 +67,7 @@ export default {
       disabledbarcode: false,
       testlistform: {
         Name: '',
-        Year: '',
-        Classification: '',
-        Responsible: '',
-        State: 1,
-        Remarks: '',
-        CalibrationDeadlineType: 3,
-        CalibrationTime: new Date(),
-        CalibrationDeadline: 1,
-        HeartbeatTime: new Date(),
-        TimeNotification: 0,
-        MaintenCycle: 1,
-        CycleType: 3
-
+        Year: ''
       },
       Advancetime: 0,
       triggerlist: {},
@@ -91,14 +77,14 @@ export default {
 
       rulestestlistform: {
 
-        Code: [{
+        Year: [{
           required: true,
-          message: '请输入设备编码',
+          message: '请选择年级',
           trigger: 'blur'
         }],
         Name: [{
           required: true,
-          message: '请输入设备名称',
+          message: '请输入班级名称',
           trigger: 'blur'
         }]
       }
@@ -128,7 +114,6 @@ export default {
     savedata () {
       ClassApi.addClass(this.testlistform, {})
         .then(res => {
-          // response
           this.$emit('closeAddDialog')
           this.dialogvisible = false
           this.fileList = []
@@ -147,18 +132,8 @@ export default {
     },
     handleCloseAdd () {
       this.$refs['testlistform'].resetFields()
-      // this.$refs['uploader'].clearFiles()
-      this.testlistform.Code = ''
+      this.testlistform.Year = ''
       this.testlistform.Name = ''
-      this.testlistform.Brand = ''
-      this.testlistform.SupplierId = ''
-      this.testlistform.FactoryNum = ''
-      this.testlistform.Responsible = ''
-      this.testlistform.CalibrationDeadline = 1
-      this.testlistform.MaintenCycle = 1
-      this.testlistform.Model = ''
-      this.testlistform.Remarks = ''
-      this.testlistform.Classification = ''
       this.$emit('closeAddDialog')
     },
 

+ 18 - 13
frontend_web/src/views/class/components/classedit.vue

@@ -12,7 +12,7 @@
               class="donorsaddformcss">
         <el-col :span="8">
           <el-form-item label="年级"
-                        prop="testlistform.Year"
+                        prop="Year"
                         label-width="120px">
             <el-select ref="reftube"
                        v-model="testlistform.Year"
@@ -50,8 +50,6 @@
 </template>
 
 <script>
-import axios from 'axios'
-import uploadajax from '@/assets/js/uploadajax.js'
 import ClassApi from '@/api/class'
 
 export default {
@@ -85,25 +83,35 @@ export default {
 
       rulestestlistform: {
 
+        Year: [{
+          required: true,
+          message: '请选择年级',
+          trigger: 'blur'
+        }],
+        Name: [{
+          required: true,
+          message: '请输入班级名称',
+          trigger: 'blur'
+        }]
       }
     }
   },
   created () {
-    var myDate = new Date;
-    var year = myDate.getFullYear();
+    var myDate = new Date()
+    var year = myDate.getFullYear()
     this.initSelectYear(year)
   },
   methods: {
     init () {
-      var myDate = new Date;
-      var year = myDate.getFullYear();//获取当前年
+      var myDate = new Date()
+      var year = myDate.getFullYear()// 获取当前年
       this.initSelectYear(year)
-      this.form.recentYear = year;
+      this.form.recentYear = year
     },
     initSelectYear (year) {
-      this.years = [];
+      this.years = []
       for (let i = 0; i < 30; i++) {
-        this.years.push({ value: (year - i), label: (year - i) + "年" });
+        this.years.push({ value: (year - i), label: (year - i) + '年' })
       }
     },
     yearChange (value) {
@@ -112,7 +120,6 @@ export default {
 
     // 修改班级信息
     savedata () {
-      let _this = this
       ClassApi.updateClass(this.testlistform, {})
         .then(res => {
           this.dialogvisible = false
@@ -123,7 +130,6 @@ export default {
           // handle error
           console.error(err)
         })
-
     },
     getEntity (pid) {
       let _this = this
@@ -147,7 +153,6 @@ export default {
         })
     },
 
-
     // 计算日期
     addDate (date, days) {
       if (days === undefined || days === '') {

+ 1 - 1
frontend_web/src/views/duty/index.vue

@@ -147,7 +147,6 @@ export default {
       dutyId: -1,
       details: false,
       statusList: [],
-      activities: [],
       totalsize: 0,
       currpage: 1,
       size: 10,
@@ -262,6 +261,7 @@ export default {
       DutyApi.getPageList(params)
         .then(res => {
           _this.activities = res.records
+          _this.search.page.total = res.total
         })
     },
     handleSizeChange (val) {

+ 36 - 213
frontend_web/src/views/personnel/components/personneladd.vue

@@ -68,18 +68,6 @@
                       placeholder="请输入联系地址"></el-input>
           </el-form-item>
         </el-col>
-
-        <el-col :span="24">
-          <el-form-item label="备注信息"
-                        label-width="120px">
-            <el-input v-model="testlistform.Remarks"
-                      type="textarea"
-                      :rows=3
-                      placeholder="请输入备注信息"
-                      style="width:100%"></el-input>
-          </el-form-item>
-        </el-col>
-
       </el-row>
     </el-form>
     <span slot="footer">
@@ -93,18 +81,9 @@
 </template>
 
 <script>
-// import {
-//   classificationlist,
-//   personnelGetCode,
-//   getSavepersonnel,
-//   getsupplierlist
-// } from '@/api/personnel'
 import PersonnelApi from '@/api/personnel'
 import axios from 'axios'
 import uploadajax from '@/assets/js/uploadajax.js'
-// import { addTrigger,
-//   gettriggerlist
-// } from '@/api/trigger'
 export default {
   name: 'personneladd',
   data () {
@@ -141,212 +120,69 @@ export default {
       TimeNotification: false, // 有效期提醒
       classificationlist: [],
       getsupplierlist: [],
-      statelist: [{
-        stateName: '正常',
-        Id: 1
-      }, {
-        stateName: '维修',
-        Id: 2
-      }, {
-        stateName: '停用',
-        Id: 3
-      }],
-      timeType: [{
-        stateName: '天',
-        Id: 1
-      }, {
-        stateName: '周',
-        Id: 2
-      }, {
-        stateName: '月',
-        Id: 3
-      }, {
-        stateName: '年',
-        Id: 4
-      }],
       rulestestlistform: {
-
-        // Code: [{
-        //   required: true,
-        //   message: '请输入设备编码',
-        //   trigger: 'blur'
-        // }],
-        // Name: [{
-        //   required: true,
-        //   message: '请输入设备姓名',
-        //   trigger: 'blur'
-        // }]
-        // SupplierId: [{
-        //   required: true,
-        //   message: '请选择供应商',
-        //   trigger: 'blur'
-        // }],
-        // Model: [{
-        //   required: true,
-        //   message: '请输入型号',
-        //   trigger: 'blur'
-        // }],
-        // Spec: [{
-        //   required: true,
-        //   message: '请输入规格',
-        //   trigger: 'blur'
-        // }],
-        // Brand: [{
-        //   required: true,
-        //   message: '请输入品牌姓名',
-        //   trigger: 'blur'
-        // }],
-        // Classification: [{
-        //   required: true,
-        //   message: '请输入设备大类',
-        //   trigger: 'blur'
-        // }],
-        // State: [{
-        //   required: true,
-        //   message: '请输入设备状态',
-        //   trigger: 'blur'
-        // }]
+        PersonnelName: [{
+          required: true,
+          message: '请输入人员姓名',
+          trigger: 'blur'
+        }],
+        PersonneCode: [{
+          required: true,
+          message: '请输入人员编号',
+          trigger: 'blur'
+        }],
+        Telephone: [{
+          required: true,
+          message: '请输入电话',
+          trigger: 'blur'
+        }],
+        Mailbox: [{
+          required: true,
+          message: '请输入邮箱',
+          trigger: 'blur'
+        }],
+        CardId: [{
+          required: true,
+          message: '请输入身份证号',
+          trigger: 'blur'
+        }],
+        Address: [{
+          required: true,
+          message: '请输入联系地址',
+          trigger: 'blur'
+        }]
       }
     }
   },
   created () {
-    // let _this = this
-    // this.getclassificationlist()
-    // this.getSupplier()
   },
   methods: {
-    // 操作规程文件上传
-    uploadrequest (option) {
-      let _this = this
-      axios.post(this.$uploadFile, {})
-        .then(function (res) {
-          if (res.data && res.data.fid && res.data.fid !== '') {
-            option.action = `http://${res.data.url}/${res.data.fid}`
-            _this.uploadFile = {
-              uid: option.file.uid,
-              url: res.data.publicUrl,
-              fid: res.data.fid
-            }
-            uploadajax(option)
-          } else {
-            _this.$message({
-              type: 'warning',
-              message: '未上传成功!请刷新界面重新上传!'
-            })
-          }
-        })
-        .catch(function (error) {
-          console.log(error)
-          _this.$message({
-            type: 'warning',
-            message: '未上传成功!请重新上传!'
-          })
-        })
-    },
-    handleRemove (file, fileList) {
-      this.testlistform.FileUrl = ''
-      this.testlistform.FileName = ''
-      this.FileUrl = {}
-    },
-    handleUploadSuccess (res, file) {
-      this.testlistform.FileUrl = `${this.uploadFile.url}/${this.uploadFile.fid}`
-      this.testlistform.FileName = file.name
-      this.FileUrl = URL.createObjectURL(file.raw)
-    },
     savedata () {
       PersonnelApi.AddPersonnel(this.testlistform, {})
         .then(res => {
-          // response
-          console.log('--------', res)
-          // if (res.info.code === 0) {
-          //   _this.$message({
-          //     type: 'success',
-          //     message: res.info.message
-
-          //   })
-          //   // window.history.go(-1)
-          // } else {
-          //   _this.$message({
-          //     type: 'warning',
-          //     message: res.info.message
-          //   })
-          // }
-          // this.handleCloseAdd()
           this.$emit('closeAddDialog')
           this.dialogvisible = false
           this.fileList = []
           // 刷新
         })
         .catch(err => {
-          // handle error
           console.error(err)
         })
     },
-    // // 保存
-    // getCode (formName) {
-    //   let _this = this
-    //   this.$refs[formName].validate((valid) => {
-    //     personnelGetCode(_this.testlistform.Code)
-    //       .then(function (response) {
-    //         _this.total = response.info.items
-    //         if (_this.total === 0) {
-    //           _this.savedata()
-    //         } else {
-    //           _this.$message({
-    //             type: 'warning',
-    //             message: '设备编号已存在'
-    //           })
-    //         }
-    //         _this.refreshData()
-    //       })
-    //       .catch(function (error) {
-    //         console.log(error)
-    //       })
-    //   })
-    // },
     refreshData () {
       this.$emit('refreshData')
     },
-    // // 获取设备大类
-    // getclassificationlist () {
-    //   let _this = this
-    //   let params = {
-
-    //     code: 'PersonnelItem'
-    //   }
-    //   classificationlist(params)
-    //     .then(res => {
-    //       _this.classificationlist = res.info
-    //     })
-    // },
-    // 获取供应商
-    // getSupplier () {
-    //   let _this = this
-    //   let params = {
-    //     customerName: 'Supplier'
-    //   }
-    //   getsupplierlist(params)
-    //     .then(res => {
-    //       _this.getsupplierlist = res.info
-    //     })
-    // },
     closedialog () {
       this.dialogvisible = false
     },
     handleCloseAdd () {
       this.$refs['testlistform'].resetFields()
-      // this.$refs['uploader'].clearFiles()
-      this.testlistform.Code = ''
-      this.testlistform.Name = ''
-      this.testlistform.Brand = ''
-      this.testlistform.SupplierId = ''
-      this.testlistform.FactoryNum = ''
-      this.testlistform.Responsible = ''
-      this.testlistform.CalibrationDeadline = 1
-      this.testlistform.MaintenCycle = 1
-      this.testlistform.Model = ''
-      this.testlistform.Remarks = ''
-      this.testlistform.Classification = ''
+      this.testlistform.PersonnelName = ''
+      this.testlistform.PersonneCode = ''
+      this.testlistform.Telephone = ''
+      this.testlistform.Mailbox = ''
+      this.testlistform.CardId = ''
+      this.testlistform.Address = ''
       this.$emit('closeAddDialog')
     },
 
@@ -373,19 +209,6 @@ export default {
       var time = dates.getFullYear() + '-' + month + '-' + day
       return time
     }
-    // // 查询action
-    // getttriggernow (id, instumentid) {
-    //   gettriggerlist({}, id)
-    //     .then(res => {
-    //       let _this = this
-    //       _this.Advancetime = res.items.Advancetime
-    //       // 查询子表 有效期
-    //       _this.addTriggerl(instumentid, _this.testlistform.Code, _this.testlistform.TimeNotification, _this.testlistform.Name, _this.Advancetime, _this.testlistform.CalibrationTime, _this.testlistform.CalibrationDeadline, _this.testlistform.CalibrationDeadlineType)
-    //     })
-    //     .catch(err => {
-    //       console.error(err)
-    //     })
-    // }
 
   }
 }

+ 14 - 82
frontend_web/src/views/personnel/components/personneledit.vue

@@ -68,18 +68,6 @@
                       placeholder="请输入联系地址"></el-input>
           </el-form-item>
         </el-col>
-
-        <el-col :span="24">
-          <el-form-item label="备注信息"
-                        label-width="120px">
-            <el-input v-model="testlistform.Remarks"
-                      type="textarea"
-                      :rows=3
-                      placeholder="请输入备注信息"
-                      style="width:100%"></el-input>
-          </el-form-item>
-        </el-col>
-
       </el-row>
     </el-form>
     <span slot="footer">
@@ -96,18 +84,9 @@
 import axios from 'axios'
 import uploadajax from '@/assets/js/uploadajax.js'
 import PersonnelApi from '@/api/personnel'
-// import {
-//   initData,
-//   classificationlist,
-//   savedataedit,
-//   getsupplierlist
-// } from '@/api/personnel'
-// import { addTrigger,
-//   gettriggerlist,
-//   deletetriggerlistfordid
-// } from '@/api/trigger'
+
 export default {
-  name: 'personneladd',
+  name: 'personneledit',
   props: {
     PersonnelId: {
       default: 0
@@ -122,94 +101,47 @@ export default {
       formtype: '1',
       disabledbarcode: false,
       testlistform: {
-        Code: '',
-        Name: '',
-        Supplier: '',
-        SupplierId: '',
-        Model: '',
-        Brand: '',
-        Classification: '',
-        State: 1,
-        Remarks: '',
-        CalibrationDeadlineType: 2,
-        CalibrationTime: new Date(),
-        CalibrationDeadline: 1,
-        HeartbeatTime: new Date(),
-        TimeNotification: 0
       },
       Advancetime: 0,
       triggerlist: {},
       TimeNotification: false, // 有效期提醒
       classificationlist: [],
       getsupplierlist: [],
-      statelist: [{
-        stateName: '正常',
-        Id: 1
-      }, {
-        stateName: '维修',
-        Id: 2
-      }, {
-        stateName: '闲置',
-        Id: 3
-      }],
-      timeType: [{
-        stateName: '天',
-        Id: 1
-      }, {
-        stateName: '周',
-        Id: 2
-      }, {
-        stateName: '月',
-        Id: 3
-      }, {
-        stateName: '年',
-        Id: 4
-      }],
       rulestestlistform: {
-
-        Code: [{
-          required: true,
-          message: '请输入设备编码',
-          trigger: 'blur'
-        }],
-        Name: [{
+        PersonnelName: [{
           required: true,
-          message: '请输入设备姓名',
+          message: '请输入人员姓名',
           trigger: 'blur'
         }],
-        Supplier: [{
+        PersonneCode: [{
           required: true,
-          message: '请输入供应商',
+          message: '请输入人员编号',
           trigger: 'blur'
         }],
-        Model: [{
+        Telephone: [{
           required: true,
-          message: '请输入型号',
+          message: '请输入电话',
           trigger: 'blur'
         }],
-        Brand: [{
+        Mailbox: [{
           required: true,
-          message: '请输入品牌姓名',
+          message: '请输入邮箱',
           trigger: 'blur'
         }],
-        State: [{
+        CardId: [{
           required: true,
-          message: '请输入设备状态',
+          message: '请输入身份证号',
           trigger: 'blur'
         }],
-        Classification: [{
+        Address: [{
           required: true,
-          message: '请输入设备大类',
+          message: '请输入联系地址',
           trigger: 'blur'
         }]
-
       }
     }
   },
   created () {
-    //  this.getEntity(this.PersonnelId)
-    // this.getclassificationlist()
-    // this.getSupplier()
   },
   methods: {
     // 操作规程文件上传