Commit c5222b54 authored by Mac's avatar Mac

新增

parent 1c9ab861
...@@ -63,6 +63,30 @@ ...@@ -63,6 +63,30 @@
data 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 export default customerService
<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
<template> <template>
<!-- <requestgroup></requestgroup> -->
<div class="q-pa-md customerField"> <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"> <table class="payTable">
<thead> <thead>
<tr> <tr>
...@@ -17,7 +20,7 @@ ...@@ -17,7 +20,7 @@
<tr v-if="data && data.length==0"> <tr v-if="data && data.length==0">
<td :colspan="8" align="center">暂无数据</td> <td :colspan="8" align="center">暂无数据</td>
</tr> </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 }"> <template #item="{ element }">
<tr> <tr>
<td><span>{{element.Name}}</span></td> <td><span>{{element.Name}}</span></td>
...@@ -30,11 +33,11 @@ ...@@ -30,11 +33,11 @@
<q-toggle v-if="element.IsLock==1" v-model="element.Enable" :true-value="1" :false-value="2" <q-toggle v-if="element.IsLock==1" v-model="element.Enable" :true-value="1" :false-value="2"
icon="lock" disable /> icon="lock" disable />
<q-toggle v-else v-model="element.Enable" :true-value="1" :false-value="2" <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>
<td> <td>
<q-toggle v-model="element.Required" :true-value="1" :false-value="2" <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>
<td> <td>
<div>{{element.UpdateByName}}</div> <div>{{element.UpdateByName}}</div>
...@@ -44,7 +47,7 @@ ...@@ -44,7 +47,7 @@
<q-btn flat size="xs" icon="edit" style="font-weight:400;color: #3FC4FF" class="q-mr-xs" <q-btn flat size="xs" icon="edit" style="font-weight:400;color: #3FC4FF" class="q-mr-xs"
label="编辑" @click="goedit(element)" /> label="编辑" @click="goedit(element)" />
<q-btn v-if='element.IsDefault!=1' flat size="xs" icon="delete" color="negative" <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>
<td> <td>
<i class="iconfont icon-drag" style="font-size: 20px;color: #777;"></i> <i class="iconfont icon-drag" style="font-size: 20px;color: #777;"></i>
...@@ -54,39 +57,52 @@ ...@@ -54,39 +57,52 @@
</draggable> </draggable>
</table> </table>
<div >
<addfield v-if="Isadd" @getcancel='getcancel' :passobj="addMsg" :passdeptl="deptl" :passtabsList="tabsList" :passcheckboxList="checkboxList"></addfield>
</div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent ,ref, onMounted, } from 'vue' import { defineComponent, ref, onMounted, } from 'vue'
// import requestgroup from '../../../components/customer/request-group.vue'
import customerService from '@/api/customer' import customerService from '@/api/customer'
import draggable from "vuedraggable"; import draggable from "vuedraggable";
import { useQuasar } from 'quasar' import { useQuasar } from 'quasar'
import addfield from '../../../components/customer/addfield.vue'
interface listType { interface listType {
Id: number Id: number
Enable:number Enable: number
Required?:number Required: number
[propName:string]:any [propName: string]: any
}
interface tabsType {
Id: number
Name: string
disable: boolean
} }
export default defineComponent({ export default defineComponent({
components: { draggable }, components: { draggable, addfield },
setup() { setup() {
const $q = useQuasar() const $q = useQuasar()
let data= ref<Array<listType>>([]) let data = ref < Array < listType >> ([])
let dragId =ref(0); 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 = () => { const changePage = () => {
customerService.getCustomerFiledList({ Enable: -1 }).then((res) => { 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) // console.log('拖动结束',e)
let olddragId = 0 let olddragId = 0
if(e.newIndex>0){ if (e.newIndex > 0) {
olddragId = data.value[e.newIndex-1].Id olddragId = data.value[e.newIndex - 1].Id
}else{ } else {
olddragId = 0 olddragId = 0
} }
let msg = { let msg = {
...@@ -97,13 +113,13 @@ ...@@ -97,13 +113,13 @@
customerService.setCustomerFiledState(msg).then((res) => { customerService.setCustomerFiledState(msg).then((res) => {
if (res.data.Code == 1) { if (res.data.Code == 1) {
console.log(res) console.log(res)
}else{//如果移动失败 重新获取列表 } else {//如果移动失败 重新获取列表
changePage() changePage()
} }
}) })
} }
const getdata = (e:any) => { const getdata = (e: any) => {
dragId.value = e.draggedContext.element.Id dragId.value = e.draggedContext.element.Id
} }
const setFiledState = (item, Type) => { const setFiledState = (item, Type) => {
...@@ -122,34 +138,29 @@ ...@@ -122,34 +138,29 @@
position: 'top' position: 'top'
}) })
changePage() changePage()
}else{//如果移动失败 重新获取列表 } else {//如果移动失败 重新获取列表
} }
}) })
} }
const godelete = (item:listType,type:number,index:number) => { const godelete = (item: listType, type: number) => {
let text = '' let text = ''
console.log(item) if (type == 1) {//tyep等于1和2的时候 先让弹出提示 然后再给予掉接口 所以把原本的值暂时先赋值给本身
if(type==1){//tyep等于1和2的时候 先让弹出提示 然后再给予掉接口 所以把原本的值暂时先赋值给本身
text = '确定修改启用状态' text = '确定修改启用状态'
if(item.Enable==2){ if (item.Enable == 2) {
item.Enable = 1
data.value[index].Enable = 1 } else {
}else{ item.Enable = 2
data.value[index].Enable = 2
} }
}else if(type==2){ } else if (type == 2) {
text = '确定修改必填状态' text = '确定修改必填状态'
if(item.Required==2){ if (item.Required == 2) {
data.value[index].Required = 1 item.Required = 1
console.log( data.value[index].Required,' data.value[index].Required') } else {
item.Required = 2
}else{
data.value[index].Required = 2
} }
}else if(type==3){ } else if (type == 3) {
text = '删除后字段不在显示,是否删除?' text = '删除后字段不在显示,是否删除?'
} }
console.log(text)
$q.dialog({ $q.dialog({
title: "提示信息", title: "提示信息",
message: text, message: text,
...@@ -166,10 +177,47 @@ ...@@ -166,10 +177,47 @@
setFiledState(item, type) setFiledState(item, type)
}); });
} }
const getCustomerFieldType = () => {
customerService.getCustomerFieldTypeEnumList({}).then((res) => {
if (res.data.Code == 1) {
tabsList.value = res.data.Data
}
})
}
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(() => { onMounted(() => {
changePage() changePage()
getCustomerFieldType()
getDepartList()//获取部门
getFieldInputType()//输入类型
}) })
return { return {
data, data,
...@@ -177,7 +225,17 @@ ...@@ -177,7 +225,17 @@
datadragEnd, datadragEnd,
getdata, getdata,
godelete, godelete,
setFiledState setFiledState,
goaddfield,
Isadd,
addMsg,
getcancel,
getCustomerFieldType,
getDepartList,
deptl,
getFieldInputType,
checkboxList,
tabsList
} }
} }
......
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