Преглед изворни кода

技术服务类准入范围批量添加组件

shihang пре 6 година
родитељ
комит
9e712d71b1

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

@@ -40,6 +40,25 @@ type SupplierCertSubModel struct {
 	IsDelete         int
 }
 
+type techChecked struct {
+	Id       int `json:"id"`
+	Code     string
+	Name     string
+	CodeName string
+}
+type TechnologySubModel struct {
+	CheckList        []techChecked //批量添加准入范围
+	Id               int           `xorm:"<- not null pk autoincr INT(10)"`
+	SupplierId       int
+	SupplierCertId   int
+	SupplierTypeCode string
+	SubClassId       int
+	Code             string
+	Name             string
+	Remark           string
+	IsDelete         int
+}
+
 type OilSupplierCertAppendSub struct {
 	Id             int       `xorm:"not null pk autoincr INT(10)"`
 	SupplierId     int       `xorm:"not null comment('供方基本信息表主键') INT(10)"`

+ 7 - 5
src/dashoo.cn/backend/api/business/oilsupplier/technologyservice/oiltechnologyservice.go

@@ -86,9 +86,11 @@ type OilTechnologyServiceView struct {
 }
 
 type TechnologyBusiness struct {
-	Id       int
-	Code     string
-	Name     string
-	ParentId int
-	Remark   string
+	Id                int
+	Code              string
+	Name              string
+	CodeName          string
+	ParentId          int
+	Remark            string
+	DeletionStateCode int
 }

+ 15 - 1
src/dashoo.cn/backend/api/business/oilsupplier/technologyservice/oiltechnologyserviceService.go

@@ -1,10 +1,12 @@
 package technologyservice
 
 import (
+	"strconv"
+
 	. "dashoo.cn/backend/api/mydb"
+	"dashoo.cn/utils"
 	. "dashoo.cn/utils/db"
 	"github.com/go-xorm/xorm"
-	"strconv"
 )
 
 type OilTechnologyServiceService struct {
@@ -51,3 +53,15 @@ func (s *OilTechnologyServiceService) GetMyPagingEntitiesWithOrderBytbl(tableNam
 	}
 	return total
 }
+
+func (s *OilTechnologyServiceService) GetTechList(goodsclass, where string) []TechnologyBusiness {
+	if where == "" {
+		where = " 1=1 "
+	}
+	var sql string
+	sql = `select Id, Code, Name, concat(Code, '  ', Name) as CodeName, ParentId, Remark, DeletionStateCode  
+	from ` + goodsclass + ` where ` + where + `  order by Code asc `
+	List := make([]TechnologyBusiness, 0)
+	utils.DBE.Sql(sql).Find(&List)
+	return List
+}

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

@@ -300,7 +300,7 @@ func (this *OilSupplierCertSubController) DeleteEntity() {
 	}
 }
 
-// @Title 批量添加准入范围
+// @Title 批量添加准入范围--物资类
 // @Description 批量添加准入范围
 // @Success 200 {object} business.device.DeviceChannels
 // @router /addgoodsbus [post]
@@ -377,6 +377,83 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 	}
 }
 
