fundSide.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. <template>
  2. <div class="app-container">
  3. <el-card class="fiche">
  4. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"
  5. >收起</right-toolbar
  6. >
  7. <span
  8. style="
  9. margin-bottom: 10px;
  10. color: #333333;
  11. font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial,
  12. sans-serif;
  13. "
  14. >所选条件:</span
  15. >
  16. <div style="float: right; margin-right: 1%">
  17. <el-button
  18. type="cyan"
  19. icon="el-icon-search"
  20. size="mini"
  21. @click="handleQuery"
  22. >搜索</el-button
  23. >
  24. <el-button
  25. icon="el-icon-refresh"
  26. size="mini"
  27. @click="resetQuery"
  28. style="float: "
  29. >重置</el-button
  30. >
  31. </div>
  32. <hr style="margin-top: 16px" />
  33. <el-form
  34. :model="queryParams"
  35. ref="queryForm"
  36. :inline="true"
  37. v-show="showSearch"
  38. label-width="100px"
  39. >
  40. <el-form-item label="资金方名称" prop="scyName">
  41. <el-input
  42. v-model="queryParams.scyName"
  43. placeholder="请输入资金方名称"
  44. clearable
  45. size="small"
  46. @keyup.enter.native="handleQuery"
  47. maxlength="15"
  48. />
  49. </el-form-item>
  50. <el-form-item label="资金方类型" align="center" prop="smiType">
  51. <el-select v-model="queryParams.smiType">
  52. <el-option
  53. v-for="(item, index) in formulaOptions"
  54. :key="index"
  55. :label="item.dictLabel"
  56. :value="item.dictValue"
  57. ></el-option>
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="客户经理" prop="smiManager">
  61. <el-input
  62. v-model="queryParams.smiManager"
  63. placeholder="请输入客户经理"
  64. clearable
  65. size="small"
  66. @keyup.enter.native="handleQuery"
  67. maxlength="15"
  68. />
  69. </el-form-item>
  70. <el-form-item label="联系人姓名" prop="smiContract">
  71. <el-input
  72. v-model="queryParams.smiContract"
  73. placeholder="请输入联系人姓名"
  74. clearable
  75. size="small"
  76. @keyup.enter.native="handleQuery"
  77. maxlength="15"
  78. />
  79. </el-form-item>
  80. <el-form-item label="联系人电话" prop="smiContractPhone">
  81. <el-input
  82. v-model="queryParams.smiContractPhone"
  83. placeholder="请输入联系人电话"
  84. clearable
  85. size="small"
  86. @keyup.enter.native="handleQuery"
  87. maxlength="15"
  88. />
  89. </el-form-item>
  90. </el-form>
  91. </el-card>
  92. <el-row :gutter="10" class="mb8">
  93. <el-col :span="1.5">
  94. <el-button
  95. type="primary"
  96. icon="el-icon-plus"
  97. size="mini"
  98. @click="handleAdd"
  99. v-hasPermi="['fundSide:fundSide:add']"
  100. >新增</el-button
  101. >
  102. </el-col>
  103. </el-row>
  104. <el-table
  105. v-loading="loading"
  106. :data="fundList"
  107. @selection-change="handleSelectionChange"
  108. stripe
  109. border
  110. >
  111. <el-table-column label="序号" type="index" width="55" align="center" />
  112. <el-table-column label="资金方编号" align="center" prop="scyId" />
  113. <el-table-column label="资金方名称" align="center" prop="scyName" />
  114. <el-table-column
  115. label="资金方类型"
  116. :formatter="formulaFormat"
  117. align="center"
  118. prop="smiType"
  119. />
  120. <el-table-column
  121. label="社会统一信用代码"
  122. align="center"
  123. prop="scySocialCode"
  124. />
  125. <el-table-column label="联系人名称" align="center" prop="smiContract" />
  126. <el-table-column
  127. label="联系人电话"
  128. align="center"
  129. prop="smiContractPhone"
  130. />
  131. <el-table-column label="客户经理" align="center" prop="smiManager" />
  132. <!-- <el-table-column
  133. label="资金方状态"
  134. :formatter="formulaFormatSend"
  135. align="center"
  136. prop="scyStatus"
  137. /> -->
  138. <el-table-column label="资金方状态" align="center">
  139. <template slot-scope="scope">
  140. <el-switch
  141. v-model="scope.row.scyStatus"
  142. active-value="00"
  143. inactive-value="01"
  144. @change="handleStatusChange(scope.row)"
  145. ></el-switch>
  146. </template>
  147. </el-table-column>
  148. <el-table-column
  149. label="操作"
  150. align="center"
  151. class-name="small-padding fixed-width"
  152. >
  153. <template slot-scope="scope">
  154. <el-button
  155. size="mini"
  156. type="text"
  157. icon="el-icon-view"
  158. @click="handleDetail(scope.row)"
  159. >详情</el-button
  160. >
  161. <el-button
  162. size="mini"
  163. type="text"
  164. icon="el-icon-edit"
  165. @click="handleUpdate(scope.row)"
  166. v-hasPermi="['fundSide:fundSide:update']"
  167. v-if="scope.row.scyStatus=='01'"
  168. >修改</el-button
  169. >
  170. </template>
  171. </el-table-column>
  172. </el-table>
  173. <pagination
  174. v-show="total > 0"
  175. :total="total"
  176. :page.sync="queryParams.pageNum"
  177. :limit.sync="queryParams.pageSize"
  178. @pagination="getList"
  179. />
  180. <!-- 添加或修改资金方对话框 -->
  181. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  182. <el-form
  183. ref="form"
  184. :model="form"
  185. :rules="rules"
  186. label-width="120px"
  187. :inline="true"
  188. :disabled="disableds"
  189. >
  190. <el-divider content-position="left">渠道信息</el-divider>
  191. <el-form-item label="资金方名称" prop="scyName">
  192. <el-input
  193. v-model="form.scyName"
  194. style="width: 215px"
  195. placeholder="请输入资金方名称"
  196. maxlength="15"
  197. />
  198. </el-form-item>
  199. <el-form-item prop="smiType" label="资金方类型">
  200. <el-select v-model="form.smiType">
  201. <el-option
  202. v-for="(item, index) in formulaOptions"
  203. :key="index"
  204. :label="item.dictLabel"
  205. :value="item.dictValue"
  206. ></el-option>
  207. </el-select>
  208. </el-form-item>
  209. <el-form-item
  210. label="合作协议签署"
  211. align="center"
  212. prop="smiAgreementType"
  213. >
  214. <el-select v-model="form.smiAgreementType">
  215. <el-option
  216. v-for="(item, index) in formulaOptionsSend"
  217. :key="index"
  218. :label="item.dictLabel"
  219. :value="item.dictValue"
  220. ></el-option>
  221. </el-select>
  222. </el-form-item>
  223. <el-form-item label="资金方网点" prop="smiAddress">
  224. <el-input
  225. v-model="form.smiAddress"
  226. style="width: 215px"
  227. placeholder="请输入资金方网点"
  228. maxlength="15"
  229. />
  230. </el-form-item>
  231. <el-form-item label="社会统一信用代码" prop="scySocialCode">
  232. <el-input
  233. v-model="form.scySocialCode"
  234. style="width: 215px"
  235. placeholder="请输入社会统一信用代码"
  236. maxlength="18"
  237. />
  238. </el-form-item>
  239. <el-form-item label="客户经理" prop="smiManager">
  240. <el-input
  241. v-model="form.smiManager"
  242. style="width: 215px"
  243. placeholder="请输入客户经理"
  244. maxlength="15"
  245. />
  246. </el-form-item>
  247. <el-form-item label="联系人姓名" prop="smiContract">
  248. <el-input
  249. v-model="form.smiContract"
  250. style="width: 215px"
  251. placeholder="请输入联系人姓名"
  252. maxlength="15"
  253. :disabled="disabled"
  254. />
  255. </el-form-item>
  256. <el-form-item label="联系人电话" prop="smiContractPhone">
  257. <el-input
  258. v-model="form.smiContractPhone"
  259. style="width: 215px"
  260. placeholder="请输入联系人电话"
  261. maxlength="11"
  262. :disabled="disabled"
  263. />
  264. </el-form-item>
  265. <el-form-item label="补充描述">
  266. <el-input
  267. v-model="form.smiDesc"
  268. type="textarea"
  269. placeholder="请输入内容"
  270. maxlength="100"
  271. style="width: 558px"
  272. ></el-input>
  273. </el-form-item>
  274. <el-form-item label="合作协议">
  275. <el-upload
  276. ref="upload"
  277. class="upload-demo"
  278. :class="{ uoloadSty: showBtnImg, disUoloadSty: noneBtnImg }"
  279. action=""
  280. accept=".jpg, .jpeg, .png, .JPG, .JPEG, .PNG"
  281. :http-request="sfzRequest"
  282. :on-preview="handlePictureCardPreview"
  283. :on-remove="beforeRemove"
  284. :on-change="dealImgChange"
  285. multiple
  286. :limit="20"
  287. :on-exceed="handleExceed"
  288. list-type="picture-card"
  289. :file-list="sfzList"
  290. :auto-upload="true"
  291. >
  292. <el-button slot="trigger" size="small" type="primary"
  293. >点击选择</el-button
  294. >
  295. </el-upload>
  296. </el-form-item>
  297. <!-- <el-button
  298. style="margin-left: 10px"
  299. size="small"
  300. type="success"
  301. @click="submitUpload"
  302. >上传到服务器</el-button
  303. > -->
  304. </el-form>
  305. <div slot="footer" class="dialog-footer">
  306. <el-button type="primary" @click="submitForm">确 定</el-button>
  307. <el-button @click="cancel">取 消</el-button>
  308. </div>
  309. </el-dialog>
  310. <el-dialog :visible.sync="sfzVisible">
  311. <img width="100%" :src="sfzImageUrl" alt="" />
  312. </el-dialog>
  313. </div>
  314. </template>
  315. <script>
  316. import {
  317. listFund,
  318. getFund,
  319. addFund,
  320. updateFund,
  321. fundSideStatus,
  322. } from "@/api/fundSide/fundSide";
  323. import Editor from "@/components/Editor";
  324. import { uploadFileNew } from "@/api/common/file";
  325. import { getToken } from "@/utils/auth";
  326. export default {
  327. name: "fundSide",
  328. components: {
  329. Editor,
  330. },
  331. data() {
  332. return {
  333. //图片预览
  334. sfzImageUrl: "",
  335. sfzVisible: false,
  336. showBtnImg: false,
  337. noneBtnImg: false,
  338. limitCountImg: 1,
  339. // id隐藏
  340. isShow: false,
  341. // 遮罩层
  342. loading: true,
  343. // 选中数组
  344. ids: [],
  345. // 非单个禁用
  346. single: true,
  347. // 非多个禁用
  348. multiple: true,
  349. // 显示搜索条件
  350. showSearch: true,
  351. //联系人隐藏
  352. disabled: false,
  353. disableds: false,
  354. // 总条数
  355. total: 0,
  356. // 资金方表格数据
  357. fundList: [],
  358. //姓名
  359. nameList: [],
  360. //字典
  361. formulaOptions: [],
  362. formulaOptionsSend: [],
  363. UserList: [],
  364. enclosureList: [],
  365. sfzList: [],
  366. // 弹出层标题
  367. title: "",
  368. // 是否显示弹出层
  369. open: false,
  370. // 查询参数
  371. queryParams: {
  372. pageNum: 1,
  373. pageSize: 10,
  374. scyName: null,
  375. smiType: null,
  376. smiManager: null,
  377. smiContract: null,
  378. smiContractPhone: null,
  379. sfsContent: null,
  380. sfsIsDel: null,
  381. sfsRemark: null,
  382. ssId: null,
  383. ssName: null,
  384. },
  385. // 表单参数
  386. form: {},
  387. // 表单校验
  388. rules: {
  389. scyName: [
  390. {
  391. required: true,
  392. message: "资金方名称不能为空",
  393. trigger: ["change", "blur"],
  394. },
  395. {
  396. pattern: /^[\u2E80-\u9FFF]|\w|[,,\.。]+$/,
  397. message: "资金方名称不能含有特殊字符",
  398. trigger: "blur",
  399. },
  400. ],
  401. smiAddress: [
  402. {
  403. required: true,
  404. message: "资金方网点不能为空",
  405. trigger: ["change", "blur"],
  406. },
  407. {
  408. pattern: /^[\u2E80-\u9FFF]|\w|[,,\.。]+$/,
  409. message: "资金方网点不能含有特殊字符",
  410. trigger: "blur",
  411. },
  412. ],
  413. smiType: [
  414. {
  415. required: true,
  416. message: "资金方类型不能为空",
  417. trigger: ["change", "blur"],
  418. },
  419. ],
  420. smiAgreementType: [
  421. {
  422. required: true,
  423. message: "合作协议签署不能为空",
  424. trigger: ["change", "blur"],
  425. },
  426. ],
  427. scySocialCode: [
  428. {
  429. required: true,
  430. message: "社会统一信用代码不能为空",
  431. trigger: ["change", "blur"],
  432. },
  433. ],
  434. smiManager: [
  435. {
  436. required: true,
  437. message: "客户经理不能为空",
  438. trigger: ["change", "blur"],
  439. },
  440. {
  441. pattern: /^[\u2E80-\u9FFF]|\w|[,,\.。]+$/,
  442. message: "客户经理不能含有特殊字符",
  443. trigger: "blur",
  444. },
  445. ],
  446. smiContract: [
  447. {
  448. required: true,
  449. message: "联系人姓名不能为空",
  450. trigger: ["change", "blur"],
  451. },
  452. {
  453. pattern: /^[\u2E80-\u9FFF]|\w|[,,\.。]+$/,
  454. message: "联系人姓名不能含有特殊字符",
  455. trigger: "blur",
  456. },
  457. ],
  458. smiContractPhone: [
  459. {
  460. required: true,
  461. message: "联系人电话不能为空",
  462. trigger: ["change", "blur"],
  463. },
  464. {
  465. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  466. message: "请输入正确的手机号码",
  467. trigger: ["blur", "change"],
  468. },
  469. ],
  470. },
  471. };
  472. },
  473. created() {
  474. this.getList();
  475. this.getDicts("sys_smi_type").then((response) => {
  476. this.formulaOptions = response.data;
  477. });
  478. this.getDicts("sys_agreement_type").then((response) => {
  479. this.formulaOptionsSend = response.data;
  480. });
  481. },
  482. methods: {
  483. /** 查询资金方列表 */
  484. getList() {
  485. this.loading = true;
  486. listFund(this.queryParams).then((response) => {
  487. this.fundList = response.rows;
  488. this.total = response.total;
  489. this.loading = false;
  490. });
  491. },
  492. // 取消按钮
  493. cancel() {
  494. this.open = false;
  495. this.reset();
  496. },
  497. // 表单重置
  498. reset() {
  499. this.form = {
  500. scyId: null,
  501. scyName: null,
  502. smiType: null,
  503. smiManager: null,
  504. smiContract: null,
  505. smiContractPhone: null,
  506. sfsContent: null,
  507. sfsIsDel: null,
  508. createBy: null,
  509. createTime: null,
  510. updateBy: null,
  511. updateTime: null,
  512. sfsRemark: null,
  513. ssId: null,
  514. ssName: null,
  515. };
  516. this.noneBtnImg = false;
  517. this.enclosureList = [];
  518. this.sfzList = [];
  519. this.resetForm("form");
  520. },
  521. /** 搜索按钮操作 */
  522. handleQuery() {
  523. this.queryParams.pageNum = 1;
  524. this.getList();
  525. },
  526. /** 重置按钮操作 */
  527. resetQuery() {
  528. this.resetForm("queryForm");
  529. this.handleQuery();
  530. },
  531. // 多选框选中数据
  532. handleSelectionChange(selection) {
  533. this.ids = selection.map((item) => item.scyId);
  534. this.single = selection.length !== 1;
  535. this.multiple = !selection.length;
  536. },
  537. //资方类型
  538. formulaFormat(row, column) {
  539. return this.selectDictLabel(this.formulaOptions, row.smiType);
  540. },
  541. //奖项
  542. formulaFormatSend(row, column) {
  543. return this.selectDictLabel(
  544. this.formulaOptionsSend,
  545. row.smiAgreementType
  546. );
  547. },
  548. /** 新增按钮操作 */
  549. handleAdd() {
  550. this.reset();
  551. this.open = true;
  552. this.disableds = false;
  553. this.disabled = false;
  554. this.title = "添加资金方";
  555. },
  556. /** 修改按钮操作 */
  557. handleUpdate(row) {
  558. this.reset();
  559. const scyId = row.scyId || this.ids;
  560. getFund(scyId).then((response) => {
  561. console.log(response);
  562. this.form = response.data.list[0];
  563. if (response.data.data && response.data.data.length != 0) {
  564. this.sfzList.push({
  565. uid: response.data.data[0].uid,
  566. url: response.data.data[0].pfiUrl + "/" + getToken(),
  567. });
  568. this.noneBtnImg = true;
  569. }
  570. this.open = true;
  571. this.disableds = false;
  572. this.disabled = true;
  573. this.title = "修改资金方";
  574. });
  575. },
  576. /** 详情按钮操作 */
  577. handleDetail(row) {
  578. this.reset();
  579. const scyId = row.scyId || this.ids;
  580. getFund(scyId).then((response) => {
  581. console.log(response);
  582. this.form = response.data.list[0];
  583. if (response.data.data && response.data.data.length != 0) {
  584. this.sfzList.push({
  585. name: "合作协议",
  586. url: response.data.data[0].pfiUrl + "/" + getToken(),
  587. });
  588. this.noneBtnImg = true;
  589. }
  590. this.open = true;
  591. this.disableds = true;
  592. this.title = "资金方详情";
  593. });
  594. },
  595. /** 提交按钮 */
  596. submitForm() {
  597. this.$refs["form"].validate((valid) => {
  598. this.form.smiAgreement = this.sfzList;
  599. console.log(this.sfzList)
  600. console.log(this.form.smiAgreement);
  601. if (valid) {
  602. if (this.form.scyId != null) {
  603. const loading = this.$loading({
  604. lock: true,
  605. text: "Loading",
  606. spinner: "el-icon-loading",
  607. background: "rgba(0, 0, 0, 0.7)",
  608. });
  609. updateFund(this.form)
  610. .then((response) => {
  611. loading.close();
  612. this.msgSuccess("修改成功");
  613. this.open = false;
  614. this.getList();
  615. })
  616. .catch((response) => {
  617. loading.close();
  618. });
  619. } else {
  620. const loading = this.$loading({
  621. lock: true,
  622. text: "Loading",
  623. spinner: "el-icon-loading",
  624. background: "rgba(0, 0, 0, 0.7)",
  625. });
  626. addFund(this.form)
  627. .then((response) => {
  628. loading.close();
  629. this.msgSuccess("新增成功");
  630. this.open = false;
  631. this.getList();
  632. })
  633. .catch((response) => {
  634. loading.close();
  635. });
  636. }
  637. }
  638. });
  639. },
  640. //状态变更
  641. handleStatusChange(row) {
  642. let text = row.scyStatus === "00" ? "启用" : "停用";
  643. this.$confirm("确认要" + text + '"' + row.scyName + '"吗?', "警告", {
  644. confirmButtonText: "确定",
  645. cancelButtonText: "取消",
  646. type: "warning",
  647. })
  648. .then(function () {
  649. return fundSideStatus(row.scyId, row.scyStatus);
  650. })
  651. .then(() => {
  652. this.msgSuccess(text + "成功");
  653. })
  654. .catch(function () {
  655. row.scyStatus = row.scyStatus === "00" ? "01" : "00";
  656. });
  657. },
  658. //文件移除提示
  659. beforeRemove(file, sfzList) {
  660. for (let i = 0; i < this.sfzList.length; i++) {
  661. if (file.uid == this.sfzList[i].uid) {
  662. this.sfzList.splice(i, 1);
  663. break;
  664. }
  665. }
  666. this.noneBtnImg = sfzList.length >= this.limitCountImg;
  667. },
  668. handleExceed(file, sfzList) {
  669. this.$message.warning(`当前限制选择 20 个文件`);
  670. },
  671. //图片预览
  672. handlePictureCardPreview(file) {
  673. this.sfzImageUrl = file.url;
  674. this.sfzVisible = true;
  675. },
  676. dealImgChange(file, sfzList) {
  677. this.noneBtnImg = sfzList.length >= this.limitCountImg;
  678. },
  679. //上传
  680. submitUpload() {
  681. this.$refs.upload.submit();
  682. },
  683. //手动上传文件触发
  684. sfzRequest(param) {
  685. let fileObj = param.file; // 相当于input里取得的files
  686. const isLt2M = fileObj.size / 1024 / 1024 < 2;
  687. if (!isLt2M) {
  688. this.$message.error("上传图片大小不能超过 2MB!");
  689. loading.close();
  690. }
  691. const isJPG = fileObj.type === "image/jpeg"||
  692. fileObj.type === "image/png";
  693. if (!isJPG) {
  694. this.$message.error("上传头像图片只能是 JPG ,PNG格式!");
  695. loading.close();
  696. }
  697. let fd = new FormData(); // FormData 对象
  698. fd.append("file", fileObj); // 文件对象
  699. fd.append("fileType", "00"); //文件类型
  700. const loading = this.$loading({
  701. lock: true,
  702. text: "Loading",
  703. spinner: "el-icon-loading",
  704. background: "rgba(0, 0, 0, 0.7)",
  705. });
  706. uploadFileNew(fd).then((response) => {
  707. if (response) {
  708. this.sfzList.push({
  709. uid: response.fileId,
  710. url: response.url + "/" + getToken(),
  711. });
  712. setTimeout(() => {
  713. loading.close();
  714. }, 2000);
  715. }
  716. }).catch((response) => {
  717. loading.close();
  718. });
  719. },
  720. },
  721. };
  722. </script>