OutStoreFormYY.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <a-card :bordered="false">
  3. <div v-show="visible">
  4. <a-drawer
  5. title="筛选"
  6. placement="top"
  7. :closable="false"
  8. :visible="showFilter"
  9. :height="330"
  10. @close="showFilter=false"
  11. >
  12. <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
  13. <a-form layout="inline">
  14. <a-row :gutter="48">
  15. <a-col :md="6" :sm="24">
  16. <a-form-item label="关键字">
  17. <a-input v-model.trim="queryParam.keyword" placeholder="请输入单号"/>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="24">
  21. <a-form-item label="用友单号">
  22. <a-input v-model.trim="queryParam.yyId" placeholder="请输入用友单号"/>
  23. </a-form-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-item label="出库类型">
  27. <a-select v-model="queryParam.type" placeholder="请选择">
  28. <a-select-option
  29. v-for="(label,value) in typeMap"
  30. :key="value"
  31. :label="label"
  32. :value="parseInt(value)">{{ label }}
  33. </a-select-option>
  34. </a-select>
  35. </a-form-item>
  36. </a-col>
  37. <a-col :md="6" :sm="24">
  38. <a-form-item label="申请部门">
  39. <a-select v-model="queryParam.applyDept" placeholder="请选择">
  40. <a-select-option
  41. v-for="(label,value) in deptYYMap"
  42. :key="value"
  43. :label="label"
  44. :value="parseInt(value)">{{ label }}
  45. </a-select-option>
  46. </a-select>
  47. </a-form-item>
  48. </a-col>
  49. <a-col :md="6" :sm="24">
  50. <a-form-item label="出库状态">
  51. <a-select v-model="queryParam.status" placeholder="请选择">
  52. <a-select-option
  53. v-for="(label,value) in statusMap"
  54. :key="value"
  55. :label="label"
  56. :value="parseInt(value)">{{ label }}
  57. </a-select-option>
  58. </a-select>
  59. </a-form-item>
  60. </a-col>
  61. <a-col :md="6" :sm="24">
  62. <a-form-item label="开始时间">
  63. <a-date-picker style="width:100%" v-model.trim="queryParam.searchStartTime" placeholder="请选择开始时间"/>
  64. </a-form-item>
  65. </a-col>
  66. <a-col :md="6" :sm="24">
  67. <a-form-item label="结束时间">
  68. <a-date-picker style="width:100%" v-model.trim="queryParam.searchEndTime" placeholder="请选择结束时间"/>
  69. </a-form-item>
  70. </a-col>
  71. <a-col :md="6 || 24" :sm="24">
  72. <span class="table-page-search-submitButtons">
  73. <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
  74. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  75. </span>
  76. </a-col>
  77. </a-row>
  78. </a-form>
  79. </div>
  80. </a-drawer>
  81. <div class="table-page-search-wrapper">
  82. <a-form layout="inline">
  83. <a-row :gutter="48">
  84. <a-col :md="8" :sm="24">
  85. <a-form-item label="关键字">
  86. <a-input v-model.trim="queryParam.keyword" placeholder="请输入单号"/>
  87. </a-form-item>
  88. </a-col>
  89. <a-col :md="6 || 24" :sm="24">
  90. <a-space>
  91. <a-button type="primary" @click="handleOk">查询</a-button>
  92. <a-button type="primary" @click="showFilter=true">筛选</a-button>
  93. <a-button @click="resetSearchForm">重置</a-button>
  94. </a-space>
  95. </a-col>
  96. </a-row>
  97. </a-form>
  98. </div>
  99. <div class="table-operator" style="margin-bottom: 8px;">
  100. <a-button v-if="$auth('store-out-store-forms-add')" type="primary" icon="plus" @click="handleAdd()">{{ outFlag?'新增':'退库申请' }}</a-button>
  101. <a-button style="margin-left: 8px" v-if="$auth('store-out-store-forms-export')" type="primary" icon="download" @click="doExport">导出</a-button>
  102. <!--<a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('store-out-store-forms-del')">
  103. <a-menu slot="overlay">
  104. <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
  105. <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
  106. </a-popconfirm>
  107. </a-menu>
  108. <a-button style="margin-left: 8px">
  109. 批量操作 <a-icon type="down" />
  110. </a-button>
  111. </a-dropdown>-->
  112. </div>
  113. <s-table
  114. ref="table"
  115. size="default"
  116. rowKey="id"
  117. :columns="columns"
  118. :data="loadData"
  119. :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
  120. :alert="options.alert"
  121. :rowSelection="options.rowSelection"
  122. showPagination="auto"
  123. >
  124. <span slot="action" slot-scope="record">
  125. <template>
  126. <a @click="handleView(record)">查看</a>
  127. <a-divider v-if="(record.status==0 || record.status == 3)&&outFlag" type="vertical" />
  128. <a v-if="$auth('store-out-store-forms-edit')&&(record.status==0 || record.status == 3)&&outFlag" @click="handleEdit(record)">修改</a>
  129. <a-divider v-if="record.status == 4 || record.status == 5 || record.status == 4" type="vertical" />
  130. <a v-if="record.status == 4 || record.status == 5" @click="handleViewTicket(record)">打印</a>
  131. <a-divider v-if="record.status==0" type="vertical" />
  132. <a-popconfirm v-if="record.status==0" title="是否提交审核?" @confirm="updateStore(record.id)">
  133. <a>提交审核</a>
  134. </a-popconfirm>
  135. <a-divider v-if="record.status==3" type="vertical" />
  136. <a-popconfirm v-if="record.status==3" title="重新推送?" @confirm="rePush(record.id)">
  137. <a>重新推送</a>
  138. </a-popconfirm>
  139. <a-divider v-if="record.status==0" type="vertical" />
  140. <a-popconfirm v-if="$auth('store-out-store-forms-del')&&record.status==0" title="是否要删除该条数据?" @confirm="batchDelete(record.id)">
  141. <a>删除</a>
  142. </a-popconfirm>
  143. <!-- <a-divider v-if="record.status==2" type="vertical" />
  144. <a-popconfirm v-if="record.status==2" title="是否要撤销?" @confirm="updateStoreBack(record.id)">
  145. <a>撤销</a>
  146. </a-popconfirm>-->
  147. </template>
  148. </span>
  149. <span slot="status" slot-scope="text">
  150. <badge
  151. :status="DictCache.COLOR.OUT_STORE_FORM_STATUS[text]"
  152. :text="statusMap[text]" />
  153. </span>
  154. </s-table>
  155. </div>
  156. <detail ref="detailModal" @ok="handleOk"/>
  157. <base-form ref="baseModal" @ok="handleOk"/>
  158. <base-form-back ref="baseBackModal" @ok="handleOk"/>
  159. <ticket-form ref="ticketForm" @ok="handleOk" />
  160. </a-card>
  161. </template>
  162. <script>
  163. import { STable, Ellipsis } from '@/components'
  164. import BaseForm from './modules/BaseFormYY'
  165. import BaseFormBack from './modules/BaseFormBackYY'
  166. import Detail from './modules/DetailYY'
  167. import TicketForm from './modules/TicketForm'
  168. import { updateStoreBack, getOutStoreFormPage, deleteOutStoreForms, fetchOutStoreForm, exportOutStoreForm } from '@/api/store/outstoreform'
  169. import { addOutFormYY } from '@/api/yongyou/yongyou'
  170. import { startSbInfoScrap } from '@/api/activiti/activiti-sb-scrap'
  171. export default {
  172. name: 'OutStoreFormList',
  173. components: {
  174. STable,
  175. Ellipsis,
  176. BaseForm,
  177. TicketForm,
  178. BaseFormBack,
  179. Detail
  180. },
  181. props: {
  182. filter: {
  183. type: Number,
  184. default: -1
  185. },
  186. outFlag: {
  187. type: Number,
  188. default: 1
  189. }
  190. },
  191. data () {
  192. return {
  193. // 查询参数
  194. queryParam: {
  195. ...this.$route.query
  196. },
  197. showFilter: false,
  198. // 表头
  199. columns: [
  200. {
  201. title: '序号',
  202. dataIndex: 'index',
  203. checked: true,
  204. width: 70,
  205. customRender: (text, record, index) => {
  206. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  207. }
  208. },
  209. {
  210. title: '出库单号',
  211. checked: true,
  212. width: 140,
  213. dataIndex: 'outNo'
  214. },
  215. {
  216. title: '用友单号',
  217. checked: true,
  218. width: 140,
  219. dataIndex: 'yyId'
  220. },
  221. {
  222. title: '出库类型',
  223. dataIndex: 'type',
  224. checked: true,
  225. width: 140,
  226. customRender: (text, record, index) => {
  227. return this.BaseTool.Object.getField(this.typeMap, text)
  228. }
  229. },
  230. {
  231. title: '申请部门',
  232. dataIndex: 'applyDept',
  233. checked: true,
  234. width: 140,
  235. customRender: (text, record, index) => {
  236. return this.BaseTool.Object.getField(this.deptYYMap, text)
  237. }
  238. },
  239. {
  240. title: '状态',
  241. dataIndex: 'status',
  242. checked: true,
  243. width: 140,
  244. scopedSlots: { customRender: 'status' }
  245. },
  246. {
  247. title: '领用日期',
  248. checked: true,
  249. width: 140,
  250. dataIndex: 'userTime'
  251. },
  252. {
  253. title: '仓库',
  254. checked: true,
  255. width: 140,
  256. dataIndex: 'storeName'
  257. },
  258. {
  259. title: '维修工单',
  260. checked: true,
  261. width: 140,
  262. dataIndex: 'repairNo'
  263. },
  264. {
  265. title: '操作',
  266. key: 'action',
  267. width: '200px',
  268. checked: true,
  269. fixed: 'right',
  270. align: 'center',
  271. scopedSlots: { customRender: 'action' }
  272. }
  273. ],
  274. // 下拉框map
  275. typeMap: {},
  276. deptYYMap: {},
  277. // 加载数据方法 必须为 Promise 对象
  278. loadData: parameter => {
  279. if (this.queryParam.searchStartTime) {
  280. this.queryParam.searchStartTime = this.BaseTool.Date.formatter(this.queryParam.searchStartTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) + ' 00:00:00'
  281. }
  282. if (this.queryParam.searchEndTime) {
  283. this.queryParam.searchEndTime = this.BaseTool.Date.formatter(this.queryParam.searchEndTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) + ' 23:59:59'
  284. }
  285. parameter = {
  286. ...parameter,
  287. ...this.queryParam,
  288. filter: this.filter,
  289. outFlag: this.outFlag,
  290. dataScope: {
  291. sortBy: 'desc',
  292. sortName: 'update_time'
  293. }
  294. }
  295. return getOutStoreFormPage(Object.assign(parameter, this.queryParam))
  296. .then(res => {
  297. return res.data
  298. })
  299. },
  300. selectedRowKeys: [],
  301. selectedRows: [],
  302. visible: true,
  303. options: {
  304. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  305. rowSelection: {
  306. selectedRowKeys: this.selectedRowKeys,
  307. onChange: this.onSelectChange
  308. }
  309. },
  310. optionAlertShow: false
  311. }
  312. },
  313. created () {
  314. // 下拉框map
  315. this.deptYYMap = { ...this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.OUT_STORE_FORM_DEPT_CODE), ...this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBB) }
  316. // console.log(this.deptYYMap)
  317. if (this.outFlag === 1) {
  318. this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.OUT_STORE_FORM_TYPE)
  319. } else {
  320. this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_BACK_FORM_TYPE)
  321. }
  322. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.OUT_STORE_FORM_STATUS)
  323. this.tableOption()
  324. },
  325. methods: {
  326. tableOption () {
  327. if (!this.optionAlertShow) {
  328. this.options = {
  329. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  330. rowSelection: {
  331. selectedRowKeys: this.selectedRowKeys,
  332. onChange: this.onSelectChange,
  333. getCheckboxProps: record => ({
  334. props: {
  335. disabled: false,
  336. name: record.id
  337. }
  338. })
  339. }
  340. }
  341. this.optionAlertShow = true
  342. } else {
  343. this.options = {
  344. alert: false,
  345. rowSelection: null
  346. }
  347. this.optionAlertShow = false
  348. }
  349. },
  350. batchDelete (id) {
  351. let ids = []
  352. if (this.BaseTool.String.isBlank(id)) {
  353. const length = this.selectedRows.length
  354. if (length === 0) {
  355. this.$message.info('请选择要删除的记录')
  356. return
  357. }
  358. ids = this.selectedRows.map(item => item.id)
  359. } else {
  360. ids = [id]
  361. }
  362. deleteOutStoreForms(ids).then(res => {
  363. this.$message.info('删除成功')
  364. this.handleOk()
  365. this.$refs.table.clearSelected()
  366. })
  367. },
  368. handleViewTicket (record) {
  369. this.visible = false
  370. fetchOutStoreForm({ id: record.id }).then(res => {
  371. const modal = this.$refs.ticketForm
  372. modal.base(res.data, this.outFlag)
  373. })
  374. },
  375. handleView (record) {
  376. this.visible = false
  377. fetchOutStoreForm({ id: record.id }).then(res => {
  378. const modal = this.$refs.detailModal
  379. modal.base(res.data)
  380. })
  381. },
  382. handleAdd () {
  383. this.visible = false
  384. const modal = this.outFlag ? this.$refs.baseModal : this.$refs.baseBackModal
  385. modal.base({ outFlag: this.outFlag }, {})
  386. },
  387. handleEdit (record) {
  388. this.visible = false
  389. fetchOutStoreForm({ id: record.id }).then(res => {
  390. const modal = this.outFlag ? this.$refs.baseModal : this.$refs.baseBackModal
  391. res.data.storeName = record.storeName
  392. modal.base(res.data)
  393. })
  394. },
  395. updateStore (id) {
  396. const params = {}
  397. params.id = id
  398. params.processInstanceId = ''
  399. params.auditModelName = '仓库审批'
  400. params.auditModelKey = 'out_store_back'
  401. startSbInfoScrap(params).then(res => {
  402. this.$message.info('已提交,请等待主管审核')
  403. this.$refs.table.refresh()
  404. })
  405. },
  406. updateStoreBack (id) {
  407. updateStoreBack({ id: id }).then(res => {
  408. this.$message.info('撤销成功')
  409. this.$refs.table.refresh()
  410. })
  411. },
  412. rePush (id) {
  413. addOutFormYY({ id: id }).then(res => {
  414. this.$message.info('撤销成功')
  415. this.$refs.table.refresh()
  416. })
  417. },
  418. handleOk () {
  419. this.visible = true
  420. this.$refs.table.refresh()
  421. },
  422. onSelectChange (selectedRowKeys, selectedRows) {
  423. this.selectedRowKeys = selectedRowKeys
  424. this.selectedRows = selectedRows
  425. },
  426. resetSearchForm () {
  427. this.queryParam = {
  428. }
  429. this.$refs.table.refresh(true)
  430. },
  431. doExport () {
  432. const parameter = {
  433. ...this.queryParam,
  434. ids: this.selectedRowKeys
  435. }
  436. exportOutStoreForm(parameter).then(file => {
  437. this.BaseTool.UPLOAD.downLoadExportExcel(file)
  438. })
  439. },
  440. handleEnter () {
  441. this.$refs.table.refresh(true)
  442. }
  443. }
  444. }
  445. </script>