indexOne.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <div class="app-container noticeconfig">
  3. <el-form :model="form" ref="form" :inline="true" label-width="120px">
  4. <div class="top-title-box">
  5. <p>预案通知</p>
  6. <p class="inquire-button-one" @click="upData" v-if="form.id" v-hasPermi="['laboratory:noticeconfig:edit']">保存</p>
  7. <p class="inquire-button-one" @click="upData" v-if="!form.id" v-hasPermi="['laboratory:noticeconfig:add']">提交</p>
  8. </div>
  9. <el-form-item label="广播通知" prop="riskRadio" class="form-item-box">
  10. <el-input
  11. style="width:350px;"
  12. type="textarea"
  13. maxlength="50"
  14. :rows="3"
  15. resize="none"
  16. placeholder="请输入广播通知内容"
  17. v-model="form.riskRadio">
  18. </el-input>
  19. </el-form-item>
  20. <el-form-item label="语音播报" prop="riskVoice" class="form-item-box">
  21. <el-input
  22. style="width:350px;"
  23. type="textarea"
  24. maxlength="50"
  25. :rows="3"
  26. resize="none"
  27. placeholder="请输入语音播报内容"
  28. v-model="form.riskVoice">
  29. </el-input>
  30. </el-form-item>
  31. <el-form-item label="电话通知" prop="riskPhone" class="form-item-box">
  32. <el-input
  33. style="width:350px;"
  34. type="textarea"
  35. maxlength="50"
  36. :rows="3"
  37. resize="none"
  38. placeholder="请输入电话通知内容"
  39. v-model="form.riskPhone">
  40. </el-input>
  41. </el-form-item>
  42. <el-form-item label="短信提示" prop="riskMessage" class="form-item-box">
  43. <el-input
  44. style="width:350px;"
  45. type="textarea"
  46. maxlength="50"
  47. :rows="3"
  48. resize="none"
  49. placeholder="请输入短信提示内容"
  50. v-model="form.riskMessage">
  51. </el-input>
  52. </el-form-item>
  53. </el-form>
  54. </div>
  55. </template>
  56. <script>
  57. import { getNoticeconfigInfo, postNoticeconfigInfo, putNoticeconfigInfo } from "@/api/laboratory/noticeconfig";
  58. export default {
  59. name: "Noticeconfig",
  60. data() {
  61. return {
  62. // 遮罩层
  63. loading: true,
  64. // 选中数组
  65. ids: [],
  66. // 非单个禁用
  67. single: true,
  68. // 非多个禁用
  69. multiple: true,
  70. // 显示搜索条件
  71. showSearch: true,
  72. // 总条数
  73. total: 0,
  74. // 通知配置表格数据
  75. form: {},
  76. // 弹出层标题
  77. title: "",
  78. // 是否显示弹出层
  79. open: false,
  80. // 查询参数
  81. queryParams: {
  82. pageNum: 1,
  83. pageSize:20,
  84. riskVoice: null,
  85. riskPhone: null,
  86. riskMessage: null,
  87. exitRadio: null,
  88. exitVoice: null,
  89. exitPhone: null,
  90. exitMessage: null
  91. },
  92. };
  93. },
  94. created() {
  95. this.getList();
  96. },
  97. methods: {
  98. upData(){
  99. let self = this;
  100. this.$confirm('是否确定提交?', "警告", {
  101. confirmButtonText: "确定",
  102. cancelButtonText: "取消",
  103. type: "warning"
  104. }).then(function() {
  105. if(self.form.id){
  106. self.putNoticeconfigInfo();
  107. }else{
  108. self.postNoticeconfigInfo();
  109. }
  110. }).then(() => {
  111. }).catch(() => {});
  112. },
  113. postNoticeconfigInfo(){
  114. postNoticeconfigInfo(this.form).then( response => {
  115. this.msgSuccess("操作成功")
  116. this.getList();
  117. });
  118. },
  119. putNoticeconfigInfo(){
  120. putNoticeconfigInfo(this.form).then( response => {
  121. this.msgSuccess("操作成功")
  122. this.getList();
  123. });
  124. },
  125. /** 查询通知配置列表 */
  126. getList() {
  127. this.loading = true;
  128. getNoticeconfigInfo().then( response => {
  129. this.form = response.data;
  130. this.loading = false;
  131. });
  132. },
  133. // 取消按钮
  134. cancel() {
  135. this.open = false;
  136. this.reset();
  137. },
  138. // 表单重置
  139. reset() {
  140. this.form = {
  141. id: null,
  142. riskRadio: null,
  143. riskVoice: null,
  144. riskPhone: null,
  145. riskMessage: null,
  146. };
  147. this.resetForm("form");
  148. },
  149. /** 搜索按钮操作 */
  150. handleQuery() {
  151. this.queryParams.pageNum = 1;
  152. this.getList();
  153. },
  154. /** 重置按钮操作 */
  155. resetQuery() {
  156. this.resetForm("queryForm");
  157. this.handleQuery();
  158. },
  159. // 多选框选中数据
  160. handleSelectionChange(selection) {
  161. this.ids = selection.map(item => item.id)
  162. this.single = selection.length!==1
  163. this.multiple = !selection.length
  164. },
  165. /** 新增按钮操作 */
  166. handleAdd() {
  167. this.reset();
  168. this.open = true;
  169. this.title = "添加通知配置";
  170. },
  171. /** 修改按钮操作 */
  172. handleUpdate(row) {
  173. this.reset();
  174. const id = row.id || this.ids
  175. getNoticeconfig(id).then( response => {
  176. this.form = response.data;
  177. this.open = true;
  178. this.title = "修改通知配置";
  179. });
  180. },
  181. /** 提交按钮 */
  182. submitForm() {
  183. this.$refs["form"].validate(valid => {
  184. if (valid) {
  185. if (this.form.id != null) {
  186. updateNoticeconfig(this.form).then( response => {
  187. this.msgSuccess("修改成功");
  188. this.open = false;
  189. this.getList();
  190. });
  191. } else {
  192. addNoticeconfig(this.form).then( response => {
  193. this.msgSuccess("新增成功");
  194. this.open = false;
  195. this.getList();
  196. });
  197. }
  198. }
  199. });
  200. },
  201. /** 删除按钮操作 */
  202. handleDelete(row) {
  203. const ids = row.id || this.ids;
  204. this.$confirm('是否确认删除通知配置编号为"' + ids + '"的数据项?', "警告", {
  205. confirmButtonText: "确定",
  206. cancelButtonText: "取消",
  207. type: "warning"
  208. }).then(function() {
  209. return delNoticeconfig(ids);
  210. }).then(() => {
  211. this.getList();
  212. this.msgSuccess("删除成功");
  213. }).catch(() => {});
  214. },
  215. /** 导出按钮操作 */
  216. handleExport() {
  217. this.download('laboratory/noticeconfig/export', {
  218. ...this.queryParams
  219. }, `laboratory_noticeconfig.xlsx`)
  220. }
  221. }
  222. };
  223. </script>
  224. <style scoped lang="scss">
  225. .noticeconfig{
  226. display: flex !important;
  227. flex-direction: column;
  228. overflow: hidden;
  229. padding:0 20px 20px!important;
  230. *{
  231. margin:0;
  232. }
  233. .top-title-box{
  234. display: flex;
  235. height:80px;
  236. border-bottom:1px solid #E0E0E0;
  237. margin-bottom:54px;
  238. p:nth-child(1){
  239. line-height:80px;
  240. font-size:18px;
  241. color:#0045AF;
  242. flex:1;
  243. }
  244. p:nth-child(2){
  245. margin-top:20px;
  246. }
  247. }
  248. .form-item-box{
  249. display: inline-block;
  250. margin-bottom:28px;
  251. }
  252. }
  253. </style>