|
@@ -15,7 +15,7 @@
|
|
|
<el-form-item label="客户名称" prop="workClientInfo.name" :rules="[
|
|
|
{required: true, message:'请输入客户名称', trigger:'blur'}
|
|
|
]">
|
|
|
- <el-input v-model="inputForm.workClientInfo.name" placeholder="请输入客户名称"></el-input>
|
|
|
+ <el-input @blur="isExistByName" v-model="inputForm.workClientInfo.name" placeholder="请输入客户名称"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="2">
|
|
@@ -88,7 +88,7 @@
|
|
|
:rules="[
|
|
|
{required: true, message:'请输入统一社会信用代码', trigger:'blur'}
|
|
|
]">
|
|
|
- <el-input v-model="inputForm.workClientInfo.uscCode" placeholder="请输入统一社会信用代码"></el-input>
|
|
|
+ <el-input @blur="isExistByUscCode" v-model="inputForm.workClientInfo.uscCode" placeholder="请输入统一社会信用代码"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
@@ -329,10 +329,13 @@
|
|
|
:on-remove="handleRemove"
|
|
|
:show-file-list="false"
|
|
|
:on-change="changes"
|
|
|
+ :on-progress="uploadVideoProcess"
|
|
|
:file-list="filesArra2">
|
|
|
<el-button type="info" size="mini" v-if="inputForm.permissionFlag&&showVi">点击上传</el-button>
|
|
|
</el-upload>
|
|
|
<div style="height: calc(100% - 80px);margin-top: 10px">
|
|
|
+ <!-- 进度条 -->
|
|
|
+ <el-progress style="margin-left: 5em" v-if="progressFlag" :percentage="loadProgress"></el-progress>
|
|
|
<vxe-table
|
|
|
style="margin-left: 5em"
|
|
|
border="inner"
|
|
@@ -376,7 +379,7 @@
|
|
|
zIndex="9999"/>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button size="small" @click="close(),closeXTable()" icon="el-icon-circle-close">关闭</el-button>
|
|
|
- <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
|
|
|
+ <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick :disabled="isSubmit">确定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -387,6 +390,8 @@
|
|
|
import SelectTree from '@/components/treeSelect/treeSelect.vue'
|
|
|
import OSSSerive, {
|
|
|
httpRequest,
|
|
|
+ toHref,
|
|
|
+ openWindowOnUrl,
|
|
|
handleRemove,
|
|
|
fileName
|
|
|
} from '@/api/sys/OSSService'
|
|
@@ -403,6 +408,7 @@
|
|
|
dataListNew: [],
|
|
|
title: '',
|
|
|
method: '',
|
|
|
+ isSubmit: false,
|
|
|
visible: false,
|
|
|
loading: false,
|
|
|
returnForm: {
|
|
@@ -508,7 +514,9 @@
|
|
|
src: '',
|
|
|
showVi: true,
|
|
|
onedit: false,
|
|
|
- type: ''
|
|
|
+ type: '',
|
|
|
+ loadProgress: 0, // 动态显示进度条
|
|
|
+ progressFlag: false // 关闭进度条
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
@@ -521,41 +529,49 @@
|
|
|
this.ossService = new OSSSerive()
|
|
|
this.workClientService = new WorkClientService()
|
|
|
},
|
|
|
+ mounted () {
|
|
|
+ window.onPreview = this.onPreview
|
|
|
+ },
|
|
|
methods: {
|
|
|
- async toHref (row) {
|
|
|
- const link = document.createElement('a')
|
|
|
- if (row.id === null || row.id === undefined || row.id === '') {
|
|
|
- await this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
|
|
|
- const url = data.data // 完整的url则直接使用
|
|
|
- // 这里是将url转成blob地址,
|
|
|
- fetch(url).then(res => res.blob()).then(blob => { // 将链接地址字符内容转变成blob地址
|
|
|
- link.href = URL.createObjectURL(blob)
|
|
|
- console.log(link.href)
|
|
|
- link.download = row.name || '' // 下载文件的名字
|
|
|
- // a.download = url.split('/')[url.split('/').length -1] // // 下载文件的名字
|
|
|
- document.body.appendChild(link)
|
|
|
- link.click()
|
|
|
- // 在资源下载完成后 清除 占用的缓存资源
|
|
|
- window.URL.revokeObjectURL(link.href)
|
|
|
- document.body.removeChild(link)
|
|
|
- })
|
|
|
+ uploadVideoProcess (event, file, fileList) {
|
|
|
+ this.progressFlag = true // 显示进度条
|
|
|
+ this.loadProgress = parseInt(event.percent) // 动态获取文件上传进度
|
|
|
+ if (this.loadProgress >= 100) {
|
|
|
+ this.loadProgress = 100
|
|
|
+ setTimeout(() => { this.progressFlag = false }, 1000) // 一秒后关闭进度条
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isExistByName () {
|
|
|
+ let value = this.inputForm.workClientInfo.name
|
|
|
+ if (value !== null && value !== undefined && value !== '') {
|
|
|
+ this.workClientService.isExist(value).then((data) => {
|
|
|
+ console.log('data', data.data)
|
|
|
+ if (data.data !== 0) {
|
|
|
+ this.$message.error('该客户名称已存在')
|
|
|
+ this.isSubmit = true
|
|
|
+ } else {
|
|
|
+ this.isSubmit = false
|
|
|
+ }
|
|
|
})
|
|
|
- } else {
|
|
|
- const url = row.temporaryUrl // 完整的url则直接使用
|
|
|
- // 这里是将url转成blob地址,
|
|
|
- fetch(url).then(res => res.blob()).then(blob => { // 将链接地址字符内容转变成blob地址
|
|
|
- link.href = URL.createObjectURL(blob)
|
|
|
- console.log(link.href)
|
|
|
- link.download = row.name || '' // 下载文件的名字
|
|
|
- // a.download = url.split('/')[url.split('/').length -1] // // 下载文件的名字
|
|
|
- document.body.appendChild(link)
|
|
|
- link.click()
|
|
|
- // 在资源下载完成后 清除 占用的缓存资源
|
|
|
- window.URL.revokeObjectURL(link.href)
|
|
|
- document.body.removeChild(link)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isExistByUscCode () {
|
|
|
+ let value = this.inputForm.workClientInfo.uscCode
|
|
|
+ if (value !== null && value !== undefined && value !== '') {
|
|
|
+ this.workClientService.isExist(value).then((data) => {
|
|
|
+ console.log('data', data.data)
|
|
|
+ if (data.data !== 0) {
|
|
|
+ this.$message.error('该统一社会信用代码已存在')
|
|
|
+ this.isSubmit = true
|
|
|
+ } else {
|
|
|
+ this.isSubmit = false
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ async toHref (row) {
|
|
|
+ toHref(row)
|
|
|
+ },
|
|
|
onPreview (url) {
|
|
|
this.url = url
|
|
|
this.showViewer = true
|
|
@@ -694,6 +710,10 @@
|
|
|
},
|
|
|
// 表单提交
|
|
|
doSubmit () {
|
|
|
+ if (this.progressFlag === true) {
|
|
|
+ this.$message.warning('文件正在上传中,请稍等')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.$refs['inputForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true
|
|
@@ -792,14 +812,12 @@
|
|
|
this.showVi = true
|
|
|
},
|
|
|
httpRequest (file) {
|
|
|
- httpRequest(file, fileName(file), 'projectRecords')
|
|
|
+ httpRequest(file, fileName(file), 'workClient')
|
|
|
},
|
|
|
handleRemove () {
|
|
|
this.fileList = handleRemove()
|
|
|
},
|
|
|
changes (file, fileList) {
|
|
|
- console.log('file', file)
|
|
|
- console.log('22', fileList)
|
|
|
this.dataListNew = []
|
|
|
this.dataList.forEach((item) => {
|
|
|
this.dataListNew.push(item)
|
|
@@ -809,8 +827,6 @@
|
|
|
item.createBy = this.$store.state.user.name
|
|
|
this.dataListNew.push(item)
|
|
|
})
|
|
|
- console.log('11', this.dataList)
|
|
|
- console.log('33', this.dataListNew)
|
|
|
const isLt2M = file.size / 1024 / 1024 < 300
|
|
|
if (isLt2M === false) {
|
|
|
this.$message.error('文件大小不能超过 ' + 300 + 'M !')
|
|
@@ -819,39 +835,7 @@
|
|
|
}
|
|
|
},
|
|
|
async showFile (row) {
|
|
|
- console.log('row', row)
|
|
|
- let suffix = row.name.substring(row.name.lastIndexOf('.') + 1)
|
|
|
- if (suffix === 'jpg' || suffix === 'png' || suffix === 'gif' || suffix === 'bmp' || suffix === 'jpeg') {
|
|
|
- if (row.url !== null && row.url !== undefined && row.url !== '') {
|
|
|
- this.onPreview(row.url)
|
|
|
- return
|
|
|
- } else {
|
|
|
- await this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
|
|
|
- this.onPreview(data.data)
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- if (row.url !== null && row.url !== undefined && row.url !== '') {
|
|
|
- if (suffix === 'pdf') {
|
|
|
- window.open('https://view.xdocin.com/xdoc?_xdoc=' + row.url, '_blank')
|
|
|
- } else if (suffix === 'rar' || suffix === 'zip' || suffix === 'jar' || suffix === '7z') {
|
|
|
- window.open('http://ow365.cn/?i=25008&furl=' + row.url, '_blank')
|
|
|
- } else {
|
|
|
- window.open('https://view.officeapps.live.com/op/view.aspx?src=' + row.url, '_blank')
|
|
|
- }
|
|
|
- } else if (row.raw.url !== null && row.raw.url !== undefined && row.raw.url !== '') {
|
|
|
- await this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
|
|
|
- this.rowurl = data.data
|
|
|
- })
|
|
|
- if (suffix === 'pdf') {
|
|
|
- window.open('https://view.xdocin.com/xdoc?_xdoc=' + this.rowurl, '_blank')
|
|
|
- } else if (suffix === 'rar' || suffix === 'zip' || suffix === 'jar' || suffix === '7z') {
|
|
|
- window.open('http://ow365.cn/?i=25008&furl=' + this.rowurl, '_blank')
|
|
|
- } else {
|
|
|
- window.open('https://view.officeapps.live.com/op/view.aspx?src=' + this.rowurl, '_blank')
|
|
|
- }
|
|
|
- }
|
|
|
+ await openWindowOnUrl(row)
|
|
|
},
|
|
|
// 排序
|
|
|
sortChangeHandle (column) {
|
|
@@ -862,7 +846,6 @@
|
|
|
this.refreshList()
|
|
|
},
|
|
|
deleteMsgById (row, index) {
|
|
|
- console.log(index)
|
|
|
this.dataListNew.splice(index, 1)
|
|
|
if (row.id !== null && row.id !== '' && row.id !== undefined) {
|
|
|
this.ossService.deleteMsgById(row.id)
|
|
@@ -961,7 +944,6 @@
|
|
|
async rowClick (event) {
|
|
|
let id = this.gridData[event.rowIndex].companyid
|
|
|
await this.workClientService.enterpriseTicketInfo(id).then((data) => {
|
|
|
- console.log(data)
|
|
|
this.inputForm.workClientInfo.name = data.data.ENTNAME
|
|
|
this.inputForm.workClientInfo.uscCode = data.data.UNCID
|
|
|
this.inputForm.workClientInfo.registerAddress = data.data.OPLOC
|