index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="68px"
  9. >
  10. <el-form-item label="" prop="fileName">
  11. <el-input
  12. v-model="queryParams.fileName"
  13. placeholder="请输入文件名称"
  14. clearable
  15. size="small"
  16. @keyup.enter.native="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item label="" prop="createtime">
  20. <el-input
  21. v-model="queryParams.createtime"
  22. placeholder="请输入上传日期"
  23. clearable
  24. size="small"
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item label="" prop="updatetime">
  29. <el-input
  30. v-model="queryParams.updatetime"
  31. placeholder="请输入更新日期"
  32. clearable
  33. size="small"
  34. @keyup.enter.native="handleQuery"
  35. />
  36. </el-form-item>
  37. <el-form-item>
  38. <el-button
  39. type="primary"
  40. size="btn"
  41. @click="handleQuery"
  42. >搜索</el-button
  43. >
  44. <el-button size="btr" @click="resetQuery"
  45. >重置</el-button
  46. >
  47. </el-form-item>
  48. </el-form>
  49. <el-row :gutter="10" class="mb8">
  50. <el-col :span="1.5">
  51. <el-button
  52. type="primary"
  53. plain
  54. icon="el-icon-plus"
  55. size="mini"
  56. @click="handleAdd"
  57. v-hasPermi="['medicalhealth:announcement:add']"
  58. >新增</el-button
  59. >
  60. </el-col>
  61. <el-col :span="1.5">
  62. <el-button
  63. type="success"
  64. plain
  65. icon="el-icon-edit"
  66. size="mini"
  67. :disabled="single"
  68. @click="handleUpdate"
  69. v-hasPermi="['medicalhealth:announcement:edit']"
  70. >修改</el-button
  71. >
  72. </el-col>
  73. <el-col :span="1.5">
  74. <el-button
  75. type="danger"
  76. plain
  77. icon="el-icon-delete"
  78. size="mini"
  79. :disabled="multiple"
  80. @click="handleDelete"
  81. v-hasPermi="['medicalhealth:announcement:remove']"
  82. >删除</el-button
  83. >
  84. </el-col>
  85. <el-col :span="1.5">
  86. <el-button
  87. type="warning"
  88. plain
  89. icon="el-icon-download"
  90. size="mini"
  91. :loading="exportLoading"
  92. @click="handleExport"
  93. v-hasPermi="['medicalhealth:announcement:export']"
  94. >导出</el-button
  95. >
  96. </el-col>
  97. <!-- <right-toolbar
  98. :showSearch.sync="showSearch"
  99. @queryTable="getList"
  100. ></right-toolbar> -->
  101. </el-row>
  102. <el-table
  103. v-loading="loading"
  104. :data="announcementList"
  105. @selection-change="handleSelectionChange"
  106. :header-cell-style="{ background: '#003C69', color: 'white' }"
  107. >
  108. <el-table-column type="selection" width="55" align="center" />
  109. <el-table-column label="更新日期" align="center" prop="id" />
  110. <el-table-column label="文件" align="center" prop="file" />
  111. <el-table-column label="文件名称" align="center" prop="fileName" />
  112. <el-table-column label="上传日期" align="center" prop="createtime" />
  113. <el-table-column label="更新日期" align="center" prop="updatetime" />
  114. <el-table-column
  115. label="操作"
  116. align="center"
  117. class-name="small-padding fixed-width"
  118. >
  119. <template slot-scope="scope">
  120. <el-button
  121. size="btu"
  122. type="text"
  123. @click="handleUpdate(scope.row)"
  124. v-hasPermi="['medicalhealth:announcement:edit']"
  125. >修改</el-button
  126. >
  127. <el-button
  128. size="btd"
  129. type="text"
  130. @click="handleDelete(scope.row)"
  131. v-hasPermi="['medicalhealth:announcement:remove']"
  132. >删除</el-button
  133. >
  134. </template>
  135. </el-table-column>
  136. </el-table>
  137. <pagination
  138. v-show="total > 0"
  139. :total="total"
  140. :page.sync="queryParams.pageNum"
  141. :limit.sync="queryParams.pageSize"
  142. @pagination="getList"
  143. />
  144. <!-- 添加或修改疫情通知公告对话框 -->
  145. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  146. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  147. <el-form-item label="文件">
  148. <fileUpload v-model="form.file" />
  149. </el-form-item>
  150. <el-form-item label="文件名称" prop="fileName">
  151. <el-input v-model="form.fileName" placeholder="请输入文件名称" />
  152. </el-form-item>
  153. </el-form>
  154. <div slot="footer" class="dialog-footer">
  155. <el-button type="primary" @click="submitForm">确 定</el-button>
  156. <el-button @click="cancel">取 消</el-button>
  157. </div>
  158. </el-dialog>
  159. </div>
  160. </template>
  161. <script>
  162. import {
  163. listAnnouncement,
  164. getAnnouncement,
  165. delAnnouncement,
  166. addAnnouncement,
  167. updateAnnouncement,
  168. exportAnnouncement,
  169. } from "@/api/medicalhealth/announcement";
  170. export default {
  171. name: "Announcement",
  172. data() {
  173. return {
  174. // 遮罩层
  175. loading: true,
  176. // 导出遮罩层
  177. exportLoading: false,
  178. // 选中数组
  179. ids: [],
  180. // 非单个禁用
  181. single: true,
  182. // 非多个禁用
  183. multiple: true,
  184. // 显示搜索条件
  185. showSearch: true,
  186. // 总条数
  187. total: 0,
  188. // 疫情通知公告表格数据
  189. announcementList: [],
  190. // 弹出层标题
  191. title: "",
  192. // 是否显示弹出层
  193. open: false,
  194. // 查询参数
  195. queryParams: {
  196. pageNum: 1,
  197. pageSize: 10,
  198. file: null,
  199. fileName: null,
  200. createtime: null,
  201. updatetime: null,
  202. },
  203. // 表单参数
  204. form: {},
  205. // 表单校验
  206. rules: {},
  207. };
  208. },
  209. created() {
  210. this.getList();
  211. },
  212. methods: {
  213. /** 查询疫情通知公告列表 */
  214. getList() {
  215. this.loading = true;
  216. listAnnouncement(this.queryParams).then((response) => {
  217. this.announcementList = response.rows;
  218. this.total = response.total;
  219. this.loading = false;
  220. });
  221. },
  222. // 取消按钮
  223. cancel() {
  224. this.open = false;
  225. this.reset();
  226. },
  227. // 表单重置
  228. reset() {
  229. this.form = {
  230. id: null,
  231. file: null,
  232. fileName: null,
  233. createtime: null,
  234. updatetime: null,
  235. };
  236. this.resetForm("form");
  237. },
  238. /** 搜索按钮操作 */
  239. handleQuery() {
  240. this.queryParams.pageNum = 1;
  241. this.getList();
  242. },
  243. /** 重置按钮操作 */
  244. resetQuery() {
  245. this.resetForm("queryForm");
  246. this.handleQuery();
  247. },
  248. // 多选框选中数据
  249. handleSelectionChange(selection) {
  250. this.ids = selection.map((item) => item.id);
  251. this.single = selection.length !== 1;
  252. this.multiple = !selection.length;
  253. },
  254. /** 新增按钮操作 */
  255. handleAdd() {
  256. this.reset();
  257. this.open = true;
  258. this.title = "添加疫情通知公告";
  259. },
  260. /** 修改按钮操作 */
  261. handleUpdate(row) {
  262. this.reset();
  263. const id = row.id || this.ids;
  264. getAnnouncement(id).then((response) => {
  265. this.form = response.data;
  266. this.open = true;
  267. this.title = "修改疫情通知公告";
  268. });
  269. },
  270. /** 提交按钮 */
  271. submitForm() {
  272. this.$refs["form"].validate((valid) => {
  273. if (valid) {
  274. if (this.form.id != null) {
  275. updateAnnouncement(this.form).then((response) => {
  276. this.msgSuccess("修改成功");
  277. this.open = false;
  278. this.getList();
  279. });
  280. } else {
  281. addAnnouncement(this.form).then((response) => {
  282. this.msgSuccess("新增成功");
  283. this.open = false;
  284. this.getList();
  285. });
  286. }
  287. }
  288. });
  289. },
  290. /** 删除按钮操作 */
  291. handleDelete(row) {
  292. const ids = row.id || this.ids;
  293. this.$confirm("是否确认删除疫情通知公告的数据项?", "警告", {
  294. confirmButtonText: "确定",
  295. cancelButtonText: "取消",
  296. type: "warning",
  297. })
  298. .then(function () {
  299. return delAnnouncement(ids);
  300. })
  301. .then(() => {
  302. this.getList();
  303. this.msgSuccess("删除成功");
  304. })
  305. .catch(() => {});
  306. },
  307. /** 导出按钮操作 */
  308. handleExport() {
  309. const queryParams = this.queryParams;
  310. this.$confirm("是否确认导出所有疫情通知公告数据项?", "警告", {
  311. confirmButtonText: "确定",
  312. cancelButtonText: "取消",
  313. type: "warning",
  314. })
  315. .then(() => {
  316. this.exportLoading = true;
  317. return exportAnnouncement(queryParams);
  318. })
  319. .then((response) => {
  320. this.download(response.msg);
  321. this.exportLoading = false;
  322. })
  323. .catch(() => {});
  324. },
  325. },
  326. };
  327. </script>
  328. <style scoped>
  329. /* 对话框背景颜色 */
  330. ::v-deep .el-dialog {
  331. background: #004d86 !important;
  332. }
  333. ::v-deep .el-textarea__inner {
  334. width: 920px;
  335. height: 104px;
  336. margin: auto;
  337. }
  338. ::v-deep .el-dialog__header {
  339. border-bottom: 1px solid #718a9d;
  340. }
  341. ::v-deep .el-dialog__title {
  342. color: #fff;
  343. font: 18px;
  344. }
  345. ::v-deep .el-dialog__headerbtn .el-dialog__close {
  346. color: #fff;
  347. }
  348. ::v-deep .el-form-item__label {
  349. font: 16px;
  350. color: #fff;
  351. width: 100px !important;
  352. }
  353. ::v-deep .el-input__inner {
  354. /* width: 200px !important;
  355. height: 36px; */
  356. background: transparent;
  357. color: #fff;
  358. border: 1px solid white !important;
  359. }
  360. /* 单位框背景颜色 */
  361. ::v-deep .vue-treeselect__control {
  362. background: #004d86 !important;
  363. }
  364. ::v-deep .el-upload__tip{
  365. color: #bcc5cc !important;
  366. }
  367. </style>