fundSide.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  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. :before-upload="beforeAvatarUpload"
  286. multiple
  287. :limit="20"
  288. :on-exceed="handleExceed"
  289. list-type="picture-card"
  290. :file-list="sfzList"
  291. :auto-upload="true"
  292. >
  293. <el-button slot="trigger" size="small" type="primary"
  294. >点击选择</el-button
  295. >
  296. </el-upload>
  297. </el-form-item>
  298. <!-- <el-button
  299. style="margin-left: 10px"
  300. size="small"
  301. type="success"
  302. @click="submitUpload"
  303. >上传到服务器</el-button
  304. > -->
  305. </el-form>
  306. <div slot="footer" class="dialog-footer">
  307. <el-button type="primary" @click="submitForm">确 定</el-button>
  308. <el-button @click="cancel">取 消</el-button>
  309. </div>
  310. </el-dialog>
  311. <el-dialog :visible.sync="sfzVisible">
  312. <img width="100%" :src="sfzImageUrl" alt="" />
  313. </el-dialog>
  314. </div>
  315. </template>
  316. <script>
  317. import {
  318. listFund,
  319. getFund,
  320. addFund,
  321. updateFund,
  322. fundSideStatus,
  323. } from "@/api/fundSide/fundSide";
  324. import Editor from "@/components/Editor";
  325. import { uploadFileNew } from "@/api/common/file";
  326. import { getToken } from "@/utils/auth";
  327. export default {
  328. name: "fundSide",
  329. components: {
  330. Editor,
  331. },
  332. data() {
  333. return {
  334. //图片预览
  335. sfzImageUrl: "",
  336. sfzVisible: false,
  337. showBtnImg: false,
  338. noneBtnImg: false,
  339. limitCountImg: 20,
  340. // id隐藏
  341. isShow: false,
  342. // 遮罩层
  343. loading: true,
  344. // 选中数组
  345. ids: [],
  346. // 非单个禁用
  347. single: true,
  348. // 非多个禁用
  349. multiple: true,
  350. // 显示搜索条件
  351. showSearch: true,
  352. //联系人隐藏
  353. disabled: false,
  354. disableds: false,
  355. // 总条数
  356. total: 0,
  357. // 资金方表格数据
  358. fundList: [],
  359. //姓名
  360. nameList: [],
  361. //字典
  362. formulaOptions: [],
  363. formulaOptionsSend: [],
  364. UserList: [],
  365. enclosureList: [],
  366. sfzList: [],
  367. // 弹出层标题
  368. title: "",
  369. // 是否显示弹出层
  370. open: false,
  371. // 查询参数
  372. queryParams: {
  373. pageNum: 1,
  374. pageSize: 10,
  375. scyName: null,
  376. smiType: null,
  377. smiManager: null,
  378. smiContract: null,
  379. smiContractPhone: null,
  380. sfsContent: null,
  381. sfsIsDel: null,
  382. sfsRemark: null,
  383. ssId: null,
  384. ssName: null,
  385. },
  386. // 表单参数
  387. form: {},
  388. // 表单校验
  389. rules: {
  390. scyName: [
  391. {
  392. required: true,
  393. message: "资金方名称不能为空",
  394. trigger: ["change", "blur"],
  395. },
  396. {
  397. pattern: /^[\u2E80-\u9FFF]|\w|[,,\.。]+$/,
  398. message: "资金方名称不能含有特殊字符",
  399. trigger: "blur",
  400. },
  401. ],
  402. smiAddress: [
  403. {
  404. required: true,
  405. message: "资金方网点不能为空",
  406. trigger: ["change", "blur"],
  407. },
  408. {
  409. pattern: /^[\u2E80-\u9FFF]|\w|[,,\.。]+$/,
  410. message: "资金方网点不能含有特殊字符",
  411. trigger: "blur",
  412. },
  413. ],
  414. smiType: [
  415. {
  416. required: true,
  417. message: "资金方类型不能为空",
  418. trigger: ["change", "blur"],
  419. },
  420. ],
  421. smiAgreementType: [
  422. {
  423. required: true,
  424. message: "合作协议签署不能为空",
  425. trigger: ["change", "blur"],
  426. },
  427. ],
  428. scySocialCode: [
  429. {
  430. required: true,
  431. message: "社会统一信用代码不能为空",
  432. trigger: ["change", "blur"],
  433. },
  434. ],
  435. smiManager: [
  436. {
  437. required: true,
  438. message: "客户经理不能为空",
  439. trigger: ["change", "blur"],
  440. },
  441. {
  442. pattern: /^[\u2E80-\u9FFF]|\w|[,,\.。]+$/,
  443. message: "客户经理不能含有特殊字符",
  444. trigger: "blur",
  445. },
  446. ],
  447. smiContract: [
  448. {
  449. required: true,
  450. message: "联系人姓名不能为空",
  451. trigger: ["change", "blur"],
  452. },
  453. {
  454. pattern: /^[\u2E80-\u9FFF]|\w|[,,\.。]+$/,
  455. message: "联系人姓名不能含有特殊字符",
  456. trigger: "blur",
  457. },
  458. ],
  459. smiContractPhone: [
  460. {
  461. required: true,
  462. message: "联系人电话不能为空",
  463. trigger: ["change", "blur"],
  464. },
  465. {
  466. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  467. message: "请输入正确的手机号码",
  468. trigger: ["blur", "change"],
  469. },
  470. ],
  471. },
  472. };
  473. },
  474. created() {
  475. this.getList();
  476. this.getDicts("sys_smi_type").then((response) => {
  477. this.formulaOptions = response.data;
  478. });
  479. this.getDicts("sys_agreement_type").then((response) => {
  480. this.formulaOptionsSend = response.data;
  481. });
  482. },
  483. methods: {
  484. /** 查询资金方列表 */
  485. getList() {
  486. this.loading = true;
  487. listFund(this.queryParams).then((response) => {
  488. this.fundList = response.rows;
  489. this.total = response.total;
  490. this.loading = false;
  491. });
  492. },
  493. // 取消按钮
  494. cancel() {
  495. this.open = false;
  496. this.reset();
  497. },
  498. // 表单重置
  499. reset() {
  500. this.form = {
  501. scyId: null,
  502. scyName: null,
  503. smiType: null,
  504. smiManager: null,
  505. smiContract: null,
  506. smiContractPhone: null,
  507. sfsContent: null,
  508. sfsIsDel: null,
  509. createBy: null,
  510. createTime: null,
  511. updateBy: null,
  512. updateTime: null,
  513. sfsRemark: null,
  514. ssId: null,
  515. ssName: null,
  516. };
  517. this.noneBtnImg = false;
  518. this.enclosureList = [];
  519. this.sfzList = [];
  520. this.resetForm("form");
  521. },
  522. /** 搜索按钮操作 */
  523. handleQuery() {
  524. this.queryParams.pageNum = 1;
  525. this.getList();
  526. },
  527. /** 重置按钮操作 */
  528. resetQuery() {
  529. this.resetForm("queryForm");
  530. this.handleQuery();
  531. },
  532. // 多选框选中数据
  533. handleSelectionChange(selection) {
  534. this.ids = selection.map((item) => item.scyId);
  535. this.single = selection.length !== 1;
  536. this.multiple = !selection.length;
  537. },
  538. //资方类型
  539. formulaFormat(row, column) {
  540. return this.selectDictLabel(this.formulaOptions, row.smiType);
  541. },
  542. //奖项
  543. formulaFormatSend(row, column) {
  544. return this.selectDictLabel(
  545. this.formulaOptionsSend,
  546. row.smiAgreementType
  547. );
  548. },
  549. /** 新增按钮操作 */
  550. handleAdd() {
  551. this.reset();
  552. this.open = true;
  553. this.disableds = false;
  554. this.disabled = false;
  555. this.title = "添加资金方";
  556. },
  557. /** 修改按钮操作 */
  558. handleUpdate(row) {
  559. this.reset();
  560. const scyId = row.scyId || this.ids;
  561. getFund(scyId).then((response) => {
  562. console.log(response);
  563. this.form = response.data.list[0];
  564. if (response.data.data && response.data.data.length != 0) {
  565. this.sfzList.push({
  566. uid: response.data.data[0].uid,
  567. url: response.data.data[0].pfiUrl + "/" + getToken(),
  568. });
  569. this.noneBtnImg = true;
  570. }
  571. this.open = true;
  572. this.disableds = false;
  573. this.disabled = true;
  574. this.title = "修改资金方";
  575. });
  576. },
  577. /** 详情按钮操作 */
  578. handleDetail(row) {
  579. this.reset();
  580. const scyId = row.scyId || this.ids;
  581. getFund(scyId).then((response) => {
  582. console.log(response);
  583. this.form = response.data.list[0];
  584. if (response.data.data && response.data.data.length != 0) {
  585. this.sfzList.push({
  586. name: "合作协议",
  587. url: response.data.data[0].pfiUrl + "/" + getToken(),
  588. });
  589. this.noneBtnImg = true;
  590. }
  591. this.open = true;
  592. this.disableds = true;
  593. this.title = "资金方详情";
  594. });
  595. },
  596. /** 提交按钮 */
  597. submitForm() {
  598. this.$refs["form"].validate((valid) => {
  599. this.form.smiAgreement = this.sfzList;
  600. console.log(this.sfzList)
  601. console.log(this.form.smiAgreement);
  602. if (valid) {
  603. if (this.form.scyId != null) {
  604. const loading = this.$loading({
  605. lock: true,
  606. text: "Loading",
  607. spinner: "el-icon-loading",
  608. background: "rgba(0, 0, 0, 0.7)",
  609. });
  610. updateFund(this.form)
  611. .then((response) => {
  612. loading.close();
  613. this.msgSuccess("修改成功");
  614. this.open = false;
  615. this.getList();
  616. })
  617. .catch((response) => {
  618. loading.close();
  619. });
  620. } else {
  621. const loading = this.$loading({
  622. lock: true,
  623. text: "Loading",
  624. spinner: "el-icon-loading",
  625. background: "rgba(0, 0, 0, 0.7)",
  626. });
  627. addFund(this.form)
  628. .then((response) => {
  629. loading.close();
  630. this.msgSuccess("新增成功");
  631. this.open = false;
  632. this.getList();
  633. })
  634. .catch((response) => {
  635. loading.close();
  636. });
  637. }
  638. }
  639. });
  640. },
  641. //上传前校验
  642. beforeAvatarUpload(file) {
  643. const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
  644. const isLt2M = file.size / 1024 / 1024 < 2;
  645. if (!isJPG) {
  646. this.$message.error('上传图片只能是 JPG/PNG 格式');
  647. }
  648. if (!isLt2M) {
  649. this.$message.error('上传图片大小不能超过 2MB');
  650. }
  651. return isJPG && isLt2M;
  652. },
  653. //状态变更
  654. handleStatusChange(row) {
  655. let text = row.scyStatus === "00" ? "启用" : "停用";
  656. this.$confirm("确认要" + text + '"' + row.scyName + '"吗?', "警告", {
  657. confirmButtonText: "确定",
  658. cancelButtonText: "取消",
  659. type: "warning",
  660. })
  661. .then(function () {
  662. return fundSideStatus(row.scyId, row.scyStatus);
  663. })
  664. .then(() => {
  665. this.msgSuccess(text + "成功");
  666. })
  667. .catch(function () {
  668. row.scyStatus = row.scyStatus === "00" ? "01" : "00";
  669. });
  670. },
  671. //文件移除提示
  672. beforeRemove(file, sfzList) {
  673. for (let i = 0; i < this.sfzList.length; i++) {
  674. if (file.uid == this.sfzList[i].uid) {
  675. this.sfzList.splice(i, 1);
  676. break;
  677. }
  678. }
  679. this.noneBtnImg = sfzList.length >= this.limitCountImg;
  680. },
  681. handleExceed(file, sfzList) {
  682. this.$message.warning(`当前限制选择 20 个文件`);
  683. },
  684. //图片预览
  685. handlePictureCardPreview(file) {
  686. this.sfzImageUrl = file.url;
  687. this.sfzVisible = true;
  688. },
  689. dealImgChange(file, sfzList) {
  690. this.noneBtnImg = sfzList.length >= this.limitCountImg;
  691. },
  692. //上传
  693. submitUpload() {
  694. this.$refs.upload.submit();
  695. },
  696. //手动上传文件触发
  697. sfzRequest(param) {
  698. let fileObj = param.file; // 相当于input里取得的files
  699. let fd = new FormData(); // FormData 对象
  700. fd.append("file", fileObj); // 文件对象
  701. fd.append("fileType", "00"); //文件类型
  702. const loading = this.$loading({
  703. lock: true,
  704. text: "Loading",
  705. spinner: "el-icon-loading",
  706. background: "rgba(0, 0, 0, 0.7)",
  707. });
  708. uploadFileNew(fd).then((response) => {
  709. if (response) {
  710. this.sfzList.push({
  711. uid: response.fileId,
  712. url: response.url + "/" + getToken(),
  713. });
  714. setTimeout(() => {
  715. loading.close();
  716. }, 2000);
  717. }
  718. }).catch((response) => {
  719. loading.close();
  720. });
  721. },
  722. },
  723. };
  724. </script>