浏览代码

财务调整

wangqiang 1 年之前
父节点
当前提交
363628fb23
共有 3 个文件被更改,包括 69 次插入31 次删除
  1. 7 0
      src/api/sys/OSSService.js
  2. 8 0
      src/api/sys/userService.js
  3. 54 31
      src/views/sys/cert/CertForm.vue

+ 7 - 0
src/api/sys/OSSService.js

@@ -4,6 +4,13 @@ import request from '@/utils/httpRequest'
 import { PUBLIC_MODULES_PATH as prefix } from "../AppPath";
 
 export default class OSSSerive {
+	queryById (id) {
+		return request({
+			url: prefix + '/oss/file/queryById',
+			method: 'get',
+			params: { id: id },
+		})
+	}
   saveMsg (param) {
     return request({
       url: prefix + '/oss/file/saveMsg',

+ 8 - 0
src/api/sys/userService.js

@@ -2,6 +2,14 @@ import request from "@/utils/httpRequest";
 import { SYS_PATH as prefix } from "../AppPath";
 
 export default {
+	saveCertList (inputForm) {
+		return request({
+			url: prefix + `/sys/user/saveCertList`,
+			method: 'post',
+			headers: {arrayFormat: 'repeat'},
+			data: inputForm
+		})
+	},
 	save: function (inputForm) {
 		return request({
 			url: prefix + "/sys/user/save",

+ 54 - 31
src/views/sys/cert/CertForm.vue

@@ -108,17 +108,18 @@
 				  </vxe-table-column>
 				  <vxe-table-column field="issuedDate" align="center" title="发证日期" :edit-render="{}">
 					  <template v-slot:edit="scope">
-						  <vxe-input v-model="scope.row.issuedDate" placeholder="发证日期" type="date" transfer></vxe-input>
+						  <el-date-picker style="width: 100%;" v-model="scope.row.issuedDate" placeholder="发证日期" type="date"
+										  value-format="YYYY-MM-DD" transfer></el-date-picker>
 					  </template>
 				  </vxe-table-column>
 				  <vxe-table-column field="enrollDate" align="center" title="注册日期" :edit-render="{}">
 					  <template v-slot:edit="scope">
-						  <vxe-input v-model="scope.row.enrollDate" type="date" placeholder="注册日期" clearable transfer></vxe-input>
+						  <el-date-picker style="width: 100%;" v-model="scope.row.enrollDate" value-format="YYYY-MM-DD" type="date" placeholder="注册日期" clearable transfer></el-date-picker>
 					  </template>
 				  </vxe-table-column>
 				  <vxe-table-column field="expireDate" align="center" title="到期日期" :edit-render="{}">
 					  <template v-slot:edit="scope">
-						  <vxe-input v-model="scope.row.expireDate" placeholder="到期日期" type="date" transfer></vxe-input>
+						  <el-date-picker style="width: 100%;" v-model="scope.row.expireDate" value-format="YYYY-MM-DD" placeholder="到期日期" type="date" transfer></el-date-picker>
 					  </template>
 				  </vxe-table-column>
 				  <vxe-table-column field="enrollCertNo" align="center" title="注册证书编号" :edit-render="{}">
@@ -127,10 +128,10 @@
 					  </template>
 				  </vxe-table-column>
 				  <vxe-table-column field="profession" align="center" title="专业" :formatter="formatLabel" :edit-render="{}">
-					  <template #edit="{ row }">
-						  <vxe-select v-model="row.profession" @change="changeProfession" placeholder="请选择专业" clearable style="width: 100%;" transfer>
+					  <template v-slot:edit="scope">
+						  <vxe-select v-model="scope.row.profession" @change="changeProfession" placeholder="请选择专业" clearable style="width: 100%;" transfer>
 							  <vxe-option
-								  v-for="item in row.professionList"
+								  v-for="item in scope.row.professionList"
 								  :key="item.value"
 								  :label="item.label"
 								  :value="item.label">
@@ -184,6 +185,7 @@ import SelectTree from '@/components/treeSelect/treeSelect.vue'
 import userService from '@/api/sys/userService'
 import postService from '@/api/sys/postService'
 import roleService from '@/api/sys/roleService'
+import OSSSerive from '@/api/sys/OSSService'
 // import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
 export default {
   data () {
@@ -222,13 +224,16 @@ export default {
         remarks: '', // 备注
         certDTOList: [] // 资格证书列表
       },
+		testList: [],
       professionList: [],
       tableKey: '',
       url: '',
       showViewer: false
     }
   },
+	ossService: null,
   created () {
+	  this.ossService = new OSSSerive()
   },
   mounted () {
   },
@@ -238,6 +243,7 @@ export default {
   },
   methods: {
     init (method, id) {
+    	this.testList = []
       this.method = method
       this.inputForm.id = id
       if (method === 'add') {
@@ -260,14 +266,24 @@ export default {
 
         if (method === 'edit' || method === 'view') { // 修改或者查看
           this.loading = true
-          userService.queryById(this.inputForm.id).then((data) => {
-            this.inputForm = this.recover(this.inputForm, data)
-            this.inputForm.oldLoginName = this.inputForm.loginName
-            if (this.commonJS.isEmpty(this.inputForm.certDTOList)) {
-              this.inputForm.certDTOList = []
-            }
-            this.loading = false
-          })
+			this.ossService.queryById(this.inputForm.id).then((data) => {
+				console.log('data', data)
+				this.inputForm = this.recover(this.inputForm, data)
+				this.inputForm.oldLoginName = this.inputForm.loginName
+				if (this.commonJS.isEmpty(this.inputForm.certDTOList)) {
+					this.inputForm.certDTOList = []
+				}
+				this.loading = false
+			})
+          // userService.queryById(this.inputForm.id).then((data) => {
+          // 	console.log('data', data)
+          //   this.inputForm = this.recover(this.inputForm, data)
+          //   this.inputForm.oldLoginName = this.inputForm.loginName
+          //   if (this.commonJS.isEmpty(this.inputForm.certDTOList)) {
+          //     this.inputForm.certDTOList = []
+          //   }
+          //   this.loading = false
+          // })
         }
       })
     },
@@ -290,31 +306,36 @@ export default {
       this.$refs['inputForm'].validate((valid) => {
         if (valid) {
           this.loading = true
+			console.log('this.inputForm.certDTOList', this.inputForm.certDTOList)
           this.inputForm.certDTOList.forEach((item, index) => {
-            if (this.commonJS.isEmpty(item.type)) {
+			  this.testList.push(item.row)
+          	console.log('item',item.type)
+            if (this.commonJS.isEmpty(item.row.type)) {
               this.$message.error('执业资格证书中第' + (index + 1) + '条数据的“证书类型”未填写')
               this.loading = false
               throw new Error()
             }
-            if (this.commonJS.isEmpty(item.no)) {
+            if (this.commonJS.isEmpty(item.row.no)) {
               this.$message.error('执业资格证书中第' + (index + 1) + '条数据的“证书编号”未填写')
               this.loading = false
               throw new Error()
             }
-            if (this.commonJS.isNotEmpty(item.issuedDate)) {
-              item.issuedDate = this.moment(item.issuedDate).format('YYYY-MM-DD')
+            if (this.commonJS.isNotEmpty(item.row.issuedDate)) {
+              item.issuedDate = this.moment(item.row.issuedDate).format('YYYY-MM-DD')
             }
-            if (this.commonJS.isNotEmpty(item.enrollDate)) {
-              item.enrollDate = this.moment(item.enrollDate).format('YYYY-MM-DD')
+            if (this.commonJS.isNotEmpty(item.row.enrollDate)) {
+              item.enrollDate = this.moment(item.row.enrollDate).format('YYYY-MM-DD')
             }
-            if (this.commonJS.isNotEmpty(item.expireDate)) {
-              item.expireDate = this.moment(item.expireDate).format('YYYY-MM-DD')
+            if (this.commonJS.isNotEmpty(item.row.expireDate)) {
+              item.expireDate = this.moment(item.row.expireDate).format('YYYY-MM-DD')
             } else {
               this.$message.error('执业资格证书中第' + (index + 1) + '条数据的“到期日期”未填写')
               this.loading = false
               throw new Error()
             }
           })
+			console.log('this.testList', this.testList)
+			this.inputForm.certDTOList = this.testList
           userService.saveCertList(this.inputForm).then((data) => {
             this.loading = false
             this.visible = false
@@ -338,15 +359,16 @@ export default {
       this.inputForm.certDTOList.splice(rowIndex, 1)
     },
     changeType (index) {
-      this.inputForm.certDTOList[index].profession = ''
-      if (this.inputForm.certDTOList[index].type === '1' || this.inputForm.certDTOList[index].type === '2') {
-        this.inputForm.certDTOList[index].professionList = this.$dictUtils.getDictList('sys_cert_profession_build')
-      } else if (this.inputForm.certDTOList[index].type === '3' || this.inputForm.certDTOList[index].type === '4') {
-        this.inputForm.certDTOList[index].professionList = this.$dictUtils.getDictList('sys_cert_profession_cost')
-      } else if (this.inputForm.certDTOList[index].type === '5') {
-        this.inputForm.certDTOList[index].professionList = this.$dictUtils.getDictList('sys_cert_profession_supervision')
-      } else if (this.inputForm.certDTOList[index].type === '6') {
-        this.inputForm.certDTOList[index].professionList = this.$dictUtils.getDictList('sys_cert_profession_accounting')
+    	console.log('this.inputForm.certDTOList[index].type',this.inputForm.certDTOList[index].type)
+      this.inputForm.certDTOList[index].row.profession = ''
+      if (this.inputForm.certDTOList[index].row.type === '1' || this.inputForm.certDTOList[index].row.type === '2') {
+        this.inputForm.certDTOList[index].row.professionList = this.$dictUtils.getDictList('sys_cert_profession_build')
+      } else if (this.inputForm.certDTOList[index].row.type === '3' || this.inputForm.certDTOList[index].row.type === '4') {
+        this.inputForm.certDTOList[index].row.professionList = this.$dictUtils.getDictList('sys_cert_profession_cost')
+      } else if (this.inputForm.certDTOList[index].row.type === '5') {
+        this.inputForm.certDTOList[index].row.professionList = this.$dictUtils.getDictList('sys_cert_profession_supervision')
+      } else if (this.inputForm.certDTOList[index].row.type === '6') {
+        this.inputForm.certDTOList[index].row.professionList = this.$dictUtils.getDictList('sys_cert_profession_accounting')
       }
     },
     changeProfession () {
@@ -365,6 +387,7 @@ export default {
     closeViewer () {
       this.url = ''
       this.showViewer = false
+		this.testList = []
     },
     // 格式化显示名称
     // 单元格或行在没有变成可编辑前、单元格或行在编辑状态结束后 都会执行此方法