当前位置:   article > 正文

el-select option数据太多 优化_el-option数组数据量大

el-option数组数据量大

el-select 多选:  --- 数据是数组

  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. size="small"
  7. :inline="true"
  8. v-show="showSearch"
  9. label-width="68px"
  10. >
  11. <el-form-item label="主题" prop="title">
  12. <el-input
  13. v-model="queryParams.title"
  14. placeholder="请输入警示教育主题"
  15. clearable
  16. @keyup.enter.native="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item label="数据来源" prop="origin">
  20. <el-input
  21. v-model="queryParams.origin"
  22. placeholder="请输入数据来源"
  23. clearable
  24. @keyup.enter.native="handleQuery"
  25. />
  26. </el-form-item>
  27. <!-- <el-form-item label="审核状态" prop="status">
  28. <el-select
  29. v-model="queryParams.status"
  30. placeholder="审核状态"
  31. clearable
  32. style="width: 240px"
  33. >
  34. <el-option
  35. v-for="dict in dict.type.status"
  36. :key="dict.value"
  37. :label="dict.label"
  38. :value="dict.value"
  39. />
  40. </el-select>
  41. </el-form-item>-->
  42. <el-form-item>
  43. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  44. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  45. </el-form-item>
  46. </el-form>
  47. <el-row :gutter="10" class="mb8">
  48. <el-col :span="1.5">
  49. <el-button
  50. type="primary"
  51. plain
  52. icon="el-icon-plus"
  53. size="mini"
  54. @click="handleAdd"
  55. v-hasPermi="['party:warning:add']"
  56. >新增</el-button>
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="success"
  61. plain
  62. icon="el-icon-edit"
  63. size="mini"
  64. :disabled="single"
  65. @click="handleUpdate"
  66. v-hasPermi="['party:warning:edit']"
  67. >修改</el-button>
  68. </el-col>
  69. <el-col :span="1.5">
  70. <el-button
  71. type="danger"
  72. plain
  73. icon="el-icon-delete"
  74. size="mini"
  75. :disabled="multiple"
  76. @click="handleDelete"
  77. v-hasPermi="['party:warning:remove']"
  78. >删除</el-button>
  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. @click="handleExport"
  87. v-hasPermi="['party:warning:export']"
  88. >导出</el-button>
  89. </el-col>
  90. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  91. </el-row>
  92. <el-table v-loading="loading" :data="warningList" @selection-change="handleSelectionChange">
  93. <el-table-column type="selection" width="55" align="center" />
  94. <el-table-column label="主题" align="center" prop="title" />
  95. <el-table-column label="数据来源" align="center" prop="origin" />
  96. <el-table-column label="开展组织名称" align="center" prop="orgName" />
  97. <el-table-column label="参加人员" align="center" prop="unionUserName" />
  98. <el-table-column label="开展时间" align="center" prop="developTime" />
  99. <el-table-column label="学习教育覆盖率" align="center" prop="cover" />
  100. <el-table-column label="附件" align="center" prop="fileName">
  101. <template slot-scope="scope">
  102. <span class="span-text" v-if="scope.row.filePath !== undefined">
  103. <div
  104. v-for="(item, index) in scope.row.fileName"
  105. :key="index"
  106. style="color: red;cursor: pointer;"
  107. @click="handleDownloadTable(item, scope.row.filePath.split(',')[index] )"
  108. >{{ item}}</div>
  109. </span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="超级链接" align="center" prop="hyperLink" />
  113. <!-- <el-table-column label="审核状态" align="center" prop="status">
  114. <template slot-scope="scope">
  115. <dict-tag :options="dict.type.status" :value="scope.row.status" />
  116. </template>
  117. </el-table-column>-->
  118. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  119. <template slot-scope="scope">
  120. <el-button
  121. size="mini"
  122. type="text"
  123. icon="el-icon-edit"
  124. @click="openDetail(scope.row, true)"
  125. v-hasPermi="['party:warning:query']"
  126. >查看详情</el-button>
  127. <el-button
  128. v-if="scope.row.createdBy == userId"
  129. size="mini"
  130. type="text"
  131. icon="el-icon-edit"
  132. @click="handleUpdate(scope.row, false)"
  133. v-hasPermi="['party:warning:edit']"
  134. >修改</el-button>
  135. <el-button
  136. v-if="scope.row.createdBy == userId"
  137. size="mini"
  138. type="text"
  139. icon="el-icon-delete"
  140. @click="handleDelete(scope.row)"
  141. v-hasPermi="['party:warning:remove']"
  142. >删除</el-button>
  143. <el-button
  144. size="mini"
  145. type="text"
  146. icon="el-icon-lock"
  147. @click="handleAssignPermissions(scope.row)"
  148. v-hasPermi="['party:feedback:distribution']"
  149. >分配权限</el-button>
  150. <el-button
  151. size="mini"
  152. type="text"
  153. icon="el-icon-lock"
  154. v-if="
  155. scope.row.feedBackStatus != null &&
  156. scope.row.feedBackStatus == '0' &&
  157. scope.row.createdBy != userId"
  158. @click="handleFeedback(scope.row)"
  159. v-hasPermi="['party:feedback:feedback']"
  160. >反馈</el-button>
  161. <!-- <el-button
  162. v-if="scope.row.status == 2 || scope.row.status == 3|| scope.row.status == 4"
  163. size="mini"
  164. type="text"
  165. icon="el-icon-view"
  166. @click="handleWarning(scope.row)"
  167. v-hasPermi="['party:warning:getWarningDetail']"
  168. >查看进度</el-button>
  169. <el-button
  170. v-if="
  171. scope.row.status == 1 ||
  172. scope.row.status == 4
  173. "
  174. size="mini"
  175. type="text"
  176. icon="el-icon-edit"
  177. @click="handleSubmitReview(scope.row)"
  178. v-hasPermi="['party:warning:submit']"
  179. >提交审核</el-button>-->
  180. </template>
  181. </el-table-column>
  182. </el-table>
  183. <pagination
  184. v-show="total>0"
  185. :total="total"
  186. :page.sync="queryParams.pageNum"
  187. :limit.sync="queryParams.pageSize"
  188. @pagination="getList"
  189. />
  190. <!-- 添加或修改党风廉政建设及反腐败工作_警示教育对话框 -->
  191. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  192. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  193. <el-form-item label="主题" prop="title">
  194. <el-input v-model="form.title" placeholder="请输入主题" />
  195. </el-form-item>
  196. <!-- <el-form-item label="教育名称" prop="name">
  197. <el-input v-model="form.name" placeholder="请输入警示教育名称" />
  198. </el-form-item>-->
  199. <el-form-item label="数据来源" prop="origin" v-if="form.origin!=null">
  200. <el-input v-model="form.origin" placeholder="请输入数据来源" disabled />
  201. </el-form-item>
  202. <el-form-item label="开展组织名称" prop="orgId">
  203. <treeselect
  204. v-model="form.orgId"
  205. :options="deptOptions"
  206. :show-count="true"
  207. placeholder="请选择组织"
  208. />
  209. </el-form-item>
  210. <el-form-item label="参加人员" prop="unionUserId">
  211. <el-select
  212. v-model="form.unionUserId"
  213. placeholder="请选择人员"
  214. filterable
  215. clearable
  216. multiple
  217. style="width:100%"
  218. :filter-method="userFilter"
  219. >
  220. <el-option
  221. v-for="dict in renderOption"
  222. :key="dict.userId"
  223. :label="dict.label"
  224. :value="dict.userId"
  225. />
  226. </el-select>
  227. </el-form-item>
  228. <el-form-item label="开展时间" prop="developTime">
  229. <el-date-picker
  230. clearable
  231. v-model="form.developTime"
  232. type="date"
  233. value-format="yyyy-MM-dd"
  234. placeholder="请选择开展时间"
  235. ></el-date-picker>
  236. </el-form-item>
  237. <el-form-item label="学习教育覆盖率" prop="cover">
  238. <el-input v-model="form.cover" placeholder="请输入学习教育覆盖率" />
  239. </el-form-item>
  240. <el-form-item label="附件" prop="filePath">
  241. <file-upload v-model="form.filePath" />
  242. </el-form-item>
  243. <el-form-item label="超级链接" prop="hyperLink">
  244. <el-input v-model="form.hyperLink" placeholder="请输入超级链接" />
  245. </el-form-item>
  246. <el-form-item label="教育概况" prop="overview">
  247. <editor v-model="form.overview" :min-height="192" :read-only="true" />
  248. </el-form-item>
  249. </el-form>
  250. <div slot="footer" class="dialog-footer">
  251. <el-button type="primary" @click="submitForm">确 定</el-button>
  252. <el-button @click="cancel">取 消</el-button>
  253. </div>
  254. </el-dialog>
  255. <!-- 查看警示教育对话框 -->
  256. <warning-dialog
  257. :detail="detail"
  258. :dialogTitle="title"
  259. :detailId="detailId"
  260. @dialogChange="dialogChange"
  261. @handleDetail="handleDetail"
  262. ></warning-dialog>
  263. <!-- <el-dialog :title="title" :visible.sync="detail" width="800px" append-to-body>
  264. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  265. <el-form-item label="主题:" prop="title">
  266. <span style="text-decoration: underline">{{form.title}}</span>
  267. </el-form-item>
  268. <el-form-item label="数据来源:" prop="title">
  269. <span style="text-decoration: underline">{{form.origin}}</span>
  270. </el-form-item>
  271. <el-form-item label="开展组织名称:" prop="orgName">
  272. <span style="text-decoration: underline">{{form.orgName}}</span>
  273. </el-form-item>
  274. <el-form-item label="参加人员:" prop="unionUserName">
  275. <span style="text-decoration: underline">{{form.unionUserName}}</span>
  276. </el-form-item>
  277. <el-form-item label="开展时间:" prop="developTime">
  278. <span style="text-decoration: underline">{{form.developTime}}</span>
  279. </el-form-item>
  280. <el-form-item label="学习教育覆盖率:" prop="cover">
  281. <span style="text-decoration: underline">{{form.cover}}</span>
  282. </el-form-item>
  283. <el-form-item label="文件上传" prop="filePath">
  284. <file-upload v-model="form.filePath" :disabled="detail == true" />
  285. </el-form-item>
  286. <el-form-item label="超级链接:" prop="hyperLink">
  287. <span style="text-decoration: underline">{{form.hyperLink}}</span>
  288. </el-form-item>
  289. <el-form-item label="概况:" prop="overview">
  290. <editor v-model="form.overview" :min-height="192" />
  291. </el-form-item>
  292. </el-form>
  293. <div slot="footer" class="dialog-footer">
  294. <el-button @click="cancelDetail">取 消</el-button>
  295. </div>
  296. </el-dialog>-->
  297. <el-dialog title="查看流程进度" :visible.sync="timelineOpen" width="800px" append-to-body>
  298. <el-timeline :reverse="false">
  299. <el-timeline-item
  300. v-for="(activity, index) in activities"
  301. :key="index"
  302. :timestamp="activity.timestamp"
  303. :color="activity.color"
  304. placement="top"
  305. >
  306. <el-card>
  307. <h4 v-if="activity.type == 'startEvent'">流程开始:{{ activity.content }}</h4>
  308. <h4 v-else-if="activity.type == 'userTask'">流程审核:{{ activity.content }}</h4>
  309. <h4 v-else-if="activity.type == 'endEvent'">流程结束:{{ activity.content }}</h4>
  310. <h4 v-else>其他流程:{{ activity.content }}</h4>
  311. <p v-if="activity.operator !== '' && activity.operator !== undefined">
  312. <template
  313. v-if="
  314. activity.finishTime !== '' &&
  315. activity.finishTime !== undefined
  316. "
  317. >于 {{ activity.finishTime }}, {{ activity.operator }}</template>
  318. <template v-else>{{ activity.operator }} 处理中</template>
  319. </p>
  320. <p v-else-if="activity.type == 'userTask'">等待审核</p>
  321. <p v-else>{{ activity.timestamp }}</p>
  322. </el-card>
  323. </el-timeline-item>
  324. </el-timeline>
  325. </el-dialog>
  326. <!-- 分配权限开始 -->
  327. <el-dialog title="分配权限" :visible.sync="assignPermissions" width="1200px" append-to-body>
  328. <div class="el-dialog-div">
  329. <assign-permissions
  330. ref="assignPermissions"
  331. :key="assignPermissionsKey"
  332. :newId="newId"
  333. :menuName="menuName"
  334. :title="title"
  335. :byBranchGetTreeUrl="byBranchGetTreeUrl"
  336. :byBranchGetallotUrl="byBranchGetallotUrl"
  337. :byBranchGetAlreadyAllotUrl="byBranchGetAlreadyAllotUrl"
  338. :byBranchSaveDataUrl="byBranchSaveDataUrl"
  339. :byRoleGetTreeUrl="byRoleGetTreeUrl"
  340. :byRoleGetallotUrl="byRoleGetallotUrl"
  341. :byRoleGetAlreadyAllotUrl="byRoleGetAlreadyAllotUrl"
  342. :byRoleSaveDataUrl="byRoleSaveDataUrl"
  343. @closeAssignPermissions="closeAssignPermissions"
  344. ></assign-permissions>
  345. </div>
  346. <span slot="footer" class="dialog-footer">
  347. <el-button @click="assignPermissions = false">取 消</el-button>
  348. <el-button type="primary" @click="handleSaveBtn()">保 存</el-button>
  349. </span>
  350. </el-dialog>
  351. <!-- 分配权限结束 -->
  352. <!-- 反馈开始 -->
  353. <el-dialog title="反馈" :visible.sync="feedbackDialogVisible" width="800px" append-to-body>
  354. <el-row>
  355. <el-form label-width="80px">
  356. <el-form-item label="标题:">{{ feedbackTitle }}</el-form-item>
  357. <el-form-item label="反馈内容:">
  358. <el-input type="textarea" :rows="6" v-model="feedBackContent"></el-input>
  359. </el-form-item>
  360. </el-form>
  361. </el-row>
  362. <span slot="footer" class="dialog-footer">
  363. <el-button @click="feedbackDialogVisible = false">取 消</el-button>
  364. <el-button type="primary" @click="handleFeedbackSaveBtn()">保 存</el-button>
  365. </span>
  366. </el-dialog>
  367. <!-- 反馈结束 -->
  368. </div>
  369. </template>
  370. <script>
  371. import {
  372. listWarning,
  373. getWarning,
  374. delWarning,
  375. addWarning,
  376. updateWarning,
  377. getWarningDetail,
  378. submitContent
  379. } from "@/api/party/dflz/warning";
  380. import { downloadFile, postSaveData } from "@/api/common/common";
  381. import { mapState } from "vuex";
  382. import { getAllUser, getAllUserNew } from "@/api/system/user";
  383. import { treeselect } from "@/api/system/dept";
  384. import Treeselect from "@riophae/vue-treeselect";
  385. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  386. export default {
  387. name: "Warning",
  388. dicts: ["status"],
  389. components: { Treeselect },
  390. computed: {
  391. ...mapState({
  392. userId: state => state.user.userId
  393. })
  394. },
  395. data() {
  396. return {
  397. renderOption: [],
  398. // 遮罩层
  399. loading: true,
  400. // 选中数组
  401. ids: [],
  402. // 非单个禁用
  403. single: true,
  404. // 非多个禁用
  405. multiple: true,
  406. // 显示搜索条件
  407. showSearch: true,
  408. // 总条数
  409. total: 0,
  410. // 部门树选项
  411. deptOptions: undefined,
  412. //用户列表
  413. userList: [],
  414. // 党风廉政建设及反腐败工作_警示教育表格数据
  415. warningList: [],
  416. //流程进度列表
  417. activities: [],
  418. detailId: 0,
  419. // 时间线显示
  420. timelineOpen: false,
  421. // 弹出层标题
  422. title: "",
  423. // 是否显示弹出层
  424. open: false,
  425. // 是否显示弹出层
  426. detail: false,
  427. // 查询参数
  428. queryParams: {
  429. pageNum: 1,
  430. pageSize: 10,
  431. name: null,
  432. createdAt: null,
  433. updatedAt: null
  434. },
  435. // 表单参数
  436. form: {},
  437. // 表单校验
  438. rules: {
  439. name: [
  440. { required: true, message: "警示教育名称不能为空", trigger: "blur" }
  441. ],
  442. filePath: [
  443. { required: true, message: "警示教育文件不能为空", trigger: "blur" }
  444. ]
  445. },
  446. //分配权限开始
  447. assignPermissionsKey: false, //组件强制重新加载 避免重置
  448. //1按部门分配
  449. assignPermissions: false, //弹框显示 隐藏
  450. newId: 0,
  451. byBranchGetTreeUrl: "/party/feedback/getTree", //部门左侧树形部门 接口地址
  452. byBranchGetallotUrl: "/party/feedback/listUserByDeptId", //可分配权限用户查询接口
  453. byBranchGetAlreadyAllotUrl: "/party/feedback/getUserList", //已分配用户 查询接口
  454. byBranchSaveDataUrl: "/party/feedback/distribution", //保存接口
  455. //2 按角色分配
  456. allotRolesKey: false,
  457. allotRoles: false,
  458. byRoleGetTreeUrl: "/party/feedback/getAllRole", //左侧 获取所有角色 接口地址
  459. byRoleGetallotUrl: "/party/feedback/listUserByRoleId", //可分配权限用户查询接口
  460. byRoleGetAlreadyAllotUrl: "/party/feedback/getUserList", //已分配用户 查询接口
  461. byRoleSaveDataUrl: "/party/feedback/distribution", //保存接口
  462. //分配权限结束
  463. //反馈开始
  464. feedbackTitle: "", //弹窗上面显示的标题
  465. feedbackDialogVisible: false, //弹窗显示和隐藏
  466. feedbackNewId: 0, //反馈新闻id
  467. feedBackContent: "" //反馈内容
  468. //反馈结束
  469. };
  470. },
  471. created() {
  472. this.getList();
  473. this.getTreeselect();
  474. this.getAllUser();
  475. this.myPageTitle = this.$route.meta.title + "";
  476. this.menuName = this.$route.meta.title + "";
  477. },
  478. methods: {
  479. /** 查询党风廉政建设及反腐败工作_警示教育列表 */
  480. getList() {
  481. this.loading = true;
  482. listWarning(this.queryParams).then(response => {
  483. this.warningList = response.rows;
  484. this.total = response.total;
  485. this.loading = false;
  486. });
  487. },
  488. // 取消按钮
  489. cancel() {
  490. this.open = false;
  491. this.reset();
  492. },
  493. // 取消详情按钮
  494. cancelDetail() {
  495. this.detail = false;
  496. this.reset();
  497. },
  498. // 表单重置
  499. reset() {
  500. this.form = {
  501. id: null,
  502. name: null,
  503. title: null,
  504. filePath: null,
  505. createdBy: null,
  506. createdAt: null,
  507. updatedBy: null,
  508. updatedAt: null,
  509. orgId: null,
  510. orgName: null,
  511. developTime: null,
  512. unionUserId: null,
  513. unionUserName: null
  514. };
  515. this.resetForm("form");
  516. },
  517. /** 搜索按钮操作 */
  518. handleQuery() {
  519. this.queryParams.pageNum = 1;
  520. this.getList();
  521. },
  522. /** 重置按钮操作 */
  523. resetQuery() {
  524. this.resetForm("queryForm");
  525. this.handleQuery();
  526. },
  527. // 多选框选中数据
  528. handleSelectionChange(selection) {
  529. this.ids = selection.map(item => item.id);
  530. this.single = selection.length !== 1;
  531. this.multiple = !selection.length;
  532. },
  533. /** 新增按钮操作 */
  534. handleAdd() {
  535. this.reset();
  536. this.getTreeselect();
  537. this.getAllUser();
  538. this.open = true;
  539. this.title = "添加警示教育";
  540. },
  541. /** 修改按钮操作 */
  542. handleUpdate(row) {
  543. this.reset();
  544. this.getTreeselect();
  545. this.getAllUser();
  546. const id = row.id || this.ids;
  547. getWarning(id).then(response => {
  548. if (response.data.unionUserId) {
  549. response.data.unionUserId = response.data.unionUserId
  550. .split(",")
  551. .map(Number);
  552. }
  553. this.form = response.data;
  554. this.open = true;
  555. this.title = "修改警示教育";
  556. });
  557. },
  558. dialogChange(val) {
  559. this.detail = val;
  560. },
  561. /** 打开详情按钮操作 */
  562. openDetail(row) {
  563. this.detail = true;
  564. this.detailId = row.id;
  565. },
  566. /** 查看详情按钮操作 */
  567. handleDetail(detail, form) {
  568. this.detail = detail;
  569. this.form = form;
  570. },
  571. // handleDetail(row) {
  572. // this.reset();
  573. // const id = row.id || this.ids;
  574. // getWarning(id).then(response => {
  575. // this.form = response.data;
  576. // this.detail = true;
  577. // this.title = "查看警示教育";
  578. // });
  579. // },
  580. /** 查询部门下拉树结构 */
  581. getTreeselect() {
  582. treeselect().then(response => {
  583. this.deptOptions = response.data;
  584. });
  585. },
  586. getAllUser() {
  587. // getAllUser().then(response => {
  588. getAllUserNew().then(response => {
  589. this.userList = response.data;
  590. this.userFilter();
  591. });
  592. },
  593. userFilter(query = "") {
  594. let arr = this.userList.filter(item => {
  595. return item.label.includes(query);
  596. });
  597. // console.log(arr.length," arr.length arr.length")
  598. if (arr.length > 500) {
  599. this.renderOption = arr.slice(0, 500);
  600. } else {
  601. this.renderOption = arr;
  602. }
  603. let array = this.form.unionUserId;
  604. if (array && array.length > 0) {
  605. this.addOptions(array);
  606. }
  607. // console.log(this.renderOption,"this.renderOptionthis.renderOptionthis.renderOption")
  608. },
  609. addOptions(array) {
  610. array.forEach(item => {
  611. let str = this.renderOption.some(t => item === t.userId);
  612. if (!str) {
  613. let arr = this.userList.filter(ele => {
  614. return ele.userId === item;
  615. });
  616. this.renderOption = arr.concat(this.renderOption);
  617. // console.log(arr, "arr2arr2arr2arr2arr2arr2");
  618. }
  619. });
  620. },
  621. /** 提交按钮 */
  622. submitForm() {
  623. const { unionUserId, ...rest } = this.form;
  624. const params = {
  625. unionUserId: unionUserId.join(","),
  626. ...rest
  627. };
  628. this.$refs["form"].validate(valid => {
  629. if (valid) {
  630. if (this.form.id != null) {
  631. updateWarning(params).then(response => {
  632. this.$modal.msgSuccess("修改成功");
  633. this.open = false;
  634. this.getList();
  635. });
  636. } else {
  637. addWarning(params).then(response => {
  638. this.$modal.msgSuccess("新增成功");
  639. this.open = false;
  640. this.getList();
  641. });
  642. }
  643. }
  644. });
  645. },
  646. /** 删除按钮操作 */
  647. handleDelete(row) {
  648. const ids = row.id || this.ids;
  649. this.$modal
  650. .confirm(
  651. '是否确认删除党风廉政建设及反腐败工作_警示教育编号为"' +
  652. ids +
  653. '"的数据项?'
  654. )
  655. .then(function() {
  656. return delWarning(ids);
  657. })
  658. .then(() => {
  659. this.getList();
  660. this.$modal.msgSuccess("删除成功");
  661. })
  662. .catch(() => {});
  663. },
  664. /** 导出按钮操作 */
  665. handleExport() {
  666. this.download(
  667. "party/dflz/warning/export",
  668. {
  669. ...this.queryParams
  670. },
  671. `warning_${new Date().getTime()}.xlsx`
  672. );
  673. },
  674. /** 文件下载 */
  675. handleDownload(row) {
  676. const url = row.filePath;
  677. const name = row.fileName;
  678. downloadFile({ resource: url }).then(res => {
  679. let href = window.URL.createObjectURL(new Blob([res])); // 根据后端返回的url对应的文件流创建URL对象
  680. const link = document.createElement("a"); //创建一个隐藏的a标签
  681. link.style.display = "none";
  682. link.href = href; //设置下载的url
  683. link.download = name; //设置下载的文件名
  684. document.body.appendChild(link);
  685. link.click();
  686. document.body.removeChild(link);
  687. window.URL.revokeObjectURL(href); // 释放掉blob对象
  688. });
  689. },
  690. /** 表格列表文件下载 */
  691. handleDownloadTable(name, url) {
  692. downloadFile({ resource: url }).then(res => {
  693. let href = window.URL.createObjectURL(new Blob([res])); // 根据后端返回的url对应的文件流创建URL对象
  694. const link = document.createElement("a"); //创建一个隐藏的a标签
  695. link.style.display = "none";
  696. link.href = href; //设置下载的url
  697. link.download = name; //设置下载的文件名
  698. document.body.appendChild(link);
  699. link.click();
  700. document.body.removeChild(link);
  701. window.URL.revokeObjectURL(href); // 释放掉blob对象
  702. });
  703. },
  704. handleWarning(row) {
  705. getWarningDetail(row.id).then(response => {
  706. this.activities = response.data;
  707. this.timelineOpen = true;
  708. });
  709. },
  710. /** 提交审核 */
  711. handleSubmitReview(row) {
  712. const pageTitle = this.$route.meta.title;
  713. const fullPath = this.$route.fullPath.replaceAll("/", "");
  714. const id = row.id || this.ids;
  715. console.log(fullPath);
  716. this.$modal
  717. .confirm("是否确认提交审核")
  718. .then(function() {
  719. return submitContent(id, pageTitle, fullPath);
  720. })
  721. .then(() => {
  722. this.getList();
  723. this.$modal.msgSuccess("提交审核成功");
  724. })
  725. .catch(() => {});
  726. },
  727. //分配权限 开始
  728. //分配权限 打开弹窗
  729. handleAssignPermissions(row) {
  730. this.assignPermissions = true;
  731. this.assignPermissionsKey = !this.assignPermissionsKey;
  732. this.newId = row.id;
  733. this.title = row.title;
  734. },
  735. //分配权限 点击保存按钮
  736. handleSaveBtn() {
  737. this.$refs.assignPermissions.submitData();
  738. },
  739. // 分配权限 保存成功之后 孙组件调用 关闭弹窗
  740. closeAssignPermissions() {
  741. this.assignPermissions = false;
  742. },
  743. //分配权限 结束
  744. //反馈开始
  745. //反馈打开弹窗
  746. handleFeedback(row) {
  747. this.feedbackDialogVisible = true;
  748. this.feedbackNewId = row.id;
  749. this.feedbackTitle = row.title;
  750. this.feedBackContent = "";
  751. },
  752. //反馈 点击保存按钮
  753. handleFeedbackSaveBtn() {
  754. let url = "/party/feedback/feedback";
  755. let obj = {};
  756. obj.feedBackContent = this.feedBackContent;
  757. obj.name = this.menuName;
  758. obj.newId = this.feedbackNewId;
  759. postSaveData(url, obj).then(res => {
  760. if (res.code === 200) {
  761. this.$message({
  762. message: "保存成功",
  763. type: "success"
  764. });
  765. this.feedbackDialogVisible = false;
  766. this.getList();
  767. } else {
  768. this.$message({
  769. message: "保存失败,请确认",
  770. type: "warning"
  771. });
  772. }
  773. });
  774. }
  775. //反馈结束
  776. }
  777. };
  778. </script>

