queryPart.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div class="accountStatement-query-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <div style="width:100%">
  6. <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="时间">
  10. <rangeDate id="accountStatement-query-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. <a-input id="accountStatement-query-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入业务单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="借贷类型">
  20. <v-select
  21. v-model="queryParam.changeType"
  22. ref="jdType"
  23. id="accountStatement-query-jdType"
  24. code="VERIFY_ACCOUNT_CHANGE_TYPE"
  25. placeholder="请选择借贷类型"
  26. allowClear></v-select>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="业务类型">
  31. <v-select
  32. v-model="queryParam.bizType"
  33. ref="bizType"
  34. id="accountStatement-query-bizType"
  35. code="VERIFY_ACCOUNT_BIZ_TYPE"
  36. placeholder="请选择业务类型"
  37. allowClear></v-select>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="业务状态">
  42. <!-- 备货单状态,销售退货单,调拨单,费用报销单 -->
  43. <v-select
  44. v-model="queryParam.bizStatus"
  45. ref="bizStatus"
  46. id="accountStatement-query-bizStatus"
  47. :code="bizStatusCode"
  48. placeholder="请选择业务状态"
  49. allowClear></v-select>
  50. </a-form-item>
  51. </a-col>
  52. <a-col :md="4" :sm="24">
  53. <a-button type="primary" @click="$refs.chooseTable.refresh(true)" id="accountStatement-query-refresh">查询</a-button>
  54. <a-button style="margin-left: 5px" @click="resetSearchForm" id="accountStatement-query-reset">重置</a-button>
  55. </a-col>
  56. <a-col :md="24" :sm="24" style="margin-bottom: 10px;display: flex;align-items: center;justify-content: space-between;">
  57. <div>
  58. <a-button type="primary" style="margin-right: 5px" @click="handleBatchAdd" :loading="addMoreLoading">批量选择</a-button>
  59. <span v-if="selNums&&selNums!=0" style="margin:0 10px;">已选中{{ selNums }}项</span>
  60. </div>
  61. </a-col>
  62. </a-row>
  63. </a-form>
  64. </div>
  65. </div>
  66. <!-- 列表 -->
  67. <s-table
  68. class="sTable"
  69. ref="chooseTable"
  70. size="small"
  71. :rowKey="(record) => record.bizSn"
  72. rowKeyName="bizSn"
  73. :row-selection="{ columnWidth: 40 }"
  74. @rowSelection="rowSelectionFun"
  75. :columns="columns"
  76. :data="loadData"
  77. :defaultLoadData="false"
  78. :scroll="{ y: 300 }"
  79. bordered>
  80. <!-- 备注 -->
  81. <template slot="remarks" slot-scope="text, record">
  82. <div @dblclick.stop>
  83. <a-input
  84. size="small"
  85. v-model="record.remarks"
  86. style="width: 100%;"
  87. placeholder="请输入备注"/>
  88. </div>
  89. </template>
  90. <!-- 操作 -->
  91. <template slot="action" slot-scope="text, record">
  92. <a-button
  93. size="small"
  94. type="link"
  95. class="button-info"
  96. :loading="newLoading"
  97. @click="handleAdd(record)"
  98. >选择</a-button>
  99. </template>
  100. </s-table>
  101. </div>
  102. </template>
  103. <script>
  104. import { verifyAccountBillQueryWaitSelectList } from '@/api/verifyAccount.js'
  105. import { STable, VSelect } from '@/components'
  106. import rangeDate from '@/views/common/rangeDate.vue'
  107. import { toThousands } from '@/libs/tools.js'
  108. export default {
  109. name: 'QueryPart',
  110. components: { STable, VSelect, rangeDate },
  111. props: {
  112. newLoading: Boolean,
  113. addMoreLoading: {
  114. type: Boolean,
  115. default: false
  116. },
  117. itemSn: {
  118. type: String,
  119. default: ''
  120. },
  121. dealerSn: {
  122. type: String,
  123. default: ''
  124. }
  125. },
  126. data () {
  127. return {
  128. buyerSn: '',
  129. queryParam: { // 查询条件
  130. beginDate: '',
  131. endDate: '',
  132. bizNo: '',
  133. changeType: undefined,
  134. bizType: undefined,
  135. bizStatus: undefined
  136. },
  137. creatDate: [], // 创建时间
  138. rowSelectionInfo: null,
  139. isChecked: false,
  140. repeatList: null,
  141. warehouseSn: null,
  142. // 加载数据方法 必须为 Promise 对象
  143. loadData: parameter => {
  144. const params = {
  145. ...parameter,
  146. dealerSn: this.dealerSn,
  147. ...this.queryParam
  148. }
  149. return verifyAccountBillQueryWaitSelectList(params).then(res => {
  150. let data
  151. if (res.status == 200) {
  152. data = res.data
  153. const no = (data.pageNo - 1) * data.pageSize
  154. for (var i = 0; i < data.list.length; i++) {
  155. data.list[i].no = no + i + 1
  156. const dates = data.list[i].bizDate.split('-')
  157. data.list[i].year = dates[0]
  158. data.list[i].month = dates[1]
  159. data.list[i].day = dates[2].split(' ')[0]
  160. // 正为借方, 负数为贷方
  161. if (data.list[i].bizAmount > 0) {
  162. data.list[i].debitAmount = data.list[i].bizAmount
  163. } else {
  164. data.list[i].creditorAmount = data.list[i].bizAmount
  165. }
  166. }
  167. }
  168. return data
  169. })
  170. },
  171. bizStatusText: [],
  172. codeArr: {
  173. 'DISPATCH': 'DISPATCH_BILL_STATUS',
  174. 'SALES_RETURN': 'SALES_RETURN_BILL_STATUS',
  175. 'ALLOCATE': 'ALLOCATE_STATUS',
  176. 'EXPENSE': 'EXPENSE_STATE',
  177. 'FINANCE_BOOK': 'FINANCE_BOOK_STATE',
  178. 'CHANGE': 'VERIFY_ACCOUNT_CHANGE_STATUS'
  179. }
  180. }
  181. },
  182. computed: {
  183. bizStatusCode () {
  184. return this.codeArr[this.queryParam.bizType]
  185. },
  186. columns () {
  187. const arr = [
  188. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  189. { title: '年', dataIndex: 'year', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  190. { title: '月', dataIndex: 'month', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  191. { title: '日', dataIndex: 'day', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  192. { title: '业务单号', dataIndex: 'bizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  193. { title: '业务类型', dataIndex: 'bizTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  194. { title: '业务状态', dataIndex: 'bizStatusDictValue', width: '8%', align: 'left', customRender: function (text, record) { return text || '--' } },
  195. { title: '费用/调拨类型', dataIndex: 'expenseAllocateType', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  196. { title: '摘要', dataIndex: 'digestInfo', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  197. { title: '客诉索赔编码', dataIndex: 'productCode', width: '8%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
  198. { title: '借方', dataIndex: 'debitAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } },
  199. { title: '贷方', dataIndex: 'creditorAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } },
  200. { title: '备注', scopedSlots: { customRender: 'remarks' }, width: '15%', align: 'center' },
  201. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  202. ]
  203. return arr
  204. },
  205. selNums () {
  206. return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
  207. }
  208. },
  209. methods: {
  210. // 创建时间 change
  211. dateChange (date) {
  212. this.queryParam.beginDate = date[0] ? date[0] : ''
  213. this.queryParam.endDate = date[1] ? date[1] : ''
  214. },
  215. // 重置
  216. resetSearchForm () {
  217. this.queryParam.bizNo = ''
  218. this.queryParam.beginDate = ''
  219. this.queryParam.endDate = ''
  220. this.queryParam.bizNo = ''
  221. this.queryParam.changeType = undefined
  222. this.queryParam.bizType = undefined
  223. this.queryParam.bizStatus = undefined
  224. this.creatDate = []
  225. this.$refs.rangeDate.resetDate(this.creatDate)
  226. this.$refs.chooseTable.refresh(true)
  227. },
  228. pageInit () {
  229. this.$refs.chooseTable.refresh()
  230. // this.clearSelected()
  231. },
  232. // 添加
  233. handleAdd (row) {
  234. this.$emit('add', row)
  235. },
  236. // 清空选择
  237. clearSelected (row) {
  238. this.$refs.chooseTable.clearSelected()
  239. },
  240. // 表格选中项
  241. rowSelectionFun (obj) {
  242. this.rowSelectionInfo = obj || null
  243. },
  244. // 批量添加
  245. handleBatchAdd () {
  246. const row = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys
  247. if (!row || row.length == 0) {
  248. this.$message.warning('请先选择单据!')
  249. return
  250. }
  251. this.$emit('bachAdd', this.rowSelectionInfo.selectedRows)
  252. }
  253. }
  254. }
  255. </script>
  256. <style lang="less" scoped>
  257. .accountStatement-query-wrap{
  258. .redBg-row{
  259. background-color: #f5cdc8;
  260. }
  261. }
  262. /deep/.sTable input:disabled{
  263. color:gray !important;
  264. -webkit-text-fill-color:gray !important;
  265. }
  266. </style>