index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  1. <!--智能报警器-->
  2. <template>
  3. <div class="app-container smartAlarm">
  4. <el-form :model="queryParamsData" class="form-box" ref="queryForm" :inline="true">
  5. <el-form-item label="关键字" prop="searchValue">
  6. <el-input
  7. maxLength="30"
  8. v-model="queryParamsData.searchValue"
  9. placeholder="设备编号/实验室"
  10. clearable
  11. size="small"
  12. style="width: 240px"/>
  13. </el-form-item>
  14. <el-form-item label="学院" prop="deptId">
  15. <el-select v-model="queryParamsData.deptId" clearable placeholder="请选择学院">
  16. <el-option
  17. v-for="item in optionsListOne"
  18. :key="item.deptId"
  19. :label="item.deptName"
  20. :value="item.deptId">
  21. </el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="状态" prop="deviceStatus">
  25. <el-select v-model="queryParamsData.deviceStatus" clearable placeholder="请选择状态">
  26. <el-option
  27. v-for="item in optionsListTwo"
  28. :key="item.id"
  29. :label="item.name"
  30. :value="item.id">
  31. </el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item>
  35. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  36. <p class="reset-button-one" @click="resetQuery">重置</p>
  37. </el-form-item>
  38. <el-form-item style="float: right;">
  39. <el-col :span="1.5" v-hasPermi="['laboratory:hardware8:add']">
  40. <p class="add-button-one-90"
  41. @click="pageToggle(1)"
  42. ><i class="el-icon-plus"></i>新增</p>
  43. </el-col>
  44. </el-form-item>
  45. <el-form-item style="float: right;">
  46. <el-col :span="1.5" v-hasPermi="['chemical:hxpSmartTerminalConfig:edit']">
  47. <p class="add-button-one-90"
  48. @click="pageToggle(4)"
  49. >报警设置</p>
  50. </el-col>
  51. </el-form-item>
  52. <el-form-item style="float: right;">
  53. <el-dropdown @command="importButton" v-hasPermi="['laboratory:hardware8:import']">
  54. <div class="form-dropdown-box">
  55. <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_dr.png">
  56. <p>导入</p>
  57. <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
  58. </div>
  59. <el-dropdown-menu slot="dropdown">
  60. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;color:#333;" :command="{command:1}">下载模板</el-dropdown-item>
  61. <el-dropdown-item style="margin:0 10px;color:#666;" :command="{command:2}">导入数据</el-dropdown-item>
  62. </el-dropdown-menu>
  63. </el-dropdown>
  64. </el-form-item>
  65. </el-form>
  66. <el-table border :data="tableList" @selection-change="handleSelectionChange" ref="multipleTable" :row-key="getRowKeys">
  67. <el-table-column type="selection" width="50" align="center" :reserve-selection="true"/>
  68. <el-table-column label="智能报警器编号" align="center" prop="hardwareNum"/>
  69. <el-table-column label="学院" align="center" prop="deptName" width="180"/>
  70. <el-table-column label="位置" align="center" prop="posi" width="250" show-overflow-tooltip/>
  71. <el-table-column label="设备状态" align="center" prop="status" width="80">
  72. <template slot-scope="scope">{{scope.row.status == 3||scope.row.status == 4?'在线':'离线'}}</template>
  73. </el-table-column>
  74. <el-table-column label="报警时长" align="center" prop="ringTime" width="80">
  75. <template slot-scope="scope">{{scope.row.ringTime?scope.row.ringTime+'秒':'未设置'}}</template>
  76. </el-table-column>
  77. <el-table-column label="处理时长" align="center" prop="dealTime" width="80">
  78. <template slot-scope="scope">{{scope.row.dealTime?scope.row.dealTime+'分钟':'未设置'}}</template>
  79. </el-table-column>
  80. <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
  81. <el-table-column label="创建人" align="center" prop="createBy" width="150"/>
  82. <el-table-column label="操作" align="center" width="220" class-name="small-padding fixed-width" v-if="tableButtonType">
  83. <template slot-scope="scope">
  84. <div class="button-box">
  85. <p style="margin-left:20px;">
  86. <el-switch
  87. @click.native="changeIsNeedCaptcha(scope.row)"
  88. class="switch captcha-img"
  89. :active-value="1"
  90. :inactive-value="0"
  91. active-color="#0183FA"
  92. inactive-color="#999"
  93. v-model="scope.row.deviceStatus"
  94. active-text="启用"
  95. inactive-text="停用"
  96. disabled
  97. ></el-switch>
  98. </p>
  99. <p class="table-min-button" style="margin-right:10px;" v-hasPermi="['laboratory:hardware8:edit']" @click="pageToggle(2,scope.row)">编辑</p>
  100. <p class="table-min-button" v-hasPermi="['laboratory:hardware8:remove']" @click="pageToggle(3,scope.row)">删除</p>
  101. </div>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <div style="display: flex;height:32px;margin:15px 0;">
  106. <!--<p style="flex:4;"></p>-->
  107. <p style="text-align: left;margin:0;line-height:32px;margin-right:20px;font-size:14px;color:#999;">
  108. <i class="el-icon-warning" style="color:#0183FA;"></i>
  109. 已选择 {{selectedNum}} 项
  110. </p>
  111. <div style="flex:5;">
  112. <pagination :page-sizes="[20, 30, 40, 50]"
  113. v-show="total>0"
  114. :total="total"
  115. style="margin:0;"
  116. :page.sync="queryParams.pageNum"
  117. :limit.sync="queryParams.pageSize"
  118. @pagination="getList"
  119. />
  120. </div>
  121. </div>
  122. <!--导入窗口-->
  123. <el-dialog title="导入数据" :visible.sync="importOpen" @close="importOpenOff" width="600px" append-to-body class="import-dialog-box">
  124. <div class="el-upload__text" style="margin:0 0 20px 58px;">提示:导入后的数据将覆盖原有数据</div>
  125. <el-upload
  126. class="import-dialog-upLoad-box"
  127. :drag="true"
  128. :data="upImportData"
  129. :action="uploadImgUrl"
  130. :show-file-list="false"
  131. :on-success="handleAvatarSuccess"
  132. :headers="headers"
  133. :before-upload="beforeAvatarUpload">
  134. <i class="el-icon-upload"></i>
  135. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  136. <!--<div class="el-upload__tip" slot="tip">-->
  137. <!--<el-checkbox v-model="upImportData.upDate">是否更新已经存在的数据</el-checkbox>-->
  138. <!--</div>-->
  139. <div class="el-upload__tip" slot="tip">数据导入模板.xlsx<span style="color:#0183FA;cursor: pointer" @click="importTemplate">下载</span></div>
  140. <div class="el-upload-text-box" slot="tip" v-if="getImportData.downFile">
  141. <div class="img-text-box">
  142. <img src="@/assets/ZDimages/personnelManagement/icon_dr_wj.png">
  143. <p>{{getImportData.textName}}</p>
  144. </div>
  145. <p class="text-p">数据导入成功 <span style="color:#0183FA;">{{getImportData.successNum}}</span> 条,失败 <span style="color:#FF6464 ;">{{getImportData.failureNum}}</span> 条</p>
  146. <div class="img-text-box">
  147. <img src="@/assets/ZDimages/personnelManagement/icon_dr_sj.png">
  148. <p style="color:#0183FA;cursor: pointer;" @click="failureExcel">点击下载失败数据报表</p>
  149. </div>
  150. </div>
  151. </el-upload>
  152. <div slot="footer" class="teacher-import-dialog-button-box">
  153. <p class="inquire-button-one" @click="importOpenOff">确定</p>
  154. </div>
  155. <div class="teacher-import-dialog-position-box" v-if="loading"></div>
  156. </el-dialog>
  157. <!--新增/编辑-->
  158. <el-dialog :title="dialogTitle" :visible.sync="addDialogType" v-if="addDialogType" width="550px" append-to-body class="add-dialog-box">
  159. <el-form ref="form" :model="form" :rules="rules" label-width="140px">
  160. <el-form-item label="智能报警器编号:" prop="hardwareNum">
  161. <el-input v-model="form.hardwareNum" placeholder="最大20个字符,包含大小写字母、数字" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')" maxlength="30" style="width:360px;"/>
  162. </el-form-item>
  163. <el-form-item label="实验室:" prop="subjectId">
  164. <el-select
  165. style="width:360px;"
  166. v-model="form.subjectId"
  167. filterable
  168. remote
  169. clearable
  170. reserve-keyword
  171. @focus="selectFocus"
  172. @clear="clearClick"
  173. placeholder="搜索选择实验室"
  174. :remote-method="getSelectList"
  175. :loading="loading">
  176. <el-option
  177. v-for="item in selectList"
  178. :key="item.id"
  179. :label="item.name"
  180. :value="item.id">
  181. </el-option>
  182. </el-select>
  183. </el-form-item>
  184. <el-form-item label="继电器类型">
  185. <el-radio-group v-model="form.hardwareType" style="width:360px;">
  186. <el-radio :label="item.value" :key="item.value" v-for="(item,index) in hardwardTypeList">{{item.label}}</el-radio>
  187. </el-radio-group>
  188. </el-form-item>
  189. <el-form-item label="绑定继电器" prop="relayCode" v-if="form.hardwareType==1">
  190. <el-select v-model="form.relayCode" placeholder="请选择继电器" clearable style="width:360px;">
  191. <el-option v-for="relay in relayList"
  192. :key="relay.code"
  193. :label="relay.code"
  194. :value="relay.code">
  195. </el-option>
  196. </el-select>
  197. </el-form-item>
  198. <el-form-item label="继电器编号" prop="relayCode" v-if="form.hardwareType==2">
  199. <el-input
  200. style="width:360px;"
  201. v-model="form.relayCode"
  202. placeholder="请输入继电器编号"
  203. clearable
  204. size="small"
  205. maxlength="20"
  206. />
  207. </el-form-item>
  208. <el-form-item label="继电器位置" prop="bit" >
  209. <el-select v-model="form.bit" placeholder="请选择继电器位置" clearable style="width:360px;">
  210. <el-option v-for="lab in relayNumList"
  211. :key="lab.name"
  212. :label="lab.name"
  213. :value="lab.name">
  214. </el-option>
  215. </el-select>
  216. </el-form-item>
  217. <el-form-item label="配置名称" prop="relayCode" v-if="form.hardwareType==2">
  218. <el-input
  219. style="width:360px;"
  220. v-model="form.configName"
  221. placeholder="请输入配置名称"
  222. clearable
  223. size="small"
  224. maxLength="15"
  225. />
  226. </el-form-item>
  227. <el-form-item label="配置状态" prop="relayCode" v-if="form.hardwareType==2">
  228. <el-input
  229. style="width:360px;"
  230. v-model="form.configStatus"
  231. placeholder="请输入配置状态"
  232. clearable
  233. size="small"
  234. maxLength="8"
  235. />
  236. </el-form-item>
  237. </el-form>
  238. <div slot="footer" class="dialog-footer">
  239. <el-button type="primary" @click="submitForm">确 定</el-button>
  240. <el-button @click="cancel">取 消</el-button>
  241. </div>
  242. </el-dialog>
  243. <!--报警设置-->
  244. <el-dialog title="报警设置" :visible.sync="setUpType" v-if="setUpType" width="550px" append-to-body class="add-dialog-box">
  245. <el-form ref="setUpForm" :model="setUpForm" :rules="rules" label-width="120px">
  246. <el-form-item label="报警时长:" prop="ringTime">
  247. <el-input v-model="setUpForm.ringTime" placeholder="请输入报警时长" maxlength="3" style="width:360px;"
  248. onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
  249. <template slot="append">秒</template>
  250. </el-input>
  251. </el-form-item>
  252. <el-form-item label="处理时长:" prop="dealTime">
  253. <el-input v-model="setUpForm.dealTime" placeholder="请输入处理时长" maxlength="3" style="width:360px;"
  254. onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
  255. <template slot="append">分钟</template>
  256. </el-input>
  257. </el-form-item>
  258. </el-form>
  259. <div slot="footer" class="dialog-footer">
  260. <el-button type="primary" @click="setUpSubmitForm">确 定</el-button>
  261. <el-button @click="setUpCancel">取 消</el-button>
  262. </div>
  263. </el-dialog>
  264. </div>
  265. </template>
  266. <script>
  267. import { hxpSmartTerminal,filterDept,getSubList,addHxpSmartTerminal,putHxpSmartTerminal,getHxpSmartTerminal,delHxpSmartTerminal,updateStatus,alarmSettings } from "@/api/medicUniversity-3_1/index";
  268. import { listHardware, delHardware, addHardware, updateHardware, hardWareControl } from "@/api/medicUniversity-3_1/index";
  269. import { listRelay } from "@/api/laboratory/relay";
  270. import { listDepartments } from "@/api/system/dept";
  271. import { getToken } from "@/utils/auth";
  272. export default {
  273. name: "smartAlarm",
  274. data() {
  275. return {
  276. // table操作按钮校验
  277. tableButtonType:this.hasPermiDom(['laboratory:hardware8:edit','laboratory:hardware8:remove']),
  278. //上传相关配置
  279. uploadImgUrl: window.location.href.split('://')[0]+'://' + process.env.VUE_APP_BASE_API + "/laboratory/hardware/importData", // 上传地址
  280. headers: {
  281. Authorization: "Bearer " + getToken(),
  282. },
  283. // 遮罩层
  284. loading:false,
  285. //页面状态
  286. pageType:1,
  287. // 搜索数据
  288. queryParamsData:{
  289. pageNum:1,
  290. pageSize:20,
  291. },
  292. // 搜索实际发送数据
  293. queryParams:{
  294. pageNum:1,
  295. pageSize:20,
  296. },
  297. //数据数量
  298. total:0,
  299. //数据数组
  300. tableList:[],
  301. //表格扩展选择器---需要在@selection-change绑定的方法内监控selection数组长度
  302. selectedNum:0,
  303. // 选中数组
  304. ids: [],
  305. // 非单个禁用
  306. single: true,
  307. // 非多个禁用
  308. multiple: true,
  309. //学院列表
  310. optionsListOne:[],
  311. //状态列表
  312. optionsListTwo:[{id:"1",name:"启用"},{id:"0",name:"停用"}],
  313. //导入弹层开关
  314. importOpen:false,
  315. //导入数据
  316. upImportData:{
  317. sysUserEnable:true,
  318. upDate:false,
  319. terminalType:'AI_ALARM',
  320. },
  321. getImportData:{
  322. downFile:false,
  323. successNum:0,
  324. failureNum:0,
  325. textName:"",
  326. },
  327. //编辑新增相关
  328. dialogTitle:"",
  329. addDialogType:false,
  330. form:{},
  331. selectList:[],
  332. selectListData:[],
  333. relayNum: "",
  334. rules:{
  335. hardwareNum: [
  336. { required: true, trigger: "blur", message: "最大20个字符,包含大小写字母、数字" },
  337. { required: true, message: "最大20个字符,包含大小写字母、数字", validator: this.spaceJudgment, trigger: "blur" }
  338. ],
  339. subjectId: [
  340. { required: true, trigger: "blur", message: "搜索选择实验室" },
  341. ],
  342. ringTime: [
  343. { required: true, trigger: "blur", message: "请输入报警时长" },
  344. { required: true, message: "请输入报警时长", validator: this.spaceJudgment, trigger: "blur" }
  345. ],
  346. dealTime: [
  347. { required: true, trigger: "blur", message: "请输入处理时长" },
  348. { required: true, message: "请输入处理时长", validator: this.spaceJudgment, trigger: "blur" }
  349. ],
  350. },
  351. //报警设置
  352. setUpType:false,
  353. setUpForm:{},
  354. // 继电器
  355. relayList: [],
  356. relayNumList:[
  357. {name:1},
  358. {name:2},
  359. {name:3},
  360. {name:4},
  361. {name:5},
  362. {name:6},
  363. {name:7},
  364. {name:8},
  365. {name:9},
  366. {name:10},
  367. {name:11},
  368. {name:12}
  369. ],
  370. hardwardTypeList:[
  371. {value:1,label:"老继电器"},
  372. {value:2,label:"新继电器"}
  373. ]
  374. };
  375. },
  376. created() {
  377. },
  378. mounted(){
  379. this.filterDept();
  380. this.listDepartments();
  381. this.getList();
  382. this.getRelayList();
  383. },
  384. methods: {
  385. selectFocus(){
  386. if(!this.selectList[0]){
  387. this.filterDept();
  388. }
  389. },
  390. // 查询继电器列表
  391. getRelayList(){
  392. listRelay({"type": 1}).then(response => {
  393. this.relayList = response.data;
  394. if(this.form.relayCode){
  395. let self = this
  396. let num = ""
  397. for(let i=0;i<self.relayList.length;i++){
  398. if(self.relayList[i].code == this.form.relayCode){
  399. num = self.relayList[i].routeNum
  400. }
  401. }
  402. let list = [];
  403. for(let i=0;i<num;i++){
  404. let obj = {
  405. name:i+1
  406. }
  407. list.push(obj);
  408. }
  409. this.relayNumList = list;
  410. }
  411. });
  412. },
  413. //报警器开启关闭方法
  414. changeIsNeedCaptcha(row){
  415. let self = this;
  416. console.log("row.deviceStatus",row.deviceStatus);
  417. let text = row.deviceStatus==1?'停用':(row.deviceStatus==0?'启用':'')
  418. this.$confirm(`是否`+text+`此设备`, "提示", {
  419. confirmButtonText: "确定",
  420. cancelButtonText: "取消",
  421. type: "warning"
  422. }).then(async () => {
  423. self.switchChange(row)
  424. }).catch(() => {
  425. })
  426. },
  427. //开关按钮
  428. switchChange(row){
  429. //编辑
  430. let obj = {
  431. id:row.id,
  432. deviceStatus:row.deviceStatus == 1?0:1
  433. }
  434. this.form.type = "AI_ALARM";
  435. updateHardware(obj).then(response => {
  436. if (response.code == 200){
  437. row.deviceStatus = row.deviceStatus == 1?0:1;
  438. }
  439. });
  440. },
  441. //获取学院列表
  442. listDepartments(){
  443. listDepartments().then(response => {
  444. this.optionsListOne = response.data;
  445. });
  446. },
  447. pageToggle(type,item){
  448. let self = this;
  449. if(type == 1){
  450. //新增
  451. this.dialogTitle = '新增';
  452. this.$set(this,'form',{
  453. hardwareNum:"",
  454. subjectId:"",
  455. hardwareType:1,
  456. relayCode:"",
  457. bit:"",
  458. configName:"",
  459. configStatus:"",
  460. });
  461. this.clearClick();
  462. this.addDialogType = true;
  463. }else if(type == 2){
  464. // 编辑
  465. this.dialogTitle = '编辑';
  466. let obj = {
  467. id:item.id,
  468. subjectId:item.subjectId,
  469. hardwareNum:item.hardwareNum,
  470. hardwareType:item.hardwareType,
  471. relayCode:item.relayCode,
  472. bit:item.bit,
  473. configName:item.configName,
  474. configStatus:item.configStatus,
  475. };
  476. this.$set(this,'form',obj);
  477. this.clearClick();
  478. this.addDialogType = true;
  479. }else if(type == 3){
  480. // 删除
  481. this.$confirm('确认要删除吗?', "警告", {
  482. confirmButtonText: "确定",
  483. cancelButtonText: "取消",
  484. type: "warning"
  485. }).then(function() {
  486. delHardware(item.id).then(response => {
  487. if (response.code == 200){
  488. self.msgSuccess(response.msg);
  489. self.getList();
  490. }
  491. });
  492. }).then(() => {
  493. }).catch(() => {});
  494. }else if(type == 4){
  495. //报警设置
  496. if(self.ids.length>0) {
  497. this.setUpForm = {
  498. ringTime:"",
  499. dealTime:""
  500. }
  501. this.setUpType = true;
  502. }else{
  503. this.msgError('请选择要设置的报警器')
  504. }
  505. }
  506. },
  507. //查询当前院系
  508. filterDept(){
  509. filterDept().then(response => {
  510. let idText = "";
  511. for(let i=0;i<response.data.length;i++){
  512. if(i==0){
  513. idText = idText + response.data[i].deptId;
  514. }else{
  515. idText = idText +','+ response.data[i].deptId;
  516. }
  517. }
  518. //查询院系下实验室
  519. getSubList(idText).then(response => {
  520. //当前列表
  521. this.selectList = JSON.parse(JSON.stringify(response.data));
  522. //原始列表数据
  523. this.selectListData = JSON.parse(JSON.stringify(response.data));
  524. });
  525. });
  526. },
  527. /** 实验室-本地懒加载 */
  528. getSelectList(val) {
  529. let self = this;
  530. let list = [];
  531. for(let i=0;i<self.selectListData.length;i++){
  532. if(self.selectListData[i].name.indexOf(val) != -1){
  533. list.push(self.selectListData[i]);
  534. }
  535. }
  536. this.selectList = JSON.parse(JSON.stringify(list))
  537. },
  538. //实验室选中清除
  539. clearClick(){
  540. this.selectList = JSON.parse(JSON.stringify(this.selectListData))
  541. },
  542. submitForm(){
  543. this.$refs["form"].validate((valid) => {
  544. if (valid) {
  545. if(this.form.id){
  546. //编辑
  547. this.form.type = "AI_ALARM";
  548. updateHardware(this.form).then(response => {
  549. if (response.code == 200){
  550. this.addDialogType = false;
  551. this.msgSuccess(response.msg);
  552. this.getList();
  553. }
  554. });
  555. }else{
  556. //新增
  557. this.form.type = "AI_ALARM";
  558. addHardware(this.form).then(response => {
  559. if (response.code == 200){
  560. this.addDialogType = false;
  561. this.msgSuccess(response.msg);
  562. this.resetQuery();
  563. }
  564. });
  565. }
  566. }
  567. })
  568. },
  569. cancel(){
  570. this.addDialogType = false;
  571. },
  572. //获取数据列表
  573. getList(){
  574. this.queryParamsData = JSON.parse(JSON.stringify(this.queryParams));
  575. this.queryParamsData.type = 'AI_ALARM';
  576. listHardware(this.queryParamsData).then(response => {
  577. this.total = response.total;
  578. this.tableList = response.rows;
  579. });
  580. },
  581. /** 搜索按钮操作 */
  582. handleQuery() {
  583. this.queryParamsData.pageNum = 1;
  584. this.queryParamsData.pageSize = 20;
  585. this.queryParams = JSON.parse(JSON.stringify(this.queryParamsData));
  586. this.getList();
  587. },
  588. /** 重置按钮操作 */
  589. resetQuery() {
  590. this.$set(this,'queryParamsData',{});
  591. this.$set(this,'queryParams',{});
  592. this.handleQuery();
  593. },
  594. //导入页面关闭
  595. importOpenOff(){
  596. this.importOpen = false;
  597. this.getImportData.downFile = false;
  598. this.getImportData.successNum = 0;
  599. this.getImportData.failureNum = 0;
  600. this.getImportData.textName = "";
  601. },
  602. /** 导入按钮操作 */
  603. importButton(item){
  604. if(item.command == 1){
  605. // 下载模板
  606. this.download('/laboratory/hardware/importTemplate', {}, `导入模板.xlsx`)
  607. }else if(item.command == 2){
  608. // 导入数据
  609. console.log('导入数据');
  610. this.importOpen = true;
  611. }
  612. },
  613. /** 下载模板操作 */
  614. importTemplate() {
  615. this.download('/laboratory/hardware/importTemplate', {}, `导入模板.xlsx`)
  616. },
  617. /*下载失败列表*/
  618. failureExcel(){
  619. this.download('/laboratory/hardware/importErrorData', {}, `失败报表.xlsx`)
  620. },
  621. //****************************************导入功能**************************************
  622. handleAvatarSuccess(res, file) {
  623. if(res.code == 200){
  624. if(res.data.downFile){
  625. this.getImportData.downFile = res.data.downFile
  626. this.getImportData.successNum = res.data.successNum
  627. this.getImportData.failureNum = res.data.failureNum
  628. }else{
  629. this.msgSuccess(res.msg);
  630. this.importOpen = false;
  631. this.resetQuery();
  632. }
  633. // this.getImportData.downFile = res.data.downFile
  634. // this.getImportData.successNum = res.data.successNum
  635. // this.getImportData.failureNum = res.data.failureNum
  636. // this.importOpen = false;
  637. // this.getList();
  638. }else{
  639. this.msgError(res.msg);
  640. }
  641. this.loading = false;
  642. },
  643. beforeAvatarUpload(file) {
  644. let type = false;
  645. console.log('file',file);
  646. if (file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || file.type == 'application/vnd.ms-excel') {
  647. this.getImportData.textName = file.name;
  648. type = true;
  649. this.loading = true;
  650. }else{
  651. this.msgError('只能上传xls/xlsx格式文件')
  652. type = false;
  653. }
  654. return type;
  655. },
  656. //修改报警设置
  657. setUpSubmitForm(){
  658. this.$refs["setUpForm"].validate((valid) => {
  659. if (valid) {
  660. let obj = {
  661. ids:this.ids,
  662. ringTime:parseInt(this.setUpForm.ringTime),
  663. dealTime:parseInt(this.setUpForm.dealTime),
  664. }
  665. alarmSettings(obj).then(response => {
  666. if(response.code == 200){
  667. this.setUpType = false;
  668. this.msgSuccess(response.msg);
  669. this.getList();
  670. }
  671. });
  672. }
  673. })
  674. },
  675. //关闭报警设置页面
  676. setUpCancel(){
  677. this.setUpType = false;
  678. },
  679. // 多选框选中数据
  680. handleSelectionChange(selection) {
  681. this.selectedNum = selection.length;
  682. this.ids = selection.map(item => item.id);
  683. this.single = selection.length != 1;
  684. this.multiple = !selection.length;
  685. },
  686. /*===记录勾选数据===
  687. 需要再el-table 添加 :row-key="getRowKeys"
  688. 需要在selection 添加 :reserve-selection="true"
  689. */
  690. getRowKeys(row) {
  691. return row.id
  692. },
  693. },
  694. }
  695. </script>
  696. <style scoped lang="scss">
  697. .smartAlarm{
  698. flex:1;
  699. display: flex;
  700. flex-direction: column;
  701. overflow: hidden!important;
  702. padding:20px !important;
  703. p{
  704. margin:0;
  705. padding:0;
  706. }
  707. .form-box{
  708. .form-dropdown-box{
  709. display: flex;
  710. margin:0;
  711. padding:0 10px;
  712. cursor: pointer;
  713. height:40px;
  714. img:nth-child(1){
  715. width:16px;
  716. height:16px;
  717. margin-top:12px;
  718. }
  719. p{
  720. width:47px;
  721. text-align: center;
  722. font-size:14px;
  723. margin:0;
  724. line-height:40px;
  725. }
  726. img:nth-child(3){
  727. width:10px;
  728. height:6px;
  729. margin-top:17px;
  730. }
  731. }
  732. }
  733. .button-box{
  734. display: flex;
  735. }
  736. }
  737. </style>
  738. <style lang="scss">
  739. .import-dialog-box{
  740. .import-dialog-upLoad-box{
  741. .el-upload{
  742. width:450px;
  743. margin:0 55px;
  744. .el-upload-dragger{
  745. width:450px;
  746. .el-icon-upload{
  747. font-size:100px;
  748. color:#CBE6FE;
  749. }
  750. .el-upload__text{
  751. margin-top:20px;
  752. }
  753. }
  754. }
  755. .el-upload__tip{
  756. margin-left:60px;
  757. font-size:14px;
  758. margin-top:10px;
  759. }
  760. .el-upload-text-box{
  761. background: #F5F5F5;
  762. border-radius: 10px;
  763. margin:15px 30px 0;
  764. padding:0 20px 15px;
  765. overflow: hidden;
  766. *{
  767. margin:0;
  768. }
  769. .img-text-box{
  770. display: flex;
  771. margin-top:15px;
  772. img{
  773. width:16px;
  774. height:16px;
  775. margin-right:13px;
  776. }
  777. p{
  778. height:16px;
  779. line-height:16px;
  780. font-size:12px;
  781. }
  782. }
  783. .text-p{
  784. margin-top:15px;
  785. margin-left:29px;
  786. height:16px;
  787. line-height:16px;
  788. font-size:12px;
  789. }
  790. }
  791. }
  792. .teacher-import-dialog-button-box{
  793. display: flex;
  794. width:190px;
  795. margin:0 auto;
  796. p{
  797. width:70px;
  798. height:30px;
  799. line-height:30px;
  800. font-size:14px;
  801. margin:0 auto;
  802. }
  803. }
  804. .teacher-import-dialog-position-box{
  805. width:100%;
  806. height:100%;
  807. position: absolute;
  808. top:0;
  809. left:0;
  810. z-index: 999;
  811. background: rgba(255,255,255,0.4);
  812. border-radius:20px;
  813. }
  814. }
  815. </style>
  816. <style lang="scss">
  817. .smartAlarm{
  818. .switch .el-switch__label {
  819. position: absolute;
  820. display: none;
  821. color: #fff !important;
  822. }
  823. .switch .el-switch__label--right {
  824. z-index: 1;
  825. }
  826. .switch .el-switch__label--right span{
  827. margin-right:10px;
  828. }
  829. .switch .el-switch__label--left {
  830. z-index: 1;
  831. }
  832. .switch .el-switch__label--left span{
  833. margin-left: 14px;
  834. }
  835. .switch .el-switch__label.is-active {
  836. display: block;
  837. }
  838. .switch.el-switch .el-switch__core,
  839. .el-switch .el-switch__label {
  840. width: 64px !important;
  841. margin: 0;
  842. }
  843. }
  844. </style>