index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
  4. <el-form-item label="年份" prop="year">
  5. <el-date-picker clearable
  6. v-model="queryParams.year"
  7. type="year"
  8. value-format="yyyy"
  9. placeholder="请选择年份">
  10. </el-date-picker>
  11. </el-form-item>
  12. <el-form-item label="涉及code" prop="questionnaireId">
  13. <el-input
  14. v-model="queryParams.questionnaireId"
  15. placeholder="请输入涉及code"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="负责人" prop="personInCharge">
  21. <el-select clearable v-model="queryParams.personInCharge" placeholder="请选择负责人"
  22. @keyup.enter.native="handleQuery">
  23. <el-option
  24. v-for="dict in userOptions"
  25. :key="dict.dictValue"
  26. :label="dict.dictLabel"
  27. :value="dict.dictValue"
  28. ></el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item label="装置" prop="deptId">
  32. <el-select clearable v-model="queryParams.deptId" placeholder="请选择装置">
  33. <el-option
  34. v-for="dict in deptOptions"
  35. :key="dict.dictValue"
  36. :label="dict.dictLabel"
  37. :value="dict.dictValue"
  38. ></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  43. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  44. </el-form-item>
  45. </el-form>
  46. <el-row :gutter="10" class="mb8">
  47. <el-col :span="1.5">
  48. <el-button
  49. type="primary"
  50. plain
  51. icon="el-icon-plus"
  52. size="mini"
  53. @click="handleAdd"
  54. v-hasPermi="['rc:meeting:add']"
  55. >新增</el-button>
  56. </el-col>
  57. <el-col :span="1.5">
  58. <el-button
  59. type="success"
  60. plain
  61. icon="el-icon-edit"
  62. size="mini"
  63. :disabled="single"
  64. @click="handleUpdate"
  65. v-hasPermi="['rc:meeting:edit']"
  66. >修改</el-button>
  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="['rc:meeting:remove']"
  77. >删除</el-button>
  78. </el-col>
  79. <el-col :span="1.5">
  80. <el-button
  81. type="warning"
  82. plain
  83. icon="el-icon-download"
  84. size="mini"
  85. @click="handleExport"
  86. v-hasPermi="['rc:meeting:export']"
  87. >导出</el-button>
  88. </el-col>
  89. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  90. </el-row>
  91. <el-table border v-loading="loading" :data="meetingList" @selection-change="handleSelectionChange">
  92. <el-table-column type="selection" width="55" align="center" />
  93. <el-table-column label="装置" align="center" prop="deptName" width="120" />
  94. <el-table-column label="年份" align="center" prop="year" width="120">
  95. <template slot-scope="scope">
  96. <span>{{ parseTime(scope.row.year, '{y}') }}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="涉及code" align="center" prop="questionnaireId" width="100" />
  100. <el-table-column label="负责人" align="center" prop="personInChargeName" width="100" />
  101. <el-table-column label="备注" align="center" prop="remarks" />
  102. <el-table-column label="定期会议纪要" align="center" width="120" fixed="right">
  103. <template slot-scope="scope">
  104. <el-button icon="el-icon-folder" style="color:#6e96fa;" circle @click="handleDoc(scope.row , 'meeting-record')"></el-button>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="会议行动清单" align="center" width="120" fixed="right">
  108. <template slot-scope="scope">
  109. <el-button icon="el-icon-folder" style="color:#6e96fa;" circle @click="handleDoc(scope.row , 'meeting-actionlist')"></el-button>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="操作" align="center" width="180" fixed="right" class-name="small-padding fixed-width">
  113. <template slot-scope="scope">
  114. <el-button
  115. size="mini"
  116. type="text"
  117. icon="el-icon-edit"
  118. @click="handleUpdate(scope.row)"
  119. v-hasPermi="['rc:meeting:edit']"
  120. >修改</el-button>
  121. <el-button
  122. size="mini"
  123. type="text"
  124. icon="el-icon-delete"
  125. @click="handleDelete(scope.row)"
  126. v-hasPermi="['rc:meeting:remove']"
  127. >删除</el-button>
  128. </template>
  129. </el-table-column>
  130. </el-table>
  131. <pagination
  132. v-show="total>0"
  133. :total="total"
  134. :page.sync="queryParams.pageNum"
  135. :limit.sync="queryParams.pageSize"
  136. @pagination="getList"
  137. />
  138. <!-- 添加或修改会议对话框 -->
  139. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  140. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  141. <el-form-item label="年份" prop="year">
  142. <el-date-picker clearable
  143. v-model="form.year"
  144. type="year"
  145. value-format="yyyy"
  146. placeholder="请选择年份">
  147. </el-date-picker>
  148. </el-form-item>
  149. <el-form-item label="涉及code" prop="questionnaireId">
  150. <el-input v-model="form.questionnaireId" placeholder="请输入涉及code" />
  151. </el-form-item>
  152. <el-form-item label="负责人" prop="personInCharge">
  153. <el-select clearable v-model="form.personInCharge" placeholder="请选择负责人">
  154. <el-option
  155. v-for="dict in userOptions"
  156. :key="dict.dictValue"
  157. :label="dict.dictLabel"
  158. :value="dict.dictValue"
  159. ></el-option>
  160. </el-select>
  161. </el-form-item>
  162. <el-form-item label="备注" prop="remarks">
  163. <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" />
  164. </el-form-item>
  165. <el-form-item label="装置" prop="deptId">
  166. <el-select clearable multiple v-model="form.deptId" placeholder="请选择装置">
  167. <el-option
  168. v-for="dict in deptOptions"
  169. :key="dict.dictValue"
  170. :label="dict.dictLabel"
  171. :value="dict.dictValue"
  172. ></el-option>
  173. </el-select>
  174. </el-form-item>
  175. </el-form>
  176. <div slot="footer" class="dialog-footer">
  177. <el-button type="primary" @click="submitForm">确 定</el-button>
  178. <el-button @click="cancel">取 消</el-button>
  179. </div>
  180. </el-dialog>
  181. <!-- 附件对话框 -->
  182. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="800px" append-to-body >
  183. <el-upload ref="doc"
  184. :limit="50"
  185. :headers="doc.headers"
  186. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  187. :disabled="doc.isUploading"
  188. :on-progress="handleFileDocProgress"
  189. :on-success="handleFileDocSuccess"
  190. :auto-upload="true"
  191. drag
  192. >
  193. <i class="el-icon-upload"></i>
  194. <div class="el-upload__text">
  195. 将文件拖到此处,或
  196. <em>点击上传</em>
  197. </div>
  198. </el-upload>
  199. <el-table :data="doc.commonfileList" border>
  200. <el-table-column label="文件名" align="center" prop="fileName" :show-overflow-tooltip="true">
  201. <template slot-scope="scope">
  202. <a class="link-type" @click="handleDownload(scope.row)">
  203. <span>{{ scope.row.fileName }}</span>
  204. </a>
  205. </template>
  206. </el-table-column>
  207. <el-table-column label="大小(Kb)" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  208. <el-table-column label="上传人" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  209. <el-table-column label="操作" align="center" width="220" class-name="small-padding fixed-width">
  210. <template slot-scope="scope">
  211. <el-button
  212. size="mini"
  213. type="text"
  214. icon="el-icon-download"
  215. @click="handleDownload(scope.row)"
  216. >下载</el-button>
  217. <el-button
  218. size="mini"
  219. type="text"
  220. icon="el-icon-delete"
  221. @click="handleDeleteDoc(scope.row)"
  222. >删除</el-button>
  223. </template>
  224. </el-table-column>
  225. </el-table>
  226. </el-dialog>
  227. </div>
  228. </template>
  229. <script>
  230. import { listMeeting, getMeeting, delMeeting, addMeeting, updateMeeting } from "@/api/rc/meeting";
  231. import { listDept } from "@/api/system/dept";
  232. import { listAllUser } from "@/api/system/user";
  233. import { getToken } from "@/utils/auth";
  234. import { addCommonfile, allFileList, delCommonfile, updateCommonfile } from "@/api/rc/commonfile";
  235. export default {
  236. name: "Meeting",
  237. data() {
  238. return {
  239. // 遮罩层
  240. loading: true,
  241. // 选中数组
  242. ids: [],
  243. // 非单个禁用
  244. single: true,
  245. // 非多个禁用
  246. multiple: true,
  247. // 显示搜索条件
  248. showSearch: true,
  249. // 总条数
  250. total: 0,
  251. // 会议表格数据
  252. meetingList: [],
  253. // 弹出层标题
  254. title: "",
  255. // 是否显示弹出层
  256. open: false,
  257. // 查询参数
  258. queryParams: {
  259. pageNum: 1,
  260. pageSize: 10,
  261. year: null,
  262. questionnaireId: null,
  263. personInCharge: null,
  264. remarks: null,
  265. deptId: null
  266. },
  267. // 表单参数
  268. form: {},
  269. // 表单校验
  270. rules: {
  271. },
  272. // 装置列表
  273. deptOptions: [],
  274. // 用户列表
  275. userOptions: [],
  276. // 附件参数
  277. doc: {
  278. file: "",
  279. // 是否显示弹出层(报告附件)
  280. open: false,
  281. // 弹出层标题(报告附件)
  282. title: "附件",
  283. // 是否禁用上传
  284. isUploading: false,
  285. // 是否更新已经存在的用户数据
  286. updateSupport: 0,
  287. // 报告附件上传位置编号
  288. ids: 0,
  289. // 设置上传的请求头部
  290. headers: { Authorization: "Bearer " + getToken() },
  291. // 上传的地址
  292. url: process.env.VUE_APP_BASE_API + "/rc/commonfile/uploadFile",
  293. commonfileList: null,
  294. queryParams: {
  295. pId: null,
  296. pType: ''
  297. },
  298. pType: '',
  299. pId: null,
  300. form: {}
  301. },
  302. };
  303. },
  304. created() {
  305. this.getList();
  306. this.getDeptList();
  307. this.getUserList();
  308. },
  309. methods: {
  310. /** 附件按钮操作 */
  311. handleDoc(row , type) {
  312. var typeName = "";
  313. if (type === "meeting-record"){
  314. typeName = "定期会议纪要";
  315. } else if (type === "meeting-actionlist"){
  316. typeName = "会议行动清单";
  317. }
  318. this.doc.pType = type
  319. this.doc.queryParams.pType = type
  320. this.doc.id = row.id;
  321. this.doc.title = typeName;
  322. this.doc.open = true;
  323. this.doc.queryParams.pId = row.id
  324. this.doc.pId = row.id
  325. this.getFileList();
  326. },
  327. getFileList(){
  328. allFileList(this.doc.queryParams).then(response => {
  329. this.doc.commonfileList = response;
  330. });
  331. },
  332. //附件上传中处理
  333. handleFileDocProgress(event, file, fileList) {
  334. this.doc.file = file;
  335. this.doc.isUploading = true;
  336. },
  337. //附件上传成功处理
  338. handleFileDocSuccess(response, file, fileList) {
  339. this.doc.isUploading = false;
  340. this.$alert(response.msg, '导入结果', { dangerouslyUseHTMLString: true });
  341. this.getFileList()
  342. },
  343. // 文件下载处理
  344. handleDownload(row) {
  345. var name = row.fileName;
  346. var url = row.fileUrl;
  347. var suffix = url.substring(url.lastIndexOf("."), url.length);
  348. const a = document.createElement('a')
  349. a.setAttribute('download', name)
  350. a.setAttribute('target', '_blank')
  351. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  352. a.click()
  353. },
  354. /** 删除按钮操作 */
  355. handleDeleteDoc(row) {
  356. const ids = row.id || this.ids;
  357. this.$confirm('是否确认删除?', '警告', {
  358. confirmButtonText: '确定',
  359. cancelButtonText: '取消',
  360. type: "warning"
  361. }).then(function() {
  362. return delCommonfile(ids);
  363. }).then(() => {
  364. this.getFileList()
  365. this.$message({
  366. message: '删除成功',
  367. type: 'success'
  368. });
  369. })
  370. },
  371. /** 查询用户列表 */
  372. getUserList() {
  373. listAllUser().then(response => {
  374. let data = response.data;
  375. for (let i = 0; i < data.length; i++) {
  376. // 非顶级节点
  377. if (data[i].parentId !== 0) {
  378. // 插入装置列表
  379. this.userOptions.push({"dictLabel": data[i].nickName, "dictValue": data[i].userId});
  380. }
  381. }
  382. });
  383. },
  384. /** 查询会议列表 */
  385. getList() {
  386. this.loading = true;
  387. listMeeting(this.queryParams).then(response => {
  388. console.log(response)
  389. this.meetingList = response.rows;
  390. this.total = response.total;
  391. this.loading = false;
  392. });
  393. },
  394. /** 查询装置列表 */
  395. getDeptList() {
  396. listDept().then(response => {
  397. let data = response.data;
  398. for (let i = 0; i < data.length; i++) {
  399. // 非顶级节点
  400. if (data[i].parentId !== 0) {
  401. // 插入装置列表
  402. this.deptOptions.push({"dictLabel": data[i].deptName, "dictValue": data[i].deptId});
  403. }
  404. }
  405. });
  406. },
  407. // 取消按钮
  408. cancel() {
  409. this.open = false;
  410. this.reset();
  411. },
  412. // 表单重置
  413. reset() {
  414. this.form = {
  415. id: null,
  416. year: null,
  417. questionnaireId: null,
  418. personInCharge: null,
  419. remarks: null,
  420. deptId: null
  421. };
  422. this.resetForm("form");
  423. },
  424. /** 搜索按钮操作 */
  425. handleQuery() {
  426. this.queryParams.pageNum = 1;
  427. this.getList();
  428. },
  429. /** 重置按钮操作 */
  430. resetQuery() {
  431. this.resetForm("queryForm");
  432. this.handleQuery();
  433. },
  434. // 多选框选中数据
  435. handleSelectionChange(selection) {
  436. this.ids = selection.map(item => item.id)
  437. this.single = selection.length!==1
  438. this.multiple = !selection.length
  439. },
  440. /** 新增按钮操作 */
  441. handleAdd() {
  442. this.reset();
  443. this.open = true;
  444. this.title = "添加会议";
  445. },
  446. /** 修改按钮操作 */
  447. handleUpdate(row) {
  448. this.reset();
  449. const id = row.id || this.ids
  450. getMeeting(id).then(response => {
  451. // 字符串转数组
  452. if (response.data.deptId != null && response.data.deptId != "") {
  453. response.data.deptId = response.data.deptId.split(",").map(Number);
  454. } else {
  455. response.data.deptId = [];
  456. }
  457. this.form = response.data;
  458. this.open = true;
  459. this.title = "修改会议";
  460. });
  461. },
  462. /** 提交按钮 */
  463. submitForm() {
  464. this.$refs["form"].validate(valid => {
  465. if (valid) {
  466. // 数组转字符串
  467. if (this.form.deptId != null) {
  468. this.form.deptId = this.form.deptId.toString();
  469. }
  470. if (this.form.id != null) {
  471. updateMeeting(this.form).then(response => {
  472. this.$modal.msgSuccess("修改成功");
  473. this.open = false;
  474. this.getList();
  475. });
  476. } else {
  477. addMeeting(this.form).then(response => {
  478. this.$modal.msgSuccess("新增成功");
  479. this.open = false;
  480. this.getList();
  481. });
  482. }
  483. }
  484. });
  485. },
  486. /** 删除按钮操作 */
  487. handleDelete(row) {
  488. const ids = row.id || this.ids;
  489. this.$modal.confirm('是否确认删除会议编号为"' + ids + '"的数据项?').then(function() {
  490. return delMeeting(ids);
  491. }).then(() => {
  492. this.getList();
  493. this.$modal.msgSuccess("删除成功");
  494. }).catch(() => {});
  495. },
  496. /** 导出按钮操作 */
  497. handleExport() {
  498. this.download('rc/meeting/export', {
  499. ...this.queryParams
  500. }, `meeting_${new Date().getTime()}.xlsx`)
  501. }
  502. }
  503. };
  504. </script>