| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459 |
- <template>
- <basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
- <template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.guestrecord_delete"
- @click="handleDelete">删 除
- </el-button>
- </template>
- <template slot="auditStatus" slot-scope="scope">
- <el-tag v-if="scope.row.auditStatus===0" type="info">待审核</el-tag>
- <el-tag v-if="scope.row.auditStatus===1" type="success">审核通过</el-tag>
- <el-tag v-if="scope.row.auditStatus===2" type="danger">审核不通过</el-tag>
- </template>
- <template slot="registerSource" slot-scope="{row}">
- <el-tag v-if="row.registerSource===1">小程序</el-tag>
- <el-tag v-if="row.registerSource===2">管理后台</el-tag>
- <el-tag v-if="row.registerSource===3">访客机</el-tag>
- </template>
- <template slot="menu" slot-scope="{row}">
- <el-button size="mini" type="text" icon="el-icon-setting">
- <el-dropdown>
- <span class="el-dropdown-link">
- 更多<i class="el-icon-arrow-down el-icon--right"></i>
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item style="color: limegreen" type="text" @click.native="pushFace(row)" icon="el-icon-sort-down">人脸下发</el-dropdown-item>
- <el-dropdown-item style="color: red" type="text" @click.native="deleteFace(row)" icon="el-icon-sort-up">人脸禁用</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- </template>
- <script>
- import {getList, getDetail, add, update, remove, pushGuestFace, deleteGuestFace} from "@/api/estate/guestrecord";
- import {mapGetters} from "vuex";
- export default {
- data() {
- return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {
- menuWidth: 300,
- height:'auto',
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- addBtn:true,
- delBtn:true,
- viewBtn: true,
- selection: true,
- dialogClickModal: false,
- column: [
- {
- label: "预约开始时间",
- prop: "beginTime",
- type: "datetime",
- width: 130,
- format: "yyyy-MM-dd HH:mm:ss",
- valueFormat: "yyyy-MM-dd HH:mm:ss"
- },
- {
- label: "预约结束时间",
- prop: "endTime",
- type: "datetime",
- width: 130,
- format: "yyyy-MM-dd HH:mm:ss",
- valueFormat: "yyyy-MM-dd HH:mm:ss"
- },
- {
- label: "登记来源",
- prop: "registerSource",
- slot: true,
- editDisplay: false,
- addDisplay:false,
- },
- {
- label: "访客姓名",
- prop: "guestName",
- search: true,
- rules: [{
- required: true,
- message: "请输入访客名称",
- trigger: "blur"
- }]
- },
- {
- label: "访客手机号",
- prop: "guestTel",
- labelWidth: 100,
- rules: [{
- required: true,
- message: "请输入访客手机号",
- trigger: "blur"
- }]
- },
- {
- label: "证件号码",
- prop: "guestIdcard",
- hide: true,
- rules: [{
- required: false,
- message: "请输入证件号码",
- trigger: "blur"
- }]
- },
- {
- label: "拜访园区",
- prop: "agencyId",
- cascaderItem: ['enterpriseId'],
- type: "select",
- remote: true,
- hide: true,
- search: true,
- viewDisplay: false,
- dicUrl: "/api/cyzh-community/agency/list",
- dicFormatter:(res)=>{
- return res.data.records;//返回字典的层级结构
- },
- props: {
- label: "name",
- value: "id"
- },
- rules: [{
- required: true,
- message: "请选择拜访园区",
- trigger: "blur"
- }]
- },
- {
- label: "拜访企业",
- prop: "enterpriseId",
- type: "select",
- search: true,
- hide: true,
- viewDisplay: false,
- dicUrl: "/api/cyzh-enterprise/enterprise/list?agencyId={{key}}",
- dicFormatter:(res)=>{
- return res.data.records;//返回字典的层级结构
- },
- // dicFlag: false,
- filterable: true,
- props: {
- label: "enterpriseName",
- value: "id"
- },
- rules: [{
- required: true,
- message: "请选择拜访企业",
- trigger: "blur"
- }]
- },
- {
- label: "拜访园区",
- prop: "agencyName",
- editDisplay: false,
- addDisplay: false,
- },
- {
- label: "拜访企业",
- prop: "enterpriseName",
- editDisplay: false,
- addDisplay: false,
- },
- {
- label: "审核状态",
- prop: "auditStatus",
- slot: true,
- type:'select',
- addDisplay: false,
- dicData:[
- {
- label:'待审核',
- value:0,
- color:'red'
- },{
- label:'审核通过',
- value:1
- },{
- label:'审核不通过',
- value:2
- }
- ]
- },
- {
- label: "审核意见",
- prop: "opinion",
- hide: true,
- editDisplay: false,
- addDisplay: false
- },
- {
- label: "访客事由",
- prop: "guestReason",
- type: 'textarea',
- rules: [{
- required: false,
- message: "请输入访问缘由",
- trigger: "blur"
- }]
- },
- {
- label: "访客人脸",
- prop: "imageUri",
- type: "upload",
- width: 150,
- listType: 'picture-img',
- propsHttp: {
- res: "data",
- url: "link"
- },
- action: "/api/blade-resource/oss/endpoint/put-file",
- rules: [{
- required: false,
- message: "请上传访客人脸",
- trigger: "blur"
- }]
- },
- ]
- },
- data: []
- };
- },
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.guestrecord_add, false),
- viewBtn: this.vaildData(this.permission.guestrecord_view, false),
- delBtn: this.vaildData(this.permission.guestrecord_delete, false),
- editBtn: this.vaildData(this.permission.guestrecord_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
- },
- created() {
- const tenantType = localStorage.getItem("tenantType");
- if (tenantType == 0){
- let findObject1 = this.findObject(this.option.column, "agencyName");
- let findObject2 = this.findObject(this.option.column, "residentialName");
- let findObject3 = this.findObject(this.option.column, "buildingName");
- let findObject4 = this.findObject(this.option.column, "unitName");
- let findObject5 = this.findObject(this.option.column, "floorName");
- let findObject6 = this.findObject(this.option.column, "roomName");
- let findObject7 = this.findObject(this.option.column, "enterpriseName");
- findObject1.label = "拜访园区";
- findObject2.label = "拜访小区";
- findObject3.hide = false;findObject3.viewDisplay = true;
- findObject4.hide = false;findObject4.viewDisplay = true;
- findObject5.hide = false;findObject5.viewDisplay = true;
- findObject6.hide = false;findObject6.viewDisplay = true;
- findObject7.hide = true;
- }else if (tenantType == 1){
- let findObject1 = this.findObject(this.option.column, "agencyName");
- let findObject2 = this.findObject(this.option.column, "residentialName");
- let findObject3 = this.findObject(this.option.column, "enterpriseName");
- let findObject4 = this.findObject(this.option.column, "buildingName");
- let findObject5 = this.findObject(this.option.column, "unitName");
- let findObject6 = this.findObject(this.option.column, "floorName");
- let findObject7 = this.findObject(this.option.column, "roomName");
- findObject1.label = "拜访园区";
- findObject2.label = "拜访区域";
- findObject3.hide = false;
- findObject4.hide = true;findObject4.viewDisplay = false;
- findObject5.hide = true;findObject5.viewDisplay = false;
- findObject6.hide = true;findObject6.viewDisplay = false;
- findObject7.hide = true;findObject7.viewDisplay = false;
- }
- },
- methods: {
- pushFace(row){
- //下发人脸到测温系统和设备
- pushGuestFace(row).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- })
- },
- deleteFace(row){
- this.$confirm("确定禁用人脸吗?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return deleteGuestFace(row);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
- },
- rowSave(row, done, loading) {
- row.agencyName = row.$agencyId;
- row.enterpriseName = row.$enterpriseId;
- row.auditStatus = 1;
- row.registerSource = 2;
- add(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
- },
- rowUpdate(row, index, done, loading) {
- row.agencyName = row.$agencyId;
- row.enterpriseName = row.$enterpriseId;
- row.registerSource = 2;
- update(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- console.log(error);
- });
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage){
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize){
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
- }
- }
- };
- </script>
- <style>
- </style>
|