sourceOfDangerForewarning.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <!--危险源预警-->
  2. <template>
  3. <div class="sourceOfDangerForewarning">
  4. <div class="title-box">
  5. <p>危险源预警配置</p>
  6. <p></p>
  7. </div>
  8. <div class="content-box scrollbar-box">
  9. <el-form class="form-max-box" ref="addForm" :model="addForm" :rules="rules" label-width="170px">
  10. <p class="form-title-p">化学品预警规则</p>
  11. <div class="form-top-box">
  12. <el-form-item class="form-item-box" label="即将过期提醒" prop="unexpiredWarnDays">
  13. <el-input-number style="width:320px" v-model="addForm.unexpiredWarnDays" placeholder="请输入即将过期提醒天数(天)" :min="5" :max="60" label=""></el-input-number>
  14. </el-form-item>
  15. <el-form-item class="form-item-box" label="过期提醒数" prop="expiredWarnCount">
  16. <el-input-number style="width:320px" v-model="addForm.expiredWarnCount" placeholder="请输入化学品过期后提醒次数" :min="1" :max="5" label=""></el-input-number>
  17. </el-form-item>
  18. </div>
  19. <el-form-item class="form-item-check-box" label="违规带离">
  20. <el-checkbox-group v-model="addForm.illegalRemoval">
  21. <el-checkbox style="width:100px;margin-top:2px;"
  22. v-for="item in checkListA" :value="item.key" :label="item.key" :key="item.key">{{item.value}}</el-checkbox>
  23. </el-checkbox-group>
  24. </el-form-item>
  25. <el-form-item class="form-item-check-box" label="超时未归还">
  26. <el-checkbox-group v-model="addForm.timeout">
  27. <el-checkbox style="width:100px;margin-top:2px;"
  28. v-for="item in checkListA" :value="item.key" :label="item.key" :key="item.key">{{item.value}}</el-checkbox>
  29. </el-checkbox-group>
  30. </el-form-item>
  31. <el-form-item class="form-item-check-box" label="化学品已过期">
  32. <el-checkbox-group v-model="addForm.expired">
  33. <el-checkbox style="width:100px;margin-top:2px;"
  34. v-for="item in checkListC" :value="item.key" :label="item.key" :key="item.key">{{item.value}}</el-checkbox>
  35. </el-checkbox-group>
  36. </el-form-item>
  37. <el-form-item class="form-item-check-box" label="化学品即将过期">
  38. <el-checkbox-group v-model="addForm.unexpired">
  39. <el-checkbox style="width:100px;margin-top:2px;"
  40. v-for="item in checkListC" :value="item.key" :label="item.key" :key="item.key">{{item.value}}</el-checkbox>
  41. </el-checkbox-group>
  42. </el-form-item>
  43. <p class="form-title-p" style="margin-top:20px;margin-bottom:10px;">气瓶预警规则</p>
  44. <el-form-item class="form-item-check-box" label="违规带离">
  45. <el-checkbox-group v-model="addForm2.illegalRemoval">
  46. <el-checkbox style="width:100px;margin-top:2px;"
  47. v-for="item in checkListB" :value="item.key" :label="item.key" :key="item.key">{{item.value}}</el-checkbox>
  48. </el-checkbox-group>
  49. </el-form-item>
  50. <el-form-item class="form-item-check-box" label="超时未归还">
  51. <el-checkbox-group v-model="addForm2.timeout">
  52. <el-checkbox style="width:100px;margin-top:2px;"
  53. v-for="item in checkListB" :value="item.key" :label="item.key" :key="item.key">{{item.value}}</el-checkbox>
  54. </el-checkbox-group>
  55. </el-form-item>
  56. </el-form>
  57. </div>
  58. <div class="bottom-button-max-box">
  59. <p></p>
  60. <p class="reset-button-one" @click="outButton">取消</p>
  61. <p class="inquire-button-one" @click="upDataButton">提交</p>
  62. <p></p>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import { warningConfigAdd, warningConfigList } from '@/api/laboratory/warningNotice'
  68. export default {
  69. name: 'sourceOfDangerForewarning',
  70. data(){
  71. return{
  72. checkListA:[{key:"1",value:"系统通知"},{key:"2",value:"短信通知"},{key:"3",value:"声光报警"},{key:"5",value:"电话通知"},],
  73. checkListB:[{key:"1",value:"系统通知"},{key:"2",value:"短信通知"},{key:"3",value:"声光报警"},],
  74. checkListC:[{key:"1",value:"系统通知"},{key:"2",value:"短信通知"}],
  75. addForm:{//化学品
  76. id:'',
  77. unexpiredWarnDays:7,
  78. expiredWarnCount:2,
  79. illegalRemoval:[],
  80. timeout:[],
  81. expired:[],
  82. unexpired:[],
  83. warningType:2,
  84. },
  85. addForm2:{//气瓶
  86. id:'',
  87. illegalRemoval:[],
  88. timeout:[],
  89. expired:[],
  90. unexpired:[],
  91. warningType:3,
  92. },
  93. rules:{
  94. unexpiredWarnDays: [
  95. { required: true, message: "请输入即将过期提醒天数(天)", trigger: "blur" },
  96. ],
  97. expiredWarnCount: [
  98. { required: true, message: "请输入化学品过期后提醒次数", trigger: "blur" },
  99. ],
  100. },
  101. }
  102. },
  103. created(){
  104. },
  105. mounted(){
  106. this.getInfo();
  107. },
  108. methods:{
  109. /* 详情 */
  110. getInfo(){
  111. warningConfigList({warningType:'2'}).then( response => {
  112. let res=response.data[0];
  113. if(response.code==200 && res){
  114. this.addForm.id=res.id
  115. this.addForm.unexpiredWarnDays=res.unexpiredWarnDays
  116. this.addForm.expiredWarnCount=res.expiredWarnCount
  117. this.addForm.illegalRemoval=res.illegalRemoval.split(',')
  118. this.addForm.timeout=res.timeout.split(',')
  119. this.addForm.expired=res.expired.split(',')
  120. this.addForm.unexpired=res.unexpired.split(',')
  121. }
  122. });
  123. warningConfigList({warningType:'3'}).then( response => {
  124. let res=response.data[0];
  125. if(response.code==200 && res){
  126. this.addForm2.id=res.id
  127. this.addForm2.illegalRemoval=res.illegalRemoval.split(',')
  128. this.addForm2.timeout=res.timeout.split(',')
  129. this.addForm2.expired=res.expired.split(',')
  130. this.addForm2.unexpired=res.unexpired.split(',')
  131. }
  132. });
  133. },
  134. //提交
  135. upDataButton(){
  136. this.$refs["addForm"].validate(valid => {
  137. if (valid) {
  138. let obj=[];
  139. obj.push(this.addForm)
  140. obj.push(this.addForm2)
  141. for(let i=0;i<obj.length;i++){
  142. obj[i].illegalRemoval=obj[i].illegalRemoval.join(',');
  143. obj[i].timeout=obj[i].timeout.join(',');
  144. obj[i].expired=obj[i].expired.join(',');
  145. obj[i].unexpired=obj[i].unexpired.join(',');
  146. }
  147. warningConfigAdd(obj).then((response) => {
  148. if(response.code==200){
  149. this.outButton();
  150. }
  151. });
  152. }
  153. })
  154. },
  155. //返回事件
  156. outButton(){
  157. this.$parent.goPage(1);
  158. },
  159. }
  160. }
  161. </script>
  162. <style scoped lang="scss">
  163. .sourceOfDangerForewarning{
  164. font-weight: 500;
  165. flex: 1;
  166. display: flex !important;
  167. flex-direction: column;
  168. overflow: hidden;
  169. ::v-deep .el-input-number__increase{
  170. line-height: 38px;
  171. }
  172. .title-box{
  173. display: flex;
  174. border-bottom:1px solid #dedede;
  175. p:nth-child(1){
  176. margin-left:20px;
  177. line-height: 80px;
  178. font-size:18px;
  179. color:#0045AF;
  180. }
  181. p:nth-child(2){
  182. flex:1;
  183. }
  184. p:nth-child(3){
  185. margin:20px;
  186. }
  187. }
  188. .content-box{
  189. flex:1;
  190. padding-top:30px;
  191. .form-max-box{
  192. .form-top-box{
  193. display: flex;
  194. margin-top:30px;
  195. height:60px;
  196. .form-item-box{
  197. height:60px;
  198. margin-bottom:0;
  199. }
  200. }
  201. .form-item-check-box{
  202. margin:0;
  203. }
  204. .form-title-p{
  205. line-height:50px;
  206. color:#0045AF;
  207. background-color: #F5F5F5;
  208. font-size:16px;
  209. padding-left:20px;
  210. }
  211. }
  212. }
  213. .bottom-button-max-box{
  214. display: flex;
  215. padding:20px 0;
  216. p:nth-child(1){
  217. flex:1;
  218. }
  219. p:nth-child(2){
  220. width:100px;
  221. margin-right:20px;
  222. }
  223. p:nth-child(3){
  224. width:100px;
  225. }
  226. p:nth-child(4){
  227. flex:1;
  228. }
  229. }
  230. }
  231. </style>