From ff95e73d12418ee4b1e400eaceac3d4d623f85b6 Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期五, 29 三月 2024 18:44:04 +0800
Subject: [PATCH] 提交一把
---
company/src/components/business/OperaSolutionsWindow.vue | 409 +++++++++++++++++++++++++++++++--------------------------
1 files changed, 223 insertions(+), 186 deletions(-)
diff --git a/company/src/components/business/OperaSolutionsWindow.vue b/company/src/components/business/OperaSolutionsWindow.vue
index 55ea177..c48dbfe 100644
--- a/company/src/components/business/OperaSolutionsWindow.vue
+++ b/company/src/components/business/OperaSolutionsWindow.vue
@@ -85,6 +85,19 @@
<el-radio :label="1">濮旀墭鎶曚繚</el-radio>
</el-radio-group>
</el-form-item>
+ <el-form-item label="濮旀墭鍟嗘埛" prop="shopId" v-if="form.type =='1'">
+ <el-select v-model="form.shopId" 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="fanganFile" v-if="form.type =='1'">
+ <UploadFile :uploadData="{ folder: 'apply',fileType:'.pdf' }" :fileList="form.fileList1" @uploadSuccess="editFanganFile" />
+ </el-form-item>
<el-form-item label="鎺ユ敹鏂囦欢閭" prop="email">
<el-input v-model="form.email" placeholder="璇疯緭鍏�" v-trim/>
</el-form-item>
@@ -141,191 +154,215 @@
</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: false, 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 { all as allWorktype } from '@/api/business/worktype'
+import { solutionsId } from '@/api/business/solutions'
+import { pageAll as shopList } from '@/api/business/company'
+import UploadFile from "@/components/common/UploadFile";
+export default {
+ name: 'OperaSolutionsWindow',
+ extends: BaseOpera,
+ components: { GlobalWindow ,UploadFile},
+ data () {
+ var validType = (rule, value, callback) => {
+ if (this.form.validType === 0 && !value) {
+ return callback(new Error('寤惰繜澶╂暟涓嶈兘涓虹┖'))
+ } else if (this.form.validType === 0 && !/^[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: '',
+ shopId: null,
+ insureCycle: '',
+ insureCycleUnit: '',
+ email: '',
+ specialAgreement: '',
+ specialInfo: '',
+ ortherInfo: '',
+ signKeyword: '',
+ validTypeNum: '',
+ fileList1:[],
+ fanganFile:null,
+ 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: false, message: '璇疯緭鍏ユ姇淇濆崟绛剧珷鍏抽敭瀛�' }
+ // ]
+ },
+ shops: [],
+ company: [],
+ typeWork: []
+ }
+ },
+ created () {
+ this.config({
+ api: '/business/solutions',
+ 'field.id': 'id'
+ })
+ },
+ methods: {
+ editFanganFile(data){
+ this.form.fanganFile=data
+ },
+ // 鍒囨崲鍏徃
+ getAllWorktype1 () {
+ this.form.worktypeIdList = [{ worktypeId: '' }]
+ this.getAllWorktype()
+ },
+ // 纭鏂板缓/淇敼
+ confirm () {
+ const 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.fanganFile=null
+ this.form.fileList1= new Array();
+ this.form.worktypeIdList = [{ worktypeId: '' }]
+ // this.$refs['$upload'].clearFiles()//鍒濆鍖栧鍏ョ粍浠�
+ this.allCompany()
+ this.allShops()
+ // 鏂板缓
+ 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]
+ }
+ if(this.form.fanganFile && this.form.fanganFile.fileurl){
+ this.form.fileList1= [{url: this.form.fanganFile.fileurlFull, name:this.form.fanganFile.name}];
+ }
+ console.log(this.form.fileList1)
+ 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
+ })
+ },
+ allShops () {
+ shopList({ type: 1, status: 0 })
+ .then(res => {
+ console.log(res)
+ this.shops = 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)
+ }
+ }
+}
</script>
--
Gitblit v1.9.3