addPage.vue 30 KB

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