index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="标题" prop="title">
  5. <el-input
  6. v-model="queryParams.title"
  7. placeholder="请输入标题"
  8. clearable
  9. style="width: 240px"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <!-- <el-form-item label="来源" prop="datasourceName">
  14. <el-select v-model="queryParams.datasourceName" placeholder="来源" clearable>
  15. <el-option
  16. v-for="dict in dict.type.sys_yes_no"
  17. :key="dict.value"
  18. :label="dict.label"
  19. :value="dict.value"
  20. />
  21. </el-select>
  22. </el-form-item> -->
  23. <!-- <el-form-item label="时间" prop="docSrcTime">
  24. <el-date-picker
  25. v-model="dateRange"
  26. style="width: 340px"
  27. value-format="yyyy-MM-dd"
  28. type="datetimerange"
  29. range-separator="-"
  30. start-placeholder="开始日期"
  31. end-placeholder="结束日期"
  32. ></el-date-picker>
  33. </el-form-item> -->
  34. <el-form-item>
  35. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  36. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  37. <el-button type="primary" icon="el-icon-s-claim" size="mini" @click="handleGetApplyTpl">获取申请模板</el-button>
  38. <el-button type="primary" icon="el-icon-s-claim" size="mini" @click="handleSubmitApply">提交申请</el-button>
  39. </el-form-item>
  40. </el-form>
  41. <el-row :gutter="10" class="mb8">
  42. <el-col :span="1.5">
  43. <el-button
  44. type="primary"
  45. plain
  46. icon="el-icon-plus"
  47. size="mini"
  48. @click="handleAdd"
  49. v-hasPermi="['system:config:add']"
  50. >新增</el-button>
  51. </el-col>
  52. <el-col :span="1.5">
  53. <el-button
  54. type="success"
  55. plain
  56. icon="el-icon-edit"
  57. size="mini"
  58. :disabled="single"
  59. @click="handleUpdate"
  60. v-hasPermi="['system:config:edit']"
  61. >修改</el-button>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-button
  65. type="danger"
  66. plain
  67. icon="el-icon-delete"
  68. size="mini"
  69. :disabled="multiple"
  70. @click="handleDelete"
  71. v-hasPermi="['system:config:remove']"
  72. >删除</el-button>
  73. </el-col>
  74. <!-- <el-col :span="1.5">
  75. <el-button
  76. type="warning"
  77. plain
  78. icon="el-icon-download"
  79. size="mini"
  80. @click="handleExport"
  81. v-hasPermi="['system:config:export']"
  82. >导出</el-button>
  83. </el-col> -->
  84. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  85. </el-row>
  86. <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
  87. <el-table-column type="selection" width="55" align="center" />
  88. <el-table-column label="姓名" align="center" prop="title" >
  89. <template slot-scope="scope">
  90. <!-- <i class="el-icon el-icon-sort-up" v-if="scope.row.isTop==1"></i> -->
  91. {{scope.row.title}}
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="申请时间" align="center" prop="docSrcTime" width="180">
  95. <template slot-scope="scope">
  96. <span>{{ parseTime(scope.row.docSrcTime) }}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="手机号码" align="center" prop="datasourceName" :show-overflow-tooltip="true" ></el-table-column>
  100. <el-table-column label="单位名称" align="center" prop="content" :show-overflow-tooltip="true" />
  101. <el-table-column label="简述" align="center" prop="url" :show-overflow-tooltip="true" />
  102. <el-table-column label="申请时间" align="center" prop="docSrcTime" width="180">
  103. <template slot-scope="scope">
  104. <span>{{ parseTime(scope.row.docSrcTime) }}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="审核状态" align="center" prop="pageViewNum" :show-overflow-tooltip="true" />
  108. <el-table-column label="处理时间" align="center" prop="pageViewNum" :show-overflow-tooltip="true" />
  109. <el-table-column label="审核备注" align="center" prop="pageViewNum" :show-overflow-tooltip="true" />
  110. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  111. <template slot-scope="scope">
  112. <el-button
  113. size="mini"
  114. type="text"
  115. icon="el-icon-edit"
  116. @click="handleLook(scope.row)"
  117. v-hasPermi="['system:config:edit']"
  118. >查看</el-button>
  119. <el-button
  120. size="mini"
  121. type="text"
  122. icon="el-icon-edit"
  123. @click="handleUpdate(scope.row)"
  124. v-hasPermi="['system:config:edit']"
  125. >修改</el-button>
  126. <el-button
  127. size="mini"
  128. type="text"
  129. icon="el-icon-delete"
  130. @click="handleDelete(scope.row)"
  131. v-hasPermi="['system:config:remove']"
  132. >删除</el-button>
  133. <el-button
  134. size="mini"
  135. type="text"
  136. icon="el-icon-edit"
  137. @click="handleUpdateViewNum(scope.row)"
  138. v-hasPermi="['system:config:edit']"
  139. >编辑浏览量</el-button>
  140. </template>
  141. </el-table-column>
  142. </el-table>
  143. <pagination
  144. v-show="total>0"
  145. :total="total"
  146. :page.sync="queryParams.pageNo"
  147. :limit.sync="queryParams.pageSize"
  148. @pagination="getList"
  149. />
  150. <!-- 添加或修改参数配置对话框 -->
  151. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :fullscreen="true">
  152. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  153. <el-form-item label="是否住院" prop="status">
  154. <el-select v-model="form.status" placeholder="是否住院" clearable @change="changeShifouInhospital">
  155. <el-option
  156. v-for="dict in dict.type.sys_yes_no"
  157. :key="dict.value"
  158. :label="dict.label"
  159. :value="dict.value"
  160. />
  161. </el-select>
  162. </el-form-item>
  163. <el-form-item label="标题" prop="title" v-if="form.status=='Y'">
  164. <el-input v-model="form.title" placeholder="请输入标题" />
  165. </el-form-item>
  166. <!-- <el-form-item label="来源" prop="datasourceName">
  167. <el-input v-model="form.datasourceName" placeholder="请输入来源" />
  168. </el-form-item> -->
  169. <el-form-item label="文章时间" prop="docSrcTime" v-if="form.status=='Y'">
  170. <el-date-picker
  171. type="datetime"
  172. v-model="form.docSrcTime"
  173. style="width: 240px"
  174. value-format="yyyy-MM-dd HH:mm:ss"
  175. placeholder="请选择发布时间"
  176. ></el-date-picker>
  177. </el-form-item>
  178. <el-form-item label="地址" prop="url" v-if="form.status=='Y'">
  179. <el-input v-model="form.url" placeholder="请输入地址" />
  180. </el-form-item>
  181. <el-form-item label="内容" prop="content" v-if="form.status=='Y'">
  182. <editor v-model="form.content" :min-height="292"/>
  183. </el-form-item>
  184. <el-form-item label="排序" v-if="form.status=='Y'">
  185. <el-input-number v-model="form.orderNum" controls-position="right" :min="1" :max="10000"></el-input-number>
  186. </el-form-item>
  187. </el-form>
  188. <div slot="footer" class="dialog-footer">
  189. <el-button type="primary" @click="submitForm">确 定</el-button>
  190. <el-button @click="cancel">取 消</el-button>
  191. </div>
  192. </el-dialog>
  193. <el-dialog title="获取申请模板" :visible.sync="openApplyTpl" width="800px" append-to-body >
  194. <el-form ref="formViewNum" :model="formApplyTpl" :rules="rules" label-width="120px">
  195. <el-form-item label="所患疾病" prop="status">
  196. <el-select v-model="formApplyTpl.status" placeholder="所患疾病" clearable>
  197. <el-option
  198. v-for="dict in dict.type.sys_normal_disable"
  199. :key="dict.value"
  200. :label="dict.label"
  201. :value="dict.value"
  202. />
  203. </el-select>
  204. </el-form-item>
  205. <el-form-item label="个人外网邮箱" prop="title">
  206. <el-input v-model="formApplyTpl.pageViewNum" placeholder="请输入个人外网邮箱" />
  207. </el-form-item>
  208. </el-form>
  209. <div slot="footer" class="dialog-footer">
  210. <el-button type="primary" @click="submitFormViewNum">确 定</el-button>
  211. <el-button @click="cancelApplyTpl">取 消</el-button>
  212. </div>
  213. </el-dialog>
  214. <el-drawer
  215. title="查看"
  216. :visible.sync="drawer"
  217. direction="rtl" size='50%'>
  218. <div style="margin:20px;">
  219. <div><h2>{{form.title}}</h2></div>
  220. <div style="color:#666;margin-top: 20px;font-size:12px;">来源地址:{{form.url}}</div>
  221. <div style="margin-top: 20px;" v-html="form.content"></div>
  222. </div>
  223. </el-drawer>
  224. </div>
  225. </template>
  226. <script>
  227. import { list, getConfig, del, add, update, refreshCache, updateViewNum, addViewNum } from "@/api/business/inhospital";
  228. export default {
  229. name: "Config",
  230. dicts: ['sys_yes_no','sys_normal_disable'],
  231. data() {
  232. return {
  233. // 遮罩层
  234. loading: true,
  235. // 选中数组
  236. ids: [],
  237. // 非单个禁用
  238. single: true,
  239. // 非多个禁用
  240. multiple: true,
  241. // 显示搜索条件
  242. showSearch: true,
  243. // 总条数
  244. total: 0,
  245. // 参数表格数据
  246. configList: [],
  247. // 弹出层标题
  248. title: "",
  249. // 是否显示弹出层
  250. open: false,
  251. openApplyTpl:false,
  252. drawer: false,
  253. // 日期范围
  254. dateRange: [],
  255. // 查询参数
  256. queryParams: {
  257. pageIndex: 1,
  258. pageSize: 10,
  259. title: undefined,
  260. datasourceName: undefined
  261. },
  262. // 表单参数
  263. form: {
  264. // isTop: '0',
  265. // orderNum: '0',
  266. docId: null,
  267. url: '',
  268. content: ''
  269. },
  270. // 表单校验
  271. rules: {
  272. title: [
  273. { required: true, message: "标题不能为空", trigger: "blur" }
  274. ],
  275. // url: [
  276. // { required: true, message: "来源地址不能为空", trigger: "blur" }
  277. // ],
  278. docSrcTime: [
  279. { required: true, message: "时间不能为空", trigger: "blur" }
  280. ]
  281. ,
  282. content: [
  283. { required: true, message: "内容不能为空", trigger: "blur" }
  284. ]
  285. },
  286. formApplyTpl:{
  287. pageViewNum: null,
  288. docId: null
  289. }
  290. };
  291. },
  292. created() {
  293. this.getList();
  294. // this.form = {
  295. // title: '测试',
  296. // url: 'www.baidu.com',
  297. // content: '<p><b>aaaaa</b></p>'
  298. // }
  299. },
  300. methods: {
  301. changeShifouInhospital(val){
  302. if(val == 'Y'){
  303. }else{
  304. this.$alert('对符合慰问条件,患本办法规定范围内的38种指定重大疾病且每年首次住院的工会会员,给予一次性2000元慰问金,对每年首次因其他疾病住院的工会会员给予500元慰问金。', '说明', {
  305. confirmButtonText: '确定',
  306. callback: action => {
  307. }
  308. });
  309. }
  310. },
  311. handleSubmitApply(){
  312. this.open = true;
  313. },
  314. /** 查询参数列表 */
  315. getList() {
  316. this.loading = true;
  317. list(this.queryParams).then(response => {
  318. this.configList = response.rows;
  319. this.total = response.count;
  320. this.loading = false;
  321. }
  322. );
  323. },
  324. // 取消按钮
  325. cancel() {
  326. this.open = false;
  327. this.reset();
  328. },
  329. // 表单重置
  330. reset() {
  331. this.form = {
  332. docId: undefined,
  333. title: undefined,
  334. url: undefined,
  335. content: undefined,
  336. // isTop: '0',
  337. // orderNum: '0'
  338. };
  339. this.resetForm("form");
  340. },
  341. handleGetApplyTpl(){
  342. this.openApplyTpl = true;
  343. },
  344. /** 搜索按钮操作 */
  345. handleQuery() {
  346. this.queryParams.pageNo = 1;
  347. this.getList();
  348. },
  349. /** 重置按钮操作 */
  350. resetQuery() {
  351. this.dateRange = [];
  352. this.resetForm("queryForm");
  353. this.handleQuery();
  354. },
  355. /** 新增按钮操作 */
  356. handleAdd() {
  357. this.reset();
  358. this.open = true;
  359. this.title = "添加文章";
  360. },
  361. // 多选框选中数据
  362. handleSelectionChange(selection) {
  363. this.ids = selection.map(item => item.configId)
  364. this.single = selection.length!=1
  365. this.multiple = !selection.length
  366. },
  367. /** 修改按钮操作 */
  368. handleUpdate(row) {
  369. this.reset();
  370. const configId = row.docId
  371. // getDetail(configId).then(response => {
  372. // this.form = response.data;
  373. this.form = row;
  374. this.open = true;
  375. this.title = "修改文章";
  376. // });
  377. },
  378. handleLook(row){
  379. this.drawer = true;
  380. this.form =row;
  381. addViewNum({
  382. docId: row.docId
  383. }).then(res=>{
  384. console.log('增加文章阅读量:', res)
  385. })
  386. },
  387. submitFormViewNum(){
  388. this.$refs["formViewNum"].validate(valid => {
  389. if (valid) {
  390. if (this.form.docId != undefined) {
  391. updateViewNum(this.formViewNum).then(response => {
  392. this.$modal.msgSuccess("修改成功");
  393. this.openViewNum = false;
  394. this.getList();
  395. });
  396. }
  397. }
  398. });
  399. },
  400. cancelApplyTpl(){
  401. this.openApplyTpl = false;
  402. this.formApplyTpl.docId = null;
  403. this.formApplyTpl.pageViewNum = null;
  404. },
  405. /** 提交按钮 */
  406. submitForm: function() {
  407. this.$refs["form"].validate(valid => {
  408. if (valid) {
  409. if (this.form.docId != undefined) {
  410. update(this.form).then(response => {
  411. this.$modal.msgSuccess("修改成功");
  412. this.open = false;
  413. this.getList();
  414. });
  415. } else {
  416. add(this.form).then(response => {
  417. this.$modal.msgSuccess("新增成功");
  418. this.open = false;
  419. this.getList();
  420. });
  421. }
  422. }
  423. });
  424. },
  425. /** 删除按钮操作 */
  426. handleDelete(row) {
  427. // const configIds = row.id || this.ids;
  428. this.$modal.confirm('是否确认删除该条记录?').then(function() {
  429. return del({
  430. docId: row.docId
  431. });
  432. }).then(() => {
  433. this.getList();
  434. this.$modal.msgSuccess("删除成功");
  435. }).catch(() => {});
  436. },
  437. /** 导出按钮操作 */
  438. handleExport() {
  439. this.download('system/config/export', {
  440. ...this.queryParams
  441. }, `config_${new Date().getTime()}.xlsx`)
  442. },
  443. /** 刷新缓存按钮操作 */
  444. handleRefreshCache() {
  445. refreshCache().then(() => {
  446. this.$modal.msgSuccess("刷新成功");
  447. });
  448. }
  449. }
  450. };
  451. </script>