diff --git a/src/views/components/SearchForm.vue b/src/views/components/SearchForm.vue index d548dec..d9f7879 100644 --- a/src/views/components/SearchForm.vue +++ b/src/views/components/SearchForm.vue @@ -49,48 +49,41 @@ - + - - - - +
+ - + {{ item.deptAlias }} + + - - - - 添加 - + + + + 添加 + +
2.最大支持2MB的xls/xlsx文件
3.一次导入患者数量不能超过5000
- 自动去除当日重复记录 + 自动去除当日重复记录
+ - - - - - - - - + + + + + + + + @@ -449,15 +450,16 @@ export default { }, data() { return { - loading:false, - patientInfoList:[], - datalist:[], - openphone:false, + departmentsshow: false,//添加按钮 + loading: false, + patientInfoList: [], + datalist: [], + openphone: false, form: {}, uploadopen: false, fileList: [], - records:true, - + records: true, + action: { data: { records: '', @@ -478,7 +480,7 @@ export default { rules: { deptAliasVOS: { departmentName: [ - { required: true, message: "科室不能为空", trigger: "blur" } + { required: true, message: "1111111", trigger: "blur", } ] }, @@ -495,7 +497,7 @@ export default { departmentoptions: [], nodeTypeoptions: [], isResouceShow: 1, - indexadd: "", + indexadd: undefined, showMask: false,//遮罩层 progress: 0, // 表单校验--添加 @@ -551,38 +553,48 @@ export default { methods: { handleAvatarSuccess(response, file, fileList) { console.log(response, file, fileList, 'response, file, fileList') - if (response.code == 500) { + if (response.code == 500 && !response.data) { this.$modal.msgError(response.msg); - }else if(response.code == 500_2){ - this.openphone=true; + } else if (response.code == 5002) { + this.openphone = true; + this.patientInfoList=response.data + + } else if (response.code == 500 && response.data) { + if (response.data.departments) { + this.form = response.data + } else { + this.form.deptAliasVOS = response.data.deptAliasVOS + this.form.departments = [] + this.departmentsshow = true + } + this.open = true; + } - else if (response.code == 200 && !response.data) { + else if (response.code == 200 && !response.data) { this.$modal.msgSuccess("导入成功"); this.$emit('handleRules') } else if (response.code == 200 && response.data) { this.form = response.data this.open = true; - } this.uploadcancel(); + this.fileList = []; }, handleRemove(file, fileList) { console.log(file, fileList); }, handlePreview(file) { - console.log(file, '000000'); }, //导入相关的方法 submitUpload() { - console.log(this.action,'action') - if(this.records==true){ - this.action.data.records=1 + if (this.records == true) { + this.action.data.records = 1 - }else{ - this.action.data.records=0 + } else { + this.action.data.records = 0 } this.$refs.upload.submit(); }, @@ -599,8 +611,8 @@ export default { ); }, // 列表取消 - cancelphone(){ - this.openphone=false; + cancelphone() { + this.openphone = false; }, // 导入 handleUpload() { @@ -609,7 +621,7 @@ export default { this.uploadopen = true; - this.records=true; + this.records = true; this.fileList = []; this.form = {}; @@ -660,7 +672,9 @@ export default { // 点击事件 changeway(e, index) { console.log(e, index, 'e') - this.form.deptAliasVOS[index].departmentName = this.form.departments.find(f => f.id == e).departmentName + // this.$set(this.form.deptAliasVOS[this.indexadd], 'departmentName', this.formadd.departmentName) + + // this.form.deptAliasVOS[index].departmentName = this.form.departments.find(f => f.id == e).departmentName // this.form.deptAliasVOS[index].departmentId = e this.$nextTick(() => { @@ -814,6 +828,7 @@ export default { }, /** 提交按钮 --添加*/ submitFormadd() { + console.log(this.form, 'this.forma000000000000000000') let reg = new RegExp("-", "g"); if (this.formadd.establishDate && this.formadd.revokeDate && new Date(this.formadd.establishDate.replace(reg, "/")) > new Date(this.formadd.revokeDate.replace(reg, "/"))) { @@ -823,18 +838,21 @@ export default { this.$refs["formadd"].validate((valid) => { if (valid) { if (!this.formadd.hospitalAgencyId) { - this.formadd.hospitalAgencyId = this.formadd.hospitalAgencyIdtwo - } - // this.formadd.hospitalAgencyId = this.formadd.hospitalAgencyIdtwo + this.formadd.hospitalAgencyId = this.formadd.hospitalAgencyIdtwo + } var obj = { departmentName: this.formadd.departmentName, id: '' } - this.form.departments.push(obj) - this.form.deptAliasVOS[this.indexadd].departmentName = this.formadd.departmentName console.log(this.formadd, 'this.formadd') + console.log(this.form, 'this.form') addDepartment(this.formadd).then((response) => { this.$modal.msgSuccess("添加成功"); + this.form.departments.push(obj) + console.log(this.form.deptAliasVOS) + // this.form.deptAliasVOS[this.indexadd].departmentName = this.formadd.departmentName + this.$set(this.form.deptAliasVOS[this.indexadd], 'departmentName', this.formadd.departmentName) + // this.$forceUpdate() this.openadd = false; // this.getList(); }); @@ -844,16 +862,32 @@ export default { }, /** 提交按钮 */ submitForm() { - console.log(this.form, 'this.form确定') - this.$refs["form"].validate(valid => { - if (valid) { - secondaryUpload(this.form).then(response => { + // this.$forceUpdate() + var emptyItems = [] + emptyItems = this.form.deptAliasVOS.filter(f => f.departmentName=="" || f.departmentName==null) + console.log(emptyItems, 'this.emptyItems') + + if (emptyItems.length > 0) { + this.$modal.msgError("必填项请填写完整,再进行提交"); + }else{ + secondaryUpload(this.form).then(response => { this.$modal.msgSuccess("保存成功"); this.open = false; this.$emit('handleRules') }); - } - }); + + + } + + // this.$refs["form"].validate(valid => { + // if (valid) { + // secondaryUpload(this.form).then(response => { + // this.$modal.msgSuccess("保存成功"); + // this.open = false; + // this.$emit('handleRules') + // }); + // } + // }); }, // 屏幕resize监听 screenChange() { @@ -905,12 +939,12 @@ export default { height: 28px !important; } } -::v-deep .el-checkbox__label{ +::v-deep .el-checkbox__label { font-size: 12px; } -::v-deep .el-checkbox__inner{ +::v-deep .el-checkbox__inner { width: 12px; - height: 12px; + height: 12px; } .el-cascader .el-input input::-webkit-input-placeholder { color: black;