index.vue 14 KB

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