Commit 1222faf9 by 张权

合并资料

1 parent 627da615
import GlCombiForm from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GlCombiForm.install = function(Vue) {
Vue.component(GlCombiForm.name, GlCombiForm)
}
// 默认导出组件
export default GlCombiForm
\ No newline at end of file
/**
* 时间控件-限制月份
*/
export const beforeRangePickerOptions = {
disabledDate(date) {
if (date > new Date()) {
return true
}
return false
}
}
export const afterRangePickerOptions = {
disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
if (date < yesterday) {
return true
}
return false
}
}
import GLSearch from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLSearch.install = function(Vue) {
Vue.component(GLSearch.name, GLSearch)
}
// 默认导出组件
export default GLSearch
\ No newline at end of file
<!-- <content> -->
<GLSearch @onOk="handleOkFn" @onRest="handleRestFn">
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-input size="small" v-model="input" placeholder="请输入内容"></el-input>
</GLSearchItem>
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-select v-model="value" size="small" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</GLSearchItem>
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-date-picker size="small" v-model="value1" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</GLSearchItem>
<GLSearchItem>
<el-select v-model="selvalue" placeholder="请选择" size="small" slot="name">
<el-option v-for="item in seloptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
<el-input size="small" v-model="input" placeholder="请输入内容"></el-input>
</GLSearchItem>
</GLSearch>
<el-button type="warning" @click="toggleShow(1)">显示代码</el-button>
```js {mixin:true}
{
data() {
return {
demo1: true,
//gl-search数据
input: '',
options: [
{
value: '选项1',
label: '黄金糕'
},
{
value: '选项2',
label: '双皮奶'
},
{
value: '选项3',
label: '蚵仔煎'
},
{
value: '选项4',
label: '龙须面'
},
{
value: '选项5',
label: '北京烤鸭'
}
],
value: '',
value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
seloptions: [
{
value: '选项1',
label: '黄金糕'
},
{
value: '选项2',
label: '双皮奶'
},
{
value: '选项3',
label: '蚵仔煎北京烤鸭'
},
{
value: '选项4',
label: '龙须面北京烤鸭'
},
{
value: '选项5',
label: '北京烤鸭北京烤鸭'
}
],
selvalue: ''
}
},
methods:{
toggleShow(num){
// console.log(123)
this['demo' + num] = !this['demo' + num]
},
//gl-search 方法
handleOkFn() {
console.log('您点击了确定')
},
handleRestFn() {
console.log('您点击了取消')
}
}
}
```
# 用来作为 markdown 代码的示例部分
<div v-if="demo1">
```vue
<template>
<GLSearch @onOk="handleOkFn" @onRest="handleRestFn">
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-input size="small" v-model="input" placeholder="请输入内容"></el-input>
</GLSearchItem>
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-select v-model="value" size="small" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</GLSearchItem>
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-date-picker size="small" v-model="value1" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</GLSearchItem>
<GLSearchItem>
<el-select v-model="selvalue" placeholder="请选择" size="small" slot="name">
<el-option v-for="item in seloptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
<el-input size="small" v-model="input" placeholder="请输入内容"></el-input>
</GLSearchItem>
</GLSearch>
</template>
<script>
import {GLSearch, GLSearchItem} from 'glsx-components'
// 全局引入一次css即可
import 'glsx-components/dist/glsx-components.css'
export default {
data() {
return {
//gl-search数据
input: '',
options: [
{
value: '选项1',
label: '黄金糕'
},
{
value: '选项2',
label: '双皮奶'
},
{
value: '选项3',
label: '蚵仔煎'
},
{
value: '选项4',
label: '龙须面'
},
{
value: '选项5',
label: '北京烤鸭'
}
],
value: '',
value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
seloptions: [
{
value: '选项1',
label: '黄金糕'
},
{
value: '选项2',
label: '双皮奶'
},
{
value: '选项3',
label: '蚵仔煎北京烤鸭'
},
{
value: '选项4',
label: '龙须面北京烤鸭'
},
{
value: '选项5',
label: '北京烤鸭北京烤鸭'
}
],
selvalue: ''
}
},
methods: {
handleOkFn() {
console.log('您点击了确定')
},
handleRestFn() {
console.log('您点击了取消')
}
}
}
</script>
```
</div>
<!-- </content> -->
<template>
<div class="gl-search" id="gl-search" :class="{ transTo: !expand }">
<div class="search-list">
<!-- 默认插槽 -->
<slot></slot>
<!-- <div class="search-item">
<div class="name">我是文本输入框</div>
<div class="input">
<el-input
size="small"
v-model="input"
placeholder="请输入内容"
></el-input>
</div>
</div> -->
<!-- <div class="search-item">
<div class="name">我是文本输入框</div>
<div class="input">
<el-input
size="small"
v-model="input"
placeholder="请输入内容"
></el-input>
</div>
</div> -->
<!-- <div class="search-item">
<div class="name">我是文本输入框</div>
<div class="input">
<el-input
size="small"
v-model="input"
placeholder="请输入内容"
></el-input>
</div>
</div>
<div class="search-item">
<div class="name">我是文本输入框</div>
<div class="input">
<el-input
size="small"
v-model="input"
placeholder="请输入内容"
></el-input>
</div>
</div> -->
</div>
<div class="gl-operate">
<div class="operate">
<el-button size="small" type="primary" @click="handleOk">查询</el-button>
<el-button size="small" @click="handleRest">重置</el-button>
<el-button type="text" size="small" @click="expandFn" v-if="hasExpand">
<span>{{ !expand ? '展开' : '收起' }}</span>
<i class="expand" :class="classIcon"></i>
</el-button>
<!-- <i class="el-icon-arrow-down expand"></i> -->
<!-- <i class="el-icon-arrow-up"></i> -->
</div>
</div>
</div>
</template>
<script>
export default {
name: 'GLSearch',
props: {},
data() {
return {
// input: '',
expand: false,
itemNum: 0,
time: null,
hasExpand: false
}
},
created() {},
mounted() {
this.getItemNum()
// 判断宽度按,是否显示展开收起
this.getClientWith()
window.addEventListener('resize', this.getClientWith, false)
},
computed: {
classIcon() {
return !this.expand ? 'el-icon-arrow-down' : 'el-icon-arrow-up'
}
},
methods: {
// 展开收起
expandFn() {
this.expand = !this.expand
},
// 获取item 输入框 的个数
getItemNum() {
const items = document.getElementById('gl-search').getElementsByClassName('search-item').length
this.itemNum = items
},
// 判断是否有展开收起标志
ifHasExpand(nowCol) {
if (this.itemNum > nowCol) {
return true
}
return false
},
// 监听函数
getClientWith() {
if (this.time) clearTimeout(this.time)
this.time = setTimeout(() => {
const clientWidth = document.documentElement.clientWidth
// console.log('clientWidth: ', clientWidth)
if (clientWidth <= 800) {
// 1列
this.hasExpand = this.ifHasExpand(1)
} else if (clientWidth <= 1440 && clientWidth > 800) {
// 2列
this.hasExpand = this.ifHasExpand(2)
} else if (clientWidth <= 1720 && clientWidth > 1440) {
// 3列
this.hasExpand = this.ifHasExpand(3)
} else {
// 4列
this.hasExpand = this.ifHasExpand(4)
}
}, 300)
},
handleOk() {
// 点击确定的回调
this.$emit('onOk')
},
handleRest() {
// 点击重置的回调
this.$emit('onRest')
}
},
components: {},
watch: {},
beforeDestroy() {
window.removeEventListener('resize', this.getClientWith, false)
this.time = null
}
}
</script>
<style lang="scss">
.gl-search {
&.transTo {
height: 52px;
}
display: flex;
justify-content: space-between;
overflow: hidden;
// @media screen and (max-width: 1062px) {
// .search-list {
// .search-item {
// width: 100%;
// }
// }
// }
// @media screen and (min-width: 1062px) and (max-width: 1440px) {
// .search-list {
// .search-item {
// width: 100%;
// }
// }
// }
// @media screen and (min-width: 1440px) and (max-width: 1720px) {
// .search-list {
// .search-item {
// width: 100%;
// }
// }
// }
// @media screen and (min-width: 1720px) {
// .search-list {
// .search-item {
// width: 100%;
// }
// }
// }
.search-list {
.search-item {
width: 100%;
}
}
.search-list {
flex: 1;
display: flex;
flex-wrap: wrap;
.search-item {
// flex: 1;
// padding-right: 12px;
margin-bottom: 20px;
min-width: 276px;
display: flex;
align-items: center;
box-sizing: border-box;
.name {
width: 112px;
text-align: right;
font-size: 14px;
font-weight: 400;
color: #666;
}
.input {
flex: 1;
// width:100%;
}
.el-input {
width: 100%;
}
.el-select {
width: 100%;
}
.el-date-editor {
width: 100%;
}
}
}
.gl-operate {
display: flex;
align-items: flex-end;
.operate {
text-align: left;
width: 190px;
margin-bottom: 20px;
.expand {
font-size: 14px;
}
.el-button + .el-button {
margin-left: 8px;
}
}
}
}
</style>
import GLSearchItem from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLSearchItem.install = function(Vue) {
Vue.component(GLSearchItem.name, GLSearchItem)
}
// 默认导出组件
export default GLSearchItem
\ No newline at end of file
<template>
<div :style="{ 'padding-right': spacer + 'px' }" class="search-item">
<div class="name">
<!-- {{ label }} -->
<!-- name 插槽 -->
<slot name="name"></slot>
</div>
<div class="input">
<!-- 默认插槽 -->
<slot></slot>
<!-- <el-input
size="small"
v-model="input"
placeholder="请输入内容"
></el-input> -->
</div>
</div>
</template>
<script>
export default {
name: 'GLSearchItem',
props: {
// 每个项间隙
spacer: {
type: Number,
default: 12
}
},
data () {
return {}
},
created () {},
mounted () {},
computed: {},
methods: {},
components: {},
watch: {}
}
</script>
......@@ -2,6 +2,9 @@ import Vue from 'vue'
import { message, messageBox } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton, GLTable } from 'glsx-components' //权限按钮 (根据权限动态创建)
import GLCombiForm from '@/components/GlCombiForm'
import GlSearch from '@/components/GlSearch'
import GlSearchItem from '@/components/GlSearchItem'
import { getRoutes } from '@/router'
import render from './render'
import 'glsx-components/dist/glsx-components.css'
......@@ -12,10 +15,13 @@ let instance = null
Vue.use(GLTable)
// Vue.use(Table)
// Vue.use(TableColumn)
Vue.use(GLCombiForm)
Vue.use(GlSearch)
Vue.use(GlSearchItem)
export async function bootstrap({ history, common, messenger, globalState, routerBase }) {
const { response, request, request_brand, sign, secret } = await fetchConfig()
// request.baseURL = 'https://scrm.test.glsx.com.cn'
// request_brand.baseURL = 'https://scrm.test.glsx.com.cn'
request.baseURL = 'https://scrm.test.glsx.com.cn'
request_brand.baseURL = 'https://scrm.test.glsx.com.cn'
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
......
<template>
<div class="report-components">
<div class="title">上传资料</div>
<glsxCombiForm class="edit-form-container" ref="materialRef" labelWidth="144px" defaultWidth="320px" :formObj="materialForm" :formData="materialData"></glsxCombiForm>
</div>
</template>
<script>
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: '',
components: {
glsxCombiForm
},
// props: {
// materialForm: Object
// },
data() {
return {
materialForm: {
cardInfo: '',
billInfo: '',
otherInfo: ''
},
materialData: [
{
label: '身份证',
name: 'cardInfo',
type: 'upload'
},
{
label: '发票',
name: 'billInfo',
type: 'upload'
},
{
label: '其他',
name: 'otherInfo',
type: 'upload'
}
]
}
},
methods: {}
}
</script>
<style lang="scss" scoped>
.report-components {
background: white;
.title {
padding: 0 20px;
font-size: 16px;
font-weight: bold;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
}
.edit-form-container {
margin-top: 20px;
}
}
</style>
<template>
<div>
<div class="report-components">
<div class="title">报案信息(店面补充)</div>
<glsx-combi-form class="edit-form-container" ref="handlerRef" :formRules="accountRule" labelWidth="144px" defaultWidth="320px" :formObj="accountForm" :formData="handlerForm"></glsx-combi-form>
</div>
<div class="report-components">
<div class="title">维修信息</div>
<div>
<div>
<label for="">批准金额:</label>
<div class="service-wrap">
<div class="service-item" v-for="item in equityList" :key="item.name">
<p>{{ item.name }}</p>
<div class="price">
<label for="">定损批准金额:</label>
<el-input placeholder="请选择定损批准金额" v-model="item.price"></el-input>
</div>
</div>
</div>
</div>
<div>
<label for="">合计:</label>
<span>定损批准金额:{{ totalPrice }}元</span>
</div>
<div>
<label for="">收款对象:</label>
<el-radio v-model="accountForm.collectOwner" label="business">店面</el-radio>
<el-radio v-model="accountForm.collectOwner" label="other">其他</el-radio>
</div>
<div class="account-info">
<glsx-combi-form ref="accountRef" :formRules="accountRule" labelWidth="144px" defaultWidth="320px" :formObj="accountForm" :formData="accountData">
<template slot="collectCity">
<city-select @onChange="selectAddress"></city-select>
</template>
</glsx-combi-form>
</div>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import citySelect from './citySelect.vue'
import glsxCombiForm from '@/components/glsx-combi-form'
const phoneReg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
export default {
name: 'repair',
props: {
accountForm: Object
},
components: {
glsxCombiForm,
citySelect,
},
data() {
return {
accountData:[
{
label: '账户类型',
name: 'accountType',
type: 'radio',
optionList: [
{
confId:'company',
confName:'对公'
},
{
confId:'personal',
confName:'对私'
}
],
optionId: 'confId',
optionLabel: 'confName'
},
{
label: '开户行名称',
name: 'bankName',
type: 'input'
},
{
label: '账户名称',
name: 'collectName',
type: 'input'
},
{
label: '收款账号',
name: 'collectAccount',
type: 'input'
},
{
label: '收款账号所在省市',
name: 'collectCity',
addHtml: 'collectCity'
},
{
label: '收款人证件类型',
name: 'collectCardType',
type: 'select',
optionList: [
{
confId:'IDCard',
confName:'身份证'
},
{
confId:'PassCard',
confName:'统一社会信息代码'
},
],
optionId: 'confId',
optionLabel: 'confName'
},
{
label: '收款人证件号码',
name: 'collectCardNo',
type: 'input',
maxlength: 18,
isClear: true
},
{
label: '收款人联系电话',
name: 'collectPhone',
type: 'input',
maxlength: 11,
isClear: true
},
],
handlerForm: [
{
label: '经办人',
name: 'handlerName',
type: 'input',
isClear: true
},
{
label: '经办人联系号码',
name: 'handlerPhone',
type: 'input',
maxlength: 11,
isClear: true
}
],
accountRule: {
bankName: [{ required: true, message: '请输入开户行名称', trigger: 'change' }],
collectName: [{ required: true, message: '请输入账户名称', trigger: 'change' }],
collectAccount: [{ required: true, message: '请输入收款账号', trigger: 'change' }],
collectCity: [{ required: true, message: '请选择收款账号所在省市', trigger: 'change' }],
collectCardType: [{ required: true, message: '请选择收款人证件类型', trigger: 'change' }],
handlerName: [{ required: true, message: '请输入经办人', trigger: 'change' }],
collectCardNo: [{
required: true,
validator: (rule, value, callback) => {
return value ? callback() : callback(new Error('请输入' + (this.accountForm.collectCardType == 'IDCard' ? '身份证' : '统一社会信息代码')))
}, trigger: 'change'
},
{
validator: (rule, value, callback) => {
return (/[a-zA-Z0-9]{18}/).test(value) ? callback() : callback(new Error('请输入18位数字或字母'))
}, trigger: 'change'
}],
collectPhone: [{ required: true, message: '请输入联系号码', trigger: 'change' },
{
validator: (rule, value, callback) => {
return phoneReg.test(value) ? callback() : callback(new Error('请输入正确的联系号码'))
}, trigger: 'change'
}],
handlerPhone: [
{
required: true,
validator: (rule, value, callback) => {
if (!value) {
callback(new Error('请输入手机号'))
} else if (phoneReg.test(value)) {
callback()
} else {
callback(new Error('请输入正确的手机号'))
}
},
trigger: 'change'
}
],
},
equityList:[
{
name:'huiyuan痊愈',
price: 100
},
{
name:'会员权益',
price: 92
},
{
name:'核赔申请',
price: 65
},
{
name:'定损定损',
price: 63
},
]
}
},
computed:{
totalPrice(){
return this.equityList.reduce(function (prev, cur) {
return prev + (+cur.price)
}, 0);
}
},
mounted() {
},
methods:{
selectAddress(e) {
this.accountForm.collectCity = e.label.join('')
},
getParams(){
return {equityList: this.equityList, totalPrice: this.totalPrice}
},
}
}
</script>
<style lang="scss" scoped>
.report-components {
background: white;
margin-top: 20px;
.title {
padding: 0 20px;
font-size: 16px;
font-weight: bold;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
}
.edit-form-container {
margin-top: 20px;
}
}
.service-wrap {
display: flex;
.service-item {
width: 180px;
height: 64px;
border-radius: 5px;
border: 1px solid #909399;
.price {
display: flex;
align-items: center;
label {
font-size: 12px;
white-space: nowrap;
color: red;
}
}
}
}
/deep/ .account-info {
.el-form-item {
display: block;
}
}
</style>
......@@ -2,14 +2,21 @@
<template>
<div class="app">
<report :editForm.sync="editForm"></report>
<repair ref="repairRef" :accountForm.sync="accountForm"></repair>
<material ref="materialRef" :materialForm.sync="materialForm"></material>
<el-button type="primary" size="small" @click="validAccountInfo">校验</el-button>
</div>
</template>
<script>
import report from './components/report.vue'
import repair from './components/repair.vue'
import material from './components/material.vue'
export default {
name: 'order',
components: {
report
report,
repair,
material
},
data() {
return {
......@@ -20,7 +27,21 @@ export default {
reimbursementAddress: '',
reportName: '',
reportPhone: ''
}
},
accountForm: {
collectOwner: 'business',
accountType: 'company',
bankName: '',
collectName: '',
collectAccount: '',
collectCity: '',
collectCardType: '',
collectCardNo: '',
collectPhone: '',
handlerName: '',
handlerPhone: ''
},
materialForm: {}
}
},
created() {},
......@@ -29,6 +50,14 @@ export default {
// 处理表单数据
handlerForm() {
console.log(this.editForm)
},
validAccountInfo() {
console.log(this.$refs.repairRef)
this.$refs.repairRef.$refs.accountRef.$refs.formRef.validate(valid => {
this.$refs.repairRef.$refs.handlerRef.$refs.formRef.validate(valid => {
console.log(this.editForm, this.accountForm, this.$refs.repairRef.getParams())
})
})
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!