PurchaseInList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. <template>
  2. <a-row :gutter="24">
  3. <a-col :md="24">
  4. <a-card :bordered="false">
  5. <!-- 查询区域 -->
  6. <div class="table-page-search-wrapper">
  7. <!-- 搜索区域 -->
  8. <a-form layout="inline" @keyup.enter.native="searchQuery">
  9. <a-row :gutter="24">
  10. <a-col :md="6" :sm="24">
  11. <a-form-item label="单据编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
  12. <a-input placeholder="请输入单据编号" v-model="queryParam.number"></a-input>
  13. </a-form-item>
  14. </a-col>
  15. <a-col :md="6" :sm="24">
  16. <a-form-item label="商品信息" :labelCol="labelCol" :wrapperCol="wrapperCol">
  17. <a-input
  18. placeholder="请输入条码、名称、助记码、规格、型号等信息"
  19. v-model="queryParam.materialParam"
  20. ></a-input>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="单据日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  25. <a-range-picker
  26. style="width: 100%"
  27. v-model="queryParam.createTimeRange"
  28. format="YYYY-MM-DD"
  29. :placeholder="['开始时间', '结束时间']"
  30. @change="onDateChange"
  31. @ok="onDateOk"
  32. />
  33. </a-form-item>
  34. </a-col>
  35. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  36. <a-col :md="6" :sm="24">
  37. <a-button type="primary" @click="searchQuery">查询</a-button>
  38. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  39. <a @click="handleToggleSearch" style="margin-left: 8px">
  40. {{ toggleSearchStatus ? '收起' : '展开' }}
  41. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  42. </a>
  43. </a-col>
  44. </span>
  45. </a-row>
  46. <template v-if="toggleSearchStatus">
  47. <a-row :gutter="24">
  48. <a-col :md="6" :sm="24">
  49. <a-form-item label="供应商" :labelCol="labelCol" :wrapperCol="wrapperCol">
  50. <a-select
  51. placeholder="请选择供应商"
  52. showSearch
  53. optionFilterProp="children"
  54. v-model="queryParam.organId"
  55. >
  56. <a-select-option v-for="(item, index) in supList" :key="index" :value="item.id">
  57. {{ item.supplier }}
  58. </a-select-option>
  59. </a-select>
  60. </a-form-item>
  61. </a-col>
  62. <a-col :md="6" :sm="24">
  63. <a-form-item label="仓库名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
  64. <a-select
  65. placeholder="请选择仓库"
  66. showSearch
  67. optionFilterProp="children"
  68. v-model="queryParam.depotId"
  69. >
  70. <a-select-option v-for="(depot, index) in depotList" :key="index" :value="depot.id">
  71. {{ depot.depotName }}
  72. </a-select-option>
  73. </a-select>
  74. </a-form-item>
  75. </a-col>
  76. <a-col :md="6" :sm="24">
  77. <a-form-item label="操作员" :labelCol="labelCol" :wrapperCol="wrapperCol">
  78. <a-select
  79. placeholder="请选择操作员"
  80. showSearch
  81. optionFilterProp="children"
  82. v-model="queryParam.creator"
  83. >
  84. <a-select-option v-for="(item, index) in userList" :key="index" :value="item.id">
  85. {{ item.userName }}
  86. </a-select-option>
  87. </a-select>
  88. </a-form-item>
  89. </a-col>
  90. <a-col :md="6" :sm="24">
  91. <a-form-item label="关联订单" :labelCol="labelCol" :wrapperCol="wrapperCol">
  92. <a-input placeholder="请输入关联订单" v-model="queryParam.linkNumber"></a-input>
  93. </a-form-item>
  94. </a-col>
  95. <a-col :md="6" :sm="24">
  96. <a-form-item label="结算账户" :labelCol="labelCol" :wrapperCol="wrapperCol">
  97. <a-select
  98. placeholder="请选择结算账户"
  99. showSearch
  100. optionFilterProp="children"
  101. v-model="queryParam.accountId"
  102. >
  103. <a-select-option v-for="(item, index) in accountList" :key="index" :value="item.id">
  104. {{ item.name }}
  105. </a-select-option>
  106. </a-select>
  107. </a-form-item>
  108. </a-col>
  109. <a-col :md="6" :sm="24">
  110. <a-form-item label="有无欠款" :labelCol="labelCol" :wrapperCol="wrapperCol">
  111. <a-select placeholder="请选择有无欠款" v-model="queryParam.hasDebt">
  112. <a-select-option value="1">有欠款</a-select-option>
  113. <a-select-option value="0">无欠款</a-select-option>
  114. </a-select>
  115. </a-form-item>
  116. </a-col>
  117. <a-col :md="6" :sm="24">
  118. <a-form-item label="单据状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
  119. <a-select placeholder="请选择单据状态" v-model="queryParam.status">
  120. <a-select-option value="0">未审核</a-select-option>
  121. <a-select-option value="9" v-if="!checkFlag">审核中</a-select-option>
  122. <a-select-option value="1">已审核</a-select-option>
  123. <a-select-option value="3">部分入库</a-select-option>
  124. <a-select-option value="2">完成入库</a-select-option>
  125. </a-select>
  126. </a-form-item>
  127. </a-col>
  128. <a-col :md="6" :sm="24">
  129. <a-form-item label="单据备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
  130. <a-input placeholder="请输入单据备注" v-model="queryParam.remark"></a-input>
  131. </a-form-item>
  132. </a-col>
  133. </a-row>
  134. </template>
  135. </a-form>
  136. </div>
  137. <!-- 操作按钮区域 -->
  138. <div class="table-operator" style="margin-top: 5px">
  139. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="myHandleAdd" type="primary" icon="plus">新增</a-button>
  140. <a-button v-if="btnEnableList.indexOf(1) > -1" icon="delete" @click="batchDel">删除</a-button>
  141. <a-button v-if="checkFlag && btnEnableList.indexOf(2) > -1" icon="check" @click="batchSetStatus(1)"
  142. >审核</a-button
  143. >
  144. <a-button v-if="checkFlag && btnEnableList.indexOf(7) > -1" icon="stop" @click="batchSetStatus(0)"
  145. >反审核</a-button
  146. >
  147. <a-button v-if="isShowExcel && btnEnableList.indexOf(3) > -1" icon="download" @click="handleExport"
  148. >导出</a-button
  149. >
  150. <a-popover trigger="click" placement="right">
  151. <template slot="content">
  152. <a-checkbox-group @change="onColChange" v-model="settingDataIndex" :defaultValue="settingDataIndex">
  153. <a-row style="width: 500px">
  154. <template v-for="(item, index) in defColumns">
  155. <template>
  156. <a-col :span="8">
  157. <a-checkbox :value="item.dataIndex">
  158. <j-ellipsis :value="item.title" :length="10"></j-ellipsis>
  159. </a-checkbox>
  160. </a-col>
  161. </template>
  162. </template>
  163. </a-row>
  164. <a-row style="padding-top: 10px">
  165. <a-col>
  166. 恢复默认列配置:<a-button @click="handleRestDefault" type="link" size="small">恢复默认</a-button>
  167. </a-col>
  168. </a-row>
  169. </a-checkbox-group>
  170. </template>
  171. <a-button icon="setting">列设置</a-button>
  172. </a-popover>
  173. <a-tooltip
  174. placement="left"
  175. title="采购入库单可以由采购订单转过来,也可以单独创建。
  176. 采购入库单据中的仓库列表只显示当前用户有权限的仓库。采购入库单可以使用多账户付款。
  177. 勾选单据之后可以进行批量操作(删除、审核、反审核)"
  178. slot="action"
  179. >
  180. <a-icon v-if="btnEnableList.indexOf(1) > -1" type="question-circle" style="font-size: 20px; float: right" />
  181. </a-tooltip>
  182. </div>
  183. <!-- table区域-begin -->
  184. <div>
  185. <a-table
  186. ref="table"
  187. size="middle"
  188. bordered
  189. rowKey="id"
  190. :columns="columns"
  191. :dataSource="dataSource"
  192. :components="handleDrag(columns)"
  193. :pagination="ipagination"
  194. :scroll="scroll"
  195. :loading="loading"
  196. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  197. @change="handleTableChange"
  198. >
  199. <span slot="action" slot-scope="text, record">
  200. <a @click="myHandleDetail(record, '采购入库', prefixNo)">查看</a>
  201. <a-divider v-if="btnEnableList.indexOf(1) > -1" type="vertical" />
  202. <a v-if="btnEnableList.indexOf(1) > -1" @click="myHandleEdit(record)">编辑</a>
  203. <a-divider v-if="btnEnableList.indexOf(1) > -1" type="vertical" />
  204. <a v-if="btnEnableList.indexOf(1) > -1" @click="myHandleCopyAdd(record)">复制</a>
  205. <a-divider v-if="btnEnableList.indexOf(1) > -1" type="vertical" />
  206. <a-popconfirm
  207. v-if="btnEnableList.indexOf(1) > -1"
  208. title="确定删除吗?"
  209. @confirm="() => myHandleDelete(record)"
  210. >
  211. <a>删除</a>
  212. </a-popconfirm>
  213. </span>
  214. <template slot="customRenderDebt" slot-scope="value, record">
  215. <a-tooltip title="有付款单">
  216. <span style="color: green" v-if="value > 0 && record.hasFinancialFlag">{{ value }}</span>
  217. </a-tooltip>
  218. <a-tooltip title="暂未付款">
  219. <span style="color: red" v-if="value > 0 && !record.hasFinancialFlag">{{ value }}</span>
  220. </a-tooltip>
  221. <span v-if="value === 0">{{ value }}</span>
  222. </template>
  223. <template slot="customRenderStatus" slot-scope="status">
  224. <a-tag v-if="status == '0'" color="red">未审核</a-tag>
  225. <a-tag v-if="status == '1'" color="green">已审核</a-tag>
  226. <a-tag v-if="status == '2'" color="cyan">完成入库</a-tag>
  227. <a-tag v-if="status == '3'" color="blue">部分入库</a-tag>
  228. <a-tag v-if="status == '9'" color="orange">审核中</a-tag>
  229. </template>
  230. </a-table>
  231. </div>
  232. <!-- table区域-end -->
  233. <!-- 表单区域 -->
  234. <purchase-in-modal ref="modalForm" @ok="modalFormOk" @close="modalFormClose"></purchase-in-modal>
  235. <bill-detail ref="modalDetail" @ok="modalFormOk" @close="modalFormClose"></bill-detail>
  236. <bill-excel-iframe ref="billExcelIframe" @ok="modalFormOk" @close="modalFormClose"></bill-excel-iframe>
  237. </a-card>
  238. </a-col>
  239. </a-row>
  240. </template>
  241. <!-- by ji sheng hua-->
  242. <script>
  243. import PurchaseInModal from './modules/PurchaseInModal'
  244. import BillDetail from './dialog/BillDetail'
  245. import BillExcelIframe from '@/components/tools/BillExcelIframe'
  246. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  247. import { BillListMixin } from './mixins/BillListMixin'
  248. import JEllipsis from '@/components/jeecg/JEllipsis'
  249. import JDate from '@/components/jeecg/JDate'
  250. import Vue from 'vue'
  251. export default {
  252. name: 'PurchaseInList',
  253. mixins: [JeecgListMixin, BillListMixin],
  254. components: {
  255. PurchaseInModal,
  256. BillDetail,
  257. BillExcelIframe,
  258. JEllipsis,
  259. JDate,
  260. },
  261. data() {
  262. return {
  263. // 查询条件
  264. queryParam: {
  265. number: '',
  266. materialParam: '',
  267. type: '入库',
  268. subType: '采购',
  269. organId: undefined,
  270. depotId: undefined,
  271. creator: undefined,
  272. linkNumber: '',
  273. accountId: undefined,
  274. hasDebt: undefined,
  275. status: undefined,
  276. remark: '',
  277. },
  278. prefixNo: 'CGRK',
  279. labelCol: {
  280. span: 5,
  281. },
  282. wrapperCol: {
  283. span: 18,
  284. offset: 1,
  285. },
  286. // 默认索引
  287. defDataIndex: [
  288. 'action',
  289. 'organName',
  290. 'number',
  291. 'materialsList',
  292. 'operTimeStr',
  293. 'userName',
  294. 'materialCount',
  295. 'totalPrice',
  296. 'totalTaxLastMoney',
  297. 'needInMoney',
  298. 'changeAmount',
  299. 'debt',
  300. 'status',
  301. ],
  302. // 默认列
  303. defColumns: [
  304. {
  305. title: '操作',
  306. dataIndex: 'action',
  307. align: 'center',
  308. width: 180,
  309. scopedSlots: { customRender: 'action' },
  310. },
  311. { title: '供应商', dataIndex: 'organName', width: 120, ellipsis: true },
  312. {
  313. title: '单据编号',
  314. dataIndex: 'number',
  315. width: 160,
  316. customRender: function (text, record, index) {
  317. text = record.linkNumber ? text + '[订]' : text
  318. text = record.hasBackFlag ? text + '[退]' : text
  319. return text
  320. },
  321. },
  322. { title: '关联订单', dataIndex: 'linkNumber', width: 140 },
  323. { title: '商品信息', dataIndex: 'materialsList', width: 220, ellipsis: true },
  324. { title: '单据日期', dataIndex: 'operTimeStr', width: 145 },
  325. { title: '操作员', dataIndex: 'userName', width: 80, ellipsis: true },
  326. { title: '数量', dataIndex: 'materialCount', width: 60 },
  327. { title: '金额合计', dataIndex: 'totalPrice', width: 80 },
  328. {
  329. title: '含税合计',
  330. dataIndex: 'totalTaxLastMoney',
  331. width: 80,
  332. customRender: function (text, record, index) {
  333. return (record.discountMoney + record.discountLastMoney).toFixed(2)
  334. },
  335. },
  336. {
  337. title: '优惠率',
  338. dataIndex: 'discount',
  339. width: 60,
  340. customRender: function (text, record, index) {
  341. return text ? text + '%' : ''
  342. },
  343. },
  344. { title: '付款优惠', dataIndex: 'discountMoney', width: 80 },
  345. { title: '其它费用', dataIndex: 'otherMoney', width: 80 },
  346. {
  347. title: '待付金额',
  348. dataIndex: 'needInMoney',
  349. width: 80,
  350. customRender: function (text, record, index) {
  351. let needInMoney = record.discountLastMoney + record.otherMoney - record.deposit
  352. return needInMoney ? needInMoney.toFixed(2) : 0
  353. },
  354. },
  355. { title: '结算账户', dataIndex: 'accountName', width: 80 },
  356. { title: '扣除订金', dataIndex: 'deposit', width: 80 },
  357. { title: '本次付款', dataIndex: 'changeAmount', width: 80 },
  358. { title: '本次欠款', dataIndex: 'debt', width: 80, scopedSlots: { customRender: 'customRenderDebt' } },
  359. { title: '备注', dataIndex: 'remark', width: 200 },
  360. {
  361. title: '状态',
  362. dataIndex: 'status',
  363. width: 80,
  364. align: 'center',
  365. scopedSlots: { customRender: 'customRenderStatus' },
  366. },
  367. ],
  368. url: {
  369. list: '/depotHead/list',
  370. delete: '/depotHead/delete',
  371. deleteBatch: '/depotHead/deleteBatch',
  372. batchSetStatusUrl: '/depotHead/batchSetStatus',
  373. },
  374. }
  375. },
  376. computed: {},
  377. created() {
  378. this.initSystemConfig()
  379. this.initSupplier()
  380. this.getDepotData()
  381. this.initUser()
  382. this.initAccount()
  383. },
  384. methods: {},
  385. }
  386. </script>
  387. <style scoped>
  388. @import '~@assets/less/common.less';
  389. </style>