From 790221ce9c7cba9fe455493c7a0e84695c021c3d Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 26 一月 2024 15:03:33 +0800
Subject: [PATCH] Mr.Shi
---
company/src/components/business/OperaCompanyDescWindow.vue | 115 +++++++++++++-
company/src/components/common/UploadAvatarImage.vue | 40 +++-
company/src/api/business/company.js | 10 +
company/src/components/business/modification.vue | 153 +++++++++++++++++++
company/src/components/business/OperaCompanyWindow.vue | 73 +++++---
company/src/views/business/company.vue | 36 ++++
6 files changed, 374 insertions(+), 53 deletions(-)
diff --git a/company/src/api/business/company.js b/company/src/api/business/company.js
index 2e1ef12..5131034 100644
--- a/company/src/api/business/company.js
+++ b/company/src/api/business/company.js
@@ -31,3 +31,13 @@
export function getById (id) {
return request.get(`/business/company/${id}`)
}
+
+// 浼佷笟鏇存崲鎵嬫満鍙�
+export function updatePhone (data) {
+ return request.post('/business/company/updatePhone', data)
+}
+
+// 淇敼淇濋櫓鏂规
+export function updateSolutions (data) {
+ return request.post('/business/company/updateSolutions', data)
+}
diff --git a/company/src/components/business/OperaCompanyDescWindow.vue b/company/src/components/business/OperaCompanyDescWindow.vue
index c7c3c9a..a5b131e 100644
--- a/company/src/components/business/OperaCompanyDescWindow.vue
+++ b/company/src/components/business/OperaCompanyDescWindow.vue
@@ -1,7 +1,8 @@
<template>
<GlobalWindow
:title="title"
- width="80%"
+ width="100%"
+ :withFooter="false"
:visible.sync="visible"
:confirm-working="isWorking"
@confirm="confirm"
@@ -9,7 +10,10 @@
<div class="info">
<div class="info_label">
<span>浼佷笟璇︽儏</span>
- <el-button type="primary" @click="$refs.operaCompanyWindow.open('缂栬緫浼佷笟淇℃伅', row)">淇敼浼佷笟淇℃伅</el-button>
+ <div>
+ <el-button type="primary" @click="$refs.modification.open('淇敼淇濋櫓鏂规', form)">鏇存敼淇濋櫓鏂规</el-button>
+ <el-button type="primary" @click="$refs.operaCompanyWindow.open('缂栬緫浼佷笟淇℃伅', form)">淇敼浼佷笟淇℃伅</el-button>
+ </div>
</div>
<div class="info_list">
<div class="info_list_item">
@@ -118,6 +122,9 @@
</div>
<!-- 鏂板缓/淇敼 -->
<OperaCompanyWindow ref="operaCompanyWindow" @success="callback"/>
+ <!-- 淇敼淇濋櫓鏂规 -->
+ <modification ref="modification" @success="callback"/>
+ <!-- 淇敼鎵嬫満鍙� -->
<el-dialog
title="鏇存敼缁戝畾鎵嬫満鍙�"
:visible.sync="visiblePhone"
@@ -130,20 +137,21 @@
<div class="form_item">
<div class="form_item_label">缁戝畾鎵嬫満鍙凤細</div>
<div class="form_item_val">
- <input type="text" placeholder="璇疯緭鍏�" />
+ <el-input v-model="phone" placeholder="璇疯緭鍏�"></el-input>
</div>
</div>
<div class="form_item">
<div class="form_item_label">楠岃瘉鐮侊細</div>
<div class="form_item_val">
- <input type="text" placeholder="璇疯緭鍏�" />
- <el-button type="primary" style="margin-left: 20px;">鍙戦�侀獙璇佺爜</el-button>
+ <el-input v-model="code" placeholder="璇疯緭鍏�"></el-input>
+ <el-button type="primary" style="margin-left: 20px;" @click="send" v-if="num === 0">鍙戦�侀獙璇佺爜</el-button>
+ <el-button type="primary" style="flex-shrink: 0; margin-left: 15px;" v-else>{{num}}s</el-button>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
- <el-button @click="visiblePhone = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="visiblePhone = false">鎻� 浜�</el-button>
+ <el-button @click="close">鍙� 娑�</el-button>
+ <el-button type="primary" @click="updatePhoneEvent">鎻� 浜�</el-button>
</span>
</el-dialog>
</GlobalWindow>
@@ -153,20 +161,26 @@
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import OperaCompanyWindow from '@/components/business/OperaCompanyWindow'
- import { getById } from '@/api/business/company'
+ import modification from '@/components/business/modification'
+ import { getById, updatePhone } from '@/api/business/company'
import { listForCompany } from '@/api/business/solutions'
+ import { sendSms } from '@/api/business/smsEmail'
export default {
name: 'OperaCompanyDescWindow',
extends: BaseOpera,
- components: { GlobalWindow, OperaCompanyWindow },
+ components: { GlobalWindow, OperaCompanyWindow, modification },
data () {
return {
ruleForm: {
phone: '',
code: ''
},
+ num: 0,
+ timer: null,
// 琛ㄥ崟鏁版嵁
form: {},
+ phone: '',
+ code: '',
visiblePhone: false,
options: [],
tableData: []
@@ -179,12 +193,94 @@
})
},
methods: {
+ close() {
+ this.visiblePhone = false
+ this.phone = ''
+ this.code = ''
+ clearInterval(this.timer)
+ this.num = 0
+ },
+ updatePhoneEvent() {
+ if (!this.phone) {
+ this.$message.warning('璇疯緭鍏ユ墜鏈哄彿')
+ return
+ }
+ if (!this.code) {
+ this.$message.warning('璇疯緭鍏ラ獙璇佺爜')
+ return
+ }
+ updatePhone({
+ id: this.form.id,
+ captche: this.code,
+ phone: this.phone
+ }).then(res => {
+ this.form.phone = JSON.parse(JSON.stringify(this.phone))
+ this.$message.success('鎿嶄綔鎴愬姛')
+ this.visiblePhone = false
+ this.phone = ''
+ this.code = ''
+ clearInterval(this.timer)
+ this.num = 0
+ })
+ },
+ send() {
+ if (!this.phone) {
+ this.$message.warning('璇疯緭鍏ユ墜鏈哄彿')
+ return
+ }
+ sendSms({ phone: this.phone })
+ .then(res => {
+ this.num = 60
+ this.setTime()
+ })
+ },
+ setTime() {
+ this.timer = setInterval(() => {
+ this.num -= 1
+ if (this.num === 0) {
+ clearInterval(this.timer)
+ this.num = 0
+ }
+ }, 1000)
+ },
open (title, target) {
const that = this;
this.title = title
+ this.phone = ''
+ this.code = ''
+ clearInterval(this.timer)
+ this.num = 0
getById(target.id)
.then(res => {
this.form = res
+ this.form.type = 1
+
+ this.form.file = {
+ imgurl: '',
+ imgurlfull: ''
+ }
+ this.form.file1 = {
+ imgurl: '',
+ imgurlfull: ''
+ }
+ this.form.file2 = {
+ imgurl: '',
+ imgurlfull: ''
+ }
+ this.form.file3 = {
+ imgurl: '',
+ imgurlfull: ''
+ }
+
+ this.form.file.imgurl = res.businessImg.fileurl
+ this.form.file.imgurlfull = res.businessImg.fileurlFull
+ this.form.file1.imgurl = res.idcardImgList[0].fileurl
+ this.form.file1.imgurlfull = res.idcardImgList[0].fileurlFull
+ this.form.file2.imgurl = res.idcardImgList[1].fileurl
+ this.form.file2.imgurlfull = res.idcardImgList[1].fileurlFull
+ this.form.file3.imgurl = res.signImg.fileurl
+ this.form.file3.imgurlfull = res.signImg.fileurlFull
+
listForCompany({ companyId: target.id })
.then(resa => {
that.form.solutionList = resa.map(item => {
@@ -201,6 +297,7 @@
canReduce: item.canReduce
}
})
+ console.log(that.form)
that.visible = true
})
})
diff --git a/company/src/components/business/OperaCompanyWindow.vue b/company/src/components/business/OperaCompanyWindow.vue
index 0bfa100..44c6e69 100644
--- a/company/src/components/business/OperaCompanyWindow.vue
+++ b/company/src/components/business/OperaCompanyWindow.vue
@@ -13,23 +13,23 @@
<el-form-item label="缁熶竴淇$敤浠g爜" prop="code">
<el-input v-model="form.code" placeholder="璇疯緭鍏�" v-trim/>
</el-form-item>
- <el-form-item label="娉曚汉濮撳悕" prop="legalName">
+ <el-form-item label="娉曚汉濮撳悕" prop="legalName" v-if="form.type !== 1">
<el-input v-model="form.legalName" placeholder="璇疯緭鍏�" v-trim/>
</el-form-item>
- <el-form-item label="缁戝畾鎵嬫満鍙�" prop="phone">
+ <el-form-item label="缁戝畾鎵嬫満鍙�" prop="phone" v-if="form.type !== 1">
<div style="width: 100%; display: flex; align-items: center;">
<el-input v-model="form.phone" maxlength="11" type="number" style="flex: 1;" placeholder="璇疯緭鍏�" v-trim/>
<el-button type="primary" style="flex-shrink: 0; margin-left: 15px;" @click="send" v-if="num === 0">鍙戦�侀獙璇佺爜</el-button>
<el-button type="primary" style="flex-shrink: 0; margin-left: 15px;" v-else>{{num}}s</el-button>
</div>
</el-form-item>
- <el-form-item label="楠岃瘉鐮�" prop="captche">
+ <el-form-item label="楠岃瘉鐮�" prop="captche" v-if="form.type !== 1">
<el-input v-model="form.captche" placeholder="璇疯緭鍏�" v-trim/>
</el-form-item>
- <el-form-item label="鍏徃璐﹀彿" prop="username">
+ <el-form-item label="鍏徃璐﹀彿" prop="username" v-if="form.type !== 1">
<el-input v-model="form.username" placeholder="璇疯緭鍏�" v-trim/>
</el-form-item>
- <el-form-item label="璁よ瘉閭" prop="email">
+ <el-form-item label="璁よ瘉閭" prop="email" v-if="form.type !== 1">
<el-input v-model="form.email" placeholder="璇疯緭鍏�" v-trim/>
</el-form-item>
<el-form-item label="绾崇◣浜鸿瘑鍒彿" prop="taxCode">
@@ -51,21 +51,22 @@
<el-input v-model="form.invoiceAddr" placeholder="璇疯緭鍏�" v-trim/>
</el-form-item>
<el-form-item label="钀ヤ笟鎵х収" prop="businessImg">
- <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="file" @uploadSuccess="result" />
+ <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="form.file" @uploadSuccess="result" />
</el-form-item>
<el-form-item label="娉曚汉韬唤璇�" prop="idcardImgList">
<div style="width: 100%; display: flex; align-items: center;">
- <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="file1" @uploadSuccess="result1" />
+ <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="form.file1" @uploadSuccess="result1" />
<div style="width: 15px;height: 100%;"></div>
- <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="file2" @uploadSuccess="result2" />
+ <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="form.file2" @uploadSuccess="result2" />
</div>
</el-form-item>
<el-form-item label="鐢靛瓙绛剧珷" prop="signImg">
- <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="file3" @uploadSuccess="result3" />
+ <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="form.file3" @uploadSuccess="result3" />
</el-form-item>
</el-form>
- <el-button type="primary" style="margin-bottom: 15px;" @click="add">娣诲姞</el-button>
+ <el-button type="primary" style="margin-bottom: 15px;" @click="add" v-if="form.type !== 1">娣诲姞</el-button>
<el-table
+ v-if="form.type !== 1"
:data="form.solutionList"
border
style="width: 100%">
@@ -154,7 +155,24 @@
canAdd: 0,
canReduce: 0
}
- ]
+ ],
+ type: '',
+ file: {
+ imgurl: '',
+ imgurlfull: ''
+ },
+ file1: {
+ imgurl: '',
+ imgurlfull: ''
+ },
+ file2: {
+ imgurl: '',
+ imgurlfull: ''
+ },
+ file3: {
+ imgurl: '',
+ imgurlfull: ''
+ },
},
timer: null,
num: 0,
@@ -194,22 +212,7 @@
{ required: true, message: '璇疯緭鍏ュ叕鍙歌处鍙�' }
]
},
- file: {
- imgurl: '',
- imgurlfull: ''
- },
- file1: {
- imgurl: '',
- imgurlfull: ''
- },
- file2: {
- imgurl: '',
- imgurlfull: ''
- },
- file3: {
- imgurl: '',
- imgurlfull: ''
- },
+
programme: []
}
},
@@ -295,19 +298,35 @@
},
// 鎺ユ敹钀ヤ笟鎵х収鏁版嵁
result(data) {
+ this.form.businessImg = {
+ fileurl: '',
+ name: ''
+ }
this.form.businessImg.fileurl = data.imgurl
this.form.businessImg.name = data.name
},
// 韬唤璇佺収鐗�1
result1(data) {
+ this.form.idcardImgList[0] = {
+ fileurl: '',
+ name: ''
+ }
this.form.idcardImgList[0] = { fileurl: data.imgurl, name: data.name }
},
// 韬唤璇佺収鐗�2
result2(data) {
+ this.form.idcardImgList[1] = {
+ fileurl: '',
+ name: ''
+ }
this.form.idcardImgList[1] = { fileurl: data.imgurl, name: data.name }
},
// 鐢靛瓙绛剧珷
result3(data) {
+ this.form.signImg = {
+ fileurl: '',
+ name: ''
+ }
this.form.signImg.fileurl = data.imgurl
this.form.signImg.name = data.name
}
diff --git a/company/src/components/business/modification.vue b/company/src/components/business/modification.vue
new file mode 100644
index 0000000..877a401
--- /dev/null
+++ b/company/src/components/business/modification.vue
@@ -0,0 +1,153 @@
+<template>
+ <GlobalWindow
+ :title="title"
+ width="100%"
+ :visible.sync="visible"
+ :confirm-working="isWorking"
+ @confirm="confirm"
+ >
+ <el-button type="primary" style="margin-bottom: 15px;" @click="add">娣诲姞</el-button>
+ <el-table
+ :data="form.solutionList"
+ border
+ style="width: 100%">
+ <el-table-column
+ label="搴忓彿"
+ align="center"
+ width="80">
+ <template slot-scope="scope">
+ <span>{{scope.$index + 1}}</span>
+ </template>
+ </el-table-column>
+ <el-table-column
+ align="center"
+ label="淇濋櫓鏂规">
+ <template slot-scope="{row}">
+ <el-select v-model="row.solutionBaseId" placeholder="璇烽�夋嫨">
+ <el-option
+ v-for="item in programme"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column
+ align="center"
+ label="鍔犲噺淇濆姛鑳�">
+ <template slot-scope="{row}">
+ <el-checkbox :true-label="1" :false-label="0" v-model="row.canAdd">鍔犱繚</el-checkbox>
+ <el-checkbox :true-label="1" :false-label="0" v-model="row.canReduce">鍑忎繚</el-checkbox>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鎿嶄綔"
+ align="center"
+ width="100">
+ <template slot-scope="scope">
+ <el-button type="text" size="small" style="color: red;" @click="dele(scope.$index)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </GlobalWindow>
+</template>
+
+<script>
+ import BaseOpera from '@/components/base/BaseOpera'
+ import GlobalWindow from '@/components/common/GlobalWindow'
+ import { all } from '@/api/business/solutions'
+ import { listForCompany } from '@/api/business/solutions'
+ import { updateSolutions } from '@/api/business/company'
+
+ export default {
+ name: 'modification',
+ extends: BaseOpera,
+ components: { GlobalWindow },
+ data () {
+ return {
+ // 琛ㄥ崟鏁版嵁
+ form: {
+ id: null,
+ solutionList: [
+ {
+ solutionBaseId: '',
+ canAdd: 0,
+ canReduce: 0
+ }
+ ]
+ },
+ // 楠岃瘉瑙勫垯
+ rules: {
+ solutionList: [
+ { required: true, message: '璇疯緭鍏ュ叕鍙歌处鍙�' }
+ ]
+ },
+ programme: []
+ }
+ },
+ created () {
+ this.config({
+ api: '/business/company',
+ 'field.id': 'id'
+ })
+ },
+ methods: {
+ confirm() {
+ this.isWorking = true
+ updateSolutions(this.form)
+ .then(res => {
+ this.visible = false
+ this.$tip.apiSuccess('鏂板缓鎴愬姛')
+ this.$emit('success')
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ this.isWorking = false
+ })
+ },
+ // 鑾峰彇鍏ㄩ儴鏂规
+ getAll() {
+ all({})
+ .then(res => {
+ this.programme = res
+ })
+ },
+ open (title, target) {
+ var that = this;
+ this.title = title
+ for (const key in this.form) {
+ this.form[key] = target[key]
+ }
+ this.getAll()
+ listForCompany({ companyId: target.id })
+ .then(resa => {
+ that.form.solutionList = resa.map(item => {
+ return {
+ solutionBaseId: item.solutionBaseId,
+ canAdd: item.canAdd,
+ canReduce: item.canReduce
+ }
+ })
+ that.visible = true
+ })
+ },
+ add() {
+ this.form.solutionList.push({
+ solutionName: '',
+ canAdd: '',
+ canReduce: ''
+ })
+ },
+ dele(index) {
+ if (this.form.solutionList.length === 1) {
+ this.$message.warning('鑷冲皯淇濈暀涓�椤�')
+ return
+ }
+ this.form.solutionList.splice(index, 1)
+ }
+ }
+ }
+</script>
diff --git a/company/src/components/common/UploadAvatarImage.vue b/company/src/components/common/UploadAvatarImage.vue
index e0d737e..6347a83 100644
--- a/company/src/components/common/UploadAvatarImage.vue
+++ b/company/src/components/common/UploadAvatarImage.vue
@@ -3,16 +3,18 @@
<el-upload
class="avatar-uploader"
accept=".png,.jpg"
+ :style="customStyle"
:action="uploadImgUrl"
:data="uploadData"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:on-error="uploadError"
:before-upload="beforeAvatarUpload">
- <template v-if="file.imgurlfull">
- <img :src="file.imgurlfull" class="avatar">
- </template>
- <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+ <img v-if="file.imgurlfull" :src="file.imgurlfull" :style="customStyle" class="avatar">
+ <div v-else :style="customStyle">
+ <i class="el-icon-plus avatar-uploader-icon"></i>
+ <div class="tips-style">{{ tipsLabel }}</div>
+ </div>
</el-upload>
</div>
@@ -25,16 +27,16 @@
type: Object,
default: () => {}
},
+ tipsLabel: '',
+ customStyle: {
+ type: String,
+ default: 'width: 90px; height: 90px;'
+ },
uploadData: Object
},
data() {
return {
- uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/uploadLocal',
- // uploadData: {
- // folder: 'upload',
- // type: 'image'
- // },
- imgurlfull: ''
+ uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload'
}
},
@@ -42,10 +44,11 @@
// 涓婁紶鍥剧墖
handleAvatarSuccess(res, file) {
if (res.code == 200) {
- this.file.imgurl = res.data.imgaddr;
- this.file.imgurlfull = res.data.url;
- this.$tip.apiSuccess('涓婁紶鎴愬姛')
- this.$emit('uploadSuccess', { imgurl: res.data.imgaddr, imgurlfull: res.data.url })
+ let { data } = res
+ this.file.imgurl = data.imgaddr;
+ this.file.imgurlfull = data.url;
+ this.$message.success('涓婁紶鎴愬姛')
+ this.$emit('uploadSuccess', { imgurl: data.imgaddr, imgurlfull: data.url, name: data.originname })
} else {
this.$tip.apiFailed('涓婁紶澶辫触')
}
@@ -83,11 +86,11 @@
border-color: #409EFF;
}
.avatar-uploader-icon {
+ line-height: 90px;
font-size: 28px;
color: #8c939d;
width: $image-width;
height: $image-width;
- line-height: $image-width;
text-align: center;
}
.avatar {
@@ -95,6 +98,13 @@
height: $image-width;
display: block;
}
+.tips-style {
+ height: 13px;
+ font-size: 13px;
+ font-weight: 400;
+ color: #999999;
+ line-height: 13px;
+}
</style>
<style lang="scss" scoped>
::v-deep .el-upload--picture-card{
diff --git a/company/src/views/business/company.vue b/company/src/views/business/company.vue
index e0a2098..51341f7 100644
--- a/company/src/views/business/company.vue
+++ b/company/src/views/business/company.vue
@@ -50,7 +50,7 @@
>
<template slot-scope="{row}">
<el-button type="text" @click="$refs.OperaCompanyDescWindow.open('浼佷笟璇︽儏', row)" v-permissions="['business:company:update']">鏌ョ湅璇︽儏</el-button>
- <el-button type="text" @click="$refs.operaCompanyWindow.open('缂栬緫浼佷笟淇℃伅琛�', row)" v-permissions="['business:company:update']">淇敼</el-button>
+ <el-button type="text" @click="edit(row)" v-permissions="['business:company:update']">淇敼</el-button>
<el-button type="text" @click="$refs.operaCompanyWindow.open('缂栬緫浼佷笟淇℃伅琛�', row)" v-permissions="['business:company:update']">鐢靛瓙绛捐璇�</el-button>
</template>
</el-table-column>
@@ -75,7 +75,7 @@
import Pagination from '@/components/common/Pagination'
import OperaCompanyWindow from '@/components/business/OperaCompanyWindow'
import OperaCompanyDescWindow from '@/components/business/OperaCompanyDescWindow'
- import { updateStatus } from '@/api/business/company'
+ import { updateStatus, getById } from '@/api/business/company'
export default {
name: 'Company',
extends: BaseTable,
@@ -99,6 +99,38 @@
this.search()
},
methods: {
+ edit(row) {
+ getById(row.id)
+ .then(res => {
+ let form = res;
+ form.type = 1
+ form.file = {
+ imgurl: '',
+ imgurlfull: ''
+ }
+ form.file1 = {
+ imgurl: '',
+ imgurlfull: ''
+ }
+ form.file2 = {
+ imgurl: '',
+ imgurlfull: ''
+ }
+ form.file3 = {
+ imgurl: '',
+ imgurlfull: ''
+ }
+ form.file.imgurl = res.businessImg.fileurl
+ form.file.imgurlfull = res.businessImg.fileurlFull
+ form.file1.imgurl = res.idcardImgList[0].fileurl
+ form.file1.imgurlfull = res.idcardImgList[0].fileurlFull
+ form.file2.imgurl = res.idcardImgList[1].fileurl
+ form.file2.imgurlfull = res.idcardImgList[1].fileurlFull
+ form.file3.imgurl = res.signImg.fileurl
+ form.file3.imgurlfull = res.signImg.fileurlFull
+ this.$refs.operaCompanyWindow.open('缂栬緫浼佷笟', form)
+ })
+ },
// 淇敼鐘舵��
changeStatus(status, row) {
updateStatus({ id: row.id, status })
--
Gitblit v1.9.3