smart-admin-h5

This commit is contained in:
zhuoda
2020-11-29 23:35:57 +08:00
parent fb33580397
commit 49da08dfc1
80 changed files with 8181 additions and 1 deletions

View File

@@ -0,0 +1,54 @@
<template>
<div>
<van-tabbar fixed route v-model="active" @change="handleChange">
<van-tabbar-item v-for="(item, index) in data" :to="item.to" :icon="item.icon" :key="index">
{{ item.title }}
</van-tabbar-item>
</van-tabbar>
</div>
</template>
<script>
export default {
name: 'TabBar',
props: {
defaultActive: {
type: Number,
default: 0
},
data: {
type: Array,
default: () => {
return []
}
}
},
data() {
return {
active: this.defaultActive
}
},
methods: {
handleChange(value) {
this.$emit('change', value)
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@@ -0,0 +1,120 @@
/**
* @descriptiondepartment-employee-selector
* @author: zhuoda
*/
<template>
<div style="padding: 20px">
<template v-if="isRadio">
<van-radio-group v-model="radioSelectEmployeeId">
<van-radio
v-for="item in employeeList"
:key="item.id"
:name="item.id"
style="margin-top: 5px"
@click="clickRadio"
>
{{
item.actualName
}}
</van-radio>
</van-radio-group>
</template>
<template v-if="!isRadio">
<van-checkbox-group ref="checkboxGroup" :max="max" v-model="selectEmployeeList">
<van-checkbox
:key="item.id"
:name="item.id"
v-model="item._checked"
v-for="item in employeeList"
style="margin-top: 5px">
{{
item.actualName
}}
</van-checkbox>
</van-checkbox-group>
</template>
<br>
<van-button v-if="!isRadio" type="primary" size="small" @click="checkAll" style="margin:0 10px">全选</van-button>
<van-button v-if="!isRadio" type="info" size="small" @click="toggleAll">反选</van-button>
</div>
</template>
<script>
import { systemConfigApi } from '@/api/system-config';
import { employeeApi } from 'api/employee';
export default {
name: 'DepartmentEmployeeSelector',
props: {
// 最大数
max: Number,
isRadio: Boolean
},
data() {
return {
selectEmployeeList: [],
employeeList: [],
radioSelectEmployeeId: null,
radioSelectEmployeeName: null
};
},
created() {
this.loadEmployeeList();
},
methods: {
updateRadioSelectEmployeeId(employeeId) {
this.radioSelectEmployeeId = employeeId;
},
clickRadio(e, val) {
this.radioSelectEmployeeName = e.target.innerText;
},
getSelected() {
if (this.isRadio) {
return [{
id: this.radioSelectEmployeeId,
actualName: this.radioSelectEmployeeName
}];
} else {
const result = [];
for (const employee of this.employeeList) {
if (this.selectEmployeeList.indexOf(employee.id) > -1) {
result.push(Object.assign({}, employee));
}
}
return result;
}
},
async loadEmployeeList() {
this.$smart.loading();
try {
const departmentIdResult = await systemConfigApi.getConfigListByKey('crm_school_share_department_id');
const employeeListResult = await employeeApi.getListEmployeeByDeptId(departmentIdResult.data.configValue);
this.employeeList = employeeListResult.data.filter(e => e.isDelete === 0 && e.isDisabled === 0).map(e => {
e._checked = false;
return e;
});
} catch (e) {
this.$smartSentry.captureException(e);
} finally {
this.$smart.loadingClear();
}
},
checkAll() {
this.$refs.checkboxGroup.toggleAll(true);
},
toggleAll() {
this.$refs.checkboxGroup.toggleAll();
}
}
};
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,61 @@
<template>
<div>
<van-field
v-model="result"
v-bind="$attrs"
readonly
is-link
@click="show = !show"
/>
<van-popup v-model="show" position="bottom">
<van-picker
value-key="desc"
:columns="columns"
show-toolbar
:title="$attrs.label"
@cancel="show = !show"
@confirm="onConfirm"
/>
</van-popup>
</div>
</template>
<script>
export default {
name: 'SmartEnumSelectPicker',
model: {
prop: 'selectValue'
},
props: {
enumName: {
type: String
},
selectValue: {
type: String
}
},
data() {
return {
show: false,
result: this.selectValue,
columns: this.$enum.getValueDescList(this.enumName)
};
},
methods: {
onConfirm(value) {
this.result = value.desc;
this.show = !this.show;
this.$emit('change', value);
}
},
watch: {
selectValue: function(newVal) {
this.result = newVal;
},
result(newVal) {
this.$emit('input', newVal);
}
}
};
</script>
<style></style>

View File

@@ -0,0 +1,59 @@
<template>
<div>
<van-field
v-model="result"
v-bind="$attrs"
readonly
is-link
@click="show = !show"
/>
<van-popup v-model="show" position="bottom">
<van-picker
value-key="value"
:columns="columns"
show-toolbar
:title="$attrs.label"
@cancel="show = !show"
@confirm="onConfirm"
/>
</van-popup>
</div>
</template>
<script>
export default {
model: {
prop: 'selectValue'
},
props: {
columns: {
type: Array
},
selectValue: {
type: String
}
},
data() {
return {
show: false,
result: this.selectValue
};
},
methods: {
onConfirm(value) {
this.result = value;
this.show = !this.show;
}
},
watch: {
selectValue: function(newVal) {
this.result = newVal;
},
result(newVal) {
this.$emit('input', newVal);
}
}
};
</script>
<style></style>

View File

@@ -0,0 +1,24 @@
<template>
<van-nav-bar :title="title" left-text="返回" left-arrow @click-left="onClickLeft" />
</template>
<script>
export default {
name: 'BackNavBar',
props: {
title: {
type: String
}
},
data() {
return {};
},
methods: {
onClickLeft() {
this.$router.go(-1);
}
}
};
</script>

View File

@@ -0,0 +1,27 @@
<template>
<van-nav-bar :title="title" left-text="返回" left-arrow @click-left="onClickLeft" />
</template>
<script>
export default {
name: 'RouterNavBar',
props: {
title: {
type: String
},
path: {
type: String
}
},
data() {
return {};
},
methods: {
onClickLeft() {
this.$router.push(this.path);
}
}
};
</script>