Commit 78eafdf9 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/xiangwei/horse into master

# Conflicts:
#	src/api/customer.ts
parents 79073f2b 64ad5fd6
...@@ -9,7 +9,7 @@ export declare interface customerFieldlistType { ...@@ -9,7 +9,7 @@ export declare interface customerFieldlistType {
export declare interface customerFieldtabsType { export declare interface customerFieldtabsType {
Id: number Id: number
Name: string Name: string
disable?: boolean disable?: boolean | any
} }
/** 客户字段 新增的类型 */ /** 客户字段 新增的类型 */
export declare interface customerFieldaddMsgType { export declare interface customerFieldaddMsgType {
......
...@@ -10,5 +10,5 @@ export default defineComponent({ ...@@ -10,5 +10,5 @@ export default defineComponent({
</script> </script>
<style lang="sass"> <style lang="sass">
@import url('./css/font.sass') @import url('./css/font.sass')
@import url('//at.alicdn.com/t/font_2930340_dn2rgl17m5t.css') @import url('//at.alicdn.com/t/font_2930340_ymozcida88.css')
</style> </style>
...@@ -13,7 +13,10 @@ ...@@ -13,7 +13,10 @@
interface msg { interface msg {
Enable: number Enable: number
} }
interface IdName {
Id:number,
Name:string
}
...@@ -73,28 +76,48 @@ ...@@ -73,28 +76,48 @@
} }
// 获取客户子段类型枚举 // 获取客户子段类型枚举
static async getCustomerFieldTypeEnumList(data: any): Promise<HttpResponse> { static async getCustomerFieldTypeEnumList(data: any): Promise<HttpResponse> {
return Axios('/QYCustomer/GetCustomerFieldTypeEnumList', { return Axios('/QYCustomer/GetCustomerFieldTypeEnumList', {
method: 'post', method: 'post',
responseType: 'json', responseType: 'json',
data data
}) })
} }
// 获取部门树形列表 // 获取部门树形列表
static async getDeptTree(data: any): Promise<HttpResponse> { static async getDeptTree(data: any): Promise<HttpResponse> {
return Axios('/User/GetDeptTree', { return Axios('/User/GetDeptTree', {
method: 'post', method: 'post',
responseType: 'json', responseType: 'json',
data data
}) })
} }
// 获取部门树形列表 // 获取部门树形列表
static async getCustomerFieldInputTypeEnumList(data: any): Promise<HttpResponse> { static async getCustomerFieldInputTypeEnumList(data: any): Promise<HttpResponse> {
return Axios('/QYCustomer/GetCustomerFieldInputTypeEnumList', { return Axios('/QYCustomer/GetCustomerFieldInputTypeEnumList', {
method: 'post', method: 'post',
responseType: 'json', responseType: 'json',
data data
}) })
} }
//新增修改客户字段
static async setCustomerFiledInfo(data: {
Id:number,
Type:number,
Name:string,
Required:number,
DeptId:number,
WordNum:number,
InputType:string,
OptionsList:Array<IdName>,
Digits:number,
Enable:number,
[propName: string]: any
}): Promise<HttpResponse> {
return Axios('/QYCustomer/SetCustomerFiledInfo', {
method: 'post',
responseType: 'json',
data
})
}
} }
export default customerService export default customerService
...@@ -10,88 +10,104 @@ ...@@ -10,88 +10,104 @@
<q-card-section class="q-pt-none" style="margin-top: 15px;"> <q-card-section class="q-pt-none" style="margin-top: 15px;">
<q-splitter v-model="splitterModel"> <q-splitter v-model="splitterModel">
<template v-slot:before> <template v-slot:before>
<q-tabs v-model="tab" vertical @input="getdefault"> <q-tabs v-model="tab" vertical @click="getdefault">
<q-tab v-for="(x,y) in tabsList" :key='y' :name="x.Id" :label="x.Name" <q-tab v-for="(x,y) in tabsList" :key='y' :name="x.Id" :label="x.Name"
:disable="x.disable" /> :disable="x.disable" />
</q-tabs> </q-tabs>
</template> </template>
<template v-slot:after> <template v-slot:after>
<div style="height: 100%; width: 100%;padding: 16px"> <div style="height: 100%; width: 100%;padding: 16px">
<div class="rightrow"> <div class="rightrow" style="margin-top: 0px;">
<div class="leftwidth">字段名称:</div> <div class="leftwidth">字段名称:</div>
<q-input clearable outlined v-model="addMsg.Name" counter maxlength="8" <q-input clearable outlined v-model="addMsg.Name" counter maxlength="8"
:rules="[val => !!val || '请输入字段名称']" dense style="width: 400px;" /> :rules="[val => !!val || '请输入字段名称']" dense style="width: 400px;" />
</div> </div>
<div class="rightrow"> <div class="rightrow" style="margin-top: 0px;">
<div class="leftwidth">部门选择:</div> <div class="leftwidth">部门选择:</div>
<q-radio v-model="departmentType" val="1" label="公司字段" @input='addMsg.DeptId=0' /> <div>
<q-radio v-model="departmentType" val="2" label="部门字段" @input='addMsg.DeptId=0' /> <q-radio v-model="departmentType" val="1" label="公司字段"
@input='addMsg.DeptId=0' />
<q-radio v-model="departmentType" val="2" label="部门字段"
@input='addMsg.DeptId=0' />
<div v-if="departmentType==2">
<selectTree :treeData='deptl' :defaultArray="returnString" nodeKey="DeptId" style="width: 300px;"
:multiple="false" labelKey="DeptName" childrenKey="ChildList"
tipText="选择部门" @getChild="getChild" classStr="col-6 q-pb-lg">
</selectTree>
</div>
</div>
</div> </div>
<div class="rightrow" v-if='tab==1'>
<div class="rightrow" v-if='tab==1'>
<div class="leftwidth">字数限制:</div> <div class="leftwidth">字数限制:</div>
<q-input v-model.number="addMsg.WordNum" outlined dense counter :rules="[val => !!val || '不能为空']" <q-input v-model.number="addMsg.WordNum" outlined dense type="number" :max='50'
type="number" :max='50' :min='0' maxlength="8" style="width: 400px" /> :min='0' maxlength="8" style="width: 400px" />
</div> </div>
<div class="rightrow" v-if='tab==1'> <div class="rightrow" v-if='tab==1'>
<div class="leftwidth">输入类型:</div> <div class="leftwidth">输入类型:</div>
<q-checkbox v-model="addMsg.InputType" v-for="(x,y) in checkboxList" <q-checkbox v-model="addMsg.InputType" v-for="(x,y) in checkboxList" :key='y'
:key='y' :val="x.Id" :label="x.Name" /> :val="x.Id" :label="x.Name" />
</div> </div>
<div class="rightrow" v-if='tab==2'> <div class="rightrow" v-if='tab==2'>
<div class="leftwidth">文字字数:</div> <div class="leftwidth">文字字数:</div>
<q-input v-model.number="addMsg.WordNum" outlined dense type="number" :max='2000'
:min='0' maxlength="2000" style="width: 400px" />
</div>
<div class="rightrow" v-if='tab==3|| tab==4'>
<div class="leftwidth">列表选项:</div>
<draggable v-model="addMsg.OptionsList" item-key="Id">
<template #item="{ element ,index}">
<div style="display: flex;margin-bottom: 10px;">
<i class="iconfont icon-drag"
style="font-size: 26px;color: #777;margin-right: 10px;"></i>
<q-input v-model.number="element.Name" outlined dense clearable
style="width: 250px" />
<div
style="display: flex;align-items: center;margin-top: 8px;margin-left: 10px;height: 26px;">
<div style="width: 26px;height: 26px;margin-right: 10px;"
v-if="addMsg.OptionsList.length>1">
<q-btn round size="xs" color="deep-orange" icon="delete"
@click="addMsg.OptionsList.splice(index,1)" />
</div>
<div style="width: 26px;height: 26px;"
v-if="addMsg.OptionsList.length==index+1">
<q-btn round size="xs" color="primary" icon="add"
@click="addMsg.OptionsList.push({Id:0,Name:''})" />
</div>
</div>
</div>
</template>
</draggable>
</div>
<div class="rightrow" v-if='tab==7'>
<div class="leftwidth">小数位数:</div>
<q-select filled stack-label option-value="Id" option-label="Id"
style="width: 300px;" v-model="addMsg.Digits" ref="Id" :options="decimalslist"
dense map-options />
</div>
<div class="rightrow">
<div class="leftwidth">属性设置:</div>
<div class="q-gutter-sm">
<q-toggle v-model="addMsg.Required" label="必填项" :true-value="1"
:false-value="2" />
<q-toggle v-model="addMsg.Enable" label="启用" :true-value="1" :false-value="2" />
</div>
</div> </div>
<!-- <el-form label-width="120px"> <!-- <el-form label-width="120px">
<el-form-item label="部门选择:"> <el-form-item label="部门选择:">
<div v-if="departmentType==2"> <div v-if="departmentType==2">
<selectTree :treeData='deptl' :defaultArray="returnString" nodeKey="DeptId"
:multiple="false" labelKey="DeptName" childrenKey="ChildList"
tipText="选择部门" @getChild="getChild" classStr="col-6 q-pb-lg">
</selectTree>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="文字字数:" v-if='tab==2'>
<el-input-number v-model="addMsg.WordNum" @change="handleChange" :min="1"
:max="2000">
</el-input-number>
</el-form-item>
<el-form-item label="列表选项:" v-if='tab==3|| tab==4'>
<draggable v-model="addMsg.OptionsList">
<div v-for="(x,y) in addMsg.OptionsList" :key='y'
style="display: flex;align-items: center;margin-bottom: 10px;">
<i class="iconfont icon-weiyi"
style="font-size: 14px;color: #777;margin-right: 10px;"></i>
<q-input clearable filled maxlength="16" v-model="x.Name"
style="width: 280px;" @input="$forceUpdate()" label="列表项值" />
<q-btn round size="xs" color="deep-orange" icon="delete"
v-if="addMsg.OptionsList.length>1"
@click="addMsg.OptionsList.splice(y,1)"
style='margin-left: 10px;' />
<q-btn round size="xs" color="primary" icon="add"
v-if="addMsg.OptionsList.length==y+1"
@click="addMsg.OptionsList.push({Id:0,Name:''})"
style='margin-left: 10px;' />
</div>
</draggable>
</el-form-item>
<el-form-item label="小数位数:" v-if='tab==7'>
<q-select filled stack-label option-value="Id" option-label="Id"
v-model="addMsg.Digits" ref="Id" :options="decimalslist" label="小数位数"
:dense="false" emit-value map-options />
</el-form-item>
<el-form-item label="属性设置:">
<div class="q-gutter-sm">
<q-toggle v-model="addMsg.Required" label="必填项" :true-value="1"
:false-value="2" />
<q-toggle v-model="addMsg.Enable" label="启用" :true-value="1"
:false-value="2" />
</div>
</el-form-item>
</el-form> --> </el-form> -->
</div> </div>
</template> </template>
...@@ -108,14 +124,19 @@ ...@@ -108,14 +124,19 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, ref } from 'vue' import { defineComponent, ref } from 'vue'
import { customerFieldlistType, customerFieldaddMsgType, customerFieldtabsType } from '@/@types/customer' import draggable from "vuedraggable";
import selectTree from '@/components/common/selectTree.vue'
import { useQuasar } from 'quasar'
import customerService from '@/api/customer'
// import { customerFieldtabsType } from '@/@types/customer'
export default defineComponent({ export default defineComponent({
components: { draggable, selectTree },
props: { props: {
passobj: { passobj: {
type: Object, type: Object,
default:()=> {return {}}, default: () => { return {} },
}, },
passdeptl: { passdeptl: {
type: Array, type: Array,
...@@ -131,13 +152,34 @@ ...@@ -131,13 +152,34 @@
}, },
}, },
setup(props, ctx) { setup(props, ctx) {
const $q = useQuasar()
let addMsg = ref(props.passobj) let addMsg = ref(props.passobj)
let deptl = ref(props.passdeptl) let deptl = ref(props.passdeptl)
let tabsList = ref(props.passtabsList) let departmentType = ref('1')
let tab = ref(1)
let loading = ref(false)
let tabsList = ref < Array < any >> ([])
tabsList.value = props.passtabsList
let checkboxList = ref < Array < any >> ([]) let checkboxList = ref < Array < any >> ([])
checkboxList.value = props.passcheckboxList checkboxList.value = props.passcheckboxList
let decimalslist = ref([{ Id: 0 }, { Id: 1 }, { Id: 2 }, { Id: 3 }, { Id: 4 }, { Id: 5 }, { Id: 6 }, { Id: 7 }, { Id: 8 }, { Id: 9 }, { Id: 10 }, { Id: 11 },])
let returnString = ref< Array < any >>([])
if (addMsg.value.Id > 0) { if (addMsg.value.Id > 0) {
console.log() tab.value = addMsg.value.Type
addMsg.value.InputType = addMsg.value.InputType.split(',').map(Number)
if (addMsg.value.DeptId > 0) {
departmentType.value = '2'
returnString.value = []
setTimeout(() => {
returnString.value.push(addMsg.value.DeptId)
}, 500)
}
tabsList.value.forEach(x => {
if (x.Id != addMsg.value.Type) {
x.disable = true
}
})
} else { } else {
addMsg.value.InputType = []; addMsg.value.InputType = [];
checkboxList.value.forEach((x) => { checkboxList.value.forEach((x) => {
...@@ -148,7 +190,103 @@ ...@@ -148,7 +190,103 @@
ctx.emit('getcancel', 1) ctx.emit('getcancel', 1)
} }
const savewb = () => {//数据保存 const savewb = () => {//数据保存
let submitobj = JSON.parse(JSON.stringify(addMsg.value))
submitobj.Type = tab.value //先类型赋值
if (submitobj.Name == '') {
$q.notify({
type: 'negative',
message: `请填写字段名称`,
position: 'top'
})
return
}
if ((submitobj.Type == 1 || submitobj.Type == 2) && submitobj.WordNum == '') {
$q.notify({
type: 'negative',
message: `字数不能为空`,
position: 'top'
})
return
}
if (departmentType.value == '2' && (submitobj.DeptId == 0 || submitobj.DeptId == '')) {
$q.notify({
type: 'negative',
message: `请选择部门`,
position: 'top'
})
return
}
if (submitobj.Type == 3 || submitobj.Type == 4) {
for (let i = 0; i < submitobj.OptionsList.length; i++) {
let x = submitobj.OptionsList[i]
if (x.Name == ''|| x.Name == null) {
$q.notify({
type: 'negative',
message: `请填写列表选项值`,
position: 'top'
})
return
}
submitobj.OptionsList[i].Id = i + 1
}
}
if (submitobj.Type == 1) {
if (submitobj.InputType.length == 0) {
$q.notify({
type: 'negative',
message: `至少选择一种输入类型`,
position: 'top'
})
return
} else {
submitobj.InputType = submitobj.InputType.join(',')
}
} else {
submitobj.InputType = '1'
}
loading.value = true
customerService.setCustomerFiledInfo(submitobj).then((res) => {
if (res.data.Code == 1) {
console.log(res)
$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: res.data.Message,
position: 'top'
})
loading.value = false
ctx.emit('getcancel', 2)
} else {//如果移动失败 重新获取列表
loading.value = false
}
})
}
const getChild = (deptArray: string) => {
var tempStr = "";
if (deptArray && deptArray != '') {
tempStr = deptArray;
}
addMsg.value.DeptId = tempStr
}
const getdefault = () => {//切换模式的时候 初始化
addMsg.value = {
Id: 0,
Type: 1,
Name: '',
Required: 2,
DeptId: 0,
WordNum: 1,
InputType: '',
OptionsList: [{
Id: 1,
Name: ''
}],
Digits: 0,
Enable: 1,
};
} }
return { return {
...@@ -160,8 +298,13 @@ ...@@ -160,8 +298,13 @@
tabsList, tabsList,
checkboxList, checkboxList,
splitterModel: ref(13), splitterModel: ref(13),
tab: ref(1), tab,
departmentType:ref('1') departmentType,
decimalslist,
returnString,
getChild,
loading,
getdefault
} }
} }
}) })
...@@ -169,7 +312,7 @@ ...@@ -169,7 +312,7 @@
<style> <style>
.addfield .rightrow { .addfield .rightrow {
display: flex; display: flex;
margin-top: 10px;
align-items: flex-start; align-items: flex-start;
} }
......
...@@ -177,7 +177,6 @@ ...@@ -177,7 +177,6 @@
ok: { ok: {
label: "确认", label: "确认",
flat: true, flat: true,
focus: true
} }
}).onOk(() => { }).onOk(() => {
setFiledState(item, type) setFiledState(item, type)
...@@ -187,10 +186,16 @@ ...@@ -187,10 +186,16 @@
customerService.getCustomerFieldTypeEnumList({}).then((res) => { customerService.getCustomerFieldTypeEnumList({}).then((res) => {
if (res.data.Code == 1) { if (res.data.Code == 1) {
tabsList.value = res.data.Data tabsList.value = res.data.Data
tabsList.value.forEach(x => {
x.disable = false
})
} }
}) })
} }
const goedit = (item: customerFieldlistType) => {
addMsg.value = JSON.parse(JSON.stringify(item))
Isadd.value = true;
}
const goaddfield = () => { const goaddfield = () => {
Isadd.value = true; Isadd.value = true;
addMsg.value = { addMsg.value = {
...@@ -255,7 +260,8 @@ ...@@ -255,7 +260,8 @@
deptl, deptl,
getFieldInputType, getFieldInputType,
checkboxList, checkboxList,
tabsList tabsList,
goedit
} }
} }
......
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