瀏覽代碼

fix(证照管理) 页面优化

liu1tian 10 月之前
父節點
當前提交
8aff90b0e1

+ 17 - 1
src/api/qualityControl/qualityControl.js

@@ -49,7 +49,6 @@ export function byLicenseId(query) {
   })
 }
 
-
 // 文件上传 
 export function upload(data) {
   return request({
@@ -57,4 +56,21 @@ export function upload(data) {
     method: 'post',
     data: data
   })
+}
+
+// 提交保存 
+export function addOrEdit(data) {
+  return request({
+    url: '/mk/zj/zjLicenseInfo/addOrEdit',
+    method: 'post',
+    data: data
+  })
+}
+
+// 证照分类下拉列表
+export function getLicenseType() {
+  return request({
+    url: '/mk/zj/zjLicenseInfo/getLicenseType',
+    method: 'get'
+  })
 }

+ 6 - 1
src/views/qualityControl/approval.vue

@@ -85,7 +85,7 @@
   </template>
   
   <script>
-  import { listInfo } from "@/api/qualityControl/qualityControl.js";
+  import { listInfo, getLicenseType } from "@/api/qualityControl/qualityControl.js";
   
   export default {
     name: "Info",
@@ -143,6 +143,11 @@
     },
     created() {
       this.getList();
+      getLicenseType().then(res=>{
+            if(res.code == '200'){
+                this.licenseTypeList = res.data
+            }
+        });
     },
     methods: {
       /** 查询合作企业证照列表 */

+ 6 - 1
src/views/qualityControl/approved.vue

@@ -80,7 +80,7 @@
   </template>
   
   <script>
-  import { listInfo } from "@/api/qualityControl/qualityControl.js";
+  import { listInfo,getLicenseType } from "@/api/qualityControl/qualityControl.js";
   
   export default {
     name: "Info",
@@ -138,6 +138,11 @@
     },
     created() {
       this.getList();
+      getLicenseType().then(res=>{
+            if(res.code == '200'){
+                this.licenseTypeList = res.data
+            }
+        });
     },
     methods: {
       /** 查询合作企业证照列表 */

+ 55 - 32
src/views/qualityControl/gysDetail.vue

@@ -126,7 +126,7 @@
                 <el-col :span="6">
                     <span>经营方式:<el-input v-model="form.businessType" placeholder="请输入经营方式" style="width: 60%" :disabled="isFlag"/></span>
                 </el-col>
-                <el-col :span="5">
+                <el-col :span="6">
                     <span>
                         有效期至:
                         <el-date-picker
@@ -149,7 +149,7 @@
             <el-form-item class="container">
                 <el-button type="primary"  style="margin-right: 4vw;" @click="upload()" :disabled="isFlag">上传证照</el-button>
             </el-form-item> 
-            <el-form-item style="margin-left: -3vw; border: 5px solid #fff; padding: 5px; padding-top: 15px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);">
+            <el-form-item style="height: 205px; margin-left: -3vw; border: 5px solid #fff; padding: 5px; padding-top: 15px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);">
                 <el-col :span="3" v-for="imgs in imgList" :key="'index4-'+imgs.id" style="border-right: 1px solid #ebeef5;">
                     <el-image 
                         :src="imgs.filepath" 
@@ -227,8 +227,8 @@
             <el-form-item>
                 <div class="button-container">
                     <el-button type="danger" @click="qx" >取消</el-button>
-                    <el-button type="danger" @click="tj" v-show="!isFlag">提交</el-button>
-                    <el-button type="danger" @click="bc" v-show="!isFlag">保存</el-button>
+                    <el-button type="danger" @click="tj(2)" v-show="!isFlag">提交</el-button>
+                    <el-button type="danger" @click="bc(1)" v-show="!isFlag">保存</el-button>
                 </div>
             </el-form-item>
         </el-form> 
@@ -259,7 +259,7 @@
 <script>
   import axios from 'axios';
   import { getToken } from '@/utils/auth';
-  import { zjCompanyInfo, byCompanyCode, zjLicenseInfo, byLicenseId, upload } from "@/api/qualityControl/qualityControl";
+  import { zjCompanyInfo, byCompanyCode, zjLicenseInfo, byLicenseId, upload, addOrEdit, getLicenseType } from "@/api/qualityControl/qualityControl";
 export default {
     name: "qualityControlDetail",
     data() {
@@ -290,22 +290,7 @@ export default {
         id: '',
         items1: [],
         items2: [],
-        options: [{
-          value: '选项1',
-          label: '黄金糕'
-        }, {
-          value: '选项2',
-          label: '双皮奶'
-        }, {
-          value: '选项3',
-          label: '蚵仔煎'
-        }, {
-          value: '选项4',
-          label: '龙须面'
-        }, {
-          value: '选项5',
-          label: '北京烤鸭'
-        }],
+        options: [],
         scopeLevelList: [
         { 
           value: '1',
@@ -369,8 +354,14 @@ export default {
                 this.tableData = response.data
             }
         });
+        getLicenseType().then(res=>{
+            if(res.code == '200'){
+                this.options = res.data
+            }
+        });
     },
     methods: {
+       
          // 修改时自定义上传方法
         handleFileUpload(params){
             let newfile=params.file
@@ -450,13 +441,6 @@ export default {
             this.tableData.push(newRow);
         },
         deleteTable(e) {
-          if(this.tableData.length === 1){
-              this.$message({
-                  message: '当前行无法删除, 请至少保留一条适用科室信息!',
-                  type: 'warning'
-              });
-              return;
-          }
           this.tableData = this.tableData.filter(row => 
               row.id != e.id
           );
@@ -472,11 +456,50 @@ export default {
         qx(){
             this.$router.go(-1)
         },
-        tj(){
-
+        tj(state){
+            this.form.workState = state;
+            this.$set(this.form, 'zjBusinessScopeList', this.tableData);
+            this.$set(this.form, 'organizationId', this.baseInfoData.organizationId);
+            this.$set(this.form, 'companyAttributes', this.baseInfoData.companyAttributes);
+            this.$set(this.form, 'companySourceCode', this.baseInfoData.companySourceCode);
+            if(this.imgList.length>0){
+                let pics = '';
+                this.imgList.forEach(element => {
+                    pics += element.id+',';
+                });
+                if(pics!=''){
+                    pics = pics.slice(0, -1);   
+                    this.form.licensePicture = pics;  
+                }
+            }
+            addOrEdit(this.form).then(res=>{
+                if(res.code == 200){
+                    this.$modal.msgSuccess("提交成功");
+                    this.$router.go(-1)
+                }
+            })
         },
-        bc(){
-
+        bc(state){
+            this.form.workState = state;
+            this.$set(this.form, 'zjBusinessScopeList', this.tableData)
+            this.$set(this.form, 'organizationId', this.baseInfoData.organizationId);
+            this.$set(this.form, 'companyAttributes', this.baseInfoData.companyAttributes);
+            this.$set(this.form, 'companySourceCode', this.baseInfoData.companySourceCode);
+            if(this.imgList.length>0){
+                let pics = '';
+                this.imgList.forEach(element => {
+                    pics += element.id+',';
+                });
+                if(pics!=''){
+                    pics = pics.slice(0, -1);   
+                    this.form.licensePicture = pics;  
+                }
+            }
+            addOrEdit(this.form).then(res=>{
+                if(res.code == 200){
+                    this.$modal.msgSuccess("保存成功");
+                }
+            })
         },
         async sends(){
             const response = await axios.post('https://zhiguan.cognitiveservices.azure.cn/vision/v3.2/read/analyze', {'url': this.imgs}, {

+ 222 - 53
src/views/qualityControl/khDetail.vue

@@ -26,7 +26,7 @@
                     <el-tag
                         :label="item.id"
                         :value="item.licenseName"
-                        :type="item.serviceState == '0' ? 'info' : 'danger'"
+                        :type="item.serviceState == '0' ? 'danger' : 'info'"
                         style="width: 7.5vw; text-align: center;  height: 4vh; line-height:4vh;"
                         effect="plain">
                         {{ item.licenseName }}
@@ -38,7 +38,7 @@
                     <el-tag
                         :label="item.id"
                         :value="item.licenseName"
-                        :type="item.serviceState == '0' ? 'info' : 'danger'"
+                        :type="item.serviceState == '0' ? 'danger' : 'info'"
                         style="width: 7.5vw; text-align: center;  height: 4vh; line-height:4vh;"
                         effect="plain">
                         {{ item.licenseName }}
@@ -76,7 +76,7 @@
                 <el-col :span="6">
                     <span>经营方式:<el-input v-model="form.businessType" placeholder="请输入经营方式" style="width: 60%" :disabled="isFlag"/></span>
                 </el-col>
-                <el-col :span="5">
+                <el-col :span="6">
                     <span>
                         有效期至:
                         <el-date-picker
@@ -99,7 +99,7 @@
             <el-form-item class="container">
                 <el-button type="primary"  style="margin-right: 4vw;" @click="upload()" :disabled="isFlag">上传证照</el-button>
             </el-form-item> 
-            <el-form-item style="margin-left: -3vw; border: 5px solid #fff; padding: 5px; padding-top: 15px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);">
+            <el-form-item style="height: 205px; margin-left: -3vw; border: 5px solid #fff; padding: 5px; padding-top: 15px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);">
                 <el-col :span="3" v-for="imgs in imgList" :key="'index4-'+imgs.id" style="border-right: 1px solid #ebeef5;">
                     <el-image 
                         :src="imgs.filepath" 
@@ -177,8 +177,8 @@
             <el-form-item>
                 <div class="button-container">
                     <el-button type="danger" @click="qx" >取消</el-button>
-                    <el-button type="danger" @click="tj" v-show="!isFlag">提交</el-button>
-                    <el-button type="danger" @click="bc" v-show="!isFlag">保存</el-button>
+                    <el-button type="danger" @click="tj(2)" v-show="!isFlag">提交</el-button>
+                    <el-button type="danger" @click="bc(1)" v-show="!isFlag">保存</el-button>
                 </div>
             </el-form-item>
         </el-form> 
@@ -191,9 +191,9 @@
                 <el-upload
                     list-type="picture"
                     class="upload-demo"
-                    :action="uploadUrl"
-                    :on-success="handleSuccess"
+                    action="#"
                     :on-remove="handleRemove"
+                    :http-request="handleFileUpload"
                     :file-list="fileList">
                     <i class="el-icon-upload"></i>
                     <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
@@ -207,13 +207,16 @@
 </template>
   
 <script>
-  import { getToken } from '@/utils/auth'
-  import { zjCompanyInfo, byCompanyCode, zjLicenseInfo, byLicenseId } from "@/api/qualityControl/qualityControl";
-
+  import axios from 'axios';
+  import { getToken } from '@/utils/auth';
+  import { zjCompanyInfo, byCompanyCode, zjLicenseInfo, byLicenseId, upload, addOrEdit, getLicenseType } from "@/api/qualityControl/qualityControl";
 export default {
     name: "qualityControlDetail",
     data() {
       return {
+        key:'53cfd89363924f95b75b7221b6d0bfe3',
+        endpoint:'https://zhiguan.cognitiveservices.azure.cn/',
+        imgs: '',
         isFlag: false,
         form: {
             xxx: '2'
@@ -235,26 +238,9 @@ export default {
         },
         // 主表ID
         id: '',
-        items1: [
-        ],
-        items2: [
-        ],
-        options: [{
-          value: '选项1',
-          label: '黄金糕'
-        }, {
-          value: '选项2',
-          label: '双皮奶'
-        }, {
-          value: '选项3',
-          label: '蚵仔煎'
-        }, {
-          value: '选项4',
-          label: '龙须面'
-        }, {
-          value: '选项5',
-          label: '北京烤鸭'
-        }],
+        items1: [],
+        items2: [],
+        options: [],
         scopeLevelList: [
         { 
           value: '1',
@@ -318,8 +304,43 @@ export default {
                 this.tableData = response.data
             }
         });
+        getLicenseType().then(res=>{
+            if(res.code == '200'){
+                this.options = res.data
+            }
+        });
     },
     methods: {
+       
+         // 修改时自定义上传方法
+        handleFileUpload(params){
+            let newfile=params.file
+            let suffix = (newfile.name).substr((newfile.name).lastIndexOf("."));
+            newfile =new File([params.file], this.randomLong()+`${suffix}`)
+            newfile.uid=params.file.uid // new File 没有uid属性,会导致组件底层报错,这里手动加上
+            console.log(newfile)
+            // 使用FormData传参数和文件
+            var fileForm = new FormData();
+            // 文件
+            fileForm.append("file", newfile);
+            // 调用封装好的上传方法,传给后台FormData
+            upload(fileForm).then(res=>{
+                if(res && res.data.code == 200){
+                    this.fileList.push({
+                        'id': res.data.id,
+                        'name':res.data.filename,
+                        'url': process.env.NODE_ENV == "development"
+                        ? "https://dev-sy.derom.com/document-center/minio/"+res.data.filepath
+                        : "https://sy.derom.com/document-center/minio/"+res.data.filepath
+                    })
+                    this.imgs = process.env.NODE_ENV == "development"
+                        ? "https://sy.derom.com/01762feca72748b9b343c861753fe6f.png"
+                        : "https://sy.derom.com/document-center/minio/"+res.data.filepath
+                    this.sends()
+                    this.$modal.msgSuccess("上传成功");
+                }
+            })
+        },
         upload(){
             this.fileList = [];
             this.imgList.forEach(element => {
@@ -338,15 +359,6 @@ export default {
             })
             .catch(_ => {});
         },
-        handleSuccess(e){
-            this.fileList.push({
-                'id': e.id,
-                'name':e.filename,
-                'url': process.env.NODE_ENV == "development"
-                ? "https://dev-sy.derom.com/document-center/minio/"+e.filepath
-                : "https://sy.derom.com/document-center/minio/"+e.filepath
-            })
-        },
         canclUpload(){
             this.dialogVisible = false;
         },
@@ -375,17 +387,10 @@ export default {
             });
         },
         addTable() {
-            const newRow = { id: this.randomLong(), one: '', two: '', three: '', four: '' };
+            const newRow = { id: this.randomLong(), scopeLevel: '', code: '', name: '', remark: '' };
             this.tableData.push(newRow);
         },
         deleteTable(e) {
-          if(this.tableData.length === 1){
-              this.$message({
-                  message: '当前行无法删除, 请至少保留一条适用科室信息!',
-                  type: 'warning'
-              });
-              return;
-          }
           this.tableData = this.tableData.filter(row => 
               row.id != e.id
           );
@@ -401,12 +406,176 @@ export default {
         qx(){
             this.$router.go(-1)
         },
-        tj(){
-
+        tj(state){
+            this.form.workState = state;
+            this.$set(this.form, 'zjBusinessScopeList', this.tableData)
+            this.$set(this.form, 'organizationId', this.baseInfoData.organizationId);
+            this.$set(this.form, 'companyAttributes', this.baseInfoData.companyAttributes);
+            this.$set(this.form, 'companySourceCode', this.baseInfoData.companySourceCode);
+            if(this.imgList.length>0){
+                let pics = '';
+                this.imgList.forEach(element => {
+                    pics += element.id+',';
+                });
+                if(pics!=''){
+                    pics = pics.slice(0, -1);   
+                    this.form.licensePicture = pics;  
+                }
+            }
+            addOrEdit(this.form).then(res=>{
+                if(res.code == 200){
+                    this.$modal.msgSuccess("提交成功");
+                    this.$router.go(-1)
+                }
+            })
+        },
+        bc(state){
+            this.form.workState = state;
+            this.$set(this.form, 'zjBusinessScopeList', this.tableData)
+            this.$set(this.form, 'organizationId', this.baseInfoData.organizationId);
+            this.$set(this.form, 'companyAttributes', this.baseInfoData.companyAttributes);
+            this.$set(this.form, 'companySourceCode', this.baseInfoData.companySourceCode);
+            if(this.imgList.length>0){
+                let pics = '';
+                this.imgList.forEach(element => {
+                    pics += element.id+',';
+                });
+                if(pics!=''){
+                    pics = pics.slice(0, -1);   
+                    this.form.licensePicture = pics;  
+                }
+            }
+            addOrEdit(this.form).then(res=>{
+                if(res.code == 200){
+                    this.$modal.msgSuccess("保存成功");
+                }
+            })
+        },
+        async sends(){
+            const response = await axios.post('https://zhiguan.cognitiveservices.azure.cn/vision/v3.2/read/analyze', {'url': this.imgs}, {
+                headers: {
+                    'Ocp-Apim-Subscription-Key': this.key,
+                    'Content-Type': 'application/json'
+                }
+            });
+            // console.log("A:::" +  JSON.stringify(response))
+            if(response.status == '202'){
+                let Operations = response.headers["operation-location"];
+                // console.log("B:::" + Operations)
+                setTimeout(()=>{
+                    this.sendGet(Operations);
+                },1000)
+            }else{
+                console.log("图片解析失败!")
+            }
+        },
+        async sendGet(url){
+            const res = await axios.get(url, {
+                headers: {
+                    'Ocp-Apim-Subscription-Key': this.key,
+                    'Content-Type': 'application/json'
+                }
+            });
+            // console.log("C:::" +  JSON.stringify(res))
+            if(res.data.status == 'succeeded'){
+                let ocrs  =  res.data.analyzeResult.readResults;
+                if(ocrs.length>0){
+                    let lines = ocrs[0].lines;
+                    lines.forEach((element,index) => {
+                        console.log("A:::" + element.text)
+                        if(element.text.includes('许可证编号')){
+                            if(element.text.includes(':')){
+                                this.form.licenseNumber = element.text.substr(6);
+                            }else{
+                                this.form.licenseNumber = element.text.substr(5);
+                            }
+                            this.form.licenseNumber = this.form.licenseNumber.split(' ').join('')
+                        }
+                        if(element.text.includes('许可证') && !element.text.includes('编号')){
+                            this.form.licenseName = element.text;
+                            this.form.licenseName = this.form.licenseName.split(' ').join('')
+                        }
+                        if(element.text.includes('发证机关')||element.text.includes('发证部门')||element.text.includes('颁证机构')){
+                            if(element.text.includes(':')){
+                                this.form.licenseCompany = element.text.substr(5);
+                            }else{
+                                this.form.licenseCompany = element.text.substr(4);
+                            }
+                            if(!lines[index+1].text.includes(":")){
+                                this.form.licenseCompany += lines[index+1].text;
+                            }
+                            this.form.licenseCompany = this.form.licenseCompany.split(' ').join('').split(',').join('')
+                        }
+                        if(element.text.includes('生产方式') || element.text.includes('经营方式')){
+                            if(element.text.includes(':')){
+                                this.form.businessType = element.text.substr(5);
+                            }else{
+                                this.form.businessType = element.text.substr(4);
+                            }
+                            if(!lines[index+1].text.includes(":")){
+                                this.form.businessType += lines[index+1].text;
+                            }
+                            this.form.businessType = this.form.businessType.split(' ').join('')
+                        }
+                        if(element.text.includes('有效期限') && !element.text.includes('至')){
+                            let wb = '';
+                            if(element.text.includes(':')){
+                                wb = element.text.substr(5);
+                                if(wb != ''){
+                                    wb = wb.replace('年','-');
+                                    wb = wb.replace('月','-');
+                                    wb = wb.replace('日','');
+                                    wb = wb.split(' ').join('')
+                                    this.form.validUntil = wb;
+                                }
+                            }else{
+                                wb = element.text.substr(4);
+                                if(wb != ''){
+                                    wb = wb.replace('年','-');
+                                    wb = wb.replace('月','-');
+                                    wb = wb.replace('日','');
+                                    wb = wb.split(' ').join('')
+                                    this.form.validUntil = wb;
+                                }
+                            }
+                        }
+                        if(element.text.includes('至')){
+                            let wb = '';
+                            wb = element.text.substr(1);
+                            if(wb != ''){
+                                wb = wb.replace('年','-');
+                                wb = wb.replace('月','-');
+                                wb = wb.replace('日','');
+                                wb = wb.split(' ').join('')
+                                this.form.validUntil = wb;
+                            }
+                        }
+                        if(element.text.includes('发证日期')){
+                            let wb = '';
+                            if(element.text.includes(':')){
+                                wb = element.text.substr(5);
+                                if(wb != ''){
+                                    wb = wb.replace('年','-');
+                                    wb = wb.replace('月','-');
+                                    wb = wb.replace('日','');
+                                    wb = wb.split(' ').join('')
+                                    this.form.licenseDate = wb;
+                                }
+                            }else{
+                                wb = element.text.substr(4);
+                                if(wb != ''){
+                                    wb = wb.replace('年','-');
+                                    wb = wb.replace('月','-');
+                                    wb = wb.replace('日','');
+                                    wb = wb.split(' ').join('')
+                                    this.form.licenseDate = wb;
+                                }
+                            }
+                        }
+                    });
+                }
+            }
         },
-        bc(){
-
-        }
     },
   };
 </script>