index.vue 29 KB

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