Pārlūkot izejas kodu

文件列表结构修改

shihang 6 gadi atpakaļ
vecāks
revīzija
0e3f47be35

+ 1 - 1
src/dashoo.cn/backend/api/business/oilsupplier/suppliercertsub/oilsuppliercertsub.go

@@ -9,7 +9,7 @@ type OilSupplierCertSub struct {
 	SupplierId       int       `xorm:"not null comment('供方基本信息表主键') INT(10)"`
 	SupplierCertId   int       `xorm:"not null comment('供方准入证书信息表主键') INT(10)"`
 	SupplierTypeCode string    `xorm:"not null default '' comment('准入类别代码') VARCHAR(5)"`
-	SubclassId       int       `xorm:"not null comment('分类表主键(物资类或基建类或技术服务类)') INT(10)"`
+	SubClassId       int       `xorm:"not null comment('分类表主键(物资类或基建类或技术服务类)') INT(10)"`
 	Code             string    `xorm:"not null default '' comment('分类编码') VARCHAR(8)"`
 	Name             string    `xorm:"not null default '' comment('分类名称') VARCHAR(50)"`
 	Remark           string    `xorm:"comment('备注') VARCHAR(500)"`

+ 4 - 15
src/dashoo.cn/backend/api/business/oilsupplier/supplierfile/supplierfile.go

@@ -6,14 +6,15 @@ import (
 
 type OilSupplierFile struct {
 	Id                int       `xorm:"not null pk autoincr INT(10)"`
-	SupplierCertId    int       `xorm:"INT(10)"`
-	AppendClassId     int       `xorm:"INT(10)"`
+	SupplierId        int       `xorm:"INT(10)"`
+	SupplierTypeCode  string    `xorm:"VARCHAR(5)"`
 	SupplierCertSubId int       `xorm:"INT(10)"`
+	CertSubName       string    `xorm:"VARCHAR(50)"`
 	NeedFileType      string    `xorm:"VARCHAR(50)"`
 	NeedFileCode      string    `xorm:"VARCHAR(20)"`
-	FileName          string    `xorm:"VARCHAR(50)"`
 	FileExt           string    `xorm:"VARCHAR(10)"`
 	FileSize          int       `xorm:"INT(10)"`
+	FileName          string    `xorm:"VARCHAR(50)"`
 	EffectDate        time.Time `xorm:"DATETIME"`
 	FileUrl           string    `xorm:"VARCHAR(100)"`
 	OtherRemark       string    `xorm:"VARCHAR(500)"`
@@ -26,15 +27,3 @@ type OilSupplierFile struct {
 	ModifiedUserId    int       `xorm:"INT(10)"`
 	ModifiedBy        string    `xorm:"VARCHAR(50)"`
 }
-
-type SubFileModel struct {
-	NeedfileList   []OilSupplierFile
-	Id             int
-	SupplierId     int
-	SupplierCertId int
-	SubclassId     int
-	Code           string
-	Name           string
-	Remark         string
-	IsDelete       int
-}

+ 134 - 1
src/dashoo.cn/backend/api/business/oilsupplier/supplierfile/supplierfileService.go

@@ -2,9 +2,11 @@ package supplierfile
 
 import (
 	//"fmt"
-	//"strconv"
+	"strconv"
 
+	"dashoo.cn/backend/api/business/oilsupplier/technologyservice"
 	. "dashoo.cn/backend/api/mydb"
+
 	//"dashoo.cn/utils"
 	//. "dashoo.cn/utils/db"
 	"github.com/go-xorm/xorm"
@@ -14,8 +16,139 @@ type SupplierfileService struct {
 	MyServiceBase
 }
 
+type FileList struct {
+	FileName string
+}
+
 func GetSupplierfileService(xormEngine *xorm.Engine) *SupplierfileService {
 	s := new(SupplierfileService)
 	s.DBE = xormEngine
 	return s
 }
+
+func (s *SupplierfileService) GetTechNeedFileList(classid int) (needList []FileList) {
+	var entity technologyservice.OilTechnologyService
+	sql := "select * from OilTechnologyService where ClassId = '" + strconv.Itoa(classid) + "'"
+	s.DBE.Sql(sql).Get(&entity)
+	if entity.F01 == "1" {
+		needList = append(needList, FileList{FileName: "营业执照"})
+	}
+	if entity.F02 == "1" {
+		needList = append(needList, FileList{FileName: "组织机构代码证"})
+	}
+	if entity.F03 == "1" {
+		needList = append(needList, FileList{FileName: "税务登记证"})
+	}
+	if entity.F04 == "1" {
+		needList = append(needList, FileList{FileName: "银行开户许可证"})
+	}
+	if entity.F05 == "1" {
+		needList = append(needList, FileList{FileName: "质量管理体系认证证书"})
+	}
+	if entity.F06 == "1" {
+		needList = append(needList, FileList{FileName: "环境管理体系认证证书"})
+	}
+	if entity.F07 == "1" {
+		needList = append(needList, FileList{FileName: "职业健康安全管理体系认证证书"})
+	}
+	if entity.F08 == "1" {
+		needList = append(needList, FileList{FileName: "软件企业认定证书"})
+	}
+	if entity.F09 == "1" {
+		needList = append(needList, FileList{FileName: "安全生产许可证"})
+	}
+	if entity.F10 == "1" {
+		needList = append(needList, FileList{FileName: "陆上石油天然气安全生产许可证"})
+	}
+	if entity.F11 == "1" {
+		needList = append(needList, FileList{FileName: "海洋石油作业安全生产许可证"})
+	}
+	if entity.F12 == "1" {
+		needList = append(needList, FileList{FileName: "辐射安全许可证"})
+	}
+	if entity.F13 == "1" {
+		needList = append(needList, FileList{FileName: "石油工程技术服务企业资质证书"})
+	}
+	if entity.F14 == "1" {
+		needList = append(needList, FileList{FileName: "物业服务企业资质证书"})
+	}
+	if entity.F15 == "1" {
+		needList = append(needList, FileList{FileName: "工业清洗企业资质证书"})
+	}
+	if entity.F16 == "1" {
+		needList = append(needList, FileList{FileName: "建设项目环境影响评价资格证书"})
+	}
+	if entity.F17 == "1" {
+		needList = append(needList, FileList{FileName: "消防设施维护保养资质证书"})
+	}
+	if entity.F18 == "1" {
+		needList = append(needList, FileList{FileName: "安全评价机构资质证书"})
+	}
+	if entity.F19 == "1" {
+		needList = append(needList, FileList{FileName: "工程咨询招标代理机构资质证书"})
+	}
+	if entity.F20 == "1" {
+		needList = append(needList, FileList{FileName: "工程监督资质证书"})
+	}
+	if entity.F21 == "1" {
+		needList = append(needList, FileList{FileName: "土地开发资格证"})
+	}
+	if entity.F22 == "1" {
+		needList = append(needList, FileList{FileName: "房屋预售资格证"})
+	}
+	if entity.F23 == "1" {
+		needList = append(needList, FileList{FileName: "保安服务许可证"})
+	}
+	if entity.F24 == "1" {
+		needList = append(needList, FileList{FileName: "道路运输经营许可证"})
+	}
+	if entity.F25 == "1" {
+		needList = append(needList, FileList{FileName: "机动车维修经营许可证"})
+	}
+	if entity.F26 == "1" {
+		needList = append(needList, FileList{FileName: "道路危险货物运输许可证"})
+	}
+	if entity.F27 == "1" {
+		needList = append(needList, FileList{FileName: "特种设备安装改造维修许可证"})
+	}
+	if entity.F28 == "1" {
+		needList = append(needList, FileList{FileName: "建筑安全许可证"})
+	}
+	if entity.F29 == "1" {
+		needList = append(needList, FileList{FileName: "防火许可证"})
+	}
+	if entity.F30 == "1" {
+		needList = append(needList, FileList{FileName: "印刷经营许可证"})
+	}
+	if entity.F31 == "1" {
+		needList = append(needList, FileList{FileName: "餐饮服务许可证"})
+	}
+	if entity.F32 == "1" {
+		needList = append(needList, FileList{FileName: "劳务派遣经营许可证"})
+	}
+	if entity.F33 == "1" {
+		needList = append(needList, FileList{FileName: "人力资源服务许可证"})
+	}
+	if entity.F34 == "1" {
+		needList = append(needList, FileList{FileName: "国家实验室认可证书"})
+	}
+	if entity.F35 == "1" {
+		needList = append(needList, FileList{FileName: "海洋石油专业设备检验检测机构证书"})
+	}
+	if entity.F36 == "1" {
+		needList = append(needList, FileList{FileName: "安全生产检验检测证书"})
+	}
+	if entity.F37 == "1" {
+		needList = append(needList, FileList{FileName: "液化气钢瓶检验证书"})
+	}
+	if entity.F38 == "1" {
+		needList = append(needList, FileList{FileName: "国家电网承试承装承修许可证"})
+	}
+	if entity.F39 == "1" {
+		needList = append(needList, FileList{FileName: "建筑企业资质证书"})
+	}
+	if entity.F40 == "1" {
+		needList = append(needList, FileList{FileName: "中油集团监造许可"})
+	}
+	return needList
+}

+ 9 - 8
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercert.go

@@ -1,15 +1,16 @@
 package oilsupplier
 
 import (
-	"dashoo.cn/backend/api/business/auditsetting"
-	"dashoo.cn/backend/api/business/oilsupplier/classorgsetting"
-	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
-	"dashoo.cn/backend/api/business/workflow"
 	"encoding/json"
 	"strconv"
 	"strings"
 	"time"
 
+	"dashoo.cn/backend/api/business/auditsetting"
+	"dashoo.cn/backend/api/business/oilsupplier/classorgsetting"
+	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
+	"dashoo.cn/backend/api/business/workflow"
+
 	"dashoo.cn/backend/api/business/baseUser"
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
 	. "dashoo.cn/backend/api/controllers"
@@ -502,11 +503,11 @@ func (this *OilSupplierCertController) AuditEntity() {
 	var subList []suppliercertsub.OilSupplierCertSub
 	certSubSrv := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
 	subWhere := " 1=1 "
-	subWhere += " and SupplierCertId='"+ Id +"'"
+	subWhere += " and SupplierCertId='" + Id + "'"
 	certSubSrv.GetEntitysByWhere(OilSupplierCertSubName, subWhere, &subList)
 	var subClassIds string
 	for _, certSub := range subList {
-		subClassIds += strconv.Itoa(certSub.SubclassId) + ","
+		subClassIds += strconv.Itoa(certSub.SubClassId) + ","
 	}
 	subClassIds = strings.Trim(subClassIds, ",")
 	if len(subClassIds) <= 0 {
@@ -519,7 +520,7 @@ func (this *OilSupplierCertController) AuditEntity() {
 	var orgListStr string
 	var where string
 	where += " 1=1 "
-	subWhere += " and SupplierTypeCode='"+ supplierCert.SupplierTypeCode +"'"
+	subWhere += " and SupplierTypeCode='" + supplierCert.SupplierTypeCode + "'"
 	where += " and ClassId in (" + subClassIds + ")"
 	where += " and AuditStepCode = '" + workflow.FIRST_TRIAL + "'"
 	classorgSrv.GetEntitysByWhere(OilClassOrgSettingName, where, &list)
@@ -547,7 +548,7 @@ func (this *OilSupplierCertController) AuditEntity() {
 		orgAudit.UserIds = strings.Replace(tempstr, "uid_", "", -1)
 		orgAudits = append(orgAudits, orgAudit)
 
-		orgListStr += "org_"+strconv.Itoa(certsetting.OrganizeId) + ","
+		orgListStr += "org_" + strconv.Itoa(certsetting.OrganizeId) + ","
 		//排除未设置部门的分类
 		subClassIdsCheck = strings.Replace(subClassIdsCheck, strconv.Itoa(certsetting.ClassId)+",", "", 1)
 	}

+ 39 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertsub.go

@@ -2,11 +2,16 @@ package oilsupplier
 
 import (
 	"encoding/json"
+	//	"fmt"
+	"strconv"
 	"strings"
 	"time"
 
 	"dashoo.cn/backend/api/business/baseUser"
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
+	"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
+
+	//	"dashoo.cn/backend/api/business/oilsupplier/technologyservice"
 	. "dashoo.cn/backend/api/controllers"
 	"dashoo.cn/business/userRole"
 	"dashoo.cn/utils"
@@ -313,6 +318,40 @@ func (this *OilSupplierCertSubController) AddBusiness() {
 	model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 	svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
 	_, err := svc.InsertEntityBytbl(OilSupplierCertSubName, &model)
+
+	filesvc := supplierfile.GetSupplierfileService(utils.DBE)
+	needList := filesvc.GetTechNeedFileList(model.SubClassId)
+
+	if err == nil {
+		var list []suppliercertsub.OilSupplierCertSub
+		where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "'"
+		where += " and SupplierCertId = '" + strconv.Itoa(model.SupplierCertId) + "'"
+		svc.GetEntitysByWhere(OilSupplierCertSubName, where, &list)
+
+		if len(list) == 1 { //第一次添加准入项,将共有必备资质写入文件表
+			for i := 0; i < len(needList); i++ {
+				var entity supplierfile.OilSupplierFile
+				entity.SupplierId = model.SupplierId
+				entity.SupplierTypeCode = model.SupplierTypeCode
+				entity.NeedFileType = needList[i].FileName
+				entity.CreateBy = this.User.Realname
+				entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+				svc.InsertEntityBytbl(OilSupplierFileName, &entity)
+			}
+		} else {
+			if len(needList) > 4 {
+				for i := 4; i < len(needList); i++ {
+					var entity supplierfile.OilSupplierFile
+					entity.SupplierId = model.SupplierId
+					entity.SupplierTypeCode = model.SupplierTypeCode
+					entity.NeedFileType = needList[i].FileName
+					entity.CreateBy = this.User.Realname
+					entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+					svc.InsertEntityBytbl(OilSupplierFileName, &entity)
+				}
+			}
+		}
+	}
 	var errinfo ErrorDataInfo
 	if err == nil {
 		errinfo.Message = "操作成功!"

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

@@ -25,7 +25,7 @@ func (this *SupplierfileController) FileList() {
 	var list []supplierfile.OilSupplierFile
 	svc := supplierfile.GetSupplierfileService(utils.DBE)
 	where := " 1=1"
-	orderby := "EffectDate"
+	orderby := "Id"
 	asc := false
 	Order := this.GetString("Order")
 	Prop := this.GetString("Prop")
@@ -35,13 +35,13 @@ func (this *SupplierfileController) FileList() {
 			asc = true
 		}
 	}
-	SupplierCertId := this.GetString("SupplierCertId")
-	if SupplierCertId != "" {
-		where = where + " and SupplierCertId = '" + SupplierCertId + "'"
+	SupplierId := this.GetString("SupplierId")
+	if SupplierId != "" {
+		where = where + " and SupplierId = '" + SupplierId + "'"
 	}
-	SupplierCertSubId := this.GetString("SupplierCertSubId")
-	if SupplierCertSubId != "" {
-		where = where + " and SupplierCertSubId in (" + SupplierCertSubId + ")"
+	SupplierTypeCode := this.GetString("SupplierTypeCode")
+	if SupplierTypeCode != "" {
+		where = where + " and SupplierTypeCode = '" + SupplierTypeCode + "'"
 	}
 	total := svc.GetPagingEntitiesWithoutAccCode(page.CurrentPage, page.Size, orderby, asc, &list, where)
 	var datainfo DataInfo
@@ -101,7 +101,7 @@ func (this *SupplierfileController) EditSubfile() {
 	model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
 	svc := supplierfile.GetSupplierfileService(utils.DBE)
 	opdesc := "编辑文件上传-" + model.NeedFileType
-	var cols []string = []string{"SupplierCertSubId", "NeedFileType", "NeedFileCode", "FileName", "EffectDate", "FileUrl", "OtherRemark", "Remark", "IsDelete", "ModifiedBy", "ModifiedUserId"}
+	var cols []string = []string{"SupplierCertSubId", "CertSubName", "NeedFileType", "NeedFileCode", "FileName", "EffectDate", "FileUrl", "OtherRemark", "Remark", "IsDelete", "ModifiedBy", "ModifiedUserId"}
 	err := svc.UpdateOperationAndWriteLogBytbl(OilSupplierFileName, BaseOperationLogName, id, &model, &entity, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "文件上传")
 
 	if err == nil {

+ 15 - 332
src/dashoo.cn/frontend_web/src/components/oilsupplier/businesslist.vue

@@ -5,8 +5,7 @@
         <span style="font-weight: bold">分类</span>
         <el-button style="float: right; padding: 3px 0" type="text" @click="showDialog">添加</el-button>
       </div>
-      <el-table :data="businessList" border @selection-change="handleSelectionChange">
-        <el-table-column type="selection" width="55"></el-table-column>
+      <el-table :data="businessList" border>
         <el-table-column label="操作" width="70" align="center" fixed>
           <template slot-scope="scope">
             <el-button type="text" title="编辑" size="small" icon="el-icon-edit" @click="openDialog(scope.row)">
@@ -30,15 +29,16 @@
         <span style="font-weight: bold">分类文档</span>
         <el-button style="float: right; padding: 3px 0" type="text" @click="subfiledialog">添加</el-button>
       </div>
-      <subfile-list ref="subfileList" :data="subfileList" :SupplierCertId="SupplierCertId" :SupplierCertSubId="cersubId"
-        :businessList="businessList" :BusinessForm="BusinessForm" height="360px" style="margin-top: 20px">
+      <subfile-list ref="subfileList" :data="subfileList" :SupplierId="SupplierId" :SupplierCertId="SupplierCertId"
+        :SupplierTypeCode="SupplierTypeCode" :businessList="businessList" :BusinessForm="BusinessForm" height="360px"
+        style="margin-top: 20px">
       </subfile-list>
     </el-card>
 
     <el-dialog :title="Title" :visible.sync="visible" top="5vh">
       <el-form :model="BusinessForm" label-width="100px">
         <el-row>
-          <el-col :span="12" v-if="SupplierTypeCode == '01'">
+          <el-col :span="12" v-if="SupplierTypeCode == '01' && Title == '新增准入范围'">
             <el-form-item label="名称" required>
               <el-select filterable default-first-option v-model="OneCode" placeholder="请选择" style="width: 100%"
                 @change="getChild()">
@@ -47,7 +47,7 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="12" v-if="SupplierTypeCode == '02'">
+          <el-col :span="12" v-if="SupplierTypeCode == '02' && Title == '新增准入范围'">
             <el-form-item label="名称" required>
               <el-input placeholder="请选择名称" v-model="BusinessForm.Name" style="width:100%">
                 <el-button type="primary" style="width:30%" @click="basicDialog = true" slot="append">选择
@@ -55,15 +55,20 @@
               </el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="12" v-if="SupplierTypeCode != '02'">
+          <el-col :span="12" v-if="SupplierTypeCode != '02' && Title == '新增准入范围'">
             <el-form-item label="名称" required>
               <el-cascader :options="techTreeList" :props="orgtreeprops" change-on-select :show-all-levels="false"
                 v-model="selectedorg" placeholder="请选择菜单" @change="getCode()" style="width:100%"></el-cascader>
             </el-form-item>
           </el-col>
+          <el-col :span="12" v-if="Title == '编辑准入范围'">
+            <el-form-item label="名称">
+              <el-input v-model="BusinessForm.Name" placeholder="请输入名称" disabled></el-input>
+            </el-form-item>
+          </el-col>
           <el-col :span="12">
             <el-form-item label="编码" required>
-              <el-input v-model="BusinessForm.Code" placeholder="请输入编码"></el-input>
+              <el-input v-model="BusinessForm.Code" placeholder="请输入编码" :disabled="Title == '编辑准入范围'"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="24">
@@ -157,7 +162,6 @@
         },
         selectedorg: [],
         ClassId: '',
-        needfileList: [],
 
         Title: '',
         BusinessForm: {
@@ -182,10 +186,7 @@
         Size: 10,
         CurrentItemCount: 0,
 
-        cersubId: '', //对应的证书分类ID
         subfileList: [], //文档
-        selectBusiness: [],
-        selectId: [],
       }
     },
     methods: {
@@ -203,13 +204,7 @@
           .then(res => {
             _this.businessList = res.data.items
             _this.currentItemCount = res.data.currentItemCount
-            if (_this.businessList && _this.businessList.length > 0) {
-              for (var i = 0; i < _this.businessList.length; i++) {
-                _this.selectId.push(_this.businessList[i].Id)
-              }
-              _this.cersubId = _this.selectId.join(",")
-              this.$refs["subfileList"].initData(_this.cersubId)
-            }
+            _this.$refs["subfileList"].initData()
           })
           .catch(err => {
             // handle error
@@ -238,7 +233,7 @@
               _this.BusinessForm.Id = res.data.item + ''
               _this.visible = false
               _this.initData()
-              _this.getneedfile()
+              _this.$refs["subfileList"].initData()
             } else {
               _this.$message({
                 type: 'warning',
@@ -425,322 +420,10 @@
         this.BusinessForm.Name = val.Name
         this.basicDialog = false
       },
-      getneedfile() {
-        let _this = this
-        const params = {
-          ClassId: this.ClassId
-        }
-        if (_this.SubClassId == '03') { //获取技术服务类文件需求
-          this.$axios.get('technologyservice/needfilelist', {
-              params
-            })
-            .then(res => {
-              if (res.data.items.F01 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '营业执照',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F02 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '组织机构代码证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F03 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '税务登记证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F04 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '银行开户许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F05 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '质量管理体系认证证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F06 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '环境管理体系认证证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F07 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '职业健康安全管理体系认证证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F08 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '软件企业认定证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F09 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '安全生产许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F10 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '陆上石油天然气安全生产许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F11 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '海洋石油作业安全生产许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F12 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '辐射安全许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F13 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '石油工程技术服务企业资质证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F14 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '物业服务企业资质证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F15 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '工业清洗企业资质证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F16 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '建设项目环境影响评价资格证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F17 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '消防设施维护保养资质证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F18 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '安全评价机构资质证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F19 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '工程咨询招标代理机构资质证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F20 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '工程监督资质证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F21 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '土地开发资格证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F22 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '房屋预售资格证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F23 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '保安服务许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F24 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '道路运输经营许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F25 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '机动车维修经营许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F26 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '道路危险货物运输许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F27 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '特种设备安装改造维修许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F28 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '建筑安全许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F29 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '防火许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F30 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '印刷经营许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F31 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '餐饮服务许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F32 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '劳务派遣经营许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F33 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '人力资源服务许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F34 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '国家实验室认可证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F35 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '海洋石油专业设备检验检测机构证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F36 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '安全生产检验检测证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F37 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '液化气钢瓶检验证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F38 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '国家电网承试承装承修许可证',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F39 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '建筑企业资质证书',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              if (res.data.items.F40 == '1') {
-                _this.needfileList.unshift({
-                  'FileName': '中油集团监造许可',
-                  'FileUrl': '',
-                  'EffectDate': new Date()
-                })
-              }
-              _this.$refs["subfileList"].showFileDialog(_this.needfileList)
-              console.log("-------------------", _this.needfileList)
-            })
-            .catch(err => {
-              console.error(err)
-            })
-        }
-      },
 
-      handleSelectionChange(val) {
-        this.selectBusiness = val
-        this.selectId = []
-        if (this.selectBusiness && this.selectBusiness.length > 0) {
-          for (var i = 0; i < this.selectBusiness.length; i++) {
-            this.selectId.push(this.selectBusiness[i].Id)
-          }
-        }
-        this.getfilelist()
-      },
       subfiledialog() {
         this.$refs["subfileList"].showDialog()
       },
-      getfilelist() {
-        this.cersubId = this.selectId.join(",")
-        this.$refs["subfileList"].initData(this.cersubId)
-      },
 
       handleSizeChange(value) {
         this.size = value

+ 44 - 153
src/dashoo.cn/frontend_web/src/components/oilsupplier/subfilelist.vue

@@ -9,7 +9,7 @@
         </template>
       </el-table-column>
       <el-table-column prop="NeedFileType" label="文件分类" show-overflow-tooltip></el-table-column>
-      <el-table-column prop="NeedFileCode" label="分类编码" show-overflow-tooltip></el-table-column>
+      <!-- <el-table-column prop="NeedFileCode" label="分类编码" show-overflow-tooltip></el-table-column> -->
       <el-table-column prop="FileName" label="文件名称" show-overflow-tooltip></el-table-column>
       <el-table-column prop="EffectDate" label="有效日期" show-overflow-tooltip>
         <template slot-scope="scope">
@@ -19,51 +19,29 @@
       <el-table-column prop="OtherRemark" label="其他信息" show-overflow-tooltip></el-table-column>
       <el-table-column prop="Remark" label="备注信息" show-overflow-tooltip></el-table-column>
     </el-table>
-    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-      :page-sizes="[10, 15, 20, 25]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
-      :total="currentItemCount">
-    </el-pagination>
-
-    <el-dialog :title="Title" :visible.sync="fileDialog" top="5vh">
-      <el-table :data="needfileList" border>
-        <el-table-column prop="FileName" label="文件分类" show-overflow-tooltip></el-table-column>
-        <el-table-column label="操作" show-overflow-tooltip center>
-          <template slot-scope="scope">
-            <el-upload style="margin-top: -1px;" multiple action="" :limit="1" ref="refuploadattach"
-              :http-request="uploadrequest" :show-file-list="true" :before-upload="beforeAvatarUpload">
-              <el-button size="mini" type="primary" @click="getItem(scope.row)">点击上传</el-button>
-            </el-upload>
-          </template>
-        </el-table-column>
-      </el-table>
-      <div slot="footer" class="dialog-footer" style="margin-top:-30px;">
-        <el-button @click="fileDialog = false">完 成</el-button>
-        <!-- <el-button type="primary" @click="getItem()">确 定</el-button> -->
-      </div>
-    </el-dialog>
 
     <el-dialog :title="Title" :visible.sync="visible" top="5vh">
       <el-form :model="SubfileForm" label-width="100px">
         <el-row>
           <el-col :span="12">
-            <el-form-item label="文件分类" required>
+            <el-form-item label="分类名称" required>
               <el-select ref="refSupplierCertSub" v-model="SubfileForm.SupplierCertSubId" style="width:100%"
-                placeholder="请选择文件分类" @change="getCode()">
+                placeholder="请选择分类名称" @change="getCode()">
                 <el-option v-for="item in businessList" :label="item.Name" :value="item.Id" :key="item.Id">
                 </el-option>
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="文件名称" required>
-              <el-input v-model="SubfileForm.FileName" placeholder="请输文件分类"></el-input>
+            <el-form-item label="文件分类" required>
+              <el-input v-model="SubfileForm.NeedFileType" placeholder="请输文件分类"></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+          <!-- <el-col :span="12">
             <el-form-item label="分类编码" required>
               <el-input v-model="SubfileForm.NeedFileCode" placeholder="请输入编码"></el-input>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="12">
             <el-form-item label="有效日期" required>
               <el-date-picker style="width: 100%" v-model="SubfileForm.EffectDate" type="date" placeholder="请选择有效日期">
@@ -126,11 +104,15 @@
   export default {
     name: 'SubfileList',
     props: {
+      SupplierId: {
+        type: String,
+        default: '0'
+      },
       SupplierCertId: {
         type: String,
         default: '0'
       },
-      SupplierCertSubId: {
+      SupplierTypeCode: {
         type: String,
         default: '0'
       },
@@ -161,14 +143,15 @@
         Title: '',
         SubfileForm: {
           Id: '',
-          SupplierCertId: '',
-          AppendClassId: '',
+          SupplierId: '',
+          SupplierTypeCode: '',
           SupplierCertSubId: '',
+          CertSubName: '',
           NeedFileType: '',
           NeedFileCode: '',
-          FileName: '',
           FileExt: '',
           FileSize: '',
+          FileName: '',
           EffectDate: new Date(),
           FileUrl: '',
           OtherRemark: '',
@@ -177,25 +160,19 @@
         },
         visible: false,
         selfVisible: this.visible, // 避免vue双向绑定警告
-        currentPage: 1, // 分页
-        size: 10,
-        currentItemCount: 0,
 
-        fileDialog: false,
-        itemNo: 0,
-        needfileList: [], //需要上传文件列表
         waituploads: [], // 等待上传的附件列表
         doclist: [],
       }
     },
     methods: {
-      initData(val) {
+      initData() {
         let _this = this
         const params = {
-          SupplierCertId: this.SupplierCertId,
-          SupplierCertSubId: val,
-          _currentPage: this.currentPage,
-          _size: this.size,
+          SupplierId: this.SupplierId,
+          SupplierTypeCode: this.SupplierTypeCode,
+          _currentPage: 1,
+          _size: 1000,
         }
         this.$axios.get('supplierfile/filelist', {
             params
@@ -213,38 +190,11 @@
         if (this.businessList && this.businessList.length > 0) {
           for (var i = 0; i < this.businessList.length; i++) {
             if (this.SubfileForm.SupplierCertSubId == this.businessList[i].Id) {
-              this.SubfileForm.NeedFileType = this.businessList[i].Name
-              this.SubfileForm.NeedFileCode = this.businessList[i].Code
+              this.SubfileForm.CertSubName = this.businessList[i].Name
             }
           }
         }
       },
-      getItem(val) {
-        console.log("--1111111111111--", val)
-        for (var i = 0; i < this.needfileList.length; i++) {
-          if (val.FileName == this.needfileList[i].FileName) {
-            this.itemNo = i
-            this.SubfileForm.SupplierCertSubId = this.BusinessForm.Id
-            this.SubfileForm.NeedFileType = this.BusinessForm.Name
-            this.SubfileForm.NeedFileCode = this.BusinessForm.Code
-            this.SubfileForm.FileName = this.needfileList[i].FileName
-          }
-        }
-        console.log("--------------------", this.SubfileForm)
-        // if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
-        //   // 上传附件是否完成判断
-        //   if (!this.attachissuccess()) {
-        //     this.$message.error('有附件未成功上传!不能保存数据')
-        //     return
-        //   }
-        //   this.getattachissuccess()
-        // } else {
-        //   this.$message({
-        //     type: 'warning',
-        //     message: '请上传文件!'
-        //   })
-        // }
-      },
       makesure() {
         if (this.Title == '新增文件') {
           if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
@@ -270,44 +220,14 @@
             }
             this.getattachissuccess()
             this.editSubfile()
-          } else if (this.doclist && this.doclist.length > 0) {
-            this.editSubfile()
           } else {
-            this.$message({
-              type: 'warning',
-              message: '请上传文件!'
-            })
+            this.editSubfile()
           }
         }
       },
-      addNeedSubfile(val) {
-        let _this = this
-        _this.SubfileForm.SupplierCertId = parseInt(_this.SubfileForm.SupplierCertId)
-        _this.SubfileForm.AppendClassId = parseInt(_this.SubfileForm.AppendClassId)
-        _this.SubfileForm.SupplierCertSubId = parseInt(_this.SubfileForm.SupplierCertSubId)
-        _this.SubfileForm.FileUrl = val
-        _this.$axios.post('/supplierfile/addsubfile/', _this.SubfileForm)
-          .then(res => {
-            if (res.data.code === 0) {
-              _this.$message({
-                type: 'success',
-                message: res.data.message,
-              })
-            } else {
-              _this.$message({
-                type: 'warning',
-                message: res.data.message
-              })
-            }
-          })
-          .catch(err => {
-            console.error(err)
-          })
-      },
       addSubfile() {
         let _this = this
-        _this.SubfileForm.SupplierCertId = parseInt(_this.SubfileForm.SupplierCertId)
-        _this.SubfileForm.AppendClassId = parseInt(_this.SubfileForm.AppendClassId)
+        _this.SubfileForm.SupplierId = parseInt(_this.SubfileForm.SupplierId)
         _this.SubfileForm.SupplierCertSubId = parseInt(_this.SubfileForm.SupplierCertSubId)
         _this.$axios.post('/supplierfile/addsubfile/', _this.SubfileForm)
           .then(res => {
@@ -318,6 +238,7 @@
               })
               this.visible = false
               this.initData()
+              this.$refs.refuploadattach = ''
             } else {
               _this.$message({
                 type: 'warning',
@@ -331,8 +252,8 @@
       },
       editSubfile() {
         let _this = this
-        _this.SubfileForm.SupplierCertId = parseInt(_this.SubfileForm.SupplierCertId)
-        _this.SubfileForm.AppendClassId = parseInt(_this.SubfileForm.AppendClassId)
+        _this.SubfileForm.SupplierId = parseInt(_this.SubfileForm.SupplierId)
+        _this.SubfileForm.SupplierCertSubId = parseInt(_this.SubfileForm.SupplierCertSubId)
         _this.$axios.put('/supplierfile/editsubfile/' + _this.SubfileForm.Id, _this.SubfileForm)
           .then(res => {
             if (res.data.code === 0) {
@@ -342,6 +263,7 @@
               })
               this.visible = false
               this.initData()
+              this.$refs.refuploadattach = ''
             } else {
               _this.$message({
                 type: 'warning',
@@ -386,14 +308,15 @@
       showDialog() {
         this.Title = '新增文件'
         this.SubfileForm.Id = ''
-        this.SubfileForm.SupplierCertId = this.SupplierCertId
-        this.SubfileForm.AppendClassId = ''
+        this.SubfileForm.SupplierId = this.SupplierId
+        this.SubfileForm.SupplierTypeCode = this.SupplierTypeCode
         this.SubfileForm.SupplierCertSubId = ''
+        this.SubfileForm.CertSubName = ''
         this.SubfileForm.NeedFileType = ''
         this.SubfileForm.NeedFileCode = ''
-        this.SubfileForm.FileName = ''
         this.SubfileForm.FileExt = ''
         this.SubfileForm.FileSize = ''
+        this.SubfileForm.FileName = ''
         this.SubfileForm.EffectDate = new Date()
         this.SubfileForm.FileUrl = ''
         this.SubfileForm.OtherRemark = ''
@@ -401,25 +324,22 @@
         this.SubfileForm.IsDelete = 0
         this.visible = true
       },
-      showFileDialog(val) {
-        this.needfileList = val
-        this.Title = '新增必要文件'
-        this.SubfileForm.Id = ''
-        this.SubfileForm.SupplierCertId = this.SupplierCertId
-        this.SubfileForm.AppendClassId = ''
-        this.fileDialog = true
-      },
       openDialog(val) {
         this.Title = '编辑文件'
         this.SubfileForm.Id = val.Id
-        this.SubfileForm.SupplierCertId = val.SupplierCertId
-        this.SubfileForm.AppendClassId = val.AppendClassId
-        this.SubfileForm.SupplierCertSubId = val.SupplierCertSubId
+        this.SubfileForm.SupplierId = val.SupplierId
+        this.SubfileForm.SupplierTypeCode = val.SupplierTypeCode
+        if (val.SupplierCertSubId == 0) {
+          this.SubfileForm.SupplierCertSubId = ''
+        } else {
+          this.SubfileForm.SupplierCertSubId = val.SupplierCertSubId
+        }
+        this.SubfileForm.CertSubName = val.CertSubName
         this.SubfileForm.NeedFileType = val.NeedFileType
         this.SubfileForm.NeedFileCode = val.NeedFileCode
-        this.SubfileForm.FileName = val.SubfileForm.FileName
         this.SubfileForm.FileExt = val.FileExt
         this.SubfileForm.FileSize = val.FileSize
+        this.SubfileForm.FileName = val.FileName
         this.SubfileForm.EffectDate = new Date(val.EffectDate)
         this.SubfileForm.FileUrl = val.FileUrl
         this.SubfileForm.OtherRemark = val.OtherRemark
@@ -462,9 +382,6 @@
                 fid: res.data.fid
               })
               uploadajax(option)
-              if (_this.Title == '新增必要文件') {
-                _this.addNeedSubfile(`http://${res.data.url}/${res.data.fid}`)
-              }
             } else {
               _this.$message({
                 type: 'warning',
@@ -473,7 +390,6 @@
             }
           })
           .catch(function (error) {
-            console.log("pppppppppppppppppppp", error)
             _this.$message({
               type: 'warning',
               message: '未上传成功!请重新上传!'
@@ -491,25 +407,6 @@
         }
         return true
       },
-      // getneedfilessuccess() {
-      //   this.needfileList[this.itemNo].FileUrl = ''
-      //   console.log("=-=================", this.itemNo, this.$refs.refuploadattach.uploadFiles)
-      //   if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
-      //     console.log("11111111111111111111", this.$refs.refuploadattach.uploadFiles)
-      //     for (let i = 0; i < this.$refs.refuploadattach.uploadFiles.length; i++) {
-      //       console.log("222222222222222222222221", this.$refs.refuploadattach.uploadFiles[i].status)
-      //       if (this.$refs.refuploadattach.uploadFiles[i].status == 'success') {
-      //         for (let j = 0; j < this.waituploads.length; j++) {
-      //           if (this.waituploads[j].uid === this.$refs.refuploadattach.uploadFiles[i].uid) {
-      //             this.needfileList[this.itemNo].FileUrl =
-      //               `${this.waituploads[j].url}/${this.waituploads[j].fid}|${this.$refs.refuploadattach.uploadFiles[i].name}`
-      //           }
-      //         }
-      //       }
-      //     }
-      //   }
-      //   console.log("----------------------", this.needfileList)
-      // },
       getattachissuccess() {
         this.SubfileForm.FileUrl = ''
         if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
@@ -519,6 +416,7 @@
                 if (this.waituploads[j].uid === this.$refs.refuploadattach.uploadFiles[i].uid) {
                   this.SubfileForm.FileUrl =
                     `${this.waituploads[j].url}/${this.waituploads[j].fid}|${this.$refs.refuploadattach.uploadFiles[i].name}`
+                  this.SubfileForm.FileName = `${this.$refs.refuploadattach.uploadFiles[i].name}`
                 }
               }
             }
@@ -544,18 +442,11 @@
       seachdata() {
         this.initData()
       },
-      handleSizeChange(value) {
-        this.size = value
-        this.currentPage = 1
-        this.initData()
-      },
-      handleCurrentChange(value) {
-        this.currentPage = value
-        this.initData()
-      },
       jstimehandle(val) {
         if (val === '') {
           return '----'
+        } else if (val === '0001-01-01T00:00:00Z') {
+          return '----'
         } else if (val === '0001-01-01T08:00:00+08:00') {
           return '----'
         } else if (val === '5000-01-01T23:59:59+08:00') {