index.vue 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733
  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. :tatolLabel="['金额']"
  24. :hasPermi="hasPermi"
  25. :isItHidden="isItHidden"
  26. :customButton="customButton"
  27. :listStyle="listStyle"
  28. :queryList="queryList"
  29. :setRowList="setRowList"
  30. />
  31. <!-- <el-pagination-->
  32. <!-- style="float: right;margin-top: 10px"-->
  33. <!-- @size-change="handleSizeChange"-->
  34. <!-- @current-change="handleCurrentChange"-->
  35. <!-- :page-sizes="[10, 20, 30, 50]"-->
  36. <!-- :page-size="this.formDataList.pageSize"-->
  37. <!-- background-->
  38. <!-- layout="sizes, prev, pager, next"-->
  39. <!-- :total="total">-->
  40. <!-- </el-pagination>-->
  41. <div style="float: right;margin-bottom: 10px">
  42. <pagination
  43. v-show="total > 0"
  44. :total="total"
  45. :page.sync="formDataList.pageNum"
  46. :limit.sync="formDataList.pageSize"
  47. :page-sizes="[10,100,200,500,1000]"
  48. @pagination="feedback('搜索')"
  49. />
  50. </div>
  51. </div>
  52. <div v-else class="app-container">
  53. <div style="display: flex;margin-bottom: 10px">
  54. <el-breadcrumb>
  55. <el-breadcrumb-item>
  56. <el-button
  57. size="mini"
  58. type="danger" plain
  59. @click="backToList"
  60. icon="el-icon-arrow-left">
  61. 返回列表</el-button>
  62. </el-breadcrumb-item>
  63. <!-- <el-breadcrumb-item style="font-weight: 700">-->
  64. <!-- <el-button-group>-->
  65. <!-- <el-button type="primary" size="mini" icon="el-icon-arrow-left" :disabled="forward" @click="sequence(true)">向前</el-button>-->
  66. <!-- <el-button type="primary" size="mini" :disabled="backward" @click="sequence(true)">向后<i class="el-icon-arrow-right el-icon&#45;&#45;right"></i></el-button>-->
  67. <!-- </el-button-group>-->
  68. <!-- </el-breadcrumb-item>-->
  69. </el-breadcrumb>
  70. </div>
  71. <h1 style="text-align: center;margin-top: -42px">采购申请单</h1>
  72. <formComponent
  73. v-if="searchWhether"
  74. :formOption="contentOption"
  75. :dataList="dataList"
  76. :inDex="inDex"
  77. ref="avatar"
  78. @writeOff="writeOff"
  79. @submitForm="submitForm"
  80. @returnToForm="returnToForm"
  81. @submitAndSave="submitAndSave"
  82. @selectTrigger="selectTrigger"
  83. />
  84. <listComponent
  85. ref="listComponent"
  86. :tableData="contentList"
  87. @selectionbox="selectionbox"
  88. @see="viewMethod"
  89. @modify="modification"
  90. @deletion="deletion"
  91. @buttonList="buttonList"
  92. @showSearch="showSearch"
  93. @feedback="feedback"
  94. @getList="getList"
  95. @deletRows="deletRows"
  96. @totalAmount="totalAmount"
  97. @change="change"
  98. :hasPermi="hasPermi"
  99. :tatolLabel="tatolLabel"
  100. :isItHidden="isItHidden"
  101. :customButton="contentButton"
  102. :listStyle="contentStyle"
  103. :queryList="purchaseList"
  104. :setRowList="setRowList"
  105. :listData="listData"
  106. />
  107. </div>
  108. <add-or-update
  109. v-if="addOrUpdateVisible"
  110. ref="addOrUpdate"
  111. @refreshDataList="getDataList"
  112. ></add-or-update>
  113. <approval-comments
  114. v-if="addOrUpdateVisib"
  115. ref="ApprovalComments"
  116. @refreshDataList="returnData"
  117. ></approval-comments>
  118. <el-dialog
  119. title="打印采购"
  120. :visible.sync="dialogVisible"
  121. :fullscreen="true"
  122. style="padding: 0;margin:0"
  123. width="70%">
  124. <div ref="print">
  125. <table class="table table-striped table-bordered" align="center" valign="center">
  126. <tr>
  127. <td style="font-size: 24px;font-weight:bold" class="column" colspan="6">采购表</td>
  128. </tr>
  129. <tr>
  130. <td class="column" style="width: 10%;">项目</td>
  131. <td class="column" style="width: 25%;">{{formList.projectName}}</td>
  132. <td class="column" style="width: 10%;">供应商</td>
  133. <td class="column" style="width: 25%;">{{ formList.corpName }}</td>
  134. <td class="column" style="width: 25%;" colspan="2">日期:{{formList.fBsdate}}</td>
  135. </tr>
  136. </table>
  137. <table class="table table-striped table-bordered" align="center" valign="center">
  138. <tr>
  139. <td class="column" style="width: 15%;border-top: none;">品名</td>
  140. <td class="column" style="width: 15%;border-top: none;">单价</td>
  141. <td class="column" style="width: 15%;border-top: none;">采购计划</td>
  142. <td class="column" style="width: 15%;border-top: none;">实际重量</td>
  143. <td class="column" style="width: 15%;border-top: none;">金额</td>
  144. <td class="column" style="width: 20%;border-top: none;">备注</td>
  145. </tr>
  146. <tr v-for="(item,index) in contentList" :key="index">
  147. <td class="column">{{item.feeName}}</td>
  148. <td class="column">{{item.fUnitprice?Number(item.fUnitprice).toFixed(2):item.fUnitprice}}</td>
  149. <td class="column">{{item.fPurchase}}({{item.fFeeunitName}})</td>
  150. <td class="column">{{item.fQty}}({{item.fFeeunitName}})</td>
  151. <td class="column">{{item.fAmount?Number(item.fAmount).toFixed(2):item.fAmount}}</td>
  152. <td class="column">{{item.remark}}</td>
  153. </tr>
  154. </table>
  155. <table class="table table-striped table-bordered" align="center" valign="center">
  156. <tr>
  157. <td colspan="6" style="border-top: none;" class="column"></td>
  158. </tr>
  159. <tr>
  160. <td class="column" style="width: 25%;">采购人签字</td>
  161. <td class="column" style="width: 25%;">厨房主管签字</td>
  162. <td class="column" style="width: 25%;">验收人签字</td>
  163. <td class="column" style="width: 25%;">主管签字</td>
  164. </tr>
  165. <tr>
  166. <td class="column" style="width: 25%;height: 37px;"></td>
  167. <td class="column" style="width: 25%;"></td>
  168. <td class="column" style="width: 25%;"></td>
  169. <td class="column" style="width: 25%;"></td>
  170. </tr>
  171. <tr>
  172. <td colspan="4" style="border-top: none;font-weight:bold;text-align: right;padding-right: 10%;font-size: 16px;" class="column">{{ formList.fsbuName }}</td>
  173. </tr>
  174. </table>
  175. </div>
  176. <span slot="footer" class="dialog-footer">
  177. <el-button @click="dialogVisible = false">取 消</el-button>
  178. <el-button type="primary" @click="Printing">打印</el-button>
  179. </span>
  180. </el-dialog>
  181. </div>
  182. </template>
  183. <script>
  184. import { select } from '@/api/system/set'
  185. import {
  186. listQuery,
  187. submit,
  188. viewSingle,
  189. deleteQuery,
  190. productName,
  191. queryItem,
  192. company,
  193. warehouse,
  194. listDelete,
  195. tableDeleteQuery,
  196. confirmDeletion,
  197. pleaseCheck,
  198. copyNew,
  199. revoke,
  200. withdrawBy,
  201. getName,
  202. queryUserVal
  203. } from '@/api/purchaseRequest/index'
  204. import Cookies from 'js-cookie'
  205. import Global from '@/layout/components/global'
  206. import moment from 'moment'
  207. export default {
  208. name: 'index',
  209. data() {
  210. return {
  211. before:'',
  212. lander:'',
  213. operator:'',
  214. forward:false,
  215. backward:false,
  216. addOrUpdateVisible: false,
  217. addOrUpdateVisib: false,
  218. total:0,
  219. selection:[],
  220. formDataList:{
  221. fBilltype: 'SQ',
  222. pageSize:10,
  223. pageNum:1,
  224. },
  225. formList:{},
  226. tatolLabel:['金额'],
  227. dialogVisible: false,
  228. listData: {
  229. fFeeid: [],
  230. fFeeunitid: [],
  231. fStltypeid: []
  232. },
  233. hasPermi:{
  234. lookup:['anpin:stockControl:query'],
  235. disappear:['anpin:stockControl:remove']
  236. },
  237. setTimeout:'',
  238. searchWhether: true,
  239. pageDisplay: true,
  240. dataList: {
  241. fGoodsid: [],
  242. fSbu: [],
  243. fWarehouseid: [],
  244. fCorpid: [],
  245. fFeeid:[]
  246. },
  247. contentList: [],
  248. inDex: 4,
  249. tableData: [],
  250. tableList: [],
  251. isItHidden: true,
  252. listStyle: [
  253. {
  254. surface: '1',
  255. label: 'serialNumber',
  256. name: '序号',
  257. checked: 0,
  258. width: 100,
  259. onabort: ''
  260. }, {
  261. surface: '2',
  262. label: 'fBillno',
  263. name: '系统编号',
  264. checked: 0,
  265. width: 100,
  266. onabort: ''
  267. }, {
  268. surface: '3',
  269. label: 'projectName',
  270. name: '项目名称',
  271. checked: 0,
  272. width: 100,
  273. onabort: ''
  274. }, {
  275. surface: '4',
  276. label: 'corpName',
  277. name: '供应商',
  278. checked: 0,
  279. width: 100,
  280. onabort: ''
  281. }, {
  282. surface: '5',
  283. label: 'fMoney',
  284. name: '金额',
  285. checked: 0,
  286. width: 100,
  287. onabort: ''
  288. }, {
  289. surface: '5',
  290. label: 'fBsdate',
  291. name: '提货日期',
  292. checked: 0,
  293. width: 100,
  294. onabort: ''
  295. },{
  296. surface: '5',
  297. label: 'fsbuName',
  298. name: '开票公司',
  299. checked: 0,
  300. width: 100,
  301. onabort: ''
  302. },
  303. {
  304. surface: '6',
  305. label: 'createTime',
  306. name: '制单日期',
  307. checked: 0,
  308. width: 100,
  309. onabort: ''
  310. },{
  311. surface: '7',
  312. label: 'createBy',
  313. name: '申请人',
  314. checked: 0,
  315. width: 100,
  316. onabort: ''
  317. }, {
  318. surface: '8',
  319. label: 'fReviewDate',
  320. name: '审核日期',
  321. checked: 0,
  322. width: 100,
  323. onabort: ''
  324. },{
  325. surface: '9',
  326. label: 'remark',
  327. name: '备注',
  328. checked: 0,
  329. width: 100,
  330. onabort: ''
  331. },{
  332. surface: '10',
  333. label: 'fBillstatusName',
  334. name: '状态',
  335. checked: 0,
  336. width: 100,
  337. onabort: ''
  338. },{
  339. surface: '11',
  340. label: 'fCreateLog',
  341. name: '生成日志',
  342. checked: 0,
  343. width: 160,
  344. operation: '1',
  345. onabort: ''
  346. },
  347. {
  348. surface: '12',
  349. label: 'operation',
  350. name: '操作',
  351. checked: 0,
  352. width: 160,
  353. fixed:'right',
  354. operation: '1',
  355. onabort: ''
  356. }
  357. ],
  358. contentStyle: [
  359. {
  360. surface: '1',
  361. label: 'serialNumber',
  362. name: '序号',
  363. checked: 0,
  364. width: 100,
  365. disabled: false,
  366. onabort: ''
  367. }, {
  368. surface: '2',
  369. label: 'fFeeid',
  370. name: '品名',
  371. checked: 0,
  372. width: 100,
  373. onabort: '',
  374. disabled: false,
  375. changeable: 1
  376. }, {
  377. surface: '3',
  378. label: 'fCurrencyName',
  379. name: '规格',
  380. checked: 0,
  381. width: 100,
  382. onabort: '',
  383. disabled: false,
  384. },{
  385. surface: '4',
  386. label: 'fUnitprice',
  387. name: '单价',
  388. checked: 0,
  389. width: 100,
  390. disabled: false,
  391. onabort: 'this.value=this.value.replace(/[^\\-?\\d.]/g,"").replace(/^(\\-)*(\\d+)\\.(\\d\\d).*$/, "$1$2.$3")',
  392. changeable: 2
  393. }, {
  394. surface: '5',
  395. label: 'fPurchase',
  396. name: '采购数量',
  397. checked: 0,
  398. width: 100,
  399. onabort: '',
  400. disabled: false,
  401. changeable: 2
  402. }, {
  403. surface: '6',
  404. label: 'fQty',
  405. name: '实际数量',
  406. checked: 0,
  407. width: 100,
  408. onabort: 'this.value=this.value.replace(/[^\\-?\\d.]/g,"").replace(/^(\\-)*(\\d+)\\.(\\d\\d).*$/, "$1$2.$3")',
  409. disabled: false,
  410. changeable: 2
  411. }, {
  412. surface: '7',
  413. label: 'fFeeunitid',
  414. name: '计量单位',
  415. checked: 0,
  416. width: 100,
  417. onabort: '',
  418. disabled: false,
  419. changeable: 1
  420. }, {
  421. surface: '8',
  422. label: 'fAmount',
  423. name: '金额',
  424. checked: 0,
  425. width: 100,
  426. onabort: 'this.value=this.value.replace(/[^\\-?\\d.]/g,"").replace(/^(\\-)*(\\d+)\\.(\\d\\d).*$/, "$1$2.$3")',
  427. disabled: false,
  428. changeable: 2
  429. }, {
  430. surface: '9',
  431. label: 'fStltypeid',
  432. name: '付费方式',
  433. checked: 0,
  434. width: 100,
  435. onabort: '',
  436. disabled: false,
  437. changeable: 1
  438. }, {
  439. surface: '10',
  440. label: 'remark',
  441. name: '备注',
  442. checked: 0,
  443. width: 100,
  444. onabort: '',
  445. disabled: false,
  446. changeable: 2
  447. }, {
  448. surface: '11',
  449. label: 'createTime',
  450. name: '制单日期',
  451. checked: 0,
  452. disabled: false,
  453. width: 100,
  454. onabort: ''
  455. }, {
  456. surface: '12',
  457. label: 'createBy',
  458. name: '申请人',
  459. disabled: false,
  460. checked: 0,
  461. width: 100,
  462. onabort: ''
  463. }, {
  464. surface: '13',
  465. label: 'fReviewDate',
  466. name: '审核日期',
  467. checked: 0,
  468. disabled: false,
  469. width: 100,
  470. onabort: ''
  471. }, {
  472. surface: '14',
  473. label: 'operation',
  474. name: '操作',
  475. checked: 0,
  476. disabled: false,
  477. width: 160,
  478. fixed:'right',
  479. operation: '2',
  480. onabort: ''
  481. }
  482. ],
  483. queryList: {
  484. tableName: '采购申请',
  485. columnList: []
  486. },
  487. purchaseList: {
  488. tableName: '采购申请详情',
  489. columnList: []
  490. },
  491. setRowList: [],
  492. customButton: [
  493. {
  494. type: 'primary',
  495. size: 'mini',
  496. icon: 'el-icon-edit',
  497. name: '新单',
  498. disabled: false,
  499. hasPermi:['anpin:stockControl:anPingApply']
  500. },
  501. // {
  502. // type:'warning',
  503. // size:'mini',
  504. // icon:'el-icon-edit',
  505. // name:'立即修改',
  506. // disabled:false,
  507. // },
  508. {
  509. type: 'warning',
  510. size: 'mini',
  511. icon: 'el-icon-upload2',
  512. name: '导出',
  513. disabled: false,
  514. hasPermi:['anpin:stockControl:export']
  515. }, {
  516. type: 'success',
  517. size: 'mini',
  518. icon: 'el-icon-c-scale-to-original',
  519. name: '复制新单',
  520. disabled: false,
  521. hasPermi:['anpin:stockControl:generateReceipts']
  522. }
  523. ],
  524. contentButton: [{
  525. type: 'primary',
  526. size: 'mini',
  527. icon: 'el-icon-plus',
  528. name: '录入明细',
  529. disabled: false
  530. }, {
  531. type: 'primary',
  532. size: 'mini',
  533. icon: 'el-icon-check',
  534. name: '保存',
  535. plain: true,
  536. disabled: false
  537. }, {
  538. type: 'primary',
  539. size: 'mini',
  540. icon: 'el-icon-edit-outline',
  541. name: '请核',
  542. disabled: false
  543. }, {
  544. type: 'primary',
  545. size: 'mini',
  546. icon: 'el-icon-plus',
  547. name: '新单',
  548. nameTwo:'详情页',
  549. plain: true,
  550. disabled: false
  551. },{
  552. type: 'primary',
  553. size: 'mini',
  554. icon: 'el-icon-plus',
  555. name: '复制新单',
  556. nameTwo:'详情页',
  557. plain: true,
  558. disabled: false
  559. },{
  560. type: 'success',
  561. size: 'mini',
  562. icon: 'el-icon-edit',
  563. name: '修改',
  564. disabled: false
  565. }, {
  566. type: 'warning',
  567. size: 'mini',
  568. icon: 'el-icon-download',
  569. name: '导出',
  570. disabled: false
  571. },{
  572. type: 'info',
  573. size: 'mini',
  574. icon: 'el-icon-edit-outline',
  575. name: '打印',
  576. disabled: false
  577. },{
  578. type: 'primary',
  579. size: 'mini',
  580. icon: 'el-icon-edit-outline',
  581. name: '查看审批',
  582. disabled: false
  583. },{
  584. type: 'info',
  585. size: 'mini',
  586. icon: 'el-icon-edit-outline',
  587. name: '生成入库单',
  588. disabled: false
  589. },{
  590. type: 'info',
  591. size: 'mini',
  592. icon: 'el-icon-edit-outline',
  593. name: '生成销售单',
  594. disabled: false
  595. }
  596. // ,{
  597. // type: 'info',
  598. // size: 'mini',
  599. // icon: 'el-icon-edit-outline',
  600. // name: '生成出库单',
  601. // disabled: false
  602. // }
  603. ],
  604. formOption: [
  605. {
  606. span: 6,
  607. label: 'fBillno',
  608. name: '系统编号',
  609. inputType: 2,
  610. width: 200,
  611. labelSize: '80',
  612. rules: [{ required: false, message: ' ' }]
  613. }, {
  614. span: 6,
  615. label: 'fGoodsid',
  616. name: '项目名称',
  617. inputType: 1,
  618. width: 200,
  619. labelSize: '80',
  620. rules: [{ required: false, message: ' ' }]
  621. }, {
  622. span: 6,
  623. label: 'fCorpid',
  624. name: '供应商',
  625. inputType: 1,
  626. width: 200,
  627. labelSize: '80',
  628. rules: [{ required: false, message: ' ' }]
  629. },{
  630. span: 6,
  631. label: 'timeInterval',
  632. name: '提货日期',
  633. inputType: 3,
  634. width: 300,
  635. labelSize: '80',
  636. rules: [{ required: false, message: ' ' }]
  637. },{
  638. span: 6,
  639. label: 'createBy',
  640. name: '申请人',
  641. inputType: 2,
  642. width: 200,
  643. labelSize: '80',
  644. rules: [{ required: false, message: ' ' }]
  645. }, {
  646. span: 6,
  647. label: 'moneys',
  648. name: '金额',
  649. inputType: 5,
  650. width: 200,
  651. labelSize: '80',
  652. rules: [{ required: false, message: ' ' }]
  653. },{
  654. span: 6,
  655. label: 'fFeeid',
  656. name: '品名',
  657. inputType: 1,
  658. width: 200,
  659. labelSize: '80',
  660. rules: [{ required: false, message: ' ' }]
  661. }
  662. ],
  663. contentOption: [
  664. {
  665. index:'1',
  666. span: 6,
  667. label: 'fBillno',
  668. name: '系统编号',
  669. inputType: 2,
  670. width: 200,
  671. labelSize: '80',
  672. disabled: true,
  673. rules: [{ required: false, message: ' ' }]
  674. }, {
  675. index:'2',
  676. span: 6,
  677. label: 'fGoodsid',
  678. name: '项目名称',
  679. inputType: 1,
  680. width: 200,
  681. labelSize: '80',
  682. disabled: true,
  683. rules: [{ required: true, message: ' ' }]
  684. }, {
  685. index:'3',
  686. span: 6,
  687. label: 'personNaem',
  688. name: '项目主管',
  689. inputType: 2,
  690. width: 200,
  691. labelSize: '80',
  692. disabled: true,
  693. rules: [{ required: false, message: ' ' }]
  694. }, {
  695. index:'4',
  696. span: 6,
  697. label: 'corpsName',
  698. name: '客户',
  699. inputType: 2,
  700. width: 200,
  701. labelSize: '80',
  702. disabled: true,
  703. rules: [{ required: false, message: ' ' }]
  704. }, {
  705. index:'5',
  706. span: 6,
  707. label: 'fCorpid',
  708. name: '供应商',
  709. inputType: 1,
  710. width: 200,
  711. labelSize: '80',
  712. disabled: true,
  713. rules: [{ required: true, message: ' ' }]
  714. }, {
  715. index:'6',
  716. span: 6,
  717. label: 'fWarehouseid',
  718. name: '仓库',
  719. inputType: 1,
  720. width: 200,
  721. disabled: true,
  722. labelSize: '80',
  723. rules: [{ required: true, message: ' ' }]
  724. }, {
  725. index:'7',
  726. span: 6,
  727. label: 'fBsdate',
  728. name: '提货日期',
  729. inputType: 6,
  730. width: 200,
  731. disabled: true,
  732. labelSize: '80',
  733. rules: [{ required: true, message: ' ' }]
  734. }, {
  735. index:'8',
  736. span: 6,
  737. label: 'createBy',
  738. name: '申请人',
  739. inputType: 2,
  740. width: 200,
  741. disabled: true,
  742. labelSize: '80',
  743. rules: [{ required: false, message: ' ' }]
  744. },
  745. {
  746. index:'9',
  747. span: 6,
  748. label: 'fStudentsWeight',
  749. name: '学生人数',
  750. inputType: 2,
  751. onabort: 'this.value=this.value.replace(/[^0-9]/g,\'\')',
  752. width: 200,
  753. disabled: true,
  754. labelSize: '80',
  755. rules: [{ required: true, message: ' ' }]
  756. }, {
  757. index:'10',
  758. span: 6,
  759. label: 'fTeachersWeight',
  760. name: '教师人数',
  761. onabort: 'this.value=this.value.replace(/[^0-9]/g,\'\')',
  762. inputType: 2,
  763. width: 200,
  764. disabled: true,
  765. labelSize: '80',
  766. rules: [{ required: true, message: ' ' }]
  767. },
  768. {
  769. index:'11',
  770. span: 6,
  771. label: 'fSbu',
  772. name: '开票公司',
  773. inputType: 1,
  774. width: 200,
  775. disabled: true,
  776. labelSize: '80',
  777. rules: [{ required: true, message: ' ' }]
  778. }, {
  779. index:'12',
  780. span: 6,
  781. label: 'remark',
  782. name: '备注',
  783. inputType: 4,
  784. disabled: true,
  785. width: 200,
  786. labelSize: '80',
  787. rules: [{ required: false, message: ' ' }]
  788. }
  789. ],
  790. pendingPage:'',
  791. }
  792. },
  793. activated(){
  794. if(this.$route.query.list){
  795. this.pendingPage = JSON.parse(this.$route.query.list)
  796. this.homePage()
  797. }
  798. },
  799. created() {
  800. //获取登陆人
  801. queryUserVal().then((response) => {
  802. this.lander = response.user.userName
  803. })
  804. let data = {
  805. tableName: this.queryList.tableName,
  806. userId: Cookies.get('userName')
  807. }
  808. let y = moment(Date.parse(new Date())).format('YYYY-MM-DD')
  809. this.$set(this.formDataList,'timeInterval',[ y + ' 00:00:00', y + ' 23:59:59'])
  810. this.getRow(data)
  811. this.query(this.formDataList)
  812. productName().then(res => {
  813. console.log(res)
  814. if (res.code === 200) {
  815. for (let item in res.rows) {
  816. this.dataList.fFeeid.push({
  817. label: res.rows[item].fName,
  818. value: res.rows[item].fId,
  819. })
  820. this.listData.fFeeid.push({
  821. label: res.rows[item].fName,
  822. value: res.rows[item].fId,
  823. fFeeunitid: res.rows[item].fFeeunitid,
  824. fCurrency: res.rows[item].fCurrency
  825. })
  826. }
  827. }
  828. })
  829. this.getDicts('data_unitfees').then(res => {
  830. console.log(res.data)
  831. for (let item in res.data) {
  832. this.listData.fFeeunitid.push({
  833. label: res.data[item].dictLabel,
  834. value: JSON.parse(res.data[item].dictValue)
  835. })
  836. }
  837. })
  838. this.getDicts('f_paymode').then(res => {
  839. console.log(res)
  840. for (let item in res.data) {
  841. this.listData.fStltypeid.push({
  842. label: res.data[item].dictLabel,
  843. value: JSON.parse(res.data[item].dictValue)
  844. })
  845. }
  846. })
  847. queryItem().then(res => {
  848. console.log(res)
  849. for (let item in res.data) {
  850. this.dataList.fGoodsid.push({
  851. label: res.data[item].projectName,
  852. value: res.data[item].fId,
  853. personNaem: res.data[item].personNaem,
  854. corpsName: res.data[item].corpsName,
  855. fCorpid: res.data[item].fCorpid
  856. })
  857. }
  858. })
  859. //查询仓库
  860. warehouse().then(res => {
  861. console.log(res)
  862. for (let item in res.rows) {
  863. this.dataList.fWarehouseid.push({
  864. label: res.rows[item].fName,
  865. value: res.rows[item].fId
  866. })
  867. }
  868. })
  869. this.fCompany(1)
  870. this.fCompany(2)
  871. },
  872. methods: {
  873. change(scope){
  874. console.log(this.contentList)
  875. for(let item in this.contentList){
  876. for(let li in this.listData.fFeeid){
  877. if(this.contentList[item].fFeeid == this.listData.fFeeid[li].value){
  878. // console.log("111")
  879. this.$set(this.contentList[item],'fFeeunitid',this.listData.fFeeid[li].fFeeunitid)
  880. this.$set(this.contentList[item],'fCurrencyName',this.listData.fFeeid[li].fCurrency)
  881. }
  882. }
  883. }
  884. },
  885. homePage(){
  886. let date = this.$route.query
  887. console.log(date)
  888. if (this.$route.query.list){
  889. // this.contentButton = this.$options.data().contentButton
  890. // this.contentButton.push(JSON.parse(this.$route.query.list))
  891. console.log(this.contentButton)
  892. let scope = {
  893. row:{
  894. fId:JSON.parse(this.$route.query.data).billId
  895. }
  896. }
  897. this.viewMethod(scope)
  898. }else{
  899. // console.log("111")
  900. this.pageDisplay = true
  901. }
  902. },
  903. // 查看审批流
  904. getDataList() {
  905. this.addOrUpdateVisible = false;
  906. },
  907. returnData() {
  908. this.addOrUpdateVisib = false;
  909. this.open = false;
  910. this.cancelTwo();
  911. },
  912. sequence(res){
  913. // let i = 0
  914. // for ( i ; i <= this.tableData.length;i++){
  915. // if (this.$refs.avatar.form.fId == this.tableData[i].fId) {
  916. // console.log(i)
  917. // if (i >= 0) this.forward = true
  918. // if (this.tableData.length != Number(i+1)) this.backward = false
  919. // if (i !== 0){
  920. // console.log(this.tableData[--i].fId)
  921. // }
  922. // return
  923. // }
  924. // }
  925. // if (res === true){
  926. //
  927. // }
  928. },
  929. addOrUpdateHandle() {
  930. this.addOrUpdateVisible = true;
  931. this.$nextTick(() => {
  932. this.$refs.addOrUpdate.init(this.$refs.avatar.form.fId,520);
  933. });
  934. },
  935. addOrUpdateHand() {
  936. this.addOrUpdateVisib = true;
  937. this.$nextTick(() => {
  938. this.$refs.ApprovalComments.init(this.$refs.avatar.form.fId,520);
  939. });
  940. },
  941. //首页审批跳转关闭返回首页
  942. cancelTwo() {
  943. let view = {}
  944. if(this.pendingPage.pendingPage){
  945. view = {
  946. fullPath: "/morePage/stock?open=true",
  947. hash: "",
  948. matched: Array(2),
  949. meta: Object,
  950. name: "MorePage/stock",
  951. params: Object,
  952. path: "/morePage/stock",
  953. query: Object,
  954. title: "待审数据"
  955. }
  956. this.$router.push({ path: '/morePage/stock' })
  957. }else{
  958. view = {
  959. fullPath: '/purchaseRequest',
  960. hash: '',
  961. matched: Array(2),
  962. meta: Object,
  963. name: 'PurchaseRequest',
  964. params: Object,
  965. path: '/purchaseRequest',
  966. query: Object,
  967. title: '采购申请'
  968. }
  969. this.$router.push({ path: '/index' })
  970. }
  971. this.$store
  972. .dispatch('tagsView/delView', view)
  973. .then(({ visitedViews }) => {
  974. if (this.isActive(view)) {
  975. this.toLastView(visitedViews, view)
  976. }
  977. })
  978. Global.$emit('removeCache', 'closeSelectedTag', view)
  979. },
  980. //分页
  981. handleSizeChange(val) {
  982. // console.log(`每页 ${val} 条`);
  983. this.formDataList.pageSize = val
  984. this.query(this.formDataList)
  985. },
  986. handleCurrentChange(val) {
  987. // console.log(`当前页: ${val}`);
  988. this.formDataList.pageNum = val
  989. this.query(this.formDataList)
  990. },
  991. //计算金额
  992. totalAmount(scope,item) {
  993. if (item.label === 'fAmount'){
  994. if (scope.row.fAmount && scope.row.fQty) {
  995. this.$set(scope.row,'fUnitprice',(scope.row.fAmount / scope.row.fQty).toFixed(2))
  996. }
  997. }
  998. if (item.label === 'fUnitprice'||item.label === 'fQty'){
  999. if (scope.row.fUnitprice && scope.row.fQty) {
  1000. this.$set(scope.row,'fAmount',(scope.row.fUnitprice * scope.row.fQty).toFixed(2))
  1001. }
  1002. }
  1003. },
  1004. //查询公司
  1005. fCompany(name) {
  1006. company(name).then(res => {
  1007. console.log(res)
  1008. if (name == 1) {
  1009. this.dataList.fCorpid = []
  1010. for (let item in res.data) {
  1011. this.dataList.fCorpid.push({
  1012. label: res.data[item].fName,
  1013. value: res.data[item].fId
  1014. })
  1015. }
  1016. } else if (name == 2) {
  1017. this.dataList.fSbu = []
  1018. for (let item in res.data) {
  1019. this.dataList.fSbu.push({
  1020. label: res.data[item].fName,
  1021. value: res.data[item].fId
  1022. })
  1023. }
  1024. }
  1025. })
  1026. },
  1027. //查询主页列数据
  1028. query(data) {
  1029. console.log(data)
  1030. listQuery(data).then(res => {
  1031. this.tableData = res.rows
  1032. this.total = res.total
  1033. })
  1034. },
  1035. //查询列数据
  1036. getRow(data,list,add,i) {
  1037. console.log(data,list,add)
  1038. select(data).then((res) => {
  1039. this.$refs.avatar.form = {}
  1040. if (data.tableName === '采购申请详情') {
  1041. if (res.data.length != 0) {
  1042. this.purchaseList.columnList = res.data.filter((e) => e.checked == 0)
  1043. this.purchaseList.columnList = res.data
  1044. this.setRowList = res.data
  1045. this.purchaseList.columnList = this.purchaseList.columnList.filter((e) => e.checked == 0)
  1046. // this.waitFor = true
  1047. } else {
  1048. this.$set(this.purchaseList,'columnList',this.$options.data().contentStyle)
  1049. this.setRowList = this.$options.data().contentStyle
  1050. }
  1051. if(add){
  1052. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1053. }else{
  1054. this.purchaseList.columnList.forEach(item => item.disabled = true)
  1055. }
  1056. this.pageDisplay = false
  1057. this.isItHidden = false
  1058. this.inDex = this.contentOption.length
  1059. } else {
  1060. if (res.data.length != 0) {
  1061. this.queryList.columnList = res.data.filter((e) => e.checked == 0)
  1062. this.queryList.columnList = res.data
  1063. this.setRowList = res.data
  1064. this.queryList.columnList = this.queryList.columnList.filter((e) => e.checked == 0)
  1065. // this.waitFor = true
  1066. } else {
  1067. this.$set(this.queryList,'columnList',this.$options.data().listStyle)
  1068. this.setRowList = this.$options.data().listStyle
  1069. }
  1070. this.pageDisplay = true
  1071. this.isItHidden = true
  1072. this.inDex = 4
  1073. let y = moment(Date.parse(new Date())).format('YYYY-MM-DD')
  1074. if (this.formDataList.timeInterval === undefined){
  1075. this.$set(this.formDataList,'timeInterval',[ y + ' 00:00:00', y + ' 23:59:59'])
  1076. }else {
  1077. this.$set(this.formDataList,'timeInterval',this.formDataList.timeInterval)
  1078. }
  1079. this.$refs.avatar.assignmentTime(this.formDataList)
  1080. }
  1081. if (list){
  1082. this.$refs.avatar.form = list.warehouseBills
  1083. this.contentList = list.tWarehousebillsfees
  1084. this.contentButton = this.$options.data().contentButton
  1085. console.log(this.$route.query.list)
  1086. if (this.pendingPage.name) {
  1087. this.contentButton.push(JSON.parse(this.$route.query.list))
  1088. if (JSON.parse(this.$route.query.list)) this.$router.push({ query: {} })
  1089. }
  1090. let data = {
  1091. actId: 520,
  1092. id: this.$refs.avatar.form.fId
  1093. }
  1094. getName(data).then(response => {
  1095. console.log(response)
  1096. if (response.data.length != 0) {
  1097. this.before = response.data[0].userName
  1098. if (this.$refs.avatar.form.fBillstatus === 6 && this.before == this.lander) {
  1099. // this.contentButton.forEach(item =>{
  1100. // if (item.name === '审批'){
  1101. //
  1102. // }
  1103. // })
  1104. this.contentButton.push({
  1105. type: 'danger',
  1106. size: 'mini',
  1107. icon: 'el-icon-edit-outline',
  1108. name: '撤销采购',
  1109. disabled: false
  1110. })
  1111. }
  1112. }
  1113. })
  1114. let operator = this.$refs.avatar.form.createBy
  1115. if(this.$refs.avatar.form.fBillstatus === 4 && this.lander === operator){
  1116. this.contentButton.push({
  1117. type: 'danger',
  1118. size: 'mini',
  1119. icon: 'el-icon-edit-outline',
  1120. name: '撤销审批',
  1121. disabled: false
  1122. })
  1123. }
  1124. this.contentButton.forEach(item =>{
  1125. if(this.$refs.avatar.form.fBillstatus < 4){
  1126. if (item.name == '录入明细' || item.name == '保存'){
  1127. item.disabled = true
  1128. }else {
  1129. item.disabled = false
  1130. }
  1131. }else{
  1132. if (item.name == '录入明细' || item.name == '保存' || item.name == '请核' || item.name == '修改'){
  1133. item.disabled = true
  1134. }else {
  1135. item.disabled = false
  1136. }
  1137. }
  1138. })
  1139. }
  1140. if (i == 1) this.submitAnd()
  1141. })
  1142. },
  1143. returnToForm(row) {
  1144. console.log(row, 111)
  1145. },
  1146. //查看-列表
  1147. viewMethod(scope,res,i) {
  1148. if(res){
  1149. this.contentButton.forEach(item => {
  1150. item.disabled = false
  1151. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1152. this.contentStyle.forEach(item => item.disabled = false)
  1153. this.contentOption.forEach(item => {
  1154. if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
  1155. item.disabled = true
  1156. } else {
  1157. item.disabled = false
  1158. }
  1159. })
  1160. })
  1161. }else{
  1162. this.contentOption.forEach(item => item.disabled = true)
  1163. this.contentStyle.forEach(item => item.disabled = true)
  1164. }
  1165. viewSingle(scope.row.fId).then(res => {
  1166. if (res.code === 200) {
  1167. let data = {
  1168. tableName: this.purchaseList.tableName,
  1169. userId: Cookies.get('userName')
  1170. }
  1171. let list ={
  1172. warehouseBills:res.data.warehouseBills,
  1173. tWarehousebillsfees:res.data.tWarehousebillsfees
  1174. }
  1175. // this.$refs.avatar.form = {}
  1176. this.getRow(data,list,'',i)
  1177. }
  1178. })
  1179. },
  1180. submitAnd(){
  1181. this.$refs.avatar.form.fId = ''
  1182. this.$refs.avatar.form.fBillno = ''
  1183. this.$refs.avatar.form.fCreateLog = ''
  1184. this.$refs.avatar.form.fPrintLog = ''
  1185. this.$refs.avatar.form.fReviewDate = ''
  1186. this.$refs.avatar.form.fBillstatus = 2
  1187. this.$refs.avatar.form.fPrint = 0
  1188. this.contentList.forEach(item=>item.fId = '')
  1189. this.contentOption.forEach(item => {
  1190. if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
  1191. item.disabled = true
  1192. } else {
  1193. item.disabled = false
  1194. }
  1195. })
  1196. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1197. this.contentButton.forEach(item => item.disabled = false)
  1198. this.contentStyle.forEach(item => item.disabled = false)
  1199. },
  1200. //修改
  1201. modification(scope) {
  1202. console.log(scope)
  1203. },
  1204. //删除
  1205. deletion(scope) {
  1206. console.log(scope.row.fId)
  1207. tableDeleteQuery(scope.row.fId).then(res => {
  1208. console.log(res)
  1209. this.$confirm(res.msg == 1 ? '主表数据为空' : (res.msg == 2 ? '主表有数据' : '未知状态') + '是否永久删除该条数据?', '提示', {
  1210. confirmButtonText: '确定',
  1211. cancelButtonText: '取消',
  1212. type: 'warning'
  1213. }).then(() => {
  1214. confirmDeletion(scope.row.fId).then(data => {
  1215. this.$message({
  1216. type: 'success',
  1217. message: '删除成功!'
  1218. })
  1219. this.query(this.formDataList)
  1220. })
  1221. }).catch(() => {
  1222. this.$message({
  1223. type: 'info',
  1224. message: '已取消删除'
  1225. })
  1226. })
  1227. })
  1228. },
  1229. //选择框
  1230. selectionbox(selection) {
  1231. if (selection.length > 1){
  1232. this.customButton.forEach(item =>{
  1233. if (item.name === '复制新单'){
  1234. item.disabled = true
  1235. }else {
  1236. item.disabled = false
  1237. }
  1238. })
  1239. }else {
  1240. this.customButton.forEach(item => item.disabled = false)
  1241. this.selection = selection
  1242. }
  1243. },
  1244. //详情内容保存
  1245. submitAndSave(item,res) {
  1246. console.log(item,res)
  1247. if(this.$refs.avatar.form.fBillstatus <= 4 || !this.$refs.avatar.form.fBillstatus) {
  1248. let formData = new window.FormData()
  1249. this.$refs.avatar.form.fMoney = 0
  1250. this.contentList.forEach(item => this.$refs.avatar.form.fMoney += Number(item.fAmount))
  1251. formData.append('tWarehousebills', JSON.stringify(this.$refs.avatar.form))
  1252. formData.append('tWarehousebillsfees', JSON.stringify(this.contentList))
  1253. formData.append('fBilltype', 'SQ')
  1254. if (item === 3){
  1255. this.$refs.avatar.form.fId = ''
  1256. this.$refs.avatar.form.fBillno = ''
  1257. this.$refs.avatar.form.fCreateLog = ''
  1258. this.$refs.avatar.form.fPrintLog = ''
  1259. this.$refs.avatar.form.fBillstatus = 2
  1260. this.$refs.avatar.form.fPrint = 0
  1261. this.contentList.forEach(item=>item.fId = '')
  1262. this.contentOption.forEach(item => {
  1263. if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
  1264. item.disabled = true
  1265. } else {
  1266. item.disabled = false
  1267. }
  1268. })
  1269. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1270. this.contentButton.forEach(item => item.disabled = false)
  1271. this.contentStyle.forEach(item => item.disabled = false)
  1272. }else {
  1273. submit(formData).then(res => {
  1274. if (res.code == 200) {
  1275. if(res){
  1276. this.$refs.avatar.form = res.data.warehouseBills
  1277. }
  1278. this.contentList = res.data.tWarehousebillsCntrs
  1279. this.$message.success('保存成功')
  1280. }
  1281. })
  1282. }
  1283. }
  1284. if (item == 1){
  1285. this.dialogVisible = true
  1286. }else if (item === 2){
  1287. let data = {
  1288. tableName: this.queryList.tableName,
  1289. userId: Cookies.get('userName')
  1290. }
  1291. this.getRow(data)
  1292. this.query(this.formDataList)
  1293. }
  1294. if (item === 3 && this.$refs.avatar.form.fBillstatus > 3){
  1295. this.$refs.avatar.form.fId = ''
  1296. this.$refs.avatar.form.fBillno = ''
  1297. this.$refs.avatar.form.fCreateLog = ''
  1298. this.$refs.avatar.form.fReviewDate = ''
  1299. this.$refs.avatar.form.fReviewDate = ''
  1300. this.$refs.avatar.form.fPrintLog = ''
  1301. this.$refs.avatar.form.fBillstatus = 2
  1302. this.$refs.avatar.form.fPrint = 0
  1303. this.contentList.forEach(item=>item.fId = '')
  1304. this.contentOption.forEach(item => {
  1305. if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
  1306. item.disabled = true
  1307. } else {
  1308. item.disabled = false
  1309. }
  1310. })
  1311. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1312. this.contentButton.forEach(item => item.disabled = false)
  1313. this.contentStyle.forEach(item => item.disabled = false)
  1314. // let datae = {
  1315. // fId:this.$refs.avatar.form.fId,
  1316. // fBilltype:'SQ'
  1317. // }
  1318. // copyNew(datae).then(res=> {
  1319. // this.$message({
  1320. // message: '复制新单成功',
  1321. // type: 'success',
  1322. // showClose: true
  1323. // });
  1324. // let scope = {
  1325. // row: {
  1326. // fId: res.data
  1327. // }
  1328. // }
  1329. // this.query(this.formDataList)
  1330. // this.viewMethod(scope,res)
  1331. // })
  1332. }
  1333. },
  1334. //表单选中后触发
  1335. selectTrigger(name, list, id) {
  1336. console.log(list, id)
  1337. if (name == 'fGoodsid') {
  1338. for (let item in list) {
  1339. if (list[item].value == id) {
  1340. this.$refs.avatar.form.personNaem = list[item].personNaem
  1341. this.$refs.avatar.form.corpsName = list[item].corpsName
  1342. }
  1343. }
  1344. }
  1345. },
  1346. //确认打印
  1347. Printing(){
  1348. this.$print(this.$refs.print)
  1349. },
  1350. //返回列表
  1351. backToList(){
  1352. let data
  1353. if (!this.$refs.avatar.form.fId && this.contentList !== 0 || this.$refs.avatar.form.fBillstatus > 3 && !this.$route.query.data) {
  1354. data = {
  1355. tableName: this.queryList.tableName,
  1356. userId: Cookies.get('userName')
  1357. }
  1358. this.getRow(data)
  1359. this.query(this.formDataList)
  1360. } else if(this.$route.query.data){
  1361. this.cancelTwo();
  1362. // this.$router.push({path:'/index'})
  1363. }else {
  1364. this.$confirm('当前数据是否保存?', '提示', {
  1365. confirmButtonText: '保存',
  1366. cancelButtonText: '取消',
  1367. type: 'warning'
  1368. }).then(() => {
  1369. this.submitAndSave(2,1)
  1370. }).catch(() => {
  1371. data = {
  1372. tableName: this.queryList.tableName,
  1373. userId: Cookies.get('userName')
  1374. }
  1375. this.getRow(data)
  1376. this.query(this.formDataList)
  1377. })
  1378. }
  1379. },
  1380. //所以按钮
  1381. buttonList(row) {
  1382. console.log(row)
  1383. let data
  1384. switch (row.name) {
  1385. case '新单':
  1386. if(row.nameTwo == '详情页'){
  1387. if(this.$refs.avatar.form.fId){
  1388. this.contentList = []
  1389. data = {
  1390. tableName: this.purchaseList.tableName,
  1391. userId: Cookies.get('userName')
  1392. }
  1393. this.$refs.avatar.form = {}
  1394. this.getRow(data,'',1)
  1395. this.contentOption.forEach(item => {
  1396. if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
  1397. item.disabled = true
  1398. } else {
  1399. item.disabled = false
  1400. }
  1401. })
  1402. this.contentButton.forEach(item => item.disabled = false)
  1403. this.contentStyle.forEach(item => item.disabled = false)
  1404. this.$refs.avatar.clearVerification()
  1405. this.$refs.avatar.form.createBy = Cookies.get('userName')
  1406. }else{
  1407. this.$message.error("当前数据未保存,请先保存")
  1408. }
  1409. }else{
  1410. this.contentList = []
  1411. data = {
  1412. tableName: this.purchaseList.tableName,
  1413. userId: Cookies.get('userName')
  1414. }
  1415. this.$refs.avatar.form = {}
  1416. this.getRow(data,'',1)
  1417. this.contentOption.forEach(item => {
  1418. if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
  1419. item.disabled = true
  1420. } else {
  1421. item.disabled = false
  1422. }
  1423. })
  1424. this.contentButton.forEach(item => item.disabled = false)
  1425. this.contentStyle.forEach(item => item.disabled = false)
  1426. this.$refs.avatar.clearVerification()
  1427. this.$refs.avatar.form.createBy = Cookies.get('userName')
  1428. }
  1429. break
  1430. case '保存':
  1431. this.$refs.avatar.submitForm('submit')
  1432. break
  1433. case '打印':
  1434. console.log(this.listData.fFeeid,this.contentList)
  1435. for (let item in this.contentList){
  1436. for (let li in this.listData.fFeeid){
  1437. if (this.contentList[item].fFeeid == this.listData.fFeeid[li].value){
  1438. this.contentList[item].feeName = this.listData.fFeeid[li].label
  1439. }
  1440. }
  1441. for(let i in this.listData.fFeeunitid){
  1442. if (this.contentList[item].fFeeunitid == this.listData.fFeeunitid[i].value){
  1443. this.contentList[item].fFeeunitName = this.listData.fFeeunitid[i].label
  1444. }
  1445. }
  1446. }
  1447. if (!this.$refs.avatar.form.fId){
  1448. this.$message.error('未保存,不允许打印');
  1449. }else if (this.$refs.avatar.form.fBillstatus >= 4){
  1450. this.formList = this.$refs.avatar.form
  1451. this.dialogVisible = true
  1452. }else {
  1453. this.formList = this.$refs.avatar.form
  1454. console.log(this.$refs.avatar.form.fBillstatus)
  1455. this.submitAndSave(1)
  1456. }
  1457. break
  1458. case '修改':
  1459. this.contentButton.forEach(item =>{
  1460. if (this.$refs.avatar.form.fBillstatus >= 4){
  1461. if (item.name === '返回列表' || item.name == '打印' || item.name === '修改' || item.name === '生成入库单' || item.name === '生成销售单'||item.name === '生成出库单' || item.name === '查看审批' || item.name === '审批' || item.name === '撤销采购' || item.name === '撤销审批'){
  1462. item.disabled = false
  1463. }else {
  1464. item.disabled = true
  1465. }
  1466. }else {
  1467. item.disabled = false
  1468. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1469. this.contentStyle.forEach(item => item.disabled = false)
  1470. this.contentOption.forEach(item => {
  1471. if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
  1472. item.disabled = true
  1473. } else {
  1474. item.disabled = false
  1475. }
  1476. })
  1477. }
  1478. })
  1479. break
  1480. case '录入明细':
  1481. this.contentList.push({
  1482. fFeeid: '',
  1483. fUnitprice: '',
  1484. fPurchase: '',
  1485. fQty: '',
  1486. fFeeunitid: '',
  1487. fAmount: '',
  1488. fStltypeid: '',
  1489. remark: '',
  1490. createTime: '',
  1491. createBy: Cookies.get('userName'),
  1492. fReviewDate: '',
  1493. operation: '',
  1494. })
  1495. break
  1496. case '查看审批':
  1497. this.addOrUpdateHandle()
  1498. break
  1499. case '审批':
  1500. this.addOrUpdateHand()
  1501. break
  1502. case '请核':
  1503. if (this.$refs.avatar.form.fBillstatus < 4){
  1504. this.$refs.avatar.submitForm('check')
  1505. }else {
  1506. this.$message.error('请先保存');
  1507. }
  1508. break
  1509. case '生成入库单':
  1510. let listData = {
  1511. fId:this.$refs.avatar.form.fId,
  1512. fBilltype:'RK'
  1513. }
  1514. copyNew(listData).then(res=>{
  1515. this.$message({
  1516. message: '生成成功',
  1517. type: 'success',
  1518. showClose:true
  1519. });
  1520. })
  1521. break
  1522. case '生成销售单':
  1523. let liste = {
  1524. fId:this.$refs.avatar.form.fId,
  1525. fBilltype:'XS'
  1526. }
  1527. copyNew(liste).then(res=>{
  1528. this.$message({
  1529. message: '生成成功',
  1530. type: 'success',
  1531. showClose:true
  1532. });
  1533. })
  1534. break
  1535. case '生成出库单':
  1536. let listd = {
  1537. fId:this.$refs.avatar.form.fId,
  1538. fBilltype:'CK'
  1539. }
  1540. copyNew(listd).then(res=>{
  1541. this.$message({
  1542. message: '生成成功',
  1543. type: 'success',
  1544. showClose:true
  1545. });
  1546. })
  1547. break
  1548. case '复制新单':
  1549. if (row.nameTwo === '详情页'){
  1550. this.$refs.avatar.submitForm('submit',3)
  1551. }else {
  1552. if (this.selection.length > 0){
  1553. let scope = {
  1554. row:{
  1555. fId:this.selection[0].fId
  1556. }
  1557. }
  1558. this.query(this.formDataList)
  1559. this.viewMethod(scope,'',1)
  1560. }else {
  1561. this.$message.warning('未选择列表,请选择后再点击');
  1562. }
  1563. }
  1564. break
  1565. case '撤销审批':
  1566. let date = new Date()
  1567. let y = date.getFullYear()
  1568. let m = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
  1569. let d = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate())
  1570. data = {
  1571. actId:520,
  1572. id:this.$refs.avatar.form.fId,
  1573. billId:this.$refs.avatar.form.fId,
  1574. auditItem:y + '-' + m + '-' + d
  1575. }
  1576. console.log(data)
  1577. revoke(data).then(res=>{
  1578. if (res.code === 200){
  1579. this.$message({
  1580. showClose: true,
  1581. message: '撤销成功',
  1582. type: 'success'
  1583. })
  1584. data = {
  1585. tableName: this.queryList.tableName,
  1586. userId: Cookies.get('userName')
  1587. }
  1588. this.getRow(data)
  1589. this.query(this.formDataList)
  1590. }
  1591. })
  1592. break
  1593. case '撤销采购':
  1594. withdrawBy(this.$refs.avatar.form.fId).then(res=>{
  1595. if (res.code === 200){
  1596. this.$message({
  1597. showClose: true,
  1598. message: '撤销成功',
  1599. type: 'success'
  1600. })
  1601. data = {
  1602. tableName: this.queryList.tableName,
  1603. userId: Cookies.get('userName')
  1604. }
  1605. this.getRow(data)
  1606. this.query(this.formDataList)
  1607. }
  1608. })
  1609. break
  1610. default:
  1611. this.$message.error('该按钮暂无功能')
  1612. }
  1613. },
  1614. //请核
  1615. writeOff(){
  1616. let formData = new window.FormData()
  1617. formData.append('tWarehousebills', JSON.stringify(this.$refs.avatar.form))
  1618. formData.append('tWarehousebillsfees', JSON.stringify(this.contentList))
  1619. formData.append('fBilltype', 'SQ')
  1620. pleaseCheck(formData).then(res => {
  1621. if (res.code == 200) {
  1622. this.$message.success('请核成功')
  1623. this.contentOption.forEach(item => item.disabled = true)
  1624. this.contentStyle.forEach(item => item.disabled = true)
  1625. this.contentButton.forEach(item =>{
  1626. if (item.name == '返回列表' || item.name == '修改'){
  1627. item.disabled = false
  1628. }else {
  1629. item.disabled = true
  1630. }
  1631. })
  1632. // this.$refs.avatar.form = res.data.warehouseBills
  1633. // this.contentList = res.data.tWarehousebillsCntrs
  1634. let data = {
  1635. tableName: this.queryList.tableName,
  1636. userId: Cookies.get('userName')
  1637. }
  1638. this.getRow(data)
  1639. this.query(this.formDataList)
  1640. }
  1641. })
  1642. },
  1643. // 显示搜索条件、点击后会调用此方法
  1644. showSearch() {
  1645. console.log('到我了')
  1646. this.searchWhether = !this.searchWhether
  1647. },
  1648. //搜索、重置、展开
  1649. feedback(res) {
  1650. console.log(res)
  1651. if (res == '展开') {
  1652. if (this.inDex == 4) {
  1653. this.inDex = this.formOption.length
  1654. } else {
  1655. this.inDex = 4
  1656. }
  1657. } else if (res == '搜索') {
  1658. this.$refs.avatar.submitForm()
  1659. } else if (res == '重置') {
  1660. this.formDataList = {
  1661. pageNum:1,
  1662. pageSize:10,
  1663. timeInterval:null
  1664. }
  1665. this.$refs.avatar.assignmentTime(this.formDataList)
  1666. this.$refs.avatar.submitForm()
  1667. }
  1668. },
  1669. //表单验证通过执行搜索
  1670. submitForm() {
  1671. let list = this.formDataList
  1672. console.log(this.$refs.avatar.form)
  1673. this.formDataList = this.$refs.avatar.form
  1674. this.formDataList.fBilltype = list.fBilltype
  1675. this.formDataList.pageSize = list.pageSize
  1676. this.formDataList.pageNum = list.pageNum
  1677. this.formDataList.timeInterval = list.timeInterval
  1678. this.query(this.formDataList)
  1679. },
  1680. //点击刷新会调用此方法
  1681. getList() {
  1682. this.feedback('重置')
  1683. this.submitForm()
  1684. console.log('到我了2')
  1685. },
  1686. //详情表内容移出
  1687. deletRows(index, rows) {
  1688. console.log(index, rows)
  1689. if (rows[index].fId) {
  1690. deleteQuery(this.$refs.avatar.form.fId, this.$refs.avatar.form.fDateChanged).then(res => {
  1691. if (res.code === 200) {
  1692. listDelete(rows[index].fId).then(data => {
  1693. rows.splice(index, 1)
  1694. })
  1695. }
  1696. })
  1697. } else {
  1698. rows.splice(index, 1)
  1699. }
  1700. }
  1701. }
  1702. }
  1703. </script>
  1704. <style scoped>
  1705. .table {
  1706. border-collapse: collapse;
  1707. border-spacing: 0;
  1708. background-color: transparent;
  1709. display: table;
  1710. width: 100%;
  1711. max-width: 100%;
  1712. margin: 0 auto;
  1713. }
  1714. .table td {
  1715. text-align: center;
  1716. vertical-align: middle;
  1717. font-size: 14px;
  1718. color: #000000;
  1719. padding: 8px 12px;
  1720. }
  1721. .column {
  1722. border: 1px solid #000;
  1723. }
  1724. .app-container >>> .el-form-item{
  1725. margin-bottom: 0;
  1726. }
  1727. </style>