list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="创建时间">
  10. <rangeDate id="accountStatement-rangeDate" ref="rangeDate" :value="creatDate" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="客户名称">
  15. <dealerSubareaScopeList id="accountStatement-dealerName" ref="dealer" @change="custChange" @dealerDetail="getDealerDetail" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="对账单号">
  20. <a-input id="accountStatement-verifyAccountBillNo" v-model.trim="queryParam.verifyAccountBillNo" allowClear placeholder="请输入对账单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="业务状态">
  25. <v-select
  26. v-model="queryParam.billStatus"
  27. ref="status"
  28. id="accountStatement-status"
  29. code="VERIFY_ACCOUNT_STATUS"
  30. placeholder="请选择业务状态"
  31. allowClear></v-select>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="6" :sm="24">
  35. <a-form-item label="同步状态">
  36. <a-select
  37. v-model="queryParam.syncFlag"
  38. ref="syncFlag"
  39. id="accountStatement-syncFlag"
  40. placeholder="请选择同步状态"
  41. allowClear
  42. >
  43. <a-select-option value="1">已同步</a-select-option>
  44. <a-select-option value="0">未同步</a-select-option>
  45. </a-select>
  46. </a-form-item>
  47. </a-col>
  48. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  49. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="accountStatement-refresh">查询</a-button>
  50. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="accountStatement-reset">重置</a-button>
  51. </a-col>
  52. </a-row>
  53. </a-form>
  54. </div>
  55. </a-card>
  56. <a-card size="small" :bordered="false" class="accountStatement-wrap">
  57. <a-spin :spinning="spinning" tip="Loading...">
  58. <!-- 操作按钮 -->
  59. <div class="table-operator">
  60. <div class="flex-center">
  61. <a-button type="primary" v-if="$hasPermissions('B_as_new')" @click="handleAdd">新增</a-button>
  62. <div class="tongji-bar"></div>
  63. </div>
  64. <div></div>
  65. </div>
  66. <!-- 列表 -->
  67. <s-table
  68. class="sTable fixPagination"
  69. ref="table"
  70. :style="{ height: tableHeight+80+'px' }"
  71. size="small"
  72. :rowKey="(record) => record.id"
  73. :columns="columns"
  74. :data="loadData"
  75. :scroll="{ y: tableHeight }"
  76. :pageSize="30"
  77. :defaultLoadData="false"
  78. bordered>
  79. <!-- 单号 -->
  80. <template slot="verifyAccountBillNo" slot-scope="text, record">
  81. <span v-if="$hasPermissions('B_as_detail')" class="link-bule" @click="handleDetail(record,0)">{{ record.verifyAccountBillNo }}</span>
  82. <span v-else>{{ record.verifyAccountBillNo }}</span>
  83. </template>
  84. <!-- 业务时间区间 -->
  85. <template slot="bizDate" slot-scope="text, record">
  86. {{ record.bizFirstDate }} ~ {{ record.bizLastDate }}
  87. </template>
  88. <!-- 操作 -->
  89. <template slot="action" slot-scope="text, record">
  90. <div>
  91. <a-button
  92. v-if="record.syncFlag=='0'&&(record.billStatus=='FINISH'||record.billStatus=='WAIT_VERIFY')"
  93. size="small"
  94. type="link"
  95. class="button-info"
  96. @click="handleSync(record)"
  97. >
  98. 同步
  99. </a-button>
  100. <a-button
  101. v-if="record.billStatus=='WAIT_CONFIRM'&&$hasPermissions('B_as_confirm')"
  102. size="small"
  103. type="link"
  104. class="button-info"
  105. @click="handleDetail(record,1)"
  106. >
  107. 对单
  108. </a-button>
  109. <a-button
  110. v-if="record.billStatus=='WAIT_VERIFY'&&$hasPermissions('B_as_verify')"
  111. size="small"
  112. type="link"
  113. class="button-info"
  114. @click="checkAcount(record)"
  115. >
  116. 对账
  117. </a-button>
  118. <a-button
  119. size="small"
  120. type="link"
  121. v-if="(record.billStatus=='WAIT_SUBMIT'||record.billStatus=='WAIT_CONFIRM')&&$hasPermissions('M_as_edit')"
  122. class="button-info"
  123. @click="handleEdit(record)"
  124. >
  125. 编辑
  126. </a-button>
  127. <a-button
  128. v-if="(record.billStatus=='WAIT_SUBMIT'||record.billStatus=='WAIT_CONFIRM')&&$hasPermissions('M_as_del')"
  129. size="small"
  130. type="link"
  131. class="button-error"
  132. @click="handleDel(record)"
  133. >
  134. 删除
  135. </a-button>
  136. </div>
  137. </template>
  138. </s-table>
  139. </a-spin>
  140. <!-- 基础信息 -->
  141. <baseModal v-drag :show="baseModal" @cancel="baseModal=false"></baseModal>
  142. <!-- 对单 -->
  143. <confrontModal v-drag :show="openModal" ref="detailModal" @cancel="openModal=false" @confirm="confirmOk"></confrontModal>
  144. </a-card>
  145. </div>
  146. </template>
  147. <script>
  148. import { commonMixin } from '@/utils/mixin'
  149. import { STable, VSelect } from '@/components'
  150. import rangeDate from '@/views/common/rangeDate.vue'
  151. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  152. import baseModal from './baseModal.vue'
  153. import confrontModal from './confrontModal.vue'
  154. import { verifyAcountBillList, verifyAcountBillDel, verifyAcountBillVerify, verifyAcountBillSyncBill } from '@/api/verifyAccount.js'
  155. export default {
  156. name: 'AccountStatementList',
  157. mixins: [commonMixin],
  158. components: { STable, VSelect, rangeDate, baseModal, confrontModal, dealerSubareaScopeList },
  159. data () {
  160. return {
  161. spinning: false,
  162. openModal: false,
  163. baseModal: false,
  164. tableHeight: 0,
  165. queryParam: { // 查询条件
  166. beginDate: '',
  167. endDate: '',
  168. verifyAccountBillNo: '',
  169. dealerName: undefined,
  170. dealerSn: undefined,
  171. billStatus: undefined,
  172. syncFlag: undefined
  173. },
  174. disabled: false, // 查询、重置按钮是否可操作
  175. creatDate: [], // 创建时间
  176. // 加载数据方法 必须为 Promise 对象
  177. loadData: parameter => {
  178. this.disabled = true
  179. this.spinning = true
  180. const params = Object.assign(parameter, this.queryParam)
  181. return verifyAcountBillList(params).then(res => {
  182. let data
  183. if (res.status == 200) {
  184. data = res.data
  185. const no = (data.pageNo - 1) * data.pageSize
  186. for (var i = 0; i < data.list.length; i++) {
  187. data.list[i].no = no + i + 1
  188. }
  189. this.total = data.count || 0
  190. this.disabled = false
  191. }
  192. this.spinning = false
  193. return data
  194. })
  195. },
  196. total: 0, // 合计
  197. countData: null,
  198. detailType: null,
  199. editRow: null
  200. }
  201. },
  202. // 根据权限显示列表字段
  203. computed: {
  204. columns () {
  205. const arr = [
  206. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  207. { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  208. { title: '对账单号', scopedSlots: { customRender: 'verifyAccountBillNo' }, width: '8%', align: 'center' },
  209. { title: '客户名称', dataIndex: 'dealerName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  210. { title: '借方', dataIndex: 'debitAmount', width: '5%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  211. { title: '贷方', dataIndex: 'creditAmount', width: '5%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text * -1) : '--') },
  212. { title: '期初余额', dataIndex: 'beginBalance', width: '5%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  213. { title: '余额', dataIndex: 'totalAmount', width: '5%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  214. { title: '业务单数', dataIndex: 'bizNum', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  215. { title: '业务时间区间', dataIndex: 'bizDate', scopedSlots: { customRender: 'bizDate' }, width: '14%', align: 'center' },
  216. { title: '对单时间', dataIndex: 'confirmDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  217. { title: '对账时间', dataIndex: 'verifyDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  218. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  219. { title: '同步状态', dataIndex: 'syncFlag', width: '6%', align: 'center', customRender: function (text) { return ['未同步', '已同步'][text] } },
  220. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  221. ]
  222. return arr
  223. }
  224. },
  225. methods: {
  226. // 创建时间 change
  227. dateChange (date) {
  228. this.queryParam.beginDate = date[0] ? date[0] : ''
  229. this.queryParam.endDate = date[1] ? date[1] : ''
  230. },
  231. // 客户
  232. custChange (v) {
  233. if (v && v.key) {
  234. this.queryParam.dealerSn = v.key
  235. this.queryParam.dealerName = v.row ? v.row.dealerName : ''
  236. } else {
  237. this.queryParam.dealerSn = ''
  238. this.queryParam.dealerName = ''
  239. }
  240. },
  241. // 重置
  242. resetSearchForm () {
  243. this.creatDate = []
  244. this.$refs.rangeDate.resetDate(this.creatDate)
  245. this.queryParam.beginDate = ''
  246. this.queryParam.endDate = ''
  247. this.queryParam.dealerName = undefined
  248. this.queryParam.dealerSn = undefined
  249. this.queryParam.verifyAccountBillNo = ''
  250. this.queryParam.billStatus = undefined
  251. this.queryParam.syncFlag = undefined
  252. if (this.$refs.dealer) {
  253. this.$refs.dealer.resetForm()
  254. }
  255. this.$refs.table.refresh(true)
  256. },
  257. // 新增
  258. handleAdd () {
  259. this.baseModal = true
  260. },
  261. // 编辑
  262. handleEdit (row) {
  263. this.$router.push({ name: 'accountStatementEdit', params: { sn: row.verifyAccountBillSn, type: 0 } })
  264. },
  265. // 删除
  266. handleDel (row) {
  267. const _this = this
  268. this.$confirm({
  269. title: '提示(' + row.dealerName + ')',
  270. content: <div style="font-size:14px;"><div>对账单号:{row.verifyAccountBillNo}</div><div>余额:{Number(row.totalAmount).toFixed(2)}元,确定删除吗?</div></div>,
  271. centered: true,
  272. closable: true,
  273. onOk () {
  274. _this.spinning = true
  275. verifyAcountBillDel({ sn: row.verifyAccountBillSn }).then(res => {
  276. if (res.status == 200) {
  277. _this.$message.success(res.message)
  278. _this.$refs.table.refresh()
  279. _this.spinning = false
  280. } else {
  281. _this.spinning = false
  282. }
  283. })
  284. }
  285. })
  286. },
  287. // 同步
  288. handleSync (row) {
  289. const _this = this
  290. this.$confirm({
  291. title: '提示',
  292. content: <div style="font-size:14px;"><div>您要同步对账单【{row.verifyAccountBillNo}】给【{row.dealerName}】客户吗?</div></div>,
  293. centered: true,
  294. closable: true,
  295. onOk () {
  296. _this.spinning = true
  297. verifyAcountBillSyncBill({ sn: row.verifyAccountBillSn }).then(res => {
  298. if (res.status == 200) {
  299. _this.$message.success(res.message)
  300. _this.$refs.table.refresh()
  301. _this.spinning = false
  302. } else {
  303. _this.spinning = false
  304. }
  305. })
  306. }
  307. })
  308. },
  309. // 0详情,1对单
  310. handleDetail (row, type) {
  311. this.spinning = true
  312. this.$refs.dealer.getDetail(row.dealerSn, true)
  313. this.detailType = type
  314. this.editRow = row
  315. },
  316. getDealerDetail (data) {
  317. this.spinning = false
  318. this.$refs.detailModal.pageInit(this.editRow, data, this.detailType)
  319. this.openModal = true
  320. },
  321. // 对单成功
  322. confirmOk () {
  323. this.openModal = false
  324. this.$refs.table.refresh()
  325. },
  326. // 对账
  327. checkAcount (row) {
  328. const _this = this
  329. this.$confirm({
  330. title: '提示(' + row.dealerName + ')',
  331. content: <div style="font-size:14px;"><div>对账单号:{row.verifyAccountBillNo}</div><div>余额:{row.totalAmount},确定对账吗?</div></div>,
  332. centered: true,
  333. closable: true,
  334. onOk () {
  335. _this.spinning = true
  336. verifyAcountBillVerify({ sn: row.verifyAccountBillSn }).then(res => {
  337. if (res.status == 200) {
  338. _this.$message.success(res.message)
  339. _this.$refs.table.refresh()
  340. _this.spinning = false
  341. } else {
  342. _this.spinning = false
  343. }
  344. })
  345. }
  346. })
  347. },
  348. pageInit () {
  349. const _this = this
  350. this.$nextTick(() => { // 页面渲染完成后的回调
  351. _this.setTableH()
  352. })
  353. },
  354. setTableH () {
  355. const tableSearchH = this.$refs.tableSearch.offsetHeight
  356. this.tableHeight = window.innerHeight - tableSearchH - 250
  357. }
  358. },
  359. watch: {
  360. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  361. this.setTableH()
  362. }
  363. },
  364. mounted () {
  365. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  366. this.pageInit()
  367. this.resetSearchForm()
  368. }
  369. },
  370. activated () {
  371. // 如果是新页签打开,则重置当前页面
  372. if (this.$store.state.app.isNewTab) {
  373. this.pageInit()
  374. this.resetSearchForm()
  375. }
  376. // 仅刷新列表,不重置页面
  377. if (this.$store.state.app.updateList) {
  378. this.pageInit()
  379. this.$refs.table.refresh()
  380. }
  381. },
  382. beforeRouteEnter (to, from, next) {
  383. next(vm => {})
  384. }
  385. }
  386. </script>
  387. <style lang="less">
  388. .accountStatement-wrap{
  389. .active{
  390. color: #ed1c24;
  391. cursor: pointer;
  392. }
  393. .common{
  394. color: rgba(0, 0, 0);
  395. }
  396. }
  397. </style>