WaitBillList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <div ref="container">
  3. <a-modal
  4. :title="title"
  5. :width="1250"
  6. :visible="visible"
  7. :getContainer="() => $refs.container"
  8. :maskStyle="{ top: '93px', left: '154px' }"
  9. :wrapClassName="wrapClassNameInfo()"
  10. :mask="isDesktop()"
  11. :maskClosable="false"
  12. @ok="handleOk"
  13. @cancel="handleCancel"
  14. cancelText="关闭"
  15. style="top: 20px; height: 95%"
  16. >
  17. <!-- 查询区域 -->
  18. <div class="table-page-search-wrapper" v-if="selectType === 'list'">
  19. <!-- 搜索区域 -->
  20. <a-form layout="inline" @keyup.enter.native="searchQuery">
  21. <a-row :gutter="24">
  22. <a-col :md="6" :sm="24">
  23. <a-form-item label="单据编号" :labelCol="{ span: 5 }" :wrapperCol="{ span: 18, offset: 1 }">
  24. <a-input placeholder="请输入单据编号查询" v-model="queryParam.number"></a-input>
  25. </a-form-item>
  26. </a-col>
  27. <a-col :md="6" :sm="24">
  28. <a-form-item label="商品信息" :labelCol="{ span: 5 }" :wrapperCol="{ span: 18, offset: 1 }">
  29. <a-input placeholder="条码|名称|规格|型号" v-model="queryParam.materialParam"></a-input>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :md="6" :sm="24">
  33. <a-form-item label="单据日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  34. <a-range-picker
  35. style="width: 100%"
  36. v-model="queryParam.createTimeRange"
  37. format="YYYY-MM-DD"
  38. :placeholder="['开始时间', '结束时间']"
  39. @change="onDateChange"
  40. @ok="onDateOk"
  41. />
  42. </a-form-item>
  43. </a-col>
  44. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  45. <a-col :md="6" :sm="24">
  46. <a-button type="primary" @click="searchQuery">查询</a-button>
  47. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  48. </a-col>
  49. </span>
  50. </a-row>
  51. </a-form>
  52. </div>
  53. <!-- table区域-begin -->
  54. <a-table
  55. v-if="selectType === 'list'"
  56. bordered
  57. ref="table"
  58. size="middle"
  59. rowKey="id"
  60. :columns="columns"
  61. :dataSource="dataSource"
  62. :pagination="ipagination"
  63. :loading="loading"
  64. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: getType }"
  65. :customRow="rowAction"
  66. @change="handleTableChange"
  67. >
  68. <span slot="numberCustomRender" slot-scope="text, record">
  69. <a v-if="!queryParam.purchaseStatus" @click="myHandleDetail(record)">{{ record.number }}</a>
  70. <span v-if="queryParam.purchaseStatus">{{ record.number }}</span>
  71. </span>
  72. <template slot="customRenderStatus" slot-scope="text, record">
  73. <template>
  74. <a-tag v-if="record.status === '1'" color="green">已审核</a-tag>
  75. <a-tag v-if="record.status === '3' && queryParam.type === '入库'" color="blue">部分入库</a-tag>
  76. <a-tag v-if="record.status === '3' && queryParam.type === '出库'" color="blue">部分出库</a-tag>
  77. </template>
  78. </template>
  79. </a-table>
  80. <a-table
  81. v-if="selectType === 'detail'"
  82. bordered
  83. ref="table"
  84. size="middle"
  85. rowKey="id"
  86. :pagination="false"
  87. :columns="columnsDetail"
  88. :dataSource="dataSourceDetail"
  89. :loading="loading"
  90. :rowSelection="{ selectedRowKeys: selectedDetailRowKeys, onChange: onSelectDetailChange, type: 'checkbox' }"
  91. @change="handleTableChange"
  92. >
  93. </a-table>
  94. <!-- table区域-end -->
  95. <!-- 表单区域 -->
  96. <bill-detail ref="billDetail"></bill-detail>
  97. </a-modal>
  98. </div>
  99. </template>
  100. <script>
  101. import BillDetail from './BillDetail'
  102. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  103. import { mixinDevice } from '@/utils/mixin'
  104. import { findBillDetailByNumber } from '@/api/api'
  105. import { getAction } from '@/api/manage'
  106. export default {
  107. name: 'WaitBillList',
  108. mixins: [JeecgListMixin, mixinDevice],
  109. components: {
  110. BillDetail,
  111. },
  112. data() {
  113. return {
  114. title: '操作',
  115. visible: false,
  116. disableMixinCreated: true,
  117. selectedRowKeys: [],
  118. selectedDetailRowKeys: [],
  119. selectBillRows: [],
  120. selectBillDetailRows: [],
  121. showType: 'basic',
  122. selectType: 'list',
  123. linkNumber: '',
  124. organId: '',
  125. discountMoney: '',
  126. deposit: '',
  127. remark: '',
  128. queryParam: {
  129. number: '',
  130. materialParam: '',
  131. type: '',
  132. subType: '',
  133. status: '',
  134. },
  135. labelCol: {
  136. xs: { span: 24 },
  137. sm: { span: 8 },
  138. },
  139. wrapperCol: {
  140. xs: { span: 24 },
  141. sm: { span: 16 },
  142. },
  143. // 表头
  144. columns: [
  145. { title: '', dataIndex: 'organName', width: 120, ellipsis: true },
  146. { title: '单据编号', dataIndex: 'number', width: 130, scopedSlots: { customRender: 'numberCustomRender' } },
  147. {
  148. title: '商品信息',
  149. dataIndex: 'materialsList',
  150. width: 280,
  151. ellipsis: true,
  152. customRender: function (text, record, index) {
  153. if (text) {
  154. return text.replace(',', ',')
  155. }
  156. },
  157. },
  158. { title: '单据日期', dataIndex: 'operTimeStr', width: 145 },
  159. { title: '操作员', dataIndex: 'userName', width: 70 },
  160. { title: '数量', dataIndex: 'materialCount', width: 60 },
  161. {
  162. title: '状态',
  163. dataIndex: 'status',
  164. width: 70,
  165. align: 'center',
  166. scopedSlots: { customRender: 'customRenderStatus' },
  167. },
  168. ],
  169. columnsDetail: [
  170. { title: '条码', dataIndex: 'barCode', width: 120 },
  171. { title: '名称', dataIndex: 'name', width: 100, ellipsis: true },
  172. { title: '规格', dataIndex: 'standard', width: 120, ellipsis: true },
  173. { title: '型号', dataIndex: 'model', width: 120, ellipsis: true },
  174. { title: '单位', dataIndex: 'unit', width: 50 },
  175. { title: '数量', dataIndex: 'operNumber', width: 50 },
  176. { title: '备注', dataIndex: 'remark', width: 100, ellipsis: true },
  177. ],
  178. dataSource: [],
  179. dataSourceDetail: [],
  180. url: {
  181. list: '/depotHead/waitBillList',
  182. },
  183. }
  184. },
  185. computed: {
  186. getType: function () {
  187. return 'radio'
  188. },
  189. },
  190. created() {},
  191. methods: {
  192. show(type, subType, status) {
  193. this.selectType = 'list'
  194. this.showType = 'other'
  195. this.queryParam.type = type
  196. this.queryParam.subType = subType
  197. this.queryParam.status = status
  198. this.columns[0].title = '供应商或客户'
  199. this.model = Object.assign({}, {})
  200. this.visible = true
  201. this.loadData(1)
  202. },
  203. myHandleDetail(record) {
  204. findBillDetailByNumber({ number: record.number }).then((res) => {
  205. if (res && res.code === 200) {
  206. let type = res.data.depotHeadType
  207. type = type.replace('其它', '')
  208. this.$refs.billDetail.show(res.data, type)
  209. this.$refs.billDetail.title = type + '-详情'
  210. }
  211. })
  212. },
  213. close() {
  214. this.$emit('close')
  215. this.visible = false
  216. },
  217. handleCancel() {
  218. this.close()
  219. },
  220. onSelectChange(selectedRowKeys) {
  221. this.selectedRowKeys = selectedRowKeys
  222. },
  223. onSelectDetailChange(selectedRowKeys) {
  224. this.selectedDetailRowKeys = selectedRowKeys
  225. },
  226. handleOk() {
  227. if (this.selectType === 'list') {
  228. this.getSelectBillRows()
  229. this.selectType = 'detail'
  230. this.title = '请选择单据明细'
  231. if (this.selectBillRows && this.selectBillRows.length > 0) {
  232. let record = this.selectBillRows[0]
  233. this.linkNumber = record.number
  234. this.organId = record.organId
  235. this.remark = record.remark
  236. this.loadDetailData(1)
  237. }
  238. } else {
  239. if (this.selectedDetailRowKeys.length) {
  240. this.getSelectBillDetailRows()
  241. this.$emit('ok', this.selectBillDetailRows, this.linkNumber, this.remark, this.organId)
  242. this.close()
  243. } else {
  244. this.$message.warning('抱歉,请选择单据明细!')
  245. }
  246. }
  247. },
  248. //查询明细列表
  249. loadDetailData(arg) {
  250. //加载数据 若传入参数1则加载第一页的内容
  251. if (arg === 1) {
  252. this.ipagination.current = 1
  253. }
  254. if (this.selectBillRows && this.selectBillRows.length > 0) {
  255. let record = this.selectBillRows[0]
  256. let param = {
  257. headerId: record.id,
  258. mpList: '',
  259. linkType: this.showType,
  260. }
  261. this.loading = true
  262. getAction('/depotItem/getDetailList', param).then((res) => {
  263. if (res.code === 200) {
  264. let list = res.data.rows
  265. let listEx = []
  266. for (let j = 0; j < list.length; j++) {
  267. let info = list[j]
  268. if (info.preNumber !== info.finishNumber) {
  269. //去掉已经全部转换的明细
  270. listEx.push(info)
  271. }
  272. }
  273. this.dataSourceDetail = listEx
  274. this.ipagination.total = res.data.total
  275. }
  276. if (res.code === 510) {
  277. this.$message.warning(res.data)
  278. }
  279. this.loading = false
  280. })
  281. }
  282. },
  283. onDateChange: function (value, dateString) {
  284. this.queryParam.beginTime = dateString[0]
  285. this.queryParam.endTime = dateString[1]
  286. },
  287. onDateOk(value) {
  288. console.log(value)
  289. },
  290. searchReset() {
  291. this.queryParam = {
  292. type: this.queryParam.type,
  293. subType: this.queryParam.subType,
  294. status: '1,3',
  295. }
  296. this.loadData(1)
  297. },
  298. getSelectBillRows() {
  299. let dataSource = this.dataSource
  300. this.selectBillRows = []
  301. for (let i = 0, len = dataSource.length; i < len; i++) {
  302. if (this.selectedRowKeys.includes(dataSource[i].id)) {
  303. this.selectBillRows.push(dataSource[i])
  304. }
  305. }
  306. },
  307. getSelectBillDetailRows() {
  308. let dataSource = this.dataSourceDetail
  309. this.selectBillDetailRows = []
  310. for (let i = 0, len = dataSource.length; i < len; i++) {
  311. if (this.selectedDetailRowKeys.includes(dataSource[i].id)) {
  312. this.selectBillDetailRows.push(dataSource[i])
  313. }
  314. }
  315. },
  316. rowAction(record, index) {
  317. return {
  318. on: {
  319. click: () => {
  320. let arr = []
  321. arr.push(record.id)
  322. this.selectedRowKeys = arr
  323. },
  324. dblclick: () => {
  325. let arr = []
  326. arr.push(record.id)
  327. this.selectedRowKeys = arr
  328. this.handleOk()
  329. },
  330. },
  331. }
  332. },
  333. },
  334. }
  335. </script>
  336. <style scoped></style>