Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
horse
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
向伟
horse
Commits
c5222b54
Commit
c5222b54
authored
Nov 17, 2021
by
Mac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增
parent
1c9ab861
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
269 additions
and
41 deletions
+269
-41
customer.ts
src/api/customer.ts
+24
-0
addfield.vue
src/components/customer/addfield.vue
+146
-0
customerField.vue
src/pages/customer/components/customerField.vue
+99
-41
No files found.
src/api/customer.ts
View file @
c5222b54
...
...
@@ -63,6 +63,30 @@
data
})
}
// 获取客户子段类型枚举
static
async
getCustomerFieldTypeEnumList
(
data
:
any
):
Promise
<
HttpResponse
>
{
return
Axios
(
'/QYCustomer/GetCustomerFieldTypeEnumList'
,
{
method
:
'post'
,
responseType
:
'json'
,
data
})
}
// 获取部门树形列表
static
async
getDeptTree
(
data
:
any
):
Promise
<
HttpResponse
>
{
return
Axios
(
'/User/GetDeptTree'
,
{
method
:
'post'
,
responseType
:
'json'
,
data
})
}
// 获取部门树形列表
static
async
getCustomerFieldInputTypeEnumList
(
data
:
any
):
Promise
<
HttpResponse
>
{
return
Axios
(
'/QYCustomer/GetCustomerFieldInputTypeEnumList'
,
{
method
:
'post'
,
responseType
:
'json'
,
data
})
}
}
export
default
customerService
src/components/customer/addfield.vue
0 → 100644
View file @
c5222b54
<
template
>
<div
class=
"addfield"
style=
"padding: 0;margin: 0;"
>
<q-dialog
v-model=
"Isadd"
persistent
>
<q-card
style=
"width: 700px; max-width: 80vw;"
>
<q-card-section>
<div
class=
"text-h6"
>
新建/修改字段
</div>
</q-card-section>
<q-separator
/>
<q-card-section
class=
"q-pt-none"
style=
"margin-top: 15px;"
>
<q-splitter
v-model=
"splitterModel"
>
<template
v-slot:before
>
<q-tabs
v-model=
"tab"
vertical
@
input=
"getdefault"
>
<q-tab
v-for=
"(x,y) in tabsList"
:key=
'y'
:name=
"x.Id"
:label=
"x.Name"
:disable=
"x.disable"
/>
</q-tabs>
</
template
>
<
template
v-slot:after
>
<div
style=
"height: 100%; width: 100%;padding: 16px"
>
<!--
<el-form
label-width=
"120px"
>
<el-form-item
label=
"字段名称:"
>
<q-input
clearable
filled
maxlength=
"8"
counter
v-model=
"addMsg.Name"
@
input=
"$forceUpdate()"
label=
"字段名称"
:rules=
"[val => !!val || '请输入字段名称']"
/>
</el-form-item>
<el-form-item
label=
"部门选择:"
>
<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"
:multiple=
"false"
labelKey=
"DeptName"
childrenKey=
"ChildList"
tipText=
"选择部门"
@
getChild=
"getChild"
classStr=
"col-6 q-pb-lg"
>
</selectTree>
</div>
</el-form-item>
<el-form-item
label=
"字数限制:"
v-if=
'tab==1'
>
<q-input
v-model
.
number=
"addMsg.WordNum"
:rules=
"[val => !!val || '不能为空']"
type=
"number"
filled
:max=
'50'
:min=
'0'
style=
"max-width: 200px"
/>
</el-form-item>
<el-form-item
label=
"输入类型:"
v-if=
'tab==1'
>
<div
class=
"q-gutter-sm"
>
<q-checkbox
v-model=
"addMsg.InputType"
v-for=
"(x,y) in checkboxList"
:key=
'y'
:val=
"x.Id"
:label=
"x.Name"
/>
</div>
</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>
-->
</div>
</
template
>
</q-splitter>
</q-card-section>
<q-separator
/>
<q-card-actions
align=
"right"
class=
"bg-white"
>
<q-btn
class=
"q-mr-md"
label=
"取消"
@
click=
"getcancel()"
/>
<q-btn
color=
"accent"
class=
"q-mr-md"
label=
"确定"
@
click=
"savewb()"
:loading=
"loading"
/>
</q-card-actions>
</q-card>
</q-dialog>
</div>
</template>
<
script
lang=
"ts"
>
import
{
defineComponent
,
ref
,
}
from
'vue'
export
default
defineComponent
({
props
:
{
passobj
:
{
type
:
Object
,
default
:()
=>
{},
},
passdeptl
:
{
type
:
Array
,
default
:
()
=>
[],
},
passtabsList
:
{
type
:
Array
,
default
:
()
=>
[],
},
passcheckboxList
:
{
type
:
Array
,
default
:
()
=>
[],
},
},
setup
(
props
,
ctx
)
{
let
obj
=
ref
(
props
.
passobj
)
let
deptl
=
ref
(
props
.
passdeptl
)
let
tabsList
=
ref
(
props
.
passtabsList
)
let
checkboxList
=
ref
(
props
.
passcheckboxList
)
const
getcancel
=
()
=>
{
ctx
.
emit
(
'getcancel'
,
1
)
}
const
savewb
=
()
=>
{
//数据保存
}
return
{
getcancel
,
//关闭弹窗
savewb
,
//保存数据
Isadd
:
ref
(
true
),
obj
,
deptl
,
tabsList
,
checkboxList
,
splitterModel
:
ref
(
13
),
tab
:
ref
(
1
),
}
}
})
</
script
>
\ No newline at end of file
src/pages/customer/components/customerField.vue
View file @
c5222b54
<
template
>
<!--
<requestgroup></requestgroup>
-->
<div
class=
"q-pa-md customerField"
>
<div
style=
"text-align: right;"
>
<q-btn
color=
"accent"
style=
"float:right;margin-bottom: 10px;"
size=
"sm"
class=
"q-mr-md"
icon=
"add"
label=
"新增字段"
@
click=
"goaddfield()"
></q-btn>
</div>
<table
class=
"payTable"
>
<thead>
<tr>
...
...
@@ -17,7 +20,7 @@
<tr
v-if=
"data && data.length==0"
>
<td
:colspan=
"8"
align=
"center"
>
暂无数据
</td>
</tr>
<draggable
v-model=
"data"
tag=
"tbody"
item-key=
"Id"
:move=
"getdata"
@
update=
"datadragEnd"
>
<draggable
v-model=
"data"
tag=
"tbody"
item-key=
"Id"
:move=
"getdata"
@
update=
"datadragEnd"
>
<template
#
item=
"
{ element }">
<tr>
<td><span>
{{
element
.
Name
}}
</span></td>
...
...
@@ -30,11 +33,11 @@
<q-toggle
v-if=
"element.IsLock==1"
v-model=
"element.Enable"
:true-value=
"1"
:false-value=
"2"
icon=
"lock"
disable
/>
<q-toggle
v-else
v-model=
"element.Enable"
:true-value=
"1"
:false-value=
"2"
@
update:model-value=
"godelete(element,1
,index
)"
/>
@
update:model-value=
"godelete(element,1)"
/>
</td>
<td>
<q-toggle
v-model=
"element.Required"
:true-value=
"1"
:false-value=
"2"
@
update:model-value=
"godelete(element,2
,index
)"
/>
@
update:model-value=
"godelete(element,2)"
/>
</td>
<td>
<div>
{{
element
.
UpdateByName
}}
</div>
...
...
@@ -44,7 +47,7 @@
<q-btn
flat
size=
"xs"
icon=
"edit"
style=
"font-weight:400;color: #3FC4FF"
class=
"q-mr-xs"
label=
"编辑"
@
click=
"goedit(element)"
/>
<q-btn
v-if=
'element.IsDefault!=1'
flat
size=
"xs"
icon=
"delete"
color=
"negative"
class=
"q-mr-xs"
label=
"删除"
@
click=
"godelete(element,3
,index
)"
/>
class=
"q-mr-xs"
label=
"删除"
@
click=
"godelete(element,3)"
/>
</td>
<td>
<i
class=
"iconfont icon-drag"
style=
"font-size: 20px;color: #777;"
></i>
...
...
@@ -54,39 +57,52 @@
</draggable>
</table>
<div
>
<addfield
v-if=
"Isadd"
@
getcancel=
'getcancel'
:passobj=
"addMsg"
:passdeptl=
"deptl"
:passtabsList=
"tabsList"
:passcheckboxList=
"checkboxList"
></addfield>
</div>
</div>
</template>
<
script
lang=
"ts"
>
import
{
defineComponent
,
ref
,
onMounted
,
}
from
'vue'
// import requestgroup from '../../../components/customer/request-group.vue'
import
{
defineComponent
,
ref
,
onMounted
,
}
from
'vue'
import
customerService
from
'@/api/customer'
import
draggable
from
"vuedraggable"
;
import
{
useQuasar
}
from
'quasar'
import
addfield
from
'../../../components/customer/addfield.vue'
interface
listType
{
Id
:
number
Enable
:
number
Required
?:
number
[
propName
:
string
]:
any
Enable
:
number
Required
:
number
[
propName
:
string
]:
any
}
interface
tabsType
{
Id
:
number
Name
:
string
disable
:
boolean
}
export
default
defineComponent
({
components
:
{
draggable
},
components
:
{
draggable
,
addfield
},
setup
()
{
const
$q
=
useQuasar
()
let
data
=
ref
<
Array
<
listType
>>
([])
let
dragId
=
ref
(
0
);
let
data
=
ref
<
Array
<
listType
>>
([])
let
tabsList
=
ref
<
Array
<
tabsType
>>
([])
let
deptl
=
ref
([])
let
checkboxList
=
ref
<
Array
<
tabsType
>>
([])
let
dragId
=
ref
(
0
);
let
Isadd
=
ref
(
false
)
let
addMsg
=
ref
(
null
)
const
changePage
=
()
=>
{
customerService
.
getCustomerFiledList
({
Enable
:
-
1
}).
then
((
res
)
=>
{
data
.
value
=
res
.
data
.
Data
data
.
value
=
res
.
data
.
Data
})
}
const
datadragEnd
=
(
e
:
any
)
=>
{
const
datadragEnd
=
(
e
:
any
)
=>
{
// console.log('拖动结束',e)
let
olddragId
=
0
if
(
e
.
newIndex
>
0
)
{
olddragId
=
data
.
value
[
e
.
newIndex
-
1
].
Id
}
else
{
if
(
e
.
newIndex
>
0
)
{
olddragId
=
data
.
value
[
e
.
newIndex
-
1
].
Id
}
else
{
olddragId
=
0
}
let
msg
=
{
...
...
@@ -97,13 +113,13 @@
customerService
.
setCustomerFiledState
(
msg
).
then
((
res
)
=>
{
if
(
res
.
data
.
Code
==
1
)
{
console
.
log
(
res
)
}
else
{
//如果移动失败 重新获取列表
}
else
{
//如果移动失败 重新获取列表
changePage
()
}
})
}
const
getdata
=
(
e
:
any
)
=>
{
const
getdata
=
(
e
:
any
)
=>
{
dragId
.
value
=
e
.
draggedContext
.
element
.
Id
}
const
setFiledState
=
(
item
,
Type
)
=>
{
...
...
@@ -122,34 +138,29 @@
position
:
'top'
})
changePage
()
}
else
{
//如果移动失败 重新获取列表
}
else
{
//如果移动失败 重新获取列表
}
})
}
const
godelete
=
(
item
:
listType
,
type
:
number
,
index
:
number
)
=>
{
const
godelete
=
(
item
:
listType
,
type
:
number
)
=>
{
let
text
=
''
console
.
log
(
item
)
if
(
type
==
1
){
//tyep等于1和2的时候 先让弹出提示 然后再给予掉接口 所以把原本的值暂时先赋值给本身
if
(
type
==
1
)
{
//tyep等于1和2的时候 先让弹出提示 然后再给予掉接口 所以把原本的值暂时先赋值给本身
text
=
'确定修改启用状态'
if
(
item
.
Enable
==
2
){
data
.
value
[
index
].
Enable
=
1
}
else
{
data
.
value
[
index
].
Enable
=
2
if
(
item
.
Enable
==
2
)
{
item
.
Enable
=
1
}
else
{
item
.
Enable
=
2
}
}
else
if
(
type
==
2
)
{
}
else
if
(
type
==
2
)
{
text
=
'确定修改必填状态'
if
(
item
.
Required
==
2
){
data
.
value
[
index
].
Required
=
1
console
.
log
(
data
.
value
[
index
].
Required
,
' data.value[index].Required'
)
}
else
{
data
.
value
[
index
].
Required
=
2
if
(
item
.
Required
==
2
)
{
item
.
Required
=
1
}
else
{
item
.
Required
=
2
}
}
else
if
(
type
==
3
)
{
}
else
if
(
type
==
3
)
{
text
=
'删除后字段不在显示,是否删除?'
}
console
.
log
(
text
)
$q
.
dialog
({
title
:
"提示信息"
,
message
:
text
,
...
...
@@ -166,10 +177,47 @@
setFiledState
(
item
,
type
)
});
}
const
getCustomerFieldType
=
()
=>
{
customerService
.
getCustomerFieldTypeEnumList
({}).
then
((
res
)
=>
{
if
(
res
.
data
.
Code
==
1
)
{
tabsList
.
value
=
res
.
data
.
Data
onMounted
(()
=>
{
}
})
}
const
goaddfield
=
()
=>
{
Isadd
.
value
=
true
;
addMsg
.
value
=
null
;
}
const
getcancel
=
(
type
:
number
)
=>
{
Isadd
.
value
=
false
;
tabsList
.
value
.
forEach
(
x
=>
{
x
.
disable
=
false
})
if
(
type
==
2
)
{
changePage
()
}
}
const
getDepartList
=
()
=>
{
customerService
.
getDeptTree
({
School_Id
:
0
}).
then
((
res
)
=>
{
if
(
res
.
data
.
Code
==
1
)
{
deptl
.
value
=
res
.
data
.
Data
}
})
}
const
getFieldInputType
=
()
=>
{
customerService
.
getCustomerFieldInputTypeEnumList
({}).
then
((
res
)
=>
{
if
(
res
.
data
.
Code
==
1
)
{
checkboxList
.
value
=
res
.
data
.
Data
}
})
}
onMounted
(()
=>
{
changePage
()
getCustomerFieldType
()
getDepartList
()
//获取部门
getFieldInputType
()
//输入类型
})
return
{
data
,
...
...
@@ -177,7 +225,17 @@
datadragEnd
,
getdata
,
godelete
,
setFiledState
setFiledState
,
goaddfield
,
Isadd
,
addMsg
,
getcancel
,
getCustomerFieldType
,
getDepartList
,
deptl
,
getFieldInputType
,
checkboxList
,
tabsList
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment