Commit 1fce0f73 by 杨北旺

模拟数据方便处理业务逻辑

1 parent 545b0f65
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="glsx-combi-form"> <div class="glsx-combi-form">
<el-form :ref="formRef" :inline="true" :model="formObj" :rules="formRules" size="small" class="glsx-combi-form-block"> <el-form :ref="formRef" :inline="true" :model="formObj" :rules="formRules" size="small" class="glsx-combi-form-block">
<template v-for="(item, index) in formData"> <template v-for="(item, index) in formData">
<el-form-item v-if="!item.isHide" :key="index" :id="item.name" :labelWidth="isEdit ? '144px' : labelWidth" :class="{ 'no-label': !item.label, isBlock: isBlock }" :style="{ 'margin-bottom': isEdit ? '24px' : '', 'margin-right': isEdit ? '0px': '30px', ...item.style }" :label="item.label" :prop="item.name"> <el-form-item v-if="!item.isHide" :key="index" :id="item.name" :labelWidth="isEdit ? '144px' : labelWidth" :class="{ 'no-label': !item.label, isBlock: isBlock }" :style="{ 'margin-bottom': isEdit ? '24px' : '', 'margin-right': isEdit ? '0px' : '30px', ...item.style }" :label="item.label" :prop="item.name">
<span v-if="!item.isHide && item.tips" class="tips-block" slot="label"> <span v-if="!item.isHide && item.tips" class="tips-block" slot="label">
<span class="tips-label">{{ item.label }}</span> <span class="tips-label">{{ item.label }}</span>
<el-tooltip popper-class="tooltip-class" effect="dark" :content="item.tips" :placement="item.placement || 'top'"> <el-tooltip popper-class="tooltip-class" effect="dark" :content="item.tips" :placement="item.placement || 'top'">
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
{{ item.label }} {{ item.label }}
</span> </span>
<span v-else-if="!item.isHide && item.label" slot="label"> <span v-else-if="!item.isHide && item.label" slot="label">
<span class="combi-form-label" :style="{ width: item.labelWidth ? (item.labelWidth + labelPaddingRight) + 'px' : '', 'padding-right': isEdit ? '12px' : (labelPaddingRight + 'px') }">{{ item.label }}</span> <span class="combi-form-label" :style="{ width: item.labelWidth ? item.labelWidth + labelPaddingRight + 'px' : '', 'padding-right': isEdit ? '12px' : labelPaddingRight + 'px' }">{{ item.label }}</span>
</span> </span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot> <slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<div v-else-if="item.type === 'input'"> <div v-else-if="item.type === 'input'">
<el-input :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || defaultWidth }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)" > <el-input @change="item.inputChange" :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || defaultWidth }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)">
<span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span> <span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span>
<span v-if="item.append" slot="append">{{ item.append }}</span> <span v-if="item.append" slot="append">{{ item.append }}</span>
</el-input> </el-input>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</div> </div>
<!-- 选择-输入框 --> <!-- 选择-输入框 -->
<el-input v-else-if="item.type === 'selectInput'" :placeholder="'请输入' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label" :maxlength="item.maxlength" v-model.trim="searchSelectObj[item.selectName].value" :clearable="item.isClear || false" :style="{ width: item.inputWidth || defaultWidth }" class="input-with-select"> <el-input v-else-if="item.type === 'selectInput'" :placeholder="'请输入' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label" :maxlength="item.maxlength" v-model.trim="searchSelectObj[item.selectName].value" :clearable="item.isClear || false" :style="{ width: item.inputWidth || defaultWidth }" class="input-with-select">
<el-select v-model="searchSelectObj[item.selectName].attr" :style="{ width: item.selectWidth || (labelWidth + 'px') }" slot="prepend" placeholder="请选择" @change="item.handleSelectChange"> <el-select v-model="searchSelectObj[item.selectName].attr" :style="{ width: item.selectWidth || labelWidth + 'px' }" slot="prepend" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option> <el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select> </el-select>
</el-input> </el-input>
...@@ -95,6 +95,8 @@ ...@@ -95,6 +95,8 @@
</template> </template>
<slot :name="item.suffixSlot" :scope="item"></slot> <slot :name="item.suffixSlot" :scope="item"></slot>
</template> </template>
<!-- 省市区 -->
<el-cascader v-else-if="item.type === 'cascader'" filterable :disabled="item.isDisabled" ref="cascader" :style="{ width: item.width || defaultWidth }" :clearable="item.isClear || false" placeholder="请选择省/请选择市/请选择区" size="small " :options="regionData" v-model="formObj[item.name]" @change="item.handleChange"></el-cascader>
</el-form-item> </el-form-item>
</template> </template>
<slot name="footer"></slot> <slot name="footer"></slot>
...@@ -102,7 +104,7 @@ ...@@ -102,7 +104,7 @@
<el-dialog v-if="isImgVisible" title="查看" :visible.sync="isImgVisible"> <el-dialog v-if="isImgVisible" title="查看" :visible.sync="isImgVisible">
<div class="dialog-look"> <div class="dialog-look">
<video v-if="dialogObj.uploadType == 'video'" class="dialog-video" controls> <video v-if="dialogObj.uploadType == 'video'" class="dialog-video" controls>
<source :src="dialogObj.url" type="video/mp4"> <source :src="dialogObj.url" type="video/mp4" />
</video> </video>
<img v-else class="dialog-img" width="100%" :src="dialogObj.url" alt="" /> <img v-else class="dialog-img" width="100%" :src="dialogObj.url" alt="" />
</div> </div>
...@@ -112,6 +114,7 @@ ...@@ -112,6 +114,7 @@
<script> <script>
import { beforeRangePickerOptions, afterRangePickerOptions } from './common' import { beforeRangePickerOptions, afterRangePickerOptions } from './common'
import cityList from '../../common/city'
export default { export default {
name: 'glsx-combi-form', name: 'glsx-combi-form',
data() { data() {
...@@ -124,7 +127,8 @@ export default { ...@@ -124,7 +127,8 @@ export default {
dialogObj: { dialogObj: {
url: '', url: '',
uploadType: 'img' uploadType: 'img'
} },
regionData: cityList
} }
}, },
...@@ -353,7 +357,7 @@ export default { ...@@ -353,7 +357,7 @@ export default {
.glsx-combi-form .activity-img { .glsx-combi-form .activity-img {
position: relative; position: relative;
color: #999999; color: #999999;
background-color: #F7F7F7; background-color: #f7f7f7;
border: 1px dotted #d9d9d9; border: 1px dotted #d9d9d9;
cursor: pointer; cursor: pointer;
} }
...@@ -433,16 +437,16 @@ export default { ...@@ -433,16 +437,16 @@ export default {
/* 图片上传 */ /* 图片上传 */
.glsx-combi-form .el-tag.el-tag--info .el-tag__close { .glsx-combi-form .el-tag.el-tag--info .el-tag__close {
color: #E8E8EA; color: #e8e8ea;
background-color: #5850ff !important; background-color: #5850ff !important;
} }
.glsx-combi-form .el-tag.el-tag--info { .glsx-combi-form .el-tag.el-tag--info {
border-color: #5850ff; border-color: #5850ff;
} }
.glsx-combi-form .el-tag--plain.el-tag--info .el-tag__close:hover { .glsx-combi-form .el-tag--plain.el-tag--info .el-tag__close:hover {
background-color: #E8E8EA; background-color: #e8e8ea;
} }
.glsx-combi-form .el-tag.el-tag--info .el-tag__close:hover { .glsx-combi-form .el-tag.el-tag--info .el-tag__close:hover {
background-color: #E8E8EA; background-color: #e8e8ea;
} }
</style> </style>
...@@ -85,7 +85,7 @@ const staticRoutes = Object.freeze([ ...@@ -85,7 +85,7 @@ const staticRoutes = Object.freeze([
}, },
{ {
name: 'order', name: 'order',
path: '/claims/order', path: '/claims/order/:id',
component: resolve => require([`@/views/claims/order.vue`], resolve), component: resolve => require([`@/views/claims/order.vue`], resolve),
meta: {} meta: {}
} }
......
<template>
<div class="city-select-components">
<el-cascader :disabled="isDisabled" ref="cascader" style="width:320px" placeholder="请选择省/请选择市/请选择区" size="small " :options="regionData" v-model="selectedOptions" @change="handleChange"></el-cascader>
</div>
</template>
<script>
import cityList from '../../../common/city'
export default {
name: '',
data() {
return {
regionData: cityList,
selectedOptions: ''
}
},
props: {
isDisabled: {
type: Boolean,
default: false
}
},
methods: {
handleChange(e) {
let nodesInfo = this.$refs.cascader.getCheckedNodes()[0].pathLabels
let newObj = {
value: e,
label: nodesInfo
}
this.$emit('onChange', newObj)
}
}
}
</script>
<style lang="scss" scoped>
.city-select-components /deep/ .el-cascader-panel {
height: 250px !important;
}
</style>
<template> <template>
<div class="report-components"> <div class="report-components">
<div class="title">报案信息(客户提交)</div> <div class="title">报案信息(客户提交)</div>
<glsxCombiForm class="edit-form-container " ref="editFormRefReport" labelWidth="144px" defaultWidth="320px" formRef="editRefReport" :formObj="editForm" :formData="editFormData"> <glsxCombiForm class="edit-form-container " ref="editFormRefReport" labelWidth="144px" defaultWidth="320px" formRef="editRefReport" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsxCombiForm>
<template slot="citySelect">
<city-select :isDisabled="pageType == 'add' ? false : true" @onChange="selectAddress"></city-select>
</template>
</glsxCombiForm>
</div> </div>
</template> </template>
<script> <script>
import glsxCombiForm from '@/components/glsx-combi-form' import glsxCombiForm from '@/components/glsx-combi-form'
import citySelect from './citySelect.vue'
export default { export default {
name: '', name: '',
components: { components: {
glsxCombiForm, glsxCombiForm
'city-select': citySelect
}, },
props: { props: {
editForm: Object, editForm: Object,
pageType: { pageType: {
type: String, type: Number,
default: 'add' //add为新增 look为查看加编辑 default: 1 // 1.新增 2.查看 3.重新提交 4.去处理
} }
}, },
data() { data() {
return { return {
editFormData: [], editFormData: [],
showGh: false showGh: false,
editRule: {
contractNo: [{ required: true, message: '请输入合同号', trigger: 'change' }],
reportDate: [{ required: true, message: '请选择报案日期', trigger: 'change' }],
reimbursementDate: [{ required: true, message: '请选择出险日期', trigger: 'change' }],
reportName: [{ required: true, message: '请输入报案人', trigger: 'change' }],
reportPhone: [{ required: true, message: '请输入报案人联系号码', trigger: 'change' }],
reimbursementAddress: [{ required: true, message: '请选择出险地点', trigger: 'change' }]
}
} }
}, },
created() { created() {
this.diffHost() this.diffHost()
}, },
methods: { methods: {
selectAddress(e) {
this.editForm.reimbursementAddress = e.label.join('')
},
// 从域名判断是不是广汇的 // 从域名判断是不是广汇的
diffHost() { diffHost() {
let href = window.location.host let href = window.location.host
...@@ -50,14 +49,18 @@ export default { ...@@ -50,14 +49,18 @@ export default {
}, },
// 处理广汇嘀加不同字段显示 // 处理广汇嘀加不同字段显示
diffKeyHandle(showGh) { diffKeyHandle(showGh) {
const isDisabled = this.pageType == 'add' ? false : true const isDisabled = this.pageType == 2 ? true : false
const dj = [ const dj = [
{ {
label: '合同号', label: '合同号',
name: 'contractNo', name: 'contractNo',
type: 'input', type: 'input',
maxlength: 100, maxlength: 100,
isDisabled isDisabled,
isClear: true,
inputChange: e => {
this.toSearchOrderDetail(e, showGh)
}
}, },
{ {
label: '报案日期', label: '报案日期',
...@@ -66,7 +69,8 @@ export default { ...@@ -66,7 +69,8 @@ export default {
dateType: 'datetime', dateType: 'datetime',
valueFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd',
pickerOptions: 'afterTodayRangePickerOptions', pickerOptions: 'afterTodayRangePickerOptions',
isDisabled isDisabled,
isClear: true
}, },
{ {
label: '出险日期', label: '出险日期',
...@@ -75,27 +79,38 @@ export default { ...@@ -75,27 +79,38 @@ export default {
dateType: 'datetime', dateType: 'datetime',
valueFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd',
pickerOptions: 'afterTodayRangePickerOptions', pickerOptions: 'afterTodayRangePickerOptions',
isDisabled isDisabled,
isClear: true
}, },
{ {
label: '出险地点', label: '出险地点',
name: 'reimbursementAddress', name: 'reimbursementAddress',
addHtml: 'citySelect', type: 'cascader',
isDisabled isDisabled,
isClear: true,
handleChange: cellValue => {
if (!cellValue || !cellValue.length) {
return
}
let nodesInfo = this.$refs.editFormRefReport.$refs.cascader[0].getCheckedNodes()[0].pathLabels
this.currentAddress = nodesInfo
}
}, },
{ {
label: '报案人', label: '报案人',
name: 'reportName', name: 'reportName',
type: 'input', type: 'input',
maxlength: 100, maxlength: 100,
isDisabled isDisabled,
isClear: true
}, },
{ {
label: '报案人联系号码', label: '报案人联系号码',
name: 'reportPhone', name: 'reportPhone',
type: 'input', type: 'input',
maxlength: 11, maxlength: 11,
isDisabled isDisabled,
isClear: true
} }
] ]
const gh = [ const gh = [
...@@ -104,7 +119,11 @@ export default { ...@@ -104,7 +119,11 @@ export default {
name: 'writeOffCode', name: 'writeOffCode',
type: 'input', type: 'input',
maxlength: 8, maxlength: 8,
isDisabled isDisabled,
isClear: true,
inputChange: e => {
this.toSearchOrderDetail(e, showGh)
}
}, },
{ {
label: '报案日期', label: '报案日期',
...@@ -113,7 +132,8 @@ export default { ...@@ -113,7 +132,8 @@ export default {
dateType: 'datetime', dateType: 'datetime',
valueFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd',
pickerOptions: 'afterTodayRangePickerOptions', pickerOptions: 'afterTodayRangePickerOptions',
isDisabled isDisabled,
isClear: true
}, },
{ {
label: '出险日期', label: '出险日期',
...@@ -122,30 +142,50 @@ export default { ...@@ -122,30 +142,50 @@ export default {
dateType: 'datetime', dateType: 'datetime',
valueFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd',
pickerOptions: 'afterTodayRangePickerOptions', pickerOptions: 'afterTodayRangePickerOptions',
isDisabled isDisabled,
isClear: true
}, },
{ {
label: '出险地点', label: '出险地点',
name: 'reimbursementAddress', name: 'reimbursementAddress',
addHtml: 'citySelect', type: 'cascader',
isDisabled isDisabled,
isClear: true,
handleChange: cellValue => {
if (!cellValue || !cellValue.length) {
return
}
let nodesInfo = this.$refs.editFormRefReport.$refs.cascader[0].getCheckedNodes()[0].pathLabels
this.editForm.reimbursementAddress = nodesInfo.join('')
}
}, },
{ {
label: '报案人', label: '报案人',
name: 'reportName', name: 'reportName',
type: 'input', type: 'input',
maxlength: 100, maxlength: 100,
isDisabled isDisabled,
isClear: true
}, },
{ {
label: '报案人联系号码', label: '报案人联系号码',
name: 'reportPhone', name: 'reportPhone',
type: 'input', type: 'input',
maxlength: 11, maxlength: 11,
isDisabled isDisabled,
isClear: true
} }
] ]
this.editFormData = showGh ? gh : dj this.editFormData = showGh ? gh : dj
},
// 查询订单详情信息(嘀加:合同号,广汇:核销码)
toSearchOrderDetail(value, isGH) {
let param = {}
param.contractNo = value
if (isGH) {
param.writeOffCode = value
}
console.log(param)
} }
} }
} }
......
...@@ -19,17 +19,32 @@ export default { ...@@ -19,17 +19,32 @@ export default {
reimbursementDate: '', reimbursementDate: '',
reimbursementAddress: '', reimbursementAddress: '',
reportName: '', reportName: '',
reportPhone: '' reportPhone: '',
writeOffCode: ''
}, },
pageType: 'add' pageType: 1
} }
}, },
created() {}, created() {
const urlParam = this.$route.params
const urlQuery = JSON.parse(decodeURIComponent(urlParam.id))
this.pageType = urlQuery.editNo
this.routeInfo = urlQuery
this.handleFormInfo(urlQuery.contractNo, urlQuery.isGH)
},
mounted() {}, mounted() {},
methods: { methods: {
// 处理表单数据 // 处理表单数据
handlerForm() { handlerForm() {
console.log(this.editForm) console.log(this.editForm)
},
// 根据页面跳转参数处理表单信息-自动填入
// 步骤流程:拿到核销码/者合同号后==》请求接口获取该合同号/核销码下对应的套餐,下发数据到维修信息模块,上传资料模块,报案信息模块
handleFormInfo(contractNo, isGH) {
if (isGH) {
this.editForm.writeOffCode = contractNo
}
this.editForm.contractNo = contractNo
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!