OtherInList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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 placeholder="请选择单据状态" v-model="queryParam.status">
  98. <a-select-option value="0">未审核</a-select-option>
  99. <a-select-option value="9" v-if="!checkFlag">审核中</a-select-option>
  100. <a-select-option value="1">已审核</a-select-option>
  101. </a-select>
  102. </a-form-item>
  103. </a-col>
  104. <a-col :md="6" :sm="24">
  105. <a-form-item label="单据备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
  106. <a-input placeholder="请输入单据备注" v-model="queryParam.remark"></a-input>
  107. </a-form-item>
  108. </a-col>
  109. </a-row>
  110. </template>
  111. </a-form>
  112. </div>
  113. <!-- 操作按钮区域 -->
  114. <div class="table-operator" style="margin-top: 5px">
  115. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="myHandleAdd" type="primary" icon="plus">新增</a-button>
  116. <a-button v-if="inOutManageFlag && btnEnableList.indexOf(1) > -1" @click="handleWaitBill" icon="link"
  117. >待入库({{ waitTotal }})</a-button
  118. >
  119. <a-button v-if="btnEnableList.indexOf(1) > -1" icon="delete" @click="batchDel">删除</a-button>
  120. <a-button v-if="checkFlag && btnEnableList.indexOf(2) > -1" icon="check" @click="batchSetStatus(1)"
  121. >审核</a-button
  122. >
  123. <a-button v-if="checkFlag && btnEnableList.indexOf(7) > -1" icon="stop" @click="batchSetStatus(0)"
  124. >反审核</a-button
  125. >
  126. <a-button v-if="isShowExcel && btnEnableList.indexOf(3) > -1" icon="download" @click="handleExport"
  127. >导出</a-button
  128. >
  129. <a-popover trigger="click" placement="right">
  130. <template slot="content">
  131. <a-checkbox-group @change="onColChange" v-model="settingDataIndex" :defaultValue="settingDataIndex">
  132. <a-row style="width: 500px">
  133. <template v-for="(item, index) in defColumns">
  134. <template>
  135. <a-col :span="8">
  136. <a-checkbox :value="item.dataIndex">
  137. <j-ellipsis :value="item.title" :length="10"></j-ellipsis>
  138. </a-checkbox>
  139. </a-col>
  140. </template>
  141. </template>
  142. </a-row>
  143. <a-row style="padding-top: 10px">
  144. <a-col>
  145. 恢复默认列配置:<a-button @click="handleRestDefault" type="link" size="small">恢复默认</a-button>
  146. </a-col>
  147. </a-row>
  148. </a-checkbox-group>
  149. </template>
  150. <a-button icon="setting">列设置</a-button>
  151. </a-popover>
  152. <a-tooltip placement="left" title="可以进行库存初始化,生产管理模块的成品入库。" slot="action">
  153. <a-icon v-if="btnEnableList.indexOf(1) > -1" type="question-circle" style="font-size: 20px; float: right" />
  154. </a-tooltip>
  155. </div>
  156. <!-- table区域-begin -->
  157. <div>
  158. <a-table
  159. ref="table"
  160. size="middle"
  161. bordered
  162. rowKey="id"
  163. :columns="columns"
  164. :dataSource="dataSource"
  165. :components="handleDrag(columns)"
  166. :pagination="ipagination"
  167. :scroll="scroll"
  168. :loading="loading"
  169. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  170. @change="handleTableChange"
  171. >
  172. <span slot="action" slot-scope="text, record">
  173. <a @click="myHandleDetail(record, '其它入库', prefixNo)">查看</a>
  174. <a-divider v-if="btnEnableList.indexOf(1) > -1" type="vertical" />
  175. <a v-if="btnEnableList.indexOf(1) > -1" @click="myHandleEdit(record)">编辑</a>
  176. <a-divider v-if="btnEnableList.indexOf(1) > -1" type="vertical" />
  177. <a v-if="btnEnableList.indexOf(1) > -1" @click="myHandleCopyAdd(record)">复制</a>
  178. <a-divider v-if="btnEnableList.indexOf(1) > -1" type="vertical" />
  179. <a-popconfirm
  180. v-if="btnEnableList.indexOf(1) > -1"
  181. title="确定删除吗?"
  182. @confirm="() => myHandleDelete(record)"
  183. >
  184. <a>删除</a>
  185. </a-popconfirm>
  186. </span>
  187. <template slot="customRenderStatus" slot-scope="status">
  188. <a-tag v-if="status == '0'" color="red">未审核</a-tag>
  189. <a-tag v-if="status == '1'" color="green">已审核</a-tag>
  190. <a-tag v-if="status == '9'" color="orange">审核中</a-tag>
  191. </template>
  192. </a-table>
  193. </div>
  194. <!-- table区域-end -->
  195. <!-- 表单区域 -->
  196. <other-in-modal ref="modalForm" @ok="modalFormOk" @close="modalFormClose"></other-in-modal>
  197. <bill-detail ref="modalDetail" @ok="modalFormOk" @close="modalFormClose"></bill-detail>
  198. <bill-excel-iframe ref="billExcelIframe" @ok="modalFormOk" @close="modalFormClose"></bill-excel-iframe>
  199. <batch-wait-bill-list ref="batchWaitBill" @ok="modalFormOk" @close="waitModalFormClose"></batch-wait-bill-list>
  200. </a-card>
  201. </a-col>
  202. </a-row>
  203. </template>
  204. <!--power by ji shenghua-->
  205. <script>
  206. import OtherInModal from './modules/OtherInModal'
  207. import BillDetail from './dialog/BillDetail'
  208. import BillExcelIframe from '@/components/tools/BillExcelIframe'
  209. import BatchWaitBillList from './dialog/BatchWaitBillList'
  210. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  211. import { BillListMixin } from './mixins/BillListMixin'
  212. import JEllipsis from '@/components/jeecg/JEllipsis'
  213. import JDate from '@/components/jeecg/JDate'
  214. import { deleteAction } from '@/api/manage'
  215. export default {
  216. name: 'OtherInList',
  217. mixins: [JeecgListMixin, BillListMixin],
  218. components: {
  219. OtherInModal,
  220. BillDetail,
  221. BillExcelIframe,
  222. BatchWaitBillList,
  223. JEllipsis,
  224. JDate,
  225. },
  226. data() {
  227. return {
  228. // 查询条件
  229. queryParam: {
  230. number: '',
  231. materialParam: '',
  232. type: '入库',
  233. subType: '其它',
  234. organId: undefined,
  235. depotId: undefined,
  236. creator: undefined,
  237. linkNumber: '',
  238. status: undefined,
  239. remark: '',
  240. },
  241. prefixNo: 'QTRK',
  242. //出入库管理开关,适合独立仓管场景
  243. inOutManageFlag: false,
  244. labelCol: {
  245. span: 5,
  246. },
  247. wrapperCol: {
  248. span: 18,
  249. offset: 1,
  250. },
  251. // 默认索引
  252. defDataIndex: [
  253. 'action',
  254. 'organName',
  255. 'number',
  256. 'materialsList',
  257. 'operTimeStr',
  258. 'userName',
  259. 'materialCount',
  260. 'totalPrice',
  261. 'status',
  262. ],
  263. // 默认列
  264. defColumns: [
  265. {
  266. title: '操作',
  267. dataIndex: 'action',
  268. align: 'center',
  269. width: 160,
  270. scopedSlots: { customRender: 'action' },
  271. },
  272. { title: '供应商', dataIndex: 'organName', width: 120, ellipsis: true },
  273. {
  274. title: '单据编号',
  275. dataIndex: 'number',
  276. width: 160,
  277. customRender: function (text, record, index) {
  278. text = record.linkNumber ? text + '[转]' : text
  279. return text
  280. },
  281. },
  282. { title: '关联单据', dataIndex: 'linkNumber', width: 140 },
  283. { title: '商品信息', dataIndex: 'materialsList', width: 220, ellipsis: true },
  284. { title: '单据日期', dataIndex: 'operTimeStr', width: 145 },
  285. { title: '操作员', dataIndex: 'userName', width: 80, ellipsis: true },
  286. { title: '数量', dataIndex: 'materialCount', width: 60 },
  287. { title: '金额合计', dataIndex: 'totalPrice', width: 80 },
  288. { title: '备注', dataIndex: 'remark', width: 200 },
  289. {
  290. title: '状态',
  291. dataIndex: 'status',
  292. width: 80,
  293. align: 'center',
  294. scopedSlots: { customRender: 'customRenderStatus' },
  295. },
  296. ],
  297. url: {
  298. list: '/depotHead/list',
  299. delete: '/depotHead/delete',
  300. deleteBatch: '/depotHead/deleteBatch',
  301. batchSetStatusUrl: '/depotHead/batchSetStatus',
  302. },
  303. }
  304. },
  305. computed: {},
  306. created() {
  307. this.initSystemConfig()
  308. this.initSupplier()
  309. this.getDepotData()
  310. this.initUser()
  311. this.initWaitBillCount('入库', '采购,销售退货', '1,3')
  312. },
  313. methods: {
  314. searchQuery() {
  315. this.loadData(1)
  316. if (this.inOutManageFlag) {
  317. this.initWaitBillCount('入库', '采购,销售退货', '1,3')
  318. }
  319. },
  320. searchReset() {
  321. this.queryParam = {
  322. type: this.queryParam.type,
  323. subType: this.queryParam.subType,
  324. }
  325. this.loadData(1)
  326. if (this.inOutManageFlag) {
  327. this.initWaitBillCount('入库', '采购,销售退货', '1,3')
  328. }
  329. },
  330. myHandleDelete(record) {
  331. let that = this
  332. if (record.status === '0') {
  333. deleteAction(that.url.delete, { id: record.id }).then((res) => {
  334. if (res.code === 200) {
  335. that.loadData(1)
  336. if (that.inOutManageFlag) {
  337. that.initWaitBillCount('入库', '采购,销售退货', '1,3')
  338. }
  339. } else {
  340. that.$message.warning(res.data.message)
  341. }
  342. })
  343. } else {
  344. this.$message.warning('抱歉,只有未审核的单据才能删除,请先进行反审核!')
  345. }
  346. },
  347. batchDel: function () {
  348. if (this.selectedRowKeys.length <= 0) {
  349. this.$message.warning('请选择一条记录!')
  350. } else {
  351. let ids = ''
  352. for (let i = 0; i < this.selectedRowKeys.length; i++) {
  353. ids += this.selectedRowKeys[i] + ','
  354. }
  355. let that = this
  356. this.$confirm({
  357. title: '确认删除',
  358. content: '是否删除选中数据?',
  359. onOk: function () {
  360. that.loading = true
  361. deleteAction(that.url.deleteBatch, { ids: ids })
  362. .then((res) => {
  363. if (res.code === 200) {
  364. that.loadData()
  365. that.onClearSelected()
  366. if (that.inOutManageFlag) {
  367. that.initWaitBillCount('入库', '采购,销售退货', '1,3')
  368. }
  369. } else {
  370. that.$message.warning(res.data.message)
  371. }
  372. })
  373. .finally(() => {
  374. that.loading = false
  375. })
  376. },
  377. })
  378. }
  379. },
  380. //待入库
  381. handleWaitBill() {
  382. this.$refs.batchWaitBill.show('入库', '采购,销售退货', '1,3')
  383. this.$refs.batchWaitBill.title = '批量选择采购入库或销售退货'
  384. },
  385. waitModalFormClose() {
  386. this.loadData()
  387. this.initWaitBillCount('入库', '采购,销售退货', '1,3')
  388. },
  389. },
  390. }
  391. </script>
  392. <style scoped>
  393. @import '~@assets/less/common.less';
  394. </style>