2
3
lining 6 سال پیش
والد
کامیت
0bf59c8a9f

+ 1 - 0
src/dashoo.cn/backend/api/controllers/base.go

@@ -276,6 +276,7 @@ var (
 	Tmp_OilGoodsAptitudeName                 string = "tmp_OilGoodsAptitude"
 	Tmp_OilGoodsAptitudeClassName            string = "tmp_OilGoodsAptitudeClass"
 	TmpOilSupplierCertSubName                string = "tmp_OilSupplierCertSub"
+	OilSupplierSceneFileName                 string = "OilSupplierSceneFile" // 现场考察报告
 )
 
 //分页信息及数据

+ 25 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -2159,6 +2159,9 @@ func (this *OilSupplierController) EditSubfile() {
 	model.CreateBy = this.User.Realname
 	model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 
+	where := "SupplierId=" + id
+	svc.DeleteEntityBytbl(OilSupplierSceneFileName, where)
+
 	_, err := svc.InsertEntity(&model)
 
 	if err == nil {
@@ -2253,3 +2256,25 @@ func (this *OilSupplierController) OperationCell(svc *supplier.OilSupplierServic
 		panic(err)
 	}
 }
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object} []supplier.OilSupplier
+// @router /getscenefilelist [get]
+func (this *OilSupplierController) GetSceneFileList() {
+	supplierId := this.GetString("SupplierId")
+
+	var model supplierscenefile.OilSupplierSceneFile
+
+	svc := supplierscenefile.GetSupplierScenefileService(utils.DBE)
+	where := "SupplierId=" + supplierId
+	svc.GetEntity(&model, where)
+
+	var errinfo ErrorDataInfo
+	errinfo.Item = model
+	errinfo.Code = 1
+	this.Data["json"] = &errinfo
+	this.ServeJSON()
+
+
+}

+ 68 - 22
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodsinfo.vue

@@ -693,24 +693,27 @@
         </el-col>
       </el-row>
     </el-form>
-    <el-form :model="SubfileForm" label-width="100px">
-      <el-row>
-        <el-col :span="12">
-          <el-form-item label="现场考察报告">
-            <el-button type="primary" plain size="mini" title="上传" @click="openDialog()" >上传
-            </el-button>
-            <!--<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>-->
-            <!--&lt;!&ndash;<div slot="tip" class="el-upload__tip" v-if="SubfileForm.NeedFileType !=yasuoname">请上传图片(大小为512KB-5MB),可上传多张图片&ndash;&gt;-->
-            <!--&lt;!&ndash;</div>&ndash;&gt;-->
-            <!--&lt;!&ndash;<div slot="tip" class="el-upload__tip" v-if="SubfileForm.NeedFileType ==yasuoname">请上传压缩文件&ndash;&gt;-->
-            <!--&lt;!&ndash;</div>&ndash;&gt;-->
-            <!--</el-upload>-->
-          </el-form-item>
-        </el-col>
-      </el-row>
-    </el-form>
+    <el-row v-if="formData.OperType == '制造商' && formData.Grade == '2'" >
+      <el-col :span="4">
+          <span>现场考察报告</span>
+          <el-button type="primary" style="margin-left: 10px;" plain size="mini" title="上传" @click="openDialog()" :disabled="formData.Status > '0'" >上传
+          </el-button>
+          <!--<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>-->
+          <!--&lt;!&ndash;<div slot="tip" class="el-upload__tip" v-if="SubfileForm.NeedFileType !=yasuoname">请上传图片(大小为512KB-5MB),可上传多张图片&ndash;&gt;-->
+          <!--&lt;!&ndash;</div>&ndash;&gt;-->
+          <!--&lt;!&ndash;<div slot="tip" class="el-upload__tip" v-if="SubfileForm.NeedFileType ==yasuoname">请上传压缩文件&ndash;&gt;-->
+          <!--&lt;!&ndash;</div>&ndash;&gt;-->
+          <!--</el-upload>-->
+      </el-col>
+      <el-col :span="4">
+        <div v-for="(tmpUrl, index) in scenefileurllist">
+          <el-link :href="'http://'+fileurlcut(scenefile.FileUrl, index)" target="_blank" type="primary">
+            {{scenefile.FileName.split('$')[index]}}</el-link>
+        </div>
+      </el-col>
+    </el-row>
     <!--打印内容结束-->
     <!--endprint1-->
     <el-dialog title="现场考察报告" :visible.sync="visible" top="5vh" width="900px">
