123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444 |
- <template>
- <div class="main-contain">
- <div class="position">
- <bread-crumb :crumbs="crumbs"></bread-crumb>
- <el-button
- class="filter-item"
- style="float:right;"
- type="primary"
- icon="el-icon-circle-plus-outline"
- size="small"
- @click="AddManage()"
- >新增</el-button
- >
- </div>
- <div class="app-container">
- <div class="cell clearfix">
- <el-input
- style="width: 400px;"
- v-model.trim="listQuery.searchKey"
- class="filter-item"
- placeholder="输入序列号/设备名/设备类型搜索"
- size="small"
- @keyup.enter.native='seahcerMacherInfo'
- />
- <el-button
- class="filter-item"
- type="primary"
- icon="el-icon-search"
- size="small"
- @click="seahcerMacherInfo()"
- >搜索</el-button
- >
-
- <!-- <el-button
- class="filter-item"
- type="primary"
- icon="el-icon-search"
- size="small"
- @click="Auto()"
- >脚本</el-button
- > -->
- </div>
-
- <div class="cell clearfix">
- <label class="title">
- <span class="name">分区:</span>
- </label>
- <div class="time">
- <ul class>
- <li
- :class="item.id == schedulType ? 'active' : ''"
- v-for="item in this.zones"
- :key="item.id"
- @click="selectSchedulType(item.id)"
- >
- {{ item.name }}
- </li>
- </ul>
- </div>
- </div>
-
- <div class="cell clearfix">
- <label class="title">
- <span class="name">设备类型:</span>
- </label>
- <div class="time">
- <ul class>
- <li
- :class="item.id == schedulTypeone ? 'active' : ''"
- v-for="item in this.DeviceType"
- :key="item.id"
- @click="selectSchedulTypeOne(item.id)"
- >
- {{ item.name }}
- </li>
- </ul>
- </div>
- </div>
-
- <div class="cell clearfix">
- <label class="title">
- <span class="name">状态:</span>
- </label>
- <div class="time">
- <ul class>
- <li
- :class="item.id == schedulTypetwo ? 'active' : ''"
- v-for="item in this.AllStatus"
- :key="item.id"
- @click="selectSchedulTypeTwo(item.id)"
- >
- {{ item.name }}
- </li>
- </ul>
- </div>
- </div>
-
- <el-table
- :data="tableData"
- border
- style="width: 100%"
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266'
- }"
- >
- <el-table-column label="序号" width="80" align="center" type="index">
- <!-- <template slot-scope="scope">{{ scope.row.id }}</template> -->
- </el-table-column>
-
- <el-table-column label="序列号" width="120" align="center">
- <template slot-scope="scope">{{ scope.row.serial_number }}</template>
- </el-table-column>
-
- <el-table-column label="设备类型" width="120" align="center">
- <template slot-scope="scope">{{ scope.row.device_type }}</template>
- </el-table-column>
- <el-table-column label="设备名称" width="120" align="center">
- <template slot-scope="scope">{{ scope.row.device_name }}</template>
- </el-table-column>
- <el-table-column label="设备型号" width="120" align="center">
- <template slot-scope="scope">{{ scope.row.device_mode }}</template>
- </el-table-column>
-
- <el-table-column label="分区" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.device_type!='水处理机'"> {{ scope.row.name }}</span>
- <span v-if="scope.row.device_type=='水处理机'"> {{getZoneName(scope.row.zone_id) }}</span>
- </template>
- </el-table-column>
-
- <el-table-column label="机位号" align="center">
- <template slot-scope="scope">{{ scope.row.bed_number }}</template>
- </el-table-column>
-
- <el-table-column label="机器状态" align="center">
- <template slot-scope="scope">{{ scope.row.machine_status }}</template>
- </el-table-column>
-
- <el-table-column label="使用次数" align="center" v-if="org_id!=0&&org_id!=10440">
- <template slot-scope="scope">{{getTotal(scope.row.bed_id,scope.row.user_total) }}</template>
- </el-table-column>
-
- <el-table-column label="操作" width="200" align="center">
- <template slot-scope="scope">
- <el-button
- @click="handleClick(scope.row.id, scope.$index, scope.row.bed_id)"
- type="primary"
- size="small"
- >查看</el-button>
- <el-button
- @click="deleManageMent(scope.row.id,scope.row.equiment_id,scope.$index)"
- size="small"
- type="danger"
- icon="el-icon-delete"
- >删除</el-button>
- </template>
-
- </el-table-column>
- </el-table>
-
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[10, 20, 50, 100]"
- :page-size="10"
- background
- style="margin-top:20px;float: right"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- ></el-pagination>
- <!-- 新增设备 -->
- <manage-form
- ref="manageForm"
- v-on:getAllMachineInfo="getAllMachineInfo"
- ></manage-form>
- </div>
- </div>
- </template>
-
- <script>
- import BreadCrumb from "../components/bread-crumb";
- import { getAllMachineInfo, getAllSubregion,getUserMachTotalCount,deleteManageMent,getInformationManaList } from "@/api/manage";
- import ManageForm from "./components/ManageForm";
-
- export default {
- name: "index.vue",
- components: {
- BreadCrumb,
- ManageForm
- },
- data() {
- return {
- crumbs: [
- { path: false, name: "设备管理" },
- { path: false, name: "设备管理" }
- ],
- searchKey: "",
- zones: [{ id: 0, name: "全部" }],
- schedulType: 0,
- schedulTypeone: 0,
- schedulTypetwo: 0,
- DeviceType: [
- { id: 0, name: "全部" },
- { id: 1, name: "透析机" },
- { id: 2, name: "水处理机" },
- { id: 3, name: "其他" }
- ],
-
- AllStatus: [
- { id: 0, name: "全部" },
- { id: 1, name: "使用机" },
- { id: 2, name: "备用机" },
- { id: 3, name: "急诊机" },
- { id: 4, name: "报废机" }
- ],
- tableData: [],
- listQuery: {
- page: 1,
- limit: 10,
- searchKey: "",
- zoneid: "",
- equipmentid: "",
- statusid: ""
- },
- total: 0,
- count:[],
- org_id:0,
- };
- },
- methods: {
- getAllSubregion() {
- getAllSubregion().then(response => {
- if (response.data.state === 1) {
- var zone = response.data.data.zones;
- var zones = [{ id: 0, name: "全部" }];
- for (let i = 0; i < zone.length; i++) {
- const item = zone[i];
- zones.push({ id: item.id, name: item.name });
- }
- // console.log('zones', zones)
- this.zones = zones;
- }
- });
- },
- selectSchedulType(scheduleType) {
- this.schedulType = scheduleType;
- this.listQuery.zoneid = scheduleType;
- this.getAllMachineInfo();
- },
- selectSchedulTypeOne(scheduleType) {
- this.schedulTypeone = scheduleType;
- this.listQuery.equipmentid = scheduleType;
- this.getAllMachineInfo();
- },
- selectSchedulTypeTwo(scheduleType) {
- this.schedulTypetwo = scheduleType;
- this.listQuery.statusid = scheduleType;
- this.getAllMachineInfo();
- },
- seahcerMacherInfo() {
- this.getAllMachineInfo();
- },
- AddManage() {
- this.$refs.manageForm.open();
- },
- getAllMachineInfo() {
- getAllMachineInfo(
- this.listQuery.page,
- this.listQuery.limit,
- this.listQuery.searchKey,
- this.listQuery.zoneid,
- this.listQuery.equipmentid,
- this.listQuery.statusid
- ).then(response => {
- if (response.data.state === 1) {
- var addmahcer = response.data.data.addmahcer;
- // console.log("addmacher", addmahcer);
- for (let index = 0; index < addmahcer.length; index++) {
- if (addmahcer[index].device_type === 1) {
- addmahcer[index].device_type = "透析机";
- addmahcer[index].bed_number = addmahcer[index].number;
- }
- if (addmahcer[index].device_type === 2) {
- addmahcer[index].device_type = "水处理机";
- addmahcer[index].bed_number = addmahcer[index].bed_number;
- }
-
- if (addmahcer[index].device_type === 3) {
- addmahcer[index].device_type = "其他";
- addmahcer[index].bed_number = addmahcer[index].bed_number;
- }
-
- if (addmahcer[index].machine_status === 1) {
- addmahcer[index].machine_status = "使用机";
- }
- if (addmahcer[index].machine_status === 2) {
- addmahcer[index].machine_status = "备用机";
- }
- if (addmahcer[index].machine_status === 3) {
- addmahcer[index].machine_status = "急诊机";
- }
- if (addmahcer[index].machine_status === 4) {
- addmahcer[index].machine_status = "报废机";
- }
- }
- this.tableData = addmahcer;
- console.log('addmacher', addmahcer)
- var total = response.data.data.total;
- // console.log('total', total)
- this.total = total;
- }
- });
- },
- handleSizeChange(limit) {
- this.listQuery.limit = limit;
- this.getAllMachineInfo();
- },
- handleCurrentChange(page) {
- this.listQuery.page = page;
- this.getAllMachineInfo();
- },
- handleClick(id, index, bedid) {
- this.$router.push({
- path:
- "/device/home?index=" +
- index +
- "&" +
- "bedid=" +
- bedid +
- "&" +
- "id=" +
- id
- });
- // this.$router.push({ path: '/device/home?index=' + index + '&' + 'id=' + id })
- },
- getUserMachTotalCount(){
- getUserMachTotalCount().then(response=>{
- if(response.data.state == 1){
- var count = response.data.data.count
- // console.log("count",count)
- this.count = count
- }
- })
- },
- getTotal(id,usertotal){
- if(usertotal == ''){
- usertotal = 0
- }
- var count = 0
- for(let i=0;i<this.count.length;i++){
- if(id == this.count[i].bed_number){
- count = parseInt(this.count[i].Total)+parseInt(usertotal)
- }
- }
- // console.log("count",count)
- return count
- },
- deleManageMent(id,equimentid){
- if(equimentid != 0){
- this.$confirm(
- '该设备已有使用记录,确认要删除吗? <br>删除后,信息将无法恢复',
- '删除提示',
- {
- dangerouslyUseHTMLString: true,
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }
- ).then(() => {
- deleteManageMent(id).then(response => {
- // eslint-disable-next-line eqeqeq
- if (response.data.state == 1) {
- var msg = response.data.data.msg
- this.getAllMachineInfo()
- this.$message.success("删除成功")
- } else {
- this.$message.error('删除失败')
- }
- }).catch(e => {})
- }).catch(() => {
- return false
- })
- }
- if(equimentid ==0){
- this.$confirm(
- '确认要删除所选设备吗? <br>删除后,信息将无法恢复',
- '删除提示',
- {
- dangerouslyUseHTMLString: true,
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }
- ).then(() => {
- deleteManageMent(id).then(response => {
- // eslint-disable-next-line eqeqeq
- if (response.data.state == 1) {
- var msg = response.data.data.msg
- this.getAllMachineInfo()
- this.$message.success('删除成功')
- } else {
- this.$message.error('删除失败')
- }
- }).catch(e => {})
- }).catch(() => {
- return false
- })
- }
-
- },
-
- Auto(){
-
- getInformationManaList().then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- this.$message.success("保存成功!")
- }
- })
- },
- getZoneName(val){
- var zone_name= ""
- for(let i=0;i<this.zones.length;i++){
- if(val == this.zones[i].id){
- zone_name = this.zones[i].name
- }
- }
- return zone_name
- }
- },
- created() {
- // 获取所有的分区
- this.getAllSubregion();
- this.getAllMachineInfo();
- this.getUserMachTotalCount()
- this.org_id = this.$store.getters.xt_user.template_info.org_id
- }
- };
- </script>
-
- <style scoped></style>
|