bill.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  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="120px">
  13. <el-form-item prop="value">
  14. <el-select v-model="queryParams.value" placeholder="请选择" clearable v-if="companyType !='00'" @change="change">
  15. <el-option
  16. v-for="item in options"
  17. :key="item.value"
  18. :label="item.label"
  19. :value="item.value">
  20. </el-option>
  21. </el-select>
  22. <el-select v-model="queryParams.value" placeholder="请选择" clearable v-if="companyType =='00'" @change="change">
  23. <el-option
  24. v-for="item in optionsPlus"
  25. :key="item.value"
  26. :label="item.label"
  27. :value="item.value">
  28. </el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item prop="queryValue" v-if="queryParams.value !='02'">
  32. <el-input
  33. v-model="queryParams.queryValue"
  34. placeholder="请输入关键字模糊查询"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. maxlength="30"
  39. />
  40. </el-form-item>
  41. <el-form-item prop="queryValue" v-if="queryParams.value =='02'">
  42. <el-select v-model="queryParams.queryValue" placeholder="请选择账款类型" clearable>
  43. <el-option
  44. v-for="item in newOptions"
  45. :key="item.value"
  46. :label="item.label"
  47. :value="item.value">
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="预计还款日" prop="expireDate">
  52. <el-date-picker
  53. clearable
  54. unlink-panels
  55. v-model="queryParams.expireDate"
  56. value-format="yyyy-MM-dd"
  57. format="yyyy-MM-dd"
  58. type="daterange"
  59. range-separator="-"
  60. start-placeholder="开始日期"
  61. end-placeholder="结束日期">
  62. </el-date-picker>
  63. </el-form-item>
  64. <!-- <el-form-item label="账款编号" prop="zbiNumber">
  65. <el-input
  66. v-model="queryParams.zbiNumber"
  67. placeholder="请输入账款编号"
  68. clearable
  69. size="small"
  70. @keyup.enter.native="handleQuery"
  71. maxlength="30"
  72. />
  73. </el-form-item>
  74. <el-form-item label="账款名称" prop="zbiName">
  75. <el-input
  76. v-model="queryParams.zbiName"
  77. placeholder="请输入账款名称"
  78. clearable
  79. size="small"
  80. @keyup.enter.native="handleQuery"
  81. maxlength="20"
  82. />
  83. </el-form-item>
  84. <el-form-item label="账款类型" prop="zbiType" v-if="company.scyType!='00'">
  85. <el-select v-model="queryParams.zbiType"
  86. placeholder="请选择账款类型"
  87. clearable
  88. size="small"
  89. >
  90. <el-option
  91. v-for="dict in typeOptions"
  92. :key="dict.dictValue"
  93. :label="dict.dictLabel"
  94. :value="dict.dictValue"
  95. ></el-option>
  96. </el-select>
  97. </el-form-item>
  98. <el-form-item label="应收方" prop="payeeName">
  99. <el-input
  100. v-model="queryParams.payeeName"
  101. placeholder="请输入应收方"
  102. clearable
  103. size="small"
  104. @keyup.enter.native="handleQuery"
  105. maxlength="40"
  106. />
  107. </el-form-item>
  108. <el-form-item label="应付方" prop="payerName">
  109. <el-input
  110. v-model="queryParams.payerName"
  111. placeholder="请输入应付方"
  112. clearable
  113. size="small"
  114. @keyup.enter.native="handleQuery"
  115. maxlength="40"
  116. />
  117. </el-form-item>
  118. <el-form-item label="账款状态" prop="zbiStatus">
  119. <el-select v-model="queryParams.zbiStatus"
  120. placeholder="请选择账款状态"
  121. clearable
  122. size="small"
  123. >
  124. <el-option
  125. v-for="dict in statusOptions"
  126. :key="dict.dictValue"
  127. :label="dict.dictLabel"
  128. :value="dict.dictValue"
  129. ></el-option>
  130. </el-select>
  131. </el-form-item> -->
  132. </el-form>
  133. </el-card>
  134. <el-row :gutter="10" class="mb8">
  135. <el-col :span="1.5">
  136. <el-button
  137. type="primary"
  138. icon="el-icon-plus"
  139. size="mini"
  140. @click="handleAdd"
  141. v-hasPermi="['service:bill:add']"
  142. >新增</el-button>
  143. </el-col>
  144. </el-row>
  145. <el-table stripe
  146. v-loading="loading" :data="billList" row-key="categoryId"
  147. default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}" border >
  148. <el-table-column label="序号" type="index" width="50" align="center">
  149. <template slot-scope="scope">
  150. <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="账款编号" align="center" prop="zbiNumber" v-if="uncheckList.zbiNumber" :show-overflow-tooltip="true"/>
  154. <el-table-column label="账款名称" align="center" prop="zbiName" v-if="uncheckList.zbiName" :show-overflow-tooltip="true"/>
  155. <el-table-column label="账款类型" align="center" prop="zbiType" v-if="uncheckList.zbiType&&company.scyType!='00'" :show-overflow-tooltip="true" :formatter="typeFormat"/>
  156. <el-table-column label="关联融信" align="center" prop="zfiNumber" v-if="uncheckList.zfiNumber" :show-overflow-tooltip="true"/>
  157. <el-table-column label="应付方" align="center" prop="payerName" v-if="uncheckList.payerName" :show-overflow-tooltip="true"/>
  158. <el-table-column label="应收方" align="center" prop="payeeName" v-if="uncheckList.payeeName" :show-overflow-tooltip="true"/>
  159. <el-table-column label="账款金额" align="center" prop="zbiAmount" v-if="uncheckList.zbiAmount" :show-overflow-tooltip="true"/>
  160. <el-table-column label="贸易日期" align="center" prop="zbiDate" v-if="uncheckList.zbiDate" :show-overflow-tooltip="true">
  161. <template slot-scope="scope">
  162. <span>{{ parseTime(new Date(scope.row.zbiDate),'{y}-{m}-{d}') }}</span>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="预计还款日" align="center" prop="zbiPayDate" v-if="uncheckList.zbiPayDate" :show-overflow-tooltip="true">
  166. <template slot-scope="scope">
  167. <span>{{ parseTime(new Date(scope.row.zbiPayDate),'{y}-{m}-{d}') }}</span>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="账款状态" align="center" prop="zbiStatus" v-if="uncheckList.zbiStatus" :show-overflow-tooltip="true" :formatter="statusFormat"/>
  171. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
  172. <template slot-scope="scope">
  173. <el-button
  174. size="mini"
  175. type="text"
  176. icon="el-icon-info"
  177. @click="handleDetail(scope.row)"
  178. v-show="scope.row.zfiNumber"
  179. v-hasPermi="['service:bill:detail']"
  180. >详情</el-button>
  181. <el-button
  182. size="mini"
  183. type="text"
  184. icon="el-icon-edit"
  185. @click="handleUpdate(scope.row)"
  186. v-show="!scope.row.zfiNumber"
  187. v-hasPermi="['service:bill:edit']"
  188. >修改</el-button>
  189. <el-button
  190. size="mini"
  191. type="text"
  192. icon="el-icon-delete"
  193. @click="handleDelete(scope.row)"
  194. v-show="!scope.row.zfiNumber"
  195. v-hasPermi="['service:bill:del']"
  196. >删除</el-button>
  197. </template>
  198. </el-table-column>
  199. </el-table>
  200. <pagination
  201. v-show="total>0"
  202. :total="total"
  203. :page.sync="queryParams.pageNum"
  204. :limit.sync="queryParams.pageSize"
  205. @pagination="getList"
  206. />
  207. </div>
  208. </template>
  209. <script>
  210. import { listBill, deleteBill } from "@/api/service/bill/bill";
  211. import { getOwnCompany } from "@/api/common/company";
  212. import { getUserProfile } from "@/api/system/user";
  213. import {columnQuery,columnfilter} from "@/api/common/columnSetting";
  214. import ColumnSetting from '../../../components/Table/columnSetting.vue';
  215. import Cookies from 'js-cookie'
  216. export default {
  217. name: "Bill",
  218. components: {
  219. ColumnSetting
  220. },
  221. data() {
  222. return {
  223. options: [{
  224. value: '00',
  225. label: '按账款名称查询'
  226. }, {
  227. value: '01',
  228. label: '按账款编号查询'
  229. }, {
  230. value: '02',
  231. label: '按账款类型查询'
  232. }, {
  233. value: '03',
  234. label: '按应收企业名称查询'
  235. }, {
  236. value: '04',
  237. label: '按应付企业名称查询'
  238. }],
  239. optionsPlus: [{
  240. value: '00',
  241. label: '按账款名称查询'
  242. }, {
  243. value: '01',
  244. label: '按账款编号查询'
  245. }, {
  246. value: '03',
  247. label: '按应收企业名称查询'
  248. }, {
  249. value: '04',
  250. label: '按应付企业名称查询'
  251. }],
  252. newOptions: [{
  253. value: '00',
  254. label: '应收账款'
  255. }, {
  256. value: '01',
  257. label: '应付账款'
  258. }],
  259. value:null,
  260. // 遮罩层
  261. loading: false,
  262. // 显示搜索条件
  263. showSearch: true,
  264. // 总条数
  265. total: 0,
  266. //企业类型
  267. companyType:null,
  268. // 资料目录表格数据
  269. billList: [],
  270. //账款类型
  271. typeOptions: [],
  272. //账款状态
  273. statusOptions: [],
  274. // 查询参数
  275. queryParams: {
  276. pageNum: 1,
  277. pageSize: 10,
  278. // zbiNumber: null,
  279. // zbiName: null,
  280. // zbiType: null,
  281. // payeeName: null,
  282. // payerName: null,
  283. // zbiStatus:null,
  284. value:null,
  285. // queryType:null,
  286. queryValue:null,
  287. expireDate:null,
  288. },
  289. company:{},
  290. //筛选按钮的数据列表,与table表头的数据一致 --显示隐藏列用
  291. tableList: [
  292. {
  293. label: 'zbiNumber',
  294. value: '账款编号'
  295. },
  296. {
  297. label: 'zbiName',
  298. value: '账款名称'
  299. },
  300. {
  301. label: 'zbiType',
  302. value: '账款类型'
  303. },
  304. {
  305. label: 'zfiNumber',
  306. value: '关联融信'
  307. },
  308. {
  309. label: 'payerName',
  310. value: '应付方'
  311. },
  312. {
  313. label: 'payeeName',
  314. value: '应收方'
  315. },
  316. {
  317. label: 'zbiAmount',
  318. value: '账款金额'
  319. },
  320. {
  321. label: 'zbiDate',
  322. value: '贸易日期'
  323. },
  324. {
  325. label: 'zbiPayDate',
  326. value: '预计收/付款日期'
  327. },
  328. {
  329. label: 'zbiStatus',
  330. value: '账款状态'
  331. }
  332. ],
  333. checkList: [],//筛选列选中的数据列表--显示隐藏列用
  334. uncheckList: {},//控制筛选列显示隐藏--显示隐藏列用
  335. selfDom : this,
  336. tableId:"/sc-service/ownBill/billList",
  337. };
  338. },
  339. created() {
  340. getUserProfile().then((response) =>{
  341. this.companyType = response.data.companyType
  342. if("00" == response.data.companyType){
  343. this.queryParams.value = "01"
  344. }else if("01" == response.data.companyType){
  345. this.queryParams.value = "03"
  346. }else if("02" == response.data.companyType){
  347. this.queryParams.value = "04"
  348. }
  349. });
  350. getOwnCompany().then((response) => {
  351. this.company = response.data;
  352. });
  353. this.getList();
  354. this.getDicts("zc_bill_type").then(response => {
  355. this.typeOptions = response.data;
  356. });
  357. this.getDicts("zc_bill_status").then(response => {
  358. this.statusOptions = response.data;
  359. });
  360. },
  361. activated () {
  362. this.getList();
  363. this.getDicts("zc_bill_type").then(response => {
  364. this.typeOptions = response.data;
  365. });
  366. this.getDicts("zc_bill_status").then(response => {
  367. this.statusOptions = response.data;
  368. });
  369. },
  370. mounted() {
  371. this.columnQuery();
  372. },
  373. methods: {
  374. //获取当前客户是否之前设置过列展示隐藏
  375. columnQuery(){
  376. //获取页面路径
  377. var psfPagePath = window.location.pathname;
  378. //用请求后台的url作为唯一标识
  379. var psfTableName = this.tableId;
  380. var columnForm = {};
  381. columnForm.psfPagePath = psfPagePath;
  382. columnForm.psfTableName = psfTableName;
  383. columnQuery(columnForm).then(response => {
  384. if(response.data && response.data.psfShowData){
  385. this.checkList = response.data.psfShowData;
  386. }
  387. this.filter();
  388. })
  389. },
  390. //控制隐藏显示的函数
  391. filter(checkList) {
  392. if (!!checkList) {
  393. this.checkList = checkList;
  394. }
  395. columnfilter(this.selfDom);
  396. },
  397. /** 查询往来账款列表 */
  398. getList() {
  399. this.loading = true;
  400. listBill(this.queryParams).then(response => {
  401. this.billList = response.data.records;
  402. this.total = response.data.total
  403. this.loading = false;
  404. });
  405. },
  406. // 账款类型字典翻译
  407. typeFormat(row, column) {
  408. return this.selectDictLabel(this.typeOptions, row.zbiType);
  409. },
  410. //账款状态字典翻译
  411. statusFormat(row, column) {
  412. return this.selectDictLabel(this.statusOptions, row.zbiStatus);
  413. },
  414. change(){
  415. this.queryParams.queryValue = null
  416. },
  417. // 表单重置
  418. reset() {
  419. this.form = {
  420. dciDeptName: undefined
  421. };
  422. this.resetForm("form");
  423. },
  424. /** 搜索按钮操作 */
  425. handleQuery() {
  426. this.queryParams.pageNum = 1;
  427. this.getList();
  428. },
  429. /** 重置按钮操作 */
  430. resetQuery() {
  431. this.resetForm("queryForm");
  432. this.handleQuery();
  433. },
  434. /** 新增按钮操作 */
  435. handleAdd(row) {
  436. this.resetQuery();
  437. Cookies.set("/bill/billAdd", this.$route.fullPath)
  438. this.$router.push({ path: "/bill/billAdd" });
  439. },
  440. /** 修改按钮操作 */
  441. handleUpdate(row) {
  442. this.resetQuery();
  443. Cookies.set("/bill/billEdit/" + row.zbiId, this.$route.fullPath)
  444. this.$router.push({ path: "/bill/billEdit/" + row.zbiId });
  445. },
  446. /** 详情按钮操作 */
  447. handleDetail(row) {
  448. this.resetQuery();
  449. Cookies.set("/bill/billDetail/" + row.zbiId, this.$route.fullPath)
  450. this.$router.push({ path: "/bill/billDetail/" + row.zbiId });
  451. },
  452. /** 删除按钮操作 */
  453. handleDelete(row) {
  454. var self = this
  455. const zbiName = row.zbiName;
  456. const zbiIds = row.zbiId;
  457. this.$confirm('是否确认删除往来账款名称为"' + zbiName + '"的数据项?', "警告", {
  458. confirmButtonText: "确定",
  459. cancelButtonText: "取消",
  460. type: "warning"
  461. }).then(function() {
  462. self.loading = true
  463. return deleteBill(zbiIds);
  464. }).then(() => {
  465. this.getList();
  466. this.msgSuccess("删除成功");
  467. }).catch(() => {
  468. this.$message({
  469. type: "warning",
  470. message: "已取消删除",
  471. });
  472. });
  473. }
  474. }
  475. };
  476. </script>