+// @Title 批量添加准入范围--技术服务类
+// @Description 批量添加准入范围
+// @Success 200 {object} business.device.DeviceChannels
+// @router /addtechbus [post]
+func (this *OilSupplierCertSubController) AddTechBus() {
+	var jsonblob = this.Ctx.Input.RequestBody
+	var datamain suppliercertsub.OilSupplierCertSub
+	var dataother suppliercertsub.TechnologySubModel
+	json.Unmarshal(jsonblob, &datamain)
+	json.Unmarshal(jsonblob, &dataother)
+
+	var errinfo ErrorDataInfo
+	for n := 0; ; n++ {
+		if n == len(dataother.CheckList) {
+			errinfo.Message = "操作成功!"
+			errinfo.Code = 0
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		}
+		where_sub := "SupplierTypeCode = 03 and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
+		where_sub += " and SupplierCertId = '" + strconv.Itoa(dataother.SupplierCertId) + "'"
+		where_sub += " and SubClassId = '" + strconv.Itoa(dataother.CheckList[n].Id) + "'"
+		var model suppliercertsub.OilSupplierCertSub
+		svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
+		has := svc.GetEntityByWhere(OilSupplierCertSubName, where_sub, &model)
+
+		if !has {
+			datamain.SubClassId = dataother.CheckList[n].Id
+			datamain.Code = dataother.CheckList[n].Code
+			datamain.Name = dataother.CheckList[n].Name
+			datamain.Remark = dataother.Remark
+			datamain.IsDelete = 0
+			datamain.CreateBy = this.User.Realname
+			datamain.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+			svc.InsertEntityBytbl(OilSupplierCertSubName, &datamain)
+
+			filesvc := supplierfile.GetSupplierfileService(utils.DBE)
+			needList := filesvc.GetTechNeedFileList(dataother.CheckList[n].Id)
+
+			var list []supplierfile.OilSupplierFile
+			where := "SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
+			svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
+			if len(list) == 0 { //第一次添加准入项,将共有必备资质写入文件表
+				for i := 0; i < len(needList); i++ {
+					var entity supplierfile.OilSupplierFile
+					entity.SupplierId = dataother.SupplierId
+					if i < 4 {
+						entity.SupplierTypeCode = "000"
+					} else {
+						entity.SupplierTypeCode = dataother.SupplierTypeCode
+					}
+					entity.NeedFileType = needList[i].FileName
+					entity.FileType = 1
+					entity.EffectDate = time.Now()
+					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 = dataother.SupplierId
+						entity.SupplierTypeCode = dataother.SupplierTypeCode
+						entity.NeedFileType = needList[i].FileName
+						entity.FileType = 1
+						entity.EffectDate = time.Now()
+						entity.CreateBy = this.User.Realname
+						entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+						svc.InsertEntityBytbl(OilSupplierFileName, &entity)
+					}
+				}
+			}
+		}
+	}
+}
+
 // @Title 新增准入范围
 // @Description 新增准入范围
 // @Success	200	{object} controllers.Request
@@ -397,7 +474,7 @@ func (this *OilSupplierCertSubController) AddBusiness() {
 	} else if model.SupplierTypeCode == "02" {
 		needList = filesvc.GetBasicNeedFileList(model.SubClassId)
 	} else {
-		needList = filesvc.GetTechNeedFileList(model.SubClassId)
+		//		needList = filesvc.GetTechNeedFileList(model.SubClassId)
 	}
 
 	if err == nil {

+ 21 - 21
src/dashoo.cn/backend/api/controllers/oilsupplier/technologyservice.go

@@ -349,37 +349,37 @@ func (this *OilTechnologyServiceController) DeleteEntity() {
 // @Title get 业务列表
 // @Description get SampleType by token
 // @Success 200 {object} sampletype.SampleType
-// @router /businesslist [get]
-func (this *OilTechnologyServiceController) BusinessList() {
+// @router /techbuslist [get]
+func (this *OilTechnologyServiceController) TechbusList() {
 	svc := technologyservice.GetOilTechnologyServiceService(utils.DBE)
 	where := " 1 = 1 "
 	var list []technologyservice.TechnologyBusiness
 	//获取技术服务类资质分类层级信息
-	svc.GetEntitysByWhere(OilTechnologyServiceClassName, where, &list)
+	list = svc.GetTechList(OilTechnologyServiceClassName, where)
 	var datainfo DataInfo
 	datainfo.Items = list
 	this.Data["json"] = &datainfo
 	this.ServeJSON()
 }
 
-// @Title get 业务列表
-// @Description get SampleType by token
-// @Success 200 {object} sampletype.SampleType
-// @router /needfilelist [get]
-func (this *OilTechnologyServiceController) NeedFileList() {
-	svc := technologyservice.GetOilTechnologyServiceService(utils.DBE)
-	where := " 1 = 1 "
-	ClassId := this.GetString("ClassId")
-	if ClassId != "" {
-		where = where + " and ClassId ='" + ClassId + "' "
-	}
-	var model technologyservice.OilTechnologyService
-	svc.GetEntityByWhere(OilTechnologyServiceName, where, &model)
-	var datainfo DataInfo
-	datainfo.Items = model
-	this.Data["json"] = &datainfo
-	this.ServeJSON()
-}
+//// @Title get 业务列表
+//// @Description get SampleType by token
+//// @Success 200 {object} sampletype.SampleType
+//// @router /needfilelist [get]
+//func (this *OilTechnologyServiceController) NeedFileList() {
+//	svc := technologyservice.GetOilTechnologyServiceService(utils.DBE)
+//	where := " 1 = 1 "
+//	ClassId := this.GetString("ClassId")
+//	if ClassId != "" {
+//		where = where + " and ClassId ='" + ClassId + "' "
+//	}
+//	var model technologyservice.OilTechnologyService
+//	svc.GetEntityByWhere(OilTechnologyServiceName, where, &model)
+//	var datainfo DataInfo
+//	datainfo.Items = model
+//	this.Data["json"] = &datainfo
+//	this.ServeJSON()
+//}
 
 // @Title 获取Code
 // @Description 根据Id获取Code

+ 2 - 3
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodslist.vue

@@ -75,7 +75,6 @@
         SupplierTypeCode: '',
         SupplierCertId: 0,
 
-        Title: '',
         goodsList: [],
         goodsDialog: false,
         orgtreelist: [],
@@ -86,7 +85,7 @@
         },
         checkList: [],
         Remark: '',
-        
+
         visible: false,
         selfVisible: this.visible, // 避免vue双向绑定警告
         currentPage: 1, // 分页
@@ -151,7 +150,7 @@
           })
           return
         }
