index.vue 10 KB

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