소스 검색

前后:一键添加通用资质

MAC 5 년 전
부모
커밋
1822266beb

+ 13 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertsub.go

@@ -411,7 +411,10 @@ func (this *OilSupplierCertSubController) CheckCertSubLost () {
 				//三证合一或五证合一的证件,不需要验证了
 				continue
 			}
-			if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
+			var fileist1 supplierfile.OilSupplierFile
+			where1 := " SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
+			filesvc.GetEntityByWhere(OilSupplierFileName, where1, &fileist1)
+			if !strings.Contains(companyHasHeaders, needHeader.FileName+",") || fileist1.FileName == "" {
 				//缺少的资质
 				var tmpLostCert LostCertFiles
 				tmpLostCert.Code = dataother.CheckList[n].Code
@@ -628,7 +631,10 @@ func (this *OilSupplierCertSubController) CheckTechCertLost() {
 			if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
 				continue
 			}
-			if !strings.Contains(companyHasHeaders, needList[i].FileName+",") {
+			var fileist1 supplierfile.OilSupplierFile
+			where1 := " SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "' and NeedFileType = '" + needList[i].FileName + "'"
+			filesvc.GetEntityByWhere(OilSupplierFileName, where1, &fileist1)
+			if !strings.Contains(companyHasHeaders, needList[i].FileName+",") || fileist1.FileName == "" {
 				//缺少的资质
 				var tmpLostCert LostCertFiles
 				tmpLostCert.Code = dataother.CheckList[n].Code
@@ -793,7 +799,11 @@ func (this *OilSupplierCertSubController) CheckBasisBusinessLost() {
 			if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
 				continue
 			}
-			if !strings.Contains(companyHasHeaders, needList[i].FileName+",") {
+			var fileist1 supplierfile.OilSupplierFile
+			where1 := " SupplierId = '" + strconv.Itoa(model.SupplierId) + "' and NeedFileType = '" + needList[i].FileName + "'"
+			filesvc.GetEntityByWhere(OilSupplierFileName, where1, &fileist1)
+			if !strings.Contains(companyHasHeaders, needList[i].FileName+",") || fileist1.FileName == "" {
+			//if !strings.Contains(companyHasHeaders, needList[i].FileName+",") {
 				//缺少的资质
 				var tmpLostCert LostCertFiles
 				tmpLostCert.Code = model.Code

+ 56 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/supplierfile.go

@@ -6,6 +6,7 @@ import (
 	"dashoo.cn/business2/parameter"
 	"encoding/json"
 	"strconv"
+	"time"
 
 	"strings"
 
@@ -229,6 +230,61 @@ func (this *SupplierfileController) AddSubfile() {
 	}
 }
 
+// @Title 一键添加通用
+// @Description 文件上传
+// @Success	200	{object} controllers.Request
+// @router /addGeneral [post]
+func (this *SupplierfileController) AddGeneral() {
+	var model supplierfile.OilSupplierFile
+	var model1 []tableheader.BaseTableheader
+	svc := supplierfile.GetSupplierfileService(utils.DBE)
+	svc1 := tableheader.GetTableHeaderService(utils.DBE)
+
+	var jsonblob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonblob, &model)
+	model.CreateBy = this.User.Realname
+	model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+	where := " IsManuf = '0' and CategoryCode = '" + model.SupplierTypeCode + "'"
+	svc1.GetEntitysByWhere(BaseTableHeader, where, &model1)
+
+	var fileist supplierfile.OilSupplierFile
+	where1 := " SupplierId = '" + strconv.Itoa(model.SupplierId) + "'"
+	svc.GetEntityByWhere(OilSupplierFileName, where1, &fileist)
+
+	var errinfo ErrorDataInfo
+	if len(model1) > 0 && fileist.Id == 0 {
+		for _, value := range model1 {
+			var model2 supplierfile.OilSupplierFile
+			paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
+			//"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
+			mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
+			if strings.Contains(mustField, value.Name + ",") {
+				model2.SupplierTypeCode = "000"
+			} else {
+				model2.SupplierTypeCode = model.SupplierTypeCode
+			}
+			model2.IsManuf = "0"
+			model2.SupplierId = model.SupplierId
+			model2.NeedFileType = value.Name
+			model2.FileName = ""
+			model2.SupType = 1
+			model2.CreateOn = time.Now()
+			model2.CreateBy = this.User.Realname
+			model2.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+			svc.InsertEntityBytbl(OilSupplierFileName, &model2)
+		}
+		errinfo.Message = "操作成功!"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "请勿重复添加!"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
 // @Title 获取字典列表
 // @Description get user by token
 // @Success 200 {object} map[string]interface{}

+ 1 - 1
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodsinfo.vue

@@ -711,7 +711,7 @@
              style="margin-top: 35px;">
       <div slot="header"
            class="clearfix">
-        <span style="padding:3px 20px">现场考察报告1</span>
+        <span style="padding:3px 20px">现场考察报告</span>
         <el-button :disabled="!certId || checkStatus.includes(formData.Status)" type="primary" style="margin-left: 10px;" plain size="mini" title="上传" @click="openDialog()" >上传
         </el-button>
       </div>

+ 27 - 1
src/dashoo.cn/frontend_web/src/components/oilsupplier/subfilelist2.vue

@@ -3,7 +3,7 @@
     <el-card class="box-card">
       <div slot="header" class="clearfix">
         <span>企业资质</span>
-        <el-button style="float: right; padding: 6px 25px" type="text" @click="showDialog" v-if="canadd || newcanadd">一键添加通用</el-button>
+        <el-button style="float: right; padding: 6px 25px" type="text" @click="addGeneral" v-if="canadd || newcanadd">一键添加通用</el-button>
         <el-button style="float: right; padding: 6px 25px" type="text" @click="showDialog" v-if="canadd || newcanadd">添加</el-button>
       </div>
       <el-table :data="subfileList" highlight-current-row stripe border size="mini">
@@ -191,6 +191,10 @@
       }
 
       return {
+        GeneralForm: {
+          SupplierId: '',
+          SupplierTypeCode: '',
+        },
         dialogImageUrl: '',
         dialogVisible: false,
         size: 10,
@@ -507,6 +511,28 @@
           console.error(err)
         })
       },
+      addGeneral () {
+        let _this = this
+        _this.GeneralForm.SupplierId = this.SupplierId
+        _this.GeneralForm.SupplierTypeCode = this.SupplierTypeCode
+        console.log(_this.GeneralForm, this.SupplierId, '22222')
+        _this.$axios.post('/supplierfile/addGeneral/', _this.GeneralForm).then(res => {
+            if (res.data.code === 0) {
+              _this.$message({
+                type: 'success',
+                message: res.data.message
+              })
+              this.initData()
+            } else {
+              _this.$message({
+                type: 'warning',
+                message: res.data.message
+              })
+            }
+          }).catch(err => {
+            console.error(err)
+          })
+      },
       showDialog () {
         this.fileList = []
         // this.doclist = []

+ 1 - 0
src/dashoo.cn/frontend_web/src/components/oilsupplier/techlist.vue

@@ -270,6 +270,7 @@
           this.loading = false
           return
         }
+        console.log(params, 'params')
         _this.$axios.post('/suppliercertsub/tech-cert-lost', params).then(res => {
           _this.lostTableData = _this.mergeTableRow(res.data, ['Code'])
           this.loading = false