2
3
فهرست منبع

增项添加资质

lining 5 سال پیش
والد
کامیت
39f2687a0a

+ 121 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappend.go

@@ -4,10 +4,13 @@ import (
 	"dashoo.cn/backend/api/business/audithistory"
 	"dashoo.cn/backend/api/business/auditsetting"
 	msg2 "dashoo.cn/backend/api/business/msg"
+	"dashoo.cn/backend/api/business/oilsupplier/infochange"
 	"dashoo.cn/backend/api/business/oilsupplier/oilcostmanage"
+	"dashoo.cn/backend/api/business/oilsupplier/qualchange"
 	"dashoo.cn/backend/api/business/oilsupplier/supplier"
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
 	"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
+	"dashoo.cn/backend/api/business/oilsupplier/tableheader"
 	"dashoo.cn/backend/api/business/organize"
 	"dashoo.cn/backend/api/business/paymentinfo"
 	"dashoo.cn/backend/api/business/register"
@@ -1088,4 +1091,122 @@ func (this *OilSupplierCertAppendController) updatesupplier(supname string, supp
 	}
 
 	return err
+}
+
+// @Title 添加资金
+// @Description 添加资金
+// @Success	200	{object}
+// @router /addqualchange/:id [post]
+func (this *OilSupplierCertAppendController) AddAppChange() {
+	id := this.Ctx.Input.Param(":id")
+	var errinfo ErrorInfo
+	if id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+	var model qualchange.OilQualChangeDetail
+	var jsonblob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonblob, &model)
+
+	svc := qualchange.GetQualChangeService(utils.DBE)
+
+	var supplierfile supplierfile.OilSupplierFile
+	where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "' and NeedFileType='" + model.NeedFileType + "'"
+	has := svc.GetEntity(&supplierfile, where)
+
+	var tableHeader tableheader.BaseTableheader
+	where1 := "Name = '" + model.NeedFileType + "'"
+	svc.GetEntityByWhere(BaseTableHeader, where1, &tableHeader)
+
+	if has {
+		errinfo.Message = "操作失败!不能重复添加"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
+	supplierfile.SupplierId = model.SupplierId
+	supplierfile.SupplierTypeCode = model.SupplierTypeCode
+	supplierfile.IsManuf = tableHeader.IsManuf
+	supplierfile.NeedFileType = model.NeedFileType
+	supplierfile.FileType = 0
+	supplierfile.SupType = 2
+	supplierfile.CreateOn = time.Now()
+	supplierfile.CreateUserId, _ = strconv.Atoi(this.User.Id)
+	supplierfile.CreateBy = this.User.Realname
+
+	svc.InsertEntity(&supplierfile)
+
+	model.ParentId, _ = strconv.Atoi(id)
+	model.FileId = supplierfile.Id
+	model.FileUrl = strings.Trim(model.FileUrl, "$")
+	model.FileName = strings.Trim(model.FileName, "$")
+
+	var err error
+	var qualdetaimodel []qualchange.OilQualChangeDetail
+
+	qdwhere := " SupplierId = " + utils.ToStr(model.SupplierId) + " and FileId = " + utils.ToStr(supplierfile.Id) + " and ParentId=" + id
+	svc.GetEntitysByWhere(OilAppendChangeDetailName, qdwhere, &qualdetaimodel)
+	if len(qualdetaimodel) == 0 {
+		model.CreateOn = time.Now()
+		model.CreateBy = this.User.Realname
+		model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+		_, err = svc.InsertEntityBytbl(OilAppendChangeDetailName, &model)
+	} else {
+		err = svc.UpdateEntityBywheretbl(OilAppendChangeDetailName, &model, []string{"OldEffectDate", "FileUrl", "FileName", "OtherRemark"}, qdwhere)
+	}
+
+	if err == nil {
+		errinfo.Message = "操作成功!"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "操作失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+// @Title 删除新上传的资质
+// @Description
+// @Success 200 {object} ErrorInfo
+// @Failure 403 :id 为空
+// @router /deletenewfile/:Id [delete]
+func (this *OilSupplierCertAppendController) DeleteNewFile() {
+	Id := this.Ctx.Input.Param(":Id")
+	var errinfo ErrorInfo
+	if Id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
+	svc := infochange.GetInfoChangeService(utils.DBE)
+
+	where := "FileId=" + Id
+	err := svc.DeleteEntityBytbl(OilAppendChangeDetailName, where)
+
+	where1 := "Id=" + Id
+	err = svc.DeleteEntityBytbl(OilSupplierFileName, where1)
+
+
+	if err == nil {
+		errinfo.Message = "删除成功"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
 }

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

@@ -54,5 +54,11 @@ export default {
       params: params,
       data: shenheform
     })
+  },
+  delNewFile (entityId, myAxios) {
+    return myAxios({
+      url: '/suppliercertappend/deletenewfile/' + entityId,
+      method: 'delete'
+    })
   }
 }

+ 65 - 26
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierappend/_opera/goodsdataopera.vue

@@ -568,7 +568,7 @@
             <el-card class="box-card" style="margin-top: 10px;">
               <div slot="header" class="clearfix">
                 <span><i class="icon icon-table2"></i> 企业资质</span>
