From 56edbd80963acea41d9b9737bb9264f57a6e4ae2 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 19 十一月 2024 09:13:41 +0800
Subject: [PATCH] 优化
---
company/src/components/business/OperaSolutionsWindow.vue | 515 +++++++++++++++++++++++++-------------------------------
1 files changed, 230 insertions(+), 285 deletions(-)
diff --git a/company/src/components/business/OperaSolutionsWindow.vue b/company/src/components/business/OperaSolutionsWindow.vue
index 365bbd4..4d23b6e 100644
--- a/company/src/components/business/OperaSolutionsWindow.vue
+++ b/company/src/components/business/OperaSolutionsWindow.vue
@@ -7,325 +7,270 @@
@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-form-item label="淇濋櫓鍏徃" prop="insuranceId">
- <el-select v-model="form.insuranceId" @change="getAllWorktype1" placeholder="璇烽�夋嫨">
+ <el-form-item label="涓绘柟妗�" prop="parentId">
+ <el-select v-model="form.parentId" filterable @change="changeParent" placeholder="璇烽�夋嫨">
<el-option
- v-for="item in company"
+ v-for="item in list"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="鎵夸繚鍏徃" prop="companyName">
- <el-input v-model="form.companyName" placeholder="璇疯緭鍏�" v-trim/>
- </el-form-item>
- <el-form-item label="鎶曚繚骞撮緞" prop="minAge">
- <div style="display: flex; align-items: center;">
- <el-select v-model="form.minAge" style="flex: 1;" placeholder="璇烽�夋嫨">
- <el-option
- v-for="item in 60"
- :key="item"
- :label="item"
- :value="item">
- </el-option>
- </el-select>
- <span style="margin: 0 30px;">鑷�</span>
- <el-select v-model="form.maxAge" style="flex: 1;" placeholder="璇烽�夋嫨">
- <el-option
- v-for="item in 60"
- :key="item"
- :label="item"
- :value="item">
- </el-option>
- </el-select>
- </div>
+ <el-form-item label="瀛愭柟妗堝悕绉�" prop="name">
+ <el-input v-model="form.name" placeholder="璇疯緭鍏�" v-trim/>
</el-form-item>
<el-form-item label="淇濋櫓璐圭敤" prop="price">
<div style="display: flex; align-items: center;">
<el-input v-model="form.price" style="flex: 1;" placeholder="璇疯緭鍏�" v-trim/>
<span style="margin: 0 30px;">鍏�/浜�</span>
- <el-select v-model="form.timeUnit" style="flex: 1;" placeholder="璇烽�夋嫨">
+ <el-select v-model="form.timeUnit" style="flex: 1;" placeholder="璇烽�夋嫨鍛ㄦ湡鍗曚綅" @change="changeTimeUnit">
<el-option label="澶�" :value="0"></el-option>
-<!-- <el-option label="鍗婃湀" :value="1"></el-option>-->
+ <!-- <el-option label="鍗婃湀" :value="1"></el-option>-->
<el-option label="鏈�" :value="2"></el-option>
- <el-option label="骞�" :value="3"></el-option>
+ <el-option label="瀛e害" :value="3"></el-option>
+ <el-option label="鍗婂勾" :value="4"></el-option>
+ <el-option label="骞�" :value="5"></el-option>
</el-select>
</div>
</el-form-item>
- <el-form-item label="鎶曚繚鍛ㄦ湡" prop="insureCycle">
+ <el-form-item label="鎵规敼璁¤垂瑙勫垯" prop="insureCycleUnit">
<div style="display: flex; align-items: center;">
- <el-input v-model="form.insureCycle" style="flex: 1;" placeholder="璇疯緭鍏�" v-trim/>
- <span style="margin: 0 30px;"></span>
<el-select v-model="form.insureCycleUnit" style="flex: 1;" placeholder="璇烽�夋嫨">
- <el-option label="澶�" :value="0"></el-option>
-<!-- <el-option label="鍗婃湀" :value="1"></el-option>-->
- <el-option label="鏈�" :value="2"></el-option>
- <el-option label="骞�" :value="3"></el-option>
+ <el-option label="澶�" :value="0"></el-option>
+ <el-option v-if="form.timeUnit>=1" label="鍗婃湀" :value="1"></el-option>
+ <el-option v-if="form.timeUnit>=2" label="鏈�" :value="2"></el-option>
+ <el-option v-if="form.timeUnit>=3" label="瀛e害" :value="3"></el-option>
+ <el-option v-if="form.timeUnit>=4" label="鍗婂勾" :value="4"></el-option>
+ <el-option v-if="form.timeUnit>=5" label="骞�" :value="5"></el-option>
</el-select>
- </div>
- </el-form-item>
- <el-form-item label="鐢熸晥鏃堕棿" prop="validTypeNum">
- <div style="width: 100%; display: flex; align-items: center;">
- <div style="flex-shrink: 0;">
- <el-radio-group v-model="form.validType" @change="form.validTypeNum = ''">
- <el-radio :label="0">鏃ュ悗鐢熸晥</el-radio>
- <el-radio :label="1">娆℃湀鐢熸晥</el-radio>
- </el-radio-group>
- </div>
- <el-input style="margin-left: 20px;" type="number" v-model="form.validTypeNum" placeholder="璇疯緭鍏ュ欢杩熷ぉ鏁�" v-if="form.validType === 0"></el-input>
</div>
</el-form-item>
<el-form-item label="鎶曚繚绫诲瀷" prop="type">
- <el-radio-group v-model="form.type">
+ <el-radio-group v-model="form.type" :disabled="form.id!=null" @change="form.signType = ''">
<el-radio :label="0">鐩翠繚</el-radio>
<el-radio :label="1">濮旀墭鎶曚繚</el-radio>
</el-radio-group>
</el-form-item>
+ <el-form-item label="濮旀墭鍟嗘埛" prop="shopId" :rules="form.type === 1 ? [{required:true,message:'璇烽�夋嫨鍟嗘埛'}] : [{ required:false }]">
+ <el-select v-model="form.shopId" filterable placeholder="璇烽�夋嫨濮旀墭鍟嗘埛">
+ <el-option
+ v-for="item in shops"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="绛剧珷鏂瑰紡" prop="signType" v-if="form.type === 1">
+ <el-select v-model="form.signType" placeholder="璇烽�夋嫨濮旀墭鍟嗘埛">
+ <el-option label="鍟嗘埛绛剧讲鍟嗘埛涓婁紶鎶曚繚鍗�" :value="0"></el-option>
+ <el-option label="鍟嗘埛绛炬姇淇濈敵璇�" :value="1"></el-option>
+ <el-option label="鍟嗘埛鏃犻渶绛剧珷" :value="2"></el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鏈夋淳閬e崟浣�" prop="hasDispatchUnit">
+ <el-radio-group v-model="form.hasDispatchUnit">
+ <el-radio :label="0">鏈�</el-radio>
+ <el-radio :label="1">鏃�</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="闇�瑕佸鏍�" prop="retrial">
+ <el-radio-group v-model="form.retrial">
+ <el-radio :label="1">闇�瑕�</el-radio>
+ <el-radio :label="0">涓嶉渶瑕�</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="涓婁紶鏂规纭涔︼細" prop="fanganFile" :rules="[{required:true,message:'璇蜂笂浼犳柟妗堢‘璁や功'}]">
+ <div>
+ <UploadFile @remove="deleFile" :uploadData="{ folder: 'apply', fileType:'.pdf' }" :fileList="form.fileList1" @uploadSuccess="editFanganFile" />
+ </div>
+ </el-form-item>
<el-form-item label="鎺ユ敹鏂囦欢閭" prop="email">
<el-input v-model="form.email" placeholder="璇疯緭鍏�" v-trim/>
- </el-form-item>
- <el-form-item label="鎶曚繚鍗曠绔犲叧閿瓧锛堝鏈夊涓叧閿瓧锛岃浣跨敤鑻辨枃鍒嗗彿 ; 闅斿紑锛�" prop="signKeyword">
- <el-input v-model="form.signKeyword" placeholder="澶氫釜鑻辨枃鍒嗗彿 ; 闅斿紑" v-trim/>
- </el-form-item>
- <el-button type="primary" @click="add">娣诲姞宸ョ</el-button>
- <el-table
- :data="form.worktypeIdList"
- border
- style="width: 100%; margin-bottom: 20px;">
- <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 filterable v-model="row.worktypeId" placeholder="璇烽�夋嫨">
- <el-option
- v-for="item in typeWork"
- :key="item.id"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
- </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>
- <el-form-item label="鐗瑰埆绾﹀畾" prop="specialAgreement">
- <el-input type="textarea" v-model="form.specialAgreement" placeholder="璇疯緭鍏ョ壒鍒害瀹�" v-trim/>
- </el-form-item>
- <el-form-item label="鐗瑰埆璇存槑" prop="specialInfo">
- <el-input type="textarea" v-model="form.specialInfo" placeholder="璇疯緭鍏ョ壒鍒鏄�" v-trim/>
- </el-form-item>
- <el-form-item label="鍏朵粬璇存槑" prop="ortherInfo">
- <el-input type="textarea" v-model="form.ortherInfo" placeholder="璇疯緭鍏ュ叾浠栬鏄�" v-trim/>
</el-form-item>
</el-form>
</GlobalWindow>
</template>
<script>
- import BaseOpera from '@/components/base/BaseOpera'
- import GlobalWindow from '@/components/common/GlobalWindow'
- import { all } from '@/api/business/insurance'
- import { all as allWorktype } from '@/api/business/worktype'
- import { solutionsId } from '@/api/business/solutions'
- export default {
- name: 'OperaSolutionsWindow',
- extends: BaseOpera,
- components: { GlobalWindow },
- data () {
- var validType = (rule, value, callback) => {
- if (this.form.validType === 0 && !value) {
- return callback(new Error('寤惰繜澶╂暟涓嶈兘涓虹┖'));
- } else if (!/^[0-9]*[1-9][0-9]*$/.test(value)) {
- return callback(new Error('寤惰繜澶╂暟鍙兘涓烘鏁存暟'));
- }
- callback();
- }
- return {
- // 琛ㄥ崟鏁版嵁
- form: {
- id: null,
- name: '',
- companyName: '',
- insuranceId: '',
- validType: 0,
- type: 0,
- minAge: '',
- maxAge: '',
- price: '',
- timeUnit: '',
- insureCycle: '',
- insureCycleUnit: '',
- email: '',
- specialAgreement: '',
- specialInfo: '',
- ortherInfo: '',
- signKeyword: '',
- validTypeNum: '',
- worktypeIdList: [{ worktypeId: '' }]
- },
- // 楠岃瘉瑙勫垯
- rules: {
- name: [
- { required: true, message: '璇疯緭鍏ユ柟妗堝悕绉�' }
- ],
- insuranceId: [
- { required: true, message: '璇烽�夋嫨淇濋櫓鍏徃' }
- ],
- companyName: [
- { required: true, message: '璇疯緭鍏ユ壙淇濆叕鍙�' }
- ],
- minAge: [
- { required: true, message: '璇烽�夋嫨鎶曚繚骞撮緞' }
- ],
- price: [
- { required: true, message: '璇疯緭鍏ヤ繚闄╄垂鐢�' }
- ],
- insureCycle: [
- { required: true, message: '璇疯緭鍏ユ姇淇濆懆鏈�' }
- ],
- validTypeNum: [
- { required: true, validator: validType }
- ],
- type: [
- { required: true, message: '璇烽�夋嫨鎶曚繚绫诲瀷' }
- ],
- signKeyword: [
- { required: true, message: '璇疯緭鍏ユ姇淇濆崟绛剧珷鍏抽敭瀛�' }
- ]
- },
- company: [],
- typeWork: []
- }
- },
- created () {
- this.config({
- api: '/business/solutions',
- 'field.id': 'id'
- })
- },
- methods: {
- // 鍒囨崲鍏徃
- getAllWorktype1() {
- this.form.worktypeIdList = [{ worktypeId: '' }]
- this.getAllWorktype()
- },
- // 纭鏂板缓/淇敼
- confirm () {
- let data = JSON.parse(JSON.stringify(this.form))
- data.worktypeIdList = data.worktypeIdList.map(item => item.worktypeId)
- this.$refs.form.validate((valid) => {
- if (!valid) {
- return
- }
- // 璋冪敤鏂板缓鎺ュ彛
- this.isWorking = true
- if (data.id == null || data.id === '') {
- this.api.create(data)
- .then(() => {
- this.visible = false
- this.$tip.apiSuccess('鏂板缓鎴愬姛')
- this.$emit('success')
- })
- .catch(e => {
- this.$tip.apiFailed(e)
- })
- .finally(() => {
- this.isWorking = false
- })
- } else {
- this.api.updateById(data)
- .then(() => {
- this.visible = false
- this.$tip.apiSuccess('淇敼鎴愬姛')
- this.$emit('success')
- })
- .catch(e => {
- this.$tip.apiFailed(e)
- })
- .finally(() => {
- this.isWorking = false
- })
- }
- })
- },
- open (title, target) {
- this.title = title
- this.form.maxAge = ''
- this.form.timeUnit = ''
- this.form.insureCycleUnit = ''
- this.form.validTypeNum = ''
- this.visible = true
- this.form.worktypeIdList = [{ worktypeId: '' }]
- this.allCompany()
- // 鏂板缓
- if (target == null) {
- this.$nextTick(() => {
- this.$refs.form.resetFields()
- this.form[this.configData['field.id']] = null
- })
- return
- }
- // 缂栬緫
- this.$nextTick(() => {
- solutionsId(target.id)
- .then(res => {
- for (const key in this.form) {
- this.form[key] = res[key]
- }
- this.form.worktypeIdList = res.worktypeList.map(item => {
- return {
- worktypeId: item.worktypeId
- }
- })
- this.getAllWorktype()
- })
- })
- },
- // 鏌ヨ淇濋櫓鍏徃涓嬪叏閮ㄥ伐绉�
- getAllWorktype() {
- allWorktype({
- insuranceId: this.form.insuranceId
- }).then(res => {
- this.typeWork = res
- })
- },
- // 鏌ヨ鍏ㄩ儴淇濋櫓鍏徃
- allCompany() {
- all({ dataType: 2, status: 0 })
- .then(res => {
- console.log(res)
- this.company = res
- })
- },
- add() {
- this.form.worktypeIdList.push({ worktypeId: '' })
- },
- dele(index) {
- if (this.form.worktypeIdList.length === 1) {
- this.$message.warning('鑷冲皯瑕佷繚鐣欎竴椤�')
- return
- }
- this.form.worktypeIdList.splice(index, 1)
- }
- }
+ import BaseOpera from '@/components/base/BaseOpera'
+ import GlobalWindow from '@/components/common/GlobalWindow'
+ import { all } from '@/api/business/insurance'
+ import { solutionsId } from '@/api/business/solutions'
+ import { list } from '@/api/business/solutionsBase'
+ import { pageAll as shopList } from '@/api/business/company'
+ import UploadFile from '@/components/common/UploadFile'
+ import RichEditor from '@/components/common/RichEditor'
+
+ export default {
+ name: 'OperaSolutionsWindow',
+ extends: BaseOpera,
+ components: { GlobalWindow, UploadFile, RichEditor },
+ data () {
+ return {
+ // 琛ㄥ崟鏁版嵁
+ form: {
+ id: null,
+ name: '',
+ parentId: '',
+ signType: '',
+ type: 0,
+ price: '',
+ timeUnit: '',
+ shopId: null,
+ retrial: 0,
+ hasDispatchUnit: 0,
+ insureCycleUnit: '',
+ email: '',
+ fileList1: [],
+ fanganFile: null
+ },
+ // 楠岃瘉瑙勫垯
+ rules: {
+ name: [
+ { required: true, message: '璇疯緭鍏ユ柟妗堝悕绉�' }
+ ],
+ parentId: [
+ { required: true, message: '璇烽�夋嫨涓绘柟妗�' }
+ ],
+ signType: [
+ { required: true, message: '璇烽�夋嫨绛剧珷鏂瑰紡' }
+ ],
+ price: [
+ { required: true, message: '璇疯緭鍏ユ柟妗堣垂鐢�' }
+ ],
+ insureCycleUnit: [
+ { required: true, message: '璇疯緭鍏ユ壒鏀硅璐瑰崟浣�' }
+ ],
+ type: [
+ { required: true, message: '璇烽�夋嫨鎶曚繚绫诲瀷' }
+ ]
+ },
+ list: [],
+ shops: [],
+ company: []
}
+ },
+ created () {
+ this.config({
+ api: '/business/solutions',
+ 'field.id': 'id'
+ })
+ },
+ methods: {
+ changeParent(e) {
+ let name = this.list.filter(item => {
+ if (e === item.id) {
+ return item.name
+ }
+ })
+ this.form.name = name[0].name
+ },
+ async getList() {
+ this.list = await list({})
+ },
+ changeTimeUnit () {
+ if (this.form.timeUnit < this.form.insureCycleUnit) {
+ this.form.insureCycleUnit = null
+ }
+ },
+ editFanganFile (data) {
+ this.form.fanganFile = data
+ },
+ // 纭鏂板缓/淇敼
+ confirm () {
+ const data = JSON.parse(JSON.stringify(this.form))
+ this.$refs.form.validate((valid) => {
+ if (!valid) {
+ return
+ }
+ if (data.type === 1 && (!data.fanganFile || !data.fanganFile.fileurl)) {
+ this.$message.error('璇蜂笂浼犳柟妗堢‘璁や功锛�')
+ return
+ }
+ // 璋冪敤鏂板缓鎺ュ彛
+ this.isWorking = true
+ if (data.id == null || data.id === '') {
+ this.api.create(data)
+ .then(() => {
+ this.visible = false
+ this.$tip.apiSuccess('鏂板缓鎴愬姛')
+ this.$emit('success')
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ this.isWorking = false
+ })
+ } else {
+ this.api.updateById(data)
+ .then(() => {
+ this.visible = false
+ this.$tip.apiSuccess('淇敼鎴愬姛')
+ this.$emit('success')
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ this.isWorking = false
+ })
+ }
+ })
+ },
+ deleFile () {
+ this.form.fanganFile = {}
+ },
+ open (title, target) {
+ this.title = title
+ this.visible = true
+ this.form.timeUnit = ''
+ this.form.insureCycleUnit = ''
+ this.form.fanganFile = null
+ this.form.fileList1 = []
+ this.allCompany()
+ this.allShops()
+ this.getList()
+ // 鏂板缓
+ if (target == null) {
+ this.$nextTick(() => {
+ this.$refs.form.resetFields()
+ this.form.timeUnit = ''
+ this.form.insureCycleUnit = ''
+ this.form.fanganFile = null
+ this.form.fileList1 = []
+ this.form[this.configData['field.id']] = null
+ })
+ return
+ }
+ // 缂栬緫
+ this.$nextTick(() => {
+ solutionsId(target.id)
+ .then(res => {
+ for (const key in this.form) {
+ this.form[key] = res[key]
+ }
+ if (this.form.fanganFile && this.form.fanganFile.fileurl) {
+ this.form.fileList1 = [{ url: this.form.fanganFile.fileurlFull, name: this.form.fanganFile.name }]
+ }
+ })
+ })
+ },
+ // 鏌ヨ鍏ㄩ儴淇濋櫓鍏徃
+ allCompany () {
+ all({ dataType: 2, status: 0 })
+ .then(res => {
+ this.company = res
+ })
+ },
+ allShops () {
+ shopList({ type: 1, status: 0 })
+ .then(res => {
+ this.shops = res
+ })
+ }
+ }
+}
</script>
--
Gitblit v1.9.3