|
|
@@ -0,0 +1,740 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-card class="box-card" style="margin-top: 10px;">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span style="font-weight: bold"> 企业资质</span>
|
|
|
+ <el-button type="primary" size="mini" style="float: right;margin-right: 3px" @click="nextStep()"
|
|
|
+ v-if="canadd && IsCompanyUser == 0">
|
|
|
+ 提交审批
|
|
|
+ </el-button>
|
|
|
+ <el-button style="float: right; padding: 6px 25px" type="text" @click="showDialog" v-if="canadd || newcanadd">添加</el-button>
|
|
|
+ </div>
|
|
|
+ <el-table :data="subfileList" border size="mini">
|
|
|
+ <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="!canadd && !newcanadd">上传
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" plain size="mini" title="删除" style="margin-left:3px"
|
|
|
+ :disabled="(scope.row.FileType == '1' || !canadd) && !newcanadd" @click="deletedata(scope.row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="NeedFileType" label="资质名称" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column label="贸易/制造" v-if="SupplierTypeCode == '01'" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.IsManuf=='1'">制造商</span>
|
|
|
+ <span v-else-if="scope.row.IsManuf=='2'">贸易商</span>
|
|
|
+ <span v-else>通用</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="FileUrlList" label="资质文件" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div v-for="(tmpUrl, index) in scope.row.FileUrlList">
|
|
|
+ <el-link :href="'http://'+fileurlcut(scope.row.FileUrl, index)" target="_blank" type="primary">
|
|
|
+ {{scope.row.FileName.split('$')[index]}}</el-link>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="EffectDate" label="有效日期" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ jstimehandle(scope.row.EffectDate+'') }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="OtherRemark" label="描述" show-overflow-tooltip></el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-card>
|
|
|
+
|
|
|
+ <el-dialog :title="Title" :visible.sync="visible" top="5vh" width="900px">
|
|
|
+ <el-form ref="subfileForm" :model="SubfileForm" :rules="rules" label-width="100px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="资质名称" prop="NeedFileType">
|
|
|
+ <!-- <el-input v-model="SubfileForm.NeedFileType" placeholder="请输文件类型"></el-input> -->
|
|
|
+ <el-select v-model="SubfileForm.NeedFileType" placeholder="请输文件类型" size="medium" :disabled="IsMust">
|
|
|
+ <el-option v-for="item in dynamicTableColumns" :key="item.prop" :label="item.label" :value="item.label">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="有效日期" prop="EffectDate">
|
|
|
+ <el-date-picker style="width: 100%" v-model="SubfileForm.EffectDate" type="date" placeholder="请选择有效日期" @change="pickerchange">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="描述">
|
|
|
+ <el-input v-model="SubfileForm.OtherRemark" type="textarea" :rows=3 placeholder="请输入备注信息"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="资质文件">
|
|
|
+ <el-upload multiple style="margin-top: 10px;" action="" ref="refuploadattach"
|
|
|
+ :on-remove="filremove" :http-request="uploadrequest" class="attach-uploader" :before-upload="beforeAvatarUpload" :file-list="fileList">
|
|
|
+ <i class="el-icon-plus attach-uploader-icon"></i>
|
|
|
+ <div slot="tip" class="el-upload__tip" v-if="SubfileForm.NeedFileType !=yasuoname">请上传图片(大小为512KB-5MB),可上传多张图片
|
|
|
+ </div>
|
|
|
+ <div slot="tip" class="el-upload__tip" v-if="SubfileForm.NeedFileType ==yasuoname">请上传压缩文件
|
|
|
+ </div>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer" style="margin-top:-30px;">
|
|
|
+ <el-button @click="visible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="makesure()">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ mapGetters
|
|
|
+ } from 'vuex'
|
|
|
+ import axios from 'axios'
|
|
|
+ import uploadajax from '../../assets/js/uploadajax.js'
|
|
|
+ import BusinessList from '../../components/oilsupplier/businesslist'
|
|
|
+ import setapi from '@/api/oilsupplier/oilclassorgset'
|
|
|
+ import api from '@/api/oilsupplier/supplierfile'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: 'SubfileList',
|
|
|
+ components: {
|
|
|
+ BusinessList // 准入范围
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ canadd: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ newcanadd: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ flag: {
|
|
|
+ type: String
|
|
|
+ },
|
|
|
+ Grade: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ InStyle: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ OperType: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ isInvestigate: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ session: 'session',
|
|
|
+ authUser: 'authUser'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ var effectDate = (rule, value, callback) => {
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error('请选择有效日期'))
|
|
|
+ } else {
|
|
|
+ let date = new Date()
|
|
|
+ let nowdata = new Date(date.getFullYear(), date.getMonth(), date.getDate())
|
|
|
+ if (value < nowdata) {
|
|
|
+ callback(new Error('有效日期不能小于当前日期'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ size: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ currentItem_Count: 0,
|
|
|
+ yasuoname: '',
|
|
|
+ SupplierId: 0,
|
|
|
+ SupplierTypeCode: '',
|
|
|
+ SubClassIds: [],
|
|
|
+ SupplierCertId: 0,
|
|
|
+ IsMust: false,
|
|
|
+ businessList: [],
|
|
|
+ subfileList: [],
|
|
|
+ techList: [],
|
|
|
+ techTreeList: [],
|
|
|
+ fileList: [],
|
|
|
+ orgtreeprops: {
|
|
|
+ value: 'id',
|
|
|
+ label: 'Name',
|
|
|
+ children: 'children'
|
|
|
+ },
|
|
|
+ selectedorg: [],
|
|
|
+
|
|
|
+ Title: '',
|
|
|
+ SubfileForm: {
|
|
|
+ Id: '',
|
|
|
+ SupplierId: '',
|
|
|
+ SupplierTypeCode: '',
|
|
|
+ SupplierCertSubId: '',
|
|
|
+ CertSubName: '',
|
|
|
+ NeedFileType: '',
|
|
|
+ NeedFileCode: '',
|
|
|
+ FileType: '',
|
|
|
+ FileExt: '',
|
|
|
+ FileName: '',
|
|
|
+ EffectDate: new Date(),
|
|
|
+ FileUrl: '',
|
|
|
+ OtherRemark: '',
|
|
|
+ Remark: '',
|
|
|
+ IsDelete: 0,
|
|
|
+ FileUrlList: []
|
|
|
+ },
|
|
|
+ scenefile: {
|
|
|
+ Id: '',
|
|
|
+ SupplierId: '',
|
|
|
+ NeedFileType: '',
|
|
|
+ NeedFileCode: '',
|
|
|
+ FileUrl: '',
|
|
|
+ FileName: '',
|
|
|
+ FileExt: ''
|
|
|
+ },
|
|
|
+ visible: false,
|
|
|
+ selfVisible: this.visible, // 避免vue双向绑定警告
|
|
|
+
|
|
|
+ waituploads: [], // 等待上传的附件列表
|
|
|
+ doclist: [],
|
|
|
+ dynamicTableColumns: [],
|
|
|
+ IsCompanyUser: '',
|
|
|
+ rules: {
|
|
|
+ NeedFileType: [
|
|
|
+ {required: true, message: '资质名称不能为空', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ EffectDate:
|
|
|
+ [{ required: true, validator: effectDate, trigger: 'change' }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.getDictOptions()
|
|
|
+ this.initTableHeader()
|
|
|
+ this.IsCompanyUser = this.authUser.Profile.IsCompanyUser
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ pickerchange () {
|
|
|
+ console.log(this.SubfileForm.EffectDate)
|
|
|
+ },
|
|
|
+ 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++) {
|
|
|
+ this.SubClassIds.push(val[i].SubClassId)
|
|
|
+ }
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ initTableHeader () {
|
|
|
+ if (this.flag == '01') {
|
|
|
+ setapi.initGoodTableHeader(this.$axios).then(res => {
|
|
|
+ this.dynamicTableColumns = res.data.items
|
|
|
+ })
|
|
|
+ } else if (this.flag == '02') {
|
|
|
+ setapi.initBbTableHeader(this.$axios).then(res => {
|
|
|
+ this.dynamicTableColumns = res.data.items
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ setapi.initTsTableHeader(this.$axios).then(res => {
|
|
|
+ this.dynamicTableColumns = res.data.items
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getvalue (SupplierId, SupplierTypeCode, certId, inStyle) {
|
|
|
+ this.SupplierId = SupplierId
|
|
|
+ this.SupplierTypeCode = SupplierTypeCode
|
|
|
+ this.SupplierCertId = certId
|
|
|
+ this.InStyle = inStyle
|
|
|
+ this.initData()
|
|
|
+ this.getbusList()
|
|
|
+ },
|
|
|
+ initData () {
|
|
|
+ let _this = this
|
|
|
+ const params = {
|
|
|
+ InStyle: this.InStyle,
|
|
|
+ SupplierId: this.SupplierId,
|
|
|
+ SupplierTypeCode: this.SupplierTypeCode,
|
|
|
+ SubClassIds: this.SubClassIds.join(),
|
|
|
+ _currentPage: 1,
|
|
|
+ _size: 10000
|
|
|
+ }
|
|
|
+ _this.$axios.get('supplierfile/filelist', {
|
|
|
+ params
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ _this.subfileList = res.data.items
|
|
|
+ _this.currentItemCount = res.data.currentItemCount
|
|
|
+ for (let idx in _this.subfileList) {
|
|
|
+ _this.subfileList[idx].FileUrlList = _this.subfileList[idx].FileUrl.split('$')
|
|
|
+ }
|
|
|
+ this.getSupplierSceneFile()
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getbusList () {
|
|
|
+ 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.businessList = res.data.items
|
|
|
+ _this.currentItem_Count = res.data.currentItemCount
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ makesure () {
|
|
|
+ let _this = this
|
|
|
+ _this.$refs['subfileForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (_this.Title == '新增文件') {
|
|
|
+ if (_this.$refs.refuploadattach.uploadFiles && _this.$refs.refuploadattach.uploadFiles.length > 0) {
|
|
|
+ // 上传附件是否完成判断
|
|
|
+ if (!_this.attachissuccess()) {
|
|
|
+ _this.$message.error('有附件未成功上传!不能保存数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ _this.getattachissuccess()
|
|
|
+ _this.addSubfile()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请上传文件!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else if (_this.Title == '上传文件') {
|
|
|
+ if (_this.$refs.refuploadattach.uploadFiles && _this.$refs.refuploadattach.uploadFiles.length > 0) {
|
|
|
+ // 上传附件是否完成判断
|
|
|
+ if (!_this.attachissuccess()) {
|
|
|
+ _this.$message.error('有附件未成功上传!不能保存数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ _this.getattachissuccess()
|
|
|
+ _this.editSubfile()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请上传文件!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addSubfile () {
|
|
|
+ let _this = this
|
|
|
+ _this.SubfileForm.SupplierId = parseInt(_this.SubfileForm.SupplierId)
|
|
|
+ _this.SubfileForm.SupplierCertSubId = parseInt(_this.SubfileForm.SupplierCertSubId)
|
|
|
+ _this.$axios.post('/supplierfile/addsubfile/', _this.SubfileForm)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ this.visible = false
|
|
|
+ this.initData()
|
|
|
+ this.$refs.refuploadattach.uploadFiles = []
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ editSubfile () {
|
|
|
+ let _this = this
|
|
|
+ _this.SubfileForm.SupplierId = parseInt(_this.SubfileForm.SupplierId)
|
|
|
+ _this.SubfileForm.SupplierCertSubId = parseInt(_this.SubfileForm.SupplierCertSubId)
|
|
|
+ _this.$axios.put('/supplierfile/editsubfile/' + _this.SubfileForm.Id, _this.SubfileForm)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ this.visible = false
|
|
|
+ this.initData()
|
|
|
+ this.$refs.refuploadattach.uploadFiles = []
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ deletedata (val) {
|
|
|
+ let _this = this
|
|
|
+ _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ _this.$axios.delete('supplierfile/subfiledelete/' + 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(() => {})
|
|
|
+ },
|
|
|
+ nextStep () {
|
|
|
+ if (this.businessList && this.businessList.length > 0) {
|
|
|
+ if (this.Grade === '2') {
|
|
|
+ for (let idx in this.businessList) {
|
|
|
+ if (this.businessList[idx].GoodsLevel === '1') {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '二级供应商不能准入一级物资!'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ((this.isInvestigate) && (this.InStyle != '2')) {
|
|
|
+ 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 === '') {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请上传文件' + this.subfileList[i].NeedFileType + '!'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$emit('close')
|
|
|
+ } else {
|
|
|
+ this.$emit('close')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请选择准入范围!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getDictOptions () {
|
|
|
+ api.getDictList(this.$axios).then(res => {
|
|
|
+ this.yasuoname = res.data.items['YaSuoName']
|
|
|
+ }).catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showDialog () {
|
|
|
+ // this.doclist = []
|
|
|
+ this.IsMust = false
|
|
|
+ this.Title = '新增文件'
|
|
|
+ this.SubfileForm.Id = ''
|
|
|
+ this.SubfileForm.SupplierId = this.SupplierId
|
|
|
+ this.SubfileForm.SupplierTypeCode = this.SupplierTypeCode
|
|
|
+ this.SubfileForm.SupplierCertSubId = ''
|
|
|
+ this.SubfileForm.CertSubName = ''
|
|
|
+ this.SubfileForm.NeedFileType = ''
|
|
|
+ this.SubfileForm.NeedFileCode = ''
|
|
|
+ this.SubfileForm.FileExt = ''
|
|
|
+ this.SubfileForm.FileType = ''
|
|
|
+ this.SubfileForm.FileName = ''
|
|
|
+ this.SubfileForm.EffectDate = null
|
|
|
+ this.SubfileForm.FileUrl = ''
|
|
|
+ this.SubfileForm.OtherRemark = ''
|
|
|
+ this.SubfileForm.Remark = ''
|
|
|
+ this.SubfileForm.IsDelete = 0
|
|
|
+ this.visible = true
|
|
|
+ },
|
|
|
+ openDialog (val) {
|
|
|
+ this.IsMust = true
|
|
|
+ this.Title = '上传文件'
|
|
|
+ this.SubfileForm.Id = val.Id
|
|
|
+ this.SubfileForm.SupplierId = val.SupplierId
|
|
|
+ this.SubfileForm.SupplierTypeCode = val.SupplierTypeCode
|
|
|
+ if (val.SupplierCertSubId == 0) {
|
|
|
+ this.SubfileForm.SupplierCertSubId = ''
|
|
|
+ } else {
|
|
|
+ this.SubfileForm.SupplierCertSubId = val.SupplierCertSubId
|
|
|
+ }
|
|
|
+ this.SubfileForm.CertSubName = val.CertSubName
|
|
|
+ this.SubfileForm.NeedFileType = val.NeedFileType
|
|
|
+ this.SubfileForm.NeedFileCode = val.NeedFileCode
|
|
|
+ this.SubfileForm.FileExt = val.FileExt
|
|
|
+ this.SubfileForm.FileType = val.FileType
|
|
|
+ this.SubfileForm.FileName = val.FileName
|
|
|
+ this.SubfileForm.EffectDate = (this.jsEffectDate(val.EffectDate))
|
|
|
+ this.SubfileForm.FileUrl = val.FileUrl
|
|
|
+ this.fileList = []
|
|
|
+ if (val.FileUrl !== '') {
|
|
|
+ this.getwendanginfo(val.FileUrl)
|
|
|
+ }
|
|
|
+ this.SubfileForm.OtherRemark = val.OtherRemark
|
|
|
+ this.SubfileForm.Remark = val.Remark
|
|
|
+ this.SubfileForm.IsDelete = val.IsDelete
|
|
|
+ this.visible = true
|
|
|
+ },
|
|
|
+ // 文档列表
|
|
|
+ getwendanginfo (iUrl) {
|
|
|
+ let _this = this
|
|
|
+ _this.doclist = []
|
|
|
+ let urlArr = iUrl.split('$')
|
|
|
+ for (let idx in urlArr) {
|
|
|
+ let exArr = urlArr[idx].split('|')
|
|
|
+ let params = {
|
|
|
+ name: exArr[1],
|
|
|
+ url: exArr[0]
|
|
|
+ }
|
|
|
+ _this.doclist.push(params)
|
|
|
+ _this.fileList.push(params)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ filremove (file, files) {
|
|
|
+ this.fileList = files
|
|
|
+ },
|
|
|
+ beforeAvatarUpload (file) {
|
|
|
+ console.log(file, '=====')
|
|
|
+ let isLt512K = file.size / 1024 < 512
|
|
|
+ if (isLt512K) {
|
|
|
+ this.$message.error('上传文件大小不能小于 512KB!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.SubfileForm.NeedFileType != this.yasuoname) {
|
|
|
+ if (file.type.indexOf('image') < 0) {
|
|
|
+ this.$message.error('上传图片!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let isLt50m = file.size / 1024 / 1024 / 5 < 1
|
|
|
+ if (!isLt50m) {
|
|
|
+ this.$message.error('上传文件大小不能超过 5MB!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ } else {
|
|
|
+ if (file.name.indexOf('.rar') < 0 && file.name.indexOf('.zip') < 0) {
|
|
|
+ this.$message.error('文件格式必须为rar或zip')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uploadrequest (option) {
|
|
|
+ let _this = this
|
|
|
+ if (process.client) {
|
|
|
+ const myDomain = window.location.host
|
|
|
+ axios.post(process.env.upfilehost, {})
|
|
|
+ .then(function (res) {
|
|
|
+ if (res.data && res.data.fid && res.data.fid !== '') {
|
|
|
+ if (res.data.publicUrl.indexOf('/upfile') === 0) {
|
|
|
+ option.action = `http://${myDomain}/${res.data.publicUrl}/${res.data.fid}`
|
|
|
+ } else {
|
|
|
+ option.action = `http://${res.data.publicUrl}/${res.data.fid}`
|
|
|
+ }
|
|
|
+ _this.waituploads.push({
|
|
|
+ uid: option.file.uid,
|
|
|
+ url: res.data.publicUrl,
|
|
|
+ fid: res.data.fid
|
|
|
+ })
|
|
|
+ uploadajax(option)
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '未上传成功!请刷新界面重新上传!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(function (error) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '未上传成功!请重新上传!'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 判断附件是否上传成功
|
|
|
+ attachissuccess () {
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
|
|
|
+ for (let i = 0; i < this.$refs.refuploadattach.uploadFiles.length; i++) {
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles[i].status !== 'success') {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ getattachissuccess () {
|
|
|
+ this.SubfileForm.FileUrl = ''
|
|
|
+ this.SubfileForm.FileName = ''
|
|
|
+ if (this.fileList != null && this.fileList.length > 0) {
|
|
|
+ for (let idx in this.fileList) {
|
|
|
+ this.SubfileForm.FileName += this.fileList[idx].name + '$'
|
|
|
+ this.SubfileForm.FileUrl += this.fileList[idx].url + '|' + this.fileList[idx].name + '$'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
|
|
|
+ for (let i = 0; i < this.$refs.refuploadattach.uploadFiles.length; i++) {
|
|
|
+ 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}$`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ clickachment (url, uid) {
|
|
|
+ window.open(`http://${url}`)
|
|
|
+ },
|
|
|
+ deletefile () {
|
|
|
+ let _this = this
|
|
|
+ _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ _this.doclist = []
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+
|
|
|
+ seachdata () {
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ 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
|
|
|
+ },
|
|
|
+ jstimehandle (val) {
|
|
|
+ if (val === '') {
|
|
|
+ return '----'
|
|
|
+ } else if (val === '0001-01-01T00:00:00Z') {
|
|
|
+ return '----'
|
|
|
+ } else if (val === '0001-01-01T08:00:00+08:00') {
|
|
|
+ return '----'
|
|
|
+ } else if (val === '5000-01-01T23:59:59+08:00') {
|
|
|
+ return '永久'
|
|
|
+ } else {
|
|
|
+ val = val.replace('T', ' ')
|
|
|
+ return val.substring(0, 10)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ jsEffectDate (val) {
|
|
|
+ if (val === '') {
|
|
|
+ return ''
|
|
|
+ } else if (val === '0001-01-01T00:00:00Z') {
|
|
|
+ return ''
|
|
|
+ } else if (val === '0001-01-01T08:00:00+08:00') {
|
|
|
+ return ''
|
|
|
+ } else if (val === '5000-01-01T23:59:59+08:00') {
|
|
|
+ return ''
|
|
|
+ } else {
|
|
|
+ return val
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleCurrentChange (value) {
|
|
|
+ this.currentPage = value
|
|
|
+ this.getbusList()
|
|
|
+ },
|
|
|
+ handleSizeChange (value) {
|
|
|
+ this.size = value
|
|
|
+ this.currentPage = 1
|
|
|
+ this.getbusList()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang='scss'>
|
|
|
+ .attach-uploader .el-upload {
|
|
|
+ border: 1px dashed #63B8FF;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ // margin-bottom: -17px;
|
|
|
+ margin-top: -15px;
|
|
|
+ margin-left: 20px
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader .el-upload:hover {
|
|
|
+ border-color: #228B22;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader-icon {
|
|
|
+ font-size: 25px;
|
|
|
+ color: #63B8FF;
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader-icon:hover {
|
|
|
+ color: #228B22;
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|