addPage.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  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. <<<<<<< HEAD
  246. }else{
  247. callback();
  248. }
  249. };
  250. const computingTare = (rule, value, callback) => {
  251. console.log('rule',rule)
  252. const list = rule.field.split('.');
  253. let index = parseFloat(list[1]);
  254. let index2 = parseFloat(list[3]);
  255. let chemicalAmount = parseFloat(this.dialogData.maxList[index].list[index2].chemicalAmount);
  256. if(value>chemicalAmount){
  257. callback(new Error("容器重量规格不能大于容器容量规格"));
  258. =======
  259. >>>>>>> 3.3.3-AnQuanJianCha
  260. }else{
  261. callback();
  262. }
  263. };
  264. const computingTare = (rule, value, callback) => {
  265. console.log('rule',rule)
  266. const list = rule.field.split('.');
  267. let index = parseFloat(list[1]);
  268. let index2 = parseFloat(list[3]);
  269. let chemicalAmount = parseFloat(this.dialogData.maxList[index].list[index2].chemicalAmount);
  270. if(value>chemicalAmount){
  271. callback(new Error("容器重量规格不能大于容器容量规格"));
  272. }else{
  273. callback();
  274. }
  275. };
  276. return {
  277. //限制时间范围
  278. pickerBeginOption: {
  279. disabledDate: (time) => {
  280. return time.getTime() < Date.now()-1 * 24 * 60 * 60 * 1000
  281. }
  282. },
  283. loading:false,
  284. //数据数量
  285. total:0,
  286. tableList:[],
  287. //实验室列表
  288. optionsListOne:[],
  289. //状态列表
  290. optionsListTwo:[],
  291. // 搜索数据
  292. queryParamsData:{
  293. pageNum:1,
  294. pageSize:20,
  295. },
  296. // 搜索实际发送数据
  297. queryParams:{
  298. pageNum:1,
  299. pageSize:20,
  300. },
  301. dialogType:false,
  302. dialogData:{
  303. subId:"",
  304. chemicalId:"",
  305. maxList:[],
  306. },
  307. // 查询
  308. selectList:[],
  309. //校验
  310. rules:{
  311. subId:[
  312. { required: true, message: '请搜索选择实验室', trigger: 'blur' },
  313. ],
  314. chemicalAmount:[
  315. { required: true, message: '请输入容器容量', trigger: 'blur' },
  316. { required: true, message: "请输入容器容量", validator: this.spaceJudgment, trigger: "blur" },
  317. { required: true, validator: computingCapacity, trigger: "blur" },
  318. ],
  319. tare:[
  320. { required: true, message: '请输入容器自重', trigger: 'blur' },
  321. { required: true, message: "请输入容器自重", validator: this.spaceJudgment, trigger: "blur" },
  322. { required: true, validator: computingTare, trigger: "blur" },
  323. ],
  324. storageNum:[
  325. { required: true, message: '请输入存放数量', trigger: 'blur' },
  326. { required: true, message: "请输入存放数量", validator: this.spaceJudgment, trigger: "blur" }
  327. ],
  328. },
  329. //查询历史记录
  330. recordList:[],
  331. dialogDeptName:"",
  332. dialogDeptId:"",
  333. //选中
  334. selectioned:{},
  335. };
  336. },
  337. created() {
  338. },
  339. mounted(){
  340. this.getList();
  341. this.getRecord();
  342. this.getDicts("hxp_classifyattribute").then(response => {
  343. this.optionsListTwo = response.data;
  344. })
  345. this.classifyList();
  346. },
  347. methods: {
  348. //获取化学品分类列表
  349. classifyList(){
  350. classifyList().then(response => {
  351. this.optionsListOne = response.rows;
  352. });
  353. },
  354. selectFocus(){
  355. if(!this.selectList[0]){
  356. this.getSubList();
  357. }
  358. },
  359. timeChange(){
  360. this.$forceUpdate();
  361. },
  362. //删除规格
  363. delList(index,bigIndex,minIndex){
  364. if(this.$store.state.settings.smartAlarmType == 1){
  365. this.dialogData.maxList[index].chemicalJoinCabinetSonList[bigIndex].list.splice(minIndex,1);
  366. }else{
  367. this.dialogData.maxList[index].list.splice(bigIndex,1);
  368. }
  369. },
  370. //新增规格
  371. addList(index,bigIndex){
  372. if(this.$store.state.settings.smartAlarmType == 1){
  373. this.dialogData.maxList[index].chemicalJoinCabinetSonList[bigIndex].list.push({chemicalAmount:"",tare:"",storageNum:1,})
  374. }else{
  375. this.dialogData.maxList[index].list.push({chemicalAmount:"",tare:"",storageNum:1,})
  376. }
  377. },
  378. // 提交
  379. submitForm(){
  380. let self = this;
  381. this.$refs["dialogForm"].validate(valid => {
  382. if (valid) {
  383. if(this.$store.state.settings.smartAlarmType == 0){
  384. for(let i=0;i<self.dialogData.maxList.length;i++){
  385. let maxNum = parseFloat(self.dialogData.maxList[i].maxNum);
  386. let num = 0;
  387. for(let o=0;o<self.dialogData.maxList[i].list.length;o++){
  388. num = num + parseFloat(self.dialogData.maxList[i].list[o].chemicalAmount)
  389. }
  390. if(num>maxNum){
  391. this.msgError(self.dialogData.maxList[i].name+' 总容器容量大于可存放量');
  392. return
  393. }
  394. }
  395. }else if(this.$store.state.settings.smartAlarmType == 1){
  396. for(let i=0;i<self.dialogData.maxList.length;i++){
  397. let maxNum = parseFloat(self.dialogData.maxList[i].maxNum);
  398. let num = 0;
  399. for(let o=0;o<self.dialogData.maxList[i].chemicalJoinCabinetSonList.length;o++){
  400. for(let x=0;x<self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list.length;x++){
  401. num = num + parseFloat(self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list[x].chemicalAmount)
  402. }
  403. }
  404. if(num>maxNum){
  405. this.msgError(self.dialogData.maxList[i].name+' 总容器容量大于可存放量');
  406. return
  407. }
  408. }
  409. }
  410. let obj = {
  411. subId:this.dialogData.subId,
  412. chemicalId:this.selectioned.id,
  413. chemicalJoinCabinetSonList:[],
  414. }
  415. if(this.$store.state.settings.smartAlarmType == 1){
  416. for(let i=0;i<self.dialogData.maxList.length;i++){
  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. let newObj = {
  420. cabinetId:self.dialogData.maxList[i].cabinetId,
  421. cabinetlockId:self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].id,
  422. chemicalAmount:self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list[x].chemicalAmount,
  423. chemicalAmountUnit:self.selectioned.chemicalUnit,
  424. storageNum:self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list[x].storageNum,
  425. tare:self.dialogData.maxList[i].chemicalJoinCabinetSonList[o].list[x].tare,
  426. }
  427. obj.chemicalJoinCabinetSonList.push(newObj);
  428. }
  429. }
  430. }
  431. }else{
  432. for(let i=0;i<self.dialogData.maxList.length;i++){
  433. for(let o=0;o<self.dialogData.maxList[i].list.length;o++){
  434. console.log(self.dialogData.maxList[i].list[o]);
  435. let newObj = {
  436. cabinetId:self.dialogData.maxList[i].cabinetId,
  437. chemicalAmount:self.dialogData.maxList[i].list[o].chemicalAmount,
  438. chemicalAmountUnit:self.selectioned.chemicalUnit,
  439. storageNum:self.dialogData.maxList[i].list[o].storageNum,
  440. tare:self.dialogData.maxList[i].list[o].tare,
  441. }
  442. obj.chemicalJoinCabinetSonList.push(newObj);
  443. }
  444. }
  445. }
  446. if(obj.chemicalJoinCabinetSonList[0]){
  447. hxpChemicalJoinCabinet(obj).then(response => {
  448. self.dialogType = false;
  449. self.msgSuccess(response.msg)
  450. self.$parent.pageToggle(1);
  451. });
  452. }else{
  453. self.msgError('请添加规格')
  454. }
  455. }
  456. })
  457. },
  458. //取消
  459. cancel(){
  460. this.dialogType = false;
  461. },
  462. //选中触发
  463. selectClick(data){
  464. let self = this;
  465. if(data){
  466. for(let i=0;i<self.selectList.length;i++){
  467. if(data == self.selectList[i].id){
  468. let num = 0;
  469. for(let o=0;o<self.recordList.length;o++){
  470. if(data == self.recordList[o].id){
  471. num ++
  472. }
  473. }
  474. if(num == 0){
  475. if(self.recordList.length>9){
  476. self.recordList.splice(0,1)
  477. }
  478. self.recordList.push(self.selectList[i])
  479. this.$forceUpdate();
  480. localStorage.setItem('subRecord',JSON.stringify(self.recordList))
  481. break
  482. }
  483. }
  484. }
  485. let obj ={
  486. subId:data,
  487. cabinetStatus:1
  488. }
  489. getCabinetBySubId(obj).then(response => {
  490. let list = [];
  491. for(let i=0;i<response.data.length;i++){
  492. if(self.$store.state.settings.smartAlarmType == 1){
  493. if(response.data[i].cabinetLockList[0]){
  494. let obj ={
  495. name:response.data[i].cabinetName,
  496. cabinetId:response.data[i].id,
  497. chemicalJoinCabinetSonList:response.data[i].cabinetLockList
  498. };
  499. for(let o=0;o<obj.chemicalJoinCabinetSonList.length;o++){
  500. obj.chemicalJoinCabinetSonList[o].list = [];
  501. }
  502. list.push(obj);
  503. }
  504. }else{
  505. let obj ={
  506. name:response.data[i].cabinetName,
  507. cabinetId:response.data[i].id,
  508. list:[]
  509. };
  510. list.push(obj);
  511. }
  512. }
  513. let newObj = {
  514. chemicalId:self.selectioned.id,
  515. cabinetIds:"",
  516. }
  517. for(let i=0;i<list.length;i++){
  518. if(i==0){
  519. newObj.cabinetIds = list[i].cabinetId;
  520. }else{
  521. newObj.cabinetIds = newObj.cabinetIds +','+ list[i].cabinetId;
  522. }
  523. }
  524. if(list[0]){
  525. getRestStockByManyCabinet(newObj).then(response => {
  526. for(let i=0;i<response.data.length;i++){
  527. for(let o=0;o<list.length;o++){
  528. if(response.data[i].cabinetId == list[o].cabinetId){
  529. list[o].maxNum = response.data[i].restStock;
  530. }
  531. }
  532. }
  533. this.$set(this.dialogData,"maxList",list);
  534. })
  535. }else{
  536. this.$set(this.dialogData,"maxList",list);
  537. }
  538. });
  539. }
  540. },
  541. //清空触发
  542. clearClick(){
  543. // this.optionsUser = [];
  544. // this.getList();
  545. this.getRecord();
  546. this.dialogData.maxList = [];
  547. },
  548. //查询
  549. getSelectList(val){
  550. let self = this;
  551. let list = [];
  552. for(let i=0;i<self.selectListData.length;i++){
  553. if(self.selectListData[i].name.indexOf(val) != -1){
  554. list.push(self.selectListData[i]);
  555. }
  556. }
  557. this.selectList = JSON.parse(JSON.stringify(list))
  558. },
  559. //化学品存放
  560. handleAdd(){
  561. //查询当前院系
  562. // filterDept().then(response => {
  563. // if(!this.selectioned.id){
  564. // this.msgError('请勾选化学品')
  565. // return
  566. // }
  567. // let text = "";
  568. // let idText = "";
  569. // for(let i=0;i<response.data.length;i++){
  570. // if(i==0){
  571. // text = text + response.data[i].deptName;
  572. // idText = idText + response.data[i].deptId;
  573. // }else{
  574. // text = text +'-'+ response.data[i].deptName;
  575. // idText = idText +','+ response.data[i].deptId;
  576. // }
  577. // }
  578. // this.$set(this,'dialogDeptName',text);
  579. // this.$set(this,'dialogDeptId',idText);
  580. // this.getSubList();
  581. // });
  582. this.getSubList();
  583. },
  584. backPage(){
  585. this.$parent.pageToggle(0);
  586. },
  587. //获取数据列表
  588. getList(){
  589. this.queryParamsData = JSON.parse(JSON.stringify(this.queryParams));
  590. // this.queryParamsData.chemicalId = this.listPropsData.id;
  591. getHxpQueryByUser(this.queryParamsData).then(response => {
  592. this.tableList = response.rows;
  593. this.total = response.total
  594. });
  595. },
  596. /** 搜索按钮操作 */
  597. handleQuery() {
  598. this.queryParamsData.pageNum = 1;
  599. this.queryParamsData.pageSize = 20;
  600. this.queryParams = JSON.parse(JSON.stringify(this.queryParamsData));
  601. this.getList();
  602. },
  603. /** 重置按钮操作 */
  604. resetQuery() {
  605. this.$set(this,'queryParamsData',{});
  606. this.$set(this,'queryParams',{});
  607. this.handleQuery();
  608. },
  609. //获取选择记录
  610. getRecord(){
  611. if(localStorage.getItem('subRecord')){
  612. //历史记录
  613. this.recordList = JSON.parse(localStorage.getItem('subRecord'));
  614. //当前列表
  615. this.selectList = JSON.parse(localStorage.getItem('subRecord'));
  616. }else{
  617. this.recordList = [];
  618. this.selectList = [];
  619. }
  620. },
  621. //根据所属院系或多个院系获取实验室列表
  622. getSubList(){
  623. getNoAdminSubjectListNopage().then(response => {
  624. this.$set(this,'dialogData',{
  625. subId:"",
  626. chemicalId:"",
  627. maxList:[],
  628. });
  629. //当前列表
  630. this.selectList = JSON.parse(JSON.stringify(response.data));
  631. //原始列表数据
  632. this.selectListData = JSON.parse(JSON.stringify(response.data));
  633. this.dialogType = true;
  634. });
  635. },
  636. dialogCheck (selection, row) {
  637. console.log("selection",selection)
  638. console.log("row",row)
  639. this.$refs.multipleTable.clearSelection()
  640. if (selection.length === 0) {
  641. // 判断selection是否有值存在
  642. this.selectioned = {};
  643. }else{
  644. this.selectioned = row
  645. this.$refs.multipleTable.toggleRowSelection(row, true)
  646. }
  647. },
  648. /*===记录勾选数据===
  649. 需要再el-table 添加 :row-key="getRowKeys"
  650. 需要在selection 添加 :reserve-selection="true"
  651. */
  652. getRowKeys(row) {
  653. return row.id
  654. },
  655. }
  656. }
  657. </script>
  658. <style scoped lang="scss">
  659. .addPage{
  660. flex:1;
  661. display: flex;
  662. flex-direction: column;
  663. overflow: hidden;
  664. font-weight:500;
  665. p{
  666. margin:0;
  667. padding:0;
  668. }
  669. .addPage-min{
  670. flex:1;
  671. display: flex;
  672. flex-direction: column;
  673. overflow: hidden;
  674. padding:20px;
  675. }
  676. }
  677. </style>
  678. <style lang="scss">
  679. .ChemicalInfo-addPage-dialog{
  680. p{
  681. margin:0;
  682. }
  683. .dialog-title{
  684. margin-left:10px;
  685. margin-bottom:20px;
  686. font-weight:700;
  687. }
  688. .for-max-big-box{
  689. padding:20px;
  690. background: #f5f5f5;
  691. margin-bottom:12px;
  692. .for-max-title-box{
  693. display: flex;
  694. p:nth-child(1){
  695. background: #0045AF;
  696. width: 3px;
  697. height: 16px;
  698. }
  699. p:nth-child(2){
  700. flex:1;
  701. height: 16px;
  702. font-size: 16px;
  703. color: #333333;
  704. line-height: 16px;
  705. margin-left:12px;
  706. }
  707. p:nth-child(3){
  708. font-size:16px;
  709. line-height: 16px;
  710. color:#0183FA;
  711. }
  712. }
  713. .for-big-box{
  714. margin-top:20px;
  715. .for-big-title-p{
  716. height:50px;
  717. line-height:50px;
  718. padding:0 22px;
  719. font-size: 16px;
  720. color:#333333;
  721. background: #CCE6FE;
  722. }
  723. .for-big-for-max-box{
  724. border:1px solid #E0E0E0;
  725. .for-big-for-max-title-box{
  726. height:60px;
  727. display: flex;
  728. p:nth-child(1){
  729. flex:1;
  730. font-size:14px;
  731. line-height:60px;
  732. margin-left:22px;
  733. }
  734. p:nth-child(2){
  735. width:80px;
  736. height: 30px;
  737. line-height:30px;
  738. border-radius: 6px;
  739. border: 1px solid #0045AF;
  740. text-align: center;
  741. margin:16px 14px;
  742. color:#0045AF;
  743. font-size:12px;
  744. cursor: pointer;
  745. }
  746. }
  747. .for-min-box{
  748. margin-bottom:10px;
  749. }
  750. }
  751. }
  752. input::-webkit-outer-spin-button,
  753. input::-webkit-inner-spin-button {
  754. -webkit-appearance: none!important;
  755. }
  756. /* 在Firefox浏览器下 */
  757. input[type="number"]{
  758. -moz-appearance: textfield!important;
  759. }
  760. .el-form-item__label{
  761. font-weight:400;
  762. }
  763. .el-form-item-button-box{
  764. .el-input-number__decrease{
  765. height:38px;
  766. width:38px;
  767. line-height:38px;
  768. }
  769. .el-input-number__increase{
  770. height:38px;
  771. width:38px;
  772. line-height:38px;
  773. }
  774. }
  775. }
  776. }
  777. .studentChemicalInfo-add-page{
  778. .el-table__header-wrapper{
  779. .el-checkbox{
  780. display: none;
  781. }
  782. }
  783. }
  784. .num-input-item{
  785. .num-input-min-box{
  786. display: flex;
  787. .el-input-number__increase{
  788. display: none;
  789. }
  790. .el-input-number__decrease{
  791. display: none;
  792. }
  793. input{
  794. padding:0 20px!important;
  795. border-top-right-radius: 0;
  796. border-bottom-right-radius: 0;
  797. }
  798. .num-title-span{
  799. display: inline-block;
  800. width:40px;
  801. height:40px;
  802. text-align: center;
  803. border: 1px solid #DCDFE6;
  804. border-left:none;
  805. border-top-right-radius: 4px;
  806. border-bottom-right-radius: 4px;
  807. }
  808. }
  809. }
  810. </style>