index.vue 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <el-tabs v-model="tabsName" type="card" @tab-click="handleClick">
  5. <el-tab-pane label="待采购" name="first"></el-tab-pane>
  6. <el-tab-pane label="采购中" name="second"></el-tab-pane>
  7. <el-tab-pane label="采购完成" name="third"></el-tab-pane>
  8. <el-tab-pane label="全部" name="fourth"></el-tab-pane>
  9. </el-tabs>
  10. <avue-crud
  11. v-show="tabsName == 'first'"
  12. ref="procureCrud"
  13. :page.sync="treatPage"
  14. :option="procureOption"
  15. :data="procureData"
  16. @refresh-change="listBYStatusfun(treatPage)"
  17. @resetColumn="resetColumnTwo('procureCrud', 'procureOption', 'procureOptionList', 2.3)"
  18. @saveColumn="saveColumnTwo('procureCrud', 'procureOption', 'procureOptionList', 2.3)"
  19. >
  20. <template slot-scope="scope" slot="menu">
  21. <el-button type="text" size="small" @click.stop="procureViewfun(scope.row)">采购 </el-button>
  22. </template>
  23. </avue-crud>
  24. <avue-crud
  25. v-show="tabsName == 'second' || tabsName == 'third' || tabsName == 'fourth'"
  26. ref="crud"
  27. :option="option"
  28. :data="dataList"
  29. v-model="form"
  30. :page.sync="page"
  31. :search.sync="search"
  32. @search-change="searchChange"
  33. @current-change="currentChange"
  34. @size-change="sizeChange"
  35. @refresh-change="refreshChange"
  36. @on-load="onLoad"
  37. :table-loading="loading"
  38. :cell-style="cellStyle"
  39. @selection-change="selectionChange"
  40. @expand-change="expandChange"
  41. @search-criteria-switch="searchCriteriaSwitch"
  42. @saveColumn="saveColumn('crud', 'option', 'optionBack', 2)"
  43. @resetColumn="resetColumn('crud', 'option', 'optionBack', 2)"
  44. >
  45. <template slot-scope="{ row }" slot="expand">
  46. <avue-crud
  47. ref="itemCrud"
  48. :data="row.itemData"
  49. :option="itemOption"
  50. :table-loading="row.itemLoading"
  51. @resetColumn="resetColumnTwo('itemCrud', 'itemOption', 'itemOptionList', 2.2)"
  52. @saveColumn="saveColumnTwo('itemCrud', 'itemOption', 'itemOptionList', 2.2)"
  53. :cell-style="cellStyle"
  54. class="itemTable"
  55. ></avue-crud>
  56. </template>
  57. <template slot="createTimeSearch">
  58. <el-date-picker
  59. v-model="search.createTime"
  60. type="daterange"
  61. start-placeholder="开始日期"
  62. end-placeholder="结束日期"
  63. format="yyyy-MM-dd"
  64. value-format="yyyy-MM-dd HH:mm:ss"
  65. :default-time="['00:00:00', '23:59:59']"
  66. >
  67. </el-date-picker>
  68. </template>
  69. <template slot="menuLeft">
  70. <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="newAdd('new')">创建单据 </el-button>
  71. <el-button type="success" size="small" @click.stop="copyDoc()" :disabled="selectionList.length != 1">复制单据 </el-button>
  72. <el-button type="info" size="small" disabled>报表打印</el-button>
  73. <el-button type="warning" size="small" @click="caigorenwufun">采购任务</el-button>
  74. </template>
  75. <template slot="corpIdSearch">
  76. <crop-select v-model="search.corpId" corpType="GYS"></crop-select>
  77. </template>
  78. <template slot="businesDateSearch">
  79. <el-date-picker
  80. v-model="search.businesDate"
  81. type="daterange"
  82. start-placeholder="开始日期"
  83. end-placeholder="结束日期"
  84. format="yyyy-MM-dd"
  85. value-format="yyyy-MM-dd HH:mm:ss"
  86. :default-time="['00:00:00', '23:59:59']"
  87. >
  88. </el-date-picker>
  89. </template>
  90. <template slot="plannedDeliveryDateSearch">
  91. <el-date-picker
  92. v-model="search.plannedDeliveryDate"
  93. type="daterange"
  94. start-placeholder="开始日期"
  95. end-placeholder="结束日期"
  96. format="yyyy-MM-dd"
  97. value-format="yyyy-MM-dd HH:mm:ss"
  98. :default-time="['00:00:00', '23:59:59']"
  99. >
  100. </el-date-picker>
  101. </template>
  102. <template slot="requiredDeliveryDateSearch">
  103. <el-date-picker
  104. v-model="search.requiredDeliveryDate"
  105. type="daterange"
  106. start-placeholder="开始日期"
  107. end-placeholder="结束日期"
  108. format="yyyy-MM-dd"
  109. value-format="yyyy-MM-dd HH:mm:ss"
  110. :default-time="['00:00:00', '23:59:59']"
  111. >
  112. </el-date-picker>
  113. </template>
  114. <template slot-scope="scope" slot="corpId">
  115. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(scope.row, 1)">{{ scope.row.strCorpName }} </span>
  116. </template>
  117. <template slot-scope="scope" slot="srcOrderNo">
  118. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(scope.row, 1)">{{ scope.row.srcOrderNo }}</span>
  119. </template>
  120. <template slot-scope="scope" slot="fudaPurchaseStatus">
  121. <span class="el-button--text">
  122. {{ scope.row.fudaPurchaseStatus }}
  123. </span>
  124. </template>
  125. <template slot-scope="scope" slot="fudaPurchaseDate">
  126. <span class="el-button--text">
  127. {{ scope.row.fudaPurchaseDate }}
  128. </span>
  129. </template>
  130. <template slot-scope="scope" slot="productionScheduling">
  131. <span class="el-button--text">
  132. {{ scope.row.productionScheduling }}
  133. </span>
  134. </template>
  135. <template slot-scope="scope" slot="createUser">
  136. {{ scope.row.createUserName }}
  137. </template>
  138. <template slot-scope="{ row }" slot="orderQuantity">
  139. <span>{{ row.orderQuantity | IntegerFormat }}</span>
  140. </template>
  141. <template slot-scope="{ row }" slot="purchaseAmount">
  142. <span>{{ row.purchaseAmount | decimalFormat2 }}</span>
  143. </template>
  144. <template slot-scope="{ row }" slot="purchaseQuantity">
  145. <span>{{ row.purchaseQuantity | decimalFormat2 }}</span>
  146. </template>
  147. <template slot-scope="{ row }" slot="pdeliverQuantity">
  148. <span>{{ row.deliverQuantity | decimalFormat2 }}</span>
  149. </template>
  150. <template slot-scope="{ row }" slot="actualQuantity">
  151. <span>{{ row.actualQuantity | decimalFormat2 }}</span>
  152. </template>
  153. <template slot-scope="{ row, index }" slot="menu">
  154. <el-button type="text" icon="el-icon-delete" size="small" @click.stop="rowDel(row, index)">删除 </el-button>
  155. <el-button type="text" icon="el-icon-printer" size="small" class="el-button--small-yh " @click.stop="openReports(row)">导出</el-button>
  156. </template>
  157. </avue-crud>
  158. </basic-container>
  159. <detail-page @goBack="goBack" @copyOrder="copyOrder" :detailData="detailData" v-if="!show"></detail-page>
  160. <el-dialog
  161. title="导入采购任务"
  162. v-if="dialogVisible"
  163. :visible.sync="dialogVisible"
  164. append-to-body
  165. :close-on-click-modal="false"
  166. :close-on-press-escape="false"
  167. :before-close="function() {dialogVisible = false;params = {};}"
  168. top="1vh"
  169. width="90%"
  170. >
  171. <span>
  172. <el-row>
  173. <el-col :span="6" style="padding: 0 10px">
  174. <el-scrollbar>
  175. <!-- <avue-tree :option="treeOption" :key="avueTree" :data="treeData" @node-click="nodeClick"/>-->
  176. <!-- {{ treeData }}-->
  177. <el-table
  178. style="width: 100%"
  179. border
  180. size="mini"
  181. ref="singleTable"
  182. highlight-current-row
  183. @current-change="handleCurrentChange"
  184. :data="treeData"
  185. >
  186. <el-table-column prop="orderNo" show-overflow-tooltip align="center" label="销售单号"> </el-table-column>
  187. <el-table-column prop="plannedDeliveryDate" show-overflow-tooltip width="105" align="center" label="交货日期">
  188. <template slot-scope="{ row }">
  189. {{ row.plannedDeliveryDate ? row.plannedDeliveryDate.slice(0, 10) : "" }}
  190. </template>
  191. </el-table-column>
  192. </el-table>
  193. </el-scrollbar>
  194. </el-col>
  195. <el-col :span="18">
  196. <!-- :page.sync="dialogPage"-->
  197. <avue-crud
  198. :data="dialogData"
  199. :option="dialogOption"
  200. :search.sync="params"
  201. ref="dialogCrud"
  202. @resetColumn="resetColumnTwo('dialogCrud', 'dialogOption', 'dialogOptionList', 2.1)"
  203. @saveColumn="saveColumnTwo('dialogCrud', 'dialogOption', 'dialogOptionList', 2.1)"
  204. @refresh-change="refreshChangeTwo"
  205. @search-change="searchChangeTwo"
  206. @search-reset="searchReset"
  207. @selection-change="dialogSelectionChange"
  208. @on-load="dialogOnLoad"
  209. >
  210. <template slot="menuLeft">
  211. <el-tabs v-model="activeName" @tab-click="tabHandle">
  212. <el-tab-pane label="查询结果" name="searchList" />
  213. <el-tab-pane label="已选定数据" name="importStaging" />
  214. </el-tabs>
  215. </template>
  216. <template slot="menuRight">
  217. <el-button type="primary" size="small" @click="allClick('全选')">全选</el-button>
  218. </template>
  219. <template slot="corpNameSearch">
  220. <crop-select v-model="params.corpId" corpType="GYS" />
  221. </template>
  222. <template slot="actualQuantity" slot-scope="scope">
  223. <el-input-number
  224. v-if="activeName === 'importStaging'"
  225. v-model="scope.row.actualQuantity"
  226. :precision="2"
  227. :min="0.01"
  228. :controls="false"
  229. ></el-input-number>
  230. <span v-else>{{ scope.row.actualQuantity }}</span>
  231. </template>
  232. <template slot-scope="scope" slot="menu">
  233. <el-button
  234. type="text"
  235. icon="el-icon-edit"
  236. size="small"
  237. @click.stop="importStagList(scope.row, scope.index)"
  238. v-if="activeName == 'searchList'"
  239. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
  240. >选择
  241. </el-button>
  242. <el-button type="text" icon="el-icon-delete" size="small" @click.stop="removeStagList(scope.row, scope.index)" v-else
  243. >移除
  244. </el-button>
  245. </template>
  246. </avue-crud>
  247. </el-col>
  248. </el-row>
  249. </span>
  250. <span slot="footer" class="dialog-footer">
  251. <!-- <el-button type="warning" @click="outExport">导出</el-button>-->
  252. <el-button type="warning" @click="openReport">导出</el-button>
  253. <el-button
  254. @click="
  255. dialogVisible = false;
  256. params = {};
  257. "
  258. >取 消</el-button
  259. >
  260. <el-button type="primary" :disabled="goodsListSave.length === 0" @click="confirmImport">导 入</el-button>
  261. </span>
  262. </el-dialog>
  263. <report-dialog :switchDialog="switchDialog" :reportId="params.pid" reportName="出口贸易-采购" @onClose="onClose()"></report-dialog>
  264. <report-dialog :switchDialog="switchDialogs" :reportId="srcIds" reportName="出口贸易-采购" @onClose="onCloses()"></report-dialog>
  265. <el-dialog title="导入采购任务" :visible.sync="procureVisible" append-to-body>
  266. <avue-crud
  267. :data="procurelistData"
  268. :option="procurelistOption"
  269. :search.sync="params"
  270. ref="daorucaigoCrud"
  271. @refresh-change="refreshChangeTwo"
  272. @resetColumn="resetColumnTwo('daorucaigoCrud', 'procurelistOption', 'procurelistOptionList', 2.4)"
  273. @saveColumn="saveColumnTwo('daorucaigoCrud', 'procurelistOption', 'procurelistOptionList', 2.4)"
  274. >
  275. <template slot="menuLeft">
  276. <el-tabs v-model="activeName" @tab-click="tabHandle">
  277. <el-tab-pane label="查询结果" name="searchList" />
  278. <el-tab-pane label="已选定数据" name="importStaging" />
  279. </el-tabs>
  280. </template>
  281. <template slot="corpNameSearch">
  282. <crop-select v-model="params.corpId" corpType="GYS" />
  283. </template>
  284. <template slot="actualQuantity" slot-scope="scope">
  285. <el-input-number
  286. v-if="activeName === 'importStaging'"
  287. v-model="scope.row.actualQuantity"
  288. :precision="2"
  289. :min="0.01"
  290. :controls="false"
  291. ></el-input-number>
  292. <span v-else>{{ scope.row.actualQuantity }}</span>
  293. </template>
  294. <template slot-scope="scope" slot="menu">
  295. <el-button
  296. type="text"
  297. icon="el-icon-edit"
  298. size="small"
  299. @click.stop="importStagList(scope.row, scope.index)"
  300. v-if="activeName == 'searchList'"
  301. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
  302. >选择
  303. </el-button>
  304. <el-button type="text" icon="el-icon-delete" size="small" @click.stop="removeStagList(scope.row, scope.index)" v-else>移除 </el-button>
  305. </template>
  306. </avue-crud>
  307. <span slot="footer" class="dialog-footer">
  308. <!-- <el-button type="warning" @click="outExport">导出</el-button>-->
  309. <el-button type="warning" @click="openReport">导出</el-button>
  310. <el-button @click="procureVisible = false">取 消</el-button>
  311. <el-button type="primary" :disabled="goodsListSave.length === 0" @click="confirmImport">导 入</el-button>
  312. </span>
  313. </el-dialog>
  314. </div>
  315. </template>
  316. <script>
  317. // import option from "./config/mainList.json";
  318. import reportDialog from "@/components/report-dialog/main";
  319. import { getList, remove, gainUser, listXS, generatePurchaseBill, listBYStatus, getGoodsInfo, getGoods } from "@/api/exportTrade/purchaseContract";
  320. import detailPage from "./detailsPage.vue";
  321. import { defaultDate } from "@/util/date";
  322. import { IntegerFormat, decimalFormat2 } from "@/util/validate";
  323. import { customerParameter } from "@/enums/management-type";
  324. import { getToken } from "@/util/auth";
  325. import { customerList } from "@/api/basicData/customerInformation";
  326. import { detail as companyDetail } from "@/api/basicData/customerInformation";
  327. import { getUser as nameUser } from "@/api/system/user";
  328. import tableOption from "@/views/exportTrade/EcommerceStocking/config/customerContact.json";
  329. export default {
  330. name: "customerInformation",
  331. data() {
  332. return {
  333. switchDialog: false,
  334. switchDialogs: false,
  335. tabsName: "first",
  336. tabType: "",
  337. procureData: [], // 待采购数据
  338. // 待采购配置
  339. procureOption: [],
  340. procureOptionList: {
  341. searchShow: true,
  342. searchMenuSpan: 8,
  343. border: true,
  344. index: true,
  345. viewBtn: false,
  346. editBtn: false,
  347. delBtn: false,
  348. addBtn: false,
  349. menuWidth: "100",
  350. headerAlign: "center",
  351. searchIcon: false,
  352. searchIndex: 2,
  353. column: [
  354. {
  355. label: "销售单号",
  356. prop: "orderNo",
  357. overHidden: true
  358. },
  359. {
  360. label: "采购员",
  361. prop: "buyerName",
  362. hide: true,
  363. overHidden: true
  364. },
  365. {
  366. label: "交货日期",
  367. prop: "plannedDeliveryDate",
  368. overHidden: true
  369. },
  370. {
  371. label: "公司主体",
  372. prop: "belongToCorpName",
  373. overHidden: true
  374. },
  375. {
  376. label: "公司主体",
  377. prop: "belongToCorpId",
  378. hide: true,
  379. overHidden: true
  380. },
  381. {
  382. label: "制单人",
  383. prop: "createUserName",
  384. overHidden: true
  385. },
  386. {
  387. label: "制单人",
  388. prop: "createUser",
  389. hide: true,
  390. overHidden: true
  391. },
  392. {
  393. label: "制单日期",
  394. prop: "createTime",
  395. overHidden: true
  396. }
  397. ]
  398. },
  399. procureVisible: false, // 待采购弹窗
  400. procurelistData: [], // 待采购弹窗列表数据
  401. // 待采购弹窗待配置
  402. procurelistOption: {},
  403. procurelistOptionList: {
  404. searchShow: true,
  405. searchMenuSpan: 8,
  406. border: true,
  407. index: true,
  408. viewBtn: false,
  409. editBtn: false,
  410. delBtn: false,
  411. addBtn: false,
  412. menuWidth: "100",
  413. headerAlign: "center",
  414. searchIcon: false,
  415. searchIndex: 2,
  416. tip: false,
  417. column: [
  418. {
  419. label: "销售单号",
  420. prop: "billNo",
  421. searchSpan: 8,
  422. searchOrder: 1,
  423. overHidden: true
  424. },
  425. {
  426. label: "销售日期",
  427. prop: "businesDate",
  428. searchProp: "businesDateList",
  429. width: 100,
  430. type: "date",
  431. searchSpan: 8,
  432. searchRange: true,
  433. searchDefaultTime: ["00:00:00", "23:59:59"],
  434. format: "yyyy-MM-dd",
  435. valueFormat: "yyyy-MM-dd HH:mm:ss",
  436. overHidden: true
  437. },
  438. {
  439. label: "供应商",
  440. prop: "corpName",
  441. searchSpan: 8,
  442. overHidden: true
  443. },
  444. {
  445. label: "交货日期",
  446. prop: "plannedDeliveryDate",
  447. searchProp: "plannedDeliveryDateList",
  448. width: 100,
  449. type: "date",
  450. searchSpan: 8,
  451. searchRange: true,
  452. searchDefaultTime: ["00:00:00", "23:59:59"],
  453. format: "yyyy-MM-dd",
  454. valueFormat: "yyyy-MM-dd HH:mm:ss",
  455. overHidden: true
  456. },
  457. {
  458. label: "采购员",
  459. prop: "carry",
  460. overHidden: true
  461. },
  462. {
  463. label: "产品名称",
  464. prop: "cname",
  465. overHidden: true
  466. },
  467. {
  468. label: "产品编号",
  469. prop: "code",
  470. overHidden: true
  471. },
  472. {
  473. label: "产品类别",
  474. prop: "priceCategory",
  475. overHidden: true
  476. },
  477. {
  478. label: "产品型号",
  479. prop: "itemType",
  480. overHidden: true
  481. },
  482. {
  483. label: "数量",
  484. prop: "orderQuantity"
  485. },
  486. {
  487. label: "已采购数",
  488. prop: "purchaseQuantity",
  489. overHidden: true
  490. },
  491. {
  492. label: "待采数",
  493. prop: "actualQuantity",
  494. overHidden: true
  495. },
  496. {
  497. label: "螺纹",
  498. prop: "remarksOne",
  499. overHidden: true
  500. },
  501. {
  502. label: "介质",
  503. prop: "customTwo",
  504. overHidden: true
  505. },
  506. {
  507. label: "颜色",
  508. prop: "customThree",
  509. overHidden: true
  510. },
  511. {
  512. label: "电压",
  513. prop: "customFour",
  514. overHidden: true
  515. },
  516. {
  517. label: "显示全部",
  518. prop: "showAll",
  519. searchSpan: 8,
  520. searchOrder: 2,
  521. overHidden: true,
  522. type: "select",
  523. clearable: false,
  524. hide: true,
  525. // showColumn: false,
  526. dicData: [
  527. {
  528. label: "需采购",
  529. value: 0
  530. },
  531. {
  532. label: "已采购",
  533. value: 1
  534. }
  535. ],
  536. searchValue: 0
  537. }
  538. ]
  539. },
  540. search: {
  541. businesDate: defaultDate(5)
  542. // businesDate: ''
  543. },
  544. treeData: [],
  545. avueTree: false,
  546. treeOption: {
  547. nodeKey: "id",
  548. lazy: true,
  549. treeLoad: function(node, resolve) {
  550. listBYStatus({}).then(res => {
  551. resolve(
  552. res.data.data.map(item => {
  553. return {
  554. ...item,
  555. leaf: !item.hasChildren
  556. };
  557. })
  558. );
  559. });
  560. },
  561. addBtn: false,
  562. menu: false,
  563. size: "small",
  564. props: {
  565. labelText: "标题",
  566. label: "orderNo",
  567. value: "id",
  568. children: "children"
  569. }
  570. },
  571. dialogData: [],
  572. goodsListShow: [],
  573. goodsListSave: [],
  574. params: {},
  575. dialogPage: {
  576. pageSize: 20,
  577. currentPage: 1,
  578. total: 0,
  579. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  580. },
  581. activeName: "searchList",
  582. dialogOption: {},
  583. dialogOptionList: {
  584. searchShow: true,
  585. searchMenuSpan: 8,
  586. border: true,
  587. index: true,
  588. viewBtn: false,
  589. editBtn: false,
  590. delBtn: false,
  591. addBtn: false,
  592. menuWidth: "100",
  593. headerAlign: "center",
  594. searchIcon: false,
  595. searchIndex: 2,
  596. tip: false,
  597. selection: true,
  598. column: [
  599. {
  600. label: "销售单号",
  601. prop: "billNo",
  602. search: true,
  603. searchSpan: 8,
  604. searchOrder: 1,
  605. overHidden: true
  606. },
  607. {
  608. label: "销售日期",
  609. prop: "businesDate",
  610. searchProp: "businesDateList",
  611. width: 100,
  612. type: "date",
  613. searchSpan: 8,
  614. searchRange: true,
  615. search: true,
  616. searchDefaultTime: ["00:00:00", "23:59:59"],
  617. format: "yyyy-MM-dd",
  618. valueFormat: "yyyy-MM-dd HH:mm:ss",
  619. overHidden: true
  620. },
  621. {
  622. label: "供应商",
  623. prop: "corpName",
  624. searchSpan: 8,
  625. search: true,
  626. overHidden: true
  627. },
  628. {
  629. label: "交货日期",
  630. prop: "plannedDeliveryDate",
  631. searchProp: "plannedDeliveryDateList",
  632. width: 100,
  633. type: "date",
  634. searchSpan: 8,
  635. searchRange: true,
  636. search: true,
  637. searchDefaultTime: ["00:00:00", "23:59:59"],
  638. format: "yyyy-MM-dd",
  639. valueFormat: "yyyy-MM-dd HH:mm:ss",
  640. overHidden: true
  641. },
  642. {
  643. label: "采购员",
  644. prop: "carry",
  645. overHidden: true
  646. },
  647. {
  648. label: "产品名称",
  649. prop: "cname",
  650. overHidden: true
  651. },
  652. {
  653. label: "产品编号",
  654. prop: "code",
  655. overHidden: true
  656. },
  657. {
  658. label: "产品类别",
  659. prop: "priceCategory",
  660. overHidden: true
  661. },
  662. {
  663. label: "产品型号",
  664. prop: "itemType",
  665. overHidden: true
  666. },
  667. {
  668. label: "数量",
  669. prop: "orderQuantity"
  670. },
  671. {
  672. label: "已采购数",
  673. prop: "purchaseQuantity",
  674. overHidden: true
  675. },
  676. {
  677. label: "待采数",
  678. prop: "actualQuantity",
  679. overHidden: true
  680. },
  681. {
  682. label: "螺纹",
  683. prop: "remarksOne",
  684. overHidden: true
  685. },
  686. {
  687. label: "介质",
  688. prop: "customTwo",
  689. overHidden: true
  690. },
  691. {
  692. label: "颜色",
  693. prop: "customThree",
  694. overHidden: true
  695. },
  696. {
  697. label: "电压",
  698. prop: "customFour",
  699. overHidden: true
  700. },
  701. {
  702. label: "显示全部",
  703. prop: "showAll",
  704. searchSpan: 8,
  705. searchOrder: 2,
  706. overHidden: true,
  707. type: "select",
  708. clearable: false,
  709. search: true,
  710. hide: true,
  711. // showColumn: false,
  712. dicData: [
  713. {
  714. label: "需采购",
  715. value: 0
  716. },
  717. {
  718. label: "已采购",
  719. value: 1
  720. }
  721. ],
  722. searchValue: 0
  723. }
  724. ]
  725. },
  726. dialogVisible: false,
  727. itemOption: {},
  728. itemOptionList: {
  729. align: "center",
  730. header: true,
  731. addBtn: false,
  732. border: true,
  733. menu: false,
  734. refreshBtn: false,
  735. column: [
  736. {
  737. label: "产品类别",
  738. prop: "priceCategory",
  739. width: 140,
  740. overHidden: true
  741. },
  742. {
  743. label: "产品名称",
  744. prop: "cname",
  745. width: 240,
  746. overHidden: true
  747. },
  748. {
  749. label: "产品描述",
  750. prop: "itemDescription",
  751. width: 240,
  752. overHidden: true
  753. },
  754. {
  755. label: "配件描述",
  756. prop: "partsDescribe",
  757. width: 240,
  758. overHidden: true
  759. },
  760. {
  761. label: "配件价格描述",
  762. prop: "partsPriceDescribe",
  763. width: 240,
  764. overHidden: true
  765. },
  766. {
  767. label: "数量",
  768. prop: "orderQuantity",
  769. width: 100,
  770. overHidden: true
  771. },
  772. {
  773. label: "单价",
  774. prop: "price",
  775. width: 100,
  776. overHidden: true
  777. },
  778. {
  779. label: "金额",
  780. prop: "amount",
  781. width: 100,
  782. overHidden: true
  783. }
  784. ]
  785. },
  786. form: {},
  787. option: {},
  788. optionBack: {
  789. searchShow: true,
  790. searchMenuSpan: 16,
  791. border: true,
  792. index: true,
  793. viewBtn: false,
  794. editBtn: false,
  795. delBtn: false,
  796. addBtn: false,
  797. headerAlign: "center",
  798. menuWidth: "120",
  799. searchLabelWidth: "90",
  800. searchIcon: true,
  801. searchIndex: 3,
  802. searchSpan: 6,
  803. expand: true,
  804. expandWidth: 38,
  805. selection: true,
  806. tip: false,
  807. column: [
  808. {
  809. label: "供应商",
  810. prop: "corpId",
  811. search: true,
  812. searchSpan: 8,
  813. // index: 1,
  814. minWidth: 120,
  815. overHidden: true
  816. },
  817. {
  818. label: "销售订单号",
  819. prop: "srcOrderNo",
  820. search: true,
  821. searchSpan: 8,
  822. // index: 3.1,
  823. minWidth: 120,
  824. overHidden: true
  825. },
  826. {
  827. label: "采购日期",
  828. prop: "businesDate",
  829. search: true,
  830. searchSpan: 8,
  831. // index: 2,
  832. minWidth: 90,
  833. overHidden: true,
  834. type: "date",
  835. format: "yyyy-MM-dd"
  836. },
  837. {
  838. label: "采购状态",
  839. prop: "fudaPurchaseStatus",
  840. // index: 2.1,
  841. minWidth: 80,
  842. overHidden: true
  843. },
  844. {
  845. label: "采购订单号",
  846. prop: "orderNo",
  847. search: true,
  848. searchSpan: 8,
  849. // index: 3,
  850. minWidth: 120,
  851. overHidden: true
  852. },
  853. {
  854. label: "预交日期",
  855. prop: "plannedDeliveryDate",
  856. search: true,
  857. searchSpan: 8,
  858. // index: 4,
  859. minWidth: 90,
  860. overHidden: true,
  861. type: "date",
  862. format: "yyyy-MM-dd"
  863. },
  864. {
  865. label: "实交日期",
  866. prop: "requiredDeliveryDate",
  867. search: true,
  868. searchSpan: 8,
  869. // index: 10,
  870. minWidth: 80,
  871. overHidden: true,
  872. type: "date",
  873. format: "yyyy-MM-dd"
  874. },
  875. {
  876. label: "付款方式",
  877. prop: "paymentType",
  878. // index: 10,
  879. minWidth: 80,
  880. search: true,
  881. searchSpan: 8,
  882. overHidden: true,
  883. type: "select",
  884. props: {
  885. label: "dictValue",
  886. value: "dictValue"
  887. }
  888. },
  889. {
  890. label: "采购金额",
  891. prop: "purchaseAmount",
  892. // index: 5,
  893. minWidth: 90,
  894. align: "right",
  895. overHidden: true
  896. },
  897. {
  898. label: "数量合计",
  899. prop: "orderQuantity",
  900. // index: 6,
  901. minWidth: 80,
  902. align: "right",
  903. overHidden: true
  904. },
  905. {
  906. label: "数量",
  907. prop: "storageQuantity",
  908. // index: 8.1,
  909. minWidth: 80,
  910. align: "right",
  911. overHidden: true,
  912. hide: true
  913. },
  914. {
  915. label: "采购数",
  916. prop: "purchaseQuantity",
  917. // index: 8.2,
  918. minWidth: 80,
  919. align: "right",
  920. overHidden: true
  921. },
  922. {
  923. label: "发货数",
  924. prop: "deliverQuantity",
  925. // index: 8.3,
  926. minWidth: 80,
  927. align: "right",
  928. overHidden: true
  929. },
  930. {
  931. label: "客户收货数",
  932. prop: "receiveQuantity",
  933. // index: 8.4,
  934. minWidth: 90,
  935. align: "right",
  936. overHidden: true
  937. },
  938. // {
  939. // label: "发货数量",
  940. // prop: "actualQuantity",
  941. // // index: 8.5,
  942. // minWidth: 80,
  943. // align: "right",
  944. // overHidden: true
  945. // },
  946. {
  947. label: "采购员",
  948. prop: "buyerName",
  949. // index: 8.51,
  950. minWidth: 80,
  951. overHidden: true
  952. },
  953. {
  954. label: "跟单员",
  955. prop: "documenterName",
  956. // index: 8.52,
  957. minWidth: 80,
  958. overHidden: true
  959. },
  960. {
  961. label: "采购日期",
  962. prop: "fudaPurchaseDate",
  963. // index: 8.54,
  964. minWidth: 80,
  965. overHidden: true
  966. },
  967. {
  968. label: "排产状态",
  969. prop: "productionScheduling",
  970. // index: 8.55,
  971. minWidth: 80,
  972. overHidden: true
  973. },
  974. {
  975. label: "排产日期",
  976. prop: "productionSchedulingDate",
  977. // index: 8.56,
  978. minWidth: 80,
  979. overHidden: true
  980. },
  981. {
  982. label: "预计货好状态",
  983. prop: "estimateGoodGoods",
  984. // index: 8.57,
  985. minWidth: 100,
  986. overHidden: true
  987. },
  988. {
  989. label: "预计货好日期",
  990. prop: "estimateGoodGoodsDate",
  991. // index: 8.58,
  992. minWidth: 100,
  993. overHidden: true
  994. },
  995. {
  996. label: "收货金额",
  997. prop: "",
  998. // index: 9,
  999. minWidth: 80,
  1000. align: "right",
  1001. overHidden: true
  1002. },
  1003. {
  1004. label: "收货数量",
  1005. prop: "actualQuantity",
  1006. // index: 10,
  1007. minWidth: 80,
  1008. align: "right",
  1009. overHidden: true
  1010. },
  1011. {
  1012. label: "系统号",
  1013. prop: "sysNo",
  1014. search: true,
  1015. // index: 11,
  1016. minWidth: 80,
  1017. overHidden: true,
  1018. searchSpan: 8
  1019. },
  1020. {
  1021. label: "制单人",
  1022. prop: "createUser",
  1023. // index: 12,
  1024. minWidth: 80,
  1025. search: true,
  1026. overHidden: true,
  1027. type: "select",
  1028. dicData: [],
  1029. props: {
  1030. label: "name",
  1031. value: "id"
  1032. },
  1033. filterable: true,
  1034. searchSpan: 8
  1035. },
  1036. {
  1037. label: "制单日期",
  1038. prop: "createTime",
  1039. // index: 13,
  1040. minWidth: 80,
  1041. search: true,
  1042. overHidden: true,
  1043. searchSpan: 8,
  1044. type: "date",
  1045. format: "yyyy-MM-dd"
  1046. },
  1047. {
  1048. label: "备注",
  1049. prop: "orderRemark",
  1050. // index: 8,
  1051. minWidth: 150,
  1052. overHidden: true,
  1053. search: true,
  1054. searchSpan: 8
  1055. }
  1056. ]
  1057. },
  1058. parentId: 0,
  1059. dataList: [],
  1060. treatPage: {
  1061. pageSize: 20,
  1062. currentPage: 1,
  1063. total: 0,
  1064. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  1065. },
  1066. page: {
  1067. pageSize: 20,
  1068. currentPage: 1,
  1069. total: 0,
  1070. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  1071. },
  1072. totalTwo: 0,
  1073. show: true,
  1074. detailData: {},
  1075. loading: false,
  1076. selectionList: [],
  1077. srcIds: null
  1078. };
  1079. },
  1080. components: { detailPage, reportDialog },
  1081. async created() {
  1082. this.option = await this.getColumnData(this.getColumnName(2), this.optionBack);
  1083. this.dialogOption = await this.getColumnData(this.getColumnName(2.1), this.dialogOptionList);
  1084. this.itemOption = await this.getColumnData(this.getColumnName(2.2), this.itemOptionList);
  1085. this.procureOption = await this.getColumnData(this.getColumnName(2.3), this.procureOptionList);
  1086. this.procurelistOption = await this.getColumnData(this.getColumnName(2.4), this.procurelistOptionList);
  1087. this.getWorkDicts("payment_term").then(res => {
  1088. this.findObject(this.option.column, "paymentType").dicData = res.data.data;
  1089. });
  1090. gainUser().then(res => {
  1091. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  1092. });
  1093. // 判断是否是采购员 权限
  1094. if (JSON.parse(localStorage.getItem("saber-userInfo")).content.role_name.indexOf("采购") != -1) {
  1095. this.findObject(this.procureOption.column, "buyerName").hide = false;
  1096. }
  1097. this.option.height = window.innerHeight - 210;
  1098. this.listBYStatusfun(this.treatPage); // 获取待采购数据
  1099. },
  1100. filters: {
  1101. IntegerFormat(num) {
  1102. return IntegerFormat(num);
  1103. },
  1104. decimalFormat2(num) {
  1105. return decimalFormat2(num);
  1106. }
  1107. },
  1108. activated() {
  1109. if (this.$route.query.check) {
  1110. this.detailData = {
  1111. check: this.$route.query.check,
  1112. id: this.$route.query.check.billId
  1113. };
  1114. this.show = false;
  1115. this.$store.commit("IN_CG_STATUS");
  1116. }
  1117. },
  1118. methods: {
  1119. openReports(row) {
  1120. this.switchDialogs = !this.switchDialogs;
  1121. this.srcIds = row.srcIds;
  1122. },
  1123. onCloses(val) {
  1124. this.switchDialogs = val;
  1125. this.srcIds = null;
  1126. },
  1127. handleClick() {
  1128. if (this.tabsName == "second") {
  1129. this.tabType = 1;
  1130. } else if (this.tabsName == "third") {
  1131. this.tabType = 2;
  1132. } else if (this.tabsName == "fourth") {
  1133. this.tabType = "";
  1134. }
  1135. this.onLoad(this.page, this.search);
  1136. },
  1137. // 采购任务弹窗打开
  1138. caigorenwufun() {
  1139. this.dialogVisible = true;
  1140. this.listBYStatusfun(this.treatPage); // 获取待采购数据
  1141. },
  1142. // 获取待采购数据
  1143. listBYStatusfun(page) {
  1144. listBYStatus({
  1145. size: page.pageSize,
  1146. current: page.currentPage
  1147. }).then(res => {
  1148. for (let item of res.data.data.records) {
  1149. // 公司
  1150. companyDetail(item.belongToCorpId).then(re => {
  1151. item.belongToCorpName = re.data.data.cname;
  1152. });
  1153. // 用户
  1154. nameUser(item.createUser).then(re => {
  1155. item.createUserName = re.data.data.name;
  1156. });
  1157. }
  1158. this.procureData = res.data.data.records;
  1159. this.treatPage.total = res.data.data.total;
  1160. this.treeData = res.data.data.records;
  1161. });
  1162. },
  1163. // 获取待采购弹窗列表数据
  1164. procureViewfun(row) {
  1165. this.procurelistData = [];
  1166. this.procureOnLoad(row.id);
  1167. this.procureVisible = true;
  1168. },
  1169. outExport() {
  1170. let config = { params: { ...this.params } };
  1171. if (config.params) {
  1172. for (const propName of Object.keys(config.params)) {
  1173. const value = config.params[propName];
  1174. if (value !== null && typeof value !== "undefined") {
  1175. if (value instanceof Array) {
  1176. for (const key of Object.keys(value)) {
  1177. let params = propName + "[" + key + "]";
  1178. config.params[params] = value[key];
  1179. }
  1180. delete config.params[propName];
  1181. }
  1182. }
  1183. }
  1184. }
  1185. const routeData = this.$router.resolve({
  1186. path: "/api/blade-purchase-sales/exportOrder/listXSExport", //跳转目标窗口的地址
  1187. query: {
  1188. ...config.params //括号内是要传递给新窗口的参数
  1189. }
  1190. });
  1191. window.open(routeData.href.slice(1, routeData.href.length) + "&" + `${this.website.tokenHeader}=${getToken()}`);
  1192. },
  1193. nodeClick(data) {
  1194. this.params.pid = data.id;
  1195. this.dialogPage.currentPage = 1;
  1196. this.dialogOnLoad(this.dialogPage);
  1197. },
  1198. removeStagList(row, index) {
  1199. this.goodsListSave.splice(row.$index, 1);
  1200. },
  1201. searchCriteriaSwitch(type) {
  1202. if (type) {
  1203. this.option.height = this.option.height - 139;
  1204. } else {
  1205. this.option.height = this.option.height + 139;
  1206. }
  1207. this.$refs.crud.getTableHeight();
  1208. },
  1209. cellStyle() {
  1210. return "padding:0;height:40px;";
  1211. },
  1212. //删除列表后面的删除按钮触发触发(row, index, done)
  1213. rowDel(row, index, done) {
  1214. this.$confirm("确定删除数据?", {
  1215. confirmButtonText: "确定",
  1216. cancelButtonText: "取消",
  1217. type: "warning"
  1218. }).then(() => {
  1219. remove(row.id).then(res => {
  1220. if (res.data.code == 200) {
  1221. this.$message({
  1222. type: "success",
  1223. message: "删除成功!"
  1224. });
  1225. this.onLoad(this.page, this.search);
  1226. }
  1227. });
  1228. });
  1229. },
  1230. selectionChange(list) {
  1231. this.selectionList = list;
  1232. },
  1233. // 采购任务弹窗增加多选
  1234. dialogSelectionChange(list) {
  1235. this.goodsListSave = list;
  1236. },
  1237. //行展开数据
  1238. expandChange(row) {
  1239. if (!row.itemData) {
  1240. getGoodsInfo({ id: row.id, tradeType: "CK" })
  1241. .then(res => {
  1242. this.dataList[row.$index].itemData = res.data.data;
  1243. })
  1244. .finally(() => {
  1245. this.dataList[row.$index].itemLoading = false;
  1246. });
  1247. }
  1248. },
  1249. copyDoc() {
  1250. this.selectionList.forEach(e => {
  1251. this.detailData = {
  1252. id: e.id,
  1253. status: "copy"
  1254. };
  1255. this.show = false;
  1256. });
  1257. },
  1258. copyOrder(id) {
  1259. this.show = true;
  1260. this.detailData = {
  1261. id: id,
  1262. status: "copy"
  1263. };
  1264. this.$nextTick(() => {
  1265. this.show = false;
  1266. });
  1267. },
  1268. editOpen(row, status) {
  1269. this.detailData = {
  1270. id: row.id,
  1271. status: status
  1272. };
  1273. this.show = false;
  1274. },
  1275. //点击搜索按钮触发
  1276. searchChange(params, done) {
  1277. if (params.businesDate) {
  1278. params.businesStartDate = params.businesDate[0];
  1279. params.businesEndDate = params.businesDate[1];
  1280. }
  1281. if (params.requiredDeliveryDate) {
  1282. params.requiredDeliveryStartDate = params.requiredDeliveryDate[0];
  1283. params.requiredDeliveryEndDate = params.requiredDeliveryDate[1];
  1284. }
  1285. delete params.businesDate;
  1286. delete params.requiredDeliveryDate;
  1287. this.page.currentPage = 1;
  1288. this.onLoad(this.page, params);
  1289. done();
  1290. },
  1291. currentChange(val) {
  1292. this.page.currentPage = val;
  1293. },
  1294. sizeChange(val) {
  1295. this.page.currentPage = 1;
  1296. this.page.pageSize = val;
  1297. },
  1298. // 标签页切换
  1299. tabHandle(data) {
  1300. if (data.name == "searchList") {
  1301. this.dialogData = this.goodsListShow;
  1302. this.dialogPage.total = this.totalTwo;
  1303. } else if (data.name == "importStaging") {
  1304. this.goodsListShow = this.dialogData;
  1305. this.dialogData = this.goodsListSave;
  1306. this.totalTwo = this.dialogPage.total;
  1307. this.dialogPage.total = 0;
  1308. }
  1309. },
  1310. // 采购任务弹窗列表选择按钮
  1311. importStagList(row, index) {
  1312. this.goodsListSave.push(row);
  1313. },
  1314. allClick(name) {
  1315. if (name == "全选") {
  1316. this.dialogData.forEach(item => {
  1317. if (this.goodsListSave.filter(e => item.id == e.id).length == 0) {
  1318. this.goodsListSave.push(item);
  1319. }
  1320. });
  1321. }
  1322. },
  1323. // 采购任务弹窗列表刷新
  1324. refreshChangeTwo() {
  1325. this.dialogOnLoad(this.page);
  1326. },
  1327. searchChangeTwo(params, done) {
  1328. done();
  1329. if (!this.params.pid && !this.params.billNo) {
  1330. return this.$message.error("请选择左边单号或输入销售单号");
  1331. } else {
  1332. this.dialogOnLoad(this.page);
  1333. }
  1334. },
  1335. searchReset() {
  1336. this.avueTree = !this.avueTree;
  1337. this.params.showAll = 0;
  1338. this.$refs.singleTable.setCurrentRow([]);
  1339. this.dialogData = [];
  1340. },
  1341. //自定义列保存
  1342. async saveColumnTwo(ref, option, optionBack, code) {
  1343. /**
  1344. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1345. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1346. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1347. */
  1348. console.log(875);
  1349. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1350. if (inSave) {
  1351. this.$message.success("保存成功");
  1352. //关闭窗口
  1353. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1354. }
  1355. },
  1356. //自定义列重置
  1357. async resetColumnTwo(ref, option, optionBack, code) {
  1358. this[option] = this[optionBack];
  1359. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1360. if (inSave) {
  1361. this.$message.success("重置成功");
  1362. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1363. }
  1364. },
  1365. openReport() {
  1366. this.switchDialog = !this.switchDialog;
  1367. },
  1368. onClose(val) {
  1369. this.switchDialog = val;
  1370. },
  1371. confirmImport() {
  1372. let ids = this.goodsListSave.map(item => {
  1373. return item.id;
  1374. });
  1375. const loading = this.$loading({
  1376. lock: true,
  1377. text: "加载中",
  1378. spinner: "el-icon-loading",
  1379. background: "rgba(255,255,255,0.7)"
  1380. });
  1381. generatePurchaseBill(this.goodsListSave)
  1382. .then(res => {
  1383. this.$message.success("导入成功");
  1384. console.log(res, 629);
  1385. for (let item of res.data.data.orderItemsList) {
  1386. getGoods(1, 10, null, { cname: item.cname }).then(res => {
  1387. item.price = res.data.data.records[0].displayPrice;
  1388. });
  1389. }
  1390. this.detailData = {
  1391. form: res.data.data
  1392. };
  1393. loading.close();
  1394. this.procureVisible = false; // 待采购弹窗关闭
  1395. this.dialogVisible = false; // 采购任务弹窗关闭
  1396. this.activeName = "searchList";
  1397. setTimeout(() => {
  1398. this.show = false;
  1399. }, 200);
  1400. })
  1401. .catch(() => {
  1402. loading.close();
  1403. });
  1404. },
  1405. // 采购任务列表获取数据
  1406. dialogOnLoad(page, params) {
  1407. this.dialogLoading = true;
  1408. params = {
  1409. ...params,
  1410. size: page.pageSize,
  1411. current: page.currentPage,
  1412. ...this.params
  1413. };
  1414. if (this.params.pid || this.params.billNo) {
  1415. listXS(params).then(res => {
  1416. this.dialogLoading = false;
  1417. this.dialogData = res.data.data;
  1418. // this.dialogPage.total = res.data.data.total
  1419. });
  1420. }
  1421. },
  1422. // 待采购列表获取数据
  1423. procureOnLoad(id) {
  1424. let params = {
  1425. size: 20,
  1426. current: 1,
  1427. showAll: 0,
  1428. pid: id
  1429. };
  1430. listXS(params).then(res => {
  1431. this.procurelistData = res.data.data;
  1432. });
  1433. },
  1434. onLoad(page, params) {
  1435. if (this.search.businesDate && this.search.businesDate.length > 0) {
  1436. params = {
  1437. ...params,
  1438. orderStartDate: this.search.businesDate[0],
  1439. orderEndDate: this.search.businesDate[1]
  1440. };
  1441. delete params.businesDate;
  1442. }
  1443. if (this.search.requiredDeliveryDate && this.search.requiredDeliveryDate.length > 0) {
  1444. params = {
  1445. ...params,
  1446. requiredDeliveryStartDate: this.search.requiredDeliveryDate[0],
  1447. requiredDeliveryEndDate: this.search.requiredDeliveryDate[1]
  1448. };
  1449. delete params.requiredDeliveryDate;
  1450. }
  1451. params = {
  1452. ...params,
  1453. tabType: this.tabType
  1454. };
  1455. this.loading = true;
  1456. this.dataList.forEach(item => {
  1457. this.$refs.crud.toggleRowExpansion(item, false);
  1458. });
  1459. getList(page.currentPage, page.pageSize, params)
  1460. .then(res => {
  1461. if (res.data.data.records) {
  1462. res.data.data.records.forEach(e => {
  1463. e.itemLoading = true;
  1464. });
  1465. }
  1466. this.dataList = res.data.data.records ? res.data.data.records : [];
  1467. this.page.total = res.data.data.total;
  1468. })
  1469. .finally(() => {
  1470. this.loading = false;
  1471. });
  1472. },
  1473. refreshChange() {
  1474. this.onLoad(this.page, this.search);
  1475. },
  1476. newAdd(type) {
  1477. this.detailData = {
  1478. pageType: type
  1479. };
  1480. this.show = false;
  1481. },
  1482. goBack() {
  1483. this.detailData = this.$options.data().detailData;
  1484. this.show = true;
  1485. this.onLoad(this.page, this.search);
  1486. },
  1487. //自定义列保存
  1488. async saveColumn(ref, option, optionBack, code) {
  1489. /**
  1490. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1491. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1492. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1493. */
  1494. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1495. if (inSave) {
  1496. this.$message.success("保存成功");
  1497. //关闭窗口
  1498. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1499. }
  1500. },
  1501. //自定义列重置
  1502. async resetColumn(ref, option, optionBack, code) {
  1503. this[option] = this[optionBack];
  1504. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1505. if (inSave) {
  1506. this.$message.success("重置成功");
  1507. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1508. }
  1509. },
  1510. handleCurrentChange(val) {
  1511. console.log(val);
  1512. // this.currentRow = val;
  1513. this.params.pid = val.id;
  1514. this.dialogPage.currentPage = 1;
  1515. this.dialogOnLoad(this.dialogPage);
  1516. }
  1517. },
  1518. watch: {
  1519. option: function() {
  1520. this.search.businesDate = defaultDate(5);
  1521. },
  1522. dialogVisible: function() {
  1523. this.goodsListShow = [];
  1524. this.goodsListSave = [];
  1525. this.totalTwo = 0;
  1526. this.dialogData = [];
  1527. listBYStatus({}).then(res => {
  1528. this.treeData = res.data.data;
  1529. });
  1530. this.dialogOnLoad(this.page);
  1531. }
  1532. }
  1533. };
  1534. </script>
  1535. <style scoped>
  1536. ::v-deep .select-component {
  1537. display: flex;
  1538. }
  1539. .page-crad ::v-deep .basic-container__card {
  1540. //height: 94.2vh;
  1541. height: 100vh;
  1542. }
  1543. .itemTable ::v-deep .el-table {
  1544. margin-left: 50px;
  1545. width: 100%;
  1546. }
  1547. /deep/ .el-col-md-8 {
  1548. width: 24.33333%;
  1549. }
  1550. </style>