index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <div class="app-container">
  3. <div v-show="isShow">
  4. <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px">
  5. <el-form-item label="系统单号" prop="sysNo">
  6. <el-input
  7. v-model="queryParams.sysNo"
  8. clearable
  9. placeholder="请输入系统单号"
  10. size="small"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="开票日期" prop="timeInterval">
  15. <el-date-picker
  16. v-model="queryParams.timeInterval"
  17. value-format="yyyy-MM-dd"
  18. type="daterange"
  19. range-separator="至"
  20. start-placeholder="开始月份"
  21. end-placeholder="结束月份"
  22. >
  23. </el-date-picker>
  24. </el-form-item>
  25. <el-form-item label="供应商" label-width="120px" prop="fCorpid">
  26. <el-select v-model="queryParams.fCorpid" clearable filterable
  27. placeholder="请选择客户"
  28. >
  29. <el-option
  30. v-for="item in vendorList"
  31. :key="item.fId"
  32. :label="item.fName"
  33. :value="item.fId"
  34. >
  35. </el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item label="项目名称" label-width="120px" prop="fGoodsid">
  39. <el-select v-model="queryParams.fGoodsid" clearable
  40. filterable placeholder="请选择项目"
  41. >
  42. <el-option
  43. v-for="item in fGoodsList"
  44. :key="item.fId"
  45. :label="item.projectName"
  46. :value="item.fId"
  47. >
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="备注" prop="remark">
  52. <el-input
  53. v-model="queryParams.remark"
  54. clearable
  55. placeholder="请输入备注"
  56. size="small"
  57. />
  58. </el-form-item>
  59. <el-form-item>
  60. <el-button icon="el-icon-search" size="mini" type="cyan" @click="handleQuery">搜索</el-button>
  61. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  62. </el-form-item>
  63. </el-form>
  64. <el-row :gutter="10" class="mb8">
  65. <el-col :span="1.5">
  66. <el-button
  67. icon="el-icon-plus"
  68. size="mini"
  69. type="primary"
  70. @click="handleAdd"
  71. >新单
  72. </el-button>
  73. </el-col>
  74. <!-- <el-col :span="1.5">-->
  75. <!-- <el-button-->
  76. <!-- v-hasPermi="['warehouse:fee:edit']"-->
  77. <!-- :disabled="single"-->
  78. <!-- icon="el-icon-edit"-->
  79. <!-- size="mini"-->
  80. <!-- type="success"-->
  81. <!-- @click="handleUpdate"-->
  82. <!-- >修改-->
  83. <!-- </el-button>-->
  84. <!-- </el-col>-->
  85. <!-- <el-col :span="1.5">-->
  86. <!-- <el-button-->
  87. <!-- v-hasPermi="['warehouse:fee:remove']"-->
  88. <!-- :disabled="multiple"-->
  89. <!-- icon="el-icon-delete"-->
  90. <!-- size="mini"-->
  91. <!-- type="danger"-->
  92. <!-- @click="handleDelete"-->
  93. <!-- >删除-->
  94. <!-- </el-button>-->
  95. <!-- </el-col>-->
  96. <!-- <el-col :span="1.5">-->
  97. <!-- <el-button-->
  98. <!-- v-hasPermi="['warehouse:fee:export']"-->
  99. <!-- icon="el-icon-download"-->
  100. <!-- size="mini"-->
  101. <!-- type="warning"-->
  102. <!-- @click="handleExport"-->
  103. <!-- >导出-->
  104. <!-- </el-button>-->
  105. <!-- </el-col>-->
  106. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  107. </el-row>
  108. <el-table v-loading="loading" show-summary :summary-method="getSummaries" :data="feeList" @selection-change="handleSelectionChange">
  109. <el-table-column align="center" type="selection" width="55"/>
  110. <el-table-column align="center" label="系统单号" prop="sysNo"/>
  111. <el-table-column align="center" label="开票日期" prop="kpTime" width="180">
  112. <template slot-scope="scope">
  113. <span>{{ parseTime(scope.row.kpTime, '{y}-{m}-{d}') }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column align="center" label="供应商" prop="fCorpid"/>
  117. <el-table-column align="center" label="项目名称" prop="fGoodsid"/>
  118. <el-table-column align="center" label="金额合计" prop="sumMoney"/>
  119. <el-table-column align="center" label="发票号" prop="invoiceNo"/>
  120. <el-table-column align="center" label="开票公司" prop="fSbu"/>
  121. <el-table-column align="center" label="发票类型" prop="invoiceType"/>
  122. <el-table-column align="center" label="制单人" prop="createBy"/>
  123. <el-table-column align="center" label="制单日期" prop="createTime">
  124. <template slot-scope="scope">
  125. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column align="center" label="备注" prop="remark"/>
  129. <el-table-column align="center" label="收款金额" prop="proceeds"/>
  130. <el-table-column align="center" class-name="small-padding fixed-width" label="操作">
  131. <template slot-scope="scope">
  132. <el-button
  133. v-hasPermi="['warehouse:fee:edit']"
  134. icon="el-icon-edit"
  135. size="mini"
  136. type="text"
  137. @click="handleUpdate(scope.row)"
  138. >修改
  139. </el-button>
  140. <el-button
  141. v-hasPermi="['warehouse:fee:remove']"
  142. icon="el-icon-delete"
  143. size="mini"
  144. type="text"
  145. @click="handleDelete(scope.row)"
  146. >删除
  147. </el-button>
  148. </template>
  149. </el-table-column>
  150. </el-table>
  151. <pagination
  152. v-show="total>0"
  153. :limit.sync="queryParams.pageSize"
  154. :page.sync="queryParams.pageNum"
  155. :total="total"
  156. :page-sizes="[10, 20, 30, 50, 100, 200, 300, 400]"
  157. @pagination="getList"
  158. />
  159. </div>
  160. <detailPage v-if="!isShow" ref="detail" :detailData="detailData" @goBack="goBack"></detailPage>
  161. </div>
  162. </template>
  163. <script>
  164. import { delInvoice, listInvoice } from '@/api/invoice/invoice'
  165. import { company, queryItem } from '@/api/purchaseIssue/index'
  166. import detailPage from './detailsPage'
  167. export default {
  168. name: 'Fee',
  169. components: { detailPage },
  170. data() {
  171. return {
  172. isShow: true,
  173. detailData: {},
  174. // 遮罩层
  175. loading: true,
  176. // 选中数组
  177. ids: [],
  178. // 非单个禁用
  179. single: true,
  180. // 非多个禁用
  181. multiple: true,
  182. // 显示搜索条件
  183. showSearch: true,
  184. // 总条数
  185. total: 0,
  186. // 财务数据主表格数据
  187. feeList: [],
  188. fCorpList: [],
  189. fGoodsList: [],
  190. vendorList: [],
  191. // 弹出层标题
  192. title: '',
  193. // 是否显示弹出层
  194. open: false,
  195. // 查询参数
  196. queryParams: {
  197. pageNum: 1,
  198. pageSize: 10,
  199. type: 2,
  200. },
  201. // 表单参数
  202. form: {},
  203. fCorpMap: {},
  204. fSbuMap: {},
  205. fGoodsMap: {},
  206. vendorMap: {},
  207. invoiceTypeList: [],
  208. // 表单校验
  209. rules: {
  210. fBilltype: [
  211. {
  212. required: true,
  213. message: '单据类型(对账单 收费 付费 付费申请 收费申请,发票申请 销项发票 进项发票)不能为空',
  214. trigger: 'change'
  215. }
  216. ],
  217. fDeptid: [
  218. { required: true, message: '制单部门不能为空', trigger: 'blur' }
  219. ]
  220. }
  221. }
  222. },
  223. created() {
  224. this.getDicts("invoice_type").then(response => {
  225. this.invoiceTypeList = response.data;
  226. });
  227. company(3).then(res => {
  228. this.fCorpList = res.data
  229. for (var index in res.data) {
  230. this.fCorpMap[res.data[index].fId] = res.data[index].fName
  231. }
  232. })
  233. // 开票公司
  234. company(2).then(res => {
  235. for (var index in res.data) {
  236. this.fSbuMap[res.data[index].fId] = res.data[index].fName
  237. }
  238. })
  239. // 供应商
  240. company(1).then(res => {
  241. this.vendorList = res.data
  242. for (var index in res.data) {
  243. this.vendorMap[res.data[index].fId] = res.data[index].fName
  244. }
  245. })
  246. // 项目名称
  247. queryItem().then(res => {
  248. this.fGoodsList = res.data
  249. for (var index in res.data) {
  250. this.fGoodsMap[res.data[index].fId] = res.data[index].projectName
  251. }
  252. })
  253. this.$nextTick(_ => {
  254. this.getList()
  255. })
  256. },
  257. methods: {
  258. goBack() {
  259. this.getList()
  260. this.detailData = {}
  261. this.isShow = true
  262. },
  263. getSummaries(param) {
  264. const { columns, data } = param;
  265. const sums = [];
  266. columns.forEach((column, index) => {
  267. if (index === 0) {
  268. sums[index] = '合计';
  269. return;
  270. }
  271. const values = data.map(item => Number(item[column.property]));
  272. if (column.property === 'sumMoney' || column.property === 'proceeds') {
  273. sums[index] = values.reduce((prev, curr) => {
  274. const value = Number(curr);
  275. if (!isNaN(value)) {
  276. return (Number(prev) + Number(curr)).toFixed(2);
  277. } else {
  278. return Number(prev).toFixed(2);
  279. }
  280. }, 0);
  281. sums[index];
  282. }
  283. });
  284. return sums
  285. },
  286. /** 查询财务数据主列表 */
  287. getList() {
  288. this.loading = true
  289. listInvoice(this.queryParams).then(response => {
  290. this.feeList = response.rows
  291. this.feeList.forEach(data => {
  292. // 供应商
  293. data.fCorpid = this.vendorMap[data.fCorpid]
  294. // 项目
  295. data.fGoodsid = this.fGoodsMap[data.fGoodsid]
  296. // 开票
  297. data.fSbu = this.fSbuMap[data.fSbu]
  298. this.invoiceTypeList.forEach(datas => {
  299. if (datas.dictSort == data.invoiceType) {
  300. data.invoiceType = datas.dictLabel
  301. }
  302. })
  303. })
  304. this.total = response.total
  305. this.loading = false
  306. })
  307. },
  308. // 取消按钮
  309. cancel() {
  310. this.open = false
  311. this.reset()
  312. },
  313. // 表单重置
  314. reset() {
  315. this.form = {
  316. fId: null,
  317. fBillno: null,
  318. fActId: null,
  319. fCtrlcorpid: null,
  320. fTransActId: null,
  321. fCorpid: null,
  322. tMblno: null,
  323. fAmtdr: null,
  324. fAmtcr: null,
  325. fFromDate: null,
  326. fToDate: null,
  327. fRefNo: null,
  328. fBilltype: null,
  329. fBillstatus: '0',
  330. fRemarks: null,
  331. fAccbilldate: null,
  332. delFlag: null,
  333. createBy: null,
  334. fDeptid: null,
  335. createTime: null,
  336. updateBy: null,
  337. updateTime: null,
  338. chargingMethod: null,
  339. invoiceNo: null,
  340. bank: null,
  341. waterBillNo: null,
  342. fSystemType: null,
  343. fTrackingNumber: null,
  344. fInvoiceRise: null,
  345. fSign: null,
  346. fSendTime: null,
  347. fApplyMoney: null,
  348. fAccountId: null,
  349. fMake: null
  350. }
  351. this.resetForm('form')
  352. },
  353. /** 搜索按钮操作 */
  354. handleQuery() {
  355. this.queryParams.pageNum = 1
  356. this.getList()
  357. },
  358. /** 重置按钮操作 */
  359. resetQuery() {
  360. this.resetForm('queryForm')
  361. this.handleQuery()
  362. },
  363. // 多选框选中数据
  364. handleSelectionChange(selection) {
  365. this.ids = selection.map(item => item.fId)
  366. this.single = selection.length !== 1
  367. this.multiple = !selection.length
  368. },
  369. /** 新增按钮操作 */
  370. handleAdd() {
  371. this.detailData = {}
  372. this.isShow = false
  373. // this.reset()
  374. // this.open = true
  375. // this.title = '添加财务数据主'
  376. },
  377. /** 修改按钮操作 */
  378. handleUpdate(row) {
  379. this.detailData = {
  380. id: row.id
  381. }
  382. this.isShow = false
  383. // this.isShow = false;
  384. // this.reset()
  385. // const fId = row.fId || this.ids
  386. // getFee(fId).then(response => {
  387. // this.form = response.data
  388. // this.open = true
  389. // this.title = '修改财务数据主'
  390. // })
  391. },
  392. /** 提交按钮 */
  393. submitForm() {
  394. this.$refs['form'].validate(valid => {
  395. if (valid) {
  396. if (this.form.fId != null) {
  397. updateFee(this.form).then(response => {
  398. this.msgSuccess('修改成功')
  399. this.open = false
  400. this.getList()
  401. })
  402. } else {
  403. addFee(this.form).then(response => {
  404. this.msgSuccess('新增成功')
  405. this.open = false
  406. this.getList()
  407. })
  408. }
  409. }
  410. })
  411. },
  412. /** 删除按钮操作 */
  413. handleDelete(row) {
  414. if (row.kpType == 2) {
  415. this.$message({
  416. message: '已开票无法删除',
  417. type: 'warning'
  418. });
  419. return
  420. }
  421. const fIds = row.fId || this.ids
  422. this.$confirm('是否确认删除?', '警告', {
  423. confirmButtonText: '确定',
  424. cancelButtonText: '取消',
  425. type: 'warning'
  426. }).then(function() {
  427. return delInvoice(row.id)
  428. }).then((res) => {
  429. if (res.code == 200) {
  430. this.msgSuccess('删除成功')
  431. this.$message({
  432. message: '删除成功',
  433. type: 'success'
  434. });
  435. } else {
  436. this.$message.error(res.msg);
  437. }
  438. this.getList()
  439. })
  440. },
  441. /** 导出按钮操作 */
  442. handleExport() {
  443. const queryParams = this.queryParams
  444. this.$confirm('是否确认导出所有财务数据主数据项?', '警告', {
  445. confirmButtonText: '确定',
  446. cancelButtonText: '取消',
  447. type: 'warning'
  448. }).then(function() {
  449. return exportFee(queryParams)
  450. }).then(response => {
  451. this.download(response.msg)
  452. })
  453. }
  454. }
  455. }
  456. </script>