listPage.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. <!--关联化学品柜-->
  2. <template>
  3. <div class="listPage">
  4. <div class="title-box">
  5. <p>关联化学品柜</p>
  6. <p class="reset-button-one" @click="backPage"><i class="el-icon-arrow-left"></i>返回</p>
  7. </div>
  8. <div class="listPage-min">
  9. <el-form :model="queryParamsData" ref="queryForm" :inline="true" label-width="68px">
  10. <el-form-item label="关键字" prop="searchValue">
  11. <el-input
  12. maxlength="20"
  13. v-model="queryParamsData.searchValue"
  14. placeholder="化学品柜/编号/实验室"
  15. clearable
  16. size="small"/>
  17. </el-form-item>
  18. <el-form-item label="状态" prop="status">
  19. <el-select v-model="queryParamsData.status" clearable placeholder="请选择状态">
  20. <el-option
  21. v-for="item in optionsListTwo"
  22. :key="item.id"
  23. :label="item.name"
  24. :value="item.id">
  25. </el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item style="float: right;">
  29. <el-col :span="1.5">
  30. <p class="add-button-one-90"
  31. @click="handleAdd"
  32. >化学品存放</p>
  33. </el-col>
  34. </el-form-item>
  35. <el-form-item>
  36. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  37. <p class="reset-button-one" @click="resetQuery">重置</p>
  38. </el-form-item>
  39. </el-form>
  40. <el-table v-loading="loading" border :data="tableList">
  41. <el-table-column label="化学品编号" align="center" prop="joinNum" show-overflow-tooltip/>
  42. <el-table-column label="容量规格" align="center" prop="chemicalAmountUnit" show-overflow-tooltip/>
  43. <el-table-column label="容器规格" align="center" prop="tare" show-overflow-tooltip/>
  44. <!--<el-table-column label="过期时间" align="center" prop="expireTime" show-overflow-tooltip>-->
  45. <!--<template slot-scope="scope">{{scope.row.expireTime?scope.row.expireTime:'未设定'}}</template>-->
  46. <!--</el-table-column>-->
  47. <el-table-column label="化学品柜" align="center" prop="cabinetName" show-overflow-tooltip/>
  48. <el-table-column label="柜锁名称" align="center" prop="lockName" show-overflow-tooltip v-if="$store.state.settings.smartAlarmType == 1"/>
  49. <el-table-column label="化学品柜位置" align="center" prop="posi" show-overflow-tooltip/>
  50. <el-table-column label="化学品柜编号" align="center" prop="cabinetNum" width="160px"/>
  51. <el-table-column label="入库状态" align="center" prop="cabinetStatus" width="100px" />
  52. <el-table-column label="关联时间" align="center" prop="createTime" width="180px"/>
  53. <el-table-column label="操作人" align="center" prop="createBy" width="120px"/>
  54. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="110" v-if="tableButtonType">
  55. <template slot-scope="scope">
  56. <div class="table-button-box">
  57. <p class="table-button-null"></p>
  58. <p class="table-button-p"
  59. v-if="scope.row.status == 0"
  60. @click="delRow(scope.row)"
  61. >删除</p>
  62. <p class="table-button-null"></p>
  63. </div>
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. <pagination :page-sizes="[20, 30, 40, 50]"
  68. v-show="total>0"
  69. :total="total"
  70. :page.sync="queryParams.pageNum"
  71. :limit.sync="queryParams.pageSize"
  72. @pagination="getList"
  73. />
  74. </div>
  75. <el-dialog title="化学品存放" :visible.sync="dialogType" v-if="dialogType" width="990px" append-to-body class="ChemicalInfo-listPage-dialog" :close-on-click-modal="false">
  76. <!--<p class="dialog-title">{{dialogDeptName}}</p>-->
  77. <el-form :model="dialogData" ref="dialogForm" :inline="true" :rules="rules" label-width="70px">
  78. <el-form-item label="实验室" prop="subId">
  79. <el-select
  80. style="width:485px;"
  81. v-model="dialogData.subId"
  82. filterable
  83. remote
  84. clearable
  85. @focus="selectFocus"
  86. reserve-keyword
  87. @change="selectClick"
  88. @clear="clearClick"
  89. placeholder="搜索选择实验室"
  90. :remote-method="getSelectList"
  91. :loading="loading">
  92. <el-option
  93. v-for="item in selectList"
  94. :key="item.id"
  95. :label="item.name"
  96. :value="item.id">
  97. </el-option>
  98. </el-select>
  99. </el-form-item>
  100. <p style="margin:0 0 20px 15px;font-weight:700;font-size:14px;" v-if="dialogData.maxList[0]&&dialogData.subId">设置要存放的化学品规格和数量</p>
  101. <p style="margin:0 0 0 70px;font-weight:700;font-size:14px;color:#FF6666;" v-if="!dialogData.maxList[0]&&dialogData.subId">该实验室未配置化学品柜</p>
  102. <div class="scrollbar-box" style="width:950px;margin:0 auto;max-height:500px;overflow-y: scroll" v-if="$store.state.settings.smartAlarmType == 1">
  103. <div class="for-max-big-box" v-for="(item,index) in dialogData.maxList">
  104. <div class="for-max-title-box">
  105. <p></p>
  106. <p>{{item.name}}</p>
  107. <p>{{listPropsData.chemicalName}}可存放量:{{item.maxNum}}{{listPropsData.chemicalUnit}}</p>
  108. </div>
  109. <div class="for-big-box" v-for="(bigItem,bigIndex) in item.chemicalJoinCabinetSonList">
  110. <p class="for-big-title-p">{{bigItem.lockName}}</p>
  111. <div class="for-big-for-max-box">
  112. <div class="for-big-for-max-title-box">
  113. <p>化学品存放规格</p>
  114. <p @click="addList(index,bigIndex)">+添加</p>
  115. </div>
  116. <div class="for-min-box" v-for="(minItem,minIndex) in bigItem.list">
  117. <el-form-item class="num-input-item" label="容器容量规格" label-width="120px" :prop="'maxList.'+ index +'.chemicalJoinCabinetSonList.'+bigIndex+'.list.'+minIndex+'.chemicalAmount'" :rules="rules.chemicalAmountLock">
  118. <div class="num-input-min-box">
  119. <el-input-number
  120. style="width:110px;"
  121. :min="0"
  122. :max="5000"
  123. :precision="2"
  124. :step="0.01"
  125. v-model="minItem.chemicalAmount"
  126. placeholder="请输入">
  127. </el-input-number>
  128. <p class="num-title-span">{{listPropsData.chemicalUnit}}</p>
  129. </div>
  130. </el-form-item>
  131. <el-form-item class="num-input-item" label="容器重量规格" label-width="120px" :prop="'maxList.'+ index +'.chemicalJoinCabinetSonList.'+bigIndex+'.list.'+minIndex+'.tare'" :rules="rules.tareLock">
  132. <div class="num-input-min-box">
  133. <el-input-number
  134. style="width:110px;"
  135. :min="0"
  136. :max="5000"
  137. :precision="2"
  138. :step="0.01"
  139. v-model="minItem.tare"
  140. :disabled="listPropsData.chemicalUnit!='g'"
  141. placeholder="请输入">
  142. </el-input-number>
  143. <p class="num-title-span">g</p>
  144. </div>
  145. </el-form-item>
  146. <el-form-item label="存放数量" label-width="90px" :prop="'maxList.'+ index +'.chemicalJoinCabinetSonList.'+bigIndex+'.list.'+minIndex+'.storageNum'" :rules="rules.storageNum" class="el-form-item-button-box">
  147. <el-input-number
  148. style="width:150px;"
  149. :min="1"
  150. :max="1000"
  151. :step="1"
  152. v-model="minItem.storageNum"
  153. placeholder="请输入">
  154. </el-input-number>
  155. </el-form-item>
  156. <span class="el-icon-delete" style="margin-left:30px;color:#999;line-height:40px;font-size:24px;cursor: pointer;" @click="delList(index,bigIndex,minIndex)"></span>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. <div class="scrollbar-box" style="width:950px;margin:0 auto;max-height:500px;overflow-y: scroll" v-if="$store.state.settings.smartAlarmType == 0">
  163. <div class="for-max-big-box" v-for="(item,index) in dialogData.maxList">
  164. <div class="for-max-title-box">
  165. <p></p>
  166. <p>{{item.name}}</p>
  167. <p>{{listPropsData.chemicalName}}可存放量:{{item.maxNum}}{{listPropsData.chemicalUnit}}</p>
  168. </div>
  169. <div class="for-big-box">
  170. <div class="for-big-for-max-box">
  171. <div class="for-big-for-max-title-box">
  172. <p>化学品存放规格</p>
  173. <p @click="addList(index)">+添加</p>
  174. </div>
  175. <div class="for-min-box" v-for="(bigItem,bigIndex) in item.list">
  176. <el-form-item class="num-input-item" label="容器容量规格" label-width="120px" :prop="'maxList.'+ index +'.list.'+ bigIndex+'.chemicalAmount'" :rules="rules.chemicalAmount">
  177. <div class="num-input-min-box">
  178. <el-input-number
  179. style="width:110px;"
  180. :min="0"
  181. :max="5000"
  182. :precision="2"
  183. :step="0.01"
  184. v-model="bigItem.chemicalAmount"
  185. placeholder="请输入">
  186. </el-input-number>
  187. <p class="num-title-span">{{listPropsData.chemicalUnit}}</p>
  188. </div>
  189. </el-form-item>
  190. <el-form-item class="num-input-item" label="容器重量规格" label-width="120px" :prop="'maxList.'+ index +'.list.'+ bigIndex+'.tare'" :rules="rules.tare">
  191. <div class="num-input-min-box">
  192. <el-input-number
  193. style="width:110px;"
  194. :min="0"
  195. :max="5000"
  196. :precision="2"
  197. :step="0.01"
  198. v-model="bigItem.tare"
  199. :disabled="listPropsData.chemicalUnit!='g'"
  200. placeholder="请输入">
  201. </el-input-number>
  202. <p class="num-title-span">g</p>
  203. </div>
  204. </el-form-item>
  205. <el-form-item label="存放数量" label-width="90px" :prop="'maxList.'+ index +'.list.'+ bigIndex+'.storageNum'" :rules="rules.storageNum" class="el-form-item-button-box">
  206. <el-input-number
  207. style="width:150px;"
  208. :min="1"
  209. :max="1000"
  210. :step="1"
  211. v-model="bigItem.storageNum"
  212. placeholder="请输入">
  213. </el-input-number>
  214. </el-form-item>
  215. <span class="el-icon-delete" style="margin-left:30px;color:#999;line-height:40px;font-size:24px;cursor: pointer;" @click="delList(index,bigIndex)"></span>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. </div>
  221. </el-form>
  222. <div slot="footer" class="dialog-footer">
  223. <el-button @click="cancel">取 消</el-button>
  224. <el-button type="primary" @click="submitForm">确 定</el-button>
  225. </div>
  226. </el-dialog>
  227. </div>
  228. </template>
  229. <script>
  230. import { getHxpChemicalJoinCabinet,delHxpChemicalJoinCabinet,filterDept,getSubList,getCabinetBySubId,hxpChemicalJoinCabinet,getRestStockByManyCabinet } from "@/api/medicUniversity-3_1/index";
  231. import { getLogoInfo } from "@/api/system/publicConfig";
  232. export default {
  233. name: "listPage",
  234. props:{
  235. listPropsData:{},
  236. },
  237. data() {
  238. const computingCapacity = (rule, value, callback) => {
  239. console.log('rule',rule)
  240. const list = rule.field.split('.');
  241. let index = parseFloat(list[1]);
  242. let index2 = parseFloat(list[3]);
  243. let max = parseFloat(this.dialogData.maxList[index].maxNum);
  244. let tare = parseFloat(this.dialogData.maxList[index].list[index2].tare);
  245. if(value>max){
  246. callback(new Error("超出该机柜可存放量"));
  247. }else if(value<tare){
  248. callback(new Error("容器容量规格不能小于容器重量规格"));
  249. }else{
  250. callback();
  251. }
  252. };
  253. const computingCapacityLock = (rule, value, callback) => {
  254. console.log('rule',rule)
  255. const list = rule.field.split('.');
  256. let index = parseFloat(list[1]);
  257. let index1 = parseFloat(list[3]);
  258. let index2 = parseFloat(list[5]);
  259. let max = parseFloat(this.dialogData.maxList[index].maxNum);
  260. let tare = parseFloat(this.dialogData.maxList[index].chemicalJoinCabinetSonList[index1].list[index2].tare);
  261. if(value>max){
  262. callback(new Error("超出该机柜可存放量"));
  263. }else if(value<tare){
  264. callback(new Error("容器容量规格不能小于容器重量规格"));
  265. }else{
  266. callback();
  267. }
  268. };
  269. const computingTare = (rule, value, callback) => {
  270. console.log('rule',rule)
  271. const list = rule.field.split('.');
  272. let index = parseFloat(list[1]);
  273. let index2 = parseFloat(list[3]);
  274. let chemicalAmount = parseFloat(this.dialogData.maxList[index].list[index2].chemicalAmount);
  275. if(value>chemicalAmount){
  276. callback(new Error("容器重量规格不能大于容器容量规格"));
  277. }else{
  278. callback();
  279. }
  280. };
  281. const computingTareLock = (rule, value, callback) => {
  282. console.log('rule',rule)
  283. const list = rule.field.split('.');
  284. let index = parseFloat(list[1]);
  285. let index1 = parseFloat(list[3]);
  286. let index2 = parseFloat(list[5]);
  287. let chemicalAmount = parseFloat(this.dialogData.maxList[index].chemicalJoinCabinetSonList[index1].list[index2].chemicalAmount);
  288. if(value>chemicalAmount){
  289. callback(new Error("容器重量规格不能大于容器容量规格"));
  290. }else{
  291. callback();
  292. }
  293. };
  294. return {
  295. //限制时间范围
  296. pickerBeginOption: {
  297. disabledDate: (time) => {
  298. return time.getTime() < Date.now()-1 * 24 * 60 * 60 * 1000
  299. }
  300. },
  301. // table操作按钮校验
  302. tableButtonType:this.hasPermiDom(['system:user_student:query','system:user_student:query','system:user_student:edit','system:user_student:remove','system:user_student:resetpwd']),
  303. loading:false,
  304. //数据数量
  305. total:0,
  306. tableList:[],
  307. //实验室列表
  308. optionsListOne:[],
  309. //状态列表
  310. optionsListTwo:[{id:"0",name:"未入库"},{id:"1",name:"已入库"},{id:"2",name:"已出库"}],
  311. // 搜索数据
  312. queryParamsData:{
  313. pageNum:1,
  314. pageSize:20,
  315. },
  316. // 搜索实际发送数据
  317. queryParams:{
  318. pageNum:1,
  319. pageSize:20,
  320. },
  321. dialogType:false,
  322. dialogData:{
  323. subId:"",
  324. chemicalId:"",
  325. maxList:[],
  326. },
  327. // 查询
  328. selectList:[],
  329. //校验
  330. rules:{
  331. subId:[
  332. { required: true, message: '请搜索选择实验室', trigger: 'blur' },
  333. ],
  334. chemicalAmount:[
  335. { required: true, message: '请输入容器容量', trigger: 'blur' },
  336. { required: true, message: "请输入容器容量", validator: this.spaceJudgment, trigger: "blur" },
  337. { required: true, validator: computingCapacity, trigger: "blur" },
  338. ],
  339. chemicalAmountLock:[
  340. { required: true, message: '请输入容器容量', trigger: 'blur' },
  341. { required: true, message: "请输入容器容量", validator: this.spaceJudgment, trigger: "blur" },
  342. { required: true, validator: computingCapacityLock, trigger: "blur" },
  343. ],
  344. tare:[
  345. { required: true, message: '请输入容器自重', trigger: 'blur' },
  346. { required: true, message: "请输入容器自重", validator: this.spaceJudgment, trigger: "blur" },
  347. { required: true, validator: computingTare, trigger: "blur" },
  348. ],
  349. tareLock:[
  350. { required: true, message: '请输入容器自重', trigger: 'blur' },
  351. { required: true, message: "请输入容器自重", validator: this.spaceJudgment, trigger: "blur" },
  352. { required: true, validator: computingTareLock, trigger: "blur" },
  353. ],
  354. storageNum:[
  355. { required: true, message: '请输入存放数量', trigger: 'blur' },
  356. { required: true, message: "请输入存放数量", validator: this.spaceJudgment, trigger: "blur" }
  357. ],
  358. },
  359. //查询历史记录
  360. recordList:[],
  361. dialogDeptName:"",
  362. dialogDeptId:"",
  363. };
  364. },
  365. created() {
  366. },
  367. mounted(){
  368. this.getList();
  369. this.getRecord();
  370. },
  371. methods: {
  372. selectFocus(){
  373. if(!this.selectList[0]){
  374. this.getSubList();
  375. }
  376. },
  377. timeChange(){
  378. this.$forceUpdate();
  379. },
  380. //删除规格
  381. delList(index,bigIndex,minIndex){
  382. if(this.$store.state.settings.smartAlarmType == 1){
  383. this.dialogData.maxList[index].chemicalJoinCabinetSonList[bigIndex].list.splice(minIndex,1);
  384. }else{
  385. this.dialogData.maxList[index].list.splice(bigIndex,1);
  386. }
  387. },
  388. //新增规格
  389. addList(index,bigIndex){
  390. if(this.$store.state.settings.smartAlarmType == 1){
  391. this.dialogData.maxList[index].chemicalJoinCabinetSonList[bigIndex].list.push({chemicalAmount:"",tare:"",storageNum:1,})
  392. }else{
  393. this.dialogData.maxList[index].list.push({chemicalAmount:"",tare:"",storageNum:1,})
  394. }
  395. },
  396. // 提交
  397. submitForm(){
  398. let self = this;
  399. this.$refs["dialogForm"].validate(valid => {
  400. if (valid) {
  401. if(this.$store.state.settings.smartAlarmType == 0){
  402. for(let i=0;i<self.dialogData.maxList.length;i++){
  403. let maxNum = parseFloat(self.dialogData.maxList[i].maxNum);
  404. let num = 0;
  405. for(let o=0;o<self.dialogData.maxList[i].list.length;o++){
  406. num = num + parseFloat(self.dialogData.maxList[i].list[o].chemicalAmount)
  407. }
  408. if(num>maxNum){
  409. this.msgError(self.dialogData.maxList[i].name+' 总容器容量大于可存放量');
  410. return
  411. }
  412. }
  413. }else if(this.$store.state.settings.smartAlarmType == 1){
  414. for(let i=0;i<self.dialogData.maxList.length;i++){
  415. let maxNum = parseFloat(self.dialogData.maxList[i].maxNum);
  416. let num = 0;
  417. for(let o=0;o<self.dialogData.maxList[i].chemicalJoinCabinetSonList.length;o++){
  418. for(let x=0;x<self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list.length;x++){
  419. num = num + parseFloat(self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list[x].chemicalAmount)
  420. }
  421. }
  422. if(num>maxNum){
  423. this.msgError(self.dialogData.maxList[i].name+' 总容器容量大于可存放量');
  424. return
  425. }
  426. }
  427. }
  428. let obj = {
  429. subId:this.dialogData.subId,
  430. chemicalId:this.listPropsData.id,
  431. chemicalJoinCabinetSonList:[],
  432. }
  433. if(this.$store.state.settings.smartAlarmType == 1){
  434. for(let i=0;i<self.dialogData.maxList.length;i++){
  435. for(let o=0;o<self.dialogData.maxList[i].chemicalJoinCabinetSonList.length;o++){
  436. for(let x=0;x<self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list.length;x++){
  437. let newObj = {
  438. cabinetId:self.dialogData.maxList[i].cabinetId,
  439. cabinetlockId:self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].id,
  440. chemicalAmount:self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list[x].chemicalAmount,
  441. chemicalAmountUnit:self.listPropsData.chemicalUnit,
  442. storageNum:self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list[x].storageNum,
  443. tare:self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list[x].tare,
  444. }
  445. obj.chemicalJoinCabinetSonList.push(newObj);
  446. }
  447. }
  448. }
  449. }else{
  450. for(let i=0;i<self.dialogData.maxList.length;i++){
  451. for(let o=0;o<self.dialogData.maxList[i].list.length;o++){
  452. console.log(self.dialogData.maxList[i].list[o]);
  453. let newObj = {
  454. cabinetId:self.dialogData.maxList[i].cabinetId,
  455. chemicalAmount:self.dialogData.maxList[i].list[o].chemicalAmount,
  456. chemicalAmountUnit:self.listPropsData.chemicalUnit,
  457. storageNum:self.dialogData.maxList[i].list[o].storageNum,
  458. tare:self.dialogData.maxList[i].list[o].tare,
  459. }
  460. obj.chemicalJoinCabinetSonList.push(newObj);
  461. }
  462. }
  463. }
  464. if(obj.chemicalJoinCabinetSonList[0]){
  465. hxpChemicalJoinCabinet(obj).then(response => {
  466. self.dialogType = false;
  467. self.msgSuccess(response.msg)
  468. self.resetQuery();
  469. });
  470. }else{
  471. self.msgError('请添加规格')
  472. }
  473. }
  474. })
  475. },
  476. //取消
  477. cancel(){
  478. this.dialogType = false;
  479. },
  480. //选中触发
  481. selectClick(data){
  482. let self = this;
  483. if(data){
  484. for(let i=0;i<self.selectList.length;i++){
  485. if(data == self.selectList[i].id){
  486. let num = 0;
  487. for(let o=0;o<self.recordList.length;o++){
  488. if(data == self.recordList[o].id){
  489. num ++
  490. }
  491. }
  492. if(num == 0){
  493. if(self.recordList.length>9){
  494. self.recordList.splice(0,1)
  495. }
  496. self.recordList.push(self.selectList[i])
  497. this.$forceUpdate();
  498. localStorage.setItem('subRecord',JSON.stringify(self.recordList))
  499. break
  500. }
  501. }
  502. }
  503. let obj ={
  504. subId:data,
  505. cabinetStatus:1
  506. }
  507. getCabinetBySubId(obj).then(response => {
  508. let list = [];
  509. for(let i=0;i<response.data.length;i++){
  510. if(self.$store.state.settings.smartAlarmType == 1){
  511. if(response.data[i].cabinetLockList[0]){
  512. let obj ={
  513. name:response.data[i].cabinetName,
  514. cabinetId:response.data[i].id,
  515. chemicalJoinCabinetSonList:response.data[i].cabinetLockList
  516. };
  517. for(let o=0;o<obj.chemicalJoinCabinetSonList.length;o++){
  518. obj.chemicalJoinCabinetSonList[o].list = [];
  519. }
  520. list.push(obj);
  521. }
  522. }else{
  523. let obj ={
  524. name:response.data[i].cabinetName,
  525. cabinetId:response.data[i].id,
  526. list:[]
  527. };
  528. list.push(obj);
  529. }
  530. }
  531. let newObj = {
  532. chemicalId:self.listPropsData.id,
  533. cabinetIds:"",
  534. }
  535. for(let i=0;i<list.length;i++){
  536. if(i==0){
  537. newObj.cabinetIds = list[i].cabinetId;
  538. }else{
  539. newObj.cabinetIds = newObj.cabinetIds +','+ list[i].cabinetId;
  540. }
  541. }
  542. if(list[0]){
  543. getRestStockByManyCabinet(newObj).then(response => {
  544. for(let i=0;i<response.data.length;i++){
  545. for(let o=0;o<list.length;o++){
  546. if(response.data[i].cabinetId == list[o].cabinetId){
  547. list[o].maxNum = response.data[i].restStock;
  548. }
  549. }
  550. }
  551. this.$set(this.dialogData,"maxList",list);
  552. })
  553. }else{
  554. this.$set(this.dialogData,"maxList",list);
  555. }
  556. });
  557. }
  558. },
  559. //清空触发
  560. clearClick(){
  561. // this.optionsUser = [];
  562. // this.getList();
  563. this.getRecord();
  564. this.dialogData.maxList = [];
  565. },
  566. //查询
  567. getSelectList(val){
  568. let self = this;
  569. let list = [];
  570. for(let i=0;i<self.selectListData.length;i++){
  571. if(self.selectListData[i].name.indexOf(val) != -1){
  572. list.push(self.selectListData[i]);
  573. }
  574. }
  575. this.selectList = JSON.parse(JSON.stringify(list))
  576. },
  577. //化学品存放
  578. handleAdd(){
  579. //查询当前院系
  580. filterDept().then(response => {
  581. let text = "";
  582. let idText = "";
  583. for(let i=0;i<response.data.length;i++){
  584. if(i==0){
  585. text = text + response.data[i].deptName;
  586. idText = idText + response.data[i].deptId;
  587. }else{
  588. text = text +'-'+ response.data[i].deptName;
  589. idText = idText +','+ response.data[i].deptId;
  590. }
  591. }
  592. this.$set(this,'dialogDeptName',text);
  593. this.$set(this,'dialogDeptId',idText);
  594. this.getSubList();
  595. });
  596. },
  597. backPage(){
  598. this.$parent.pageToggle(1);
  599. },
  600. //获取数据列表
  601. getList(){
  602. this.queryParamsData = JSON.parse(JSON.stringify(this.queryParams));
  603. this.queryParamsData.chemicalId = this.listPropsData.id;
  604. getHxpChemicalJoinCabinet(this.queryParamsData).then(response => {
  605. this.tableList = response.rows;
  606. this.total = response.total
  607. });
  608. },
  609. //删除
  610. delRow(row){
  611. let self = this;
  612. this.$confirm('确认要删除吗?', "警告", {
  613. confirmButtonText: "确定",
  614. cancelButtonText: "取消",
  615. type: "warning"
  616. }).then(function() {
  617. delHxpChemicalJoinCabinet(row.id).then(response => {
  618. if(response.code == 200){
  619. self.msgSuccess(response.msg)
  620. self.getList();
  621. }
  622. });
  623. }).then(() => {
  624. }).catch(() => {});
  625. },
  626. /** 搜索按钮操作 */
  627. handleQuery() {
  628. this.queryParamsData.pageNum = 1;
  629. this.queryParamsData.pageSize = 20;
  630. this.queryParams = JSON.parse(JSON.stringify(this.queryParamsData));
  631. this.getList();
  632. },
  633. /** 重置按钮操作 */
  634. resetQuery() {
  635. this.$set(this,'queryParamsData',{});
  636. this.$set(this,'queryParams',{});
  637. this.handleQuery();
  638. },
  639. //获取选择记录
  640. getRecord(){
  641. if(localStorage.getItem('subRecord')){
  642. //历史记录
  643. this.recordList = JSON.parse(localStorage.getItem('subRecord'));
  644. //当前列表
  645. this.selectList = JSON.parse(localStorage.getItem('subRecord'));
  646. }else{
  647. this.recordList = [];
  648. this.selectList = [];
  649. }
  650. },
  651. //根据所属院系或多个院系获取实验室列表
  652. getSubList(){
  653. let ids = this.dialogDeptId+'';
  654. getSubList(ids).then(response => {
  655. this.$set(this,'dialogData',{
  656. subId:"",
  657. chemicalId:"",
  658. maxList:[],
  659. });
  660. //当前列表
  661. this.selectList = JSON.parse(JSON.stringify(response.data));
  662. //原始列表数据
  663. this.selectListData = JSON.parse(JSON.stringify(response.data));
  664. this.dialogType = true;
  665. });
  666. },
  667. }
  668. }
  669. </script>
  670. <style scoped lang="scss">
  671. .listPage{
  672. flex:1;
  673. display: flex;
  674. flex-direction: column;
  675. overflow: hidden;
  676. font-weight:500;
  677. p{
  678. margin:0;
  679. padding:0;
  680. }
  681. .title-box{
  682. display: flex;
  683. height:90px;
  684. border-bottom: 1px solid #D8D8D8;
  685. p:nth-child(1){
  686. flex:1;
  687. font-size:16px;
  688. line-height:90px;
  689. margin-left:18px;
  690. color:#0045AF;
  691. }
  692. p:nth-child(2){
  693. margin:25px 25px 0 0;
  694. }
  695. }
  696. .listPage-min{
  697. flex:1;
  698. display: flex;
  699. flex-direction: column;
  700. overflow: hidden;
  701. padding:20px;
  702. }
  703. }
  704. </style>
  705. <style lang="scss">
  706. .ChemicalInfo-listPage-dialog{
  707. p{
  708. margin:0;
  709. }
  710. .dialog-title{
  711. margin-left:10px;
  712. margin-bottom:20px;
  713. font-weight:700;
  714. }
  715. .for-max-big-box{
  716. padding:20px;
  717. background: #f5f5f5;
  718. margin-bottom:12px;
  719. .for-max-title-box{
  720. display: flex;
  721. p:nth-child(1){
  722. background: #0045AF;
  723. width: 3px;
  724. height: 16px;
  725. }
  726. p:nth-child(2){
  727. flex:1;
  728. height: 16px;
  729. font-size: 16px;
  730. color: #333333;
  731. line-height: 16px;
  732. margin-left:12px;
  733. }
  734. p:nth-child(3){
  735. font-size:16px;
  736. line-height: 16px;
  737. color:#0183FA;
  738. }
  739. }
  740. .for-big-box{
  741. margin-top:20px;
  742. .for-big-title-p{
  743. height:50px;
  744. line-height:50px;
  745. padding:0 22px;
  746. font-size: 16px;
  747. color:#333333;
  748. background: #CCE6FE;
  749. }
  750. .for-big-for-max-box{
  751. border:1px solid #E0E0E0;
  752. .for-big-for-max-title-box{
  753. height:60px;
  754. display: flex;
  755. p:nth-child(1){
  756. flex:1;
  757. font-size:14px;
  758. line-height:60px;
  759. margin-left:22px;
  760. }
  761. p:nth-child(2){
  762. width:80px;
  763. height: 30px;
  764. line-height:30px;
  765. border-radius: 6px;
  766. border: 1px solid #0045AF;
  767. text-align: center;
  768. margin:16px 14px;
  769. color:#0045AF;
  770. font-size:12px;
  771. cursor: pointer;
  772. }
  773. }
  774. .for-min-box{
  775. margin-bottom:10px;
  776. }
  777. }
  778. }
  779. input::-webkit-outer-spin-button,
  780. input::-webkit-inner-spin-button {
  781. -webkit-appearance: none!important;
  782. }
  783. /* 在Firefox浏览器下 */
  784. input[type="number"]{
  785. -moz-appearance: textfield!important;
  786. }
  787. .el-form-item__label{
  788. font-weight:400;
  789. }
  790. .el-form-item-button-box{
  791. .el-input-number__decrease{
  792. height:38px;
  793. width:38px;
  794. line-height:38px;
  795. }
  796. .el-input-number__increase{
  797. height:38px;
  798. width:38px;
  799. line-height:38px;
  800. }
  801. }
  802. }
  803. }
  804. </style>