-        _this.$axios.post('/suppliercertsub/addgoodsbus/', params)
+        _this.$axios.post('/suppliercertsub/addgoodsbus', params)
           .then(res => {
             if (res.data.code === 0) {
               _this.$message({

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

@@ -0,0 +1,235 @@
+<template>
+  <div>
+    <el-card class="box-card">
+      <div slot="header" class="clearfix">
+        <span style="font-weight: bold">准入范围</span>
+        <span style="float: right;">
+          <el-button style="float: right; padding: 3px 0" type="text" @click="showDialog" v-if="canadd">添加
+          </el-button>
+        </span>
+      </div>
+      <el-table :data="techList" border style="height: calc(100vh - 435px);">
+        <el-table-column label="操作" width="90" align="center" fixed>
+          <template slot-scope="scope">
+            <el-button type="primary" plain size="mini" title="删除" style="margin-left:3px"
+              @click="deletedata(scope.row)" :disabled="!canadd">删除</el-button>
+          </template>
+        </el-table-column>
+        <el-table-column prop="Code" label="分类编码" show-overflow-tooltip></el-table-column>
+        <el-table-column prop="Name" 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-card>
+
+    <el-dialog title="技术服务类业务列表" :visible.sync="techDialog" top="5vh">
+      <el-row :gutter="20" style="height: calc(100vh - 450px); overflow: auto;">
+        <el-col :span="20">
+          <el-tree highlight-current :expand-on-click-node="true" node-key="CodeName" :data="orgtreelist"
+            :props="orgtreeprops" ref="orgmanagetree" show-checkbox>
+          </el-tree>
+        </el-col>
+      </el-row>
+      <el-row style="margin-top: 30px">
+        备注信息:
+        <el-col :span="24">
+          <el-input v-model="Remark" type="textarea" :rows=3 placeholder="请输入备注信息"></el-input>
+        </el-col>
+      </el-row>
+      <div slot="footer" class="dialog-footer">
+        <el-button size="mini" @click="visible = false">取 消</el-button>
+        <el-button type="primary" size="mini" @click="getChecklist()">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import {
+    mapGetters
+  } from 'vuex'
+
+  export default {
+    name: 'GoodsList',
+    components: {},
+    props: {
+      canadd: {
+        type: Boolean,
+        default: false
+      }
+    },
+    created() {
+      this.initData()
+    },
+    computed: {
+      ...mapGetters({
+        session: 'session'
+      })
+    },
+    data() {
+      return {
+        SupplierId: 0,
+        SupplierTypeCode: '',
+        SupplierCertId: 0,
+
+        techList: [],
+        techDialog: false,
+        orgtreelist: [],
+        orgtreeprops: {
+          value: 'Id',
+          label: 'CodeName',
+          children: 'children'
+        },
+        checkList: [],
+        Remark: '',
+        
+        visible: false,
+        selfVisible: this.visible, // 避免vue双向绑定警告
+        currentPage: 1, // 分页
+        size: 10,
+        currentItemCount: 0,
+        flagId: 0 //标记是否第一次点击
+      }
+    },
+    methods: {
+      getvalue(SupplierId, SupplierTypeCode, certId) {
+        this.SupplierId = SupplierId
+        this.SupplierTypeCode = SupplierTypeCode
+        this.SupplierCertId = certId
+        this.initData()
+      },
+      initData() {
+        let _this = this
+        const params = {
+          SupplierCertId: this.SupplierCertId,
+          SupplierTypeCode: this.SupplierTypeCode,
+          _currentPage: this.currentPage,
+          _size: this.size
+        }
+        this.$axios.get('suppliercertsub/list', {
+            params
+          })
+          .then(res => {
+            _this.techList = res.data.items
+            _this.currentItemCount = res.data.currentItemCount
+            _this.$emit('close')
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
+      getChecklist() {
+        let val = this.$refs.orgmanagetree.getCheckedNodes()
+        this.checkList = []
+        for (var i = 0; i < val.length; i++) {
+          if (val[i].Code.length == 8) {
+            this.checkList.push(val[i])
+          }
+        }
+        this.addBusiness()
+      },
+      addBusiness() {
+        let _this = this
+        let params = {
+          SupplierId: parseInt(_this.SupplierId),
+          SupplierCertId: parseInt(_this.SupplierCertId),
+          SupplierTypeCode: '03',
+          Remark: _this.Remark
+        }
+        if (_this.checkList.length > 0) {
+          params = Object.assign(params, {
+            CheckList: _this.checkList
+          })
+        } else {
+          _this.$message({
+            type: 'warning',
+            message: '名称不能为空,请选择分类!'
+          })
+          return
+        }
+        console.log("021r--================",params)
+        _this.$axios.post('/suppliercertsub/addtechbus', params)
+          .then(res => {
+            if (res.data.code === 0) {
+              _this.$message({
+                type: 'success',
+                message: res.data.message
+              })
+              _this.techDialog = false
+              _this.initData()
+            } else {
+              _this.$message({
+                type: 'warning',
+                message: '操作失败!'
+              })
+            }
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
+      deletedata(val) {
+        let _this = this
+        _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          })
+          .then(() => {
+            _this.$axios.delete('suppliercertsub/businessdelete/' + val.Id, {})
+              .then(function (response) {
+                if (response.data.code === 0) {
+                  _this.$message({
+                    type: 'success',
+                    message: response.data.message
+                  })
+                  _this.initData()
+                } else {
+                  _this.$message({
+                    type: 'warning',
+                    message: response.data.message
+                  })
+                }
+              })
+              .catch(function (error) {
+                console.log(error)
+              })
+          })
+          .catch(() => {})
+      },
+      showDialog() {
+        this.getorgtreelist()
+        this.techDialog = true
+      },
+      getorgtreelist() {
+        let _this = this
+        this.$axios.get('technologyservice/techbuslist', {})
+          .then(res => {
+            _this.orgtreelist = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Code,Name,CodeName')
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
+
+      handleSizeChange(value) {
+        this.size = value
+        this.currentPage = 1
+        this.initData()
+      },
+      handleCurrentChange(value) {
+        this.currentPage = value
+        this.initData()
+      },
+    }
+  }
+
+</script>
+
+<style>
+
+
+</style>

+ 0 - 2
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplier/_opera/goodsedit.vue

@@ -181,8 +181,6 @@
         <el-tab-pane label="准入范围" :disabled="!certId">
           <goods-list ref="goodsList" :data.sync="goodsList" @close="getbuslist" :canadd="add_flat" height="360px"
             style="margin-top: 20px"></goods-list>
-          <!-- <business-list ref="businessList" :data.sync="businessList" @close="getbuslist" :canadd="add_flat"
-            height="360px" style="margin-top: 20px"></business-list> -->
         </el-tab-pane>
         <el-tab-pane label="企业资质" :disabled="!certId">
           <subfile-list ref="subfileList" :data.sync="subfileList" :canadd="add_flat" @close="selectAuditOrg"

+ 6 - 7
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplier/_opera/techedit.vue

@@ -10,7 +10,6 @@
         <span>
           <i class="icon icon-table2"></i> 信息
         </span>
-
         <span style="float: right;">
           <el-button plain icon="el-icon-right" size="mini" style="margin-right: 5px" @click="nextTab">下一步</el-button>
           <el-popover>
@@ -192,8 +191,8 @@
           </el-card>
         </el-tab-pane>
         <el-tab-pane name="3" label="准入范围" :disabled="!certId">
-          <business-list ref="businessList" :data.sync="businessList" @close="getbuslist" :canadd="add_flat"
-            height="360px" style="margin-top: 20px"></business-list>
+          <tech-list ref="techList" :data.sync="techList" @close="getbuslist" :canadd="add_flat" height="360px"
+            style="margin-top: 20px"></tech-list>
         </el-tab-pane>
         <el-tab-pane name="4" label="企业资质" :disabled="!certId">
           <subfile-list ref="subfileList" :data.sync="subfileList" :canadd="add_flat" @close="selectAuditOrg"
@@ -274,7 +273,7 @@
   import PerformanceList from '@/components/oilsupplier/performancelist'
   import PatentList from '@/components/oilsupplier/patentlist'
   import WinningList from '@/components/oilsupplier/winninglist'
-  import BusinessList from '@/components/oilsupplier/businesslist'
+  import TechList from '@/components/oilsupplier/techlist'
   import SubfileList from '@/components/oilsupplier/subfilelist'
   import TechInfo from '@/components/oilsupplier/techinfo'
 
@@ -291,7 +290,7 @@
       PerformanceList, // 近三年主要工程业绩列表
       PatentList, // 拥有专利、专有技术及工法列表
       WinningList, // 近三年获得省部级及以上主要技术、管理成果、获奖项目列表
-      BusinessList, // 选择准入范围
+      TechList, // 选择准入范围
       SubfileList, // 选择企业资质
       TechInfo,
 
@@ -318,7 +317,7 @@
         performanceList: [], // 近三年主要工程业绩
         patentList: [], // 拥有专利、专有技术及工法
         winningList: [], // 近三年获得省部级及以上主要技术、管理成果、获奖项目
-        businessList: [], // 准入业务
+        techList: [], // 准入业务
         subfileList: [], // 资质
         organizeOption: [], // 审批部门
         auditerOption: [], // 审批人
@@ -616,7 +615,7 @@
             this.$refs['performanceList'].getvalue(this.formData.Id, this.formData.SupplierTypeCode, this.certId)
             this.$refs['patentList'].getvalue(this.formData.Id, this.formData.SupplierTypeCode, this.certId)
             this.$refs['winningList'].getvalue(this.formData.Id, this.formData.SupplierTypeCode, this.certId)
-            this.$refs['businessList'].getvalue(this.formData.Id, this.formData.SupplierTypeCode, this.certId)
+            this.$refs['techList'].getvalue(this.formData.Id, this.formData.SupplierTypeCode, this.certId)
             this.$refs['subfileList'].getvalue(this.formData.Id, this.formData.SupplierTypeCode, this.certId)
           }).catch(err => {
             console.error(err)