index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. <template>
  2. <div class="app-container noticeconfig">
  3. <div class="title-box">
  4. <!-- <div class="title-min-box" :class="buttonType == 1 ? 'check-box' : ''" @click="titleButton(1)">-->
  5. <!-- <p>检查通知</p>-->
  6. <!-- <p></p>-->
  7. <!-- </div>-->
  8. <div v-if="versionField() != 'xiBeiNongLinDaXue'"
  9. class="title-min-box" :class="buttonType == 2 ? 'check-box' : ''" @click="titleButton(2)">
  10. <p>预案通知</p>
  11. <p></p>
  12. </div>
  13. </div>
  14. <div class="content-box scrollbar-box">
  15. <!-- <el-form v-if="buttonType == 1" :model="examineForm" ref="examineForm" :inline="true" label-width="120px">-->
  16. <!-- <div class="examine-big-box">-->
  17. <!-- <div class="examine-div-one">-->
  18. <!-- <p>检查任务通知方式:</p>-->
  19. <!-- <el-checkbox :disabled="!tableButtonType" v-model="examineType" style="margin:1px 0 0 10px;" @change="examineAll">全选</el-checkbox>-->
  20. <!-- </div>-->
  21. <!-- <div class="examine-div-two">-->
  22. <!-- <el-checkbox-group :disabled="!tableButtonType" v-model="examineForm.data1" @change="examineChange">-->
  23. <!-- <el-checkbox style="margin-right:48px;"-->
  24. <!-- v-for="item in examineList" :label="item.key" :key="item.key">{{item.label}}</el-checkbox>-->
  25. <!-- </el-checkbox-group>-->
  26. <!-- </div>-->
  27. <!-- </div>-->
  28. <!-- <div class="examine-big-box">-->
  29. <!-- <div class="examine-div-one">-->
  30. <!-- <p>整改通知方式:</p>-->
  31. <!-- <el-checkbox :disabled="!tableButtonType" v-model="rectificationType" style="margin:1px 0 0 10px;" @change="rectificationAll">全选</el-checkbox>-->
  32. <!-- </div>-->
  33. <!-- <div class="examine-div-two">-->
  34. <!-- <el-checkbox-group :disabled="!tableButtonType" v-model="examineForm.data2" @change="rectificationChange">-->
  35. <!-- <el-checkbox style="margin-right:48px;"-->
  36. <!-- v-for="item in rectificationList" :label="item.key" :key="item.key">{{item.label}}</el-checkbox>-->
  37. <!-- </el-checkbox-group>-->
  38. <!-- </div>-->
  39. <!-- </div>-->
  40. <!-- <div class="examine-big-box">-->
  41. <!-- <div class="examine-div-one">-->
  42. <!-- <p>复核结果通知方式:</p>-->
  43. <!-- <el-checkbox :disabled="!tableButtonType" v-model="reviewType" style="margin:1px 0 0 10px;" @change="reviewAll">全选</el-checkbox>-->
  44. <!-- </div>-->
  45. <!-- <div class="examine-div-two">-->
  46. <!-- <el-checkbox-group :disabled="!tableButtonType" v-model="examineForm.data3" @change="reviewChange">-->
  47. <!-- <el-checkbox style="margin-right:48px;"-->
  48. <!-- v-for="item in reviewList" :label="item.key" :key="item.key">{{item.label}}</el-checkbox>-->
  49. <!-- </el-checkbox-group>-->
  50. <!-- </div>-->
  51. <!-- </div>-->
  52. <!-- </el-form>-->
  53. <el-form v-if="buttonType == 2" :model="form" ref="form" :inline="true" label-width="120px">
  54. <el-form-item label="广播通知" prop="riskRadio" class="form-item-box">
  55. <el-input
  56. style="width:350px;"
  57. type="textarea"
  58. maxlength="50"
  59. :rows="3"
  60. resize="none"
  61. placeholder="请输入广播通知内容"
  62. v-model="form.riskRadio">
  63. </el-input>
  64. </el-form-item>
  65. <el-form-item label="语音播报" prop="riskVoice" class="form-item-box">
  66. <el-input
  67. style="width:350px;"
  68. type="textarea"
  69. maxlength="50"
  70. :rows="3"
  71. resize="none"
  72. placeholder="请输入语音播报内容"
  73. v-model="form.riskVoice">
  74. </el-input>
  75. </el-form-item>
  76. <el-form-item label="电话通知" prop="riskPhone" class="form-item-box">
  77. <el-input
  78. style="width:350px;"
  79. type="textarea"
  80. maxlength="50"
  81. :rows="3"
  82. resize="none"
  83. placeholder="请输入电话通知内容"
  84. v-model="form.riskPhone">
  85. </el-input>
  86. </el-form-item>
  87. <el-form-item label="短信提示" prop="riskMessage" class="form-item-box">
  88. <el-input
  89. style="width:350px;"
  90. type="textarea"
  91. maxlength="50"
  92. :rows="3"
  93. resize="none"
  94. placeholder="请输入短信提示内容"
  95. v-model="form.riskMessage">
  96. </el-input>
  97. </el-form-item>
  98. </el-form>
  99. </div>
  100. <div class="button-box" v-if="buttonType == 1">
  101. <p class="null-p"></p>
  102. <p class="inquire-button-one button-p" @click="upExamineForm" v-hasPermi="['security:notice:add']">
  103. 提交</p>
  104. <p class="null-p"></p>
  105. </div>
  106. <div class="button-box" v-if="buttonType == 2">
  107. <p class="null-p"></p>
  108. <p class="inquire-button-one button-p" @click="upData" v-if="form.id" v-hasPermi="['laboratory:noticeconfig:edit']">
  109. 保存</p>
  110. <p class="inquire-button-one button-p" @click="upData" v-if="!form.id" v-hasPermi="['laboratory:noticeconfig:add']">
  111. 提交</p>
  112. <p class="null-p"></p>
  113. </div>
  114. </div>
  115. </template>
  116. <script>
  117. import { getNoticeconfigInfo, postNoticeconfigInfo, putNoticeconfigInfo } from "@/api/laboratory/noticeconfig";
  118. import { noticeConfigList, noticeConfigAdd } from '@/api/safetyCheck/index'
  119. export default {
  120. name: "Noticeconfig",
  121. data() {
  122. return {
  123. tableButtonType:this.hasPermiDom(['security:notice:add']),
  124. buttonType:2,
  125. // 遮罩层
  126. loading: true,
  127. // 选中数组
  128. ids: [],
  129. // 非单个禁用
  130. single: true,
  131. // 非多个禁用
  132. multiple: true,
  133. // 显示搜索条件
  134. showSearch: true,
  135. // 总条数
  136. total: 0,
  137. // 通知配置表格数据
  138. form: {},
  139. // 弹出层标题
  140. title: "",
  141. // 是否显示弹出层
  142. open: false,
  143. // 查询参数
  144. queryParams: {
  145. pageNum: 1,
  146. pageSize:20,
  147. riskVoice: null,
  148. riskPhone: null,
  149. riskMessage: null,
  150. exitRadio: null,
  151. exitVoice: null,
  152. exitPhone: null,
  153. exitMessage: null
  154. },
  155. examineType:false,
  156. examineList:[],
  157. rectificationType:false,
  158. rectificationList:[],
  159. reviewType:false,
  160. reviewList:[
  161. {
  162. label:"短信通知",
  163. key:"1",
  164. },
  165. {
  166. label:"系统通知",
  167. key:"2",
  168. },
  169. ],
  170. examineForm:{
  171. data1:[],
  172. data2:[],
  173. data3:[],
  174. },
  175. data1Id:"",
  176. data2Id:"",
  177. data3Id:"",
  178. };
  179. },
  180. created() {
  181. if(this.versionField() == 'xiBeiNongLinDaXue'){
  182. this.$set(this,'examineList',[
  183. {
  184. label:"短信通知",
  185. key:'1',
  186. },
  187. {
  188. label:"系统通知",
  189. key:'2',
  190. },
  191. ]);
  192. this.$set(this,'rectificationList',[
  193. {
  194. label:"短信通知",
  195. key:'1',
  196. },
  197. {
  198. label:"系统通知",
  199. key:'2',
  200. },
  201. ]);
  202. //this.noticeConfigList();
  203. }else{
  204. this.$set(this,'examineList',[
  205. {
  206. label:"短信通知",
  207. key:"1",
  208. },
  209. {
  210. label:"系统通知",
  211. key:"2",
  212. },
  213. {
  214. label:"一体机通知",
  215. key:"3",
  216. },
  217. ]);
  218. this.$set(this,'rectificationList',[
  219. {
  220. label:"短信通知",
  221. key:"1",
  222. },
  223. {
  224. label:"系统通知",
  225. key:"2",
  226. },
  227. {
  228. label:"一体机通知",
  229. key:"3",
  230. },
  231. ]);
  232. //this.noticeConfigList();
  233. this.getList();
  234. }
  235. },
  236. methods: {
  237. //检查通知
  238. noticeConfigList(){
  239. noticeConfigList().then( response => {
  240. for(let i=0;i<response.data.length;i++){
  241. if(response.data[i].noticeType == 1){
  242. let data1 = response.data[i].noticeWay.split(',');
  243. if(this.versionField() == 'xiBeiNongLinDaXue'){
  244. let list1 = []
  245. for(let i=0;i<data1.length;i++){
  246. if(data1[i] != 3){
  247. list1.push(data1[i])
  248. }
  249. }
  250. this.$set(this.examineForm,'data1',list1);
  251. this.$set(this,'examineType',data1[1]?true:false);
  252. }else{
  253. this.$set(this.examineForm,'data1',data1);
  254. this.$set(this,'examineType',data1[2]?true:false);
  255. }
  256. this.$set(this,'data1Id',response.data[i].id);
  257. }else if(response.data[i].noticeType == 2){
  258. let data2 = response.data[i].noticeWay.split(',');
  259. if(this.versionField() == 'xiBeiNongLinDaXue'){
  260. let list2 = []
  261. for(let i=0;i<data2.length;i++){
  262. if(data2[i] != 3){
  263. list2.push(data2[i])
  264. }
  265. }
  266. this.$set(this.examineForm,'data2',list2);
  267. this.$set(this,'rectificationType',data2[1]?true:false);
  268. }else{
  269. this.$set(this.examineForm,'data2',data2);
  270. this.$set(this,'rectificationType',data2[2]?true:false);
  271. }
  272. this.$set(this,'data2Id',response.data[i].id);
  273. }else if(response.data[i].noticeType == 3){
  274. let data3 = response.data[i].noticeWay.split(',');
  275. this.$set(this.examineForm,'data3',data3);
  276. this.$set(this,'reviewType',data3[1]?true:false);
  277. this.$set(this,'data3Id',response.data[i].id);
  278. }
  279. }
  280. });
  281. },
  282. //检查通知提交
  283. upExamineForm(){
  284. let list = [];
  285. let obj1 = {
  286. id:this.data1Id?this.data1Id:'',
  287. noticeType:1,
  288. noticeWay:this.examineForm.data1+'',
  289. };
  290. list.push(obj1);
  291. let obj2 = {
  292. id:this.data2Id?this.data2Id:'',
  293. noticeType:2,
  294. noticeWay:this.examineForm.data2+'',
  295. };
  296. list.push(obj2);
  297. let obj3 = {
  298. id:this.data3Id?this.data3Id:'',
  299. noticeType:3,
  300. noticeWay:this.examineForm.data3+'',
  301. };
  302. list.push(obj3);
  303. noticeConfigAdd(list).then( response => {
  304. this.msgSuccess(response.msg);
  305. //this.noticeConfigList();
  306. })
  307. },
  308. // 匹配
  309. examineAll(item){
  310. let self = this;
  311. if(item){
  312. let list = [];
  313. for(let i=0;i<self.examineList.length;i++){
  314. list.push(self.examineList[i].key)
  315. }
  316. this.$set(this.examineForm,'data1',list);
  317. }else{
  318. this.$set(this.examineForm,'data1',[]);
  319. }
  320. },
  321. examineChange(item){
  322. if(this.versionField() == 'xiBeiNongLinDaXue'){
  323. if(item[1]){
  324. this.$set(this,'examineType',true);
  325. }else{
  326. this.$set(this,'examineType',false);
  327. }
  328. }else{
  329. if(item[2]){
  330. this.$set(this,'examineType',true);
  331. }else{
  332. this.$set(this,'examineType',false);
  333. }
  334. }
  335. },
  336. rectificationAll(item){
  337. let self = this;
  338. if(item){
  339. let list = [];
  340. for(let i=0;i<self.rectificationList.length;i++){
  341. list.push(self.rectificationList[i].key)
  342. }
  343. this.$set(this.examineForm,'data2',list);
  344. }else{
  345. this.$set(this.examineForm,'data2',[]);
  346. }
  347. },
  348. rectificationChange(item){
  349. if(this.versionField() == 'xiBeiNongLinDaXue'){
  350. if(item[1]){
  351. this.$set(this,'rectificationType',true);
  352. }else{
  353. this.$set(this,'rectificationType',false);
  354. }
  355. }else{
  356. if(item[2]){
  357. this.$set(this,'rectificationType',true);
  358. }else{
  359. this.$set(this,'rectificationType',false);
  360. }
  361. }
  362. },
  363. reviewAll(item){
  364. let self = this;
  365. if(item){
  366. let list = [];
  367. for(let i=0;i<self.reviewList.length;i++){
  368. list.push(self.reviewList[i].key)
  369. }
  370. this.$set(this.examineForm,'data3',list);
  371. }else{
  372. this.$set(this.examineForm,'data3',[]);
  373. }
  374. },
  375. reviewChange(item){
  376. if(item[1]){
  377. this.$set(this,'reviewType',true);
  378. }else{
  379. this.$set(this,'reviewType',false);
  380. }
  381. },
  382. //切换
  383. titleButton(type){
  384. if(type != this.buttonType){
  385. this.$set(this,'buttonType',type)
  386. }
  387. },
  388. upData(){
  389. let self = this;
  390. this.$confirm('是否确定'+(self.form.id?'保存':'提交')+'?', "警告", {
  391. confirmButtonText: "确定",
  392. cancelButtonText: "取消",
  393. type: "warning"
  394. }).then(function() {
  395. if(self.buttonType == 1){
  396. }else if(self.buttonType == 2){
  397. if(self.form.id){
  398. self.putNoticeconfigInfo();
  399. }else{
  400. self.postNoticeconfigInfo();
  401. }
  402. }
  403. }).then(() => {
  404. }).catch(() => {});
  405. },
  406. postNoticeconfigInfo(){
  407. postNoticeconfigInfo(this.form).then( response => {
  408. this.msgSuccess("操作成功")
  409. this.getList();
  410. });
  411. },
  412. putNoticeconfigInfo(){
  413. putNoticeconfigInfo(this.form).then( response => {
  414. this.msgSuccess("操作成功")
  415. this.getList();
  416. });
  417. },
  418. /** 查询通知配置列表 */
  419. getList() {
  420. this.loading = true;
  421. getNoticeconfigInfo().then( response => {
  422. this.form = response.data;
  423. this.loading = false;
  424. });
  425. },
  426. // 取消按钮
  427. cancel() {
  428. this.open = false;
  429. this.reset();
  430. },
  431. // 表单重置
  432. reset() {
  433. this.form = {
  434. id: null,
  435. riskVoice: null,
  436. riskPhone: null,
  437. riskMessage: null,
  438. exitRadio: null,
  439. exitVoice: null,
  440. exitPhone: null,
  441. exitMessage: null
  442. };
  443. this.resetForm("form");
  444. },
  445. /** 搜索按钮操作 */
  446. handleQuery() {
  447. this.queryParams.pageNum = 1;
  448. this.getList();
  449. },
  450. /** 重置按钮操作 */
  451. resetQuery() {
  452. this.resetForm("queryForm");
  453. this.handleQuery();
  454. },
  455. // 多选框选中数据
  456. handleSelectionChange(selection) {
  457. this.ids = selection.map(item => item.id)
  458. this.single = selection.length!==1
  459. this.multiple = !selection.length
  460. },
  461. /** 新增按钮操作 */
  462. handleAdd() {
  463. this.reset();
  464. this.open = true;
  465. this.title = "添加通知配置";
  466. },
  467. /** 修改按钮操作 */
  468. handleUpdate(row) {
  469. this.reset();
  470. const id = row.id || this.ids
  471. getNoticeconfig(id).then( response => {
  472. this.form = response.data;
  473. this.open = true;
  474. this.title = "修改通知配置";
  475. });
  476. },
  477. /** 提交按钮 */
  478. submitForm() {
  479. this.$refs["form"].validate(valid => {
  480. if (valid) {
  481. if (this.form.id != null) {
  482. updateNoticeconfig(this.form).then( response => {
  483. this.msgSuccess("修改成功");
  484. this.open = false;
  485. this.getList();
  486. });
  487. } else {
  488. addNoticeconfig(this.form).then( response => {
  489. this.msgSuccess("新增成功");
  490. this.open = false;
  491. this.getList();
  492. });
  493. }
  494. }
  495. });
  496. },
  497. /** 删除按钮操作 */
  498. handleDelete(row) {
  499. const ids = row.id || this.ids;
  500. this.$confirm('是否确认删除通知配置编号为"' + ids + '"的数据项?', "警告", {
  501. confirmButtonText: "确定",
  502. cancelButtonText: "取消",
  503. type: "warning"
  504. }).then(function() {
  505. return delNoticeconfig(ids);
  506. }).then(() => {
  507. this.getList();
  508. this.msgSuccess("删除成功");
  509. }).catch(() => {});
  510. },
  511. /** 导出按钮操作 */
  512. handleExport() {
  513. this.download('laboratory/noticeconfig/export', {
  514. ...this.queryParams
  515. }, `laboratory_noticeconfig.xlsx`)
  516. }
  517. }
  518. };
  519. </script>
  520. <style scoped lang="scss">
  521. .noticeconfig{
  522. display: flex !important;
  523. flex:1;
  524. flex-direction: column;
  525. overflow: hidden;
  526. *{
  527. margin:0;
  528. font-weight:500;
  529. }
  530. .title-box{
  531. height:80px;
  532. border-bottom:1px solid #dedede;
  533. overflow-x:scroll;
  534. overflow-y:hidden;
  535. white-space: nowrap;
  536. padding:0 40px;
  537. .title-min-box{
  538. cursor: pointer;
  539. display: inline-block;
  540. overflow: hidden;
  541. height:80px;
  542. width:65px;
  543. margin:10px 70px 5px 0;
  544. p:nth-child(1){
  545. line-height: 40px;
  546. margin-top: 10px;
  547. font-size:16px;
  548. text-align: center;
  549. }
  550. p:nth-child(2){
  551. width:60px;
  552. height:4px;
  553. margin:0 auto;
  554. border-radius:4px;
  555. }
  556. }
  557. .check-box{
  558. p:nth-child(1){
  559. color:#0045AF!important;
  560. }
  561. p:nth-child(2){
  562. background: #0045AF!important;
  563. }
  564. }
  565. }
  566. .title-box::-webkit-scrollbar{
  567. width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
  568. height: 4px;
  569. }
  570. .title-box::-webkit-scrollbar-thumb{
  571. border-radius: 5px;
  572. background: #CBCDD1;
  573. }
  574. .title-box::-webkit-scrollbar-track{
  575. -webkit-box-shadow: inset 0 0 5px rgba(255,255,255,0);
  576. border-radius: 0;
  577. background: rgba(255,255,255,0);
  578. }
  579. .content-box{
  580. flex:1;
  581. padding:40px 46px 0;
  582. .examine-big-box{
  583. display: inline-block;
  584. overflow: hidden;
  585. border:1px solid #E0E0E0;
  586. border-radius:4px;
  587. margin-left:35px;
  588. width:450px;
  589. height:130px;
  590. div{
  591. font-size:14px;
  592. color:#333;
  593. }
  594. .examine-div-one{
  595. display: flex;
  596. margin:25px 0 30px 12px;
  597. }
  598. .examine-div-two{
  599. margin:0 0 20px 18px;
  600. }
  601. }
  602. }
  603. .button-box{
  604. display: flex;
  605. height:80px;
  606. .button-p{
  607. width:80px;
  608. height:40px;
  609. margin:20px 0;
  610. }
  611. .null-p{
  612. flex:1;
  613. }
  614. }
  615. .top-title-box{
  616. display: flex;
  617. height:80px;
  618. border-bottom:1px solid #E0E0E0;
  619. margin-bottom:54px;
  620. p:nth-child(1){
  621. line-height:80px;
  622. font-size:18px;
  623. color:#0045AF;
  624. flex:1;
  625. }
  626. p:nth-child(2){
  627. margin-top:20px;
  628. }
  629. }
  630. .form-item-box{
  631. display: inline-block;
  632. margin-bottom:28px;
  633. }
  634. }
  635. </style>