materialProcurementList.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <template>
  2. <div>
  3. <a-card :bordered="false" class="top" style="margin-bottom:1%">
  4. <!-- 查询区域 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="searchQuery">
  7. <a-row :gutter="24">
  8. <a-col :md="4" :sm="24">
  9. <a-form-item label="生产组织">
  10. <a-input placeholder="请输入" v-model="queryParam.orgName" ></a-input>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="4" :sm="24">
  14. <a-form-item label="单据号">
  15. <a-input placeholder="请输入" v-model="queryParam.orderCode"></a-input>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="4" :sm="24">
  19. <a-form-item label="项目编码">
  20. <a-input-search placeholder="请输入" v-model="queryParam.projectCode" ></a-input-search>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="4" :sm="24">
  24. <a-form-item label="单据日期">
  25. <a-range-picker v-model="orderDate" style="width: 100%;" @change="changeStartDate" />
  26. <!-- <a-date-picker showTime valueFormat="YYYY-MM-DD" format = "YYYY-MM-DD" v-model="queryParam.transferDate" style="width: 100%"/> -->
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="4" :sm="24">
  30. <a-form-item label="单据状态">
  31. <a-select v-model="queryParam.state" style='width:100%' >
  32. <a-select-option value='开立'> 开立</a-select-option>
  33. <a-select-option value='审核'> 审核</a-select-option>
  34. <a-select-option value='已运算'> 已运算</a-select-option>
  35. <a-select-option value='关闭'> 关闭</a-select-option>
  36. </a-select>
  37. </a-form-item>
  38. </a-col>
  39. <template v-if="toggleSearchStatus">
  40. <a-col :md="4" :sm="24">
  41. <a-form-item label="计划部门">
  42. <a-input placeholder="请输入" v-model="queryParam.planDept" ></a-input>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="4" :sm="24">
  46. <a-form-item label="项目编码">
  47. <a-input placeholder="请输入" v-model="queryParam.projectCode"></a-input>
  48. </a-form-item>
  49. </a-col>
  50. <a-col :md="4" :sm="24">
  51. <a-form-item label="工单号">
  52. <a-input placeholder="请输入" v-model="queryParam.workNo"></a-input>
  53. </a-form-item>
  54. </a-col>
  55. <a-col :md="4" :sm="24">
  56. <a-form-item label="业务类型">
  57. <a-select v-model="queryParam.type" style='width:100%' >
  58. <a-select-option value='1'> 1</a-select-option>
  59. </a-select>
  60. </a-form-item>
  61. </a-col>
  62. </template>
  63. <a-col :md="4" :sm="24">
  64. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  65. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  66. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  67. <a @click="handleToggleSearch" style="margin-left: 8px">
  68. {{ toggleSearchStatus ? '收起' : '展开' }}
  69. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  70. </a>
  71. </span>
  72. </a-col>
  73. </a-row>
  74. </a-form>
  75. </div>
  76. </a-card>
  77. <a-card class="middle" style="margin-bottom:1%">
  78. <!-- 操作按钮区域 -->
  79. <div class="table-operator">
  80. <a-button type="danger" size="small" @click='addList'>新增</a-button>
  81. <a-button size="small" @click='addEdit'>修改</a-button>
  82. <a-button size="small" @click="delecteList()">删除</a-button>
  83. <a-button size="small" @click="detailList">详情</a-button>
  84. <a-button size="small" @click="examineApprove">审批</a-button>
  85. <a-button size="small" @click="abstainExamineApprove">弃审</a-button>
  86. <a-button size="small" @click="exportList('材料请购单')">导出</a-button>
  87. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl">
  88. <a-button size="small">导入</a-button>
  89. </a-upload>
  90. <a-button size="small" @click="entireClose">整单关闭</a-button>
  91. <a-button size="small" @click="synchronizationData">同步请购单</a-button>
  92. </div>
  93. <!-- table区域-begin -->
  94. <div>
  95. <a-table
  96. ref="table"
  97. size="middle"
  98. bordered
  99. rowKey="id"
  100. :columns="columns"
  101. :dataSource="dataSource"
  102. :pagination="ipagination"
  103. :scroll="{ x: 1500, y: 300 }"
  104. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  105. @change="handleTableChange"
  106. :customRow ="clickRow"
  107. >
  108. </a-table>
  109. </div>
  110. <!-- table区域-end -->
  111. </a-card>
  112. <materialProcurementAdd ref="materialProcurementAdd" @ok='getTableList'></materialProcurementAdd>
  113. <materialProcurementDetail ref="materialProcurementDetail" ></materialProcurementDetail>
  114. </div>
  115. </template>
  116. <script>
  117. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  118. import moment from 'dayjs'
  119. import { httpAction ,getAction,postAction,putAction,deleteAction,downFile} from '@/api/manage'
  120. import {queryDepartTreeList} from '@/api/api'
  121. import materialProcurementAdd from './modules/materialProcurementAdd'
  122. import materialProcurementDetail from './modules/materialProcurementDetail'
  123. import alertModal from '../../../plugins/modal'
  124. import { Message } from "element-ui";
  125. //---------workflow by fhf end -------------
  126. export default {
  127. name: "materialProcurementList",
  128. mixins: [JeecgListMixin],
  129. components: {
  130. materialProcurementAdd,
  131. materialProcurementDetail,
  132. },
  133. data () {
  134. return {
  135. description: '材料请购单页面',
  136. queryParam:{},
  137. selectedRowKeys:[],
  138. selectedRows:[],
  139. documentData:[],
  140. orderDate:[],
  141. toggleSearchStatus:false,
  142. dataSource:[ ],
  143. ipagination:{
  144. current: 1,
  145. pageSize: 10,
  146. pageSizeOptions: ['10', '20', '30'],
  147. showTotal: (total, range) => {
  148. return range[0] + '-' + range[1] + ' 共' + total + '条'
  149. },
  150. showQuickJumper: true,
  151. showSizeChanger: true,
  152. total: 0
  153. },
  154. // 表头
  155. columns: [
  156. {
  157. title: '#',
  158. dataIndex: '',
  159. key: 'rowIndex',
  160. width: 60,
  161. align: "center",
  162. customRender:function (t, r, index) {
  163. return parseInt(index)+1;
  164. }
  165. },
  166. {
  167. title: '生产组织',
  168. align:"center",
  169. dataIndex: 'orgName',
  170. ellipsis: true,
  171. },
  172. {
  173. title: '单据号',
  174. align:"center",
  175. dataIndex: 'orderCode',
  176. ellipsis: true,
  177. },
  178. {
  179. title: '单据日期',
  180. align:"center",
  181. dataIndex: 'orderDate',
  182. ellipsis: true,
  183. },
  184. {
  185. title: '单据状态',
  186. align:"center",
  187. dataIndex: 'state',
  188. ellipsis: true,
  189. },
  190. {
  191. title: '业务员',
  192. align:"center",
  193. dataIndex: 'salesperson',
  194. ellipsis: true,
  195. },
  196. {
  197. title: '计划部门',
  198. align:"center",
  199. dataIndex: 'planDept',
  200. ellipsis: true,
  201. },
  202. {
  203. title: '项目编码',
  204. align:"center",
  205. dataIndex: 'projectCode',
  206. ellipsis: true,
  207. },
  208. {
  209. title: '备注',
  210. align:"center",
  211. dataIndex: 'remarks',
  212. ellipsis: true,
  213. },
  214. {
  215. title: '工单号',
  216. align:"center",
  217. dataIndex: 'workNo',
  218. ellipsis: true,
  219. },
  220. {
  221. title: '业务类型',
  222. align:"center",
  223. dataIndex: 'type',
  224. ellipsis: true,
  225. },
  226. {
  227. title: '制单人',
  228. align:"center",
  229. dataIndex: 'createBy',
  230. ellipsis: true,
  231. },
  232. {
  233. title: '审批人',
  234. align:"center",
  235. dataIndex: 'reviewer',
  236. ellipsis: true,
  237. },
  238. ],
  239. importExcelUrl:'/production/safetyStock/importExcel',
  240. // ---------workflow by fhf start -------------
  241. serviceName: 'assetAllocationService',
  242. // ---------workflow by fhf end -------------
  243. }
  244. },
  245. computed: {
  246. importExcelUrl: function(){
  247. return `${window._CONFIG['domianURL']}/${this.importExcelUrl}`;
  248. },
  249. },
  250. created () {
  251. this.getTableList()
  252. },
  253. methods: {
  254. //获取数据
  255. getTableList(){
  256. alertModal.loading("执行中,请稍后!")
  257. getAction('/materialRequisition/madeMaterialRequisition/list',this.queryParam).then(res=>{
  258. alertModal.closeLoading();
  259. if(res.success){
  260. this.dataSource =res.result.records
  261. this.ipagination = {
  262. total: res.result.total,
  263. current: res.result.current,
  264. pageSize: res.result.size
  265. }
  266. }else{
  267. this.$message.error(res.message);
  268. }
  269. })
  270. },
  271. //查询
  272. searchQuery(){
  273. this.queryParam.pageNo=1
  274. this.getTableList()
  275. },
  276. //单据日期
  277. changeStartDate(data){
  278. this.orderDate = data
  279. this.queryParam.orderDate_begin = data.length==2?moment(data[0]).format('YYYY-MM-DD'):''
  280. this.queryParam.orderDate_end = data.length==2?moment(data[1]).format('YYYY-MM-DD'):''
  281. },
  282. onSearch(){
  283. },
  284. //重置
  285. searchReset(){
  286. this.queryParam={}
  287. this.orderDate = []
  288. this.getTableList()
  289. },
  290. //新增
  291. addList(){
  292. this.$refs.materialProcurementAdd.visible=true
  293. this.$refs.materialProcurementAdd.defaultMethod='add'
  294. },
  295. //编辑
  296. addEdit(){
  297. if(this.selectedRowKeys.length==0){
  298. this.$message.warning('请选择数据!')
  299. }else if(this.selectedRowKeys.length>1){
  300. this.$message.warning('请选择一条数据!')
  301. }else if(this.selectedRows[0].state!=='开立'){
  302. this.$message.warning('请选择状态为开立的数据 !')
  303. }else{
  304. this.$refs.materialProcurementAdd.visible=true
  305. this.$refs.materialProcurementAdd.defaultMethod='edit'
  306. this.$refs.materialProcurementAdd.visible=true
  307. //获取主表信息
  308. this.$refs.materialProcurementAdd.getMainData(this.selectedRowKeys[0])
  309. }
  310. },
  311. //审批
  312. examineApprove(){
  313. if(this.selectedRowKeys.length==0){
  314. this.$message.warning('请选择数据!')
  315. }else{
  316. this.$confirm({
  317. title: '确认审批',
  318. content: '是否审批选中数据?',
  319. onOk: ()=> {
  320. var ids = this.selectedRowKeys.toString()
  321. alertModal.loading("执行中,请稍后!")
  322. getAction('/materialRequisition/madeMaterialRequisition/reviewerByIds',{ids:ids}).then(res=>{
  323. alertModal.closeLoading();
  324. if(res.success){
  325. var arr = res.message.split(";");
  326. var str = arr.join(' <br/> ');
  327. this.getTableList()
  328. Message({
  329. dangerouslyUseHTMLString: true,
  330. message: str,
  331. type: 'info'
  332. });
  333. }else{
  334. var arr = res.message.split(";");
  335. var str = arr.join(' <br/> ');
  336. Message({
  337. dangerouslyUseHTMLString: true,
  338. message: str,
  339. type: 'error'
  340. });
  341. }
  342. })
  343. }
  344. })
  345. }
  346. },
  347. //弃审
  348. abstainExamineApprove(){
  349. if(this.selectedRowKeys.length==0){
  350. this.$message.warning('请选择数据!')
  351. }else{
  352. this.$confirm({
  353. title: '确认弃审',
  354. content: '是否弃审选中数据?',
  355. onOk: ()=> {
  356. var ids = this.selectedRowKeys.toString()
  357. alertModal.loading("执行中,请稍后!")
  358. getAction('/materialRequisition/madeMaterialRequisition/unReviewerByIds',{ids:ids}).then(res=>{
  359. alertModal.closeLoading();
  360. if(res.success){
  361. var arr = res.message.split(";");
  362. var str = arr.join(' <br/> ');
  363. this.getTableList()
  364. Message({
  365. dangerouslyUseHTMLString: true,
  366. message: str,
  367. type: 'info'
  368. });
  369. }else{
  370. var arr = res.message.split(";");
  371. var str = arr.join(' <br/> ');
  372. Message({
  373. dangerouslyUseHTMLString: true,
  374. message: str,
  375. type: 'error'
  376. });
  377. }
  378. })
  379. }
  380. })
  381. }
  382. },
  383. //整单关闭
  384. entireClose(){
  385. if(this.selectedRowKeys.length==0){
  386. this.$message.warning('请选择数据!')
  387. }else{
  388. var arr = []
  389. this.selectedRows.map(item=>{
  390. arr.push(item.state)
  391. })
  392. if(arr.includes('已运算')){
  393. this.$message.warning("勾选数据里包含状态为已运算的数据,请重新选择!")
  394. }else if(arr.includes('已请购')){
  395. this.$message.warning("勾选数据里包含状态为已请购的数据,请重新选择!")
  396. }else{
  397. this.$confirm({
  398. title: '确认整单关闭',
  399. content: '是否整单关闭选中数据?',
  400. onOk: ()=> {
  401. var ids = this.selectedRowKeys.toString()
  402. alertModal.loading("执行中,请稍后!")
  403. getAction('/materialRequisition/madeMaterialRequisition/closeOrder',{ids:ids}).then(res=>{
  404. alertModal.closeLoading();
  405. if(res.success){
  406. var arr = res.message.split(";");
  407. var str = arr.join(' <br/> ');
  408. this.getTableList()
  409. Message({
  410. dangerouslyUseHTMLString: true,
  411. message: str,
  412. type: 'info'
  413. });
  414. }else{
  415. var arr = res.message.split(";");
  416. var str = arr.join(' <br/> ');
  417. Message({
  418. dangerouslyUseHTMLString: true,
  419. message: str,
  420. type: 'error'
  421. });
  422. }
  423. })
  424. }
  425. })
  426. }
  427. }
  428. },
  429. //删除
  430. delecteList(){
  431. if(this.selectedRowKeys.length==0){
  432. this.$message.warning('请勾选数据!')
  433. }else if(this.selectedRowKeys.length==1){
  434. this.$confirm({
  435. title: '确认删除',
  436. content: '是否删除选中数据?',
  437. onOk: ()=>{
  438. alertModal.loading("执行中,请稍后!")
  439. deleteAction('/materialRequisition/madeMaterialRequisition/delete', {id: this.selectedRowKeys[0]}).then((res) => {
  440. alertModal.closeLoading();
  441. if (res.success) {
  442. this.$message.success('删除成功!');
  443. this.getTableList()
  444. } else {
  445. this.$message.error(res.message);
  446. }
  447. });
  448. }
  449. })
  450. }else{
  451. this.$confirm({
  452. title: '确认删除',
  453. content: '是否删除选中数据?',
  454. onOk: ()=> {
  455. var ids = this.selectedRowKeys.toString()
  456. alertModal.loading("执行中,请稍后!")
  457. deleteAction('/materialRequisition/madeMaterialRequisition/deleteBatch', {ids: ids}).then((res) => {
  458. alertModal.closeLoading();
  459. if (res.success) {
  460. this.$message.success('删除成功!');
  461. this.getTableList()
  462. } else {
  463. this.$message.error(res.message);
  464. }
  465. });
  466. }
  467. })
  468. }
  469. },
  470. //勾选
  471. onSelectChange(selectedRowKeys, selectionRows) {
  472. this.selectedRowKeys = selectedRowKeys;
  473. this.selectedRows = selectionRows;
  474. },
  475. handleTableChange(pagination, filters, sorter) {
  476. this.queryParam.pageNo = pagination.current
  477. this.queryParam.pageSize = pagination.pageSize
  478. this.getTableList()
  479. },
  480. detailList(){
  481. if(this.selectedRowKeys.length==0){
  482. this.$message.warning('请选择数据!')
  483. }else if(this.selectedRowKeys.length>1){
  484. this.$message.warning('请选择一条数据!')
  485. }else{
  486. this.$refs.materialProcurementDetail.visible=true
  487. //获取主表信息
  488. this.$refs.materialProcurementDetail.getMainData(this.selectedRowKeys[0])
  489. }
  490. },
  491. //双击
  492. clickRow(record, index){
  493. return {
  494. on: {
  495. dblclick: () => {
  496. this.$refs.materialProcurementDetail.visible=true
  497. //获取主表信息
  498. this.$refs.materialProcurementDetail.getMainData(record.id)
  499. },
  500. }
  501. }
  502. },
  503. //导出
  504. exportList(fileName){
  505. this.$confirm({
  506. title: '确认导出',
  507. content: '是否导出数据?',
  508. onOk: ()=> {
  509. alertModal.loading("执行中,请稍后!")
  510. downFile('/materialRequisition/madeMaterialRequisition/exportXls', this.queryParam).then(data => {
  511. alertModal.closeLoading();
  512. if (!data) {
  513. this.$message.warning('文件下载失败')
  514. return
  515. }
  516. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  517. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
  518. } else {
  519. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  520. let link = document.createElement('a')
  521. link.style.display = 'none'
  522. link.href = url
  523. link.setAttribute('download', fileName + '.xlsx')
  524. document.body.appendChild(link)
  525. link.click()
  526. document.body.removeChild(link) // 下载完成移除元素
  527. window.URL.revokeObjectURL(url) // 释放掉blob对象
  528. }
  529. })
  530. }
  531. })
  532. },
  533. //请购单
  534. synchronizationData(){
  535. var arrType = []
  536. this.selectedRows.map(item=>{
  537. arrType.push(item.type)
  538. })
  539. if(arrType.includes('工装')){
  540. this.$message.warning("勾选数据里包含工装数据,不允许同步请购单!")
  541. }else{
  542. this.$confirm({
  543. title: '确认同步请购单',
  544. content: '是否同步请购单?',
  545. onOk: ()=> {
  546. var ids = this.selectedRowKeys.toString()
  547. alertModal.loading("执行中,请稍后!")
  548. getAction('/materialRequisition/madeMaterialRequisition/syncRequisition',{ids:ids}).then(res=>{
  549. alertModal.closeLoading();
  550. if(res.success){
  551. debugger
  552. var arr = res.message.split(";");
  553. debugger
  554. var str = arr.join(' <br/> ');
  555. this.getTableList()
  556. Message({
  557. dangerouslyUseHTMLString: true,
  558. message: str,
  559. type: 'info'
  560. });
  561. }else{
  562. debugger
  563. var arr = res.message.split(";");
  564. var str = arr.join(' <br/> ');
  565. Message({
  566. dangerouslyUseHTMLString: true,
  567. message: str,
  568. type: 'error'
  569. });
  570. }
  571. })
  572. }
  573. })
  574. }
  575. }
  576. }
  577. }
  578. </script>
  579. <style scoped lang="less">
  580. /* @import '~@assets/less/common.less' */
  581. /deep/.ant-input{
  582. height:29px;
  583. }
  584. /deep/.ant-select-selection--single {
  585. height: 29px;
  586. }
  587. /deep/.ant-select{
  588. font-size: 12px;
  589. }
  590. /deep/.ant-form label{
  591. font-size: 12px;
  592. }
  593. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  594. margin-bottom:9px
  595. }
  596. /deep/.top>.ant-card-body{
  597. padding-bottom:0px;
  598. padding-top: 12px;
  599. }
  600. /deep/.ant-btn{
  601. height:28px
  602. }
  603. /deep/.ant-table-thead > tr > th{
  604. padding: 6px 8px !important;
  605. }
  606. /deep/ .ant-table-tbody > tr > td{
  607. padding: 6px 8px !important;
  608. }
  609. /deep/ .ant-table{
  610. font-size:12px
  611. }
  612. /deep/.ant-table-fixed-header .ant-table-scroll .ant-table-header{
  613. width: calc(100% + 9px);//减去滚动条的宽度
  614. }
  615. /deep/.middle>.ant-card-body{
  616. padding-bottom:2px;
  617. padding-top:14px;
  618. }
  619. /deep/.ant-select-sm .ant-select-selection__rendered{
  620. line-height: 27px;
  621. }
  622. </style>