From 5e2aafeede13d337380f736567caf74f49713be7 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:38:32 +0800
Subject: [PATCH] 代码优化
---
src/views/place/practitioner.vue | 372 ++++++++++++++++++++++++++++++----------------------
1 files changed, 215 insertions(+), 157 deletions(-)
diff --git a/src/views/place/practitioner.vue b/src/views/place/practitioner.vue
index 552a39d..8a95b6a 100644
--- a/src/views/place/practitioner.vue
+++ b/src/views/place/practitioner.vue
@@ -1,49 +1,48 @@
<template>
<basic-container>
<avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" v-model="form"
- :permission="permissionList" @row-save="rowSave" :before-open="beforeOpen" @search-change="searchChange"
- @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
- @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
- <template slot-scope="{row}" slot="location">
- <span v-text="showLocation(row.location)"></span>
+ :permission="permissionList" @row-save="rowSave" @row-del="rowDel" :before-open="beforeOpen"
+ @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
+ @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
+ <template slot-scope="{row, size}" slot="age">
+ <el-tag :size="size">{{
+ row.age
+ }}</el-tag>
</template>
- <template slot-scope="{row}" slot="lng">
- <span v-text="decimalProcessing(row.lng)"></span>
+ <template slot-scope="{row, size}" slot="gender">
+ <el-tag :size="size" :type="showGender(row.gender).type">{{
+ showGender(row.gender).text
+ }}</el-tag>
</template>
- <template slot-scope="{row}" slot="lat">
- <span v-text="decimalProcessing(row.lat)"></span>
+ <template slot-scope="{row, size}" slot="resignationFlag">
+ <el-tag :size="size" :type="showResignationFlag(row.resignationFlag).type">{{
+ showResignationFlag(row.resignationFlag).text
+ }}</el-tag>
</template>
- <template slot-scope="{row, size}" slot="confirmFlag">
- <el-tag :size="size" :type="showConfirmFlag(row.confirmFlag).type">{{
- showConfirmFlag(row.confirmFlag).text
- }}</el-tag>
- </template>
-
- <template slot-scope="{row, size}" slot="source">
- <el-tag :size="size" :type="showSource(row.source).type">{{ showSource(row.source).text
- }}</el-tag>
- </template>
-
- <template slot="menuLeft">
- <!-- <el-button size="small" icon="el-icon-delete" plain v-if="permission.place_delete" @click="handleDelete">删 除
- </el-button> -->
- <el-button type="primary" size="small" @click="handleQueryAlarm(1)">未成年人 ({{countInfo.minors}}) 人
- </el-button>
- <el-button type="primary" size="small" @click="handleQueryAlarm(2)">少数民族 ({{countInfo.nationalMinority}}) 人
+ <template slot-scope="{row, size}" slot="telephone">
+ <el-button :size="size" type="text" @click="showStringDispose(row, 'telephoneflag')"
+ v-text="textDispose(row, 'telephoneflag', 'telephone')">
</el-button>
</template>
+ <template slot-scope="{row, size}" slot="idCard">
+ <el-button :size="size" type="text" @click="showStringDispose(row, 'idCardflag')"
+ v-text="textDispose(row, 'idCardflag', 'idCard')">
+ </el-button>
+ </template>
+
+ <!-- -->
<template slot-scope="{row, size}" slot="menu">
- <el-button :size="size" type="text" icon="el-icon-s-check" v-if="permission.place_audit_cur"
+ <!-- <el-button :size="size" type="text" icon="el-icon-s-check" v-if="permission.place_audit_cur"
@click="auditCur({ ...row, confirmFlag: 1 })">审核
</el-button>
<el-button :size="size" type="text" icon="el-icon-edit" v-if="permission.place_manage_tenants"
@click="ManageTenants(row)">场所维护
- </el-button>
+ </el-button> -->
</template>
<template slot-scope="{row, size}" slot="principalPhone">
@@ -70,13 +69,12 @@
<script>
import {
getPractitionerList as getList,
- remove,
- update,
add,
- getPlace,
getWarningPersonnelCount as getCount
} from "@/api/place/place"
-
+ import {
+ remove
+ } from "@/api/place/practitioner"
import {
mapGetters
} from "vuex"
@@ -88,7 +86,6 @@
export default {
data() {
-
//手机号格式校验
let validatorPhone = function(rule, value, callback) {
if (value) {
@@ -114,50 +111,98 @@
datetime: "",
selectionList: [],
option: {
- // header:true,
labelWidth: 120,
searchLabelWidth: 96,
searchShow: true,
searchMenuSpan: 3,
- // menuWidth: 280,
- menu: false,
+ menuWidth: 160,
height: "auto",
calcHeight: 54,
dialogWidth: 950,
tip: false,
border: true,
- //stripe:true,
addBtn: false,
index: true,
- viewBtn: false,
+ viewBtn: true,
editBtn: false,
- // selection: true,
+ delBtn: true,
dialogClickModal: false,
- // menuFixed: 'right',
- delBtn: false,
column: [{
+ label: "所属街道",
+ parent: false,
+ search: true,
+ searchSpan: 4,
+ prop: "townStreetName",
+ type: "tree",
+ dicUrl: "/api/blade-system/region/getTownTree",
+ props: {
+ label: "name",
+ value: "name"
+ },
+ rules: [{
+ required: true,
+ message: "请选择所属街道",
+ trigger: "blur",
+ }, ],
+ },
+
+ {
+ parent: false,
+ label: "所属社区",
+ prop: "neiName",
+ width: 150,
+ search: true,
+ type: "tree",
+ searchSpan: 4,
+ dicUrl: "/api/blade-system/region/treeToCommunity",
+ props: {
+ label: "name",
+ value: "name",
+ },
+ cascader: ["gridCode"],
+ rules: [{
+ required: true,
+ message: "请选择所属社区",
+ trigger: "blur",
+ }, ],
+ },
+ {
overHidden: true,
label: "姓名",
span: 12,
prop: "name",
- searchSpan: 4,
+ searchSpan: 3,
search: true,
searchLabelWidth: 76,
},
{
- label: "电话号码",
- prop: "telephone",
- searchSpan: 4,
- searchLabelWidth: 110,
- search: true,
+ label: "性别",
+ prop: "gender",
+ width: 80,
+ align: "center",
+ type: "select",
+ dicData: [{
+ label: "男",
+ value: 1
+ },
+ {
+ label: "女",
+ value: 0
+ }
+ ]
},
{
- overHidden: true,
- label: "微信号",
- prop: "wxAccount",
- searchSpan: 4,
- slot: true,
+ label: "民族",
+ width: 80,
+ dicUrl: "/api/blade-system/dict-biz/tree?code=nationType",
+ props: {
+ label: "title",
+ value: "key",
+ },
+ prop: "ethnicity",
+ type: "select",
+ dataType: "number"
},
{
overHidden: true,
@@ -167,63 +212,80 @@
width: 160,
searchSpan: 4,
slot: true,
-
},
{
- label: "民族",
+ label: "电话号码",
+ prop: "telephone",
+ searchSpan: 4,
+ searchLabelWidth: 110,
+ search: true,
+ },
+ {
width: 80,
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
- dicUrl: "/api/blade-system/dict-biz/tree?code=nationType",
- props: {
- label: "title",
- value: "key",
- },
- prop: "ethnicity",
- searchSpan: 4
- },
- {
- width: 160,
label: "年龄",
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
prop: "age",
- searchSpan: 4
- },
- {
- label: "岗位性质",
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
- prop: "jobNature",
- searchSpan: 4
- }, {
- label: "工作单位",
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
- prop: "employer",
- searchSpan: 4
+ align: "center"
},
{
minWidth: 160,
label: "现居住地",
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
prop: "tempAddress",
+ },
+ {
+ label: "岗位",
+ prop: "jobNature",
+ }, {
+ width: 110,
+ label: '从业人员照片',
+ prop: 'employerImg',
+ fileType: 'img',
+ type: "upload",
+ listType: "picture-card",
+ dataType: "string",
+ disabled: true,
+ row: true,
+ span: 12,
+ }, {
+ label: "工作单位",
+ prop: "employer",
searchSpan: 4
},
{
- minWidth: 160,
- label: "户籍地址",
+ width: 160,
+ label: "标签",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
- prop: "registeredAddress",
+ prop: "categoryName",
searchSpan: 4
+ },
+ {
+ label: "状态",
+ searchLabelWidth: 60,
+ prop: "resignationFlag",
+ align: 'center',
+ searchSpan: 3,
+ search: true,
+ type: "select",
+ dicData: [{
+ label: "在职",
+ value: "1"
+ },
+ {
+ label: "已离职",
+ value: "2"
+ }
+ ]
+ },
+ {
+ label: "入职时间",
+ prop: "employmentTime",
+ hide: true,
+ },
+ {
+ label: "离职时间",
+ prop: "resignationTime",
+ hide: true,
},
{
label: "预警人员",
@@ -231,7 +293,7 @@
editDisplay: false,
viewDisplay: false,
prop: "type",
- searchSpan: 4,
+ searchSpan: 3,
hide: true,
type: "select",
search: true,
@@ -248,25 +310,6 @@
value: 3
}
],
- }, {
- width: 160,
- label: "标签",
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
- prop: "categoryName",
- searchSpan: 4
- }, {
- width: 110,
- label: '从业人员照片',
- prop: 'employerImg',
- fileType: 'img',
- type: "upload",
- listType: "picture-card",
- dataType: "string",
- disabled: true,
- span: 12,
- labelWidth: 110,
},
],
},
@@ -294,10 +337,10 @@
...mapGetters(["permission", "userInfo"]),
permissionList() {
return {
- addBtn: this.vaildData(this.permission.place_add, true),
- viewBtn: this.vaildData(this.permission.place_view, true),
- delBtn: this.vaildData(this.permission.place_delete, true),
- editBtn: this.vaildData(this.permission.place_edit, true),
+ // addBtn: this.vaildData(this.permission.place_add, true),
+ viewBtn: this.vaildData(this.permission.place_practitioner_view, true),
+ delBtn: this.vaildData(this.permission.place_practitioner_delete, true),
+ // editBtn: this.vaildData(this.permission.place_edit, true),
}
},
ids() {
@@ -340,7 +383,7 @@
}
},
- showSource() {
+ showResignationFlag() {
return (data) => {
let tags = {
text: '',
@@ -349,13 +392,13 @@
if (data == 1) {
tags = {
- text: '是',
+ text: '在职',
type: 'success'
}
} else if (data == 2) {
tags = {
- text: '否',
- type: 'info'
+ text: '已离职',
+ type: 'danger'
}
}
@@ -363,15 +406,26 @@
}
},
- showLocation() {
+ showGender() {
return (data) => {
- if (data != null && data.indexOf(',') != -1) {
- data = data.split(',')
-
- return data[2]
- } else {
- return data || ''
+ let tags = {
+ text: '',
+ type: ''
}
+
+ if (data == 1) {
+ tags = {
+ text: '男',
+ type: 'primary'
+ }
+ } else if (data == 0) {
+ tags = {
+ text: '女',
+ type: 'primary'
+ }
+ }
+
+ return tags
}
},
@@ -416,6 +470,23 @@
latitude: data[1],
location: data[2]
}
+ },
+ rowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ })
+ .then(() => {
+ return remove(row.id)
+ })
+ .then(() => {
+ this.onLoad(this.page)
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ })
+ })
},
auditCur(row) {
@@ -510,32 +581,15 @@
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
- getPlace(this.form.id).then((res) => {
- this.form = res.data.data
-
- this.form.location = [this.form.lng, this.form.lat, this.form.location].join(',')
-
- // if (this.form.imageUrls.length) {
- // this.form.imageUrls = this.form.imageUrls.split(",").filter(item => item != '').map(item => website.minioUrl + item).join(',')
- // }
-
- // if (this.form.placePoiLabelVOList.length) {
- // let lebelTwo = this.form.placePoiLabelVOList.find(item => {
- // return item.type == 2
- // })
-
- // if (lebelTwo) this.form.label = String(lebelTwo.poiCode)
-
- // let lebelThree = this.form.placePoiLabelVOList.find(item => {
- // return item.type == 3
- // })
-
- // if (lebelThree) this.form.smallLabel = String(lebelThree.poiCode)
- // }
-
- done()
- })
- } else {
+ if (this.form.resignationFlag) {
+ if (this.form.resignationFlag == 1) {
+ this.form.resignationFlag = '在职'
+ }
+ if (this.form.resignationFlag == 2) {
+ this.form.resignationFlag = '已离职'
+ }
+ // this.form.employerImg = this.form.employerImg.split(",").filter(item => item != '').map(item => website.minioUrl + item).join(',')
+ }
done()
}
},
@@ -561,8 +615,8 @@
this.getPeopleCount();
this.data.forEach(item => {
- this.$set(item, 'principalPhoneflag', false)
- this.$set(item, 'principalIdCardflag', false)
+ this.$set(item, 'telephoneflag', false)
+ this.$set(item, 'idCardflag', false)
if (item.employerImg && item.employerImg != '' && item.employerImg != null && item.employerImg
.length) {
var urls = []
@@ -580,8 +634,12 @@
},
- getPeopleCount() {
- getCount().then(res => {
+ getPeopleCount(params = {}) {
+ // 在职的
+ // params = {
+ // resignationFlag:1
+ // }
+ getCount(params).then(res => {
this.countInfo = res.data.data;
})
}
--
Gitblit v1.9.3