addPlan.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  1. <!--风险预案编辑-->
  2. <template>
  3. <div class="addPlan">
  4. <p class="reset-button-one" style="float: right;" @click="backPage"><i class="el-icon-arrow-left"></i>返回</p>
  5. <p class="plan-title-p color_one">基本信息</p>
  6. <el-form :model="form" ref="form" :rules="rules" :inline="true" label-width="100px" class="form-box">
  7. <div class="plan-info-box">
  8. <el-row >
  9. <el-form-item label="预案名称:" prop="name">
  10. <el-input
  11. v-model="form.name"
  12. placeholder="请输入预案名称"
  13. clearable
  14. size="small"
  15. maxLength="50"
  16. />
  17. </el-form-item>
  18. <el-form-item label="关联实验室:" v-if="labShow==true">
  19. <el-input
  20. v-model="form.labname"
  21. placeholder="请选择关联实验室"
  22. clearable
  23. size="small"
  24. @focus="labClick()"
  25. />
  26. </el-form-item>
  27. <el-form-item label="同步执行疏散" prop="warehouse">
  28. <el-radio-group v-model="form.evacuation">
  29. <el-radio :label='0'>否</el-radio>
  30. <el-radio :label='1'>是</el-radio>
  31. </el-radio-group>
  32. </el-form-item>
  33. </el-row>
  34. </div>
  35. <p class="plan-title-p color_one">启动条件</p>
  36. <div class="plan-info-box">
  37. <el-row v-for="(item,index) in form.riskPlanSensorList" :key="index">
  38. <div >
  39. <div style="display: inline-block;">
  40. <el-form-item label="选择传感器" :prop="'riskPlanSensorList.'+ index +'.funNum'" :rules="rules.funNum" style="margin-top: -10px;">
  41. <el-select v-model="item.funNum" placeholder="请选择传感器" clearable @change="(val)=>selectFunNum(val,index)">
  42. <el-option
  43. v-for="sensor in sensorList"
  44. :key="sensor.funNum"
  45. :label="sensor.describe"
  46. :value="sensor.funNum"
  47. ></el-option>
  48. </el-select>
  49. </el-form-item>
  50. </div>
  51. <div style="display: inline-block;" class="for-sensor-input">
  52. <el-form-item label="异常值区间:" style="width: 300px;" :prop="'riskPlanSensorList.'+ index +'.minMonitor'" :rules="rules.minMonitor">
  53. <el-input
  54. type="number"
  55. v-model="item.minMonitor"
  56. oninput="if(value.length>6)value=value.slice(0,6)"
  57. placeholder="请输入异常值"
  58. clearable
  59. size="small"
  60. />
  61. </el-form-item>
  62. <p style="margin:0; text-align:center;color:#E0E0E0;display:inline-block;margin-right:10px;line-height:40px;">-</p>
  63. <el-form-item label="" :prop="'riskPlanSensorList.'+ index +'.maxMonitor'" :rules="rules.maxMonitor">
  64. <el-input
  65. type="number"
  66. v-model="item.maxMonitor"
  67. placeholder="请输入异常值"
  68. oninput="if(value.length>6)value=value.slice(0,6)"
  69. clearable
  70. size="small"
  71. @keyup.focus.native="handleQuery"
  72. />
  73. </el-form-item>
  74. <i class="el-icon-delete" style="margin-left:20px;font-size:20px;color:#999;cursor:pointer;" @click="delSensor(index)"></i>
  75. </div>
  76. </div>
  77. </el-row>
  78. <p class="add-button-p color_99" @click="addSensor"><i class="el-icon-plus"></i>新增传感器规则</p>
  79. </div>
  80. <p class="plan-title-p color_one">执行动作</p>
  81. <div class="plan-info-box">
  82. <div v-for="(item,index) in form.riskPlanHardwareList" :key="index">
  83. <div style="display: inline-block">
  84. <el-form-item label="选择硬件" style="margin-top:-10px;" :prop="'riskPlanHardwareList.'+ index +'.hardwareType'" :rules="rules.hardwareType">
  85. <el-select v-model="item.hardwareType" placeholder="请选择硬件" clearable size="small" @change="(val)=>controlTypeList(val,index)">
  86. <el-option
  87. v-for="hardware in hardwareList"
  88. :key="hardware.id"
  89. :label="hardware.name"
  90. :value="hardware.id"
  91. ></el-option>
  92. </el-select>
  93. </el-form-item>
  94. </div>
  95. <div style="display: inline-block">
  96. <el-form-item label="执行操作" :prop="'riskPlanHardwareList.'+ index +'.operate'" :rules="rules.operate">
  97. <el-select v-model="item.operate" placeholder="请选择执行操作" clearable size="small">
  98. <el-option
  99. v-for="dict in item.controlTypeOptions"
  100. :key="dict.dictValue"
  101. :label="dict.dictLabel"
  102. :value="dict.dictValue"
  103. ></el-option>
  104. </el-select>
  105. </el-form-item>
  106. <el-form-item label="结束操作" :prop="'riskPlanHardwareList.'+ index +'.operate'" :rules="rules.overAct">
  107. <el-select v-model="item.overAct" placeholder="请选择预案结束操作" clearable size="small">
  108. <el-option
  109. v-for="dict in item.controlTypeOptions"
  110. :key="dict.dictValue"
  111. :label="dict.dictLabel"
  112. :value="dict.dictValue"
  113. ></el-option>
  114. </el-select>
  115. </el-form-item>
  116. <i class="el-icon-delete" style="font-size:20px;color:#999;cursor:pointer;margin:10px 0 0 20px;" @click="delHardware(index)"></i>
  117. </div>
  118. </div>
  119. <p class="add-button-p color_99" @click="addHardware"><i class="el-icon-plus"></i>添加</p>
  120. </div>
  121. <div class="bottom-button-box">
  122. <el-button class="color_99" @click="backPage">取消</el-button>
  123. <el-button class="color_ff back_one" @click="submitForm">确定</el-button>
  124. </div>
  125. </el-form>
  126. <!--关联实验室弹框-->
  127. <el-dialog title='关联实验室' @close="handleClose" :visible.sync="dialogVisible" width="80%"
  128. :close-on-click-modal="false">
  129. <el-form :model="dialogForm" ref="dialogForm" :inline="true" label-width="140px">
  130. <el-form-item label="实验室名称" prop="name" >
  131. <el-input
  132. v-model="dialogForm.name"
  133. placeholder="请输入实验室名称"
  134. clearable
  135. size="small"
  136. />
  137. </el-form-item>
  138. <el-form-item label="学院" prop="type" >
  139. <el-select v-model="dialogForm.deptId" placeholder="请选择学院" clearable size="small">
  140. <el-option
  141. v-for="dict in deptOptions"
  142. :key="dict.deptId"
  143. :label="dict.deptName"
  144. :value="dict.deptId"
  145. ></el-option>
  146. </el-select>
  147. </el-form-item>
  148. <el-form-item label="安全分类" prop="typeId" class="form-item">
  149. <el-select v-model="dialogForm.typeId" placeholder="请选择安全分类" clearable >
  150. <el-option
  151. v-for="dict in typeList"
  152. :key="dict.id"
  153. :label="dict.typeName"
  154. :value="dict.id"
  155. ></el-option>
  156. </el-select>
  157. </el-form-item>
  158. <el-form-item label="安全分级" prop="level" class="form-item">
  159. <el-select v-model="dialogForm.level" placeholder="请选择安全分级" clearable >
  160. <el-option
  161. v-for="dict in levelList"
  162. :key="dict.id"
  163. :label="dict.classifiedName"
  164. :value="dict.id"
  165. ></el-option>
  166. </el-select>
  167. </el-form-item>
  168. <el-form-item label="实验室负责人" prop="name" >
  169. <el-input
  170. v-model="dialogForm.adminName"
  171. placeholder="请输入实验室负责人"
  172. clearable
  173. size="small"
  174. />
  175. </el-form-item>
  176. <el-form-item>
  177. <p class="inquire-button-one" style="margin-left:20px;" @click="onSearch">查询</p>
  178. <p class="reset-button-one" style="margin-left:20px;" @click="resetForm">重置</p>
  179. </el-form-item>
  180. </el-form>
  181. <div class="btn_list">
  182. <i class="el-icon-warning"></i>
  183. <i>已选择{{labRiskPlanjoinsubList.length}} 项</i>
  184. <i @click="toggleSelection(dialogTable)">全选本页</i>
  185. <!-- <i>选择全部</i>-->
  186. <i></i>
  187. <i @click="toggleSelection()">清除选项</i>
  188. <div class="bottom-button-box">
  189. <el-button class="color_99" @click="closeDialog()">取消</el-button>
  190. <el-button class="color_ff back_one" @click="confirmDialog()">确定</el-button>
  191. </div>
  192. </div>
  193. <el-table ref="multipleTable" border tooltip-effect="dark" :data="dialogTable" highlight-current-row @selection-change="handleSelectionChange" style="cursor: pointer;">
  194. <el-table-column type="selection" width="55" align="center"></el-table-column>
  195. <el-table-column label="实验室名称" show-overflow-tooltip align="left" prop="name"/>
  196. <el-table-column label="学院" align="left" prop="deptName" />
  197. <el-table-column label="安全分类" align="left" prop="typeName" />
  198. <el-table-column label="安全分级" align="left" prop="levelName" >
  199. <template slot-scope="scope">
  200. <span :style="'color:'+scope.row.fiedColor+';'">{{scope.row.levelName}}</span>
  201. </template>
  202. </el-table-column>
  203. <el-table-column label="实验室负责人" align="left" prop="adminName" />
  204. </el-table>
  205. <pagination :page-sizes="[20, 30, 40, 50]"
  206. v-show="total>0"
  207. :total="total"
  208. :page.sync="dialogForm.pageNum"
  209. :limit.sync="dialogForm.pageSize"
  210. @pagination="getList"
  211. />
  212. </el-dialog>
  213. </div>
  214. </template>
  215. <script>
  216. import {
  217. getPlan,
  218. addPlan,
  219. updatePlan,
  220. getUserRoleBySub,
  221. getLabRiskPlanRepeat,
  222. getUserRoleBySubOperation
  223. } from "@/api/laboratory/plan";
  224. import { optionHazard } from "@/api/laboratory/hazard";
  225. import { optionSensor } from "@/api/laboratory/sensor";
  226. import { optionHardware } from "@/api/laboratory/hardware";
  227. import {listDepartments} from "@/api/system/dept";
  228. import {listClassifiedAll} from "@/api/laboratory/classified";
  229. import {listClasstypeAll} from "@/api/laboratory/classtype";
  230. import {authListSubject} from "@/api/laboratory/subject";
  231. export default {
  232. props:{
  233. pageData:{},
  234. },
  235. name: "addPlan",
  236. data() {
  237. return {
  238. form:{
  239. evacuation: 0,
  240. riskPlanSensorList:[],
  241. riskPlanHardwareList:[],
  242. },
  243. dialogVisible:false,
  244. //判断实验室框是否显示隐藏
  245. labShow:false,
  246. //实验室弹框
  247. dialogForm:{
  248. pageNum: 1,
  249. pageSize:20,
  250. name: null,
  251. deptId: null,
  252. typeId: null,
  253. level: null,
  254. adminName: null,
  255. },
  256. deptOptions:[],
  257. typeList:[],
  258. levelList:[],
  259. dialogTable:[],
  260. // 表单校验
  261. rules: {
  262. name: [
  263. { required: true, message: "请输入预案名称", trigger: "blur" },
  264. { required: true, message: "请输入预案名称", validator: this.spaceJudgment, trigger: "blur" }
  265. ],
  266. labname: [
  267. { required: true, message: "请选择关联实验室", trigger: "blur" },
  268. { required: true, message: "请选择关联实验室", validator: this.spaceJudgment, trigger: "blur" }
  269. ],
  270. hazardId: [
  271. { required: true, message: "危险源不能为空", trigger: "blur" }
  272. ],
  273. message: [
  274. { required: true, message: "短信提示不能为空", trigger: "change" },
  275. { required: true, message: "短信提示不能为空", validator: this.spaceJudgment, trigger: "blur" }
  276. ],
  277. voicebroadcast: [
  278. { required: true, message: "语音播报内容不能为空", trigger: "change" },
  279. { required: true, message: "语音播报内容不能为空", validator: this.spaceJudgment, trigger: "blur" }
  280. ],
  281. information: [
  282. { required: true, message: "消息推送内容不能为空", trigger: "blur" },
  283. { required: true, message: "消息推送内容不能为空", validator: this.spaceJudgment, trigger: "blur" }
  284. ],
  285. remark: [
  286. { required: true, message: "预案描述不能为空", trigger: "blur" },
  287. { required: true, message: "预案描述不能为空", validator: this.spaceJudgment, trigger: "blur" }
  288. ],
  289. funNum: [
  290. { required: true, message: "请选择传感器", trigger: "blur" }
  291. ],
  292. minMonitor: [
  293. { required: true, message: "请输入异常值", trigger: "blur" },
  294. { required: true, message: "请输入异常值", validator: this.spaceJudgment, trigger: "blur" },
  295. ],
  296. maxMonitor: [
  297. { required: true, message: "请输入异常值", trigger: "blur" },
  298. { required: true, message: "请输入异常值", validator: this.spaceJudgment, trigger: "blur" },
  299. ],
  300. hardwareType: [
  301. { required: true, message: "请选择硬件", trigger: "blur" }
  302. ],
  303. operate: [
  304. { required: true, message: "请选择执行操作", trigger: "blur" }
  305. ],
  306. overAct: [
  307. { required: false,trigger: "blur" }
  308. ],
  309. },
  310. // 危险源下拉
  311. hazardList: [],
  312. // 传感器下拉
  313. sensorList: [],
  314. sensorListData:[],
  315. // 硬件下拉
  316. hardwareList: [],
  317. // 硬件操作字典
  318. controlTypeOptions: [],
  319. labRiskPlanjoinsubList:[],//所选实验室id
  320. total: 0,
  321. joinSubOper:null,//返回true是实验室管理员,false不是实验室管理员
  322. arr:[],
  323. };
  324. },
  325. methods: {
  326. //select传感器选中
  327. selectFunNum(val,index){
  328. // let self = this;
  329. // let num = 0;
  330. // for(let i=0;i<self.form.riskPlanSensorList.length;i++){
  331. // if(val == self.form.riskPlanSensorList[i].funNum){
  332. // num++
  333. // }
  334. // }
  335. // if(num>1){
  336. // this.$set(this.form.riskPlanSensorList[index],'funNum','');
  337. // this.msgError('已存在相同的传感器');
  338. // }
  339. },
  340. //查询
  341. onSearch() {
  342. this.dialogForm.pageNo = 1;
  343. this.getList();
  344. },
  345. //重置
  346. resetForm() {
  347. this.dialogForm.name = '';
  348. this.dialogForm.deptId = '';
  349. this.dialogForm.typeId = '';
  350. this.dialogForm.level = '';
  351. this.dialogForm.adminName = '';
  352. this.onSearch();
  353. },
  354. //实验室弹框
  355. labClick(){
  356. this.dialogVisible=true;
  357. if(this.arr){
  358. this.$nextTick(() => {
  359. this.arr.forEach(row => {
  360. this.$refs.multipleTable.toggleRowSelection(row);
  361. });
  362. })
  363. }
  364. },
  365. //关闭实验室弹窗
  366. closeDialog(){
  367. // this.labRiskPlanjoinsubList=[];
  368. this.dialogVisible=false;
  369. },
  370. //监听关联记录弹窗关闭
  371. handleClose(){
  372. if(this.arr){
  373. this.$nextTick(() => {
  374. this.arr.forEach(row => {
  375. this.$refs.multipleTable.toggleRowSelection(row);
  376. });
  377. })
  378. }
  379. },
  380. //实验室弹窗确认
  381. confirmDialog(){
  382. this.dialogVisible=false;
  383. },
  384. //切换页面
  385. backPage(){
  386. this.$parent.handleClick('','','back');
  387. },
  388. /** 查询学院列表 */
  389. getDeptListTow() {
  390. listDepartments().then(response => {
  391. this.$set(this, 'deptOptions', response.data)
  392. });
  393. },
  394. /**获取分级*/
  395. getListClassifiedAll(){
  396. listClassifiedAll().then(response=>{
  397. if(response.code==200){
  398. this.levelList = response.data
  399. }
  400. })
  401. },
  402. /**获取分类*/
  403. getListClasstypeAll(){
  404. listClasstypeAll().then(response=>{
  405. if(response.code==200){
  406. this.typeList = response.data;
  407. }
  408. });
  409. },
  410. /** 查询实验室列表 */
  411. getList() {
  412. this.loading = true;
  413. let _this=this;
  414. getUserRoleBySub(this.dialogForm).then(response => {
  415. if(response.code==200){
  416. this.dialogTable = response.rows;
  417. this.total = response.total;
  418. this.loading = false;
  419. }
  420. });
  421. },
  422. //选中实验室
  423. handleSelectionChange(val){
  424. let _this=this;
  425. _this.labRiskPlanjoinsubList=[];
  426. val.forEach(function (item,index){
  427. _this.labRiskPlanjoinsubList.push({'subjectId':item.id})
  428. })
  429. },
  430. //取消选中
  431. toggleSelection(rows) {
  432. if (rows) {
  433. this.$refs.multipleTable.clearSelection();
  434. rows.forEach(row => {
  435. this.$refs.multipleTable.toggleRowSelection(row);
  436. });
  437. } else {
  438. this.$refs.multipleTable.clearSelection();
  439. }
  440. },
  441. //新增传感器
  442. addSensor(){
  443. if(this.form.riskPlanSensorList.length>4){
  444. this.msgError('最多添加5项')
  445. return
  446. }
  447. let obj = {};
  448. this.form.riskPlanSensorList.push(obj);
  449. },
  450. delSensor(index){
  451. this.form.riskPlanSensorList.splice(index,1)
  452. },
  453. //新增规则
  454. addHardware(){
  455. if(this.form.riskPlanHardwareList.length>4){
  456. this.msgError('最多添加5项')
  457. return
  458. }
  459. let obj = {};
  460. this.form.riskPlanHardwareList.push(obj);
  461. },
  462. delHardware(index){
  463. this.form.riskPlanHardwareList.splice(index,1)
  464. },
  465. /** 修改按钮操作 */
  466. handleUpdate() {
  467. let _this=this;
  468. getPlan(this.form.id).then(response => {
  469. this.form = response.data;
  470. for(let i=0;i<response.data.riskPlanHardwareList.length;i++){
  471. this.controlTypeList(response.data.riskPlanHardwareList[i].hardwareType,i);
  472. }
  473. response.data.labRiskPlanjoinsubList.forEach(function (item,index){
  474. _this.labRiskPlanjoinsubList.push({'subjectId':item.subjectId})
  475. })
  476. _this.form.labRiskPlanjoinsubList=_this.labRiskPlanjoinsubList;
  477. //根据详情返回的实验室信息循环匹配相同实验室信息
  478. _this.dialogTable.forEach(function (item,index){
  479. _this.labRiskPlanjoinsubList.forEach(function (item2,index){
  480. if(item.id==item2.subjectId){
  481. _this.arr.push(item)
  482. }
  483. })
  484. })
  485. });
  486. },
  487. /** 查询实验室根据实验室管理员用户权限是否有操作权限 */
  488. getUserRoleBySubOperation(){
  489. getUserRoleBySubOperation({}).then(response => {
  490. if(response.code==200){
  491. this.labShow= response.data //返回true是实验室管理员,false不是实验室管理员
  492. this.joinSubOper=response.data;
  493. }
  494. });
  495. },
  496. // 危险源下拉列表
  497. getHazardList () {
  498. optionHazard({}).then(response => {
  499. this.hazardList = response.data;
  500. });
  501. },
  502. /** 查询传感器列表 */
  503. getSensorList() {
  504. optionSensor({}).then(response => {
  505. this.sensorList = response.data;
  506. this.sensorListData = JSON.parse(JSON.stringify(response.data))
  507. });
  508. },
  509. /** 查询硬件下拉列表 */
  510. getHardwareList() {
  511. optionHardware({}).then(response => {
  512. var allDate = new Array();
  513. for(const key in response.data){
  514. allDate.push({"id":response.data[key].hardwareTypeEnum.code,"name":response.data[key].hardwareTypeEnum.name})
  515. }
  516. this.hardwareList = allDate;
  517. });
  518. },
  519. /** 查询功能列表 */
  520. controlTypeList(val,index) {
  521. optionHardware({}).then(response => {
  522. var allDate = new Array();
  523. for(const key in response.data){
  524. if(response.data[key].hardwareTypeEnum.code==val){
  525. for(const sta in response.data[key].functionStatusList){
  526. allDate.push({"dictLabel":response.data[key].functionStatusList[sta].describe,"dictValue":response.data[key].functionStatusList[sta].code})
  527. }
  528. }
  529. }
  530. this.$set(this.form.riskPlanHardwareList[index],'controlTypeOptions',allDate);
  531. });
  532. },
  533. /** 提交按钮 */
  534. submitForm() {
  535. let _this=this;
  536. this.$refs["form"].validate(valid => {
  537. if (valid) {
  538. for(let i=0;i<_this.form.riskPlanSensorList.length;i++){
  539. if(parseInt(_this.form.riskPlanSensorList[i].minMonitor)>=parseInt(_this.form.riskPlanSensorList[i].maxMonitor)){
  540. this.msgError('传感器异常区值的最小值无法超过最大值');
  541. return
  542. }
  543. }
  544. _this.form.labRiskPlanjoinsubList=_this.labRiskPlanjoinsubList
  545. _this.form.joinSubOper=_this.joinSubOper
  546. getLabRiskPlanRepeat(_this.form).then(response => {
  547. if(response.code = 200){
  548. if(response.data.repeat==true){//:如果为true,就是有重复的,如果为false,就表示没有重复的
  549. this.$confirm(response.data.tipsStr, '提示', {
  550. confirmButtonText: '是',
  551. cancelButtonText: '否',
  552. type: 'warning'
  553. }).then(() => {//确定
  554. _this.form.yesOrNo=true;//是否覆盖提交,true是,false否
  555. if (this.form.id != null) {
  556. updatePlan(this.form).then(response => {
  557. if(response.code = 200){
  558. this.msgSuccess("修改成功");
  559. this.$parent.handleClick('','','back');
  560. }
  561. });
  562. } else {
  563. addPlan(this.form).then(response => {
  564. if(response.code = 200){
  565. this.msgSuccess("新增成功");
  566. this.$parent.handleClick('','','back');
  567. }
  568. });
  569. }
  570. }).catch(() => {
  571. _this.form.yesOrNo=false;//是否覆盖提交,true是,false否
  572. if (this.form.id != null) {
  573. updatePlan(this.form).then(response => {
  574. if(response.code = 200){
  575. this.msgSuccess("修改成功");
  576. this.$parent.handleClick('','','back');
  577. }
  578. });
  579. } else {
  580. addPlan(this.form).then(response => {
  581. if(response.code = 200){
  582. this.msgSuccess("新增成功");
  583. this.$parent.handleClick('','','back');
  584. }
  585. });
  586. }
  587. });
  588. }else if(response.data.repeat==false){//:如果为true,就是有重复的,如果为false,就表示没有重复的
  589. _this.form.yesOrNo=false;//是否覆盖提交,true是,false否
  590. if (_this.form.id != null) {
  591. updatePlan(_this.form).then(response => {
  592. if(response.code = 200){
  593. this.msgSuccess("修改成功");
  594. this.$parent.handleClick('','','back');
  595. }
  596. });
  597. } else {
  598. addPlan(_this.form).then(response => {
  599. if(response.code = 200){
  600. this.msgSuccess("新增成功");
  601. this.$parent.handleClick('','','back');
  602. }
  603. });
  604. }
  605. }
  606. }
  607. });
  608. }
  609. });
  610. },
  611. },
  612. beforeMount() {
  613. this.getDeptListTow();
  614. this.getListClassifiedAll();
  615. this.getListClasstypeAll();
  616. // this.controlTypeList();
  617. this.getUserRoleBySubOperation();
  618. this.getList();
  619. this.getHazardList();
  620. this.getSensorList();
  621. this.getHardwareList();
  622. if(this.pageData){
  623. this.form.id = this.pageData.id
  624. }
  625. if(this.form.id){
  626. this.handleUpdate()
  627. }
  628. },
  629. mounted(){
  630. },
  631. };
  632. </script>
  633. <style scoped lang="scss">
  634. .addPlan{
  635. position: relative;
  636. margin-top:-11px;
  637. p{
  638. margin:0;
  639. }
  640. .plan-title-p{
  641. height:80px;
  642. line-height:80px;
  643. font-size:18px;
  644. padding-left:20px;
  645. border-bottom:1px solid #E0E0E0;
  646. }
  647. .reset-button-one{
  648. /* position: absolute;
  649. top:20px;
  650. right:0;*/
  651. }
  652. .plan-info-box{
  653. padding-top:30px;
  654. .add-button-p{
  655. width:300px;
  656. height:40px;
  657. line-height:36px;
  658. font-size:16px;
  659. border:2px dashed #E0E0E0;
  660. border-radius:4px;
  661. cursor:pointer;
  662. margin:20px auto 0;
  663. text-align: center;
  664. i{
  665. margin-right:5px;
  666. }
  667. }
  668. }
  669. .bottom-button-box{
  670. display: flex;
  671. justify-content: flex-start;
  672. width:220px;
  673. margin:80px auto 20px;
  674. p{
  675. font-size:14px;
  676. height:40px;
  677. width:100px;
  678. line-height:40px;
  679. text-align: center;
  680. border-radius:4px;
  681. }
  682. p:nth-child(1){
  683. border:1px solid #E0E0E0;
  684. margin-right:20px;
  685. }
  686. p:nth-child(2){
  687. border:1px solid #0045AF;
  688. }
  689. }
  690. }
  691. .btn_list{
  692. width: 100%;
  693. height: 40px;
  694. background: rgba(1,131,250,0.1);
  695. border-radius: 6px;
  696. display: flex;
  697. justify-content: flex-start;
  698. align-items: center;
  699. margin-bottom: 32px;
  700. >i{
  701. font-style: normal;
  702. display: inline-block;
  703. cursor: pointer;
  704. }
  705. >i:nth-of-type(1){
  706. font-size: 20px;
  707. color: #0045AF;
  708. margin: 0 16px 0 14px;
  709. }
  710. >i:nth-of-type(2){
  711. font-size: 16px;
  712. font-family: Source Han Sans CN;
  713. font-weight: bold;
  714. color: #999999;
  715. line-height: 16px;
  716. }
  717. >i:nth-of-type(3){
  718. font-size: 16px;
  719. font-family: Source Han Sans CN;
  720. font-weight: bold;
  721. color: #0045AF;
  722. line-height: 16px;
  723. margin: 0 28px 0 46px;
  724. }
  725. >i:nth-of-type(4){
  726. font-size: 16px;
  727. font-family: Source Han Sans CN;
  728. font-weight: bold;
  729. color: #0045AF;
  730. line-height: 16px;
  731. }
  732. >i:nth-of-type(5){
  733. font-size: 16px;
  734. font-family: Source Han Sans CN;
  735. font-weight: bold;
  736. color: #FFA312;
  737. line-height: 16px;
  738. margin: 0 40px 0 28px;
  739. }
  740. .bottom-button-box{
  741. display: flex;
  742. width:220px;
  743. margin: 0;
  744. p{
  745. font-size:14px;
  746. height:30px;
  747. width:100px;
  748. line-height:30px;
  749. text-align: center;
  750. border-radius:4px;
  751. }
  752. p:nth-child(1){
  753. border:1px solid #E0E0E0;
  754. margin-right:20px;
  755. }
  756. p:nth-child(2){
  757. border:1px solid #0045AF;
  758. }
  759. }
  760. }
  761. </style>
  762. <style lang="scss">
  763. .addPlan{
  764. .for-sensor-input{
  765. input::-webkit-outer-spin-button,
  766. input::-webkit-inner-spin-button {
  767. -webkit-appearance: none!important;
  768. }
  769. /* 在Firefox浏览器下 */
  770. input[type="number"]{
  771. -moz-appearance: textfield!important;
  772. }
  773. }
  774. }
  775. </style>