@@ -917,6 +920,11 @@ export default {
       countryoptions: [],
       countryListOptions: [],
       waituploads: [], // 等待上传的附件列表
+      scenefileurllist: [],
+      scenefile: {
+        FileUrl: '',
+        FileName: ''
+      },
       countryprops: {
         value: 'adcode',
         label: 'name',
@@ -1081,16 +1089,42 @@ export default {
     //   this.inputCompanyName(this.authUser.Profile.Realname)
     // }
   },
+  mounted () {
+    // this.getSupplierSceneFile()
+  },
   watch: {
     dictData: {
       handler (newName, oldName) {
         this.getDictOptions()
       },
       immediate: true
+    },
+    formData: {
+      handler (newName, oldName) {
+        this.getSupplierSceneFile()
+      }
     }
   },
   methods: {
+    fileurlcut (val, index) {
+      let fileurlall = val.split('$')[index]
+      let fileurl = fileurlall.split('|')
+      let retUrl = fileurl[0]
+      // 内网服务器专用
+      if (process.client && retUrl.indexOf('/upfile') === 0) {
+        const myDomain = window.location.host
+        retUrl = myDomain + '/' + retUrl
+      }
+      return retUrl
+    },
     openDialog () {
+      if (this.formData.Id <= 0) {
+        this.$message({
+          type: 'warning',
+          message: '请先保存基本信息'
+        })
+        return
+      }
       this.visible = true
     },
 
@@ -1113,9 +1147,8 @@ export default {
     },
     editSubfile () {
       let _this = this
-      _this.SubfileForm.SupplierId = parseInt(_this.SubfileForm.SupplierId)
-      console.log(_this.SubfileForm, '_this.SubfileForms')
-      _this.$axios.put('/supplier/editsubfile/' + _this.SubfileForm.Id, _this.SubfileForm)
+      _this.SubfileForm.SupplierId = parseInt(_this.formData.Id)
+      _this.$axios.put('/supplier/editsubfile/' + this.SubfileForm.SupplierId, _this.SubfileForm)
         .then(res => {
           if (res.data.code === 0) {
             _this.$message({
@@ -1123,7 +1156,7 @@ export default {
               message: res.data.message
             })
             this.visible = false
-            this.initData()
+            this.$emit('initFDatas')
             this.$refs.refuploadattach.uploadFiles = []
           } else {
             _this.$message({
@@ -1136,6 +1169,19 @@ export default {
           console.error(err)
         })
     },
+    getSupplierSceneFile () {
+      if (this.formData.Id !== '') {
+        let params = {
+          SupplierId: this.formData.Id
+        }
+        this.$axios.get('/supplier/getscenefilelist', {params}).then(res => {
+          this.scenefile = res.data.item
+          if (this.scenefile && this.scenefile != null) {
+            this.scenefileurllist = this.scenefile.FileUrl.split('$')
+          }
+        })
+      }
+    },
     makesure () {
       if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
         // 上传附件是否完成判断

+ 31 - 0
src/dashoo.cn/frontend_web/src/components/oilsupplier/subfilelist.vue

@@ -188,6 +188,10 @@
       Grade: {
         type: String,
         default: ''
+      },
+      OperType: {
+        type: String,
+        default: ''
       }
     },
     computed: {
@@ -238,6 +242,15 @@
           IsDelete: 0,
           FileUrlList: []
         },
+        scenefile: {
+          Id: '',
+          SupplierId: '',
+          NeedFileType: '',
+          NeedFileCode: '',
+          FileUrl: '',
+          FileName: '',
+          FileExt: ''
+        },
         visible: false,
         selfVisible: this.visible, // 避免vue双向绑定警告
 
@@ -253,6 +266,14 @@
       this.IsCompanyUser = this.authUser.Profile.IsCompanyUser
     },
     methods: {
+      getSupplierSceneFile () {
+        let params = {
+          SupplierId: this.SupplierId
+        }
+        this.$axios.get('/supplier/getscenefilelist', {params}).then(res => {
+          this.scenefile = res.data.item
+        })
+      },
       handleSelectionChange (val) {
         this.SubClassIds = []
         for (var i = 0; i < val.length; i++) {
@@ -302,6 +323,7 @@
             for (let idx in _this.subfileList) {
               _this.subfileList[idx].FileUrlList = _this.subfileList[idx].FileUrl.split('$')
             }
+            this.getSupplierSceneFile()
           })
           .catch(err => {
             console.error(err)
@@ -451,6 +473,15 @@
               }
             }
           }
+          if (this.Grade === '2' && this.OperType === '制造商') {
+            if (this.scenefile.Id == '' || this.scenefile.Id == '0') {
+              this.$message({
+                type: 'warning',
+                message: '请上传现场考察报告!'
+              })
+              return
+            }
+          }
           if (this.subfileList && this.subfileList.length > 0) {
             for (var i = 0; i < this.subfileList.length; i++) {
               if (this.subfileList[i].FileType === 1 && this.subfileList[i].FileUrl === '') {

+ 3 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplier/_opera/goodsedit.vue

@@ -100,7 +100,8 @@
                         :authUser="authUser"
                         :canUpdateSupplier="canUpdateSupplier"
                         @selectcompany="changeFormData"
-                        @inputcompany="inputCompany">
+                        @inputcompany="inputCompany"
+                        @initFDatas="initDatas"  >
             </goods-info>
           </el-card>
         </el-tab-pane>
@@ -322,6 +323,7 @@
                         :canadd="add_flat"
                         :flag="flag"
                         :Grade="formData.Grade"
+                        :OperType="formData.OperType"
                         @close="selectAuditOrg"></subfile-list>
         </el-tab-pane>