inancialReconciliation.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. <template>
  2. <!-- 【单证】 计划单统计表 -->
  3. <div id="costAllocationTotal">
  4. <!-- 查询区域 -->
  5. <a-card :bordered="false">
  6. <div class="table-page-search-wrapper">
  7. <a-form layout="inline" @keyup.enter.native="searchQuery">
  8. <a-row :gutter="24">
  9. <a-col :md="6" :sm="8">
  10. <a-form-item label="计划号">
  11. <a-input placeholder="请输入计划号" v-model="queryParam.planNo"></a-input>
  12. </a-form-item>
  13. </a-col>
  14. <a-col :md="6" :sm="8">
  15. <a-form-item label="对单人">
  16. <a-input placeholder="请输入" v-model="queryParam.planMan"></a-input>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="8">
  20. <a-form-item label="日期" has-feedback>
  21. <a-range-picker
  22. :placeholder="['开始时间', '结束时间']"
  23. format="YYYY-MM-DD"
  24. style="width: 100%"
  25. v-model="dverifyDate"
  26. @change="changeCreateTime"
  27. />
  28. <!-- <a-input placeholder="请输入日期" v-model="queryParam.dverifyDate"></a-input> -->
  29. </a-form-item>
  30. </a-col>
  31. <template v-if="toggleSearchStatus">
  32. <!-- <a-col :md="6" :sm="8">
  33. <a-form-item label="是否存在对单人">
  34. <a-select v-model="queryParam.isPlanMan" placeholder="" >
  35. <a-select-option value="">请选择</a-select-option>
  36. <a-select-option value="是">是</a-select-option>
  37. <a-select-option value="否">否</a-select-option>
  38. </a-select>
  39. </a-form-item>
  40. </a-col> -->
  41. <a-col :md="6" :sm="8">
  42. <a-form-item label="面损表单据状态">
  43. <a-select v-model="queryParam.fstatus">
  44. <a-select-option value="">请选择</a-select-option>
  45. <a-select-option value="保存">保存</a-select-option>
  46. <a-select-option value="提交">提交</a-select-option>
  47. <a-select-option value="返单">返单</a-select-option>
  48. <a-select-option value="完成">完成</a-select-option>
  49. <a-select-option value="初审通过">初审通过</a-select-option>
  50. <a-select-option value="已指派">已指派</a-select-option>
  51. </a-select>
  52. <!-- <a-input placeholder="请输入面损表单据状态" v-model="queryParam.fstatus"></a-input> -->
  53. </a-form-item>
  54. </a-col>
  55. <a-col :md="6" :sm="8">
  56. <a-form-item label="分配表单据状态">
  57. <a-select v-model="queryParam.cstatus">
  58. <a-select-option value="">请选择</a-select-option>
  59. <a-select-option value="保存">保存</a-select-option>
  60. <a-select-option value="提交">提交</a-select-option>
  61. <a-select-option value="返单">返单</a-select-option>
  62. <a-select-option value="完成">完成</a-select-option>
  63. </a-select>
  64. <!-- <a-input placeholder="请输入分配表单据状态" v-model="queryParam.cstatus"></a-input> -->
  65. </a-form-item>
  66. </a-col>
  67. <a-col :md="6" :sm="8">
  68. <a-form-item label="部门">
  69. <a-input placeholder="请输入部门" v-model="queryParam.department"></a-input>
  70. </a-form-item>
  71. </a-col>
  72. <a-col :md="6" :sm="8">
  73. <a-form-item label="业务员">
  74. <a-input placeholder="请输入业务员" v-model="queryParam.salesman"></a-input>
  75. </a-form-item>
  76. </a-col>
  77. <a-col :md="6" :sm="8">
  78. <a-form-item label="计划师傅/制单人">
  79. <a-input placeholder="请输入" v-model="queryParam.maker"></a-input>
  80. </a-form-item>
  81. </a-col>
  82. <a-col :md="6" :sm="8">
  83. <a-form-item label="备注">
  84. <a-input placeholder="请输入" v-model="queryParam.remarks"></a-input>
  85. </a-form-item>
  86. </a-col>
  87. <a-col :md="6" :sm="8">
  88. <a-form-item label="审核结束日期">
  89. <a-range-picker
  90. :placeholder="['开始时间', '结束时间']"
  91. format="YYYY-MM-DD"
  92. v-model="ffirstApproveDate"
  93. @change="changeFfirstApproveDate"
  94. />
  95. <!-- <a-date-picker
  96. placeholder="请选择审核结束日期"
  97. style="width:100%;"
  98. :format="dateFormat"
  99. v-model="queryParam.ffirstApproveDate"
  100. @change="changeFfirstApproveDate"
  101. /> -->
  102. </a-form-item>
  103. </a-col>
  104. </template>
  105. <a-col :md="6" :sm="8">
  106. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  107. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  108. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  109. <a @click="handleToggleSearch" style="margin-left: 8px">
  110. {{ toggleSearchStatus ? '收起' : '展开' }}
  111. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  112. </a>
  113. </span>
  114. </a-col>
  115. </a-row>
  116. </a-form>
  117. </div>
  118. </a-card>
  119. <!-- table区域 -->
  120. <a-spin :spinning="loading">
  121. <a-card :bordered="false" style=" marginTop:10px;">
  122. <div class="table-operator">
  123. <a-button type="primary" @click="exportList('计划单统计表')" icon="plus">导出</a-button>
  124. </div>
  125. <a-table
  126. bordered
  127. rowKey="index"
  128. :columns="costAllocationColumns"
  129. :data-source="costAllocationData"
  130. :loading="loading"
  131. :customRow="rowClick"
  132. :pagination="pagination"
  133. :scroll="{ x: 1500,y:450 }"
  134. @change="handleTableChange"
  135. >
  136. <span slot="remarks" slot-scope="text, record">
  137. <a-input placeholder="请输入" v-model="record.remarks" v-if="record.enter=='1'"></a-input>
  138. <span v-if="record.enter=='0'">{{ record.remarks }}</span>
  139. </span>
  140. <span slot="planMan" slot-scope="text, record">
  141. <a-input placeholder="请输入" v-model="record.planMan" v-if="record.enter=='1'"></a-input>
  142. <span v-if="record.enter=='0'">{{ record.planMan }}</span>
  143. </span>
  144. <span slot="ffinalApproveDate" slot-scope="text, record">
  145. <a-date-picker style="width: 100%" v-model="record.ffinalApproveDate" :format="dateFormat" v-if="record.enter=='1'"> </a-date-picker>
  146. <!-- <a-input placeholder="请输入" v-model="record.ffinalApproveDate" v-if="record.enter=='1'"></a-input> -->
  147. <span v-if="record.enter=='0'">{{text}}</span>
  148. </span>
  149. <span slot="option" slot-scope="text, record">
  150. <a :disabled="record.enter=='0'" @click="sava(record)"> 保存</a>
  151. <a-divider type="vertical" />
  152. <a :disabled="record.enter=='0'" @click="cancel(record)"> 取消</a>
  153. </span>
  154. </a-table>
  155. </a-card>
  156. </a-spin>
  157. <!-- 详情 大抽屉 -->
  158. <!-- <costDetail-drawer ref="costDetailDrawer" :fatherList="getCostList" @ok="modalFormOk"></costDetail-drawer> -->
  159. </div>
  160. </template>
  161. <script>
  162. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  163. import JEllipsis from '@/components/jeecg/JEllipsis'
  164. import moment from 'moment'
  165. import { downFile } from '@/api/manage'
  166. import costDetailDrawer from '@views/cost-allocation-total/costDetailDrawer.vue'
  167. import { checkList,savaList,savaList1 } from '@api/document/inancialReconciliation.js'
  168. export default {
  169. name: 'inancialReconciliation', // 成本分配汇总 单证
  170. mixins: [JeecgListMixin],
  171. components: { JEllipsis, moment, costDetailDrawer },
  172. data() {
  173. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  174. return {
  175. dverifyDate:[],
  176. ffirstApproveDate:[],
  177. costAllocationColumns: [
  178. { title: '计划单号', width: 120, dataIndex: 'planNo', fixed: 'left', className: 'replacecolor' },
  179. { title: '日期', width: 120, dataIndex: 'dverifyDate', className: 'replacecolor' },
  180. { title: '部门', width: 120, dataIndex: 'department', className: 'replacecolor',
  181. sorter:(a,b)=> {
  182. let temp1="";
  183. let temp2="";
  184. if(a.department!=null){
  185. temp1=a.department;
  186. }
  187. if(b.department!=null){
  188. temp2=b.department;
  189. }
  190. return temp1.localeCompare(temp2);
  191. },
  192. },
  193. { title: '业务员', width: 120, dataIndex: 'salesman', className: 'replacecolor' },
  194. { title: '计划师傅/制单人', width: 150, dataIndex: 'maker', className: 'replacecolor'},
  195. { title: '对单人(手输人)', width: 220, dataIndex: 'planMan', align: 'left', className: 'replacecolor',
  196. scopedSlots: { customRender: 'planMan' },
  197. sorter:(a,b)=> {
  198. let temp1="";
  199. let temp2="";
  200. if(a.planMan!=null){
  201. temp1=a.planMan;
  202. }
  203. if(b.planMan!=null){
  204. temp2=b.planMan;
  205. }
  206. return temp1.localeCompare(temp2);
  207. },
  208. },
  209. // {
  210. // title: '创建时间',
  211. // dataIndex: 'createTime',
  212. // align: 'center',
  213. // sorter: true,
  214. // customRender: text => {
  215. // return moment(text).format('YYYY-MM-DD')
  216. // }
  217. // },
  218. {
  219. title: '交单日期',
  220. width: 120,
  221. dataIndex: 'fsubmitDate',
  222. customRender: text => {
  223. if(text!==''&&text){
  224. return moment(text).format('YYYY-MM-DD')
  225. }else{
  226. return ''
  227. }
  228. },
  229. className: 'replacecolor',
  230. sorter: (a, b) => {
  231. return new Date(a.fsubmitDate) > new Date(b.fsubmitDate) ? 1 : -1;
  232. },
  233. },
  234. {
  235. title: '返单日期',
  236. width: 120,
  237. dataIndex: 'frejectDate',
  238. customRender: text => {
  239. if(text!==''&&text){
  240. return moment(text).format('YYYY-MM-DD')
  241. }else{
  242. return ''
  243. }
  244. },
  245. className: 'replacecolor',
  246. sorter: (a, b) => {
  247. return new Date(a.frejectDate) > new Date(b.frejectDate) ? 1 : -1;
  248. },
  249. },
  250. {
  251. title: '审核结束日期',
  252. width: 120,
  253. dataIndex: 'ffirstApproveDate',
  254. customRender: text => {
  255. if(text!=='' && text){
  256. return moment(text).format('YYYY-MM-DD')
  257. }else{
  258. return ''
  259. }
  260. },
  261. className: 'replacecolor',
  262. sorter: (a, b) => {
  263. return new Date(a.ffirstApproveDate) > new Date(b.ffirstApproveDate) ? 1 : -1;
  264. },
  265. },
  266. {
  267. title: '核纱结束日期',
  268. width: 150,
  269. dataIndex: 'ffinalApproveDate',
  270. scopedSlots: { customRender: 'ffinalApproveDate' },
  271. // customRender: text => {
  272. // if(text!==''&&text){
  273. // return moment(text).format('YYYY-MM-DD')
  274. // }else{
  275. // return ''
  276. // }
  277. // },
  278. className: 'replacecolor',
  279. sorter: (a, b) => {
  280. return new Date(a.ffinalApproveDate) > new Date(b.ffinalApproveDate) ? 1 : -1;
  281. },
  282. },
  283. { title: '面损表单据状态', width: 90, dataIndex: 'fstatus', className: 'replacecolor',
  284. sorter:(a,b)=> {
  285. let temp1="";
  286. let temp2="";
  287. if(a.fstatus!=null){
  288. temp1=a.fstatus;
  289. }
  290. if(b.fstatus!=null){
  291. temp2=b.fstatus;
  292. }
  293. return temp1.localeCompare(temp2);
  294. },
  295. },
  296. {
  297. title: '交单日期',
  298. width: 120,
  299. dataIndex: 'csubmitDate',
  300. customRender: text => {
  301. if(text!==''&&text){
  302. return moment(text).format('YYYY-MM-DD')
  303. }else{
  304. return ''
  305. }
  306. },
  307. className: 'replacecolor',
  308. sorter: (a, b) => {
  309. return new Date(a.csubmitDate) > new Date(b.csubmitDate) ? 1 : -1;
  310. },
  311. },
  312. {
  313. title: '返单日期',
  314. width: 120,
  315. dataIndex: 'crejectDate',
  316. customRender: text => {
  317. if(text!==''&&text){
  318. return moment(text).format('YYYY-MM-DD')
  319. }else{
  320. return ''
  321. }
  322. },
  323. className: 'replacecolor',
  324. sorter: (a, b) => {
  325. return new Date(a.crejectDate) > new Date(b.crejectDate) ? 1 : -1;
  326. },
  327. },
  328. {
  329. title: '结束日期',
  330. width: 120,
  331. dataIndex: 'cfirstApproveDate',
  332. customRender: text => {
  333. if(text!==''&&text){
  334. return moment(text).format('YYYY-MM-DD')
  335. }else{
  336. return ''
  337. }
  338. },
  339. className: 'replacecolor',
  340. sorter: (a, b) => {
  341. return new Date(a.cfirstApproveDate) > new Date(b.cfirstApproveDate) ? 1 : -1;
  342. },
  343. },
  344. { title: '分配表单据状态', width: 120, dataIndex: 'cstatus', className: 'replacecolor',
  345. sorter:(a,b)=> {
  346. let temp1="";
  347. let temp2="";
  348. if(a.cstatus!=null){
  349. temp1=a.cstatus;
  350. }
  351. if(b.cstatus!=null){
  352. temp2=b.cstatus;
  353. }
  354. return temp1.localeCompare(temp2);
  355. },
  356. },
  357. {
  358. title: '备注',
  359. width: 180,
  360. dataIndex: 'remarks',
  361. className: 'replacecolor',
  362. scopedSlots: { customRender: 'remarks' },
  363. },
  364. {
  365. title: '操作',
  366. width: 180,
  367. dataIndex: 'option',
  368. className: 'replacecolor',
  369. fixed: 'right',
  370. scopedSlots: { customRender: 'option' },
  371. },
  372. ],
  373. costAllocationData: [],
  374. // 查询条件
  375. queryParam: {
  376. // index: '',
  377. // planNum: '',
  378. // customerShortame: '',
  379. pageSize:50,
  380. pageNo: '' // 点击的页数
  381. },
  382. // 分页
  383. pagination: {
  384. pageSizeOptions: ["50","100","150", "500"],
  385. showSizeChanger: true,
  386. pageSize:50
  387. },
  388. dateFormat: 'YYYY-MM-DD',
  389. loading: false // 表格加载
  390. }
  391. },
  392. async created() {
  393. await this.defaultData()
  394. await this.getCostList()
  395. document.title = '计划单统计表'+ ' · ' + '森语'
  396. },
  397. methods: {
  398. // 分页查询
  399. getCostList() {
  400. this.$nextTick(() => {
  401. this.loading = true
  402. checkList(this.queryParam).then(res => {
  403. this.loading = false
  404. if (res.success) {
  405. this.costAllocationData = res.result.records
  406. this.costAllocationData.map(item=>{
  407. item.enter = '0'
  408. item.ffinalApproveDate = item.ffinalApproveDate!==''&&item.ffinalApproveDate ? moment(item.ffinalApproveDate).format('YYYY-MM-DD'):''
  409. })
  410. this.pagination = {
  411. total: res.result.total,
  412. current: res.result.current,
  413. pageSize: res.result.size,
  414. pageSizeOptions: ["50","100","150", "500"],
  415. showSizeChanger: true,
  416. }
  417. }else{
  418. this.$message.error(res.message);
  419. }
  420. })
  421. })
  422. },
  423. defaultData(){
  424. var tYear = new Date().getFullYear()
  425. var startTime = new Date(tYear, 0, 1)
  426. this.dverifyDate=[moment(startTime),moment(new Date())]
  427. this.queryParam.dverifyDateE=this.dverifyDate[1].format('YYYY-MM-DD')
  428. this.queryParam.dverifyDateB=this.dverifyDate[0].format('YYYY-MM-DD')
  429. },
  430. searchQuery() {
  431. this.getCostList()
  432. },
  433. changeCreateTime(){
  434. this.queryParam.dverifyDateE=( this.dverifyDate.length==2)?this.dverifyDate[1].format('YYYY-MM-DD'):''
  435. this.queryParam.dverifyDateB=( this.dverifyDate.length==2)?this.dverifyDate[0].format('YYYY-MM-DD'):''
  436. },
  437. searchReset() {
  438. this.queryParam.pageNo = ''
  439. this.queryParam = {}
  440. this.defaultData()
  441. this.getCostList()
  442. },
  443. changeFfirstApproveDate(){
  444. this.queryParam.ffirstApproveDateE=( this.ffirstApproveDate.length==2)?this.ffirstApproveDate[1].format('YYYY-MM-DD'):''
  445. this.queryParam.ffirstApproveDateB=( this.ffirstApproveDate.length==2)?this.ffirstApproveDate[0].format('YYYY-MM-DD'):''
  446. },
  447. rowClick(record) {
  448. return {
  449. on: {
  450. dblclick: () => {
  451. record.enter ='1'
  452. this.$forceUpdate()
  453. }
  454. }
  455. }
  456. },
  457. cancel(record){
  458. record.enter = '0'
  459. this.getCostList()
  460. this.$forceUpdate()
  461. },
  462. sava(record){
  463. this.loading = true
  464. var obj={
  465. planNum : record.planNo,
  466. planMan:record.planMan,
  467. remarks:record.remarks,
  468. id:record.id
  469. }
  470. var newObj ={
  471. ccode:record.planNo,
  472. final_date: record.ffinalApproveDate!==''&&record.ffinalApproveDate ? moment(record.ffinalApproveDate).format('YYYY-MM-DD HH:mm:ss'):''
  473. }
  474. savaList(obj).then(res => {
  475. this.loading = false
  476. if (res.success) {
  477. this.$message.success('保存成功')
  478. this.getCostList()
  479. }else{
  480. this.$message.error(res.message);
  481. }
  482. })
  483. savaList1(newObj).then(res => {
  484. this.loading = false
  485. if (res.success) {
  486. this.$message.success('保存成功')
  487. this.getCostList()
  488. }else{
  489. this.$message.error(res.message);
  490. }
  491. })
  492. },
  493. //导出
  494. exportList(fileName){
  495. var params = this.queryParam
  496. this.loading = true
  497. downFile('/orderData/syCostLossReview/planExportXls', params).then(data => {
  498. console.log('888')
  499. this.loading = false
  500. if (!data) {
  501. this.$message.warning('文件下载失败')
  502. return
  503. }
  504. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  505. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
  506. } else {
  507. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  508. let link = document.createElement('a')
  509. link.style.display = 'none'
  510. link.href = url
  511. link.setAttribute('download', fileName + '.xlsx')
  512. document.body.appendChild(link)
  513. link.click()
  514. document.body.removeChild(link) // 下载完成移除元素
  515. window.URL.revokeObjectURL(url) // 释放掉blob对象
  516. }
  517. })
  518. },
  519. handleTableChange(pagination, filters, sorter) {
  520. this.queryParam.pageNo = pagination.current
  521. this.queryParam.pageSize = pagination.pageSize
  522. this.getCostList()
  523. },
  524. },
  525. computed: {},
  526. mounted() {}
  527. }
  528. </script>
  529. <style lang="less" scoped>
  530. @import '~@assets/less/common.less';
  531. @import '~@assets/less/overwriter.less';
  532. /deep/ .ant-table-thead > tr > th {
  533. text-align: center;
  534. // font-weight: 700;
  535. }
  536. /deep/ .ant-table-tbody {
  537. text-align: center;
  538. }
  539. // /deep/ th.replacecolor {
  540. // background-color: #ccc;
  541. // }
  542. </style>