index.vue 9.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-button
  6. class="filter-item"
  7. style="float:right;"
  8. type="primary"
  9. icon="el-icon-circle-plus-outline"
  10. size="small"
  11. @click="AddManage()"
  12. >新增</el-button
  13. >
  14. </div>
  15. <div class="app-container">
  16. <div class="cell clearfix">
  17. <el-input
  18. style="width: 400px;"
  19. v-model.trim="listQuery.searchKey"
  20. class="filter-item"
  21. placeholder="输入序列号/设备名/型号搜索"
  22. size="small"
  23. />
  24. <el-button
  25. class="filter-item"
  26. type="primary"
  27. icon="el-icon-search"
  28. size="small"
  29. @click="seahcerMacherInfo()"
  30. >搜索</el-button
  31. >
  32. </div>
  33. <div class="cell clearfix">
  34. <label class="title">
  35. <span class="name">分区:</span>
  36. </label>
  37. <div class="time">
  38. <ul class>
  39. <li
  40. :class="item.id == schedulType ? 'active' : ''"
  41. v-for="item in this.zones"
  42. :key="item.id"
  43. @click="selectSchedulType(item.id)"
  44. >
  45. {{ item.name }}
  46. </li>
  47. </ul>
  48. </div>
  49. </div>
  50. <div class="cell clearfix">
  51. <label class="title">
  52. <span class="name">设备类型:</span>
  53. </label>
  54. <div class="time">
  55. <ul class>
  56. <li
  57. :class="item.id == schedulTypeone ? 'active' : ''"
  58. v-for="item in this.DeviceType"
  59. :key="item.id"
  60. @click="selectSchedulTypeOne(item.id)"
  61. >
  62. {{ item.name }}
  63. </li>
  64. </ul>
  65. </div>
  66. </div>
  67. <div class="cell clearfix">
  68. <label class="title">
  69. <span class="name">状态:</span>
  70. </label>
  71. <div class="time">
  72. <ul class>
  73. <li
  74. :class="item.id == schedulTypetwo ? 'active' : ''"
  75. v-for="item in this.AllStatus"
  76. :key="item.id"
  77. @click="selectSchedulTypeTwo(item.id)"
  78. >
  79. {{ item.name }}
  80. </li>
  81. </ul>
  82. </div>
  83. </div>
  84. <el-table
  85. :data="tableData"
  86. border
  87. style="width: 100%"
  88. :row-style="{ color: '#303133' }"
  89. :header-cell-style="{
  90. backgroundColor: 'rgb(245, 247, 250)',
  91. color: '#606266'
  92. }"
  93. >
  94. <el-table-column label="序号" width="80" align="center" type="index">
  95. <!-- <template slot-scope="scope">{{ scope.row.id }}</template> -->
  96. </el-table-column>
  97. <el-table-column label="序列号" width="120" align="center">
  98. <template slot-scope="scope">{{ scope.row.serial_number }}</template>
  99. </el-table-column>
  100. <el-table-column label="设备类型" width="120" align="center">
  101. <template slot-scope="scope">{{ scope.row.device_type }}</template>
  102. </el-table-column>
  103. <el-table-column label="设备名称" width="120" align="center">
  104. <template slot-scope="scope">{{ scope.row.device_name }}</template>
  105. </el-table-column>
  106. <el-table-column label="设备型号" width="120" align="center">
  107. <template slot-scope="scope">{{ scope.row.device_mode }}</template>
  108. </el-table-column>
  109. <el-table-column label="分区" align="center">
  110. <template slot-scope="scope">{{ scope.row.name }}</template>
  111. </el-table-column>
  112. <el-table-column label="机位号" align="center">
  113. <template slot-scope="scope">{{ scope.row.bed_number }}</template>
  114. </el-table-column>
  115. <el-table-column label="机器状态" align="center">
  116. <template slot-scope="scope">{{ scope.row.machine_status }}</template>
  117. </el-table-column>
  118. <el-table-column label="使用次数" align="center">
  119. <template slot-scope="scope">{{ scope.row.user_total }}</template>
  120. </el-table-column>
  121. <el-table-column label="操作" width="120" align="center">
  122. <template slot-scope="scope">
  123. <el-button
  124. @click="handleClick(scope.row.id, scope.$index, scope.row.bed_id)"
  125. type="primary"
  126. size="small"
  127. >查看</el-button
  128. >
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. <el-pagination
  133. @size-change="handleSizeChange"
  134. @current-change="handleCurrentChange"
  135. :page-sizes="[10, 20, 50, 100]"
  136. :page-size="10"
  137. background
  138. style="margin-top:20px;float: right"
  139. layout="total, sizes, prev, pager, next, jumper"
  140. :total="total"
  141. ></el-pagination>
  142. <!-- 新增设备 -->
  143. <manage-form
  144. ref="manageForm"
  145. v-on:getAllMachineInfo="getAllMachineInfo"
  146. ></manage-form>
  147. </div>
  148. </div>
  149. </template>
  150. <script>
  151. import BreadCrumb from "../components/bread-crumb";
  152. import { getAllMachineInfo, getAllSubregion } from "@/api/manage";
  153. import ManageForm from "./components/ManageForm";
  154. export default {
  155. name: "index.vue",
  156. components: {
  157. BreadCrumb,
  158. ManageForm
  159. },
  160. data() {
  161. return {
  162. crumbs: [
  163. { path: false, name: "设备管理" },
  164. { path: false, name: "设备管理" }
  165. ],
  166. searchKey: "",
  167. zones: [{ id: 0, name: "全部" }],
  168. schedulType: 0,
  169. schedulTypeone: 0,
  170. schedulTypetwo: 0,
  171. DeviceType: [
  172. { id: 0, name: "全部" },
  173. { id: 1, name: "透析机" },
  174. { id: 2, name: "水处理机" },
  175. { id: 3, name: "其他" }
  176. ],
  177. AllStatus: [
  178. { id: 0, name: "全部" },
  179. { id: 1, name: "使用机" },
  180. { id: 2, name: "备用机" },
  181. { id: 3, name: "急诊机" },
  182. { id: 4, name: "报废机" }
  183. ],
  184. tableData: [],
  185. listQuery: {
  186. page: 1,
  187. limit: 10,
  188. searchKey: "",
  189. zoneid: "",
  190. equipmentid: "",
  191. statusid: ""
  192. },
  193. total: 0
  194. };
  195. },
  196. methods: {
  197. getAllSubregion() {
  198. getAllSubregion().then(response => {
  199. if (response.data.state === 1) {
  200. var zone = response.data.data.zones;
  201. var zones = [{ id: 0, name: "全部" }];
  202. for (let i = 0; i < zone.length; i++) {
  203. const item = zone[i];
  204. zones.push({ id: item.id, name: item.name });
  205. }
  206. // console.log('zones', zones)
  207. this.zones = zones;
  208. }
  209. });
  210. },
  211. selectSchedulType(scheduleType) {
  212. this.schedulType = scheduleType;
  213. this.listQuery.zoneid = scheduleType;
  214. this.getAllMachineInfo();
  215. },
  216. selectSchedulTypeOne(scheduleType) {
  217. this.schedulTypeone = scheduleType;
  218. this.listQuery.equipmentid = scheduleType;
  219. this.getAllMachineInfo();
  220. },
  221. selectSchedulTypeTwo(scheduleType) {
  222. this.schedulTypetwo = scheduleType;
  223. this.listQuery.statusid = scheduleType;
  224. this.getAllMachineInfo();
  225. },
  226. seahcerMacherInfo() {
  227. this.getAllMachineInfo();
  228. },
  229. AddManage() {
  230. this.$refs.manageForm.open();
  231. },
  232. getAllMachineInfo() {
  233. getAllMachineInfo(
  234. this.listQuery.page,
  235. this.listQuery.limit,
  236. this.listQuery.searchKey,
  237. this.listQuery.zoneid,
  238. this.listQuery.equipmentid,
  239. this.listQuery.statusid
  240. ).then(response => {
  241. if (response.data.state === 1) {
  242. var addmahcer = response.data.data.addmahcer;
  243. console.log("addmacher", addmahcer);
  244. for (let index = 0; index < addmahcer.length; index++) {
  245. if (addmahcer[index].device_type === 1) {
  246. addmahcer[index].device_type = "透析机";
  247. addmahcer[index].bed_number = addmahcer[index].number;
  248. }
  249. if (addmahcer[index].device_type === 2) {
  250. addmahcer[index].device_type = "水处理机";
  251. addmahcer[index].bed_number = addmahcer[index].bed_number;
  252. }
  253. if (addmahcer[index].device_type === 3) {
  254. addmahcer[index].device_type = "其他";
  255. addmahcer[index].bed_number = addmahcer[index].bed_number;
  256. }
  257. if (addmahcer[index].machine_status === 1) {
  258. addmahcer[index].machine_status = "使用机";
  259. }
  260. if (addmahcer[index].machine_status === 2) {
  261. addmahcer[index].machine_status = "备用机";
  262. }
  263. if (addmahcer[index].machine_status === 3) {
  264. addmahcer[index].machine_status = "急诊机";
  265. }
  266. if (addmahcer[index].machine_status === 4) {
  267. addmahcer[index].machine_status = "报废机";
  268. }
  269. }
  270. this.tableData = addmahcer;
  271. // console.log('addmacher', addmahcer)
  272. var total = response.data.data.total;
  273. // console.log('total', total)
  274. this.total = total;
  275. }
  276. });
  277. },
  278. handleSizeChange(limit) {
  279. this.listQuery.limit = limit;
  280. this.getAllMachineInfo();
  281. },
  282. handleCurrentChange(page) {
  283. this.listQuery.page = page;
  284. this.getAllMachineInfo();
  285. },
  286. handleClick(id, index, bedid) {
  287. this.$router.push({
  288. path:
  289. "/device/home?index=" +
  290. index +
  291. "&" +
  292. "bedid=" +
  293. bedid +
  294. "&" +
  295. "id=" +
  296. id
  297. });
  298. // this.$router.push({ path: '/device/home?index=' + index + '&' + 'id=' + id })
  299. }
  300. },
  301. created() {
  302. // 获取所有的分区
  303. this.getAllSubregion();
  304. this.getAllMachineInfo();
  305. }
  306. };
  307. </script>
  308. <style scoped></style>