|
@@ -0,0 +1,840 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <ag-grid-layout
|
|
|
+ :table-height="tableHeight"
|
|
|
+ theme="ag-theme-alpine"
|
|
|
+ :column-defs="columnDefs"
|
|
|
+ :row-data="tableData"
|
|
|
+ :locale-text="localeText"
|
|
|
+ :grid-options="gridOptions"
|
|
|
+ :default-col-def="defaultColDef"
|
|
|
+ :animate-rows="true"
|
|
|
+ :row-selection="rowSelection"
|
|
|
+ row-height="50"
|
|
|
+ @filterChanged="filterModifed"
|
|
|
+ @sortChanged="gridSortChange"
|
|
|
+ >
|
|
|
+ <div slot="toolbar" class="inner-toolbar">
|
|
|
+ <div class="toolbar-search">
|
|
|
+ <en-table-search placeholder="请输入搜索关键字" @search="handlerSearch" />
|
|
|
+ </div>
|
|
|
+ <div class="toolbar-btns">
|
|
|
+ <el-button type="primary" @click="handleAddMember">新增</el-button>
|
|
|
+ <!-- <el-button type="danger" @click="batchDelete">禁用</el-button>-->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-pagination
|
|
|
+ v-if="pageData"
|
|
|
+ slot="pagination"
|
|
|
+ :current-page="pageData.page_no"
|
|
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
|
+ :page-size="pageData.page_size"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="pageData.data_total"
|
|
|
+ @size-change="handlePageSizeChange"
|
|
|
+ @current-change="handlePageCurrentChange"
|
|
|
+ />
|
|
|
+ </ag-grid-layout>
|
|
|
+ <!--添加会员 dialog-->
|
|
|
+ <el-dialog
|
|
|
+ title="编辑成员信息"
|
|
|
+ :visible.sync="dialogAddMemberVisible"
|
|
|
+ width="60%"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ >
|
|
|
+ <el-form ref="addMemberForm" :model="addMemberForm" :rules="addMemberRules" label-width="110px" class="formwrap">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="头像">
|
|
|
+ <el-upload
|
|
|
+ class="avatar-uploader"
|
|
|
+ :action="`${uploadurl}?scene=avatar`"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="uploaded"
|
|
|
+ :before-upload="handleShopLogoBefore"
|
|
|
+ >
|
|
|
+ <img v-if="imageUrl" :src="imageUrl" class="avatar">
|
|
|
+ <i v-else class="el-icon-plus avatar-uploader-icon" />
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="登录名" prop="uname">
|
|
|
+ <el-input v-model="addMemberForm.uname" :maxlength="20" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="密码" prop="password">
|
|
|
+ <el-input v-model="addMemberForm.password" :type="pwdType" :maxlength="20" />
|
|
|
+ <span class="show-pwd" @click="pwdType = pwdType === 'password' ? 'text' : 'password'">
|
|
|
+ <svg-icon :icon-class="pwdType === 'password' ? 'eye' : 'eye-open'" />
|
|
|
+ </span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="真实姓名" prop="nickname">
|
|
|
+ <el-input v-model="addMemberForm.nickname" :maxlength="20" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="手机号码" prop="mobile">
|
|
|
+ <el-input v-model.number="addMemberForm.mobile" :maxlength="11" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="性别" class="form-item-sex">
|
|
|
+ <el-radio v-model="addMemberForm.sex" :label="1">男</el-radio>
|
|
|
+ <el-radio v-model="addMemberForm.sex" :label="0">女</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <!--固定电话-->
|
|
|
+ <el-form-item label="身份证号">
|
|
|
+ <el-input v-model="addMemberForm.midentity" :maxlength="20" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12" />
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <!--生日-->
|
|
|
+ <el-form-item label="生日" prop="birthday">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="addMemberForm.birthday"
|
|
|
+ type="date"
|
|
|
+ :editable="false"
|
|
|
+ value-format="timestamp"
|
|
|
+ placeholder="选择生日"
|
|
|
+ :picker-options="{disabledDate(time) { return time.getTime() > Date.now() }}"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="角色" prop="role_id">
|
|
|
+ <el-select
|
|
|
+ v-model="addMemberForm.role_id"
|
|
|
+ placeholder="请选择角色"
|
|
|
+ :disabled="roleTypeDisabled"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+
|
|
|
+ <el-option
|
|
|
+ v-for="item in rolesOptions"
|
|
|
+ :key="item.role_id"
|
|
|
+ :label="item.role_name"
|
|
|
+ :value="item.role_id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <!--详细地址-->
|
|
|
+ <el-form-item label="详细地址" prop="address">
|
|
|
+ <el-input v-model="addMemberForm.address" :maxlength="50" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="所负责机构" prop="shop_id">
|
|
|
+ <el-select v-model="addMemberForm.shop_id" placeholder="选择机构" :disabled="shopDisabled" clearable>
|
|
|
+ <el-option v-for="(item, index) in shopOptions" :key="index" :label="item.shop_name" :value="item.shop_id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row v-if="nurseList.length > 0">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="小组成员">
|
|
|
+ <div class="text item">
|
|
|
+ <el-row>
|
|
|
+ <el-checkbox-group v-model="newCheckList">
|
|
|
+ <el-col v-for="(bed,_index) in nurseClerkList" :key="_index" :xs="8" :sm="8" :md="6" :lg="6" :xl="6">
|
|
|
+ <el-checkbox :label="bed.clerk_id" @change="handleCheckboxChanged(bed)">
|
|
|
+ <span v-if="bed.group_id && !bed.checked" style="color: #13ce66">{{ bed.clerk_name }} <span style="color: #302db4">{{ bed.group_name }}</span></span>
|
|
|
+ <span v-else>{{ bed.clerk_name }}</span>
|
|
|
+ </el-checkbox>
|
|
|
+ </el-col>
|
|
|
+ </el-checkbox-group>
|
|
|
+ <el-col v-for="(bed,_index) in nurseClerkList" :key="_index" :xs="8" :sm="8" :md="6" :lg="6" :xl="6">
|
|
|
+ <!-- <el-checkbox v-model="bed.checked">-->
|
|
|
+ <!-- <span v-if="bed.group_id && !bed.checked" style="color: #13ce66">{{ bed.clerk_name }} <span style="color: #302db4">{{ bed.group_name }}</span></span>-->
|
|
|
+ <!-- <span v-else>{{ bed.clerk_name }}</span>-->
|
|
|
+ <!-- </el-checkbox>-->
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- <el-row>-->
|
|
|
+ <!-- <el-col :span="12">-->
|
|
|
+ <!-- <!–地区–>-->
|
|
|
+ <!-- <el-form-item label="地区" prop="region" class="form-item-region">-->
|
|
|
+ <!-- <en-region-picker :api="MixinRegionApi" @changed="(object) => { addMemberForm.region = object.last_id }"/>-->
|
|
|
+ <!-- </el-form-item>-->
|
|
|
+ <!-- </el-col>-->
|
|
|
+ <!-- <el-col :span="12">-->
|
|
|
+
|
|
|
+ <!-- <!–邮箱–>-->
|
|
|
+ <!-- <el-form-item label="邮箱" prop="email">-->
|
|
|
+ <!-- <el-input v-model="addMemberForm.email"></el-input>-->
|
|
|
+ <!-- </el-form-item>-->
|
|
|
+ <!-- </el-col>-->
|
|
|
+ <!-- </el-row>-->
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogAddMemberVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitAddMemberForm('addMemberForm')">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <template>
|
|
|
+ <image-viewer v-if="showViewer" :on-close="closeViewer" :url-list="srcList" />
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { serverUrl } from '@/utils/domain'
|
|
|
+import * as clerk_API from '@/api/ncs_clerk'
|
|
|
+import * as shop_API from '@/api/ncs_shop'
|
|
|
+import * as RegExp from '@/utils/RegExp'
|
|
|
+import { AG_GRID_LOCALE_CN } from '@/utils/AgGridVueLocaleCn'
|
|
|
+import ButtonCellRender from '@/components/AgGridCellRender/ButtonCellRender'
|
|
|
+import AgGridImg from '@/components/AgGridImg/AgGridImg'
|
|
|
+import ImageViewer from 'element-ui/packages/image/src/image-viewer'
|
|
|
+import RadioFilter from '@/components/AgGridCustomFilter/RadioFilter'
|
|
|
+import { ROLE_TYPE } from '@/utils/enum/RoleTypeEnum'
|
|
|
+let prevOverflow = ''
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'CareDoctorManager',
|
|
|
+ components: { ButtonCellRender, AgGridImg, ImageViewer, RadioFilter },
|
|
|
+ props: {
|
|
|
+ partId: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ uploadurl: serverUrl + '/ncs/upload/uploadFile',
|
|
|
+ imageUrl: '',
|
|
|
+ /** 列表loading状态 */
|
|
|
+ loading: false,
|
|
|
+ /** 列表参数 */
|
|
|
+ params: {
|
|
|
+ page_size: 10,
|
|
|
+ page_no: 1,
|
|
|
+ sort: 'nc.member_id',
|
|
|
+ dir: 'asc'
|
|
|
+ },
|
|
|
+ /** 列表数据 */
|
|
|
+ tableData: [],
|
|
|
+ pageData: [],
|
|
|
+ /** 添加会员弹出框指示 */
|
|
|
+ dialogAddMemberVisible: false,
|
|
|
+ /** 添加会员 表单数据 */
|
|
|
+ addMemberForm: {},
|
|
|
+ /** 选中行数据 */
|
|
|
+ multipleSelection: [],
|
|
|
+ rolesOptions: [],
|
|
|
+ shopOptions: [],
|
|
|
+ /**
|
|
|
+ * 角色选择,如果是机构负责人无法选择
|
|
|
+ */
|
|
|
+ roleTypeDisabled: false,
|
|
|
+ /**
|
|
|
+ * 机构选择,如果是机构负责人无法选择
|
|
|
+ */
|
|
|
+ shopDisabled: false,
|
|
|
+ /** 添加会员 表单规则 */
|
|
|
+ addMemberRules: {
|
|
|
+ uname: [
|
|
|
+ this.MixinRequired('请输入用户名'),
|
|
|
+ { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ password: [
|
|
|
+ this.MixinRequired('请输入密码!'),
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (!RegExp.password.test(value)) {
|
|
|
+ callback(new Error('密码格式有误,密码只能包含字母数字和!#$%^&*.~,字符,长度为6-20位'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ nickname: [
|
|
|
+ this.MixinRequired('请输入真实姓名'),
|
|
|
+ { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ role_id: [this.MixinRequired('请选择角色')],
|
|
|
+ mobile: [
|
|
|
+ this.MixinRequired('请输入手机号码!'),
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (!RegExp.mobile.test(value)) {
|
|
|
+ callback(new Error('手机格式格式有误'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ address: [
|
|
|
+ { max: 50, message: '最长50个字符', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ shop_id: [
|
|
|
+ { required: true, message: '请选择机构', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ pwdType: 'password',
|
|
|
+ srcList: ['1'],
|
|
|
+ columnDefs: null, // 新表格
|
|
|
+ defaultColDef: null,
|
|
|
+ gridOptions: null,
|
|
|
+ gridApi: null,
|
|
|
+ columnApi: null,
|
|
|
+ localeText: AG_GRID_LOCALE_CN,
|
|
|
+ rowSelection: null,
|
|
|
+ showViewer: false,
|
|
|
+ sexTransfer: [
|
|
|
+ { key: '男', value: 1 },
|
|
|
+ { key: '女', value: 0 }
|
|
|
+ ],
|
|
|
+ roleId: null,
|
|
|
+ roleZzId: null,
|
|
|
+ newCheckList: [],
|
|
|
+ oldCheckList: [],
|
|
|
+ nurseList: [],
|
|
|
+ shopId: null,
|
|
|
+ nurseClerkList: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ tableHeight() {
|
|
|
+ return this.mainAreaHeight - 130
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ partId(val, oldvalue) {
|
|
|
+ if (val === null) {
|
|
|
+ this.shopId = this.$store.getters.partId
|
|
|
+ } else {
|
|
|
+ this.shopId = val
|
|
|
+ }
|
|
|
+ this.params.fixedCondition = 'nc.shop_id=' + this.shopId
|
|
|
+ this.GET_MemberList()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeMount() {
|
|
|
+ this.gridOptions = {
|
|
|
+ }
|
|
|
+ this.columnDefs = [
|
|
|
+ {
|
|
|
+ headerName: '#',
|
|
|
+ headerCheckboxSelection: true,
|
|
|
+ headerCheckboxSelectionFilteredOnly: true,
|
|
|
+ checkboxSelection: true,
|
|
|
+ sortable: false, filter: false,
|
|
|
+ width: 50,
|
|
|
+ resizable: false,
|
|
|
+ valueGetter: this.hashValueGetter
|
|
|
+ },
|
|
|
+ { headerName: '头像', field: 'face', sortable: true, filter: false, width: 70,
|
|
|
+ cellRendererFramework: 'AgGridImg',
|
|
|
+ cellRendererParams: param => {
|
|
|
+ return {
|
|
|
+ onClick: this.lookBigImg,
|
|
|
+ face: 'face'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: '登录名', field: 'uname', sortable: true, filter: true, minWidth: 170 },
|
|
|
+ { headerName: '真实名字', field: 'clerk_name', sortable: true, filter: true, minWidth: 120 },
|
|
|
+ { headerName: '性别', field: 'sex', sortable: true, valueFormatter: this.formatterSex, width: 100, filterFramework: 'RadioFilter',
|
|
|
+ filterParams: {
|
|
|
+ listData: this.sexTransfer
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: '手机', field: 'mobile', sortable: true, filter: true, minWidth: 170 },
|
|
|
+ { headerName: '角色', field: 'role_name', sortable: true, filter: false, valueFormatter: this.formatterRole, width: 120 },
|
|
|
+ { headerName: '操作', field: 'id',
|
|
|
+ cellRendererFramework: 'ButtonCellRender',
|
|
|
+ cellRendererParams: param => {
|
|
|
+ return {
|
|
|
+ onClick: this.handlerEdit,
|
|
|
+ label: '编辑',
|
|
|
+ buttonType: 'primary',
|
|
|
+ buttonSize: 'mini'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ filter: false,
|
|
|
+ pinned: 'right',
|
|
|
+ lockPinned: true,
|
|
|
+ width: 100,
|
|
|
+ resizable: false,
|
|
|
+ sortable: false
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ this.defaultColDef = {
|
|
|
+ filter: 'agTextColumnFilter',
|
|
|
+ sortable: true,
|
|
|
+ resizable: true,
|
|
|
+ comparator: this.testComparator,
|
|
|
+ filterParams: {
|
|
|
+ debounceMs: 200,
|
|
|
+ newRowsAction: 'keep',
|
|
|
+ textCustomComparator: this.textCustomComparator,
|
|
|
+ comparator: this.testComparator
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.rowSelection = 'multiple'
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.gridApi = this.gridOptions.api
|
|
|
+ this.getRoles({ page_size: 200, page_no: 1, fixedCondition: ' shop_id = -1', sort: ' role_id', dir: 'desc' })
|
|
|
+ if (this.partId === 0) {
|
|
|
+ this.shopId = this.$store.getters.partId
|
|
|
+ } else {
|
|
|
+ this.shopId = this.partId
|
|
|
+ }
|
|
|
+ this.params.fixedCondition = 'ns.shop_id = ' + this.shopId + ' or ns.parent_id = ' + this.shopId
|
|
|
+ this.GET_MemberList()
|
|
|
+ this.getShopOptions(this.shopId)
|
|
|
+ },
|
|
|
+ activated() {
|
|
|
+ this.GET_MemberList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 选择行变化时,记录选中的行数据 */
|
|
|
+ selectFun(val) {
|
|
|
+ this.multipleSelection = val
|
|
|
+ },
|
|
|
+ /** 加载用户列表 */
|
|
|
+ GET_MemberList() {
|
|
|
+ this.loading = true
|
|
|
+ this.gridApi.showLoadingOverlay()
|
|
|
+ this.gridApi.sizeColumnsToFit()
|
|
|
+ clerk_API.getClerkList(this.params).then(response => {
|
|
|
+ this.loading = false
|
|
|
+ const size = 0
|
|
|
+ // response.data.forEach((item, index) => {
|
|
|
+ // if (item.founder === 1) {
|
|
|
+ // delete response.data[index]
|
|
|
+ // size++
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ this.tableData = response.data
|
|
|
+ this.pageData = {
|
|
|
+ page_no: response.page_no,
|
|
|
+ page_size: response.page_size,
|
|
|
+ data_total: response.data_total - size
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 处理搜索 **/
|
|
|
+ handlerSearch(keywords) {
|
|
|
+ this.params.query = keywords
|
|
|
+ this.GET_MemberList()
|
|
|
+ },
|
|
|
+ /** 单条数据删除处理 */
|
|
|
+ handlerDelete(ids) {
|
|
|
+ this.$confirm('你确定要禁用此用户?', '警告', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ clerk_API.remove(ids).then(
|
|
|
+ response => {
|
|
|
+ this.GET_MemberList()
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '已禁用!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ ).catch(response => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: response.message
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }).catch((response) => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消禁用'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getRoles(param) {
|
|
|
+ // 获取角色
|
|
|
+ clerk_API.getRoles(param).then(res => {
|
|
|
+ this.rolesOptions = res.data
|
|
|
+ const nurseZz = res.data.find(item => item.role_name === '护士组长')
|
|
|
+ if (nurseZz) {
|
|
|
+ this.roleZzId = nurseZz.role_id
|
|
|
+ const nurse = res.data.find(item => item.role_name === '护士')
|
|
|
+ if (nurse) {
|
|
|
+ this.roleId = nurse.role_id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 批量数据删除处理(删除选中的行) */
|
|
|
+ batchDelete: function() {
|
|
|
+ if (this.multipleSelection.length === 0) {
|
|
|
+ this.$alert('没有选择任何记录!', '系统提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: action => {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const ids = []
|
|
|
+ this.multipleSelection.forEach(function(item) {
|
|
|
+ ids.push(item.member_id)
|
|
|
+ })
|
|
|
+ this.handlerDelete(ids.join(','))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 性别格式化 */
|
|
|
+ formatterSex(row) {
|
|
|
+ return row.data.sex === 1 ? '男' : row.data.sex === 0 ? '女' : '未知'
|
|
|
+ },
|
|
|
+ formatterRole(row) {
|
|
|
+ if (row.data.founder === 1) {
|
|
|
+ return '机构负责人'
|
|
|
+ } else {
|
|
|
+ return row.data.role_name
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 提交添加会员表单 */
|
|
|
+ submitAddMemberForm(formName) {
|
|
|
+ const _this = this
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ const params = this.MixinClone(this.addMemberForm)
|
|
|
+ if (isNaN(params.birthday)) {
|
|
|
+ params.birthday = null
|
|
|
+ } else {
|
|
|
+ params.birthday = parseInt(params.birthday / 1000)
|
|
|
+ }
|
|
|
+ if (this.imageUrl) {
|
|
|
+ params.face = this.imageUrl
|
|
|
+ }
|
|
|
+ if (params.member_id) {
|
|
|
+ if (this.roleZzId === params.role_id) {
|
|
|
+ const addIds = this.newCheckList.filter(function(val) { return _this.oldCheckList.indexOf(val) === -1 })
|
|
|
+ console.log('addIds=', addIds)
|
|
|
+ const delIds = this.oldCheckList.filter(function(val) { return _this.newCheckList.indexOf(val) === -1 })
|
|
|
+ console.log('delIds=', delIds)
|
|
|
+ const data = {
|
|
|
+ clerkId: params.clerk_id,
|
|
|
+ addIds: addIds.join(','),
|
|
|
+ delIds: delIds.join(',')
|
|
|
+ }
|
|
|
+ console.log('data==', data)
|
|
|
+ clerk_API.updateParentById(data)
|
|
|
+ }
|
|
|
+ clerk_API.update(params.clerk_id, params).then(response => {
|
|
|
+ this.dialogAddMemberVisible = false
|
|
|
+ this.imageUrl = null
|
|
|
+ this.GET_MemberList()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ clerk_API.add(params).then(response => {
|
|
|
+ this.dialogAddMemberVisible = false
|
|
|
+ this.imageUrl = null
|
|
|
+ this.GET_MemberList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error('表单填写有误,请检查!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 添加会员 */
|
|
|
+ handleAddMember() {
|
|
|
+ this.nurseList = []
|
|
|
+ this.imageUrl = null
|
|
|
+ this.addMemberForm = { sex: 1 }
|
|
|
+ this.addMemberRules.password[0].required = true
|
|
|
+ this.dialogAddMemberVisible = true
|
|
|
+ this.roleTypeDisabled = false
|
|
|
+ this.shopDisabled = false
|
|
|
+ },
|
|
|
+ /** 编辑用户 */
|
|
|
+ handlerEdit(row) {
|
|
|
+ this.addMemberForm = Object.assign({}, row)
|
|
|
+ this.nurseList = []
|
|
|
+ if (this.roleZzId && this.roleZzId === row.role_id) { // 只有护士组长才能编辑小组成员
|
|
|
+ // this.getNurseByRoleId(row.member_id)
|
|
|
+ this.getNurseByRoleId(row.member_id, this.addMemberForm.shop_id)
|
|
|
+ this.shopDisabled = false
|
|
|
+ } else if (row.role_id === ROLE_TYPE.PRINCIPAL) {
|
|
|
+ this.roleTypeDisabled = true
|
|
|
+ this.shopDisabled = true
|
|
|
+ } else {
|
|
|
+ this.roleTypeDisabled = false
|
|
|
+ this.shopDisabled = false
|
|
|
+ }
|
|
|
+ this.imageUrl = row.face
|
|
|
+ delete this.addMemberForm.password
|
|
|
+ this.addMemberRules.password[0].required = false
|
|
|
+ if (row.birthday) {
|
|
|
+ this.addMemberForm.birthday *= 1000
|
|
|
+ }
|
|
|
+ this.dialogAddMemberVisible = true
|
|
|
+ },
|
|
|
+ // getNurseByRoleId(id) {
|
|
|
+ getNurseByRoleId(id, shop_id) {
|
|
|
+ const _this = this
|
|
|
+ this.newCheckList = []
|
|
|
+ this.oldCheckList = []
|
|
|
+
|
|
|
+ // clerk_API.getNurseByRoleId(_this.roleId, this.shopId).then(r => {
|
|
|
+ clerk_API.getNurseByRoleId(_this.roleId, shop_id).then(r => {
|
|
|
+ _this.nurseList = r
|
|
|
+ // _this.getNurseIds(id)
|
|
|
+ _this.getNurseIds(id, shop_id)
|
|
|
+ // r.forEach(item => {
|
|
|
+ // if (item.parent_id=== id) {
|
|
|
+ // _this.newCheckList.push(item.clerk_id)
|
|
|
+ // _this.oldCheckList.push(item.clerk_id)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // getNurseIds(id) {
|
|
|
+ getNurseIds(id, shop_id) {
|
|
|
+ const _this = this
|
|
|
+ // clerk_API.getNurseIdsByPartId(this.shopId).then(r => {
|
|
|
+ clerk_API.getNurseIdsByPartId(shop_id).then(r => {
|
|
|
+ r.forEach(item => {
|
|
|
+ _this.nurseList.forEach(t => {
|
|
|
+ if (t.clerk_id === item.nurse_id) {
|
|
|
+ t.group_name = item.clerk_name
|
|
|
+ t.group_id = item.member_id
|
|
|
+ if (item.member_id === id) {
|
|
|
+ t.checked = true
|
|
|
+ _this.oldCheckList.push(item.nurse_id)
|
|
|
+ _this.newCheckList.push(item.nurse_id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ _this.nurseClerkList = _this.nurseList
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleCheckboxChanged(item) {
|
|
|
+ item.checked = !item.checked
|
|
|
+ },
|
|
|
+ /** 分页大小发生改变 */
|
|
|
+ handlePageSizeChange(size) {
|
|
|
+ this.params.page_size = size
|
|
|
+ this.GET_MemberList()
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 分页页数发生改变 */
|
|
|
+ handlePageCurrentChange(page) {
|
|
|
+ this.params.page_no = page
|
|
|
+ this.GET_MemberList()
|
|
|
+ },
|
|
|
+ /** 图片上传之前的校验 */
|
|
|
+ handleShopLogoBefore(file) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const isImg = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif'
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2
|
|
|
+
|
|
|
+ if (!isImg) {
|
|
|
+ this.$message.error('上传头像图片只能是 JPG、PNG、GIF 格式!')
|
|
|
+ reject()
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传头像图片大小不能超过 2MB!')
|
|
|
+ reject()
|
|
|
+ }
|
|
|
+
|
|
|
+ const reader = new FileReader()
|
|
|
+ reader.onload = (event) => {
|
|
|
+ const image = new Image()
|
|
|
+ image.onload = () => {
|
|
|
+ const width = image.width
|
|
|
+ const height = image.height
|
|
|
+ if (width > 500 || width < 100) {
|
|
|
+ this.$message.error('图片宽度必须在100~500之间,宽高比为1:1!')
|
|
|
+ reject()
|
|
|
+ }
|
|
|
+ if (width !== height) {
|
|
|
+ this.$message.error('请上传宽高比为1:1的图片')
|
|
|
+ reject()
|
|
|
+ }
|
|
|
+ if (height > 500 || height < 100) {
|
|
|
+ this.$message.error('图片高度必须在100~500之间!')
|
|
|
+ reject()
|
|
|
+ }
|
|
|
+ resolve()
|
|
|
+ }
|
|
|
+ image.src = event.target.result
|
|
|
+ }
|
|
|
+ reader.readAsDataURL(file)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 上传成功后的钩子 更换图片 置空存储数组*/
|
|
|
+ uploaded(res) {
|
|
|
+ this.imageUrl = serverUrl + '/' + res
|
|
|
+ this.addMemberForm.face = this.imageUrl
|
|
|
+ },
|
|
|
+ lookBigImg(row) {
|
|
|
+ this.srcList = []
|
|
|
+ this.srcList.push(row.face)
|
|
|
+ prevOverflow = document.body.style.overflow
|
|
|
+ document.body.style.overflow = 'hidden'
|
|
|
+ this.showViewer = true
|
|
|
+ },
|
|
|
+ closeViewer() {
|
|
|
+ document.body.style.overflow = prevOverflow
|
|
|
+ this.showViewer = false
|
|
|
+ },
|
|
|
+ filterModifed(param) {
|
|
|
+ const model = param.api.getFilterModel()
|
|
|
+ this.params.filter = JSON.stringify(model)
|
|
|
+ this.GET_MemberList()
|
|
|
+ },
|
|
|
+ gridSortChange(param) {
|
|
|
+ const columnState = param.columnApi.getColumnState()
|
|
|
+ // 排序状态
|
|
|
+ const sortState = columnState.filter(function(s) {
|
|
|
+ return s.sort != null
|
|
|
+ }).map(function(s) {
|
|
|
+ return {
|
|
|
+ colId: s.colId,
|
|
|
+ sort: s.sort,
|
|
|
+ sortIndex: s.sortIndex
|
|
|
+ }
|
|
|
+ }).sort(function(a, b) {
|
|
|
+ return a.sortIndex - b.sortIndex
|
|
|
+ })
|
|
|
+ if (sortState.length > 0) {
|
|
|
+ if (sortState.length === 1) {
|
|
|
+ this.params.sort = sortState[0].colId
|
|
|
+ this.params.dir = sortState[0].sort
|
|
|
+ } else {
|
|
|
+ let sortstring = ''
|
|
|
+ sortState.forEach(function(item) {
|
|
|
+ sortstring += item.colId + ' ' + item.sort + ','
|
|
|
+ })
|
|
|
+ this.params.sort = sortstring.substring(0, sortstring.length - 1)
|
|
|
+ this.params.dir = ' '
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ delete this.params.sort
|
|
|
+ delete this.params.dir
|
|
|
+ }
|
|
|
+ this.GET_MemberList()
|
|
|
+ },
|
|
|
+ getShopOptions(part_id) {
|
|
|
+ shop_API.getShopList(part_id).then(res => {
|
|
|
+ this.shopOptions = res
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style type="text/scss" scoped>
|
|
|
+
|
|
|
+ .show-pwd {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ right: 10px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .formwrap /deep/ .el-tabs__content {
|
|
|
+ overflow: visible !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .formwrap /deep/ .app-address-title {
|
|
|
+ height: 32px !important;
|
|
|
+ line-height: 32px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .formwrap /deep/ .app-address {
|
|
|
+ width: 100% !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ div.toolbar {
|
|
|
+ height: 70px;
|
|
|
+ padding: 20px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .el-date-editor {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .el-table {
|
|
|
+ width: 100%;
|
|
|
+ overflow-x: scroll;
|
|
|
+
|
|
|
+ & td:not(.is-left) {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-tag + .el-tag {
|
|
|
+ margin-left: 10px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .avatar-uploader .el-upload {
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .avatar-uploader .el-upload:hover {
|
|
|
+ border-color: #409EFF;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .avatar-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
+ width: 110px;
|
|
|
+ height: 110px;
|
|
|
+ line-height: 110px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .avatar {
|
|
|
+ width: 110px;
|
|
|
+ height: 110px;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|