Commit c9591a4d by 彭祥礼

宽带产品增加正则验证选择

parent cdfbd68b
......@@ -6,13 +6,13 @@
<a-form layout="inline">
<a-row :gutter="24">
<a-col :md="6" :sm="12">
<a-form-item label="县分:">
<a-input placeholder="县分" v-model="queryParam.productRegion"></a-input>
<a-form-item label="县分:">
<a-input placeholder="县分" v-model="queryParam.productRegion"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item label="学校名称">
<a-input placeholder="学校名称" v-model="queryParam.productUniversity" ></a-input>
<a-form-item label="学校名称">
<a-input placeholder="学校名称" v-model="queryParam.productUniversity"></a-input>
</a-form-item>
</a-col>
<a-col :md="12" :sm="12">
......@@ -22,10 +22,11 @@
</a-col>
</a-row>
</a-form>
</div>
</div>
<!--列表-->
<s-table :columns="columns" :data="rowdata" bordered ref="table" size="small" class="flex-filling" :locale="emptyText">
<s-table :columns="columns" :data="rowdata" bordered ref="table" size="small" class="flex-filling"
:locale="emptyText">
<!--拦截器-->
<template slot="productLastUpdateTime" slot-scope="text">
{{ text | dayjs}}
......@@ -35,7 +36,7 @@
{{ text | dayjs}}
</template>
<template slot="text" slot-scope="text">
<p style="white-space: pre-line;">{{text}}</p>
<p style="white-space: pre-line;">{{text}}</p>
</template>
<template slot="productState" slot-scope="text">
<span v-if="text=='0'">正常</span>
......@@ -52,7 +53,8 @@
</template>
</s-table>
<!----弹框-->
<a-modal :title="add ?'添加宽带': '编辑宽带'" :visible="modifyvisible" @ok="createfunctionOk" @cancel="createfunctionCancel" html-type="submit" width="1024px">
<a-modal :title="add ?'添加宽带': '编辑宽带'" :visible="modifyvisible" @ok="createfunctionOk"
@cancel="createfunctionCancel" html-type="submit" width="1024px">
<a-drawer
title="适用学校详情"
placement="right"
......@@ -73,33 +75,62 @@
<p><span>计费属性:{{chouti.universityChargingAttribute}}</span></p>
<p><span>学校联系号码:{{chouti.universityContactPhone}}</span></p>
</a-drawer>
<a-drawer
title="正则校检详情"
placement="right"
:closable="false"
@close="visibleT2 = false"
:visible="visibleT2"
width=" 40%"
>
<p><span>正则名称:{{regular.name}}</span></p>
<p><span>正则表达示:{{regular.regular}}</span></p>
<p><span>错误提示:{{regular.tips}}</span></p>
<p><span>输入框默认提示:{{regular.placeholder}}</span></p>
</a-drawer>
<a-form :form="Formtable">
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="宽带标题:">
<a-input placeholder="宽带标题" v-decorator="[ 'productTitle', {rules: [{ required: true, message: '宽带标题不能为空!' ,validator: 'click'}]} ]"></a-input>
<a-input placeholder="宽带标题"
v-decorator="[ 'productTitle', {rules: [{ required: true, message: '宽带标题不能为空!' ,validator: 'click'}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="区域:">
<a-input placeholder="区域" v-decorator="[ 'productRegion', {rules: [{ required: true, message: '区域不能为空!' ,validator: 'click'}]} ]"></a-input>
<a-input placeholder="区域"
v-decorator="[ 'productRegion', {rules: [{ required: true, message: '区域不能为空!' ,validator: 'click'}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="资费:">
<a-input placeholder="资费" v-decorator="[ 'productPrice', {rules: [{required: true, message: '资费不能为空!' ,validator: 'click'}]} ]"></a-input>
<a-input placeholder="资费"
v-decorator="[ 'productPrice', {rules: [{required: true, message: '资费不能为空!' ,validator: 'click'}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="宽带速率:">
<a-input placeholder="宽带速率" v-decorator="[ 'productMeal', {rules: [{ required: true, message: '宽带速率不能为空!' ,validator: 'click'}]} ]"></a-input>
<a-input placeholder="宽带速率"
v-decorator="[ 'productMeal', {rules: [{ required: true, message: '宽带速率不能为空!' ,validator: 'click'}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="包年包月情况:">
<a-input placeholder="包年包月情况" v-decorator="[ 'productRate', {rules: [{ required: true, message: '包年包月情况不能为空!' ,validator: 'click'}]} ]"></a-input>
<a-input placeholder="包年包月情况"
v-decorator="[ 'productRate', {rules: [{ required: true, message: '包年包月情况不能为空!' ,validator: 'click'}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="适用学校:">
<a-select v-model="universityName" style="width: 330px">
<a-select v-model="universityName" style="width: 330px">
<a-select-option @click="universitySchoolName('请选择')" value="请选择">请选择</a-select-option>
<a-select-option @click="universitySchoolName(item)" v-for="item in universitySchool" :value="item.universityId">{{item.universityName}}</a-select-option>
<a-select-option @click="universitySchoolName(item)" v-for="item in universitySchool" :value="item.universityId">
{{item.universityName}}
</a-select-option>
</a-select>
<a @click="visibleT = true">详情</a>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="套餐情况:">
<a-input :rows="10" v-model="modelData.productMealPrice"/>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="正则验证名:">
<a-select v-model="regularName" style="width: 330px">
<a-select-option @click="regularsName('请选择')" value="请选择">请选择</a-select-option>
<a-select-option @click="regularsName(item)" v-for="item in regulars" :value="item.regularId">
{{item.regularName}}
</a-select-option>
</a-select>
<a @click="visibleT2 = true">详情</a>
</a-form-item>
<div v-show="!add">
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="状态">
<a-select placeholder="状态" v-decorator="[ 'productState']">
......@@ -123,42 +154,54 @@
<script>
import STable from '@/components/table';
import {productList,productDelete,productInsert,productUpdate,universitySchool} from "@/api/school-center/productAPI"
import {
productList,
productDelete,
productInsert,
productUpdate,
universitySchool
} from "@/api/school-center/productAPI"
import {cloneObject} from '@/utils/util';
export default {
name: "product",
components: {
STable,
},
data(){
data() {
return {
universityIdtrue:true,
universityName:'',
visibleT:false,
chouti:{},
universitySchool:[],
universityIdtrue: true,
universityName: '',
regularName: '',
visibleT: false,
visibleT2: false,
chouti: {},
regular: {},
universitySchool: [],
regulars: [],
emptyText: {emptyText: '暂无数据'},
Formtable: this.$form.createForm(this),
modifyvisible: false,
add: true,
productIntroduction:"",
productSetMealIntroduction:'',
productIntroduction: "",
productSetMealIntroduction: '',
queryParam: {
productUniversity :'', //适用学校
productRegion :'', // 区域
productTitle :'', //宽带标题
productState :'' // 宽带狀態
productUniversity: '', //适用学校
productRegion: '', // 区域
productTitle: '', //宽带标题
productState: '' // 宽带狀態
},
modelData:{
universityId:'',
productMealPrice:'',
productMeal:'',
productTitle:'',
productUniversity:'',
productPrice:'',
productRegion:'',
productRate:'',
productId:''
modelData: {
universityId: '',
productMealPrice: '',
productMeal: '',
productTitle: '',
productUniversity: '',
productPrice: '',
productRegion: '',
productRate: '',
productId: '',
productIntroductionPic2: ''
},
columns: [
{dataIndex: 'productTitle', width: 200, title: '宽带标题 '},
......@@ -166,14 +209,24 @@
{dataIndex: 'productPrice', width: 80, title: '资费 '},
{dataIndex: 'productRegion', width: 80, title: '县分'},
{dataIndex: 'productCreater', width: 80, title: '创建人 '},
{dataIndex: 'productLastUpdateTime', width: 200, title: '更新时间 ' ,scopedSlots: {customRender: 'productLastUpdateTime'}},
{dataIndex: 'productCreateTime', width: 200, title: '创建时间 ', scopedSlots: {customRender: 'productCreateTime'}},
{
dataIndex: 'productLastUpdateTime',
width: 200,
title: '更新时间 ',
scopedSlots: {customRender: 'productLastUpdateTime'}
},
{
dataIndex: 'productCreateTime',
width: 200,
title: '创建时间 ',
scopedSlots: {customRender: 'productCreateTime'}
},
{dataIndex: 'productState', width: 80, title: '状态 ', scopedSlots: {customRender: 'productState'}},
{dataIndex: 'productMealPrice', width: 200, title: '套餐情况 ', scopedSlots: {customRender: 'text'}},
{dataIndex: 'productRate', width: 120, title: '包年包月情况 '},
{dataIndex: 'productMeal', width: 80, title: '宽带速率 '},
/* {dataIndex: 'productIntroduction', width: 200, title: '产品情况 ', scopedSlots: {customRender: 'text'}},
{dataIndex: 'productSetMealIntroduction', width: 200, title: '资费介绍 ', scopedSlots: {customRender: 'text'}},*/
/* {dataIndex: 'productIntroduction', width: 200, title: '产品情况 ', scopedSlots: {customRender: 'text'}},
{dataIndex: 'productSetMealIntroduction', width: 200, title: '资费介绍 ', scopedSlots: {customRender: 'text'}},*/
{
dataIndex: 'operation',
width: 120,
......@@ -189,7 +242,7 @@
}
let obj = cloneObject(this.queryParam)
//表示
return productList(Object.assign(params,obj)).then(res => {
return productList(Object.assign(params, obj)).then(res => {
let data = {}
if (res.state !== 'success') {
this.$message.error("查询失败!", 5);
......@@ -201,11 +254,12 @@
totalCount: 0
}
} else {
this.regulars = res.data.regulars;
data = {
data: res.data.records,
data: res.data.page.records,
pageSize: parameter.pageSize,
pageNo: parameter.pageNo,
totalCount: res.data.total
totalCount: res.data.page.total
}
}
return data
......@@ -213,97 +267,114 @@
}
}
},
methods:{
universitySchoolName(item){
if(item == '请选择'){
this.modelData.productUniversity=item
}else {
this.modelData.productUniversity=item.universityName
this.modelData.universityId=item.universityId
this.chouti=item
methods: {
universitySchoolName(item) {
if (item == '请选择') {
this.modelData.universityId = ''
} else {
this.modelData.productUniversity = item.universityName
this.modelData.universityId = item.universityId
this.chouti = item
}
},
regularsName(item) {
if (item == '请选择') {
this.modelData.productIntroductionPic2 = ''
} else {
this.modelData.productIntroductionPic2 = item.id
this.name = item.name
this.regular = item
}
},
search() {
this.$refs.table.refresh({search: true})
},
remove(id) {
productDelete(id).then((res) => {
if(res.state=="success"){
this.$notification.success({message: res.data, description: '', duration: 4})
}
this.$refs.table.refresh({search: true})
})
productDelete(id).then((res) => {
if (res.state == "success") {
this.$notification.success({message: res.data, description: '', duration: 4})
}
this.$refs.table.refresh({search: true})
})
},
modifyfunction(data){
modifyfunction(data) {
universitySchool().then(res => {
this.universitySchool=res.data
res.data.forEach(value=>{
if(data.universityId == value.universityId){
this.chouti = value
this.universitySchool = res.data
res.data.forEach(value => {
if (data.universityId == value.universityId) {
this.chouti = value
}
})
console.log(this.universitySchool)
})
if(data != undefined ){
this.productIntroduction=data.productIntroduction,
this.productSetMealIntroduction=data.productSetMealIntroduction,
this.modelData.productMealPrice=data.productMealPrice
this.modelData.productUniversity=data.productUniversity
this.universityName=data.productUniversity
this.modelData.universityId=data.universityId
this.modelData.productId=data.productId
setTimeout(()=>{
if (data != undefined) {
this.productIntroduction = data.productIntroduction
this.productSetMealIntroduction = data.productSetMealIntroduction
this.modelData.productMealPrice = data.productMealPrice
this.modelData.productUniversity = data.productUniversity
this.universityName = data.productUniversity
for (var i = 0; i < this.regulars.length; i++) {
if (data.productIntroductionPic2 == this.regulars[i].regularId + '') {
this.regularName = this.regulars[i].regularName
this.modelData.productIntroductionPic2 = this.regulars[i].regularId
}
}
this.modelData.universityId = data.universityId
this.modelData.productId = data.productId
setTimeout(() => {
this.Formtable.setFieldsValue({
"productMeal":data.productMeal,
"productTitle":data.productTitle,
"productPrice":data.productPrice,
"productRegion":data.productRegion,
"productRate":data.productRate,
productState:data.productState
"productMeal": data.productMeal,
"productTitle": data.productTitle,
"productPrice": data.productPrice,
"productRegion": data.productRegion,
"productRate": data.productRate,
"productState": data.productState
})
},0)
this.add=false;
}else {
this.universityName='请选择'
}, 0)
this.add = false;
} else {
this.universityName = '请选择'
this.regularName = "请选择";
}
this.modifyvisible=true;
this.modifyvisible = true;
},
createfunctionOk(){
if(this.modelData.universityId == '' || this.modelData.universityId == undefined || this.modelData.productUniversity=='请选择'){
createfunctionOk() {
if (this.modelData.universityId == '' || this.modelData.universityId == undefined || this.modelData.productUniversity == '请选择') {
this.$notification.error({message: '请选择适用学校', duration: 4})
return
}
let that = this;
that.Formtable.validateFields(['productMeal','productTitle','productPrice','productRegion','productRate','productState'], {force: true}, (err, values) => {
if (err ) {
that.Formtable.validateFields(['productMeal', 'productTitle', 'productPrice', 'productRegion', 'productRate', 'productState'], {force: true}, (err, values) => {
if (err) {
return;
}
that.modelData.productMeal=values.productMeal
that.modelData.productTitle=values.productTitle
that.modelData.productPrice=values.productPrice
that.modelData.productRegion=values.productRegion
that.modelData.productRate=values.productRate
that.modelData.productState=values.productState
if(this.add){
let obj= that.modelData;
that.modelData.productMeal = values.productMeal
that.modelData.productTitle = values.productTitle
that.modelData.productPrice = values.productPrice
that.modelData.productRegion = values.productRegion
that.modelData.productRate = values.productRate
that.modelData.productState = values.productState
if (this.add) {
let obj = that.modelData;
delete obj.productId
let product= JSON.stringify(obj);
let product = JSON.stringify(obj);
productInsert({product}).then((res) => {
this.modifyvisible=false;
this.modifyvisible = false;
this.clearmodel()
if(res.state=="success"){
if (res.state == "success") {
this.$notification.success({message: res.data, description: '', duration: 4})
}
this.search()
})
}else {
let obj= that.modelData;
let product= JSON.stringify(obj);
} else {
let obj = that.modelData;
let product = JSON.stringify(obj);
productUpdate({product}).then((res) => {
this.modifyvisible=false;
this.modifyvisible = false;
this.clearmodel()
if(res.state=="success"){
if (res.state == "success") {
this.$notification.success({message: res.data, description: '', duration: 4})
}
this.search()
......@@ -311,28 +382,29 @@
}
})
},
createfunctionCancel(){
this.modifyvisible=false;
createfunctionCancel() {
this.modifyvisible = false;
this.clearmodel()
this.add=true;
this.add = true;
},
//清除弹窗信息
clearmodel() {
this.add=true
this.add = true
let that = this;
that.modelData.productMealPrice=''
that.modelData.productId=''
that.modelData.productIntroduction=''
that.modelData.productSetMealIntroduction=''
that.modelData.productUniversity='',
that.modelData.universityId='',
that.modelData.productMealPrice = ''
that.modelData.productId = ''
that.modelData.productIntroduction = ''
that.modelData.productSetMealIntroduction = ''
that.modelData.productUniversity = ''
that.modelData.universityId = ''
that.modelData.productIntroductionPic2 = ''
this.Formtable.setFieldsValue({
productMeal:'',
productTitle:'',
productPrice:'',
productRegion:'',
productRate:'',
productState:'0'
productMeal: '',
productTitle: '',
productPrice: '',
productRegion: '',
productRate: '',
productState: '0'
})
}
}
......
......@@ -7,7 +7,7 @@
<a-row :gutter="24">
<a-col :md="6" :sm="12">
<a-form-item label="正则名称">
<a-input placeholder="正则名称" v-model="queryParam.name" ></a-input>
<a-input placeholder="正则名称" v-model="queryParam.regularName" ></a-input>
</a-form-item>
</a-col>
<span class="table-page-search-submitButtons" style="float: left; overflow: hidden;">
......@@ -39,10 +39,10 @@
<span>
<a @click="modifyfunction(record)">编辑</a>
<a-divider type="vertical"/>
<a-popconfirm title="确定不显示吗" v-if="record.isShow == 1" @confirm="remove(record.id,0)">
<a-popconfirm title="确定不显示吗" v-if="record.isShow == 1" @confirm="remove(record.regularId,0)">
<a>隐藏</a>
</a-popconfirm>
<a-popconfirm title="确定显示吗" v-if="record.isShow == 0" @confirm="remove(record.id,1)">
<a-popconfirm title="确定显示吗" v-if="record.isShow == 0" @confirm="remove(record.regularId,1)">
<a>显示</a>
</a-popconfirm>
</span>
......@@ -51,11 +51,11 @@
<!----弹框-->
<a-modal :title="add ?'添加正则配置': '编辑正则配置'" :visible="modifyvisible" @ok="createfunctionOk" @cancel="createfunctionCancel" html-type="submit" width="1024px">
<a-form :form="Formtable">
<a-form-item v-show="false" :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="id:">
<a-input placeholder="id" v-decorator="[ 'id', {rules: [{ required: true, message: 'id' ,validator: 'click'}]} ]"></a-input>
<a-form-item v-show="false" :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="">
<a-input placeholder="regularId" v-decorator="[ 'regularId', {rules: [{ required: true, message: 'regularId' ,validator: 'click'}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="正则名称:">
<a-input placeholder="正则名称" v-decorator="[ 'name', {rules: [{ required: true, message: '学校名称不能为空!' ,validator: 'click'}]} ]"></a-input>
<a-input placeholder="正则名称" v-decorator="[ 'regularName', {rules: [{ required: true, message: '学校名称不能为空!' ,validator: 'click'}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="正则表达示:">
<a-input placeholder="正则表达示" v-decorator="[ 'regular', {rules: [{ required: true, message: '表达示不能为空!' ,validator: 'click'}]} ]"></a-input>
......@@ -66,6 +66,12 @@
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="输入框默认值:">
<a-input placeholder="输入框默认值" v-decorator="[ 'placeholder', {rules: [{ required: true, message: '外线方式不能为空!' ,validator: 'click'}]} ]"></a-input>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="是否显示:">
<a-select v-decorator="[ 'isShow' ]" style="width: 330px">
<a-select-option key="1"></a-select-option>
<a-select-option key="0"></a-select-option>
</a-select>
</a-form-item>
</a-form>
</a-modal>
</div>
......@@ -87,32 +93,31 @@
modifyvisible: false,
add: true,
queryParam: {
name :'', //学校
regularName :'',
},
modelData:{
id: '',
name:'',
regularId: '',
regularName:'',
regular:'',
tips:'',
placeholder:'',
isShow:''
isShow: '1'
},
columns: [
{dataIndex: 'id', width: 20, title: 'id',istrue: true},
{dataIndex: 'name', width: 100, title: '正则名称'},
{dataIndex: 'regularId', width: 20, title: 'regularId',istrue: true},
{dataIndex: 'regularName', width: 70, title: '正则名称'},
{dataIndex: 'regular', width: 100, title: '正则表达示 '},
{dataIndex: 'tips', width: 100, title: '错误提示'},
{dataIndex: 'placeholder', width: 100, title: '输入框默认提示 '},
{dataIndex: 'tips', width: 70, title: '错误提示'},
{dataIndex: 'placeholder', width: 70, title: '输入框默认提示 '},
{
dataIndex: 'operation',
width: 40,
width: 26,
title: '操作',
scopedSlots: {customRender: 'operation'},
fixed: "right"
}]
,
rowdata: parameter => {
let params = {
pageNo: parameter.pageNo,
pageSize: parameter.pageSize
......@@ -147,8 +152,8 @@
search() {
this.$refs.table.refresh({search: true})
},
remove(id,isShow) {
regularDelete({'id':id,'isShow':isShow}).then((res) => {
remove(regularId,isShow) {
regularDelete({'regularId':regularId,'isShow':isShow}).then((res) => {
if(res.state=="success"){
this.$notification.success({message: res.data, description: '', duration: 4})
}
......@@ -157,11 +162,11 @@
},
modifyfunction(data){
if(data != undefined ){
this.modelData.regularId=data.regularId
setTimeout(()=>{
this.modelData.id=data.uid
this.Formtable.setFieldsValue({
"id":data.id,
"name":data.name,
"regularId":data.regularId,
"regularName":data.regularName,
"regular":data.regular,
"tips":data.tips,
"placeholder":data.placeholder,
......@@ -174,11 +179,11 @@
},
createfunctionOk(){
let that = this;
that.Formtable.validateFields(['name','regular','tips','placeholder','isShow'], {force: true}, (err, values) => {
that.Formtable.validateFields(['regularName','regular','tips','placeholder','isShow'], {force: true}, (err, values) => {
if (err ) {
return;
}
that.modelData.name=values.name
that.modelData.regularName=values.regularName
that.modelData.regular=values.regular
that.modelData.tips=values.tips
that.modelData.placeholder=values.placeholder
......@@ -217,9 +222,9 @@
//清除弹窗信息
clearmodel() {
this.add=true
this.modelData.id=''
this.modelData.regularId=''
this.Formtable.setFieldsValue({
"name":'',
"regularName":'',
"regular":'',
"tips":'',
"placeholder":'',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment