index.vue 35 KB

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