supplierCreditLine.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  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" style="margin-left:5px"></column-setting> -->
  10. </div>
  11. <hr style="margin-top: 16px;">
  12. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  13. <el-form-item prop="scyName" label="企业名称">
  14. <el-input
  15. v-model="queryParams.scyName"
  16. placeholder="请输入企业名称"
  17. clearable
  18. size="small"
  19. maxlength="25"
  20. style="width: 190px"
  21. />
  22. </el-form-item>
  23. <el-form-item prop="AmountA" label="授信额度范围" label-width="90px">
  24. <el-input
  25. v-model="queryParams.AmountA"
  26. placeholder="请输授信额度"
  27. clearable
  28. size="small"
  29. maxlength="20"
  30. style="width: 190px"
  31. />
  32. </el-form-item>
  33. <el-form-item>
  34. -
  35. </el-form-item>
  36. <el-form-item prop="AmountB">
  37. <el-input
  38. v-model="queryParams.AmountB"
  39. placeholder="请输授信额度"
  40. clearable
  41. size="small"
  42. maxlength="20"
  43. style="width: 190px"
  44. />
  45. </el-form-item>
  46. <el-form-item label="授信状态" prop="zfsqStatus">
  47. <el-select v-model="queryParams.zfsqStatus" placeholder="请选择状态" clearable size="small">
  48. <el-option
  49. v-for="dict in statusOptions"
  50. :key="dict.dictValue"
  51. :label="dict.dictLabel"
  52. :value="dict.dictValue"
  53. />
  54. </el-select>
  55. </el-form-item>
  56. </el-form>
  57. </el-card>
  58. <el-row :gutter="10" class="mb8">
  59. <el-col :span="1.5">
  60. <el-button
  61. type="primary"
  62. icon="el-icon-plus"
  63. size="mini"
  64. @click="handleAdd"
  65. v-hasPermi="['supplierCredit:line:add']"
  66. >新增</el-button>
  67. </el-col>
  68. <el-col :span="1.5">
  69. <el-button
  70. type="warning"
  71. icon="el-icon-upload2"
  72. size="mini"
  73. @click="handleImport"
  74. v-hasPermi="['supplierCredit:line:importData']"
  75. style="background-color: #23C6C8;
  76. border-color:#23C6C8"
  77. >导入</el-button>
  78. </el-col>
  79. </el-row>
  80. <el-table v-loading="loading" :data="quotaList" @selection-change="handleSelectionChange">
  81. <!-- <el-table-column type="selection" width="55" align="center" /> -->
  82. <el-table-column label="序号" type="index" width="50" align="center">
  83. <template slot-scope="scope">
  84. <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="企业名称" align="center" prop="scyName" show-overflow-tooltip/>
  88. <el-table-column label="企业代码" align="center" prop="scySocialCode" show-overflow-tooltip/>
  89. <el-table-column label="授信额度" align="center" prop="zfsqAmount" />
  90. <el-table-column label="授信状态" :formatter="statusFormat" align="center" prop="zfsqStatus" />
  91. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  92. <template slot-scope="scope">
  93. <el-button
  94. size="mini"
  95. type="text"
  96. icon="el-icon-edit"
  97. @click="handleEdit(scope.row)"
  98. v-if="scope.row.zfsqStatus == '01'"
  99. v-hasPermi="['supplierCredit:line:edit']"
  100. >修改</el-button>
  101. <el-button
  102. type="text"
  103. size="mini"
  104. icon="el-icon-s-check"
  105. @click="handleUpdate(scope.row)"
  106. v-hasPermi="['supplierCredit:line:update']"
  107. v-if="scope.row.zfsqStatus == '00'"
  108. >冻结</el-button>
  109. <el-button
  110. size="mini"
  111. type="text"
  112. icon="el-icon-delete"
  113. @click="handleUpdate(scope.row)"
  114. v-if="scope.row.zfsqStatus == '01'"
  115. v-hasPermi="['supplierCredit:line:update']"
  116. >解冻</el-button>
  117. <el-button
  118. size="mini"
  119. type="text"
  120. icon="el-icon-delete"
  121. @click="handleDelete(scope.row)"
  122. v-if="scope.row.zfsqStatus == '01'"
  123. v-hasPermi="['supplierCredit:line:remove']"
  124. >删除</el-button>
  125. </template>
  126. </el-table-column>
  127. </el-table>
  128. <pagination
  129. v-show="total>0"
  130. :total="total"
  131. :page.sync="queryParams.pageNum"
  132. :limit.sync="queryParams.pageSize"
  133. @pagination="getList"
  134. />
  135. <!-- 添加或修改供应商授信额度对话框 -->
  136. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  137. <el-form :inline="true" ref="form" :model="form" :rules="rules" label-width="80px" :label-position="labelPosition">
  138. <el-form-item label="企业名称:" prop="zfsqCompanyId">
  139. <el-select v-model="form.zfsqCompanyId" style="width : 300px" clearable :disabled="isDisabled">
  140. <el-option
  141. v-for="(item,index) in gysCompanyList"
  142. :key="index"
  143. :label="item.scyName"
  144. :value="item.scyId"
  145. @click.native="code(item)"
  146. ></el-option>
  147. </el-select>
  148. </el-form-item>
  149. <el-form-item label="企业统一代码:" prop="scySocialCode">
  150. <el-input v-model="form.scySocialCode" :disabled="true" placeholder="请输入企业统一代码" style="width:300px"/>
  151. </el-form-item>
  152. <el-form-item label="还款账户:" prop="zfsqAccount">
  153. <el-input v-model="form.zfsqAccount" placeholder="请输入还款账户" style="width:300px" maxlength="50"/>
  154. </el-form-item>
  155. <el-form-item label="还款账户开户行:" prop="zfsqAccountBank">
  156. <el-input v-model="form.zfsqAccountBank" placeholder="请输入还款账户开户行" style="width:300px" maxlength="30"/>
  157. </el-form-item>
  158. <el-form-item label="授信额度:" prop="zfsqAmount">
  159. <el-input v-model="form.zfsqAmount" placeholder="请输入授信额度" style="width:300px">
  160. <template slot="append">元</template>
  161. </el-input>
  162. </el-form-item>
  163. </el-form>
  164. <div slot="footer" class="dialog-footer">
  165. <el-button type="primary" @click="submitForm">确 定</el-button>
  166. <el-button @click="cancel">取 消</el-button>
  167. </div>
  168. </el-dialog>
  169. <!-- 导入 -->
  170. <el-dialog :title="upload.title" :visible.sync="upload.open" :rules="rules" width="400px" append-to-body>
  171. <el-upload
  172. ref="upload"
  173. :limit="1"
  174. accept=".xlsx, .xls"
  175. :headers="upload.headers"
  176. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  177. :disabled="upload.isUploading"
  178. :on-progress="handleFileUploadProgress"
  179. :on-success="handleFileSuccess"
  180. :auto-upload="false"
  181. drag
  182. >
  183. <i class="el-icon-upload"></i>
  184. <div class="el-upload__text">
  185. 将文件拖到此处,或
  186. <em>点击上传</em>
  187. </div>
  188. <div class="el-upload__tip" slot="tip">
  189. <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据 -->
  190. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  191. </div>
  192. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  193. </el-upload>
  194. <div slot="footer" class="dialog-footer">
  195. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  196. <el-button @click="upload.open = false">取 消</el-button>
  197. </div>
  198. </el-dialog>
  199. </div>
  200. </template>
  201. <script>
  202. import { listQuota, getQuota, delQuota, addQuota, updateQuota ,changeStatus,listCompanyRel} from "@/api/service/creditLine/quota";
  203. import { listCompany } from "@/api/common/company";
  204. import { getToken } from "@/utils/auth";
  205. export default {
  206. name: "Quota",
  207. components: {
  208. },
  209. data() {
  210. var self = this;
  211. return {
  212. //核心企业授信id
  213. zfpcrId: '',
  214. //核心企业id
  215. zfpcrCompanyId: '',
  216. //导入限制数量
  217. uploadNum: 0,
  218. //是否禁用
  219. isDisabled: false,
  220. labelPosition: 'top',
  221. // 遮罩层
  222. loading: true,
  223. // 选中数组
  224. ids: [],
  225. // 非单个禁用
  226. single: true,
  227. // 非多个禁用
  228. multiple: true,
  229. // 显示搜索条件
  230. showSearch: true,
  231. // 总条数
  232. total: 0,
  233. // 供应商授信额度表格数据
  234. quotaList: [],
  235. //供应商数据
  236. gysCompanyList: [],
  237. //授信状态数据字典
  238. statusOptions: [],
  239. // 弹出层标题
  240. title: "",
  241. // 是否显示弹出层
  242. open: false,
  243. // 导入参数
  244. upload: {
  245. // 是否显示弹出层(导入)
  246. open: false,
  247. // 弹出层标题(导入)
  248. title: "",
  249. // 是否禁用上传
  250. isUploading: false,
  251. // 是否更新已经存在的用户数据
  252. updateSupport: 0,
  253. // 设置上传的请求头部
  254. headers: { Authorization: "Bearer " + getToken() },
  255. // 上传的地址
  256. url: process.env.VUE_APP_BASE_API + "/sc-service/supplierCreditLine/importData/" + self.zfpcrId + '/' + self.zfpcrCompanyId,
  257. },
  258. // 查询参数
  259. queryParams: {
  260. pageNum: 1,
  261. pageSize: 10,
  262. zfsqCoreQuotaId: null,
  263. zfsqCompanyId: null,
  264. zfsqAmount: null,
  265. zfsqOldAmount: null,
  266. zfsqRate: null,
  267. zfsqUsedAmount: null,
  268. zfsqAvailableAmount: null,
  269. zfsqDateType: null,
  270. zfsqStartDate: null,
  271. zfsqEndDate: null,
  272. zfsqStatus: null,
  273. zfsqProfitSpare1: null,
  274. zfsqProfitSpare2: null,
  275. zfsqProfitSpare3: null,
  276. zfsqProfitSpare4: null,
  277. zfsqProfitSpare5: null,
  278. zfsqProfitSpare6: null,
  279. zfsqProfitSpare7: null,
  280. zfsqProfitSpare8: null,
  281. zfsqProfitSpare9: null,
  282. sysName: null,
  283. AmountA: null,
  284. AmountB: null,
  285. },
  286. // 表单参数
  287. form: {},
  288. // 表单校验
  289. rules: {
  290. zfsqCompanyId: [
  291. { required: true, message: "企业名称不能为空", trigger: ["blur", "change"] }
  292. ],
  293. scySocialCode: [
  294. { required: true, message: "企业统一代码不能为空", trigger: ["blur", "change"] }
  295. ],
  296. zfsqAccount: [
  297. { required: true, message: "还款账户不能为空", trigger: ["blur", "change"] }
  298. ],
  299. zfsqAccountBank: [
  300. { required: true, message: "还款账户开户行不能为空", trigger: ["blur", "change"] }
  301. ],
  302. zfsqAmount: [
  303. { required: true, message: "授信额度不能为空", trigger: ["blur", "change"] },
  304. {
  305. pattern: /^[0-9][0-9]{0,7}$|^[1-9][0-9]{0,7}[.]\d{1,2}$/,
  306. message: "请输入正确的额度",
  307. trigger: "change",
  308. },
  309. ],
  310. }
  311. };
  312. },
  313. created() {
  314. this.zfpcrId = this.$route.params && this.$route.params.zfpcrId;
  315. this.zfpcrCompanyId = this.$route.params && this.$route.params.zfpcrCompanyId;
  316. this.upload.url = process.env.VUE_APP_BASE_API + "/sc-service/supplierCreditLine/importData/" + this.zfpcrId + '/' + this.zfpcrCompanyId,
  317. this.getDicts("zc_zfpcr_status").then(response => {
  318. this.statusOptions = response.data;
  319. });
  320. this.getList();
  321. },
  322. methods: {
  323. /** 查询供应商授信额度列表 */
  324. getList() {
  325. this.loading = true;
  326. this.queryParams.zfsqId = this.zfpcrId;
  327. listQuota(this.queryParams).then(response => {
  328. this.quotaList = response.data.records;
  329. this.total = response.data.total;
  330. this.loading = false;
  331. });
  332. },
  333. /* 供应商公司 */
  334. getGysCompany(){
  335. listCompanyRel(this.zfpcrCompanyId).then((response) =>{
  336. this.gysCompanyList = response.data;
  337. })
  338. },
  339. /* 选择企业带出企业统一代码 */
  340. code(item) {
  341. this.$set(this.form, "scySocialCode", item.scySocialCode);
  342. },
  343. // 取消按钮
  344. cancel() {
  345. this.open = false;
  346. this.reset();
  347. },
  348. // 表单重置
  349. reset() {
  350. this.form = {
  351. zfsqId: null,
  352. zfsqCoreQuotaId: null,
  353. zfsqCompanyId: null,
  354. zfsqAmount: null,
  355. zfsqOldAmount: null,
  356. zfsqRate: null,
  357. zfsqUsedAmount: null,
  358. zfsqAvailableAmount: null,
  359. zfsqDateType: null,
  360. zfsqStartDate: null,
  361. zfsqEndDate: null,
  362. zfsqStatus: "00",
  363. zfsqProfitSpare1: null,
  364. zfsqProfitSpare2: null,
  365. zfsqProfitSpare3: null,
  366. zfsqProfitSpare4: null,
  367. zfsqProfitSpare5: null,
  368. zfsqProfitSpare6: null,
  369. zfsqProfitSpare7: null,
  370. zfsqProfitSpare8: null,
  371. zfsqProfitSpare9: null,
  372. createBy: null,
  373. createTime: null,
  374. updateBy: null,
  375. updateTime: null,
  376. zfsqAccount: null,
  377. zfsqAccountBank: null
  378. };
  379. this.resetForm("form");
  380. },
  381. /** 搜索按钮操作 */
  382. handleQuery() {
  383. this.queryParams.pageNum = 1;
  384. this.getList();
  385. },
  386. /** 重置按钮操作 */
  387. resetQuery() {
  388. this.resetForm("queryForm");
  389. this.handleQuery();
  390. },
  391. // 多选框选中数据
  392. handleSelectionChange(selection) {
  393. this.ids = selection.map(item => item.zfsqId)
  394. this.single = selection.length!==1
  395. this.multiple = !selection.length
  396. },
  397. /** 字典翻译 */
  398. statusFormat(row, column) {
  399. return this.selectDictLabel(this.statusOptions, row.zfsqStatus);
  400. },
  401. /** 新增按钮操作 */
  402. handleAdd() {
  403. this.reset();
  404. this.getGysCompany();
  405. this.isDisabled = false;
  406. this.open = true;
  407. this.title = "添加供应商授信额度";
  408. },
  409. /** 修改按钮操作 */
  410. handleEdit(row) {
  411. this.reset();
  412. const zfsqId = row.zfsqId || this.ids
  413. this.getGysCompany();
  414. getQuota(zfsqId).then(response => {
  415. this.form = response.data[0];
  416. this.isDisabled = true;
  417. this.open = true;
  418. this.title = "修改供应商授信额度";
  419. });
  420. },
  421. /** 冻结/解冻按钮操作 */
  422. handleUpdate(row) {
  423. let text = row.zfsqStatus === "0" ? "解冻" : "冻结";
  424. this.$confirm(
  425. "确认要" + text + '此数据项吗?',
  426. "警告",
  427. {
  428. confirmButtonText: "确定",
  429. cancelButtonText: "取消",
  430. type: "warning",
  431. }
  432. )
  433. .then(function() {
  434. return changeStatus(row.zfsqId,row.zfsqStatus);
  435. })
  436. .then(() => {
  437. this.getList();
  438. this.msgSuccess(text + "成功");
  439. })
  440. },
  441. /** 提交按钮 */
  442. submitForm() {
  443. this.$refs["form"].validate(valid => {
  444. if (valid) {
  445. this.form.zfsqCoreQuotaId = this.zfpcrId;
  446. if (this.form.zfsqId != null) {
  447. updateQuota(this.form).then(response => {
  448. this.msgSuccess("修改成功");
  449. this.open = false;
  450. this.getList();
  451. });
  452. } else {
  453. addQuota(this.form).then(response => {
  454. this.msgSuccess("新增成功");
  455. this.open = false;
  456. this.getList();
  457. });
  458. }
  459. }
  460. });
  461. },
  462. /** 删除按钮操作 */
  463. handleDelete(row) {
  464. const zfsqIds = row.zfsqId || this.ids;
  465. const scyName = row.scyName;
  466. this.$confirm('是否确认删除企业名称为"' + scyName + '"的数据项?', "警告", {
  467. confirmButtonText: "确定",
  468. cancelButtonText: "取消",
  469. type: "warning"
  470. }).then(function() {
  471. return delQuota(zfsqIds);
  472. }).then(() => {
  473. this.getList();
  474. this.msgSuccess("删除成功");
  475. })
  476. },
  477. /** 导入按钮操作 */
  478. handleImport() {
  479. this.reset();
  480. this.upload.title = "授信导入";
  481. this.upload.open = true;
  482. },
  483. /** 下载模板操作 */
  484. importTemplate() {
  485. this.download(
  486. "/sc-service/supplierCreditLine/importTemplate/",
  487. {},
  488. `融资方授信模版${new Date().getTime()}.xls`
  489. );
  490. },
  491. // 文件上传中处理
  492. handleFileUploadProgress(event, file, fileList) {
  493. this.upload.isUploading = true;
  494. },
  495. // 文件上传成功处理
  496. handleFileSuccess(response, file, fileList) {
  497. this.upload.open = false;
  498. this.upload.isUploading = false;
  499. this.$refs.upload.clearFiles();
  500. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  501. this.getList();
  502. },
  503. // 提交上传文件
  504. submitFileForm() {
  505. this.$refs.upload.submit();
  506. },
  507. /** 导出按钮操作 */
  508. handleExport() {
  509. this.download('system/quota/export', {
  510. ...this.queryParams
  511. }, `system_quota.xlsx`)
  512. }
  513. }
  514. };
  515. </script>