bill.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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. </div>
  10. <hr style="margin-top: 16px;">
  11. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
  12. <el-form-item label="账款编号" prop="zbiNumber">
  13. <el-input
  14. v-model="queryParams.zbiNumber"
  15. placeholder="请输入账款编号"
  16. clearable
  17. size="small"
  18. @keyup.enter.native="handleQuery"
  19. maxlength="10"
  20. />
  21. </el-form-item>
  22. <el-form-item label="账款名称" prop="zbiName">
  23. <el-input
  24. v-model="queryParams.zbiName"
  25. placeholder="请输入账款名称"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. maxlength="10"
  30. />
  31. </el-form-item>
  32. <el-form-item label="账款类型" prop="zbiType">
  33. <el-select v-model="queryParams.zbiType"
  34. placeholder="请选择账款类型"
  35. clearable
  36. size="small"
  37. >
  38. <el-option
  39. v-for="dict in typeOptions"
  40. :key="dict.dictValue"
  41. :label="dict.dictLabel"
  42. :value="dict.dictValue"
  43. ></el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="应收方" prop="payeeName">
  47. <el-input
  48. v-model="queryParams.payeeName"
  49. placeholder="请输入应收方"
  50. clearable
  51. size="small"
  52. @keyup.enter.native="handleQuery"
  53. maxlength="10"
  54. />
  55. </el-form-item>
  56. <el-form-item label="应付方" prop="payerName">
  57. <el-input
  58. v-model="queryParams.payerName"
  59. placeholder="请输入应付方"
  60. clearable
  61. size="small"
  62. @keyup.enter.native="handleQuery"
  63. maxlength="10"
  64. />
  65. </el-form-item>
  66. <el-form-item label="账款状态" prop="zbiStatus">
  67. <el-select v-model="queryParams.zbiStatus"
  68. placeholder="请选择账款状态"
  69. clearable
  70. size="small"
  71. >
  72. <el-option
  73. v-for="dict in statusOptions"
  74. :key="dict.dictValue"
  75. :label="dict.dictLabel"
  76. :value="dict.dictValue"
  77. ></el-option>
  78. </el-select>
  79. </el-form-item>
  80. </el-form>
  81. </el-card>
  82. <el-row :gutter="10" class="mb8">
  83. <el-col :span="1.5">
  84. <el-button
  85. type="primary"
  86. icon="el-icon-plus"
  87. size="mini"
  88. @click="handleAdd"
  89. v-hasPermi="['service:bill:add']"
  90. >新增</el-button>
  91. </el-col>
  92. </el-row>
  93. <el-table stripe
  94. v-loading.fullscreen.lock="loading" :data="billList" row-key="categoryId"
  95. default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}" border >
  96. <el-table-column label="序号" type="index" width="50" align="center">
  97. <template slot-scope="scope">
  98. <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="账款编号" align="center" prop="zbiNumber" :show-overflow-tooltip="true"/>
  102. <el-table-column label="账款名称" align="center" prop="zbiName" :show-overflow-tooltip="true"/>
  103. <el-table-column label="账款类型" align="center" prop="zbiType" :show-overflow-tooltip="true" :formatter="typeFormat"/>
  104. <el-table-column label="关联融信" align="center" prop="zfiNumber" :show-overflow-tooltip="true"/>
  105. <el-table-column label="应付方" align="center" prop="payerName" :show-overflow-tooltip="true"/>
  106. <el-table-column label="应收方" align="center" prop="payeeName" :show-overflow-tooltip="true"/>
  107. <el-table-column label="账款金额" align="center" prop="zbiAmount" :show-overflow-tooltip="true"/>
  108. <el-table-column label="贸易日期" align="center" prop="zbiDate" :show-overflow-tooltip="true">
  109. <template slot-scope="scope">
  110. <span>{{ parseTime(new Date(scope.row.zbiDate),'{y}-{m}-{d}') }}</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="预计还款日" align="center" prop="zbiPayDate" :show-overflow-tooltip="true">
  114. <template slot-scope="scope">
  115. <span>{{ parseTime(new Date(scope.row.zbiPayDate),'{y}-{m}-{d}') }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="账款状态" align="center" prop="zbiStatus" :show-overflow-tooltip="true" :formatter="statusFormat"/>
  119. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
  120. <template slot-scope="scope">
  121. <el-button
  122. size="mini"
  123. type="text"
  124. icon="el-icon-info"
  125. @click="handleDetail(scope.row)"
  126. v-if="scope.row.zfiNumber"
  127. v-hasPermi="['service:bill:detail']"
  128. >详情</el-button>
  129. <el-button
  130. size="mini"
  131. type="text"
  132. icon="el-icon-edit"
  133. @click="handleUpdate(scope.row)"
  134. v-if="!scope.row.zfiNumber"
  135. v-hasPermi="['service:bill:edit']"
  136. >修改</el-button>
  137. <el-button
  138. size="mini"
  139. type="text"
  140. icon="el-icon-delete"
  141. @click="handleDelete(scope.row)"
  142. v-if="!scope.row.zfiNumber"
  143. v-hasPermi="['service:bill:del']"
  144. >删除</el-button>
  145. </template>
  146. </el-table-column>
  147. </el-table>
  148. <pagination
  149. v-show="total>0"
  150. :total="total"
  151. :page.sync="queryParams.pageNum"
  152. :limit.sync="queryParams.pageSize"
  153. @pagination="getList"
  154. />
  155. </div>
  156. </template>
  157. <script>
  158. import { listBill, deleteBill } from "@/api/service/bill/bill";
  159. import Cookies from 'js-cookie'
  160. export default {
  161. name: "Bill",
  162. data() {
  163. return {
  164. // 遮罩层
  165. loading: false,
  166. // 显示搜索条件
  167. showSearch: true,
  168. // 总条数
  169. total: 0,
  170. // 资料目录表格数据
  171. billList: [],
  172. //账款类型
  173. typeOptions: [],
  174. //账款状态
  175. statusOptions: [],
  176. // 查询参数
  177. queryParams: {
  178. pageNum: 1,
  179. pageSize: 10,
  180. zbiNumber: null,
  181. zbiName: null,
  182. zbiType: null,
  183. payeeName: null,
  184. payerName: null,
  185. zbiStatus:null
  186. },
  187. };
  188. },
  189. created() {
  190. this.getList();
  191. this.getDicts("zc_bill_type").then(response => {
  192. this.typeOptions = response.data;
  193. });
  194. this.getDicts("zc_bill_status").then(response => {
  195. this.statusOptions = response.data;
  196. });
  197. },
  198. activated () {
  199. // this.getList();
  200. this.getDicts("zc_bill_type").then(response => {
  201. this.typeOptions = response.data;
  202. });
  203. this.getDicts("zc_bill_status").then(response => {
  204. this.statusOptions = response.data;
  205. });
  206. },
  207. methods: {
  208. /** 查询往来账款列表 */
  209. getList() {
  210. this.loading = true;
  211. listBill(this.queryParams).then(response => {
  212. console.log(response)
  213. this.billList = response.data.records;
  214. this.total = response.data.total
  215. this.loading = false;
  216. });
  217. },
  218. // 账款类型字典翻译
  219. typeFormat(row, column) {
  220. return this.selectDictLabel(this.typeOptions, row.zbiType);
  221. },
  222. //账款状态字典翻译
  223. statusFormat(row, column) {
  224. return this.selectDictLabel(this.statusOptions, row.zbiStatus);
  225. },
  226. // 表单重置
  227. reset() {
  228. this.form = {
  229. dciDeptName: undefined
  230. };
  231. this.resetForm("form");
  232. },
  233. /** 搜索按钮操作 */
  234. handleQuery() {
  235. this.queryParams.pageNum = 1;
  236. this.getList();
  237. },
  238. /** 重置按钮操作 */
  239. resetQuery() {
  240. this.resetForm("queryForm");
  241. this.handleQuery();
  242. },
  243. /** 新增按钮操作 */
  244. handleAdd(row) {
  245. Cookies.set("/bill/billAdd", this.$route.fullPath)
  246. this.$router.push({ path: "/bill/billAdd" });
  247. },
  248. /** 修改按钮操作 */
  249. handleUpdate(row) {
  250. Cookies.set("/bill/billEdit/" + row.zbiId, this.$route.fullPath)
  251. this.$router.push({ path: "/bill/billEdit/" + row.zbiId });
  252. },
  253. /** 详情按钮操作 */
  254. handleDetail(row) {
  255. Cookies.set("/bill/billDetail/" + row.zbiId, this.$route.fullPath)
  256. this.$router.push({ path: "/bill/billDetail/" + row.zbiId });
  257. },
  258. /** 删除按钮操作 */
  259. handleDelete(row) {
  260. var self = this
  261. const zbiName = row.zbiName;
  262. const zbiIds = row.zbiId;
  263. this.$confirm('是否确认删除往来账款名称为"' + zbiName + '"的数据项?', "警告", {
  264. confirmButtonText: "确定",
  265. cancelButtonText: "取消",
  266. type: "warning"
  267. }).then(function() {
  268. self.loading = true
  269. return deleteBill(zbiIds);
  270. }).then(() => {
  271. this.getList();
  272. this.msgSuccess("删除成功");
  273. });
  274. }
  275. }
  276. };
  277. </script>