index.vue 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292
  1. <template>
  2. <div>
  3. <div v-if="pageDisplay" class="app-container">
  4. <formComponent
  5. v-if="searchWhether"
  6. :formOption="formOption"
  7. :dataList="dataList"
  8. :inDex="inDex"
  9. ref="avatar"
  10. @submitForm="submitForm"
  11. @returnToForm="returnToForm"
  12. />
  13. <listComponent
  14. :tableData="tableData"
  15. @selectionbox="selectionbox"
  16. @see="viewMethod"
  17. @modify="modification"
  18. @deletion="deletion"
  19. @buttonList="buttonList"
  20. @showSearch="showSearch"
  21. @feedback="feedback"
  22. @getList="getList"
  23. :isItHidden="isItHidden"
  24. :customButton="customButton"
  25. :listStyle="listStyle"
  26. :queryList="queryList"
  27. :setRowList="setRowList"
  28. />
  29. <el-pagination
  30. style="float: right;margin-top: 10px"
  31. @size-change="handleSizeChange"
  32. @current-change="handleCurrentChange"
  33. :page-sizes="[10, 20, 30, 50]"
  34. :page-size="this.formDataList.pageSize"
  35. background
  36. layout="sizes, prev, pager, next"
  37. :total="total">
  38. </el-pagination>
  39. </div>
  40. <div v-else class="app-container">
  41. <formComponent
  42. v-if="searchWhether"
  43. :formOption="contentOption"
  44. :dataList="dataList"
  45. :inDex="inDex"
  46. ref="avatar"
  47. @writeOff="writeOff"
  48. @submitForm="submitForm"
  49. @returnToForm="returnToForm"
  50. @submitAndSave="submitAndSave"
  51. @selectTrigger="selectTrigger"
  52. />
  53. <listComponent
  54. ref="listComponent"
  55. :tableData="contentList"
  56. @selectionbox="selectionbox"
  57. @see="viewMethod"
  58. @modify="modification"
  59. @deletion="deletion"
  60. @buttonList="buttonList"
  61. @showSearch="showSearch"
  62. @feedback="feedback"
  63. @getList="getList"
  64. @deletRows="deletRows"
  65. @totalAmount="totalAmount"
  66. :tatolLabel="tatolLabel"
  67. :isItHidden="isItHidden"
  68. :customButton="contentButton"
  69. :listStyle="contentStyle"
  70. :queryList="purchaseList"
  71. :setRowList="setRowList"
  72. :listData="listData"
  73. />
  74. </div>
  75. <add-or-update
  76. v-if="addOrUpdateVisible"
  77. ref="addOrUpdate"
  78. @refreshDataList="getDataList"
  79. ></add-or-update>
  80. <approval-comments
  81. v-if="addOrUpdateVisib"
  82. ref="ApprovalComments"
  83. @refreshDataList="returnData"
  84. ></approval-comments>
  85. <el-dialog
  86. title="打印采购"
  87. :visible.sync="dialogVisible"
  88. :fullscreen="true"
  89. style="padding: 0;margin:0"
  90. width="70%">
  91. <div ref="print">
  92. <table class="table table-striped table-bordered" align="center" valign="center">
  93. <tr>
  94. <td style="font-size: 24px;font-weight:bold" class="column" colspan="6">采购表</td>
  95. </tr>
  96. <tr>
  97. <td class="column" style="width: 10%;">项目</td>
  98. <td class="column" style="width: 25%;">{{formList.projectName}}</td>
  99. <td class="column" style="width: 10%;">供应商</td>
  100. <td class="column" style="width: 25%;">{{ formList.corpName }}</td>
  101. <td class="column" style="width: 25%;" colspan="2">日期:{{formList.fBsdate}}</td>
  102. </tr>
  103. </table>
  104. <table class="table table-striped table-bordered" align="center" valign="center">
  105. <tr>
  106. <td class="column" style="width: 15%;border-top: none;">品名</td>
  107. <td class="column" style="width: 15%;border-top: none;">单价</td>
  108. <td class="column" style="width: 15%;border-top: none;">采购计划(斤)</td>
  109. <td class="column" style="width: 15%;border-top: none;">实际重量(斤)</td>
  110. <td class="column" style="width: 15%;border-top: none;">金额</td>
  111. <td class="column" style="width: 20%;border-top: none;">备注</td>
  112. </tr>
  113. <tr v-for="(item,index) in this.contentList" :key="index">
  114. <td class="column">{{item.feeName}}</td>
  115. <td class="column">{{item.fUnitprice}}</td>
  116. <td class="column">{{item.fPurchase}}</td>
  117. <td class="column">{{item.fQty}}</td>
  118. <td class="column">{{item.fAmount}}</td>
  119. <td class="column">{{item.remark}}</td>
  120. </tr>
  121. </table>
  122. <table class="table table-striped table-bordered" align="center" valign="center">
  123. <tr>
  124. <td colspan="6" style="border-top: none;" class="column"></td>
  125. </tr>
  126. <tr>
  127. <td class="column" style="width: 25%;">采购人签字</td>
  128. <td class="column" style="width: 25%;">厨房主管签字</td>
  129. <td class="column" style="width: 25%;">验收人签字</td>
  130. <td class="column" style="width: 25%;">主管签字</td>
  131. </tr>
  132. <tr>
  133. <td class="column" style="width: 25%;height: 37px;"></td>
  134. <td class="column" style="width: 25%;"></td>
  135. <td class="column" style="width: 25%;"></td>
  136. <td class="column" style="width: 25%;"></td>
  137. </tr>
  138. <tr>
  139. <td colspan="4" style="border-top: none;font-weight:bold;text-align: right;padding-right: 10%;font-size: 16px;" class="column">{{ formList.fsbuName }}</td>
  140. </tr>
  141. </table>
  142. </div>
  143. <span slot="footer" class="dialog-footer">
  144. <el-button @click="dialogVisible = false">取 消</el-button>
  145. <el-button type="primary" @click="Printing">打印</el-button>
  146. </span>
  147. </el-dialog>
  148. </div>
  149. </template>
  150. <script>
  151. import { select } from '@/api/system/set'
  152. import {
  153. listQuery,
  154. submit,
  155. viewSingle,
  156. deleteQuery,
  157. productName,
  158. queryItem,
  159. company,
  160. warehouse,
  161. listDelete,
  162. tableDeleteQuery,
  163. confirmDeletion,
  164. pleaseCheck,
  165. copyNew
  166. } from '@/api/purchaseRequest/index'
  167. import Cookies from 'js-cookie'
  168. export default {
  169. name: 'index',
  170. data() {
  171. return {
  172. addOrUpdateVisible: false,
  173. addOrUpdateVisib: false,
  174. total:0,
  175. selection:[],
  176. formDataList:{
  177. fBilltype: 'SQ',
  178. pageSize:10,
  179. pageNum:1,
  180. },
  181. formList:{},
  182. tatolLabel:['金额'],
  183. dialogVisible: false,
  184. listData: {
  185. fFeeid: [],
  186. fFeeunitid: [],
  187. fStltypeid: []
  188. },
  189. setTimeout:'',
  190. searchWhether: true,
  191. pageDisplay: true,
  192. dataList: {
  193. fGoodsid: [],
  194. fSbu: [],
  195. fWarehouseid: [],
  196. fCorpid: []
  197. },
  198. contentList: [],
  199. inDex: 4,
  200. tableData: [],
  201. tableList: [],
  202. isItHidden: true,
  203. listStyle: [
  204. {
  205. surface: '1',
  206. label: 'serialNumber',
  207. name: '序号',
  208. checked: 0,
  209. width: 100,
  210. onabort: ''
  211. }, {
  212. surface: '2',
  213. label: 'fBillno',
  214. name: '申请编号',
  215. checked: 0,
  216. width: 100,
  217. onabort: ''
  218. }, {
  219. surface: '3',
  220. label: 'projectName',
  221. name: '项目名称',
  222. checked: 0,
  223. width: 100,
  224. onabort: ''
  225. }, {
  226. surface: '4',
  227. label: 'corpName',
  228. name: '客户名称',
  229. checked: 0,
  230. width: 100,
  231. onabort: ''
  232. }, {
  233. surface: '5',
  234. label: 'fMoney',
  235. name: '金额',
  236. checked: 0,
  237. width: 100,
  238. onabort: ''
  239. }, {
  240. surface: '6',
  241. label: 'createTime',
  242. name: '申请日期',
  243. checked: 0,
  244. width: 100,
  245. onabort: ''
  246. },{
  247. surface: '7',
  248. label: 'createBy',
  249. name: '申请人',
  250. checked: 0,
  251. width: 100,
  252. onabort: ''
  253. }, {
  254. surface: '8',
  255. label: 'fReviewDate',
  256. name: '审核日期',
  257. checked: 0,
  258. width: 100,
  259. onabort: ''
  260. },{
  261. surface: '9',
  262. label: 'remark',
  263. name: '备注',
  264. checked: 0,
  265. width: 100,
  266. onabort: ''
  267. },{
  268. surface: '10',
  269. label: 'fBillstatusName',
  270. name: '状态',
  271. checked: 0,
  272. width: 100,
  273. onabort: ''
  274. },{
  275. surface: '11',
  276. label: 'operation',
  277. name: '操作',
  278. checked: 0,
  279. width: 160,
  280. operation: '1',
  281. onabort: ''
  282. }
  283. ],
  284. contentStyle: [
  285. {
  286. surface: '1',
  287. label: 'serialNumber',
  288. name: '序号',
  289. checked: 0,
  290. width: 100,
  291. disabled: false,
  292. onabort: ''
  293. }, {
  294. surface: '2',
  295. label: 'fFeeid',
  296. name: '品名',
  297. checked: 0,
  298. width: 100,
  299. onabort: '',
  300. disabled: false,
  301. changeable: 1
  302. }, {
  303. surface: '3',
  304. label: 'fUnitprice',
  305. name: '单价',
  306. checked: 0,
  307. width: 100,
  308. disabled: false,
  309. onabort: 'this.value=this.value.replace(/[^\\-?\\d.]/g,"").replace(/^(\\-)*(\\d+)\\.(\\d\\d).*$/, "$1$2.$3")',
  310. changeable: 2
  311. }, {
  312. surface: '4',
  313. label: 'fPurchase',
  314. name: '采购数量',
  315. checked: 0,
  316. width: 100,
  317. onabort: '',
  318. disabled: false,
  319. changeable: 2
  320. }, {
  321. surface: '5',
  322. label: 'fQty',
  323. name: '实际数量',
  324. checked: 0,
  325. width: 100,
  326. onabort: 'this.value=this.value.replace(/[^\\-?\\d.]/g,"").replace(/^(\\-)*(\\d+)\\.(\\d\\d).*$/, "$1$2.$3")',
  327. disabled: false,
  328. changeable: 2
  329. }, {
  330. surface: '6',
  331. label: 'fFeeunitid',
  332. name: '计量单位',
  333. checked: 0,
  334. width: 100,
  335. onabort: '',
  336. disabled: false,
  337. changeable: 1
  338. }, {
  339. surface: '7',
  340. label: 'fAmount',
  341. name: '金额',
  342. checked: 0,
  343. width: 100,
  344. onabort: 'this.value=this.value.replace(/[^\\-?\\d.]/g,"").replace(/^(\\-)*(\\d+)\\.(\\d\\d).*$/, "$1$2.$3")',
  345. disabled: false,
  346. changeable: 2
  347. }, {
  348. surface: '8',
  349. label: 'fStltypeid',
  350. name: '付费方式',
  351. checked: 0,
  352. width: 100,
  353. onabort: '',
  354. disabled: false,
  355. changeable: 1
  356. }, {
  357. surface: '9',
  358. label: 'remark',
  359. name: '备注',
  360. checked: 0,
  361. width: 100,
  362. onabort: '',
  363. disabled: false,
  364. changeable: 2
  365. }, {
  366. surface: '10',
  367. label: 'createTime',
  368. name: '申请日期',
  369. checked: 0,
  370. disabled: false,
  371. width: 100,
  372. onabort: ''
  373. }, {
  374. surface: '11',
  375. label: 'createBy',
  376. name: '申请人',
  377. disabled: false,
  378. checked: 0,
  379. width: 100,
  380. onabort: ''
  381. }, {
  382. surface: '12',
  383. label: 'fReviewDate',
  384. name: '审核日期',
  385. checked: 0,
  386. disabled: false,
  387. width: 100,
  388. onabort: ''
  389. }, {
  390. surface: '13',
  391. label: 'operation',
  392. name: '操作',
  393. checked: 0,
  394. disabled: false,
  395. width: 160,
  396. operation: '2',
  397. onabort: ''
  398. }
  399. ],
  400. queryList: {
  401. tableName: '采购申请',
  402. columnList: []
  403. },
  404. purchaseList: {
  405. tableName: '采购申请详情',
  406. columnList: []
  407. },
  408. setRowList: [],
  409. customButton: [
  410. {
  411. type: 'primary',
  412. size: 'mini',
  413. icon: 'el-icon-edit',
  414. name: '新增',
  415. disabled: false
  416. },
  417. // {
  418. // type:'warning',
  419. // size:'mini',
  420. // icon:'el-icon-edit',
  421. // name:'立即修改',
  422. // disabled:false,
  423. // },
  424. {
  425. type: 'warning',
  426. size: 'mini',
  427. icon: 'el-icon-upload2',
  428. name: '导出',
  429. disabled: false
  430. }, {
  431. type: 'success',
  432. size: 'mini',
  433. icon: 'el-icon-c-scale-to-original',
  434. name: '复制新增',
  435. disabled: false
  436. }
  437. ],
  438. contentButton: [
  439. {
  440. type: 'danger',
  441. size: 'mini',
  442. icon: 'el-icon-arrow-left',
  443. name: '返回列表',
  444. disabled: false
  445. }, {
  446. type: 'primary',
  447. size: 'mini',
  448. icon: 'el-icon-plus',
  449. name: '录入',
  450. disabled: false
  451. }, {
  452. type: 'primary',
  453. size: 'mini',
  454. icon: 'el-icon-plus',
  455. name: '保存',
  456. plain: true,
  457. disabled: false
  458. }, {
  459. type: 'success',
  460. size: 'mini',
  461. icon: 'el-icon-edit',
  462. name: '修改',
  463. disabled: false
  464. }, {
  465. type: 'warning',
  466. size: 'mini',
  467. icon: 'el-icon-download',
  468. name: '导出',
  469. disabled: false
  470. },{
  471. type: 'info',
  472. size: 'mini',
  473. icon: 'el-icon-edit-outline',
  474. name: '打印',
  475. disabled: false
  476. },{
  477. type: 'primary',
  478. size: 'mini',
  479. icon: 'el-icon-edit-outline',
  480. name: '请核',
  481. disabled: false
  482. },{
  483. type: 'primary',
  484. size: 'mini',
  485. icon: 'el-icon-edit-outline',
  486. name: '查看审批',
  487. disabled: false
  488. },{
  489. type: 'info',
  490. size: 'mini',
  491. icon: 'el-icon-edit-outline',
  492. name: '生成入库单',
  493. disabled: false
  494. },{
  495. type: 'info',
  496. size: 'mini',
  497. icon: 'el-icon-edit-outline',
  498. name: '生成销售单',
  499. disabled: false
  500. }
  501. ],
  502. formOption: [
  503. {
  504. span: 6,
  505. label: 'fBillno',
  506. name: '申请编号',
  507. inputType: 2,
  508. width: 200,
  509. labelSize: '80',
  510. rules: [{ required: false, message: ' ' }]
  511. }, {
  512. span: 6,
  513. label: 'fGoodsid',
  514. name: '项目名称',
  515. inputType: 1,
  516. width: 200,
  517. labelSize: '80',
  518. rules: [{ required: false, message: ' ' }]
  519. }, {
  520. span: 6,
  521. label: 'fCorpid',
  522. name: '供应商',
  523. inputType: 2,
  524. width: 200,
  525. labelSize: '80',
  526. rules: [{ required: false, message: ' ' }]
  527. }, {
  528. span: 6,
  529. label: 'createBy',
  530. name: '申请人',
  531. inputType: 2,
  532. width: 200,
  533. labelSize: '80',
  534. rules: [{ required: false, message: ' ' }]
  535. }, {
  536. span: 6,
  537. label: 'moneys',
  538. name: '金额',
  539. inputType: 5,
  540. width: 200,
  541. labelSize: '80',
  542. rules: [{ required: false, message: ' ' }]
  543. }, {
  544. span: 6,
  545. label: 'cLoadDate',
  546. name: '申请日期',
  547. inputType: 3,
  548. width: 200,
  549. labelSize: '80',
  550. rules: [{ required: false, message: ' ' }]
  551. }
  552. ],
  553. contentOption: [
  554. {
  555. index:'1',
  556. span: 6,
  557. label: 'fBillno',
  558. name: '系统编号',
  559. inputType: 2,
  560. width: 200,
  561. labelSize: '80',
  562. disabled: true,
  563. rules: [{ required: false, message: ' ' }]
  564. }, {
  565. index:'2',
  566. span: 6,
  567. label: 'fGoodsid',
  568. name: '项目名称',
  569. inputType: 1,
  570. width: 200,
  571. labelSize: '80',
  572. disabled: true,
  573. rules: [{ required: true, message: ' ' }]
  574. }, {
  575. index:'3',
  576. span: 6,
  577. label: 'personNaem',
  578. name: '项目主管',
  579. inputType: 2,
  580. width: 200,
  581. labelSize: '80',
  582. disabled: true,
  583. rules: [{ required: false, message: ' ' }]
  584. }, {
  585. index:'4',
  586. span: 6,
  587. label: 'corpsName',
  588. name: '客户',
  589. inputType: 2,
  590. width: 200,
  591. labelSize: '80',
  592. disabled: true,
  593. rules: [{ required: false, message: ' ' }]
  594. }, {
  595. index:'5',
  596. span: 6,
  597. label: 'fCorpid',
  598. name: '供应商',
  599. inputType: 1,
  600. width: 200,
  601. labelSize: '80',
  602. disabled: true,
  603. rules: [{ required: true, message: ' ' }]
  604. }, {
  605. index:'6',
  606. span: 6,
  607. label: 'fWarehouseid',
  608. name: '仓库',
  609. inputType: 1,
  610. width: 200,
  611. disabled: true,
  612. labelSize: '80',
  613. rules: [{ required: true, message: ' ' }]
  614. }, {
  615. index:'7',
  616. span: 6,
  617. label: 'fBsdate',
  618. name: '提货日期',
  619. inputType: 6,
  620. width: 200,
  621. disabled: true,
  622. labelSize: '80',
  623. rules: [{ required: true, message: ' ' }]
  624. }, {
  625. index:'8',
  626. span: 6,
  627. label: 'createBy',
  628. name: '申请人',
  629. inputType: 2,
  630. width: 200,
  631. disabled: true,
  632. labelSize: '80',
  633. rules: [{ required: false, message: ' ' }]
  634. },
  635. {
  636. index:'9',
  637. span: 6,
  638. label: 'fStudentsWeight',
  639. name: '学生人数',
  640. inputType: 2,
  641. onabort: 'this.value=this.value.replace(/[^0-9]/g,\'\')',
  642. width: 200,
  643. disabled: true,
  644. labelSize: '80',
  645. rules: [{ required: true, message: ' ' }]
  646. }, {
  647. index:'10',
  648. span: 6,
  649. label: 'fTeachersWeight',
  650. name: '教师人数',
  651. onabort: 'this.value=this.value.replace(/[^0-9]/g,\'\')',
  652. inputType: 2,
  653. width: 200,
  654. disabled: true,
  655. labelSize: '80',
  656. rules: [{ required: true, message: ' ' }]
  657. },
  658. {
  659. index:'11',
  660. span: 6,
  661. label: 'fSbu',
  662. name: '开票公司',
  663. inputType: 1,
  664. width: 200,
  665. disabled: true,
  666. labelSize: '80',
  667. rules: [{ required: true, message: ' ' }]
  668. }, {
  669. index:'12',
  670. span: 6,
  671. label: 'remark',
  672. name: '备注',
  673. inputType: 4,
  674. disabled: true,
  675. width: 200,
  676. labelSize: '80',
  677. rules: [{ required: false, message: ' ' }]
  678. }
  679. ]
  680. }
  681. },
  682. activated(){
  683. this.homePage()
  684. },
  685. created() {
  686. let data = {
  687. tableName: this.queryList.tableName,
  688. userId: Cookies.get('userName')
  689. }
  690. this.getRow(data)
  691. this.query(this.formDataList)
  692. productName().then(res => {
  693. console.log(res)
  694. if (res.code === 200) {
  695. for (let item in res.rows) {
  696. this.listData.fFeeid.push({
  697. label: res.rows[item].fName,
  698. value: res.rows[item].fId
  699. })
  700. }
  701. console.log(this.listData)
  702. }
  703. })
  704. this.getDicts('data_unitfees').then(res => {
  705. console.log(res.data)
  706. for (let item in res.data) {
  707. this.listData.fFeeunitid.push({
  708. label: res.data[item].dictLabel,
  709. value: JSON.parse(res.data[item].dictValue)
  710. })
  711. }
  712. })
  713. this.getDicts('f_paymode').then(res => {
  714. console.log(res)
  715. for (let item in res.data) {
  716. this.listData.fStltypeid.push({
  717. label: res.data[item].dictLabel,
  718. value: JSON.parse(res.data[item].dictValue)
  719. })
  720. }
  721. })
  722. queryItem().then(res => {
  723. console.log(res)
  724. for (let item in res.data) {
  725. this.dataList.fGoodsid.push({
  726. label: res.data[item].projectName,
  727. value: res.data[item].fId,
  728. personNaem: res.data[item].personNaem,
  729. corpsName: res.data[item].corpsName,
  730. fCorpid: res.data[item].fCorpid
  731. })
  732. }
  733. })
  734. //查询仓库
  735. warehouse().then(res => {
  736. console.log(res)
  737. for (let item in res.rows) {
  738. this.dataList.fWarehouseid.push({
  739. label: res.rows[item].fName,
  740. value: res.rows[item].fId
  741. })
  742. }
  743. })
  744. this.fCompany(1)
  745. this.fCompany(2)
  746. },
  747. methods: {
  748. homePage(){
  749. let date = this.$route.query
  750. console.log(date)
  751. if (this.$route.query.list){
  752. this.contentButton = this.$options.data().contentButton
  753. this.contentButton.push(JSON.parse(this.$route.query.list))
  754. console.log(this.contentButton)
  755. let scope = {
  756. row:{
  757. fId:JSON.parse(this.$route.query.data).billId
  758. }
  759. }
  760. this.viewMethod(scope)
  761. }
  762. },
  763. // 查看审批流
  764. getDataList() {
  765. this.addOrUpdateVisible = false;
  766. },
  767. returnData() {
  768. this.addOrUpdateVisib = false;
  769. this.open = false;
  770. this.cancelTwo();
  771. },
  772. addOrUpdateHandle() {
  773. this.addOrUpdateVisible = true;
  774. this.$nextTick(() => {
  775. this.$refs.addOrUpdate.init(this.$refs.avatar.form.fId,520);
  776. });
  777. },
  778. addOrUpdateHand() {
  779. this.addOrUpdateVisib = true;
  780. this.$nextTick(() => {
  781. this.$refs.ApprovalComments.init(this.$refs.avatar.form.fId,520);
  782. });
  783. },
  784. //首页审批跳转关闭返回首页
  785. cancelTwo() {
  786. let view = {
  787. fullPath: '/purchaseRequest',
  788. hash: '',
  789. matched: Array(2),
  790. meta: Object,
  791. name: 'PurchaseRequest',
  792. params: Object,
  793. path: '/purchaseRequest',
  794. query: Object,
  795. title: '采购申请'
  796. }
  797. this.$router.push({ path: '/index' })
  798. this.$store
  799. .dispatch('tagsView/delView', view)
  800. .then(({ visitedViews }) => {
  801. if (this.isActive(view)) {
  802. this.toLastView(visitedViews, view)
  803. }
  804. })
  805. Global.$emit('removeCache', 'closeSelectedTag', view)
  806. },
  807. //分页
  808. handleSizeChange(val) {
  809. // console.log(`每页 ${val} 条`);
  810. this.formDataList.pageSize = val
  811. this.query(this.formDataList)
  812. },
  813. handleCurrentChange(val) {
  814. // console.log(`当前页: ${val}`);
  815. this.formDataList.pageNum = val
  816. this.query(this.formDataList)
  817. },
  818. //计算金额
  819. totalAmount(scope) {
  820. console.log(scope)
  821. if (scope.row.fUnitprice && scope.row.fQty) {
  822. scope.row.fAmount = (scope.row.fUnitprice * scope.row.fQty).toFixed(2)
  823. }
  824. },
  825. //查询公司
  826. fCompany(name) {
  827. company(name).then(res => {
  828. console.log(res)
  829. if (name == 1) {
  830. this.dataList.fCorpid = []
  831. for (let item in res.data) {
  832. this.dataList.fCorpid.push({
  833. label: res.data[item].fName,
  834. value: res.data[item].fId
  835. })
  836. }
  837. } else if (name == 2) {
  838. this.dataList.fSbu = []
  839. for (let item in res.data) {
  840. this.dataList.fSbu.push({
  841. label: res.data[item].fName,
  842. value: res.data[item].fId
  843. })
  844. }
  845. }
  846. })
  847. },
  848. //查询主页列数据
  849. query(data) {
  850. listQuery(data).then(res => {
  851. this.tableData = res.rows
  852. this.total = res.total
  853. })
  854. },
  855. //查询列数据
  856. getRow(data,list) {
  857. select(data).then((res) => {
  858. console.log(res)
  859. if (data.tableName === '采购申请详情') {
  860. if (res.data.length != 0) {
  861. this.purchaseList.columnList = res.data.filter((e) => e.checked == 0)
  862. this.purchaseList.columnList = res.data
  863. this.setRowList = res.data
  864. this.purchaseList.columnList = this.purchaseList.columnList.filter((e) => e.checked == 0)
  865. // this.waitFor = true
  866. } else {
  867. // this.waitFor = true
  868. this.purchaseList.columnList = this.contentStyle
  869. this.setRowList = this.contentStyle
  870. }
  871. this.pageDisplay = false
  872. this.isItHidden = false
  873. this.inDex = this.contentOption.length
  874. } else {
  875. if (res.data.length != 0) {
  876. this.queryList.columnList = res.data.filter((e) => e.checked == 0)
  877. this.queryList.columnList = res.data
  878. this.setRowList = res.data
  879. this.queryList.columnList = this.queryList.columnList.filter((e) => e.checked == 0)
  880. // this.waitFor = true
  881. } else {
  882. // this.waitFor = true
  883. this.queryList.columnList = this.listStyle
  884. console.log(this.queryList.columnList.fFeeid)
  885. this.setRowList = this.listStyle
  886. }
  887. this.pageDisplay = true
  888. this.isItHidden = true
  889. this.inDex = 4
  890. }
  891. this.$refs.avatar.form = {}
  892. if (list){
  893. this.$refs.avatar.form = list.warehouseBills
  894. this.contentList = list.tWarehousebillsfees
  895. }
  896. })
  897. },
  898. returnToForm(row) {
  899. console.log(row, 111)
  900. },
  901. //查看
  902. viewMethod(scope) {
  903. console.log(scope)
  904. this.contentOption.forEach(item => item.disabled = true)
  905. this.contentStyle.forEach(item => item.disabled = true)
  906. this.contentButton.forEach(item =>{
  907. if (item.name == '返回列表' || item.name == '修改'){
  908. item.disabled = false
  909. }else {
  910. item.disabled = true
  911. }
  912. })
  913. viewSingle(scope.row.fId).then(res => {
  914. if (res.code === 200) {
  915. let data = {
  916. tableName: this.purchaseList.tableName,
  917. userId: Cookies.get('userName')
  918. }
  919. let list ={
  920. warehouseBills:res.data.warehouseBills,
  921. tWarehousebillsfees:res.data.tWarehousebillsfees
  922. }
  923. this.$refs.avatar.form = {}
  924. this.getRow(data,list)
  925. }
  926. })
  927. },
  928. //修改
  929. modification(scope) {
  930. console.log(scope)
  931. },
  932. //删除
  933. deletion(scope) {
  934. console.log(scope.row.fId)
  935. tableDeleteQuery(scope.row.fId).then(res => {
  936. console.log(res)
  937. this.$confirm(res.msg == 1 ? '主表数据为空' : (res.msg == 2 ? '主表有数据' : '未知状态') + '是否永久删除该条数据?', '提示', {
  938. confirmButtonText: '确定',
  939. cancelButtonText: '取消',
  940. type: 'warning'
  941. }).then(() => {
  942. confirmDeletion(scope.row.fId).then(data => {
  943. this.$message({
  944. type: 'success',
  945. message: '删除成功!'
  946. })
  947. this.query(this.formDataList)
  948. })
  949. }).catch(() => {
  950. this.$message({
  951. type: 'info',
  952. message: '已取消删除'
  953. })
  954. })
  955. })
  956. },
  957. //选择框
  958. selectionbox(selection) {
  959. if (selection.length > 1){
  960. this.customButton.forEach(item =>{
  961. if (item.name === '复制新增'){
  962. item.disabled = true
  963. }else {
  964. item.disabled = false
  965. }
  966. })
  967. }else {
  968. this.customButton.forEach(item => item.disabled = false)
  969. this.selection = selection
  970. }
  971. },
  972. //详情内容保存
  973. submitAndSave(item) {
  974. let formData = new window.FormData()
  975. this.$refs.avatar.form.fMoney = 0
  976. this.contentList.forEach(item => this.$refs.avatar.form.fMoney += Number(item.fAmount))
  977. formData.append('tWarehousebills', JSON.stringify(this.$refs.avatar.form))
  978. formData.append('tWarehousebillsfees', JSON.stringify(this.contentList))
  979. formData.append('fBilltype', 'SQ')
  980. submit(formData).then(res => {
  981. if (res.code == 200) {
  982. this.$message.success('保存成功')
  983. this.$refs.avatar.form = res.data.warehouseBills
  984. this.contentList = res.data.tWarehousebillsCntrs
  985. console.log(this.dataList, this.contentList)
  986. if (item == 1){
  987. this.dialogVisible = true
  988. }else if (item === 2){
  989. let data = {
  990. tableName: this.queryList.tableName,
  991. userId: Cookies.get('userName')
  992. }
  993. this.getRow(data)
  994. this.query(this.formDataList)
  995. }
  996. }
  997. })
  998. },
  999. //表单选中后触发
  1000. selectTrigger(name, list, id) {
  1001. console.log(list, id)
  1002. if (name == 'fGoodsid') {
  1003. for (let item in list) {
  1004. if (list[item].value == id) {
  1005. this.$refs.avatar.form.personNaem = list[item].personNaem
  1006. this.$refs.avatar.form.corpsName = list[item].corpsName
  1007. }
  1008. }
  1009. }
  1010. },
  1011. //确认打印
  1012. Printing(){
  1013. this.$print(this.$refs.print)
  1014. },
  1015. //所以按钮
  1016. buttonList(row) {
  1017. console.log(row)
  1018. let data
  1019. switch (row.name) {
  1020. case '新增':
  1021. this.contentList = []
  1022. data = {
  1023. tableName: this.purchaseList.tableName,
  1024. userId: Cookies.get('userName')
  1025. }
  1026. this.$refs.avatar.form = {}
  1027. this.getRow(data)
  1028. this.contentOption.forEach(item => {
  1029. if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
  1030. item.disabled = true
  1031. } else {
  1032. item.disabled = false
  1033. }
  1034. })
  1035. this.contentButton.forEach(item => item.disabled = false)
  1036. this.contentStyle.forEach(item => item.disabled = false)
  1037. this.$refs.avatar.form.createBy = Cookies.get('userName')
  1038. break
  1039. case '保存':
  1040. this.$refs.avatar.submitForm('submit')
  1041. break
  1042. case '打印':
  1043. if (!this.$refs.avatar.form.fId){
  1044. this.$message.error('未保存,不允许打印');
  1045. }else {
  1046. this.formList = this.$refs.avatar.form
  1047. this.submitAndSave(1)
  1048. }
  1049. break
  1050. case '修改':
  1051. this.contentButton.forEach(item =>{
  1052. if (this.$refs.avatar.form.fBillstatus >= 4){
  1053. if (item.name === '返回列表' || item.name === '修改' || item.name === '生成入库单' || item.name === '生成销售单' || item.name === '查看审批' || item.name === '审批'){
  1054. item.disabled = false
  1055. }else {
  1056. item.disabled = true
  1057. }
  1058. }else {
  1059. item.disabled = false
  1060. this.contentStyle.forEach(item => item.disabled = false)
  1061. this.contentOption.forEach(item => {
  1062. if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
  1063. item.disabled = true
  1064. } else {
  1065. item.disabled = false
  1066. }
  1067. })
  1068. }
  1069. })
  1070. break
  1071. case '录入':
  1072. this.contentList.push({
  1073. fFeeid: '',
  1074. fUnitprice: '',
  1075. fPurchase: '',
  1076. fQty: '',
  1077. fFeeunitid: '',
  1078. fAmount: '',
  1079. fStltypeid: '',
  1080. remark: '',
  1081. createTime: '',
  1082. createBy: Cookies.get('userName'),
  1083. fReviewDate: '',
  1084. operation: '',
  1085. })
  1086. break
  1087. case '查看审批':
  1088. this.addOrUpdateHandle()
  1089. break
  1090. case '审批':
  1091. this.addOrUpdateHand()
  1092. break
  1093. case '返回列表':
  1094. console.log(this.$route.query.data)
  1095. if (!this.$refs.avatar.form.fId && this.contentList !== 0 || this.$refs.avatar.form.fBillstatus > 3 && !this.$route.query.data) {
  1096. data = {
  1097. tableName: this.queryList.tableName,
  1098. userId: Cookies.get('userName')
  1099. }
  1100. this.getRow(data)
  1101. this.query(this.formDataList)
  1102. } else if(this.$route.query.data){
  1103. this.cancelTwo();
  1104. this.$router.push({path:'/index'})
  1105. }else {
  1106. this.$confirm('当前数据未保存是否保存?', '提示', {
  1107. confirmButtonText: '保存',
  1108. cancelButtonText: '取消',
  1109. type: 'warning'
  1110. }).then(() => {
  1111. this.submitAndSave(2)
  1112. }).catch(() => {
  1113. data = {
  1114. tableName: this.queryList.tableName,
  1115. userId: Cookies.get('userName')
  1116. }
  1117. this.getRow(data)
  1118. this.query(this.formDataList)
  1119. })
  1120. }
  1121. break
  1122. case '请核':
  1123. if (this.$refs.avatar.form.fBillstatus < 4){
  1124. this.$refs.avatar.submitForm('check')
  1125. }else {
  1126. this.$message.error('请先保存');
  1127. }
  1128. break
  1129. case '生成入库单':
  1130. let listData = {
  1131. fId:this.$refs.avatar.form.fId,
  1132. fBilltype:'RK'
  1133. }
  1134. copyNew(listData).then(res=>{
  1135. this.$message({
  1136. message: '生成成功',
  1137. type: 'success',
  1138. showClose:true
  1139. });
  1140. })
  1141. break
  1142. case '生成销售单':
  1143. let liste = {
  1144. fId:this.$refs.avatar.form.fId,
  1145. fBilltype:'XS'
  1146. }
  1147. copyNew(liste).then(res=>{
  1148. this.$message({
  1149. message: '生成成功',
  1150. type: 'success',
  1151. showClose:true
  1152. });
  1153. })
  1154. break
  1155. case '复制新增':
  1156. if (this.selection.length > 0){
  1157. let datae = {
  1158. fId:this.selection[0].fId,
  1159. fBilltype:'SQ'
  1160. }
  1161. copyNew(datae).then(res=>{
  1162. this.$message({
  1163. message: '复制新增成功',
  1164. type: 'success',
  1165. showClose:true
  1166. });
  1167. this.query(this.formDataList)
  1168. })
  1169. }else {
  1170. this.$message.warning('未选择列表,请选择后再点击');
  1171. }
  1172. break
  1173. default:
  1174. this.$message.error('该按钮暂无功能')
  1175. }
  1176. },
  1177. //请核
  1178. writeOff(){
  1179. let formData = new window.FormData()
  1180. formData.append('tWarehousebills', JSON.stringify(this.$refs.avatar.form))
  1181. formData.append('tWarehousebillsfees', JSON.stringify(this.contentList))
  1182. formData.append('fBilltype', 'SQ')
  1183. pleaseCheck(formData).then(res => {
  1184. if (res.code == 200) {
  1185. this.$message.success('请核成功')
  1186. this.contentOption.forEach(item => item.disabled = true)
  1187. this.contentStyle.forEach(item => item.disabled = true)
  1188. this.contentButton.forEach(item =>{
  1189. if (item.name == '返回列表' || item.name == '修改'){
  1190. item.disabled = false
  1191. }else {
  1192. item.disabled = true
  1193. }
  1194. })
  1195. // this.$refs.avatar.form = res.data.warehouseBills
  1196. // this.contentList = res.data.tWarehousebillsCntrs
  1197. let data = {
  1198. tableName: this.queryList.tableName,
  1199. userId: Cookies.get('userName')
  1200. }
  1201. this.getRow(data)
  1202. this.query(this.formDataList)
  1203. }
  1204. })
  1205. },
  1206. // 显示搜索条件、点击后会调用此方法
  1207. showSearch() {
  1208. console.log('到我了')
  1209. this.searchWhether = !this.searchWhether
  1210. },
  1211. //搜索、重置、展开
  1212. feedback(res) {
  1213. console.log(res)
  1214. if (res == '展开') {
  1215. if (this.inDex == 4) {
  1216. this.inDex = this.formOption.length
  1217. } else {
  1218. this.inDex = 4
  1219. }
  1220. } else if (res == '搜索') {
  1221. this.$refs.avatar.submitForm()
  1222. } else if (res == '重置') {
  1223. this.$refs.avatar.form = {}
  1224. }
  1225. },
  1226. //表单验证通过执行搜索
  1227. submitForm() {
  1228. console.log('111')
  1229. let list = this.formDataList
  1230. console.log(this.$refs.avatar.form)
  1231. this.formDataList = this.$refs.avatar.form
  1232. this.formDataList.fBilltype = list.fBilltype
  1233. this.formDataList.pageSize = list.pageSize
  1234. this.formDataList.pageNum = list.pageNum
  1235. this.query(this.formDataList)
  1236. },
  1237. //点击刷新会调用此方法
  1238. getList() {
  1239. this.feedback('重置')
  1240. this.submitForm()
  1241. console.log('到我了2')
  1242. },
  1243. //详情表内容移出
  1244. deletRows(index, rows) {
  1245. console.log(index, rows)
  1246. if (rows[index].fId) {
  1247. deleteQuery(this.$refs.avatar.form.fId, this.$refs.avatar.form.fDateChanged).then(res => {
  1248. if (res.code === 200) {
  1249. listDelete(rows[index].fId).then(data => {
  1250. rows.splice(index, 1)
  1251. })
  1252. }
  1253. })
  1254. } else {
  1255. rows.splice(index, 1)
  1256. }
  1257. }
  1258. }
  1259. }
  1260. </script>
  1261. <style scoped>
  1262. .table {
  1263. border-collapse: collapse;
  1264. border-spacing: 0;
  1265. background-color: transparent;
  1266. display: table;
  1267. width: 100%;
  1268. max-width: 100%;
  1269. margin: 0 auto;
  1270. }
  1271. .table td {
  1272. text-align: center;
  1273. vertical-align: middle;
  1274. font-size: 14px;
  1275. color: #333333;
  1276. padding: 8px 12px;
  1277. }
  1278. .column {
  1279. border: 1px solid #000;
  1280. }
  1281. .app-container >>> .el-form-item{
  1282. margin-bottom: 0;
  1283. }
  1284. </style>