Browse Source

rfid数据操作界面增加

master
aBin 4 years ago
parent
commit
33a2bb90f1
  1. 8
      .env.development
  2. 6
      .env.production
  3. 29
      src/config/api.js
  4. 13
      src/router/index.js
  5. 130
      src/views/RfidGauge/components/Add.vue
  6. 111
      src/views/RfidGauge/components/Search.vue
  7. 140
      src/views/RfidGauge/components/Table.vue
  8. 67
      src/views/RfidGauge/index.vue

8
.env.development

@ -1,10 +1,10 @@
VUE_APP_MODE=development
VUE_APP_NODE_ENV=development
VUE_APP_SCENE=wisdomcar
VUE_APP_BASE_URL=http://test.tall.wiki/
VUE_APP_API_URL=http://test.tall.wiki/gateway
VUE_APP_BASE_URL=http://www.tall.wiki/
VUE_APP_API_URL=http://www.tall.wiki/gateway
VUE_APP_PROXY_URL=/gateway
VUE_APP_PUBLIC_PATH=/wisdomcar
VUE_APP_MSG_URL=wss://test.tall.wiki/websocket/message/v4.0/ws
VUE_APP_MSG_URL=wss://www.tall.wiki/websocket/message/v4.0/ws
VUE_APP_TITLE=盐湖区人民医院数字看板
VUE_APP_DESCRIPTION=盐湖区人民医院数字看板
VUE_APP_DESCRIPTION=盐湖区人民医院数字看板s

6
.env.production

@ -1,10 +1,10 @@
VUE_APP_MODE=production
VUE_APP_NODE_ENV=production
VUE_APP_SCENE=wisdomcar
VUE_APP_BASE_URL=http://test.tall.wiki/
VUE_APP_API_URL=http://test.tall.wiki/gateway
VUE_APP_BASE_URL=http://www.tall.wiki/
VUE_APP_API_URL=http://www.tall.wiki/gateway
VUE_APP_PROXY_URL=/gateway
VUE_APP_PUBLIC_PATH=/wisdomcar
VUE_APP_MSG_URL=wss://test.tall.wiki/websocket/message/v4.0/ws
VUE_APP_MSG_URL=wss://www.tall.wiki/websocket/message/v4.0/ws
VUE_APP_TITLE=盐湖区人民医院数字看板
VUE_APP_DESCRIPTION=盐湖区人民医院数字看板

29
src/config/api.js

@ -3,18 +3,15 @@
* @email: binbin0314@126.com
* @Date: 2021-06-05 12:16:54
* @LastEditors: aBin
* @LastEditTime: 2021-06-05 12:23:17
*/
/*
* Copyright (c) 2019.
* author: wally
* email: 18603454788@163.com
* @LastEditTime: 2021-07-05 09:55:21
*/
import axios from 'axios';
let { proxyUrl, msgUrl } = require('@/config/setting');
const wisdomcar = `${proxyUrl}/wisdomcar2`; // 盐湖医院分路径
const wisdomcar = `${proxyUrl}/wisdomcar`; // 盐湖医院分路径
const statistics = `${wisdomcar}/statistics`; // 盐湖医院相关接口
const rfid = `${wisdomcar}/rfid`; // rfid增删改查界面相关
// websocket基础地址
export const WS_BASE_URL = msgUrl;
@ -26,3 +23,21 @@ export const record = params => axios.post(`${wisdomcar}/debug/record`, params);
export const selResult = params => axios.post(`${statistics}/get/selResult`, params);
// 急救时长分析统计图数据
export const getPointTime = params => axios.post(`${statistics}/getPointTime`, params);
// 环节查询
export const queryStepList = params => axios.post(`${rfid}/queryStepList`, params);
// 医院查询
export const queryHospitalList = params => axios.post(`${rfid}/queryHospitalList`, params);
// rfid删除
export const rfidDel = params => axios.post(`${rfid}/del`, params);
// rfid新增
export const rfidSave = params => axios.post(`${rfid}/save`, params);
// rfid修改
export const rfidUpdate = params => axios.post(`${rfid}/update`, params);
// rfid查询
export const rfidQuery = params => axios.post(`${rfid}/query`, params);