-                <!--<el-button style="float: right; padding: 3px 0" type="text" @click="showDialog" >添加</el-button>-->
+                <el-button style="float: right; padding: 3px 0" type="text" @click="showDialog" >添加</el-button>
               </div>
               <!--<el-table :data="subfileList" size="mini" border>-->
                 <!--<el-table-column label="操作" width="150" align="center" fixed>-->
@@ -608,6 +608,9 @@
                   <template slot-scope="scope">
                     <el-button type="primary" plain size="mini" title="文件变更" :disabled="formData.Status > 0" @click="openDialog(scope.row)">
                       变更</el-button>
+                    <el-button type="danger" plain size="mini" title="文件删除" @click="delFile(scope.row)"
+                               v-if="formData.Status <= 0 && scope.row.FileType == 0 && scope.row.OldFileUrl == ''">
+                      删除</el-button>
                   </template>
                 </el-table-column>
                 <el-table-column prop="NeedFileType" label="文件分类" show-overflow-tooltip></el-table-column>
@@ -975,10 +978,10 @@
       :visible="chooseAuditorVisibleFen" typeCode="01"></choose-auditor-fen>
 
       <el-dialog title="新增文件" :visible.sync="newVisible" top="5vh">
-      <el-form :model="newSubfileForm" label-width="100px">
+      <el-form ref="newSubfileForm" :model="newSubfileForm" label-width="100px" :rules="rules">
         <el-row>
           <el-col :span="12">
-            <el-form-item label="资质名称" required>
+            <el-form-item label="资质名称" prop="NeedFileType">
               <el-select v-model="newSubfileForm.NeedFileType" placeholder="请输文件类型" size="medium">
                 <el-option v-for="item in dynamicTableColumns" :key="item.prop" :label="item.label" :value="item.label">
                 </el-option>
@@ -986,7 +989,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="有效日期" required>
+            <el-form-item label="有效日期" prop="EffectDate">
               <el-date-picker style="width: 100%" v-model="newSubfileForm.EffectDate" type="date" placeholder="请选择有效日期">
               </el-date-picker>
             </el-form-item>
@@ -1274,7 +1277,7 @@
           FileType: '',
           FileExt: '',
           FileName: '',
-          EffectDate: new Date(),
+          EffectDate: '',
           FileUrl: '',
           OtherRemark: '',
           Remark: '',
@@ -1290,10 +1293,10 @@
           SupType: 2,
           NeedFileType: '',
           NeedFileCode: '',
-          FileType: 66,
+          FileType: 0,
           FileExt: '',
           FileName: '',
-          EffectDate: new Date(),
+          EffectDate: '',
           FileUrl: '',
           OtherRemark: '',
           Remark: '',
@@ -1836,27 +1839,35 @@
       },
       addSubfile () {
         let _this = this
-        _this.newSubfileForm.SupplierId = parseInt(this.SupplierId)
-        _this.$axios.post('/supplierfile/addsubfile/', _this.newSubfileForm)
-          .then(res => {
-            if (res.data.code === 0) {
-              _this.$message({
-                type: 'success',
-                message: res.data.message
+        _this.newSubfileForm.SupplierId = parseInt(_this.formData.SupplierId)
+        _this.newSubfileForm.SupplierCertId = parseInt(_this.formData.SupplierCertId)
+        // _this.$axios.post('/supplierfile/addsubfile/', _this.newSubfileForm)
+        console.log(_this.newSubfileForm, '_this.newSubfileForm')
+
+        this.$refs['newSubfileForm'].validate((valid) => {
+          if (valid) {
+            _this.$axios.post('/suppliercertappend/addqualchange/' + _this.Id, _this.newSubfileForm)
+              .then(res => {
+                if (res.data.code === 0) {
+                  _this.$message({
+                    type: 'success',
+                    message: res.data.message
+                  })
+                  this.newVisible = false
+                  this.getsubfile()
+                  this.$refs.newrefuploadattach.uploadFiles = []
+                } else {
+                  _this.$message({
+                    type: 'warning',
+                    message: res.data.message
+                  })
+                }
               })
-              this.newVisible = false
-              this.getsubfile()
-              this.$refs.newrefuploadattach.uploadFiles = []
-            } else {
-              _this.$message({
-                type: 'warning',
-                message: res.data.message
+              .catch(err => {
+                console.error(err)
               })
-            }
-          })
-          .catch(err => {
-            console.error(err)
-          })
+          }
+        })
       },
       initTableHeader () {
         setapi.initGoodTableHeader(this.$axios).then(res => {
@@ -2545,8 +2556,36 @@
         this.SubfileForm.IsDelete = val.IsDelete
         this.visible = true
       },
+      delFile (row) {
+        let confirmmsg = '此操作将彻底删除该数据, 是否继续?'
+        this.$confirm(confirmmsg, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            api2.delNewFile(row.Id, this.$axios).then(res => {
+              if (res.data.code === 0) {
+                this.$message({
+                  type: 'success',
+                  message: res.data.message
+                })
+                this.getsubfile()
+              } else {
+                this.$message({
+                  type: 'warning',
+                  message: res.data.message
+                })
+              }
+            })
+          })
+          .catch(() => {})
+      },
       showDialog () {
         this.newVisible = true
+        this.newSubfileForm.NeedFileType = ''
+        this.newSubfileForm.EffectDate = ''
+        this.newSubfileForm.OtherRemark = ''
       },
       // 文档列表
       getwendanginfo (iUrl) {