queryPart.vue 11 KB

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