From 8b46c471e28fbf0b71efbe363facf0bf05d8f6f8 Mon Sep 17 00:00:00 2001 From: nidapeng <jp@doumee.com> Date: 星期四, 14 三月 2024 18:12:30 +0800 Subject: [PATCH] aaa --- company/src/components/business/OperaSolutionsWindow.vue | 393 +++++++++++++++++++++++++++++-------------------------- 1 files changed, 207 insertions(+), 186 deletions(-) diff --git a/company/src/components/business/OperaSolutionsWindow.vue b/company/src/components/business/OperaSolutionsWindow.vue index 82eca81..b123011 100644 --- a/company/src/components/business/OperaSolutionsWindow.vue +++ b/company/src/components/business/OperaSolutionsWindow.vue @@ -85,6 +85,16 @@ <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="email"> <el-input v-model="form.email" placeholder="璇疯緭鍏�" v-trim/> </el-form-item> @@ -141,191 +151,202 @@ </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 (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: '', - 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' +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 (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: '', + 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: { + // 鍒囨崲鍏徃 + 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.worktypeIdList = [{ worktypeId: '' }] + 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] + } + 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