Commit 98f19d85 by 无尘

add: 增加会员详情字段

parent 3a0a06f9
......@@ -7,10 +7,16 @@
<div class="custom-dialog-body">
<template v-for="(item,index) in customData">
<div class="detail-field-cell flex" :key="index">
<div class="detail-field-left">{{item.name}}</div>
<div class="detail-field-left">{{item.fieldName}}</div>
<div class="detail-field-right flex">
<el-checkbox-group class="flex flex-wrap" v-model="item.checkList" @change="customChange">
<el-checkbox v-for="(childItem,childIndex) in item.childList" :label="childItem.id" :key="childItem.id" name="type">{{childItem.name}}</el-checkbox>
<el-checkbox v-for="(childItem,childIndex) in item.children"
:label="childItem.fieldCode"
:key="childItem.fieldCode"
:disabled="childItem.disable"
name="type" >
{{childItem.fieldName}}
</el-checkbox>
</el-checkbox-group>
</div>
</div>
......@@ -35,91 +41,97 @@
type: Boolean,
default: false
},
datailData: {
detailData: {
type: Array,
default: []
},
dataType: {
type: Number,
default: 1 //'类型:1行政架构,2门店架构'
}
},
data () {
return {
repProjectName: 'gic-web', // 项目名
customDialog: false, // 弹框显示
fixData: ['clerkName','clerkPhone','groupName','positionName'],
fixDataStore: ['clerkName','clerkPhone','groupName','positionName','clerkCode'],
// 复选框数据
customData: [
{
id: 1,
name: "基本信息",
fieldCode: 1,
fieldName: "基本信息",
checkList: [],
childList: [
children: [
{
id: 'name',
name: '姓名'
fieldCode: 'name',
fieldName: '姓名'
},
{
id: 'depart',
name: '部门'
fieldCode: 'depart',
fieldName: '部门'
},
{
id: 'phone',
name: '手机号'
fieldCode: 'phone',
fieldName: '手机号'
},
{
id: 'email',
name: '邮箱'
fieldCode: 'email',
fieldName: '邮箱'
},
{
id: 'profession',
name: '职业'
fieldCode: 'profession',
fieldName: '职业'
},
{
id: 'hiredate',
name: '入职时间'
fieldCode: 'hiredate',
fieldName: '入职时间'
},
]
},
{
id: 2,
name: "工作信息",
fieldCode: 2,
fieldName: "工作信息",
checkList: [],
childList: [
children: [
{
id: 'name',
name: '姓名'
fieldCode: 'name',
fieldName: '姓名'
},
{
id: 'depart',
name: '部门'
fieldCode: 'depart',
fieldName: '部门'
}
]
},
{
id: 3,
name: "个人信息",
fieldCode: 3,
fieldName: "个人信息",
checkList: [],
childList: [
children: [
{
id: 'name',
name: '姓名'
fieldCode: 'name',
fieldName: '姓名'
},
{
id: 'depart',
name: '部门'
fieldCode: 'depart',
fieldName: '部门'
},
]
},
{
id: 4,
name: "学历信息",
fieldCode: 4,
fieldName: "学历信息",
checkList: [],
childList: [
children: [
{
id: 'name',
name: '姓名'
fieldCode: 'name',
fieldName: '姓名'
},
{
id: 'depart',
name: '部门'
fieldCode: 'depart',
fieldName: '部门'
},
]
},
......@@ -141,6 +153,9 @@
that.baseUrl = host
}
},
computed: {
},
methods:{
/**
......@@ -157,16 +172,18 @@
customCancel() {
const that = this;
that.customDialog = false
that.$emit('customHandleConfirm')
that.$emit('customHandleConfirm','hide')
},
/**
* 确定
*/
customConfirm() {
const that = this;
// console.log(that.customData)
that.$emit('customHandleConfirm')
that.checkList = that.customData.map(item=>item.checkList).flat();
that.saveFields(that.dataType)
},
/**
......@@ -187,13 +204,13 @@
type: type,// 类型:1行政架构,2门店架构'
}
postRequest('/haoban-manage-web/employee-show-field-detail.json',para)
postRequest('/haoban-manage-web/record/employee-show-field-save.json',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 1) {
showMsg.showmsg('操作成功','success')
showMsg.showmsg('添加成功','success');
that.$emit('customHandleConfirm')
return;
}
......@@ -266,40 +283,30 @@
*/
handleAllFields(result) {
const that = this
result.forEach(function(ele,index){
if (!!that.hasOwnProperty(ele.parentCode)) {
ele.fixed = parseInt(ele.fixed) === 1? true : false;
ele.isMust = parseInt(ele.isMust) === 1? true : false;
ele.fieldEdited = parseInt(ele.fieldEdited) === 1? true : false;
ele.systemFlag = true;
ele.fieldOperations = !!ele.fieldOperations? JSON.parse(ele.fieldOperations): {};
ele.staffRecordsIds = !!ele.staffRecordsIds? JSON.parse(ele.staffRecordsIds): [];
that[ele.parentCode].push(ele);
};
// 设置 fieldParent
if (!!that.fieldParent.hasOwnProperty(ele.fieldCode)) {
ele.children = [];
that.fieldParent[ele.fieldCode] = ele;
ele.systemFlag = true;
}
// console.log(that.treeData(result))
let newResult = that.treeData(result);
newResult.forEach(function(ele,index){
ele.checkList = []
// ele.children.forEach(function(el,key){
// el.disable = that.dataType == 1 ? that.fixData.includes(el.fieldCode) : that.fixDataStore.includes(el.fieldCode)
// })
})
that.customData = newResult;
},
formatDate(time,flag) {
/**
* 处理已选信息
*/
handleDetailData() {
const that = this
// (0-9)年月数字的显示
function formatDig(num) {
return num > 9 ? '' + num : '0' + num;
}
var myDate = new Date(time);
let y = myDate.getFullYear();
let m = myDate.getMonth()+1;
let d = myDate.getDate();
return y + flag + formatDig(m) + flag + formatDig(d) + flag
that.customData.forEach(function(ele,index) {
ele.checkList = [];
ele.children.forEach(function(el,key){
that.checkList.includes(el.fieldCode)? ele.checkList.push(el.fieldCode): '';
el.disable = that.dataType == 1 ? that.fixData.includes(el.fieldCode) : that.fixDataStore.includes(el.fieldCode)
})
})
}
},
......@@ -308,17 +315,20 @@
const that = this;
that.customDialog = newData
},
datailData: function(newData,oldData){
detailData: function(newData,oldData){
const that = this;
// console.log(newData)
that.checkList = !!newData && !!newData.length ? newData: [];
},
that.handleDetailData()
}
},
/* 接收数据 */
mounted(){
console.log("传递的参数对象:",this.showCustomDialog)
// console.log("传递的参数对象:",this.showCustomDialog)
const that = this;
that.customDialog = that.showCustomDialog
that.customDialog = that.showCustomDialog;
that.getAllFields()
},
}
......
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