index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" size="small" v-show="showSearch" label-width="68px">
  4. <el-form-item label="姓名" prop="nickName">
  5. <el-input v-model="queryParams.nickName" placeholder="请输入姓名" />
  6. </el-form-item>
  7. <el-form-item label="成员类型" prop="memberType">
  8. <el-select v-model="queryParams.memberType" placeholder="请选择成员类型">
  9. <el-option
  10. v-for="dict in memberTypeOptions"
  11. :key="dict.dictValue"
  12. :label="dict.dictLabel"
  13. :value="dict.dictValue"
  14. ></el-option>
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item label="出生年月" prop="birthday">
  18. <el-date-picker clearable size="small" style="width: 200px"
  19. v-model="queryParams.birthday"
  20. type="date"
  21. value-format="yyyy-MM-dd"
  22. placeholder="选择出生年月">
  23. </el-date-picker>
  24. </el-form-item>
  25. <el-form-item label="学历" prop="educationLevel">
  26. <el-select v-model="queryParams.educationLevel" placeholder="请选择学历">
  27. <el-option
  28. v-for="dict in educationLevelOptions"
  29. :key="dict.dictValue"
  30. :label="dict.dictLabel"
  31. :value="dict.dictValue"
  32. ></el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="入职时间" prop="workEntryTime">
  36. <el-date-picker clearable size="small" style="width: 200px"
  37. v-model="queryParams.workEntryTime"
  38. type="date"
  39. value-format="yyyy-MM-dd"
  40. placeholder="选择入职时间">
  41. </el-date-picker>
  42. </el-form-item>
  43. <el-form-item label="入党时间" prop="partyEntryTime">
  44. <el-date-picker clearable size="small" style="width: 200px"
  45. v-model="queryParams.partyEntryTime"
  46. type="date"
  47. value-format="yyyy-MM-dd"
  48. placeholder="选择入党时间">
  49. </el-date-picker>
  50. </el-form-item>
  51. <el-form-item label="任职时间" prop="labourEntryTime">
  52. <el-date-picker clearable size="small" style="width: 200px"
  53. v-model="queryParams.labourEntryTime"
  54. type="date"
  55. value-format="yyyy-MM-dd"
  56. placeholder="选择任职时间">
  57. </el-date-picker>
  58. </el-form-item>
  59. <el-form-item label="离任时间" prop="labourLeaveTime">
  60. <el-date-picker clearable size="small" style="width: 200px"
  61. v-model="queryParams.labourLeaveTime"
  62. type="date"
  63. value-format="yyyy-MM-dd"
  64. placeholder="选择离任时间">
  65. </el-date-picker>
  66. </el-form-item>
  67. <el-form-item label="归属部门" prop="deptId" style="width: 268px;">
  68. <treeselect style="width: 200px;" v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
  69. </el-form-item>
  70. <el-form-item>
  71. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  72. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  73. </el-form-item>
  74. </el-form>
  75. <el-row :gutter="10" class="mb8">
  76. <el-col :span="1.5">
  77. <el-button
  78. type="primary"
  79. plain
  80. icon="el-icon-plus"
  81. size="mini"
  82. @click="handleAdd"
  83. v-hasPermi="['branch:member:add']"
  84. >新增</el-button>
  85. </el-col>
  86. <el-col :span="1.5">
  87. <el-button
  88. type="success"
  89. plain
  90. icon="el-icon-edit"
  91. size="mini"
  92. :disabled="single"
  93. @click="handleUpdate"
  94. v-hasPermi="['branch:member:edit']"
  95. >修改</el-button>
  96. </el-col>
  97. <el-col :span="1.5">
  98. <el-button
  99. type="danger"
  100. plain
  101. icon="el-icon-delete"
  102. size="mini"
  103. :disabled="multiple"
  104. @click="handleDelete"
  105. v-hasPermi="['branch:member:remove']"
  106. >删除</el-button>
  107. </el-col>
  108. <!--<el-col :span="1.5">-->
  109. <!--<el-button-->
  110. <!--type="info"-->
  111. <!--plain-->
  112. <!--icon="el-icon-upload2"-->
  113. <!--size="mini"-->
  114. <!--@click="handleImport"-->
  115. <!--v-hasPermi="['branch:member:edit']"-->
  116. <!--&gt;导入</el-button>-->
  117. <!--</el-col>-->
  118. <!--<el-col :span="1.5">-->
  119. <!--<el-button-->
  120. <!--type="warning"-->
  121. <!--plain-->
  122. <!--icon="el-icon-download"-->
  123. <!--size="mini"-->
  124. <!--@click="handleExport"-->
  125. <!--v-hasPermi="['branch:member:export']"-->
  126. <!--&gt;导出</el-button>-->
  127. <!--</el-col>-->
  128. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  129. </el-row>
  130. <el-table v-loading="loading" :data="memberList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  131. <el-table-column type="selection" width="55" align="center" />
  132. <el-table-column label="党支部" align="center" prop="deptId" :formatter="deptListFormat"/>
  133. <el-table-column label="姓名" align="center" prop="nickName"/>
  134. <el-table-column label="性别" align="center" prop="sex" :formatter="sysUserSexFormat"/>
  135. <el-table-column label="出生年月" align="center" prop="birthday">
  136. <template slot-scope="scope">
  137. <span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
  138. </template>
  139. </el-table-column>
  140. <el-table-column label="学历" align="center" prop="educationLevel" :formatter="educationLevelFormat"/>
  141. <el-table-column label="入职时间" align="center" prop="workEntryTime">
  142. <template slot-scope="scope">
  143. <span>{{ parseTime(scope.row.workEntryTime, '{y}-{m}-{d}') }}</span>
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="现岗位" align="center" prop="postString"/>
  147. <el-table-column label="入党时间" align="center" prop="partyEntryTime">
  148. <template slot-scope="scope">
  149. <span>{{ parseTime(scope.row.partyEntryTime, '{y}-{m}-{d}') }}</span>
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="委员分工" align="center" prop="roleString"/>
  153. <el-table-column label="任职时间" align="center" prop="labourEntryTime">
  154. <template slot-scope="scope">
  155. <span>{{ parseTime(scope.row.labourEntryTime, '{y}-{m}-{d}') }}</span>
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="离任时间" align="center" prop="labourLeaveTime">
  159. <template slot-scope="scope">
  160. <span>{{ parseTime(scope.row.labourLeaveTime, '{y}-{m}-{d}') }}</span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
  164. <template slot-scope="scope">
  165. <el-button
  166. size="mini"
  167. type="text"
  168. icon="el-icon-edit"
  169. @click="handleUpdate(scope.row)"
  170. v-hasPermi="['branch:member:edit']"
  171. >修改</el-button>
  172. <el-button
  173. size="mini"
  174. type="text"
  175. icon="el-icon-delete"
  176. @click="handleDelete(scope.row)"
  177. v-hasPermi="['branch:member:remove']"
  178. >删除</el-button>
  179. </template>
  180. </el-table-column>
  181. </el-table>
  182. <pagination
  183. v-show="total>0"
  184. :total="total"
  185. :page.sync="queryParams.pageNum"
  186. :limit.sync="queryParams.pageSize"
  187. @pagination="getList"
  188. />
  189. <!-- 添加或修改支部成员管理对话框 -->
  190. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  191. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  192. <el-row>
  193. <el-col :span="12">
  194. <el-form-item label="绑定用户" prop="userId">
  195. <el-select v-model="form.userId" placeholder="请选择绑定用户">
  196. <el-option
  197. v-for="dict in userList"
  198. :key="dict.dictValue"
  199. :label="dict.dictLabel"
  200. :value="dict.dictValue"
  201. ></el-option>
  202. </el-select>
  203. </el-form-item>
  204. </el-col>
  205. <el-col :span="12">
  206. <el-form-item label="成员类型" prop="memberType">
  207. <el-select v-model="form.memberType" placeholder="请选择成员类型">
  208. <el-option
  209. v-for="dict in memberTypeOptions"
  210. :key="dict.dictValue"
  211. :label="dict.dictLabel"
  212. :value="dict.dictValue"
  213. ></el-option>
  214. </el-select>
  215. </el-form-item>
  216. </el-col>
  217. <el-col :span="12">
  218. <el-form-item label="出生年月" prop="birthday">
  219. <el-date-picker clearable size="small" style="width: 200px"
  220. v-model="form.birthday"
  221. type="date"
  222. value-format="yyyy-MM-dd"
  223. placeholder="选择出生年月">
  224. </el-date-picker>
  225. </el-form-item>
  226. </el-col>
  227. <el-col :span="12">
  228. <el-form-item label="学历" prop="educationLevel">
  229. <el-select v-model="form.educationLevel" placeholder="请选择学历">
  230. <el-option
  231. v-for="dict in educationLevelOptions"
  232. :key="dict.dictValue"
  233. :label="dict.dictLabel"
  234. :value="dict.dictValue"
  235. ></el-option>
  236. </el-select>
  237. </el-form-item>
  238. </el-col>
  239. <el-col :span="12">
  240. <el-form-item label="入职时间" prop="workEntryTime">
  241. <el-date-picker clearable size="small" style="width: 200px"
  242. v-model="form.workEntryTime"
  243. type="date"
  244. value-format="yyyy-MM-dd"
  245. placeholder="选择入职时间">
  246. </el-date-picker>
  247. </el-form-item>
  248. </el-col>
  249. <el-col :span="12">
  250. <el-form-item label="入党时间" prop="partyEntryTime">
  251. <el-date-picker clearable size="small" style="width: 200px"
  252. v-model="form.partyEntryTime"
  253. type="date"
  254. value-format="yyyy-MM-dd"
  255. placeholder="选择入党时间">
  256. </el-date-picker>
  257. </el-form-item>
  258. </el-col>
  259. <el-col :span="12">
  260. <el-form-item label="任职时间" prop="labourEntryTime">
  261. <el-date-picker clearable size="small" style="width: 200px"
  262. v-model="form.labourEntryTime"
  263. type="date"
  264. value-format="yyyy-MM-dd"
  265. placeholder="选择任职时间">
  266. </el-date-picker>
  267. </el-form-item>
  268. </el-col>
  269. <el-col :span="12">
  270. <el-form-item label="离任时间" prop="labourLeaveTime">
  271. <el-date-picker clearable size="small" style="width: 200px"
  272. v-model="form.labourLeaveTime"
  273. type="date"
  274. value-format="yyyy-MM-dd"
  275. placeholder="选择离任时间">
  276. </el-date-picker>
  277. </el-form-item>
  278. </el-col>
  279. <el-col :span="12">
  280. <el-form-item label="归属部门" prop="deptId">
  281. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
  282. </el-form-item>
  283. </el-col>
  284. </el-row>
  285. </el-form>
  286. <div slot="footer" class="dialog-footer">
  287. <el-button type="primary" @click="submitForm">确 定</el-button>
  288. <el-button @click="cancel">取 消</el-button>
  289. </div>
  290. </el-dialog>
  291. <!-- 用户导入对话框 -->
  292. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  293. <el-upload
  294. ref="upload"
  295. :limit="1"
  296. accept=".xlsx, .xls"
  297. :headers="upload.headers"
  298. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  299. :disabled="upload.isUploading"
  300. :on-progress="handleFileUploadProgress"
  301. :on-success="handleFileSuccess"
  302. :auto-upload="false"
  303. drag
  304. >
  305. <i class="el-icon-upload"></i>
  306. <div class="el-upload__text">
  307. 将文件拖到此处,或
  308. <em>点击上传</em>
  309. </div>
  310. <div class="el-upload__tip" slot="tip">
  311. <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
  312. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  313. </div>
  314. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  315. </el-upload>
  316. <div slot="footer" class="dialog-footer">
  317. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  318. <el-button @click="upload.open = false">取 消</el-button>
  319. </div>
  320. </el-dialog>
  321. </div>
  322. </template>
  323. <script>
  324. import { listMember, getMember, delMember, addMember, updateMember, exportMember, importTemplate} from "@/api/branch/member";
  325. import { treeselect } from "@/api/system/dept";
  326. import { getToken } from "@/utils/auth";
  327. import Treeselect from "@riophae/vue-treeselect";
  328. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  329. import { listUserNoPage } from "@/api/system/user";
  330. import { listDept } from "@/api/system/dept";
  331. export default {
  332. name: "Member",
  333. components: { Treeselect },
  334. data() {
  335. return {
  336. // 遮罩层
  337. loading: true,
  338. // 选中数组
  339. ids: [],
  340. // 非单个禁用
  341. single: true,
  342. // 非多个禁用
  343. multiple: true,
  344. // 显示搜索条件
  345. showSearch: false,
  346. // 总条数
  347. total: 0,
  348. // 支部成员管理表格数据
  349. memberList: [],
  350. // 弹出层标题
  351. title: "",
  352. // 部门树选项
  353. deptOptions: [],
  354. clientHeight:300,
  355. // 是否显示弹出层
  356. open: false,
  357. // 成员类型字典
  358. memberTypeOptions: [],
  359. // 学历字典
  360. educationLevelOptions: [],
  361. // 用户性别字典
  362. sysUserSexOptions: [],
  363. // 成员民族字典
  364. memberEthnicOptions: [],
  365. // 用户列表
  366. userList: [],
  367. // 部门列表
  368. deptList: [],
  369. // 用户导入参数
  370. upload: {
  371. // 是否显示弹出层(用户导入)
  372. open: false,
  373. // 弹出层标题(用户导入)
  374. title: "",
  375. // 是否禁用上传
  376. isUploading: false,
  377. // 是否更新已经存在的用户数据
  378. updateSupport: 0,
  379. // 设置上传的请求头部
  380. headers: { Authorization: "Bearer " + getToken() },
  381. // 上传的地址
  382. url: process.env.VUE_APP_BASE_API + "/branch/member/importData"
  383. },
  384. // 查询参数
  385. queryParams: {
  386. pageNum: 1,
  387. pageSize: 20,
  388. memberId: null,
  389. userId: null,
  390. memberType: null,
  391. birthday: null,
  392. educationLevel: null,
  393. workJoinTime: null,
  394. workEntryTime: null,
  395. partyEntryTime: null,
  396. currentPost: null,
  397. labourDivision: null,
  398. labourEntryTime: null,
  399. labourLeaveTime: null,
  400. entryTime: null,
  401. leaveTime: null,
  402. isLeague: null,
  403. applyTime: null,
  404. formCreateTime: null,
  405. currentMentor: null,
  406. planDevelopDuration: null,
  407. isTrained: null,
  408. remarks: null,
  409. deptId: null,
  410. },
  411. // 表单参数
  412. form: {
  413. },
  414. // 表单校验
  415. rules: {
  416. userId: [
  417. { required: true, message: "绑定用户不能为空", trigger: "blur" }
  418. ],
  419. memberType: [
  420. { required: true, message: "成员类型不能为空", trigger: "blur" }
  421. ],
  422. deptId: [
  423. { required: true, message: "归属部门不能为空", trigger: "blur" }
  424. ],
  425. }
  426. };
  427. },
  428. watch: {
  429. // 根据名称筛选部门树
  430. deptName(val) {
  431. this.$refs.tree.filter(val);
  432. }
  433. },
  434. created() {
  435. this.getUserList();
  436. this.getDeptList();
  437. //设置表格高度对应屏幕高度
  438. this.$nextTick(() => {
  439. this.clientHeight = document.body.clientHeight -250
  440. })
  441. this.getList();
  442. this.getTreeselect();
  443. this.getDicts("member_education_level").then(response => {
  444. this.educationLevelOptions = response.data;
  445. });
  446. this.getDicts("member_type").then(response => {
  447. this.memberTypeOptions = response.data;
  448. });
  449. this.getDicts("sys_user_sex").then(response => {
  450. this.sysUserSexOptions = response.data;
  451. });
  452. this.getDicts("member_ethnic").then(response => {
  453. this.memberEthnicOptions = response.data;
  454. });
  455. },
  456. methods: {
  457. /** 查询部门列表 */
  458. getDeptList() {
  459. listDept().then(response => {
  460. let data = response.data;
  461. let deptList = [];
  462. for(let i = 0; i < data.length; i++) {
  463. let dept = { "dictValue" : data[i].deptId, "dictLabel" : data[i].deptName};
  464. deptList.push(dept);
  465. }
  466. this.deptList = deptList;
  467. });
  468. },
  469. /** 查询用户列表 */
  470. getUserList() {
  471. listUserNoPage().then(response => {
  472. let rows = response.data;
  473. let userList = [];
  474. for(let i = 0; i < rows.length; i++) {
  475. if (rows[i].userName != "admin") {
  476. let user = { "dictValue" : rows[i].userId, "dictLabel" : rows[i].nickName};
  477. userList.push(user);
  478. }
  479. }
  480. this.userList = userList;
  481. });
  482. },
  483. /** 查询支部成员管理列表 */
  484. getList() {
  485. this.loading = true;
  486. this.queryParams.memberType = 3;
  487. listMember(this.queryParams).then(response => {
  488. // let rows = response.rows;
  489. // let memberList = [];
  490. // for (let i = 0; i < rows.length; i++) {
  491. // if (rows[i].memberType == "3") {//党委
  492. // memberList.push(rows[i]);
  493. // }
  494. // }
  495. // this.memberList = memberList;
  496. this.memberList = response.rows;
  497. for (let i = 0; i < this.memberList.length; i++) {
  498. let posts = Array.from(this.memberList[i].posts);
  499. let roles = Array.from(this.memberList[i].roles);
  500. let roleString = "";
  501. let postString = "";
  502. for (let j = 0; j < roles.length; j++) {
  503. if (j > 0) {
  504. roleString += "\n兼" + roles[j].roleName;
  505. } else {
  506. roleString += roles[j].roleName;
  507. }
  508. }
  509. for (let j = 0; j < posts.length; j++) {
  510. if (j > 0) {
  511. postString += "\n兼" + posts[j].postName;
  512. } else {
  513. postString += posts[j].postName;
  514. }
  515. }
  516. this.memberList[i].roleString = roleString;
  517. this.memberList[i].postString = postString;
  518. }
  519. this.total = response.total;
  520. this.loading = false;
  521. });
  522. },
  523. /** 查询部门下拉树结构 */
  524. getTreeselect() {
  525. treeselect().then(response => {
  526. this.deptOptions = response.data;
  527. });
  528. },
  529. // 学历字典翻译
  530. educationLevelFormat(row, column) {
  531. return this.selectDictLabel(this.educationLevelOptions, row.educationLevel);
  532. },
  533. // 成员类型字典翻译
  534. memberTypeFormat(row, column) {
  535. return this.selectDictLabel(this.memberTypeOptions, row.memberType);
  536. },
  537. // 用户性别字典翻译
  538. sysUserSexFormat(row, column) {
  539. return this.selectDictLabel(this.sysUserSexOptions, row.sex);
  540. },
  541. // 用户民族字典翻译
  542. memberEthnicFormat(row, column) {
  543. return this.selectDictLabel(this.memberEthnicOptions, row.ethnic);
  544. },
  545. // 用户列表字典翻译
  546. userListFormat(row, column) {
  547. return this.selectDictLabel(this.userList, row.userId);
  548. },
  549. // 现培养人字典翻译
  550. currentMentorFormat(row, column) {
  551. return this.selectDictLabel(this.userList, row.currentMentor);
  552. },
  553. // 部门列表字典翻译
  554. deptListFormat(row, column) {
  555. return this.selectDictLabel(this.deptList, row.deptId);
  556. },
  557. // 取消按钮
  558. cancel() {
  559. this.open = false;
  560. this.reset();
  561. },
  562. // 表单重置
  563. reset() {
  564. this.form = {
  565. memberId: null,
  566. userId: null,
  567. memberType: null,
  568. birthday: null,
  569. educationLevel: null,
  570. workJoinTime: null,
  571. workEntryTime: null,
  572. partyEntryTime: null,
  573. currentPost: null,
  574. labourDivision: null,
  575. labourEntryTime: null,
  576. labourLeaveTime: null,
  577. entryTime: null,
  578. leaveTime: null,
  579. isLeague: null,
  580. applyTime: null,
  581. formCreateTime: null,
  582. currentMentor: null,
  583. planDevelopDuration: null,
  584. isTrained: null,
  585. remarks: null,
  586. delFlag: null,
  587. createBy: null,
  588. createTime: null,
  589. updateBy: null,
  590. updateTime: null,
  591. deptId: null,
  592. };
  593. this.resetForm("form");
  594. },
  595. /** 搜索按钮操作 */
  596. handleQuery() {
  597. this.queryParams.pageNum = 1;
  598. this.getList();
  599. },
  600. /** 重置按钮操作 */
  601. resetQuery() {
  602. this.resetForm("queryForm");
  603. this.handleQuery();
  604. },
  605. // 多选框选中数据
  606. handleSelectionChange(selection) {
  607. this.ids = selection.map(item => item.memberId)
  608. this.single = selection.length!==1
  609. this.multiple = !selection.length
  610. },
  611. /** 新增按钮操作 */
  612. handleAdd() {
  613. this.reset();
  614. this.form.memberType = "3";
  615. this.open = true;
  616. this.title = "添加委员信息";
  617. },
  618. /** 修改按钮操作 */
  619. handleUpdate(row) {
  620. this.reset();
  621. const memberId = row.memberId || this.ids
  622. getMember(memberId).then(response => {
  623. this.form = response.data;
  624. this.open = true;
  625. this.title = "修改委员信息";
  626. });
  627. },
  628. /** 提交按钮 */
  629. submitForm() {
  630. this.$refs["form"].validate(valid => {
  631. if (valid) {
  632. if (this.form.memberId != null) {
  633. updateMember(this.form).then(response => {
  634. this.$modal.msgSuccess("修改成功");
  635. this.open = false;
  636. this.getList();
  637. });
  638. } else {
  639. console.log(this.form);
  640. addMember(this.form).then(response => {
  641. this.$modal.msgSuccess("新增成功");
  642. this.open = false;
  643. this.getList();
  644. });
  645. }
  646. }
  647. });
  648. },
  649. /** 删除按钮操作 */
  650. handleDelete(row) {
  651. const memberIds = row.memberId || this.ids;
  652. this.$confirm('是否确认删除?', "警告", {
  653. confirmButtonText: "确定",
  654. cancelButtonText: "取消",
  655. type: "warning"
  656. }).then(function() {
  657. return delMember(memberIds);
  658. }).then(() => {
  659. this.getList();
  660. this.msgSuccess("删除成功");
  661. })
  662. },
  663. /** 导出按钮操作 */
  664. handleExport() {
  665. const queryParams = this.queryParams;
  666. this.$confirm('是否确认导出所有委员会名册数据项?', "警告", {
  667. confirmButtonText: "确定",
  668. cancelButtonText: "取消",
  669. type: "warning"
  670. }).then(function() {
  671. return exportMember(queryParams);
  672. }).then(response => {
  673. this.download(response.msg);
  674. })
  675. },
  676. /** 导入按钮操作 */
  677. handleImport() {
  678. this.upload.title = "导入";
  679. this.upload.open = true;
  680. },
  681. /** 下载模板操作 */
  682. importTemplate() {
  683. importTemplate().then(response => {
  684. this.download(response.msg);
  685. });
  686. },
  687. // 文件上传中处理
  688. handleFileUploadProgress(event, file, fileList) {
  689. this.upload.isUploading = true;
  690. },
  691. // 文件上传成功处理
  692. handleFileSuccess(response, file, fileList) {
  693. this.upload.open = false;
  694. this.upload.isUploading = false;
  695. this.$refs.upload.clearFiles();
  696. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  697. this.getList();
  698. },
  699. // 提交上传文件
  700. submitFileForm() {
  701. this.$refs.upload.submit();
  702. }
  703. }
  704. };
  705. </script>
  706. <style>
  707. /** 文本换行符处理 */
  708. .el-table .cell{
  709. white-space: pre-wrap;
  710. }
  711. /** textarea字体 */
  712. textarea {
  713. font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
  714. }
  715. </style>