Pārlūkot izejas kodu

准入申请时,登录用户下已有企业信息自动填充

ljm 6 gadi atpakaļ
vecāks
revīzija
c03f346323

+ 1 - 1
src/dashoo.cn/backend/api/controllers/base.go

@@ -278,7 +278,7 @@ func (this *BaseController) Prepare() {
 		"/api/webinterface/preparelist", "/api/webinterface/prepareinfo",
 		"/api/sampletest_v/sampletest", "/api/sampletest_v/getpass", "/api/sampletest_v/editpass/",
 		"/api/sampletest_v/donorsdetail", "/api/sampletest_v/testdetail", "/api/uploads/samplesinput", "/api/doctemplate_onlyoffice/callback", "/api/doctemplate_onlyoffice/viewcallback", "/api/limsupload/usersignimg",
-		"/api/uploads/samplestypeimg", "/api/workflow/historyimg/", "/api/document/getdocumentnameandtime", "/api/annualaudit/auditcallback", "/api/suppliercert/auditcallback", "/api/register/addentity", "/api/register/getsuppliername"}
+		"/api/uploads/samplestypeimg", "/api/workflow/historyimg/", "/api/document/getdocumentnameandtime", "/api/annualaudit/auditcallback", "/api/suppliercert/auditcallback", "/api/register/addentity", "/api/register/getsuppliername", "/api/register/getdictlist"}
 	for _, v := range urls {
 		fmt.Println("**this.Ctx.Input.URL()**", this.Ctx.Input.URL())
 		if this.Ctx.Input.URL() == v {

+ 2 - 2
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -1291,8 +1291,8 @@ func (this *OilSupplierController) GetMyTaskEntityList() {
 	certIdList := actisvc.GetMyTasks(workflow.OIL_SUPPLIER_APPLY, this.User.Id)
 	certIdarr := strings.Split(certIdList, ",")
 	for i, item := range certIdarr {
-		idx := strings.Index(item,"-")
-		if (idx >= 0 ) {
+		idx := strings.Index(item, "-")
+		if idx >= 0 {
 			certIdarr[i] = strings.Split(item, "-")[0]
 		}
 	}

+ 90 - 2
src/dashoo.cn/backend/api/controllers/register/oilcorporateinfo.go

@@ -2,11 +2,18 @@ package register
 
 import (
 	"encoding/json"
+	"strconv"
 	"time"
 
+	"dashoo.cn/backend/api/business/auditsetting"
+	"dashoo.cn/backend/api/business/baseUser"
 	"dashoo.cn/backend/api/business/oilsupplier/supplier"
+	"dashoo.cn/backend/api/business/organize"
 	"dashoo.cn/backend/api/business/register"
+	"dashoo.cn/backend/api/business/workflow"
 	. "dashoo.cn/backend/api/controllers"
+	"dashoo.cn/business2/areajson"
+	"dashoo.cn/business2/items"
 	"dashoo.cn/business2/userRole"
 	"dashoo.cn/utils"
 )
@@ -15,14 +22,45 @@ type OilCorporateInfoController struct {
 	BaseController
 }
 
+// @Title 获取公司信息
+// @Description 根据公司名以及本公司的注册用户两个条件从供方信息表和公司注册表依次获取公司信息
+// @Success	200	{object} controllers.Request
+// @router /getcompanyinfo/:name [get]
+func (this *OilCorporateInfoController) GetCompanyInfo() {
+	SupplierName := this.Ctx.Input.Param(":name")
+
+	sqlStr := "SELECT * FROM OilSupplier"
+	sqlStr2 := "SELECT * FROM OilCorporateInfo"
+
+	where := " where SupplierName = '" + SupplierName + "' and CreateUserId = " + this.User.Id
+	where2 := " where SupplierName = '" + SupplierName + "' and UserId = " + this.User.Id
+
+	sql := sqlStr + where
+	sql2 := sqlStr2 + where2
+
+	svcRegister := register.GetOilCorporateInfoService(utils.DBE)
+	svcSupplier := supplier.GetOilSupplierService(utils.DBE)
+
+	model, _ := svcSupplier.DBE.QueryString(sql)
+
+	if len(model) < 1 { //若供方表没有公司信息
+		model, _ = svcRegister.DBE.QueryString(sql2)
+	}
+
+	var datainfo DataInfo
+	datainfo.Items = model
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
 // @Title 获取已注册的公司名称
 // @Description 获取已注册的公司名称
 // @Success	200	{object} controllers.Request
 // @router /getsuppliername [get]
 func (this *OilCorporateInfoController) GetSupplierName() {
 	sqlStr := "SELECT SupplierName FROM OilCorporateInfo"
-	svcSupplier := supplier.GetOilSupplierService(utils.DBE)
-	list, _ := svcSupplier.DBE.QueryString(sqlStr)
+	svc := register.GetOilCorporateInfoService(utils.DBE)
+	list, _ := svc.DBE.QueryString(sqlStr)
 
 	var datainfo DataInfo
 	datainfo.Items = list
@@ -107,3 +145,53 @@ func (this *OilCorporateInfoController) AddEntity() {
 	}
 
 }
+
+// @Title 获取字典列表
+// @Description get user by token
+// @Success 200 {object} map[string]interface{}
+// @router /getdictlist [get]
+func (this *OilCorporateInfoController) GetDictList() {
+	dictList := make(map[string]interface{})
+	dictSvc := items.GetItemsService(utils.DBE)
+	userSvc := baseUser.GetBaseUserService(utils.DBE)
+	areaJsonSvc := areajson.GetAreaJsonService(utils.DBE)
+	//customerSvc := svccustomer.GetCustomerService(utils.DBE)
+	dictList["UnitRelation"] = dictSvc.GetKeyValueItems("UnitRelation")
+	dictList["CompanyType"] = dictSvc.GetKeyValueItems("CompanyType")
+	var userEntity userRole.Base_User
+	userSvc.GetEntityById(this.User.Id, &userEntity)
+	dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
+	dictList["GaodeMapChinaAreas"] = areaJsonSvc.GetGaodeMapChinaAreas()
+	dictList["CountryList"] = areaJsonSvc.GetCountryList()
+	//获取我创建的所有公司
+	var list []supplier.OilSupplier
+	if this.User.IsCompanyUser == 1 {
+		svcSupplier := supplier.GetOilSupplierService(utils.DBE)
+		supplierWhere := " CreateUserId = '" + this.User.Id + "'"
+		svcSupplier.GetEntitysByWhere(OilSupplierName, supplierWhere, &list)
+		dictList["CompanyNames"] = list
+	} else { //二级单位不用获取
+		dictList["CompanyNames"] = list
+	}
+
+	// 部门
+	orgsvc := organize.GetOrganizeService(utils.DBE)
+	dictList["Organizes"] = orgsvc.GetCollectionDetailviewlist("'" + this.User.AccCode + "'")
+	//var dictCustomer []svccustomer.Customer
+	//customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
+	//dictList["EntrustCorp"] = &dictCustomer
+
+	//获得有审核权限的人员
+	var users []userRole.Base_RoleList
+	var auditWorkflow auditsetting.Base_OilAuditSetting
+	rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
+
+	rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.SECOND_TRIAL, &auditWorkflow)
+	users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), this.User.AccCode) //
+	dictList["Auditer"] = users
+
+	var datainfo DataInfo
+	datainfo.Items = dictList
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}

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

@@ -389,6 +389,15 @@
     },
 
     data() {
+      //查找是否有公司信息,若有则补全信息。
+      var checkSupplierName =  (rule, value, callback) => {
+        if (!value) {
+          callback(new Error('请输入供方名称'));
+        } else {
+          this.searchSupplierName();
+          callback();
+        }
+      };
       return {
         companyReadonly: false,
         companynames: [],
@@ -427,7 +436,7 @@
         rulesform: {
           SupplierName: [{
             required: true,
-            message: '请输入供方名称',
+            validator: checkSupplierName,
             trigger: 'change'
           }, ],
           CommercialNo: [{
@@ -559,6 +568,55 @@
         this.formData.CountryTaxNo = this.formData.CommercialNo
         this.formData.OrganCode = this.formData.CommercialNo
       },
+      //查找是否有公司信息,若有则补全信息
+      searchSupplierName() {
+        let _this = this
+        _this.$axios.get('/register/getcompanyinfo/' + _this.formData.SupplierName, {})
+          .then(res => {
+            if (res.data.items && res.data.items.length == 1) {
+              _this.formData.SupplierName = res.data.items[0].SupplierName
+              _this.formData.CommercialNo = res.data.items[0].CommercialNo
+              _this.formData.CountryTaxNo = res.data.items[0].CountryTaxNo
+              _this.formData.OrganCode = res.data.items[0].OrganCode
+              _this.formData.LocalTaxNo = res.data.items[0].LocalTaxNo
+              _this.formData.Address = res.data.items[0].Address
+              _this.formData.Province = res.data.items[0].Province
+              _this.formData.City = res.data.items[0].City
+              _this.formData.Street = res.data.items[0].Street
+              _this.CityAry = []
+              _this.CityAry.push(_this.formData.Province)
+              _this.CityAry.push(_this.formData.City)
+              _this.CityAry.push(_this.formData.Street)
+              _this.formData.ZipCode = res.data.items[0].ZipCode
+              _this.formData.LinkAddress = res.data.items[0].LinkAddress
+              _this.formData.LinkProvince = res.data.items[0].LinkProvince
+              _this.formData.LinkCity = res.data.items[0].LinkCity
+              _this.formData.LinkStreet = res.data.items[0].LinkStreet
+              _this.LinkCityAry = []
+              _this.LinkCityAry.push(_this.formData.LinkProvince)
+              _this.LinkCityAry.push(_this.formData.LinkCity)
+              _this.LinkCityAry.push(_this.formData.LinkStreet)
+              _this.formData.LinkZipCode = res.data.items[0].LinkZipCode
+              _this.formData.LegalPerson = res.data.items[0].LegalPerson
+              _this.formData.CompanyType = res.data.items[0].CompanyType
+              _this.formData.RegCapital = res.data.items[0].RegCapital
+              _this.formData.SetupTime = res.data.items[0].SetupTime
+              _this.formData.DepositBank = res.data.items[0].DepositBank
+              _this.formData.BankAccount = res.data.items[0].BankAccount
+              _this.formData.ContactName = res.data.items[0].ContactName
+              _this.formData.Mobile = res.data.items[0].Mobile
+              _this.formData.Telphone = res.data.items[0].Telphone
+              _this.formData.Fax = res.data.items[0].Fax
+              _this.formData.CompanyTel = res.data.items[0].CompanyTel
+              _this.formData.EMail = res.data.items[0].EMail
+              _this.formData.BankCreditRating = res.data.items[0].BankCreditRating
+              _this.formData.Remark = res.data.items[0].Remark
+            }
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
       getDictOptions() {
         if (this.dictData) {
           this.UnitRelationOptions = this.dictData['UnitRelation']

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

@@ -415,6 +415,15 @@
     },
 
     data () {
+      //查找是否有公司信息,若有则补全信息。
+      var checkSupplierName =  (rule, value, callback) => {
+        if (!value) {
+          callback(new Error('请输入供方名称'));
+        } else {
+          this.searchSupplierName();
+          callback();
+        }
+      };
       return {
         companyReadonly: false,
         companynames: [],
@@ -454,7 +463,7 @@
         rulesform: {
           SupplierName: [{
             required: true,
-            message: '请输入供方名称',
+            validator: checkSupplierName,
             trigger: 'change'
           }, ],
            Country: [{
@@ -591,6 +600,57 @@
         this.formData.CountryTaxNo = this.formData.CommercialNo
         this.formData.OrganCode = this.formData.CommercialNo
       },
+
+      //查找是否有公司信息,若有则补全信息
+      searchSupplierName() {
+        let _this = this
+        _this.$axios.get('/register/getcompanyinfo/' + _this.formData.SupplierName, {})
+          .then(res => {
+            if (res.data.items && res.data.items.length == 1) {
+              _this.formData.SupplierName = res.data.items[0].SupplierName
+              _this.formData.CommercialNo = res.data.items[0].CommercialNo
+              _this.formData.CountryTaxNo = res.data.items[0].CountryTaxNo
+              _this.formData.OrganCode = res.data.items[0].OrganCode
+              _this.formData.LocalTaxNo = res.data.items[0].LocalTaxNo
+              _this.formData.Address = res.data.items[0].Address
+              _this.formData.Province = res.data.items[0].Province
+              _this.formData.City = res.data.items[0].City
+              _this.formData.Street = res.data.items[0].Street
+              _this.CityAry = []
+              _this.CityAry.push(_this.formData.Province)
+              _this.CityAry.push(_this.formData.City)
+              _this.CityAry.push(_this.formData.Street)
+              _this.formData.ZipCode = res.data.items[0].ZipCode
+              _this.formData.LinkAddress = res.data.items[0].LinkAddress
+              _this.formData.LinkProvince = res.data.items[0].LinkProvince
+              _this.formData.LinkCity = res.data.items[0].LinkCity
+              _this.formData.LinkStreet = res.data.items[0].LinkStreet
+              _this.LinkCityAry = []
+              _this.LinkCityAry.push(_this.formData.LinkProvince)
+              _this.LinkCityAry.push(_this.formData.LinkCity)
+              _this.LinkCityAry.push(_this.formData.LinkStreet)
+              _this.formData.LinkZipCode = res.data.items[0].LinkZipCode
+              _this.formData.LegalPerson = res.data.items[0].LegalPerson
+              _this.formData.CompanyType = res.data.items[0].CompanyType
+              _this.formData.RegCapital = res.data.items[0].RegCapital
+              _this.formData.SetupTime = res.data.items[0].SetupTime
+              _this.formData.DepositBank = res.data.items[0].DepositBank
+              _this.formData.BankAccount = res.data.items[0].BankAccount
+              _this.formData.ContactName = res.data.items[0].ContactName
+              _this.formData.Mobile = res.data.items[0].Mobile
+              _this.formData.Telphone = res.data.items[0].Telphone
+              _this.formData.Fax = res.data.items[0].Fax
+              _this.formData.CompanyTel = res.data.items[0].CompanyTel
+              _this.formData.EMail = res.data.items[0].EMail
+              _this.formData.BankCreditRating = res.data.items[0].BankCreditRating
+              _this.formData.Remark = res.data.items[0].Remark
+            }
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
+
       getDictOptions () {
         if (this.dictData) {
           this.UnitRelationOptions = this.dictData['UnitRelation']

+ 59 - 2
src/dashoo.cn/frontend_web/src/components/oilsupplier/techinfo.vue

@@ -369,6 +369,15 @@
       },
     },
     data () {
+      //查找是否有公司信息,若有则补全信息。
+      var checkSupplierName =  (rule, value, callback) => {
+        if (!value) {
+          callback(new Error('请输入供方名称'));
+        } else {
+          this.searchSupplierName();
+          callback();
+        }
+      };
       return {
         companyReadonly: false,
         companynames: [],
@@ -407,7 +416,7 @@
         rulesform: {
           SupplierName: [{
             required: true,
-            message: '请输入供方名称',
+            validator: checkSupplierName,
             trigger: 'change'
           }, ],
           CommercialNo: [{
@@ -540,7 +549,55 @@
         this.formData.CountryTaxNo = this.formData.CommercialNo
         this.formData.OrganCode = this.formData.CommercialNo
       },
-      getDictOptions () {
+      //查找是否有公司信息,若有则补全信息
+      searchSupplierName() {
+        let _this = this
+        _this.$axios.get('/register/getcompanyinfo/' + _this.formData.SupplierName, {})
+          .then(res => {
+            if (res.data.items && res.data.items.length == 1) {
+              _this.formData.SupplierName = res.data.items[0].SupplierName
+              _this.formData.CommercialNo = res.data.items[0].CommercialNo
+              _this.formData.CountryTaxNo = res.data.items[0].CountryTaxNo
+              _this.formData.OrganCode = res.data.items[0].OrganCode
+              _this.formData.LocalTaxNo = res.data.items[0].LocalTaxNo
+              _this.formData.Address = res.data.items[0].Address
+              _this.formData.Province = res.data.items[0].Province
+              _this.formData.City = res.data.items[0].City
+              _this.formData.Street = res.data.items[0].Street
+              _this.CityAry = []
+              _this.CityAry.push(_this.formData.Province)
+              _this.CityAry.push(_this.formData.City)
+              _this.CityAry.push(_this.formData.Street)
+              _this.formData.ZipCode = res.data.items[0].ZipCode
+              _this.formData.LinkAddress = res.data.items[0].LinkAddress
+              _this.formData.LinkProvince = res.data.items[0].LinkProvince
+              _this.formData.LinkCity = res.data.items[0].LinkCity
+              _this.formData.LinkStreet = res.data.items[0].LinkStreet
+              _this.LinkCityAry = []
+              _this.LinkCityAry.push(_this.formData.LinkProvince)
+              _this.LinkCityAry.push(_this.formData.LinkCity)
+              _this.LinkCityAry.push(_this.formData.LinkStreet)
+              _this.formData.LinkZipCode = res.data.items[0].LinkZipCode
+              _this.formData.LegalPerson = res.data.items[0].LegalPerson
+              _this.formData.CompanyType = res.data.items[0].CompanyType
+              _this.formData.RegCapital = res.data.items[0].RegCapital
+              _this.formData.SetupTime = res.data.items[0].SetupTime
+              _this.formData.DepositBank = res.data.items[0].DepositBank
+              _this.formData.BankAccount = res.data.items[0].BankAccount
+              _this.formData.ContactName = res.data.items[0].ContactName
+              _this.formData.Mobile = res.data.items[0].Mobile
+              _this.formData.Telphone = res.data.items[0].Telphone
+              _this.formData.Fax = res.data.items[0].Fax
+              _this.formData.CompanyTel = res.data.items[0].CompanyTel
+              _this.formData.EMail = res.data.items[0].EMail
+              _this.formData.BankCreditRating = res.data.items[0].BankCreditRating
+              _this.formData.Remark = res.data.items[0].Remark
+            }
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },      getDictOptions () {
         if (this.dictData) {
           this.UnitRelationOptions = this.dictData['UnitRelation']
           this.getCityList(this.dictData['GaodeMapChinaAreas'])

+ 36 - 12
src/dashoo.cn/frontend_web/src/pages/signup.vue

@@ -31,34 +31,38 @@
         <div class="home-wrapper" v-if="activeIndex==1">
             <el-form label-width="135px" ref="formData" :model="formData" :rules="rules" size="mini">
               <el-row>
-                <el-col :span="10">
+                <el-col :span="8">
                   <el-form-item label="公司名称" style="width: 100%" prop="SupplierName">
                     <el-input v-model="formData.SupplierName"  placeholder="请输入公司名称"></el-input>
                   </el-form-item>
                 </el-col>
-                <el-col :span="14">
+                <el-col :span="8">
                   <el-form-item label="公司所在地" style="width: 100%" prop="Address">
                     <el-cascader
                       expand-trigger="hover"
                       :options="countryoptions"
                       :props="countryprops"
                       v-model="addressOptions"
-                      @change="getAreaChange"
                       style="width: 100%">
                     </el-cascader>
                   </el-form-item>
                 </el-col>
-                <el-col :span="10">
+                <el-col :span="8">
                   <el-form-item label="详细地址" style="width: 100%" prop="DetailAddress">
                     <el-input v-model="formData.DetailAddress"  placeholder="请输入详细地址"></el-input>           
                   </el-form-item>
                 </el-col>
+                <el-col :span="8">
+                  <el-form-item label="邮编" style="width: 100%" prop="ZipCode">
+                    <el-input v-model="formData.ZipCode"  placeholder="请输入邮编"></el-input>           
+                  </el-form-item>
+                </el-col>
                 <el-col :span="8">
                   <el-form-item label="中石油供应商证书号"   label-width="150px" style="width: 100%" prop="OilCertificateNo">
                     <el-input v-model="formData.OilCertificateNo"  placeholder="中石油供应商证书号"></el-input>           
                   </el-form-item>
                 </el-col>
-                <el-col :span="6">
+                <el-col :span="8">
                   <el-form-item label="工商注册号"  label-width="100px" style="width: 100%" prop="CommercialNo">
                     <el-input v-model="formData.CommercialNo"  placeholder="工商注册号"></el-input>           
                   </el-form-item>
@@ -262,11 +266,11 @@
 
         countryoptions: [],//全国省市列表
         countryprops: {
-          value: 'name',
+          value: 'adcode',
           label: 'name',
           children: 'districts'
         },
-        addressOptions: [],
+        addressOptions: [], //已选择的省市区
         dictData: null, //字典信息
         supplierNameList: [], //公司名列表
         CompanyTypeOptions: [], //公司类型列表
@@ -338,6 +342,9 @@
           DetailAddress: [
             { required: true, message: '请输入公司详细地址', trigger: 'blur' }
           ],
+          ZipCode: [
+            { required: true, message: '请输入邮编', trigger: 'blur' }
+          ],
           // OilCertificateNo: [
           //   { required: true, message: '请输入中石油供应商证书号', trigger: 'blur' }
           // ],
@@ -471,13 +478,25 @@
           return
         }
       
-        let arr = _this.addressOptions
-        _this.formData.Address = arr.join("/") //转化公司地址
+        
+        _this.formData.Address =  _this.formData.DetailAddress
+        if (_this.addressOptions[0]) {
+          _this.formData.Province = _this.addressOptions[0]
+          _this.formData.LinkProvince = _this.addressOptions[0]
+        }
+        if (_this.addressOptions[1]) {
+          _this.formData.City = _this.addressOptions[1]
+          _this.formData.LinkCity = _this.addressOptions[1]
+        }
+        if (_this.addressOptions[2]) {
+          _this.formData.Street = _this.addressOptions[2]
+          _this.formData.LinkStreet = _this.addressOptions[2]
+        }
+        _this.formData.LinkAddress =  _this.formData.DetailAddress
+        _this.formData.LinkZipCode =  _this.formData.ZipCode
         _this.formData.RegCapital = parseFloat(_this.formData.RegCapital)
         _this.formData.Currency = '万元' //币种
 
-        console.log("****_this.formData*****",_this.formData)
-
         _this.$axios.post('/register/addentity', _this.formData)
           .then(function (response) {
             if (response.data.code === 0) {
@@ -513,11 +532,16 @@
         this.formData.Province = value[0]
         this.formData.City = value[1]
         this.formData.Street = value[2]
+        this.formData.LinkProvince = value[0]
+        this.formData.LinkCity = value[1]
+        this.formData.LinkStreet = value[2]
       },
 
       //获取字典信息:
       getDictOptions() {
-        api.getDictList(this.$axios).then(res => {
+        let _this = this
+        _this.$axios.get('/register/getdictlist', {})
+        .then(res => {
           this.dictData = res.data.items
           this.getCityList(this.dictData['GaodeMapChinaAreas'])
           this.CompanyTypeOptions = this.dictData['CompanyType']