voiceIntercom.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <!--硬件管理/语音对讲-->
  2. <template>
  3. <div class="app-container voiceIntercom">
  4. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px" class="form-box">
  5. <el-form-item label="学院" prop="type">
  6. <el-select v-model="queryParams.name" placeholder="请选择学院" clearable size="small">
  7. <el-option label="请选择字典生成" value="" />
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="实验室" prop="type">
  11. <el-select v-model="queryParams.factory" placeholder="请选择实验室" clearable size="small">
  12. <el-option label="请选择字典生成" value="" />
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="状态" prop="type" style="margin-left:-40px;">
  16. <el-select v-model="queryParams.type" placeholder="请选择状态" clearable size="small">
  17. <el-option label="请选择字典生成" value="" />
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item style="float: right;">
  21. <el-col :span="1.5">
  22. <p class="add-button-one-120"
  23. @click="handleAdd"
  24. v-hasPermi="['laboratory:hardware:add']"
  25. ><i class="el-icon-plus"></i>新增硬件</p>
  26. </el-col>
  27. </el-form-item>
  28. <el-form-item>
  29. <p class="inquire-button-one" @click="handleQuery">查询</p>
  30. <p class="reset-button-one" @click="resetQuery">重置</p>
  31. </el-form-item>
  32. </el-form>
  33. <el-table v-loading="loading" border :data="hardwareList" @selection-change="handleSelectionChange">
  34. <el-table-column type="selection" width="55" align="center" />
  35. <el-table-column label="主键id" align="left" prop="id" />
  36. <el-table-column label="设备名称" align="left" prop="name" />
  37. <el-table-column label="设备厂家" align="left" prop="factory" />
  38. <el-table-column label="设备类型" align="left" prop="type" />
  39. <el-table-column label="mac地址" align="left" prop="macAdd" />
  40. <el-table-column label="实验室id" align="left" prop="subjectId" />
  41. <el-table-column label="部门id" align="left" prop="deptId" />
  42. <el-table-column label="部门名称" align="left" prop="deptName" />
  43. <el-table-column label="设备状态" align="left" prop="operate" />
  44. <el-table-column label="创建人" align="left" prop="userId" />
  45. <el-table-column label="备注" align="left" prop="remark" />
  46. <el-table-column label="操作" align="left" class-name="small-padding fixed-width">
  47. <template slot-scope="scope">
  48. <div class="table-button-box">
  49. <p class="table-button-null"></p>
  50. <p @click="handleUpdate(scope.row)" v-hasPermi="['laboratory:hardware:edit']">修改</p>
  51. <p @click="handleDelete(scope.row)" v-hasPermi="['laboratory:hardware:remove']">删除</p>
  52. <p class="table-button-null"></p>
  53. </div>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. <pagination :page-sizes="[20, 30, 40, 50]"
  58. v-show="total>0"
  59. :total="total"
  60. layout="total, prev, pager, next, sizes, jumper"
  61. :page.sync="queryParams.pageNum"
  62. :limit.sync="queryParams.pageSize"
  63. @pagination="getList"
  64. />
  65. <!-- 添加或修改硬件对话框 -->
  66. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body class="hardware-dialog"
  67. :close-on-click-modal="false">
  68. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  69. <el-form-item label="设备名称" prop="name">
  70. <el-input v-model="form.name" placeholder="请输入设备名称" />
  71. </el-form-item>
  72. <el-form-item label="设备类型" prop="type" v-if="pageType==''">
  73. <el-select v-model="form.type" placeholder="请选择设备类型" >
  74. <el-option label="请选择字典生成" value="" />
  75. </el-select>
  76. </el-form-item>
  77. <el-form-item label="mac地址" prop="macAdd">
  78. <el-input v-model="form.macAdd" placeholder="请输入mac地址" />
  79. </el-form-item>
  80. <el-form-item label="实验室" prop="subjectId">
  81. <el-input v-model="form.subjectId" placeholder="请输入实验室" />
  82. </el-form-item>
  83. </el-form>
  84. <div slot="footer" class="dialog-footer">
  85. <el-button @click="cancel">取 消</el-button>
  86. <el-button type="primary" @click="submitForm">确 定</el-button>
  87. </div>
  88. </el-dialog>
  89. </div>
  90. </template>
  91. <script>
  92. import { listHardware, getHardware, delHardware, addHardware, updateHardware } from "@/api/laboratory/hardware";
  93. export default {
  94. props:{
  95. pageType:{},
  96. },
  97. name: "voiceIntercom",
  98. data() {
  99. return {
  100. index:'',
  101. // 遮罩层
  102. loading: true,
  103. // 选中数组
  104. ids: [],
  105. // 非单个禁用
  106. single: true,
  107. // 非多个禁用
  108. multiple: true,
  109. // 显示搜索条件
  110. showSearch: true,
  111. // 总条数
  112. total: 0,
  113. // 硬件表格数据
  114. hardwareList: [],
  115. // 弹出层标题
  116. title: "",
  117. // 是否显示弹出层
  118. open: false,
  119. // 查询参数
  120. queryParams: {
  121. pageNum: 1,
  122. pageSize:20,
  123. name: null,
  124. factory: null,
  125. type: null,
  126. macAdd: null,
  127. subjectId: null,
  128. deptId: null,
  129. deptName: null,
  130. operate: null,
  131. userId: null,
  132. },
  133. // 表单参数
  134. form: {},
  135. // 表单校验
  136. rules: {
  137. }
  138. };
  139. },
  140. created() {
  141. this.getList();
  142. },
  143. methods: {
  144. /** 查询硬件列表 */
  145. getList() {
  146. this.loading = true;
  147. listHardware(this.queryParams).then(response => {
  148. this.hardwareList = response.rows;
  149. this.total = response.total;
  150. this.loading = false;
  151. });
  152. },
  153. // 取消按钮
  154. cancel() {
  155. this.open = false;
  156. this.reset();
  157. },
  158. // 表单重置
  159. reset() {
  160. this.form = {
  161. id: null,
  162. name: null,
  163. factory: null,
  164. type: null,
  165. macAdd: null,
  166. subjectId: null,
  167. deptId: null,
  168. deptName: null,
  169. operate: null,
  170. createTime: null,
  171. userId: null,
  172. createBy: null,
  173. updateTime: null,
  174. updateBy: null,
  175. remark: null
  176. };
  177. this.resetForm("form");
  178. },
  179. /** 搜索按钮操作 */
  180. handleQuery() {
  181. this.queryParams.pageNum = 1;
  182. this.getList();
  183. },
  184. /** 重置按钮操作 */
  185. resetQuery() {
  186. this.resetForm("queryForm");
  187. this.handleQuery();
  188. },
  189. // 多选框选中数据
  190. handleSelectionChange(selection) {
  191. this.ids = selection.map(item => item.id)
  192. this.single = selection.length!==1
  193. this.multiple = !selection.length
  194. },
  195. /** 新增按钮操作 */
  196. handleAdd() {
  197. this.reset();
  198. this.open = true;
  199. this.title = "添加硬件";
  200. },
  201. /** 修改按钮操作 */
  202. handleUpdate(row) {
  203. this.reset();
  204. const id = row.id || this.ids
  205. getHardware(id).then(response => {
  206. this.form = response.data;
  207. this.open = true;
  208. this.title = "修改硬件";
  209. });
  210. },
  211. /** 提交按钮 */
  212. submitForm() {
  213. this.$refs["form"].validate(valid => {
  214. if (valid) {
  215. if (this.form.id != null) {
  216. updateHardware(this.form).then(response => {
  217. this.msgSuccess("修改成功");
  218. this.open = false;
  219. this.getList();
  220. });
  221. } else {
  222. addHardware(this.form).then(response => {
  223. this.msgSuccess("新增成功");
  224. this.open = false;
  225. this.getList();
  226. });
  227. }
  228. }
  229. });
  230. },
  231. /** 删除按钮操作 */
  232. handleDelete(row) {
  233. const ids = row.id || this.ids;
  234. this.$confirm('是否确认删除硬件?', "警告", {
  235. confirmButtonText: "确定",
  236. cancelButtonText: "取消",
  237. type: "warning"
  238. }).then(function() {
  239. return delHardware(ids);
  240. }).then(() => {
  241. this.getList();
  242. this.msgSuccess("删除成功");
  243. }).catch(() => {});
  244. },
  245. /** 导出按钮操作 */
  246. handleExport() {
  247. this.download('laboratory/hardware/export', {
  248. ...this.queryParams
  249. }, `laboratory_hardware.xlsx`)
  250. }
  251. }
  252. };
  253. </script>
  254. <style scoped lang="scss">
  255. .voiceIntercom{
  256. flex: 1;
  257. display: flex!important;
  258. flex-direction: column;
  259. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  260. padding:20px!important;
  261. margin:0 20px 20px;
  262. .form-box{
  263. }
  264. .button-box{
  265. width:350px;
  266. display: flex;
  267. }
  268. }
  269. </style>