index.vue 58 KB

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