Commit 943e62be authored by Mac's avatar Mac

1

parent f91378d5
/** 客户字段列表 */
export declare interface customerFieldlistType {
Id: number
Enable: number
Required: number
[propName: string]: any
}
/** 获取客户子段类型枚举 */
export declare interface customerFieldtabsType {
Id: number
Name: string
disable?: boolean
}
/** 客户字段 新增的类型 */
export declare interface customerFieldaddMsgType {
Id: number
Type: number
Name: string
Required: number
DeptId: number
WordNum: number
InputType: string | Array<any>
OptionsList: Array<customerFieldtabsType>
Digits: number
Enable: number
}
\ No newline at end of file
<template> <template>
<div class="addfield" style="padding: 0;margin: 0;"> <div style="padding: 0;margin: 0;">
<q-dialog v-model="Isadd" persistent> <q-dialog v-model="Isadd" persistent>
<q-card style="width: 700px; max-width: 80vw;"> <q-card style="width: 700px; max-width: 80vw;" class="addfield">
<q-card-section> <q-card-section>
<div class="text-h6">新建/修改字段</div> <div class="text-h6">新建/修改字段</div>
</q-card-section> </q-card-section>
...@@ -17,16 +17,35 @@ ...@@ -17,16 +17,35 @@
</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="leftwidth">字段名称:</div>
<q-input clearable outlined v-model="addMsg.Name" counter maxlength="8"
:rules="[val => !!val || '请输入字段名称']" dense style="width: 400px;" />
</div>
<div class="rightrow">
<div class="leftwidth">部门选择:</div>
<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>
<div class="rightrow" v-if='tab==1'>
<div class="leftwidth">字数限制:</div>
<q-input v-model.number="addMsg.WordNum" outlined dense counter :rules="[val => !!val || '不能为空']"
type="number" :max='50' :min='0' maxlength="8" style="width: 400px" />
</div>
<div class="rightrow" v-if='tab==1'>
<div class="leftwidth">输入类型:</div>
<q-checkbox v-model="addMsg.InputType" v-for="(x,y) in checkboxList"
:key='y' :val="x.Id" :label="x.Name" />
</div>
<div class="rightrow" v-if='tab==2'>
<div class="leftwidth">文字字数:</div>
</div>
<!-- <el-form label-width="120px"> <!-- <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="部门选择:"> <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"> <div v-if="departmentType==2">
<selectTree :treeData='deptl' :defaultArray="returnString" nodeKey="DeptId" <selectTree :treeData='deptl' :defaultArray="returnString" nodeKey="DeptId"
:multiple="false" labelKey="DeptName" childrenKey="ChildList" :multiple="false" labelKey="DeptName" childrenKey="ChildList"
...@@ -34,17 +53,8 @@ ...@@ -34,17 +53,8 @@
</selectTree> </selectTree>
</div> </div>
</el-form-item> </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-form-item label="文字字数:" v-if='tab==2'>
<el-input-number v-model="addMsg.WordNum" @change="handleChange" :min="1" <el-input-number v-model="addMsg.WordNum" @change="handleChange" :min="1"
:max="2000"> :max="2000">
...@@ -97,50 +107,80 @@ ...@@ -97,50 +107,80 @@
</div> </div>
</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'
export default defineComponent({ export default defineComponent({
props: { props: {
passobj: { passobj: {
type: Object, type: Object,
default:()=> {}, default: () => { },
}, },
passdeptl: { passdeptl: {
type: Array, type: Array,
default: ()=> [], default: () => [],
}, },
passtabsList: { passtabsList: {
type: Array, type: Array,
default: ()=> [], default: () => [],
}, },
passcheckboxList: { passcheckboxList: {
type: Array, type: Array,
default: ()=> [], default: () => [],
}, },
}, },
setup(props, ctx) { setup(props, ctx) {
let obj = ref(props.passobj) let addMsg = ref(props.passobj)
let deptl = ref(props.passdeptl) let deptl = ref(props.passdeptl)
let tabsList = ref(props.passtabsList) let tabsList = ref(props.passtabsList)
let checkboxList = ref(props.passcheckboxList) let checkboxList = ref < Array < any >> ([])
checkboxList.value = props.passcheckboxList
if (addMsg.value.Id > 0) {
console.log()
} else {
addMsg.value.InputType = [];
checkboxList.value.forEach((x) => {
addMsg.value.InputType.push(x.Id)
})
}
const getcancel = () => { const getcancel = () => {
ctx.emit('getcancel', 1) ctx.emit('getcancel', 1)
} }
const savewb = () => {//数据保存 const savewb = () => {//数据保存
} }
return { return {
getcancel,//关闭弹窗 getcancel,//关闭弹窗
savewb,//保存数据 savewb,//保存数据
Isadd: ref(true), Isadd: ref(true),
obj, addMsg,
deptl, deptl,
tabsList, tabsList,
checkboxList, checkboxList,
splitterModel: ref(13), splitterModel: ref(13),
tab: ref(1), tab: ref(1),
departmentType:ref('1')
} }
} }
}) })
</script> </script>
\ No newline at end of file <style>
.addfield .rightrow {
display: flex;
align-items: flex-start;
}
.addfield .leftwidth {
width: 120px;
text-align: right;
height: 40px;
vertical-align: middle;
line-height: 40px;
font-size: 14px;
color: #606266;
padding: 0 12px 0 0;
}
</style>
\ No newline at end of file
...@@ -57,8 +57,9 @@ ...@@ -57,8 +57,9 @@
</draggable> </draggable>
</table> </table>
<div > <div>
<addfield v-if="Isadd" @getcancel='getcancel' :passobj="addMsg" :passdeptl="deptl" :passtabsList="tabsList" :passcheckboxList="checkboxList"></addfield> <addfield v-if="Isadd" @getcancel='getcancel' :passobj="addMsg" :passdeptl="deptl" :passtabsList="tabsList"
:passcheckboxList="checkboxList"></addfield>
</div> </div>
</div> </div>
...@@ -68,30 +69,35 @@ ...@@ -68,30 +69,35 @@
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 { customerFieldlistType, customerFieldaddMsgType, customerFieldtabsType } from '@/@types/customer'
import addfield from '../../../components/customer/addfield.vue' import addfield from '../../../components/customer/addfield.vue'
interface listType {
Id: number
Enable: number
Required: number
[propName: string]: any
}
interface tabsType {
Id: number
Name: string
disable: boolean
}
export default defineComponent({ export default defineComponent({
components: { draggable, addfield }, components: { draggable, addfield },
setup() { setup() {
const $q = useQuasar() const $q = useQuasar()
let data = ref < Array < listType >> ([]) let data = ref < Array < customerFieldlistType >> ([])
let tabsList = ref < Array < tabsType >> ([]) let tabsList = ref < Array < customerFieldtabsType >> ([])
let deptl = ref([]) let deptl = ref([])
let checkboxList = ref < Array < tabsType >> ([]) let checkboxList = ref < Array < customerFieldtabsType >> ([])
let dragId = ref(0); let dragId = ref(0);
let Isadd = ref(false) let Isadd = ref(false)
let addMsg = ref(null) let addMsg = ref < customerFieldaddMsgType > (
{
Id: 0,
Type: 1,
Name: '',
Required: 2,
DeptId: 0,
WordNum: 1,
InputType: '',
OptionsList: [{
Id: 1,
Name: ''
}],
Digits: 0,
Enable: 1,
}
)
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
...@@ -142,7 +148,7 @@ ...@@ -142,7 +148,7 @@
} }
}) })
} }
const godelete = (item: listType, type: number) => { const godelete = (item: customerFieldlistType, type: number) => {
let text = '' let text = ''
if (type == 1) {//tyep等于1和2的时候 先让弹出提示 然后再给予掉接口 所以把原本的值暂时先赋值给本身 if (type == 1) {//tyep等于1和2的时候 先让弹出提示 然后再给予掉接口 所以把原本的值暂时先赋值给本身
text = '确定修改启用状态' text = '确定修改启用状态'
...@@ -187,7 +193,21 @@ ...@@ -187,7 +193,21 @@
} }
const goaddfield = () => { const goaddfield = () => {
Isadd.value = true; Isadd.value = true;
addMsg.value = null; addMsg.value = {
Id: 0,
Type: 1,
Name: '',
Required: 2,
DeptId: 0,
WordNum: 1,
InputType: '',
OptionsList: [{
Id: 1,
Name: ''
}],
Digits: 0,
Enable: 1,
};
} }
const getcancel = (type: number) => { const getcancel = (type: number) => {
Isadd.value = false; Isadd.value = false;
...@@ -198,14 +218,14 @@ ...@@ -198,14 +218,14 @@
changePage() changePage()
} }
} }
const getDepartList=()=>{ const getDepartList = () => {
customerService.getDeptTree({School_Id: 0}).then((res) => { customerService.getDeptTree({ School_Id: 0 }).then((res) => {
if (res.data.Code == 1) { if (res.data.Code == 1) {
deptl.value = res.data.Data deptl.value = res.data.Data
} }
}) })
} }
const getFieldInputType=()=>{ const getFieldInputType = () => {
customerService.getCustomerFieldInputTypeEnumList({}).then((res) => { customerService.getCustomerFieldInputTypeEnumList({}).then((res) => {
if (res.data.Code == 1) { if (res.data.Code == 1) {
checkboxList.value = res.data.Data checkboxList.value = res.data.Data
......
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