el-select 单选:  数据是字符串或者number类型

  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. size="small"
  7. :inline="true"
  8. v-show="showSearch"
  9. label-width="68px"
  10. >
  11. <el-form-item label="称号" prop="title">
  12. <el-input
  13. v-model="queryParams.title"
  14. placeholder="请输入称号"
  15. clearable
  16. @keyup.enter.native="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item label="姓名" prop="name">
  20. <el-input
  21. v-model="queryParams.name"
  22. placeholder="请输入姓名"
  23. clearable
  24. @keyup.enter.native="handleQuery"
  25. />
  26. </el-form-item>
  27. <el-form-item label="组织" prop="organizationName">
  28. <el-input
  29. v-model="queryParams.organizationName"
  30. placeholder="请输入组织"
  31. clearable
  32. @keyup.enter.native="handleQuery"
  33. />
  34. </el-form-item>
  35. <el-form-item label="授予单位" prop="grantCompany">
  36. <el-input
  37. v-model="queryParams.grantCompany"
  38. placeholder="请输入授予单位"
  39. clearable
  40. @keyup.enter.native="handleQuery"
  41. />
  42. </el-form-item>
  43. <el-form-item label="行政级别" prop="grantCompanyLevel">
  44. <el-select
  45. v-model="queryParams.grantCompanyLevel"
  46. placeholder="请选择授予单位行政级别"
  47. clearable
  48. style="width: 240px"
  49. >
  50. <el-option
  51. v-for="dict in dict.type.grant_company_level"
  52. :key="dict.value"
  53. :label="dict.label"
  54. :value="dict.value"
  55. />
  56. </el-select>
  57. </el-form-item>
  58. <!-- <el-form-item label="数据来源" prop="origin">
  59. <el-input
  60. v-model="queryParams.origin"
  61. placeholder="请输入数据来源"
  62. clearable
  63. @keyup.enter.native="handleQuery"/>
  64. </el-form-item>-->
  65. <!-- <el-form-item label="单位" prop="organization">
  66. <el-input
  67. v-model="queryParams.organization"
  68. placeholder="请输入单位"
  69. clearable
  70. @keyup.enter.native="handleQuery"
  71. />
  72. </el-form-item>
  73. -->
  74. <!-- <el-form-item label="审核状态" prop="status">
  75. <el-select
  76. v-model="queryParams.status"
  77. placeholder="审核状态"
  78. clearable
  79. style="width: 240px"
  80. >
  81. <el-option
  82. v-for="dict in dict.type.status"
  83. :key="dict.value"
  84. :label="dict.label"
  85. :value="dict.value"
  86. />
  87. </el-select>
  88. </el-form-item>-->
  89. <el-form-item>
  90. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  91. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  92. </el-form-item>
  93. </el-form>
  94. <el-row :gutter="10" class="mb8">
  95. <el-col :span="1.5">
  96. <el-button
  97. type="primary"
  98. plain
  99. icon="el-icon-plus"
  100. size="mini"
  101. @click="handleAdd"
  102. v-hasPermi="['party:record:add']"
  103. >新增</el-button>
  104. </el-col>
  105. <el-col :span="1.5">
  106. <el-button
  107. type="success"
  108. plain
  109. icon="el-icon-edit"
  110. size="mini"
  111. :disabled="single"
  112. @click="handleUpdate"
  113. v-hasPermi="['party:record:edit']"
  114. >修改</el-button>
  115. </el-col>
  116. <el-col :span="1.5">
  117. <el-button
  118. type="danger"
  119. plain
  120. icon="el-icon-delete"
  121. size="mini"
  122. :disabled="multiple"
  123. @click="handleDelete"
  124. v-hasPermi="['party:record:remove']"
  125. >删除</el-button>
  126. </el-col>
  127. <el-col :span="1.5">
  128. <el-button
  129. type="warning"
  130. plain
  131. icon="el-icon-download"
  132. size="mini"
  133. @click="handleExport"
  134. v-hasPermi="['party:record:export']"
  135. >导出</el-button>
  136. </el-col>
  137. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  138. </el-row>
  139. <el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
  140. <el-table-column type="selection" width="55" align="center" />
  141. <el-table-column label="称号" align="center" prop="title" />
  142. <el-table-column label="姓名" align="center" prop="name" />
  143. <el-table-column label="组织" align="center" prop="organizationName" />
  144. <el-table-column label="授予单位" align="center" prop="grantCompany" />
  145. <el-table-column label="授予单位行政级别" align="center" prop="grantCompanyLevel">
  146. <template slot-scope="scope">
  147. <dict-tag :options="dict.type.grant_company_level" :value="scope.row.grantCompanyLevel" />
  148. </template>
  149. </el-table-column>
  150. <el-table-column label="附件" align="center" prop="fileName">
  151. <template slot-scope="scope">
  152. <span class="span-text" v-if="scope.row.file !== undefined">
  153. <div
  154. v-for="(item, index) in scope.row.fileName"
  155. :key="index"
  156. style="color: red;cursor: pointer;"
  157. @click="handleDownloadTable(item, scope.row.file.split(',')[index] )"
  158. >{{ item}}</div>
  159. </span>
  160. </template>
  161. </el-table-column>
  162. <!-- <el-table-column label="数据来源" align="center" prop="origin" />
  163. <el-table-column label="审核状态" align="center" prop="status" >
  164. <template slot-scope="scope">
  165. <dict-tag :options="dict.type.status" :value="scope.row.status"/>
  166. </template>
  167. </el-table-column>
  168. -->
  169. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  170. <template slot-scope="scope">
  171. <el-button
  172. size="mini"
  173. type="text"
  174. icon="el-icon-edit"
  175. @click="handleDetail(scope.row, true)"
  176. v-hasPermi="['party:record:query']"
  177. >查看详情</el-button>
  178. <el-button
  179. size="mini"
  180. type="text"
  181. icon="el-icon-edit"
  182. @click="handleUpdate(scope.row,false)"
  183. v-hasPermi="['party:record:edit']"
  184. >修改</el-button>
  185. <el-button
  186. size="mini"
  187. type="text"
  188. icon="el-icon-delete"
  189. @click="handleDelete(scope.row)"
  190. v-hasPermi="['party:record:remove']"
  191. >删除</el-button>
  192. <!-- <el-button
  193. v-if="scope.row.status == 2 || scope.row.status == 3|| scope.row.status == 4"
  194. size="mini"
  195. type="text"
  196. icon="el-icon-view"
  197. @click="handleRecord(scope.row)"
  198. v-hasPermi="['party:record:getRecordDetail']"
  199. >查看进度</el-button>
  200. <el-button
  201. v-if="scope.row.status == 1 || scope.row.status == 4"
  202. size="mini"
  203. type="text"
  204. icon="el-icon-edit"
  205. @click="handleSubmitReview(scope.row)"
  206. v-hasPermi="['party:record:submit']"
  207. >提交审核</el-button>-->
  208. <el-button
  209. size="mini"
  210. type="text"
  211. icon="el-icon-upload2"
  212. @click="handleIsTop(scope.row)"
  213. v-if="scope.$index != 0 || queryParams.pageNum != 1"
  214. v-hasPermi="['party:record:isTop']"
  215. >置顶</el-button>
  216. </template>
  217. </el-table-column>
  218. </el-table>
  219. <pagination
  220. v-show="total>0"
  221. :total="total"
  222. :page.sync="queryParams.pageNum"
  223. :limit.sync="queryParams.pageSize"
  224. @pagination="getList"
  225. />
  226. <!-- 添加或修改表彰记录信息对话框 -->
  227. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  228. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  229. <el-form-item label="称号" prop="title">
  230. <el-input v-model="form.title" placeholder="请输入称号" />
  231. </el-form-item>
  232. <!-- <el-form-item label="姓名" prop="name">
  233. <el-input v-model="form.name" placeholder="请输入姓名" />
  234. </el-form-item>-->
  235. <el-form-item label="人员" prop="name">
  236. <el-select
  237. v-model="form.unionUserId"
  238. placeholder="请选择人员"
  239. filterable
  240. clearable
  241. style="width:100%"
  242. :filter-method="userFilter"
  243. >
  244. <el-option
  245. v-for="dict in renderOption"
  246. :key="dict.userId"
  247. :label="dict.label"
  248. :value="dict.userId"
  249. />
  250. </el-select>
  251. </el-form-item>
  252. <el-form-item label="部门" prop="department">
  253. <el-input v-model="form.department" placeholder="请输入部门" />
  254. </el-form-item>
  255. <el-form-item label="授予单位" prop="grantCompany">
  256. <el-input v-model="form.grantCompany" placeholder="请输入授予单位" />
  257. </el-form-item>
  258. <el-form-item label="行政级别" prop="grantCompanyLevel">
  259. <el-select
  260. v-model="form.grantCompanyLevel"
  261. placeholder="请选择授予单位行政级别"
  262. filterable
  263. clearable
  264. >
  265. <el-option
  266. v-for="dict in dict.type.grant_company_level"
  267. :key="dict.value"
  268. :label="dict.label"
  269. :value="dict.value"
  270. />
  271. </el-select>
  272. </el-form-item>
  273. <el-form-item label="组织" prop="organization">
  274. <treeselect
  275. v-model="form.organization"
  276. :options="deptOptions"
  277. :show-count="true"
  278. placeholder="请选择组织"
  279. />
  280. </el-form-item>
  281. <el-form-item label="附件">
  282. <file-upload v-model="form.file" />
  283. </el-form-item>
  284. <el-form-item label="数据来源" prop="origin" v-if="form.origin!=null">
  285. <el-input v-model="form.origin" placeholder="请输入数据来源" disabled />
  286. </el-form-item>
  287. </el-form>
  288. <div slot="footer" class="dialog-footer">
  289. <el-button type="primary" @click="submitForm">确 定</el-button>
  290. <el-button @click="cancel">取 消</el-button>
  291. </div>
  292. </el-dialog>
  293. <!-- 查看政治轮训对话框 -->
  294. <el-dialog :title="title" :visible.sync="detail" width="500px" append-to-body>
  295. <look-details :detailId="detailId" />
  296. <div slot="footer" class="dialog-footer">
  297. <el-button @click="cancelDetail">关 闭</el-button>
  298. </div>
  299. </el-dialog>
  300. <el-dialog title="查看流程进度" :visible.sync="timelineOpen" width="800px" append-to-body>
  301. <el-timeline :reverse="false">
  302. <el-timeline-item
  303. v-for="(activity, index) in activities"
  304. :key="index"
  305. :timestamp="activity.timestamp"
  306. :color="activity.color"
  307. placement="top"
  308. >
  309. <el-card>
  310. <h4 v-if="activity.type =='startEvent'">流程开始:{{activity.content}}</h4>
  311. <h4 v-else-if="activity.type =='userTask'">流程审核:{{activity.content}}</h4>
  312. <h4 v-else-if="activity.type =='endEvent'">流程结束:{{activity.content}}</h4>
  313. <h4 v-else>其他流程:{{activity.content}}</h4>
  314. <p v-if="activity.operator !=='' && activity.operator !== undefined">
  315. <template
  316. v-if="activity.finishTime !== '' && activity.finishTime !== undefined"
  317. >于 {{activity.finishTime}}, {{activity.operator}}</template>
  318. <template v-else>{{activity.operator}} 处理中</template>
  319. </p>
  320. <p v-else-if="activity.type =='userTask'">等待审核</p>
  321. <p v-else>{{activity.timestamp}}</p>
  322. </el-card>
  323. </el-timeline-item>
  324. </el-timeline>
  325. </el-dialog>
  326. </div>
  327. </template>
  328. <script>
  329. import {
  330. listRecord,
  331. getRecord,
  332. delRecord,
  333. addRecord,
  334. updateRecord,
  335. getRecordDetail,
  336. submitContent
  337. } from "@/api/party/culture/record";
  338. import { listAllUser, getAllUserNew } from "@/api/system/user";
  339. import { downloadFile } from "@/api/common/common";
  340. import { treeselect } from "@/api/system/dept";
  341. import Treeselect from "@riophae/vue-treeselect";
  342. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  343. import { IsTop } from "@/api/common/common";
  344. import lookDetails from "./components/LookDetails";
  345. export default {
  346. name: "Record",
  347. dicts: ["status", "grant_company_level"],
  348. components: { Treeselect, lookDetails },
  349. data() {
  350. return {
  351. renderOption: [],
  352. detailId: 0,
  353. // 遮罩层
  354. loading: true,
  355. // 选中数组
  356. ids: [],
  357. // 非单个禁用
  358. single: true,
  359. // 非多个禁用
  360. multiple: true,
  361. // 显示搜索条件
  362. showSearch: true,
  363. // 总条数
  364. total: 0,
  365. // 部门树选项
  366. deptOptions: undefined,
  367. //用户列表
  368. userList: [],
  369. // 表彰记录信息表格数据
  370. recordList: [],
  371. //流程进度列表
  372. activities: [],
  373. // 时间线显示
  374. timelineOpen: false,
  375. // 弹出层标题
  376. title: "",
  377. // 是否显示弹出层
  378. open: false,
  379. detail: false,
  380. // 查询参数
  381. queryParams: {
  382. pageNum: 1,
  383. pageSize: 10,
  384. title: null,
  385. name: null,
  386. image: null,
  387. file: null,
  388. content: null,
  389. status: null,
  390. reviewComment: null,
  391. processInstanceId: null,
  392. organization: null,
  393. department: null,
  394. grantCompany: null,
  395. grantCompanyLevel: null
  396. },
  397. // 表单参数
  398. form: {},
  399. // 表单校验
  400. rules: {
  401. title: [{ required: true, message: "请输入称号", trigger: "blur" }],
  402. organization: [
  403. { required: true, message: "请输入组织", trigger: "blur" }
  404. ]
  405. }
  406. };
  407. },
  408. created() {
  409. this.getList();
  410. this.getTreeselect();
  411. this.getAllUser();
  412. },
  413. methods: {
  414. // 置顶
  415. handleIsTop(row) {
  416. // console.log(row, "rrrrrrrrrrrrrrrrr");
  417. let id = row.id;
  418. // /dev-api/party/record/updateIsTop/{id}/{isTop}
  419. let url = "/party/record/updateIsTop";
  420. IsTop(url, id).then(response => {
  421. if (response.code === 200) {
  422. this.getList();
  423. }
  424. });
  425. },
  426. /** 查询表彰记录信息列表 */
  427. getList() {
  428. this.loading = true;
  429. listRecord(this.queryParams).then(response => {
  430. this.recordList = response.rows;
  431. this.total = response.total;
  432. this.loading = false;
  433. });
  434. },
  435. // 取消按钮
  436. cancel() {
  437. this.open = false;
  438. this.reset();
  439. },
  440. // 表单重置
  441. reset() {
  442. this.form = {
  443. id: null,
  444. title: null,
  445. unionUserId: null,
  446. image: null,
  447. file: null,
  448. content: null,
  449. status: 0,
  450. reviewComment: null,
  451. createBy: null,
  452. createTime: null,
  453. updateBy: null,
  454. updateTime: null,
  455. delFlag: null,
  456. processInstanceId: null,
  457. organization: null,
  458. department: null,
  459. grantCompany: null,
  460. grantCompanyLevel: null
  461. };
  462. this.resetForm("form");
  463. },
  464. /** 搜索按钮操作 */
  465. handleQuery() {
  466. this.queryParams.pageNum = 1;
  467. this.getList();
  468. },
  469. /** 重置按钮操作 */
  470. resetQuery() {
  471. this.resetForm("queryForm");
  472. this.handleQuery();
  473. },
  474. /** 查询部门下拉树结构 */
  475. getTreeselect() {
  476. treeselect().then(response => {
  477. this.deptOptions = response.data;
  478. });
  479. },
  480. getAllUser() {
  481. // listAllUser().then(response => {
  482. getAllUserNew().then(response => {
  483. this.userList = response.data;
  484. this.userFilter();
  485. });
  486. },
  487. userFilter(query = "") {
  488. let arr = this.userList.filter(item => {
  489. return item.label.includes(query);
  490. });
  491. if (arr.length > 500) {
  492. this.renderOption = arr.slice(0, 5);
  493. } else {
  494. this.renderOption = arr;
  495. }
  496. let str = this.form.unionUserId;
  497. if (str) {
  498. this.addOptions(str);
  499. }
  500. },
  501. addOptions(item) {
  502. let str = this.renderOption.some(t => item === t.userId);
  503. let arr = [];
  504. if (!str) {
  505. arr = this.userList.filter(ele => {
  506. return ele.userId === item;
  507. });
  508. this.renderOption = arr.concat(this.renderOption);
  509. }
  510. },
  511. // 多选框选中数据
  512. handleSelectionChange(selection) {
  513. this.ids = selection.map(item => item.id);
  514. this.single = selection.length !== 1;
  515. this.multiple = !selection.length;
  516. },
  517. /** 新增按钮操作 */
  518. handleAdd() {
  519. this.reset();
  520. this.getTreeselect();
  521. this.getAllUser();
  522. this.open = true;
  523. this.title = "添加表彰奖励";
  524. },
  525. /** 修改按钮操作 */
  526. handleUpdate(row) {
  527. this.getTreeselect();
  528. this.getAllUser();
  529. this.reset();
  530. const id = row.id || this.ids;
  531. getRecord(id).then(response => {
  532. this.form = response.data;
  533. console.log(
  534. this.form,
  535. "66666666666666this.formthis.formthis.formthis.form"
  536. );
  537. this.open = true;
  538. this.title = "修改表彰奖励";
  539. });
  540. },
  541. /** 查看详情按钮操作 */
  542. handleDetail(row) {
  543. this.reset();
  544. this.detail = true;
  545. this.title = "查看表彰奖励";
  546. this.detailId = row.id;
  547. // const id = row.id || this.ids;
  548. // getRecord(id).then(response => {
  549. // this.form = response.data;
  550. // this.detail = true;
  551. // this.title = "查看表彰奖励";
  552. // });
  553. },
  554. // 取消详情按钮
  555. cancelDetail() {
  556. this.detail = false;
  557. //this.reset();
  558. },
  559. /** 提交按钮 */
  560. submitForm() {
  561. console.log(this.form, "999999999999999999999999");
  562. this.$refs["form"].validate(valid => {
  563. if (valid) {
  564. if (this.form.id != null) {
  565. updateRecord(this.form).then(response => {
  566. this.$modal.msgSuccess("修改成功");
  567. this.open = false;
  568. this.detailId = 0;
  569. this.getList();
  570. });
  571. } else {
  572. addRecord(this.form).then(response => {
  573. this.$modal.msgSuccess("新增成功");
  574. this.open = false;
  575. this.getList();
  576. });
  577. }
  578. }
  579. });
  580. },
  581. /** 删除按钮操作 */
  582. handleDelete(row) {
  583. const ids = row.id || this.ids;
  584. this.$modal
  585. .confirm('是否确认删除表彰记录信息编号为"' + ids + '"的数据项?')
  586. .then(function() {
  587. return delRecord(ids);
  588. })
  589. .then(() => {
  590. this.getList();
  591. this.$modal.msgSuccess("删除成功");
  592. })
  593. .catch(() => {});
  594. },
  595. /** 导出按钮操作 */
  596. handleExport() {
  597. this.download(
  598. "party/record/export",
  599. {
  600. ...this.queryParams
  601. },
  602. `record_${new Date().getTime()}.xlsx`
  603. );
  604. },
  605. handleRecord(row) {
  606. getRecordDetail(row.id).then(response => {
  607. this.activities = response.data;
  608. this.timelineOpen = true;
  609. });
  610. },
  611. /** 提交审核 */
  612. handleSubmitReview(row) {
  613. const pageTitle = this.$route.meta.title;
  614. const fullPath = this.$route.fullPath.replaceAll("/", "");
  615. const id = row.id || this.ids;
  616. console.log(fullPath);
  617. this.$modal
  618. .confirm("是否确认提交审核")
  619. .then(function() {
  620. return submitContent(id, pageTitle, fullPath);
  621. })
  622. .then(() => {
  623. this.getList();
  624. this.$modal.msgSuccess("提交审核成功");
  625. })
  626. .catch(() => {});
  627. },
  628. /** 表格列表文件下载 */
  629. handleDownloadTable(name, url) {
  630. downloadFile({ resource: url }).then(res => {
  631. let href = window.URL.createObjectURL(new Blob([res])); // 根据后端返回的url对应的文件流创建URL对象
  632. const link = document.createElement("a"); //创建一个隐藏的a标签
  633. link.style.display = "none";
  634. link.href = href; //设置下载的url
  635. link.download = name; //设置下载的文件名
  636. document.body.appendChild(link);
  637. link.click();
  638. document.body.removeChild(link);
  639. window.URL.revokeObjectURL(href); // 释放掉blob对象
  640. });
  641. },
  642. /** 文件下载 */
  643. handleDownload(row) {
  644. const url = row.file;
  645. const name = row.fileName;
  646. downloadFile({ resource: url }).then(res => {
  647. let href = window.URL.createObjectURL(new Blob([res])); // 根据后端返回的url对应的文件流创建URL对象
  648. const link = document.createElement("a"); //创建一个隐藏的a标签
  649. link.style.display = "none";
  650. link.href = href; //设置下载的url
  651. link.download = name; //设置下载的文件名
  652. document.body.appendChild(link);
  653. link.click();
  654. document.body.removeChild(link);
  655. window.URL.revokeObjectURL(href); // 释放掉blob对象
  656. });
  657. }
  658. }
  659. };
  660. </script>

element el-select 数据太多导致卡顿解决方案 - 简书

vue的form表单el-select下拉框数据量大导致页面卡死崩溃解决办法,使用懒加载方法加载数据解决页面卡顿 - 灰信网(软件开发博客聚合) 

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读