bill.vue 15 KB

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