13
src/router/index.js

@ -1,3 +1,10 @@
/*
* @Author: aBin
* @email: binbin0314@126.com
* @Date: 2021-06-05 12:16:54
* @LastEditors: aBin
* @LastEditTime: 2021-07-02 15:38:19
*/
import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from 'views/Index/Index.vue';
@ -17,6 +24,12 @@ const routes = [
name: 'BtnPage',
component: () => import(/* webpackChunkName: "Index" */ 'views/BtnPage/BtnPage.vue'),
},
// RFID增删改查
{
path: '/RfidGauge',
name: 'RfidGauge',
component: () => import(/* webpackChunkName: "Index" */ 'views/RfidGauge/index.vue'),
},
];
const router = new VueRouter({

130
src/views/RfidGauge/components/Add.vue

@ -0,0 +1,130 @@
<!--
* @Author: aBin
* @email: binbin0314@126.com
* @Date: 2021-07-02 15:29:09
* @LastEditors: aBin
* @LastEditTime: 2021-07-05 17:55:33
-->
<template>
<div style="margin-top: 1px">
<a-button type="primary" icon="plus" @click="visible = true">增加</a-button>
<a-modal :width="800" title="增加记录" :visible="visible" @ok="handleOk" @cancel="handleCancel">
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-form-item label="医院" required>
<a-select placeholder="医院" v-model="hospitalId" style="width: 100%; margin-right: 12px" allow-clear>
<a-select-option :value="item.id" v-for="item in hosList" :key="item.id"> {{ item.hospitalName }} </a-select-option>
</a-select>
</a-form-item>
<a-form-item label="名字" required>
<a-input placeholder="名字" v-model="name" />
</a-form-item>
<a-form-item label="RFID" required>
<a-input placeholder="RFID(16进制)" v-model="rfid" />
</a-form-item>
<a-form-item label="环节">
<a-select placeholder="医院" v-model="step" style="width: 100%; margin-right: 12px" allow-clear>
<a-select-option :value="item.id" v-for="item in stepList" :key="item.id"> {{ item.name }} </a-select-option>
</a-select>
</a-form-item>
<a-form-item label="类型" required>
<a-select placeholder="医院" v-model="type" style="width: 100%; margin-right: 12px" allow-clear>
<a-select-option :value="item.id" v-for="item in typeList" :key="item.id"> {{ item.name }} </a-select-option>
</a-select>
</a-form-item>
</a-form>
</a-modal>
</div>
</template>
<script>
import { rfidSave } from 'config/api';
export default {
name: 'Add',
props: {
hosList: {
type: Array,
default: () => [],
},
stepList: {
type: Array,
default: () => [],
},
},
data() {
return {
str: '量表',
visible: false,
formLayout: 'horizontal',
form: this.$form.createForm(this, { name: 'coordinated' }),
hospitalId: undefined,
step: undefined,
type: undefined,
typeList: [
{
id: 0,
name: '医生',
},
{
id: 1,
name: '采血车',
},
{
id: 2,
name: '门禁',
},
],
name: '',
rfid: '',
};
},
methods: {
async handleOk() {
try {
if (this.hospitalId === undefined) {
this.$message.warning('请选择医院');
return;
}
if (this.type === undefined) {
this.$message.warning('请选择类型');
return;
}
if (this.name === '') {
this.$message.warning('请输入名字');
return;
}
if (this.rfid === '') {
this.$message.warning('请输入RFID');
return;
}
const params = {
param: {
hospitalId: this.hospitalId,
step: this.step,
type: this.type,
name: this.name,
rfid: parseInt(this.rfid, 16),
},
};
const res = await rfidSave(params);
const { code, data, msg } = res.data;
if (code === 200) {
this.$message.success('添加成功');
this.visible = false;
this.$emit('Search');
this.hospitalId = undefined;
this.step = undefined;
this.type = undefined;
this.name = '';
this.rfid = '';
} else {
this.$message.error(msg);
}
} catch (error) {
this.$message.error(error);
}
},
handleCancel() {
this.visible = false;
},
},
};
</script>

111
src/views/RfidGauge/components/Search.vue

@ -0,0 +1,111 @@
<!--
* @Author: aBin
* @email: binbin0314@126.com
* @Date: 2021-07-02 15:29:34
* @LastEditors: aBin
* @LastEditTime: 2021-07-05 14:45:11
-->
<template>
<div class="d-flex justify-space-between">
<div>
RFID
<a-input placeholder="RFID(16进制)" v-model="rfid" style="width: 140px; margin-right: 12px" allow-clear />
名字
<a-input placeholder="名字" v-model="name" style="width: 140px; margin-right: 12px" allow-clear />
类型
<a-select placeholder="类型" v-model="type" style="width: 140px; margin-right: 12px" allow-clear>
<a-select-option :value="item.id" v-for="item in typeList" :key="item.id"> {{ item.name }} </a-select-option>
</a-select>
环节
<a-select placeholder="环节" v-model="step" style="width: 140px; margin-right: 12px" allow-clear>
<a-select-option :value="item.id" v-for="item in stepList" :key="item.id"> {{ item.name }} </a-select-option>
</a-select>
医院
<a-select placeholder="医院" v-model="hospitalId" style="width: 140px; margin-right: 12px" allow-clear>
<a-select-option :value="item.id" v-for="item in hosList" :key="item.id"> {{ item.hospitalName }} </a-select-option>
</a-select>
<a-button type="primary" icon="search" @click="Search">搜索</a-button>
</div>
<add :hos-list="hosList" :step-list="stepList" @Search="Search" />
</div>
</template>
<script>
import { queryHospitalList, queryStepList } from 'config/api';
import Add from './Add.vue';
export default {
name: 'Search',
components: { Add },
data() {
return {
rfid: '',
name: '',
type: undefined,
step: undefined,
hospitalId: undefined,
hosList: [], //
stepList: [], //
typeList: [
{
id: 0,
name: '医生',
},
{
id: 1,
name: '采血车',
},
{
id: 2,
name: '门禁',
},
],
};
},
created() {
this.getHos();
this.getStep();
},
methods: {
Search() {
const { rfid, name, type, step, hospitalId } = this;
const data = {
rfid,
name,
type,
step,
hospitalId,
};
this.$emit('getData', data);
},
async getHos() {
try {
const params = { param: {} };
const res = await queryHospitalList(params);
const { code, msg, data } = res.data;
if (code === 200) {
this.hosList = data;
} else {
this.$messag.error(msg);
}
} catch (error) {
this.$messag.error(error);
}
},
async getStep() {
try {
const params = { param: {} };
const res = await queryStepList(params);
const { code, msg, data } = res.data;
if (code === 200) {
this.stepList = data;
} else {
this.$messag.error(msg);
}
} catch (error) {
this.$messag.error(error);
}
},
},
};
</script>
<style lang="stylus" scoped></style>

140
src/views/RfidGauge/components/Table.vue

@ -0,0 +1,140 @@
<!--
* @Author: aBin
* @email: binbin0314@126.com
* @Date: 2021-07-02 15:29:20
* @LastEditors: aBin
* @LastEditTime: 2021-07-05 17:51:57
-->
<template>
<div>
<a-table
:columns="columns"
:data-source="list"
:row-key="record => record.id"
:pagination="pagination"
@change="handleTableChange"
bordered
>
<template slot="rfid" slot-scope="text, record">
<span>
<span style="font-weight: bold">{{ record.name }}</span>
<br />
十进制({{ record.rfid }})
<br />
十六进制({{ (+record.rfid).toString(16) }})
</span>
</template>
<template slot="type" slot-scope="text, record">
<span v-if="record.type === 0">医生</span>
<span v-else-if="record.type === 1">采血车</span>
<span v-else-if="record.type === 2">门禁</span>
</template>
<template slot="operation" slot-scope="text, record">
<a-popconfirm placement="left" ok-text="确定" cancel-text="再想想" @confirm="delData(record.id)">
<template slot="title">
<p>确定删除此项吗?</p>
</template>
<a-button type="link">删除</a-button>
</a-popconfirm>
</template>
</a-table>
</div>
</template>
<script>
import { rfidDel } from 'config/api';
const columns = [
{
title: '序号',
align: 'center',
dataIndex: 'id',
key: 'id',
width: '14.2%',
scopedSlots: { customRender: 'id' },
},
{
title: 'RFID',
align: 'center',
dataIndex: 'rfid',
key: 'rfid',
width: '14.2%',
scopedSlots: { customRender: 'rfid' },
},
{
title: '医院',
align: 'center',
dataIndex: 'hospitalName',
key: 'hospitalName',
width: '14.2%',
},
{
title: '环节名称',
align: 'center',
dataIndex: 'stepName',
key: 'stepName',
},
// {
// title: '',
// align: 'center',
// dataIndex: 'step',
// key: 'step',
// scopedSlots: { customRender: 'step' },
// width: '14.2%',
// },
{
title: '类型',
align: 'center',
dataIndex: 'type',
key: 'type',
scopedSlots: { customRender: 'type' },
width: '14.2%',
},
{
title: '操作',
align: 'center',
dataIndex: 'operation',
key: 'operation',
scopedSlots: { customRender: 'operation' },
width: '7%',
},
];
export default {
name: 'Table',
props: {
list: {
type: Array,
default: () => [],
},
pagination: {
type: Object,
default: () => {},
},
},
data() {
return {
str: '表格',
columns,
};
},
methods: {
async delData(id) {
try {
const params = { param: { id } };
const res = await rfidDel(params);
const { code } = res.data;
if (code === 200) {
this.$message.success('删除成功');
this.$emit('getData');
} else {
this.$message.error('删除失败');
}
} catch (error) {
this.$message.error('删除失败');
}
},
handleTableChange(pagination) {
this.$emit('getData', pagination);
},
},
};
</script>

67
src/views/RfidGauge/index.vue

@ -0,0 +1,67 @@
<!--
* @Author: aBin
* @email: binbin0314@126.com
* @Date: 2021-07-02 15:27:23
* @LastEditors: aBin
* @LastEditTime: 2021-07-05 11:53:49
-->
<template>
<div style="padding: 12px">
<Search @getData="getData" />
<Table class="mt-3" :list="list" :pagination="pagination" @getData="getData" />
</div>
</template>
<script>
import { rfidQuery } from 'config/api';
import Search from './components/Search.vue';
import Table from './components/Table.vue';
export default {
components: { Search, Table },
data() {
return {
str: '量表',
list: [],
pagination: {
current: 1,
pageSize: 10,
total: 0,
},
};
},
created() {
this.getData();
},
methods: {
async getData(obj) {
try {
const params = {
param: {
hospitalId: obj && obj.hospitalId > -1 ? obj.hospitalId : '',
name: (obj && obj.name) || '',
pageNum: (obj && obj.current) || 1,
pageSize: (obj && obj.pageSize) || 10,
rfid: (obj && obj.rfid) || '',
step: obj && obj.step > -1 ? obj.step : '',
type: obj && obj.type > -1 ? obj.type : '',
},
};
const res = await rfidQuery(params);
const { code, data, msg } = res.data;
if (code === 200) {
this.list = data.list;
const paper = {
current: data.pageNum,
pageSize: data.pageSize,
total: +data.total,
};
this.pagination = { ...paper };
} else {
console.log(msg);
}
} catch (error) {
console.error(error);
}
},
},
};
</script>
Loading…
Cancel
Save