From 50fb58286ed3b718c39a97e0987ee7561a295651 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 04 七月 2025 17:56:41 +0800
Subject: [PATCH] git ch
---
company/src/components/business/OperaInsuranceWindow.vue | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 160 insertions(+), 11 deletions(-)
diff --git a/company/src/components/business/OperaInsuranceWindow.vue b/company/src/components/business/OperaInsuranceWindow.vue
index 96059c6..71e833c 100644
--- a/company/src/components/business/OperaInsuranceWindow.vue
+++ b/company/src/components/business/OperaInsuranceWindow.vue
@@ -1,17 +1,33 @@
<template>
<GlobalWindow
- :title="title"
- :visible.sync="visible"
- :confirm-working="isWorking"
- @confirm="confirm"
+ :title="title"
+ :visible.sync="visible"
+ :confirm-working="isWorking"
+ @confirm="confirm"
>
<el-form :model="form" ref="form" :rules="rules">
<el-form-item label="淇濋櫓鍏徃" prop="name">
<el-input v-model="form.name" placeholder="骞冲畨淇濋櫓" v-trim/>
</el-form-item>
- <el-button type="primary" style="margin-bottom: 10px;">娣诲姞</el-button>
+ <el-form-item label="logo" prop="logo">
+ <UploadAvatarImage :uploadData="{ folder: 'insurance' }" :file="file" @uploadSuccess="result" />
+ </el-form-item>
+ <el-form-item label="鑻辨枃鍚嶇О" prop="englishName">
+ <el-input v-model="form.englishName" maxlength="100" show-word-limit placeholder="璇疯緭鍏ヨ嫳鏂囧悕绉�" v-trim/>
+ </el-form-item>
+ <el-form-item label="鑱旂郴浜�" prop="linkName">
+ <el-input v-model="form.linkName" maxlength="10" show-word-limit placeholder="璇疯緭鍏ヨ仈绯讳汉" v-trim/>
+ </el-form-item>
+ <el-form-item label="鑱旂郴浜虹數璇�" prop="linkPhone">
+ <el-input v-model="form.linkPhone" maxlength="11" show-word-limit placeholder="璇疯緭鍏ヨ仈绯讳汉鐢佃瘽" v-trim/>
+ </el-form-item>
+ <div style="width: 100%; display: flex; align-items: center;margin-bottom: 10px;">
+ <el-button type="primary" @click="add">娣诲姞</el-button>
+ <el-button type="primary" @click="impor">瀵煎叆宸ョ</el-button>
+ <el-button type="text" @click="exprot">瀵煎叆妯$増xls</el-button>
+ </div>
<el-table
- :data="tableData"
+ :data="form.worktypeList"
border
style="width: 100%; margin-bottom: 20px;">
<el-table-column
@@ -34,32 +50,70 @@
align="center"
width="100">
<template slot-scope="scope">
- <el-button type="text" size="small" style="color: red;">鍒犻櫎</el-button>
+ <el-button type="text" size="small" style="color: red;" @click="dele(scope.$index)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
+ <el-form-item label="鐞嗚禂鎵�闇�鏉愭枡" prop="claimsInformation">
+ <RichEditor :richData="form.claimsInformation" :styleEditor="'border: 1px solid #ccc;display: inline-block;'" @getWangedditor="getWangedditor" :readonly="false"/>
+ </el-form-item>
+ <el-form-item label="淇濋櫓鏀跨瓥" prop="policy">
+ <RichEditor :richData="form.policy" :styleEditor="'border: 1px solid #ccc;display: inline-block;'" @getWangedditor="getWangedditor1" :readonly="false"/>
+ </el-form-item>
+ <el-form-item label="淇濋櫓鏉℃" prop="agreement">
+ <RichEditor :richData="form.agreement" :styleEditor="'border: 1px solid #ccc;display: inline-block;'" @getWangedditor="getWangedditor2" :readonly="false"/>
+ </el-form-item>
</el-form>
+ <!-- 涓婁紶宸ョ -->
+ <input type="file" @change="getFile" style="opacity: 0;" ref="upload" accept=".xlsx" />
</GlobalWindow>
</template>
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
+ import UploadAvatarImage from '@/components/common/UploadAvatarImage'
+ import RichEditor from '@/components/common/RichEditor'
+ import { importExcel, all } from '@/api/business/worktype'
+
export default {
name: 'OperaInsuranceWindow',
extends: BaseOpera,
- components: { GlobalWindow },
+ components: { GlobalWindow, UploadAvatarImage, RichEditor },
data () {
+ var phoneRule = (rule, value, callback) => {
+ if (value) {
+ if (!/^1[3-9]\d{9}$/.test(value)) {
+ return callback(new Error('璇疯緭鍏ユ纭殑鎵嬫満鍙凤紒'))
+ }
+ }
+ callback()
+ }
return {
// 琛ㄥ崟鏁版嵁
form: {
id: null,
- name: ''
+ name: '',
+ logo: '',
+ englishName: '',
+ linkName: '',
+ linkPhone: '',
+ agreement: '',
+ claimsInformation: '',
+ policy: '',
+ worktypeList: [
+ { name: '' }
+ ]
+ },
+ file: {
+ imgurlfull: ''
},
// 楠岃瘉瑙勫垯
rules: {
- },
- tableData: []
+ linkPhone: [
+ { required: false, validator: phoneRule }
+ ]
+ }
}
},
created () {
@@ -67,6 +121,101 @@
api: '/business/insurance',
'field.id': 'id'
})
+ },
+ methods: {
+ open (title, target) {
+ this.form.worktypeList = [{ name: '' }]
+ this.title = title
+ this.visible = true
+ // 鏂板缓
+ if (target == null) {
+ this.$nextTick(() => {
+ this.$refs.form.resetFields()
+ this.form[this.configData['field.id']] = null
+ })
+ return
+ }
+ // 缂栬緫
+ this.$nextTick(() => {
+ for (const key in this.form) {
+ this.form[key] = target[key]
+ }
+ this.file.imgurlfull = target.logoFullUrl
+ console.log(this.form)
+ all({ insuranceId: this.form.id })
+ .then(res => {
+ let arr = []
+ res.forEach(item => {
+ arr.push({ name: item.name })
+ })
+ this.form.worktypeList = arr
+ })
+ })
+ },
+ getWangedditor(val){
+ this.form.claimsInformation = val;
+ },
+ getWangedditor1(val){
+ this.form.policy = val;
+ },
+ getWangedditor2(val){
+ this.form.agreement = val;
+ },
+ result(res) {
+ this.form.logo = res.imgurl
+ this.file.imgurlfull = res.imgurlfull
+ },
+ // 瀵煎嚭妯℃澘
+ exprot() {
+ window.open(process.env.VUE_APP_TYPEWORK_URL)
+ // let a = document.createElement("a");
+ // a.href = '/public/file/typeWork.xlsx';
+ // a.download = '淇濋櫓鍏徃-宸ョ瀵煎叆妯$増.xlsx';
+ // a.click();
+ },
+ // 瀵煎叆宸ョ妯℃澘
+ getFile(e) {
+ const formdate = new FormData()
+ formdate.append('file', e.target.files[0])
+ importExcel(formdate)
+ .then(res => {
+ res.forEach(item => {
+ if (this.form.worktypeList.length === 0) {
+ this.form.worktypeList.push({ name: item })
+ } else {
+ let next = true
+ this.form.worktypeList.forEach(row => {
+ if (row.name === item) {
+ next = false
+ }
+ })
+ if (next) {
+ this.form.worktypeList.push({ name: item })
+ }
+ }
+ })
+ })
+ .catch(err => {
+ this.$message.error(err.message)
+ })
+ .finally(() => {
+ this.$refs.upload.value = null
+ })
+ },
+ // 涓婁紶鏂囦欢
+ impor() {
+ this.$refs.upload.click()
+ },
+ add() {
+ this.form.worktypeList.push({ name: '' })
+ },
+ dele(index) {
+ if (this.form.worktypeList.length === 1) {
+ this.$message.warning('鑷冲皯淇濈暀涓�椤瑰唴瀹�')
+ return
+ }
+ this.form.worktypeList.splice(index, 1)
+ }
}
}
</script>
--
Gitblit v1.9.3