Explorar el Código

资质变更添加,审核历史添加

huahaiyan hace 6 años
padre
commit
b5410ab0ca

+ 10 - 0
src/dashoo.cn/backend/api/business/oilsupplier/infochange/infochangeService.go

@@ -1,6 +1,7 @@
 package infochange
 
 import (
+	"dashoo.cn/backend/api/business/oilsupplier/annualaudit"
 	"fmt"
 	"strconv"
 	"strings"
@@ -34,6 +35,15 @@ func (s *InfoChangeService) GetInfoforItem(supname, item, where string) string {
 	return itemselected
 }
 
+func (s *InfoChangeService) GetSupplierList(supname,where string) []annualaudit.Suppliername {
+	var sql string
+	//sql = `select * from  `+ supname +` where Id not in ( select SupplierId  from `+ auditname +` where  YEAR(CreateOn)=YEAR(NOW()))`
+	sql = `select * from  `+ supname + ` where ` + where
+	List := make([]annualaudit.Suppliername, 0)
+	utils.DBE.Sql(sql).Find(&List)
+	return List
+}
+
 //func (s *InfoChangeService) GetSupplierList(supname, auditname string) []Suppliername {
 //	var sql string
 //	//sql = `select * from  `+ supname +` where Id not in ( select SupplierId  from `+ auditname +` where  YEAR(CreateOn)=YEAR(NOW()))`

+ 7 - 4
src/dashoo.cn/backend/api/business/oilsupplier/qualchange/qualchange.go

@@ -16,14 +16,14 @@ type OilQualChangeDetail struct {
 	CertSubName       string    `xorm:"default '' comment('分类名称') VARCHAR(50)"`
 	NeedFileType      string    `xorm:"not null default '' comment('文件分类') VARCHAR(50)"`
 	NeedFileCode      string    `xorm:"not null default '' comment('文件分类编码') VARCHAR(20)"`
-	OldFileName       string    `xorm:"not null default '' comment('原文件名称') VARCHAR(50)"`
-	FileName          string    `xorm:"not null default '' comment('文件名称') VARCHAR(50)"`
+	OldFileName       string    `xorm:"not null default '' comment('原文件名称') VARCHAR(2000)"`
+	FileName          string    `xorm:"not null default '' comment('文件名称') VARCHAR(2000)"`
 	FileExt           string    `xorm:"VARCHAR(10)"`
 	FileType          int       `xorm:"default 0 comment('0:不必要文件;1:必上传文件;') INT(10)"`
 	OldEffectDate     time.Time `xorm:"comment('原有效期') DATETIME"`
 	EffectDate        time.Time `xorm:"comment('有效期') DATETIME"`
-	OldFileUrl        string    `xorm:"VARCHAR(100)"`
-	FileUrl           string    `xorm:"VARCHAR(100)"`
+	OldFileUrl        string    `xorm:"VARCHAR(2000)"`
+	FileUrl           string    `xorm:"VARCHAR(2000)"`
 	OtherRemark       string    `xorm:"VARCHAR(500)"`
 	Remark            string    `xorm:"comment('备注') VARCHAR(500)"`
 	IsDelete          int       `xorm:"default 0 comment('删除状态,0正常,1已删除') INT(10)"`
@@ -43,8 +43,11 @@ type OilQualChangeMain struct {
 	AccesscardNo   string    `xorm:"comment('准入证号') VARCHAR(20)"`
 	CommercialNo   string    `xorm:"comment('工商注册号') VARCHAR(20)"`
 	Step           int       `xorm:"comment('页面上第几步') INT(10)"`
+	AuditIndex     int       `xorm:"default 0 comment('审批次数') INT(11)"`
+	BusinessKey    string    `xorm:"VARCHAR(255)"`
 	Status         string    `xorm:"comment('状态标识') VARCHAR(10)"`
 	WorkFlowId     string    `xorm:"comment('工作流的ID') VARCHAR(50)"`
+	Remark         string    `xorm:"comment('备注') VARCHAR(500)"`
 	CreateOn       time.Time `xorm:"DATETIME"`
 	CreateUserId   int       `xorm:"INT(10)"`
 	CreateBy       string    `xorm:"VARCHAR(50)"`

+ 4 - 4
src/dashoo.cn/backend/api/business/oilsupplier/qualchange/qualchangeService.go

@@ -35,12 +35,12 @@ func (s *QualChangeService) GetQualPagingEntitiesWithOrderBytbl(supname, supcern
 		where = " 1=1 "
 	}
 	//获取总记录数
-	sqlCount := `select count(*) from ` + supname + ` a 
-	left join ` + supcername + ` b on a.Id=b.SupplierId left join `+ qualmainname + ` c on a.Id = c.SupplierId
+	sqlCount := `select count(*) from ` + qualmainname + ` c 
+	left join ` + supname + ` a on a.Id = c.SupplierId left join `+ supcername + ` b on a.Id=b.SupplierId
 	where a.Id in ( select SupplierId from `+ supfilename +`) and `+ where
 	var sql string
-	sql = `select a.*, b.AccessCardNo, b.Id CertId, c.Id  QualId, c.Status Status, c.Step Step, c.WorkFlowId WorkFlowId, c.CreateOn ConmmitTime from ` + supname + ` a  
-	left join ` + supcername + ` b on a.Id=b.SupplierId left join `+ qualmainname + ` c on a.Id = c.SupplierId
+	sql = `select a.*, b.AccessCardNo, b.Id CertId, c.Id  QualId, c.Status Status, c.Step Step, c.WorkFlowId WorkFlowId, c.CreateOn ConmmitTime from ` + qualmainname + ` c  
+	left join ` + supname + ` a  on a.Id = c.SupplierId left join ` + supcername + ` b on a.Id=b.SupplierId 
 	where a.Id in ( select SupplierId from `+ supfilename +`) and` + where + ` order by ` + order +
 		` limit ` + utils.ToStr((pageIndex-1)*itemsPerPage) + "," + utils.ToStr(itemsPerPage)
 

+ 29 - 10
src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

@@ -506,6 +506,7 @@ func (this *InfoChangeController) GetMyTaskEntityList() {
 	actisvc := workflow.GetActivitiService(utils.DBE)
 	certIdList := actisvc.GetMyTasks(workflow.OIL_AUDIT_APPLY, this.User.Id)
 	where += " and Id in (" + certIdList + ")"
+	where += " and Status != -2 "
 	//根据部门查询待办任务
 
 	total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
@@ -620,7 +621,7 @@ func (this *InfoChangeController) GetAuditer() {
 }
 
 // @Title 添加
-// @Description 新增年审
+// @Description 新增信息变更
 // @Success	200	{object} controllers.Request
 // @router /addinfomain [post]
 func (this *InfoChangeController) AddInfoMain() {
@@ -649,6 +650,32 @@ func (this *InfoChangeController) AddInfoMain() {
 	}
 }
 
+// @Title 获取信息变更企业名称
+// @Description 获取实体
+// @Success 200 {object}
+// @router /addsupplierlist [get]
+func (this *InfoChangeController) GetAddSupplierList() {
+	svc := infochange.GetInfoChangeService(utils.DBE)
+	var supplierlist []annualaudit.Suppliername
+	where := "1=1"
+	//企业用户必须加创建人条件
+	if this.User.IsCompanyUser == 1 {
+		where = where + " and CreateUserId = '" + this.User.Id + "'"
+	} else {
+		//超级管理员和有查看所有数据权限的用户不加条件
+		svcPerm := permission.GetPermissionService(utils.DBE)
+		isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
+		if !svcPerm.IsAdmin(this.User.Id) && !isauth {
+			where = where + " and CreateUserId = '" + this.User.Id + "'"
+		}
+	}
+	supplierlist = svc.GetSupplierList(""+OilSupplierName, where)
+	var datainfo DataInfo
+	datainfo.Items = supplierlist
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
 // @Title 提交审批
 // @Description 提交审批
 // @Success	200	{object} controllers.Request
@@ -867,15 +894,7 @@ func (this *InfoChangeController) InfoAudit() {
 			audithistoryentity.CreateBy = this.User.Realname
 			audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 			certSrv.InsertEntity(audithistoryentity)
-			var updateinfo infochange.OilInfoChange
-			updateinfo.Step = 1
-			updateinfo.WorkFlowId = ""
-			cols := []string{
-				"Id",
-				"WorkFlowId",
-				"Step",
-			}
-			svc.UpdateEntityByIdCols(infoid, updateinfo, cols)
+			infochanentity.WorkFlowId = ""
 		}
 		if receiveVal == "true" {
 			infochanentity.Step = step

+ 89 - 18
src/dashoo.cn/backend/api/controllers/oilsupplier/qualchange.go

@@ -1,6 +1,7 @@
 package oilsupplier
 
 import (
+	"dashoo.cn/backend/api/business/audithistory"
 	"encoding/json"
 	"strconv"
 	"strings"
@@ -151,7 +152,16 @@ func (this *QualChangeController) GetMyTaskEntityList() {
 	//找出待办任务
 	actisvc := workflow.GetActivitiService(utils.DBE)
 	certIdList := actisvc.GetMyTasks(workflow.OIL_QUAL_CHANGE, this.User.Id)
+	appendIdarr := strings.Split(certIdList, ",")
+	for i, item := range appendIdarr {
+		idx := strings.Index(item, "-")
+		if idx >= 0 {
+			appendIdarr[i] = strings.Split(item, "-")[0]
+		}
+	}
+	certIdList = strings.Join(appendIdarr, ",")
 	where += " and Id in (" + certIdList + ")"
+	where += " and Status != -2 "
 
 	svc := qualchange.GetQualChangeService(utils.DBE)
 	var list []qualchange.OilQualChangeMain
@@ -200,6 +210,36 @@ func (this *QualChangeController) FileList() {
 	this.ServeJSON()
 }
 
+// @Title 添加
+// @Description 新增信息变更
+// @Success	200	{object} controllers.Request
+// @router /addqualmain [post]
+func (this *QualChangeController) AddQualMain() {
+	SupplierId := this.GetString("SupplierId")
+	Remark := this.GetString("Remark")
+	var qualchmain qualchange.OilQualChangeMain
+	var errinfo ErrorDataInfo
+	qualchmain.SupplierId, _ = strconv.Atoi(SupplierId)
+	qualchmain.Remark = Remark
+	qualchmain.CreateOn = time.Now()
+	qualchmain.CreateBy = this.User.Realname
+	qualchmain.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+	svc := qualchange.GetQualChangeService(utils.DBE)
+	_, err := svc.InsertEntityBytbl(OilQualChangeMainName, &qualchmain)
+	if err == nil {
+		errinfo.Message = "添加成功!"
+		errinfo.Code = 0
+		errinfo.Item = qualchmain.Id
+		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} models.Userblood
@@ -454,31 +494,39 @@ func (this *QualChangeController) EditQualChange() {
 	var jsonblob = this.Ctx.Input.RequestBody
 	svc := qualchange.GetQualChangeService(utils.DBE)
 	json.Unmarshal(jsonblob, &model)
+	model.FileUrl = strings.Trim(model.FileUrl, "$")
+	model.FileName = strings.Trim(model.FileName, "$")
+	model.OldFileUrl = strings.Trim(model.OldFileUrl, "$")
+	model.OldFileName = strings.Trim(model.OldFileName, "$")
+	var err error
 	var entity qualchange.OilQualChangeDetail
+	var qualdetaimodel []qualchange.OilQualChangeDetail
 	var mainentirt qualchange.OilQualChangeMain
 	var qualmain []qualchange.OilQualChangeMain
 	qmwhere := " SupplierId = " + utils.ToStr(model.SupplierId)
 	svc.GetEntitysByWhere(OilQualChangeMainName, qmwhere, &qualmain)
-	var qualmainId int
-	if len(qualmain) == 0 {
-		mainentirt.SupplierCertId = model.SupplierCertId
-		mainentirt.SupplierId = model.SupplierId
-		mainentirt.Status = "0"
-		mainentirt.Step = 1
-		svc.InsertEntityBytbl(OilQualChangeMainName, &mainentirt)
-		qualmainId = mainentirt.Id
-	} else {
-		qualmainId = qualmain[0].Id
-	}
+	mainentirt.SupplierCertId = model.SupplierCertId
+	mainentirt.Status = "0"
+	mainentirt.Step = 1
+	err = svc.UpdateEntityBywheretbl(OilQualChangeMainName, &mainentirt, []string{"SupplierCertId", "Status", "Step"}, qmwhere)
+	qualmainId := mainentirt.Id
+
+	qdwhere := " SupplierId = " + utils.ToStr(model.SupplierId) + " and FileId = "+ id
+	svc.GetEntitysByWhere(OilQualChangeDetailName, qdwhere, &qualdetaimodel)
 	entity = model
 	entity.Id = 0
 	entity.ParentId = qualmainId
 	entity.SupplierCertId = model.SupplierCertId
 	entity.FileId, _ = utils.StrTo(id).Int()
-	entity.CreateOn = time.Now()
-	entity.CreateBy = this.User.Realname
-	entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
-	_, err := svc.InsertEntityBytbl(OilQualChangeDetailName, &entity)
+	if len(qualdetaimodel) == 0 {
+		entity.CreateOn = time.Now()
+		entity.CreateBy = this.User.Realname
+		entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+		_, err = svc.InsertEntityBytbl(OilQualChangeDetailName, &entity)
+	}else {
+		err = svc.UpdateEntityBywheretbl(OilQualChangeDetailName, &entity, []string{"OldEffectDate", "FileUrl", "FileName", "OtherRemark"}, qdwhere)
+	}
+
 	if err == nil {
 		errinfo.Message = "操作成功!"
 		errinfo.Code = 0
@@ -525,14 +573,16 @@ func (this *QualChangeController) AuditEntity() {
 	}()
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	processInstanceId := ""
+	businessKey := ""
 	if qualmain.WorkFlowId == "0" || len(qualmain.WorkFlowId) <= 0 {
 		//启动工作流
-		processInstanceId = svcActiviti.StartProcess(workflow.OIL_QUAL_CHANGE, utils.ToStr(qualmain.Id), this.User.Id)
+		businessKey = utils.ToStr(qualmain.Id) + "-" + strconv.Itoa(qualmain.AuditIndex)
+		processInstanceId = svcActiviti.StartProcess(workflow.OIL_QUAL_CHANGE, businessKey, this.User.Id)
 	}
 
 	var ActiComplete workflow.ActiCompleteVM
 	ActiComplete.ProcessKey = workflow.OIL_QUAL_CHANGE
-	ActiComplete.BusinessKey = utils.ToStr(qualmain.Id)
+	ActiComplete.BusinessKey = businessKey
 	ActiComplete.UserNames = firstAudit
 	ActiComplete.UserId = this.User.Id
 	ActiComplete.Result = "1"
@@ -545,6 +595,8 @@ func (this *QualChangeController) AuditEntity() {
 		var qualmainmodel qualchange.OilQualChangeMain
 		qualmainmodel.WorkFlowId = processInstanceId
 		qualmainmodel.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
+		qualmainmodel.AuditIndex = qualmain.AuditIndex + 1
+		qualmainmodel.BusinessKey = ActiComplete.BusinessKey
 		qualmainmodel.CreateOn = time.Now()
 		qualmainmodel.CreateBy = this.User.Realname
 		qualmainmodel.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
@@ -555,6 +607,8 @@ func (this *QualChangeController) AuditEntity() {
 			"WorkflowId",
 			"Status",
 			"Step",
+			"AuditIndex",
+			"BusinessKey",
 			"CreateOn",
 			"CreateBy",
 			"CreateUserId",
@@ -627,7 +681,7 @@ func (this *QualChangeController) QualAudit() {
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	var ActiComplete workflow.ActiCompleteVM
 	ActiComplete.ProcessKey = workflow.OIL_QUAL_CHANGE
-	ActiComplete.BusinessKey = utils.ToStr(qualid)
+	ActiComplete.BusinessKey = qualmodel.BusinessKey
 	ActiComplete.UserNames = userIds
 	ActiComplete.UserId = this.User.Id
 	ActiComplete.Remarks = dataother.AuditorRemark
@@ -687,12 +741,29 @@ func (this *QualChangeController) QualAudit() {
 			qualchanentity.Status = "-3" //企业法规处审批
 		}
 		receiveVal := svcActiviti.TaskComplete(ActiComplete)
+		if qualchanentity.Status == "-2" {
+			// 审批历史
+			var audithistoryentity audithistory.Base_AuditHistory
+			audithistoryentity.EntityId = qualid
+			audithistoryentity.WorkflowId = qualmodel.WorkFlowId
+			audithistoryentity.Process = ActiComplete.ProcessKey
+			audithistoryentity.BusinessKey = ActiComplete.BusinessKey
+			audithistoryentity.Type = "05"
+			audithistoryentity.BackStep = qualmodel.Status
+			audithistoryentity.Index = qualmodel.AuditIndex
+			audithistoryentity.CreateOn = time.Now()
+			audithistoryentity.CreateBy = this.User.Realname
+			audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+			certSrv.InsertEntity(audithistoryentity)
+			qualchanentity.WorkFlowId = ""
+		}
 		if receiveVal == "true" {
 			qualchanentity.Step = step
 			cols := []string{
 				"Id",
 				"Status",
 				"Step",
+				"WorkFlowId",
 			}
 			_, err := svc.UpdateEntityByIdCols(qualid, qualchanentity, cols)
 			if err == nil {

+ 6 - 0
src/dashoo.cn/frontend_web/src/api/oilsupplier/infochange.js

@@ -6,6 +6,12 @@ export default {
       params: params
     })
   },
+  getAddSupList (myAxios) {
+    return myAxios({
+      url: '/infochange/addsupplierlist/',
+      method: 'GET'
+    })
+  }, 
   getSuppList (CreateOn, params, myAxios) {
     return myAxios({
       url: '/infochange/supplist?CreateOn=' + CreateOn,

+ 7 - 0
src/dashoo.cn/frontend_web/src/api/oilsupplier/qualchange.js

@@ -24,6 +24,13 @@ export default {
       method: 'GET'
     })
   },
+  addQualChMain (params, myAxios) {
+    return myAxios({
+      url: '/qualchange/addqualmain' ,
+      method: 'post',
+      params: params
+    })
+  },
   addEntity (formData, myAxios) {
     return myAxios({
       url: '/qualchange/add',

+ 2 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/infochange/index.vue

@@ -346,7 +346,8 @@
         })
       },
       getselectsupplier() {
-        annapi.getSupList(this.$axios).then(res => {
+        api.getAddSupList(this.$axios).then(res => {
+          console.log("-------res",res.data)
           if (res.data.items.length != 0) {
             for (var i = 0; i < res.data.items.length; i++) {
               this.selectsupplierlist.push({

+ 99 - 41
src/dashoo.cn/frontend_web/src/pages/oilsupplier/qualchange/_opera/operation.vue

@@ -11,8 +11,11 @@
           <i class="icon icon-table2"></i> 编辑
         </span>
         <span style="float: right;">
+          <!-- <el-button type="primary" size="mini" style="margin-left: 8px" @click="historychange">历史变更</el-button> -->
+          <el-button type="primary" size="mini" style="margin-left: 8px" @click="auhistory">审批历史</el-button>
           <el-button type="primary" size="mini" @click="submitqualChange"
-            v-if="(QualStatus == 0 || QualStatus == '') && !butnab">提交申请</el-button>
+            v-if="(QualStatus == 0 || QualStatus == '' || QualStatus == -2 || QualStatus == 3) && !butnab">提交申请
+          </el-button>
           <router-link :to="'/oilsupplier/qualchange'">
             <el-button type="primary" size="mini" style="margin-left: 8px">返回</el-button>
           </router-link>
@@ -35,24 +38,36 @@
       <el-table :data="subfileList" border>
         <el-table-column label="操作" width="150" align="center" fixed>
           <template slot-scope="scope">
-            <el-button type="primary" plain size="mini" title="文件变更" @click="openDialog(scope.row)" :disabled="butnab">变更</el-button>
+            <el-button type="primary" plain size="mini" title="文件变更" @click="openDialog(scope.row)" :disabled="butnab">
+              变更</el-button>
           </template>
         </el-table-column>
         <el-table-column prop="NeedFileType" label="文件分类" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="OldFileName" label="原文件" show-overflow-tooltip>
+        <el-table-column prop="OldFileUrlList" label="原文件" show-overflow-tooltip>
           <template slot-scope="scope">
-            <a :href="'http://'+fileurlcut(scope.row.OldFileUrl+'')" target="_blank" class="buttonText">
-            {{scope.row.OldFileName}}</a>
+            <div v-for="(tmpUrl, index) in scope.row.OldFileUrlList">
+              <a :href="'http://'+fileurlcut(scope.row.OldFileUrl, index)" target="_blank" class="buttonText"  >{{scope.row.OldFileName.split('$')[index]}}</a>
+            </div>
           </template>
+          <!-- <template slot-scope="scope">
+            <a :href="'http://'+fileurlcut(scope.row.OldFileUrl+'')" target="_blank" class="buttonText">
+              {{scope.row.OldFileName}}</a>
+          </template> -->
         </el-table-column>
         <el-table-column prop="OldEffectDate" label="原有效日期" show-overflow-tooltip>
           <template slot-scope="scope">
             {{ jstimehandle(scope.row.OldEffectDate+'') }}
           </template>
         </el-table-column>
-        <el-table-column prop="FileName" label="变更后文件" show-overflow-tooltip>
+        <el-table-column prop="FileUrlList" label="变更后文件" show-overflow-tooltip>
+          <!-- <template slot-scope="scope">
+            <a :href="'http://'+fileurlcut(scope.row.FileUrl)" target="_blank"
+              class="buttonText">{{scope.row.FileName}}</a>
+          </template> -->
           <template slot-scope="scope">
-            <a :href="'http://'+fileurlcut(scope.row.FileUrl)" target="_blank" class="buttonText">{{scope.row.FileName}}</a>
+            <div v-for="(tmpUrl, index) in scope.row.FileUrlList">
+              <a :href="'http://'+fileurlcut(scope.row.FileUrl, index)" target="_blank" class="buttonText"  >{{scope.row.FileName.split('$')[index]}}</a>
+            </div>
           </template>
         </el-table-column>
         <el-table-column prop="EffectDate" label="变更后有效日期" show-overflow-tooltip>
@@ -66,14 +81,19 @@
       <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="资质文件">
-              <el-upload style="margin-top: 10px;" action="" ref="refuploadattach" :http-request="uploadrequest"
-                class="attach-uploader" :before-upload="beforeAvatarUpload">
-                <i class="el-icon-plus attach-uploader-icon"></i>
-              </el-upload>
-            </el-form-item>
-          </el-col>
+            <el-col :span="12">
+              <el-form-item label="资质文件">
+                <el-upload multiple style="margin-top: 10px;" action="" ref="refuploadattach"
+                  :http-request="uploadrequest" class="attach-uploader" :before-upload="beforeAvatarUpload">
+                  <i class="el-icon-plus attach-uploader-icon"></i>
+                  <div slot="tip" class="el-upload__tip">大小为512KB-5MB</div>
+                </el-upload>
+                <!-- <el-upload style="margin-top: 10px;" action="" ref="refuploadattach" :http-request="uploadrequest"
+                  class="attach-uploader" :before-upload="beforeAvatarUpload">
+                  <i class="el-icon-plus attach-uploader-icon"></i>
+                </el-upload> -->
+              </el-form-item>
+            </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,7 +146,9 @@
     </el-dialog>
     <choose-auditor ref="chooseAuditor" @close="setAuditer" @hideChooseAuditer="chooseAuditorVisible=false"
       :visible="chooseAuditorVisible"></choose-auditor>
-
+    <el-dialog title="审批历史" :visible.sync="audithistoryshow" width="1200px">
+      <wf-back-history ref="WfBackHistory" :entryinfo="backhistroy"></wf-back-history>
+    </el-dialog>
   </div>
 </template>
 
@@ -139,8 +161,9 @@
   import uploadajax from '@/assets/js//uploadajax.js'
   import quaapi from '@/api/oilsupplier/qualchange'
   import axios from 'axios'
+  import WfBackHistory from '@/components/workflow/wfbackhistory.vue'
   import ChooseAuditor from '@/components/oilsupplier/chooseauditor'
- // import uploadajax from '../../assets/js/uploadajax.js'
+  // import uploadajax from '../../assets/js/uploadajax.js'
   export default {
     computed: {
       ...mapGetters({
@@ -149,6 +172,7 @@
       })
     },
     components: {
+      WfBackHistory,
       ChooseAuditor
     },
     // components: {
@@ -159,6 +183,13 @@
 
     data() {
       return {
+        audithistoryshow: false,
+        backhistroy: {
+          certId: '',
+          classId: '05',
+          workflowId: ''
+        },
+        QualId:'',
         chooseAuditorVisible: false,
         auditer: '',
         auditerName: '',
@@ -207,6 +238,8 @@
           OldEffectDate: new Date(),
           OldFileUrl: '',
           OtherRemark: '',
+          FileUrlList: [],
+          OldFileUrlList: [],
           Remark: '',
           IsDelete: 0
         },
@@ -229,9 +262,12 @@
         this.classId = this.$route.query.classId + ''
       }
       this.QualStatus = this.$route.query.QualStatus
-      if (this.QualStatus > 0) {
-        this.butnab = true
-      }
+      this.QualId = this.$route.query.QualId
+      this.backhistroy.certId = this.QualId
+      // if (this.QualStatus > 0) {
+      //   this.butnab = true
+      // }
+      console.log("----this.QualStatus---", this.QualStatus)
       this.SupplierId = this.serviceId
       this.SupplierTypeCode = this.classId
       this.SupplierCertId = this.certId
@@ -254,7 +290,18 @@
           .then(res => {
             _this.subfileList = res.data.items
             _this.currentItemCount = res.data.currentItemCount
-            console.log("----this.subfileList---",this.subfileList)
+            console.log("----this.subfileList---", this.subfileList)
+            for (let idx in _this.subfileList) {
+              console.log(_this.subfileList[idx],"2222")
+              _this.subfileList[idx].FileUrlList = _this.subfileList[idx].FileUrl.split('$')
+
+            }
+            console.log("111-",_this.subfileList[0].FileUrlList)
+            for (let idx1 in _this.subfileList) {
+              console.log(_this.subfileList[idx1],"1111")
+              _this.subfileList[idx1].OldFileUrlList = _this.subfileList[idx1].OldFileUrl.split('$')
+
+            }
           })
           .catch(err => {
             console.error(err)
@@ -283,6 +330,10 @@
           console.error(err)
         })
       },
+      //审批历史
+      auhistory() {
+        this.audithistoryshow = true
+      },
       getbusList() {
         let _this = this
         const params = {
@@ -304,23 +355,23 @@
       //保存修改
       makesure() {
         if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
-            // 上传附件是否完成判断
-            if (!this.attachissuccess()) {
-              this.$message.error('有附件未成功上传!不能保存数据')
-              return
-            }
-            this.getattachissuccess()
-            this.editqualchange()
-          } else {
-            this.editqualchange()
+          // 上传附件是否完成判断
+          if (!this.attachissuccess()) {
+            this.$message.error('有附件未成功上传!不能保存数据')
+            return
           }
+          this.getattachissuccess()
+          this.editqualchange()
+        } else {
+          this.editqualchange()
+        }
       },
       editqualchange() {
         let _this = this
         _this.SubfileForm.SupplierId = parseInt(_this.SubfileForm.SupplierId)
         _this.SubfileForm.SupplierCertSubId = parseInt(_this.SubfileForm.SupplierCertSubId)
         _this.SubfileForm.SupplierCertId = parseInt(_this.SupplierCertId)
-        console.log("----this.SubfileForm---",this.SubfileForm)
+        console.log("----this.SubfileForm---", this.SubfileForm)
         _this.$axios.put('/qualchange/editqualchange/' + _this.SubfileForm.Id, _this.SubfileForm)
           .then(res => {
             if (res.data.code === 0) {
@@ -343,7 +394,7 @@
           })
       },
       openDialog(val) {
-        console.log("======val----",val)
+        console.log("======val----", val)
         this.Title = '资质变更'
         this.SubfileForm.Id = val.Id
         this.SubfileForm.SupplierId = val.SupplierId
@@ -381,10 +432,15 @@
         _this.doclist.push(params)
       },
 
-      beforeAvatarUpload(file) {
-        let isLt50m = file.size / 1024 / 1024 / 50 < 1
+       beforeAvatarUpload (file) {
+        /*let isLt512K = file.size / 1024 < 512
+        if (isLt512K) {
+          this.$message.error('上传文件大小不能小于 512KB!')
+          return false
+        }*/
+        let isLt50m = file.size / 1024 / 1024 / 5 < 1
         if (!isLt50m) {
-          this.$message.error('上传文件大小不能超过 50MB!')
+          this.$message.error('上传文件大小不能超过 5MB!')
           return false
         }
         return true
@@ -415,7 +471,7 @@
             })
           })
       },
-       // 判断附件是否上传成功
+      // 判断附件是否上传成功
       attachissuccess() {
         if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
           for (let i = 0; i < this.$refs.refuploadattach.uploadFiles.length; i++) {
@@ -433,9 +489,9 @@
             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.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}`
+                  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}$`
                 }
               }
             }
@@ -479,9 +535,11 @@
         this.chooseAuditorVisible = true
       },
 
-      fileurlcut(val) {
-        let fileurlall = val
+      fileurlcut(val, index) {
+        let fileurlall = val.split('$')[index]
+       // console.log("------fileurlall",fileurlall)
         let fileurl = fileurlall.split("|")
+       // console.log("------dileurl",fileurl)
         return fileurl[0]
       },
 

+ 88 - 6
src/dashoo.cn/frontend_web/src/pages/oilsupplier/qualchange/index.vue

@@ -9,10 +9,10 @@
         <span>
           <i class="icon icon-table2"></i> 企业资质表
         </span>
-        <!-- <span style="float: right;">
-          <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="addaudit">添加
+        <span style="float: right;">
+          <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="addqualchange">添加变更
           </el-button>
-        </span> -->
+        </span>
         <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
           <el-form-item label="年审日期">
             <el-date-picker size="mini" style="width: 220px" v-model="CreateOn" type="daterange" range-separator="至"
@@ -39,7 +39,7 @@
       <el-table :data="entityList" border height="calc(100vh - 243px)" style="width: 100%" @sort-change="orderby">
         <el-table-column label="操作" min-width="90" align="center" fixed="right">
           <template slot-scope="scope">
-            <router-link :to="'/oilsupplier/qualchange/' + scope.row.Id + '/operation?certid=' + scope.row.CertId +'&classId='+ scope.row.SupplierTypeCode +'&QualStatus='+scope.row.Status">
+            <router-link :to="'/oilsupplier/qualchange/' + scope.row.Id + '/operation?certid=' + scope.row.CertId +'&classId='+ scope.row.SupplierTypeCode +'&QualStatus='+scope.row.Status+'&QualId='+scope.row.QualId">
               <el-button type="primary" plain title="资质变更" size="mini">资质变更</el-button>
             </router-link>
           </template>
@@ -119,14 +119,44 @@
         <el-button size="mini" type="primary" @click="handleSearch">查 询</el-button>
       </span>
     </el-dialog>
+     <el-dialog title="资质变更添加" :visible.sync="addshow" width="360px">
+      <el-form label-width="90px" :model="entityForm" ref="EntityFormref">
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="企业名称" prop="SupplierId" required>
+              <el-select filterable default-first-option ref="supselect" v-model="entityForm.SupplierId" required
+                placeholder="请选择" style="width: 100%">
+                <el-option v-for="item in selectsupplierlist" :key="item.Id" :label="item.Realname" :value="item.Id">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="说明">
+              <el-input v-model="entityForm.Remark" type="textarea" placeholder="请输入说明内容">
+              </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <span style="float: right;margin-top:-10px;">
+        <el-button size="small" @click="addshow = false">取 消</el-button>
+        <el-button type="primary" size="small" @click="addQualChange()">确 定</el-button>
+      </span>
+      <br>
+    </el-dialog>
   </div>
 </template>
 <script>
   import {
     mapGetters
   } from 'vuex';
-  import supplierapi from '@/api/oilsupplier/supplier';
-  import api from '@/api/oilsupplier/annualaudit';
+  import infoapi from '@/api/oilsupplier/infochange'
+  import supplierapi from '@/api/oilsupplier/supplier'
+  import api from '@/api/oilsupplier/annualaudit'
+  import qualapi from '@/api/oilsupplier/qualchange'
 
   export default {
     computed: {
@@ -203,6 +233,7 @@
       Object.assign(this.searchFormReset, this.searchForm)
       //查询列表
       this.initDatas()
+      this.getselectsupplier()
       //this.getDictOptions()
     },
     methods: {
@@ -237,6 +268,57 @@
         })
       },
 
+      getselectsupplier() {
+        infoapi.getAddSupList(this.$axios).then(res => {
+          console.log("-------res",res.data)
+          if (res.data.items.length != 0) {
+            for (var i = 0; i < res.data.items.length; i++) {
+              this.selectsupplierlist.push({
+                Id: res.data.items[i].Id,
+                Realname: res.data.items[i].SupplierName
+              })
+            }
+          }
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+
+      addqualchange() {
+        this.addshow = true
+      },
+
+      addQualChange() {
+        this.$refs['EntityFormref'].validate((valid) => {
+          if (valid) {
+            console.log("---this.entityForm--",this.entityForm)
+            this.entityForm.SupplierId = this.entityForm.SupplierId + ""
+            qualapi.addQualChMain(this.entityForm, this.$axios).then(res => {
+              if (res.data.code === 0) {
+                console.log("--------res.data----", res.data)
+                //保存成功后,初始化数据,变成修改
+                this.entityForm.Id = res.data.item;
+                this.initDatas();
+                this.addshow = false
+                this.$message({
+                  type: 'success',
+                  message: res.data.message
+                });
+
+              } else {
+                this.$message({
+                  type: 'warning',
+                  message: res.data.message
+                });
+              }
+            }).catch(err => {
+              console.error(err)
+            });
+          }
+        })
+        
+      },
+
       getDictOptions() {
         api.getDictList(this.$axios).then(res => {
           //this.dictOptions.customerList = res.data.items['customerList']