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>
<div class="addfield" style="padding: 0;margin: 0;">
<div style="padding: 0;margin: 0;">
<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>
<div class="text-h6">新建/修改字段</div>
</q-card-section>
......@@ -17,16 +17,35 @@
</template>
<template v-slot:after>
<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-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"
......@@ -34,17 +53,8 @@
</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">
......@@ -97,50 +107,80 @@
</div>
</template>
<script lang="ts">
import { defineComponent, ref, } from 'vue'
import { defineComponent, ref } from 'vue'
import { customerFieldlistType, customerFieldaddMsgType, customerFieldtabsType } from '@/@types/customer'
export default defineComponent({
props: {
passobj: {
type: Object,
default:()=> {},
default: () => { },
},
passdeptl: {
type: Array,
default: ()=> [],
default: () => [],
},
passtabsList: {
type: Array,
default: ()=> [],
default: () => [],
},
passcheckboxList: {
type: Array,
default: ()=> [],
default: () => [],
},
},
setup(props, ctx) {
let obj = ref(props.passobj)
let addMsg = ref(props.passobj)
let deptl = ref(props.passdeptl)
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 = () => {
ctx.emit('getcancel', 1)
}
const savewb = () => {//数据保存
}
return {
getcancel,//关闭弹窗
savewb,//保存数据
Isadd: ref(true),
obj,
addMsg,
deptl,
tabsList,
checkboxList,
splitterModel: ref(13),
tab: ref(1),
departmentType:ref('1')
}
}
})
</script>
\ No newline at end of file
</script>
<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 @@
</draggable>
</table>
<div >
<addfield v-if="Isadd" @getcancel='getcancel' :passobj="addMsg" :passdeptl="deptl" :passtabsList="tabsList" :passcheckboxList="checkboxList"></addfield>
<div>
<addfield v-if="Isadd" @getcancel='getcancel' :passobj="addMsg" :passdeptl="deptl" :passtabsList="tabsList"
:passcheckboxList="checkboxList"></addfield>
</div>
</div>
......@@ -68,30 +69,35 @@
import customerService from '@/api/customer'
import draggable from "vuedraggable";
import { useQuasar } from 'quasar'
import { customerFieldlistType, customerFieldaddMsgType, customerFieldtabsType } from '@/@types/customer'
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({
components: { draggable, addfield },
setup() {
const $q = useQuasar()
let data = ref < Array < listType >> ([])
let tabsList = ref < Array < tabsType >> ([])
let data = ref < Array < customerFieldlistType >> ([])
let tabsList = ref < Array < customerFieldtabsType >> ([])
let deptl = ref([])
let checkboxList = ref < Array < tabsType >> ([])
let checkboxList = ref < Array < customerFieldtabsType >> ([])
let dragId = ref(0);
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 = () => {
customerService.getCustomerFiledList({ Enable: -1 }).then((res) => {
data.value = res.data.Data
......@@ -142,7 +148,7 @@
}
})
}
const godelete = (item: listType, type: number) => {
const godelete = (item: customerFieldlistType, type: number) => {
let text = ''
if (type == 1) {//tyep等于1和2的时候 先让弹出提示 然后再给予掉接口 所以把原本的值暂时先赋值给本身
text = '确定修改启用状态'
......@@ -187,7 +193,21 @@
}
const goaddfield = () => {
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) => {
Isadd.value = false;
......@@ -198,14 +218,14 @@
changePage()
}
}
const getDepartList=()=>{
customerService.getDeptTree({School_Id: 0}).then((res) => {
const getDepartList = () => {
customerService.getDeptTree({ School_Id: 0 }).then((res) => {
if (res.data.Code == 1) {
deptl.value = res.data.Data
}
})
}
const getFieldInputType=()=>{
const getFieldInputType = () => {
customerService.getCustomerFieldInputTypeEnumList({}).then((res) => {
if (res.data.Code == 1) {
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