financeProduct.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <template>
  2. <div class="app-container">
  3. <el-card class="fiche">
  4. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList">收起</right-toolbar>
  5. <span style="margin-bottom: 10px;color:#333333;font:14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial,sans-serif">所选条件:</span>
  6. <div style="float: right;margin-right:1%">
  7. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  8. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" style="float: ;">重置</el-button>
  9. <column-setting :checkList="checkList" :tableList="tableList" :selfDom="selfDom" :tableId="tableId"></column-setting>
  10. </div>
  11. <hr style="margin-top: 16px;">
  12. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  13. <el-form-item label="产品名称" prop="zfpName" >
  14. <el-input
  15. v-model="queryParams.zfpName"
  16. placeholder="请输入产品名称"
  17. clearable
  18. size="small"
  19. maxlength="30"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="资方" prop="scyName" >
  24. <el-input
  25. v-model="queryParams.scyName"
  26. placeholder="请输入资方名称"
  27. clearable
  28. size="small"
  29. maxlength="30"
  30. @keyup.enter.native="handleQuery"
  31. />
  32. </el-form-item>
  33. <el-form-item label="最短账期">
  34. <el-input
  35. type = "number"
  36. v-model="queryParams.begin"
  37. placeholder="请输入最短账期"
  38. clearable
  39. size="small"
  40. maxlength="20"
  41. min="0"
  42. />
  43. </el-form-item>
  44. <el-form-item>
  45. ~
  46. </el-form-item>
  47. <el-form-item>
  48. <el-input
  49. type = "number"
  50. v-model="queryParams.end"
  51. placeholder="请输入最短账期"
  52. clearable
  53. size="small"
  54. @keyup.enter.native="handleQuery"
  55. maxlength="20"
  56. min="1"
  57. />
  58. </el-form-item>
  59. </el-form>
  60. </el-card>
  61. <el-row :gutter="10" class="mb8">
  62. <el-col :span="1.5">
  63. <el-button
  64. type="primary"
  65. icon="el-icon-plus"
  66. size="mini"
  67. @click="handleAdd"
  68. v-hasPermi="['service:financeProduct:add']"
  69. >新增</el-button>
  70. </el-col>
  71. </el-row>
  72. <el-table v-loading="loading" :data="financeProductList" @selection-change="handleSelectionChange" border>
  73. <el-table-column label="序号" type="index" width="50" align="center">
  74. <template slot-scope="scope">
  75. <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="产品编号" align="center" prop="zfpNumber" :show-overflow-tooltip="true"  v-if="uncheckList.zfpNumber"/>
  79. <el-table-column label="产品名称" align="center" prop="zfpName" :show-overflow-tooltip="true"  v-if="uncheckList.zfpName"/>
  80. <el-table-column label="产品类型" align="center" prop="zfpType" :formatter="typeFormat" :show-overflow-tooltip="true"  v-if="uncheckList.zfpType"/>
  81. <el-table-column label="资金方" align="center" prop="scyName" :show-overflow-tooltip="true"  v-if="uncheckList.scyName"/>
  82. <el-table-column label="是否可拆转融" align="center" prop="zfpSplit" :formatter="splitFormat" :show-overflow-tooltip="true"  v-if="uncheckList.zfpSplit"/>
  83. <el-table-column label="是否有追索权" align="center" prop="zfpRecourse" :formatter="recourseFormat" :show-overflow-tooltip="true"  v-if="uncheckList.zfpRecourse"/>
  84. <el-table-column label="电子凭证类型" align="center" prop="zfpVoucherType" :formatter="voucherTypeFormat" :show-overflow-tooltip="true"  v-if="uncheckList.zfpVoucherType"/>
  85. <el-table-column label="服务费是否可退" align="center" prop="zfpCharge" :formatter="chargeFormat" :show-overflow-tooltip="true"  v-if="uncheckList.zfpCharge"/>
  86. <el-table-column label="产品状态" align="center" prop="zfpStatus" :formatter="statusFormat" :show-overflow-tooltip="true"  v-if="uncheckList.zfpStatus"/>
  87. <el-table-column label="最小融资金额(元)" align="center" prop="zfpMinimumAmount" :formatter="moneyFormat" :show-overflow-tooltip="true"  v-if="uncheckList.zfpMinimumAmount"/>
  88. <el-table-column label="最短账期" align="center" prop="zfpShortestPeriod" :show-overflow-tooltip="true"  v-if="uncheckList.zfpShortestPeriod"/>
  89. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
  90. <template slot-scope="scope">
  91. <el-button
  92. size="mini"
  93. type="text"
  94. icon="el-icon-edit"
  95. @click="handleUpdate(scope.row)"
  96. v-hasPermi="['service:financeProduct:edit']"
  97. >修改</el-button>
  98. <el-button
  99. size="mini"
  100. type="text"
  101. icon="el-icon-edit"
  102. @click="handleChange(scope.row)"
  103. v-if="scope.row.zfpStatus == '01'"
  104. v-hasPermi="['service:financeProduct:change']"
  105. >停用</el-button>
  106. <el-button
  107. size="mini"
  108. type="text"
  109. icon="el-icon-edit"
  110. @click="handleChange(scope.row)"
  111. v-if="scope.row.zfpStatus == '00'"
  112. v-hasPermi="['service:financeProduct:change']"
  113. >启用</el-button>
  114. <el-button
  115. size="mini"
  116. type="text"
  117. icon="el-icon-delete"
  118. @click="handleDel(scope.row)"
  119. v-if="scope.row.zfpStatus == '00'"
  120. v-hasPermi="['service:financeProduct:delete']"
  121. >删除</el-button>
  122. <el-button
  123. size="mini"
  124. type="text"
  125. icon="el-icon-view"
  126. @click="handleInfo(scope.row)"
  127. v-hasPermi="['service:financeProduct:query']"
  128. >详情</el-button>
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. <pagination
  133. v-show="total>0"
  134. :total="total"
  135. :page.sync="queryParams.pageNum"
  136. :limit.sync="queryParams.pageSize"
  137. @pagination="getList"
  138. />
  139. </div>
  140. </template>
  141. <script>
  142. import { listFinanceProduct,changeState,delFinanceProduct } from "@/api/service/financeProduct/financeProduct";
  143. import ColumnSetting from "../../../components/Table/columnSetting.vue";
  144. import { columnQuery, columnfilter } from "@/api/common/columnSetting";
  145. import Cookies from 'js-cookie'
  146. export default {
  147. name: "financeProduct",
  148. components: {
  149. ColumnSetting 
  150. },
  151. data() {
  152. return {
  153. // 遮罩层
  154. loading: true,
  155. // 选中数组
  156. ids: [],
  157. // 非单个禁用
  158. single: true,
  159. // 非多个禁用
  160. multiple: true,
  161. // 显示搜索条件
  162. showSearch: true,
  163. financeProductList:[],
  164. // 总条数
  165. total: 0,
  166. // 弹出层标题
  167. title: "",
  168. // 是否显示弹出层
  169. open: false,
  170. // 查询参数
  171. queryParams: {
  172. pageNum: 1,
  173. pageSize: 10,
  174. zfpName: null,
  175. scyName: null,
  176. begin: null,
  177. end: null,
  178. },
  179. // 表单参数
  180. form: {},
  181. // 表单校验
  182. rules: {
  183. // pptName:[
  184. // { required: true, message: "项目类型不能为空", trigger: "blur" },
  185. // ]
  186. },
  187. tableList: [
  188.         {
  189.           label: "zfpNumber",
  190.           value: "产品编号"
  191.         },
  192. {
  193.           label: "zfpName",
  194.           value: "产品名称"
  195.         },
  196. {
  197.           label: "zfpType",
  198.           value: "产品类型"
  199.         },
  200. {
  201.           label: "scyName",
  202.           value: "资金方"
  203.         },
  204. {
  205.           label: "zfpSplit",
  206.           value: "是否可拆转融"
  207.         },
  208. {
  209.           label: "zfpRecourse",
  210.           value: "是否有追索权"
  211.         },
  212. {
  213.           label: "zfpVoucherType",
  214.           value: "电子凭证类型"
  215.         },
  216. {
  217.           label: "zfpCharge",
  218.           value: "服务费是否可退"
  219.         },
  220. {
  221.           label: "zfpStatus",
  222.           value: "产品状态"
  223.         },
  224. {
  225.           label: "zfpMinimumAmount",
  226.           value: "最小融资金额"
  227.         },
  228. {
  229.           label: "zfpShortestPeriod",
  230.           value: "最短账期"
  231.         },
  232. ],
  233. checkList: [], //筛选列选中的数据列表--显示隐藏列用
  234.       uncheckList: {}, //控制筛选列显示隐藏--显示隐藏列用
  235.       selfDom: this,
  236.       tableId: "/service/financeProduct/list",
  237. };
  238. },
  239. created() {
  240. this.getList();
  241. this.getDicts("zc_zfp_split").then((response) => {
  242. this.splitOptions = response.data;
  243. });
  244. this.getDicts("zc_zfp_recourse").then((response) => {
  245. this.recourseOptions = response.data;
  246. });
  247. this.getDicts("zc_zfp_status").then((response) => {
  248. this.statusOptions = response.data;
  249. });
  250. this.getDicts("zc_zfp_charge").then((response) => {
  251. this.chargeOptions = response.data;
  252. });
  253. this.getDicts("zc_zfp_voucher_type").then((response) => {
  254. this.voucherTypeOptions = response.data;
  255. });
  256. this.getDicts("zc_zfp_type").then((response) => {
  257. this.typeOptions = response.data;
  258. });
  259. },
  260. activated(){
  261. this.getList();
  262. },
  263. mounted() {
  264.     this.columnQuery();
  265.   },
  266. methods: {
  267. /** 查询融资产品列表 */
  268. getList() {
  269. this.loading = true;
  270. listFinanceProduct(this.queryParams).then(response => {
  271. this.financeProductList = response.data.records;
  272. this.total = response.data.total;
  273. this.loading = false;
  274. });
  275. },
  276. // 取消按钮
  277. cancel() {
  278. this.open = false;
  279. this.reset();
  280. },
  281. // 表单重置
  282. reset() {
  283. this.form = {
  284. };
  285. this.resetForm("form");
  286. },
  287. /** 搜索按钮操作 */
  288. handleQuery() {
  289. this.queryParams.pageNum = 1;
  290. this.getList();
  291. },
  292. /** 重置按钮操作 */
  293. resetQuery() {
  294. this.queryParams.begin = "";
  295. this.queryParams.end = "";
  296. this.resetForm("queryForm");
  297. this.handleQuery();
  298. },
  299. // 多选框选中数据
  300. handleSelectionChange(selection) {
  301. /* this.ids = selection.map(item => item.ptcId)
  302. this.single = selection.length!==1
  303. this.multiple = !selection.length */
  304. },
  305. /** 新增按钮操作 */
  306. handleAdd() {
  307. this.reset();
  308. this.resetQuery();
  309. Cookies.set("/financeProduct/addFinanceProduct/", this.$route.fullPath);
  310. this.$router.push({path:"/financeProduct/addFinanceProduct/"});
  311. },
  312. /** 修改按钮操作 */
  313. handleUpdate(row) {
  314. const zfpId = row.zfpId
  315. this.resetQuery();
  316. Cookies.set("/financeProduct/editFinanceProduct/"+zfpId+"/", this.$route.fullPath);
  317. this.$router.push({path:"/financeProduct/editFinanceProduct/"+zfpId+"/"});
  318. },/** 修改按钮操作 */
  319. handleInfo(row) {
  320. const zfpId = row.zfpId
  321. this.resetQuery();
  322. Cookies.set("/financeProduct/detailFinanceProduct/"+zfpId+"/", this.$route.fullPath);
  323. this.$router.push({path:"/financeProduct/detailFinanceProduct/"+zfpId+"/"});
  324. },
  325. /** 启用按钮操作 */
  326. handleChange(row) {
  327. let text = row.zfpStatus === "00" ? "开启产品" : "停用产品";
  328. this.$confirm(
  329. "确认要" + text + '"' + row.zfpName + '"吗?',
  330. "警告",
  331. {
  332. confirmButtonText: "确定",
  333. cancelButtonText: "取消",
  334. type: "warning",
  335. }
  336. )
  337. .then(function () {
  338. return changeState(row.zfpId);
  339. })
  340. .then(() => {
  341. this.getList();
  342. this.msgSuccess(text +'"'+ row.zfpName + '"成功');
  343. })
  344. .catch(function () {
  345. });
  346. },
  347. //拆转融字典反显
  348. splitFormat(row, column) {
  349. return this.selectDictLabel(this.splitOptions, row.zfpSplit);
  350. },
  351. //是否有追索权字典反显
  352. recourseFormat(row, column) {
  353. return this.selectDictLabel(this.recourseOptions, row.zfpRecourse);
  354. },
  355. //产品状态字典反显
  356. statusFormat(row, column) {
  357. return this.selectDictLabel(this.statusOptions, row.zfpStatus);
  358. },
  359. //服务费是否可退字典反显
  360. chargeFormat(row, column) {
  361. return this.selectDictLabel(this.chargeOptions, row.zfpCharge);
  362. },
  363. //电子凭证类型字典反显
  364. voucherTypeFormat(row, column) {
  365. return this.selectDictLabel(this.voucherTypeOptions, row.zfpVoucherType);
  366. },
  367. //类型字典反显
  368. typeFormat(row, column) {
  369. return this.selectDictLabel(this.typeOptions, row.zfpType);
  370. },
  371. //获取当前客户是否之前设置过列展示隐藏
  372.     columnQuery() {
  373.       //获取页面路径
  374.       var psfPagePath = window.location.pathname;
  375.       //用请求后台的url作为唯一标识
  376.       var psfTableName = this.tableId;
  377.       var columnForm = {};
  378.       columnForm.psfPagePath = psfPagePath;
  379.       columnForm.psfTableName = psfTableName;
  380.       columnQuery(columnForm).then(response => {
  381.         if (response.data && response.data.psfShowData) {
  382.           this.checkList = response.data.psfShowData;
  383.         }
  384.         this.filter();
  385.       });
  386.     },
  387.     //控制隐藏显示的函数
  388.     filter(checkList) {
  389.       if (!!checkList) {
  390.         this.checkList = checkList;
  391.       }
  392.       columnfilter(this.selfDom);
  393.     },
  394. /** 提交按钮 */
  395. submitForm() {
  396. this.$refs["form"].validate(valid => {
  397. if (valid) {
  398. if (this.form.pptId != null) {
  399. const loading = this.$loading({
  400. lock: true,
  401. text: "Loading",
  402. spinner: "el-icon-loading",
  403. background: "rgba(0, 0, 0, 0.7)",
  404. })
  405. updateProjectType(this.form).then(response => {
  406. loading.close();
  407. this.msgSuccess("修改成功");
  408. this.open = false;
  409. this.getList();
  410. }).catch((response)=>{
  411. loading.close();
  412. });
  413. } else {
  414. const loading = this.$loading({
  415. lock: true,
  416. text: "Loading",
  417. spinner: "el-icon-loading",
  418. background: "rgba(0, 0, 0, 0.7)",
  419. })
  420. addProjectType(this.form).then(response => {
  421. loading.close();
  422. this.msgSuccess("新增成功");
  423. this.open = false;
  424. this.getList();
  425. }).catch((response)=>{
  426. loading.close();
  427. });
  428. }
  429. }
  430. });
  431. },
  432. /** 删除按钮操作 */
  433. handleDel(row) {
  434. const zfpId = row.zfpId || this.ids;
  435. const zfpName = row.zfpName;
  436. this.$confirm('是否确认删除产品名称为"'+ zfpName +'"的数据项?', "警告", {
  437. confirmButtonText: "确定",
  438. cancelButtonText: "取消",
  439. type: "warning"
  440. }).then(function() {
  441. return delFinanceProduct(zfpId);
  442. }).then(() => {
  443. this.getList();
  444. this.msgSuccess("删除成功");
  445. })
  446. .catch(() => {
  447. this.$message({
  448. type: "warning",
  449. message: "已取消删除",
  450. });
  451. });
  452. },
  453. //列表格式化金额
  454. moneyFormat(row, column, cellValue) {
  455. if(cellValue == null || cellValue== undefined || cellValue == ''){
  456. cellValue = '0.00'
  457. }
  458. cellValue += '';
  459. if (!cellValue.includes('.')) {
  460. cellValue += '.00';
  461. }
  462.     return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
  463.         return $1 + ',';
  464.       }).replace(/\.$/, '');
  465. },
  466. /** 导出按钮操作 */
  467. handleExport() {
  468. /* this.download('base/taxCode/export', {
  469. ...this.queryParams
  470. }, `base_taxCode.xlsx`) */
  471. }
  472. }
  473. };
  474. </script>