瀏覽代碼

准入的物资类的懒加载、文件管理的文档结构修改

ljm 6 年之前
父節點
當前提交
29ec35e48b

+ 3 - 4
src/dashoo.cn/backend/api/controllers/oilsupplier/goodsaptitude.go

@@ -1,10 +1,11 @@
 package oilsupplier
 
 import (
-	"dashoo.cn/backend/api/business/items"
 	"encoding/json"
 	"time"
 
+	"dashoo.cn/backend/api/business/items"
+
 	"dashoo.cn/backend/api/business/baseUser"
 	"dashoo.cn/backend/api/business/oilsupplier/goodsaptitude"
 	. "dashoo.cn/backend/api/controllers"
@@ -64,8 +65,6 @@ func (this *OilGoodsAptitudeController) GetDictList() {
 
 	dictList["AuditStep"] = dictSvc.GetKeyValueItems("AuditStep", this.User.AccCode)
 
-
-
 	//var dictCustomer []svccustomer.Customer
 	//customerSvc.GetEntitysByWhere("" + CustomerName, "", &dictCustomer)
 	//dictList["EntrustCorp"] = &dictCustomer
@@ -333,7 +332,7 @@ func (this *OilGoodsAptitudeController) DeleteEntity() {
 // @router /goodsparentlist [get]
 func (this *OilGoodsAptitudeController) GoodsParentList() {
 	svc := goodsaptitude.GetOilGoodsAptitudeService(utils.DBE)
-	where := " ParentId = 0 "
+	where := " ParentId = 0 and DeletionStateCode = 0 "
 	var list []goodsaptitude.GoodsBusiness
 	svc.GetEntitysByWhere(OilGoodsAptitudeClassName, where, &list)
 	var datainfo DataInfo

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

@@ -286,7 +286,7 @@ func (this *OilGoodsAptitudeClassController) DeleteEntity() {
 	}
 }
 
-// @Title get 获取物资类资质分类层级表
+// @Title get 获取物资类资质分类第一级分类
 // @Description get SampleType by token
 // @Success 200 {object} sampletype.SampleType
 // @router /getgoodsclasslist/:id [get]

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

@@ -1,15 +1,16 @@
 package oilsupplier
 
 import (
+	"encoding/json"
+	"strconv"
+	"strings"
+	"time"
+
 	"dashoo.cn/backend/api/business/auditsetting"
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
 	"dashoo.cn/backend/api/business/workflow"
 	"dashoo.cn/business2/permission"
 	"dashoo.cn/business2/userRole"
-	"encoding/json"
-	"strconv"
-	"strings"
-	"time"
 
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercertappendsub"
@@ -64,7 +65,7 @@ func (this *OilSupplierCertAppendController) GetList() {
 	}
 
 	if AppendType != "" {
-		where = where + " and AppendType like '" + AppendType + "'"
+		where = where + " and AppendType like '%" + AppendType + "%'"
 	}
 
 	if DenyReason != "" {
@@ -391,7 +392,6 @@ func (this *OilSupplierCertAppendController) GetMyTaskEntityList() {
 	this.ServeJSON()
 }
 
-
 // @Title 提交审批
 // @Description 提交审批
 // @Success	200	{object} controllers.Request
@@ -598,4 +598,4 @@ func (this *OilSupplierCertAppendController) AuditEntityFir() {
 			return
 		}
 	}
-}
+}

+ 116 - 18
src/dashoo.cn/frontend_web/src/components/oilsupplier/businesslist.vue

@@ -41,15 +41,17 @@
     </el-card>
 
     <el-dialog :title="Title" :visible.sync="visible" top="5vh">
-      <el-form :model="BusinessForm" label-width="100px">
+      <el-form ref="BusinessForm" :rules="formRules" :model="BusinessForm" label-width="100px">
         <el-row>
           <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%"
+            <el-form-item label="名称" prop="checkName">
+              <!-- <el-select filterable default-first-option v-model="OneCode" placeholder="请选择" style="width: 100%"
                 @change="getChild()">
-                <el-option v-for="item in oneList" :key="item.Id" :label="item.Name" :value="item.Id">
-                </el-option>
-              </el-select>
+                <el-option v-for="item in oneList" :key="item.Id" :label="item.Name" :value="item.Id"></el-option>
+              </el-select> -->
+              <el-cascader ref="cascader" :options="optionsList" style="width:100%" :props="goodsProps" :show-all-levels="false" 
+                v-model="selectedOptList" @active-item-change="getChildrens" @change="getGoodsCode" placeholder="请选择分类">
+              </el-cascader>
             </el-form-item>
           </el-col>
           <el-col :span="12" v-if="SupplierTypeCode == '02' && Title == '新增准入范围'">
@@ -60,7 +62,7 @@
               </el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="12" v-if="SupplierTypeCode != '02' && Title == '新增准入范围'">
+          <el-col :span="12" v-if="SupplierTypeCode == '03' && 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>
@@ -158,6 +160,13 @@
       })
     },
     data () {
+      var CheckSelectedOption = (rule, value, callback) => {
+        if (this.selectedOptList && this.selectedOptList.length < 1) {
+          callback(new Error('请选择分类'))
+        } else {
+          callback()
+        }
+      };
       return {
         oneList: [],
         OneCode: '',
@@ -195,10 +204,83 @@
         Size: 10,
         CurrentItemCount: 0,
 
-        subfileList: [] // 文档
+        subfileList: [], // 文档
+        //物资类懒加载
+        optionsList: [], //物资类层级列表
+        selectedOptList: [], //已选择的物资类列表
+        goodsProps: {
+          value: 'id',
+          label: 'Name',
+          children: 'children'
+        },
+        //物资类表单规则
+        formRules: {
+          checkName: [{
+            required: true,
+            validator: CheckSelectedOption,
+            trigger: 'blur'
+          }],
+        },
+        // ParentId: 0, //物资类初始父类Id值:0
+        flagId: 0 //标记是否第一次点击
       }
     },
     methods: {
+
+      //获取下一级所有分类
+      getChildrens(val) {
+        let _this = this
+        let Id = val[0]
+        if (Id != _this.flagId) { //判断是否是第一次,若不相等则为第一次
+          this.$axios.get('goodsaptitudeclass/getchildlist/' + Id, {})
+          .then(res => {
+            //获取下一级所有级联数据
+            if (res.data.items) {//判断是否有数据
+              let tempList = []
+              tempList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Name')
+              //添加到上一级对应的选项中
+              for (let i = 0; i < _this.optionsList.length; i++) {
+                if (_this.optionsList[i].id === Id) {
+                  _this.$set(_this.optionsList[i], 'children', tempList)
+                  break
+                }
+              }
+            } else {
+              //修改上一级的children属性
+              for (let i = 0; i < _this.optionsList.length; i++) {
+                if (_this.optionsList[i].id === Id) {
+                  _this.$set(_this.optionsList[i], 'children', '')
+                  break
+                }
+              }
+            }
+            //做标记
+            _this.flagId = Id
+          })
+          .catch(err => {
+            console.error(err)
+          })
+        }
+      },
+
+      //获取分类级联Id
+      getGoodsCode(item) {
+        this.getCodeById(item[item.length-1]) //根据分类Id获取Code
+      },
+
+      //根据分类Id获取Code
+      getCodeById(Id) {
+        let _this = this
+        this.$axios.get('goodsaptitudeclass/getcode/' + Id, {})
+          .then(res => {
+            _this.BusinessForm.SubClassId = Id
+            _this.BusinessForm.Code = res.data.items[0].Code
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
+
       getvalue (SupplierId, SupplierTypeCode, certId) {
         this.SupplierId = SupplierId
         this.SupplierTypeCode = SupplierTypeCode
@@ -235,10 +317,20 @@
       },
       addBusiness () {
         let _this = this
+        let arr = []
+        arr = _this.$refs['cascader'].currentLabels
+        _this.BusinessForm.Name = arr[arr.length - 1]
         _this.BusinessForm.SupplierId = parseInt(_this.BusinessForm.SupplierId)
         _this.BusinessForm.SupplierCertId = parseInt(_this.BusinessForm.SupplierCertId)
         _this.BusinessForm.SubClassId = parseInt(_this.BusinessForm.SubClassId)
-        _this.$axios.post('/suppliercertsub/addbusiness/', _this.BusinessForm)
+        //因为表单验证不能用,所以采用提示验证
+        if (_this.selectedOptList.length < 1) {
+          _this.$message({
+            type: 'warning',
+            message: '名称不能为空,请选择分类!'
+          })
+        } else {
+          _this.$axios.post('/suppliercertsub/addbusiness/', _this.BusinessForm)
           .then(res => {
             if (res.data.code === 0) {
               _this.$message({
@@ -258,6 +350,7 @@
           .catch(err => {
             console.error(err)
           })
+        }
       },
       editBusiness () {
         let _this = this
@@ -319,6 +412,7 @@
         this.keyword = ''
         this.seachdata()
         this.Title = '新增准入范围'
+        this.selectedOptList = [] //置空,防止先修改再添加时的已选分类信息保留
         this.BusinessForm.Id = ''
         this.BusinessForm.SupplierId = this.SupplierId
         this.BusinessForm.SupplierCertId = this.SupplierCertId
@@ -347,17 +441,21 @@
       },
       getbusiness () {
         let _this = this
-        if (_this.SupplierTypeCode === '01') { // 获取物资类业务列表
+        if (_this.SupplierTypeCode === '01') { // 获取物资类第一级分类
           this.$axios.get('goodsaptitude/goodsparentlist', {})
             .then(res => {
-              _this.oneList = res.data.items
-              if (_this.Title === '编辑准入范围') {
-                for (var i = 0; i < _this.oneList.length; i++) {
-                  if (_this.BusinessForm.Code === _this.oneList[i].Code) {
-                    _this.OneCode = _this.oneList[i].Id
-                  }
-                }
-              }
+              _this.optionsList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Name')
+              _this.optionsList.forEach((item,index)=>{
+                _this.$set(this.optionsList[index], 'children', [])
+              })
+              // _this.oneList = res.data.items
+              // if (_this.Title === '编辑准入范围') {
+              //   for (var i = 0; i < _this.oneList.length; i++) {
+              //     if (_this.BusinessForm.Code === _this.oneList[i].Code) {
+              //       _this.OneCode = _this.oneList[i].Id
+              //     }
+              //   }
+              // }
             })
             .catch(err => {
               console.error(err)

+ 4 - 4
src/dashoo.cn/frontend_web/src/pages/documentmanage/_opera/edit.vue

@@ -19,22 +19,22 @@
       </div>
       <el-form :model="uploadform" :rules="rules" ref="uploadform" label-width="110px">
         <div class="el-row">
-          <el-col :span="12">
+          <!-- <el-col :span="12">
             <el-form-item label="文档结构" prop="JLDirectoryIds">
               <el-cascader :options="orgtreelist" style="width:100%" :props="orgtreeprops" change-on-select :show-all-levels="false" v-model="JLDirectoryIds"
                 placeholder="请选择文档结构"></el-cascader>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="12">
             <el-form-item label="名称" prop="Name">
               <el-input v-model="uploadform.Name" placeholder="请输入名称" ></el-input>
             </el-form-item>
           </el-col>
-         <el-col :span="12">
+         <!-- <el-col :span="12">
             <el-form-item label="有效期至" prop="ValidityTime">
               <el-date-picker type="datetime" placeholder="请选择有效期" v-model="uploadform.ValidityTime" style="width: 100%;"></el-date-picker>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="12">
             <el-form-item label="版本信息" prop="VersionInfo">
               <el-input v-model="uploadform.VersionInfo" placeholder="请输入版本信息"></el-input>

+ 5 - 5
src/dashoo.cn/frontend_web/src/pages/documentmanage/add.vue

@@ -19,22 +19,22 @@
       </div>
       <el-form :model="uploadform" :rules="rules" ref="uploadform" label-width="110px">
         <div class="el-row">
-          <el-col :span="12">
+          <!-- <el-col :span="12">
             <el-form-item label="文档结构" prop="JLDirectoryId">
               <el-cascader :options="orgtreelist" style="width:100%" :props="orgtreeprops" change-on-select :show-all-levels="false" v-model="uploadform.JLDirectoryId"
                 placeholder="请选择文档结构"></el-cascader>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="12">
             <el-form-item label="文档名称" prop="Name">
               <el-input v-model="uploadform.Name" placeholder="请输入文档名称"></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+          <!-- <el-col :span="12">
             <el-form-item label="有效期至" prop="ValidityTime">
               <el-date-picker type="datetime" placeholder="请选择有效期" v-model="uploadform.ValidityTime" style="width: 100%;"></el-date-picker>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="12">
             <el-form-item label="版本信息" prop="VersionInfo">
               <el-input v-model="uploadform.VersionInfo" placeholder="请输入版本信息"></el-input>
@@ -155,7 +155,7 @@
           Remark: '',
           ValidityTime: '2122-01-01T10:00:00+08:00', //默认有效期至2122年1月1日
           // typeList: [], //文档类别列表
-          JLDirectoryId: []
+          JLDirectoryId: [322,323] //默认基础文档
         },
         rules: {
           JLDirectoryId: [{

+ 3 - 3
src/dashoo.cn/frontend_web/src/pages/documentmanage/files.vue

@@ -14,12 +14,12 @@
         </span>
       </div>
       <el-row :gutter="20">
-        <el-col :span="4">
+        <!-- <el-col :span="4">
           <el-tree highlight-current :expand-on-click-node="true" node-key="id" :data="orgtreelist" :props="orgtreeprops" :default-expanded-keys="userdepartment"
             @node-click="orgtreeNodeClick" ref="orgmanagetree">
           </el-tree>
-        </el-col>
-        <el-col :span="20">
+        </el-col> -->
+        <el-col :span="24">
           <el-collapse>
             <el-collapse-item title="文件查询">
               <el-form ref="form" :model="searchForm" label-width="120px">

+ 3 - 3
src/dashoo.cn/frontend_web/src/pages/documentmanage/notice.vue

@@ -14,12 +14,12 @@
         </span>
       </div>
       <el-row :gutter="20">
-        <el-col :span="4">
+        <!-- <el-col :span="4">
           <el-tree highlight-current :expand-on-click-node="true" node-key="id" :data="orgtreelist" :props="orgtreeprops" :default-expanded-keys="userdepartment"
             @node-click="orgtreeNodeClick" ref="orgmanagetree">
           </el-tree>
-        </el-col>
-        <el-col :span="20">
+        </el-col> -->
+        <el-col :span="24">
           <el-collapse>
             <el-collapse-item title="通知查询">
               <el-form ref="form" :model="searchForm" label-width="120px">

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

@@ -310,7 +310,7 @@
           })
       },
 
-      //获取物资类层级列表
+      //获取物资类第一级分类
       getGoodsTreeList(Id) {
         let _this = this
         this.$axios.get('goodsaptitudeclass/getgoodsclasslist/' + Id, {})
@@ -325,7 +325,7 @@
           })
       },
 
-      //获取下一级分类
+      //获取下一级所有分类
       getChildrens(val) {
         let _this = this
         let Id = val[0]