index.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <el-tabs v-model="tabsType" 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-tabs>
  8. <avue-crud v-show="tabsType == 'first'" :option="procureOption" :data="procureData" @refresh-change="listBYStatusfun" >
  9. <template slot-scope="scope" slot="menu">
  10. <el-button type="text" size="small"
  11. @click.stop="procureViewfun(scope.row)">采购
  12. </el-button>
  13. </template>
  14. </avue-crud>
  15. <avue-crud v-show="tabsType == 'second'"
  16. ref="crud" :option="option" :data="dataList" v-model="form" :page.sync="page" :search.sync="search"
  17. @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  18. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  19. @resetColumn="resetColumn" :cell-style="cellStyle" @selection-change="selectionChange"
  20. @expand-change="expandChange" @search-criteria-switch="searchCriteriaSwitch">
  21. <template slot-scope="{ row }" slot="expand">
  22. <avue-crud ref="itemCrud" :data="row.itemData" :option="itemOption" :table-loading="row.itemLoading"
  23. @resetColumn="resetColumnTwo('itemCrud', 'itemOption', 'itemOptionList', 2.2)"
  24. @saveColumn="saveColumnTwo('itemCrud', 'itemOption', 'itemOptionList', 2.2)"
  25. :cell-style="cellStyle" class="itemTable"></avue-crud>
  26. </template>
  27. <template slot="createTimeSearch">
  28. <el-date-picker v-model="search.createTime" type="daterange" start-placeholder="开始日期"
  29. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
  30. :default-time="['00:00:00', '23:59:59']">
  31. </el-date-picker>
  32. </template>
  33. <template slot="menuLeft">
  34. <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="newAdd('new')">创建单据
  35. </el-button>
  36. <el-button type="success" size="small" @click.stop="copyDoc()"
  37. :disabled="selectionList.length != 1">复制单据
  38. </el-button>
  39. <el-button type="info" size="small" disabled>报表打印</el-button>
  40. <el-button type="warning" size="small" @click="dialogVisible = true;">采购任务</el-button>
  41. </template>
  42. <template slot="corpIdSearch">
  43. <crop-select v-model="search.corpId" corpType="KH"></crop-select>
  44. </template>
  45. <template slot="businesDateSearch">
  46. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期"
  47. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
  48. :default-time="['00:00:00', '23:59:59']">
  49. </el-date-picker>
  50. </template>
  51. <template slot="plannedDeliveryDateSearch">
  52. <el-date-picker v-model="search.plannedDeliveryDate" type="daterange" start-placeholder="开始日期"
  53. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
  54. :default-time="['00:00:00', '23:59:59']">
  55. </el-date-picker>
  56. </template>
  57. <template slot="requiredDeliveryDateSearch">
  58. <el-date-picker v-model="search.requiredDeliveryDate" type="daterange" start-placeholder="开始日期"
  59. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
  60. :default-time="['00:00:00', '23:59:59']">
  61. </el-date-picker>
  62. </template>
  63. <template slot-scope="scope" slot="corpId">
  64. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(scope.row, 1)">{{
  65. scope.row.strCorpName }}
  66. </span>
  67. </template>
  68. <template slot-scope="scope" slot="srcOrderNo">
  69. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(scope.row, 1)">{{ scope.row.srcOrderNo }}</span>
  70. </template>
  71. <template slot-scope="scope" slot="fudaPurchaseStatus">
  72. <span class="el-button--text">
  73. {{ scope.row.fudaPurchaseStatus }}
  74. </span>
  75. </template>
  76. <template slot-scope="scope" slot="fudaPurchaseDate">
  77. <span class="el-button--text">
  78. {{ scope.row.fudaPurchaseDate }}
  79. </span>
  80. </template>
  81. <template slot-scope="scope" slot="productionScheduling">
  82. <span class="el-button--text">
  83. {{ scope.row.productionScheduling }}
  84. </span>
  85. </template>
  86. <template slot-scope="scope" slot="createUser">
  87. {{ scope.row.createUserName }}
  88. </template>
  89. <template slot-scope="{ row }" slot="orderQuantity">
  90. <span>{{ row.orderQuantity | IntegerFormat }}</span>
  91. </template>
  92. <template slot-scope="scope" slot="menu">
  93. <el-button type="text" icon="el-icon-delete" size="small"
  94. @click.stop="rowDel(scope.row, scope.index)">删除
  95. </el-button>
  96. </template>
  97. </avue-crud>
  98. </basic-container>
  99. <detail-page @goBack="goBack" @copyOrder="copyOrder" :detailData="detailData" v-if="!show"></detail-page>
  100. <el-dialog title="导入采购任务" v-if="dialogVisible" :visible.sync="dialogVisible" append-to-body
  101. :close-on-click-modal="false" :close-on-press-escape="false" :before-close="function () {
  102. dialogVisible = false; params = {}
  103. }" top="1vh" width="90%">
  104. <span>
  105. <el-row>
  106. <el-col :span="6" style="padding: 0 10px">
  107. <el-scrollbar>
  108. <!-- <avue-tree :option="treeOption" :key="avueTree" :data="treeData" @node-click="nodeClick"/>-->
  109. <!-- {{ treeData }}-->
  110. <el-table style="width: 100%" border size="mini" ref="singleTable" highlight-current-row
  111. @current-change="handleCurrentChange" :data="treeData">
  112. <el-table-column prop="orderNo" show-overflow-tooltip align="center" label="销售单号">
  113. </el-table-column>
  114. <el-table-column prop="plannedDeliveryDate" show-overflow-tooltip width="105" align="center"
  115. label="交货日期">
  116. <template slot-scope="{row}">
  117. {{ row.plannedDeliveryDate ? row.plannedDeliveryDate.slice(0, 10) : '' }}
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. </el-scrollbar>
  122. </el-col>
  123. <el-col :span="18">
  124. <!-- :page.sync="dialogPage"-->
  125. <avue-crud :data="dialogData" :option="dialogOption" :search.sync="params" ref="dialogCrud"
  126. @resetColumn="resetColumnTwo('dialogCrud', 'dialogOption', 'dialogOptionList', 2.1)"
  127. @saveColumn="saveColumnTwo('dialogCrud', 'dialogOption', 'dialogOptionList', 2.1)"
  128. @refresh-change="refreshChangeTwo" @search-change="searchChangeTwo" @search-reset="searchReset"
  129. @selection-change="dialogSelectionChange"
  130. @on-load="dialogOnLoad">
  131. <template slot="menuLeft">
  132. <el-tabs v-model="activeName" @tab-click="tabHandle">
  133. <el-tab-pane label="查询结果" name="searchList" />
  134. <el-tab-pane label="已选定数据" name="importStaging" />
  135. </el-tabs>
  136. </template>
  137. <template slot="corpNameSearch">
  138. <crop-select v-model="params.corpId" corpType="GYS" />
  139. </template>
  140. <template slot="actualQuantity" slot-scope="scope">
  141. <el-input-number v-if="activeName === 'importStaging'" v-model="scope.row.actualQuantity"
  142. :precision="2" :min="0.01" :controls="false"></el-input-number>
  143. <span v-else>{{ scope.row.actualQuantity }}</span>
  144. </template>
  145. <template slot-scope="scope" slot="menu">
  146. <el-button type="text" icon="el-icon-edit" size="small"
  147. @click.stop="importStagList(scope.row, scope.index)" v-if="activeName == 'searchList'"
  148. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
  149. </el-button>
  150. <el-button type="text" icon="el-icon-delete" size="small"
  151. @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
  152. </el-button>
  153. </template>
  154. </avue-crud>
  155. </el-col>
  156. </el-row>
  157. </span>
  158. <span slot="footer" class="dialog-footer">
  159. <!-- <el-button type="warning" @click="outExport">导出</el-button>-->
  160. <el-button type="warning" @click="openReport">导出</el-button>
  161. <el-button @click="dialogVisible = false; params = {}">取 消</el-button>
  162. <el-button type="primary" :disabled="goodsListSave.length === 0" @click="confirmImport">导 入</el-button>
  163. </span>
  164. </el-dialog>
  165. <report-dialog :switchDialog="switchDialog" :reportId="params.pid" reportName="出口贸易-采购"
  166. @onClose="onClose()"></report-dialog>
  167. <el-dialog title="导入采购任务" :visible.sync="procureVisible" append-to-body>
  168. <avue-crud :data="procurelistData" :option="procurelistOption" :search.sync="params" ref="dialogCrud"
  169. @refresh-change="refreshChangeTwo">
  170. <template slot="menuLeft">
  171. <el-tabs v-model="activeName" @tab-click="tabHandle">
  172. <el-tab-pane label="查询结果" name="searchList" />
  173. <el-tab-pane label="已选定数据" name="importStaging" />
  174. </el-tabs>
  175. </template>
  176. <template slot="corpNameSearch">
  177. <crop-select v-model="params.corpId" corpType="GYS" />
  178. </template>
  179. <template slot="actualQuantity" slot-scope="scope">
  180. <el-input-number v-if="activeName === 'importStaging'" v-model="scope.row.actualQuantity"
  181. :precision="2" :min="0.01" :controls="false"></el-input-number>
  182. <span v-else>{{ scope.row.actualQuantity }}</span>
  183. </template>
  184. <template slot-scope="scope" slot="menu">
  185. <el-button type="text" icon="el-icon-edit" size="small"
  186. @click.stop="importStagList(scope.row, scope.index)" v-if="activeName == 'searchList'"
  187. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
  188. </el-button>
  189. <el-button type="text" icon="el-icon-delete" size="small"
  190. @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
  191. </el-button>
  192. </template>
  193. </avue-crud>
  194. <span slot="footer" class="dialog-footer">
  195. <!-- <el-button type="warning" @click="outExport">导出</el-button>-->
  196. <el-button type="warning" @click="openReport">导出</el-button>
  197. <el-button @click="procureVisible = false;">取 消</el-button>
  198. <el-button type="primary" :disabled="goodsListSave.length === 0" @click="confirmImport">导 入</el-button>
  199. </span>
  200. </el-dialog>
  201. </div>
  202. </template>
  203. <script>
  204. import option from "./config/mainList.json";
  205. import reportDialog from "@/components/report-dialog/main";
  206. import {
  207. getList,
  208. remove,
  209. gainUser,
  210. listXS,
  211. generatePurchaseBill,
  212. listBYStatus,
  213. getGoodsInfo, getGoods
  214. } from "@/api/exportTrade/purchaseContract";
  215. import detailPage from "./detailsPage.vue";
  216. import { defaultDate } from "@/util/date";
  217. import { IntegerFormat } from "@/util/validate";
  218. import { customerParameter } from "@/enums/management-type";
  219. import { getToken } from "@/util/auth";
  220. import {customerList} from "@/api/basicData/customerInformation";
  221. import { detail as companyDetail } from "@/api/basicData/customerInformation"
  222. import {getUser as nameUser} from "@/api/system/user"
  223. export default {
  224. name: "customerInformation",
  225. data() {
  226. return {
  227. tabsType:'first',
  228. procureData:[], // 待采购数据
  229. // 待采购配置
  230. procureOption:{
  231. searchShow: true,
  232. searchMenuSpan: 8,
  233. border: true,
  234. index: true,
  235. viewBtn: false,
  236. editBtn: false,
  237. delBtn: false,
  238. addBtn: false,
  239. menuWidth: "100",
  240. headerAlign: "center",
  241. searchIcon: false,
  242. searchIndex: 2,
  243. column: [{
  244. label: "销售单号",
  245. prop: "orderNo",
  246. overHidden: true
  247. },{
  248. label: "交货日期",
  249. prop: "plannedDeliveryDate",
  250. overHidden: true
  251. },{
  252. label: "公司主体",
  253. prop: "belongToCorpName",
  254. overHidden: true
  255. },{
  256. label: "公司主体",
  257. prop: "belongToCorpId",
  258. hide:true,
  259. overHidden: true
  260. },{
  261. label: "制单人",
  262. prop: "createUserName",
  263. overHidden: true
  264. },{
  265. label: "制单人",
  266. prop: "createUser",
  267. hide:true,
  268. overHidden: true
  269. },{
  270. label: "制单日期",
  271. prop: "createTime",
  272. overHidden: true
  273. }]
  274. },
  275. procureVisible:false, // 待采购弹窗
  276. procurelistData:[], // 待采购弹窗列表数据
  277. // 待采购弹窗待配置
  278. procurelistOption: {
  279. searchShow: true,
  280. searchMenuSpan: 8,
  281. border: true,
  282. index: true,
  283. viewBtn: false,
  284. editBtn: false,
  285. delBtn: false,
  286. addBtn: false,
  287. menuWidth: "100",
  288. headerAlign: "center",
  289. searchIcon: false,
  290. searchIndex: 2,
  291. tip: false,
  292. column: [{
  293. label: "销售单号",
  294. prop: "billNo",
  295. searchSpan: 8,
  296. searchOrder: 1,
  297. overHidden: true
  298. }, {
  299. label: "销售日期",
  300. prop: "businesDate",
  301. searchProp: "businesDateList",
  302. width: 100,
  303. type: "date",
  304. searchSpan: 8,
  305. searchRange: true,
  306. searchDefaultTime: ["00:00:00", "23:59:59"],
  307. format: "yyyy-MM-dd",
  308. valueFormat: "yyyy-MM-dd HH:mm:ss",
  309. overHidden: true
  310. }, {
  311. label: "供应商",
  312. prop: "corpName",
  313. searchSpan: 8,
  314. overHidden: true
  315. }, {
  316. label: "交货日期",
  317. prop: "plannedDeliveryDate",
  318. searchProp: "plannedDeliveryDateList",
  319. width: 100,
  320. type: "date",
  321. searchSpan: 8,
  322. searchRange: true,
  323. searchDefaultTime: ["00:00:00", "23:59:59"],
  324. format: "yyyy-MM-dd",
  325. valueFormat: "yyyy-MM-dd HH:mm:ss",
  326. overHidden: true
  327. }, {
  328. label: "采购员",
  329. prop: "carry",
  330. overHidden: true
  331. }, {
  332. label: "产品名称",
  333. prop: "cname",
  334. overHidden: true
  335. }, {
  336. label: "产品编号",
  337. prop: "code",
  338. overHidden: true
  339. }, {
  340. label: "产品类别",
  341. prop: "priceCategory",
  342. overHidden: true
  343. }, {
  344. label: "产品型号",
  345. prop: "itemType",
  346. overHidden: true
  347. }, {
  348. label: "数量",
  349. prop: "orderQuantity"
  350. }, {
  351. label: "已采购数",
  352. prop: "purchaseQuantity",
  353. overHidden: true
  354. }, {
  355. label: "待采数",
  356. prop: "actualQuantity",
  357. overHidden: true
  358. }, {
  359. label: "螺纹",
  360. prop: "remarksOne",
  361. overHidden: true
  362. }, {
  363. label: "介质",
  364. prop: "customTwo",
  365. overHidden: true
  366. }, {
  367. label: "颜色",
  368. prop: "customThree",
  369. overHidden: true
  370. }, {
  371. label: "电压",
  372. prop: "customFour",
  373. overHidden: true
  374. }, {
  375. label: "显示全部",
  376. prop: "showAll",
  377. searchSpan: 8,
  378. searchOrder: 2,
  379. overHidden: true,
  380. type: "select",
  381. clearable: false,
  382. hide: true,
  383. showColumn: false,
  384. dicData: [{
  385. label: '需采购',
  386. value: 0
  387. }, {
  388. label: '已采购',
  389. value: 1
  390. }],
  391. searchValue: 0
  392. }]
  393. },
  394. switchDialog: false,
  395. search: {
  396. // businesDate: defaultDate()
  397. // businesDate: ''
  398. },
  399. treeData: [],
  400. avueTree: false,
  401. treeOption: {
  402. nodeKey: "id",
  403. lazy: true,
  404. treeLoad: function (node, resolve) {
  405. listBYStatus({}).then(res => {
  406. resolve(
  407. res.data.data.map(item => {
  408. return {
  409. ...item,
  410. leaf: !item.hasChildren
  411. };
  412. })
  413. );
  414. });
  415. },
  416. addBtn: false,
  417. menu: false,
  418. size: "small",
  419. props: {
  420. labelText: "标题",
  421. label: "orderNo",
  422. value: "id",
  423. children: "children"
  424. }
  425. },
  426. dialogData: [],
  427. goodsListShow: [],
  428. goodsListSave: [],
  429. params: {},
  430. dialogPage: {
  431. pageSize: 20,
  432. currentPage: 1,
  433. total: 0,
  434. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  435. },
  436. activeName: 'searchList',
  437. dialogOption: {},
  438. dialogOptionList: {
  439. searchShow: true,
  440. searchMenuSpan: 8,
  441. border: true,
  442. index: true,
  443. viewBtn: false,
  444. editBtn: false,
  445. delBtn: false,
  446. addBtn: false,
  447. menuWidth: "100",
  448. headerAlign: "center",
  449. searchIcon: false,
  450. searchIndex: 2,
  451. tip: false,
  452. selection:true,
  453. column: [{
  454. label: "销售单号",
  455. prop: "billNo",
  456. search: true,
  457. searchSpan: 8,
  458. searchOrder: 1,
  459. overHidden: true
  460. }, {
  461. label: "销售日期",
  462. prop: "businesDate",
  463. searchProp: "businesDateList",
  464. width: 100,
  465. type: "date",
  466. searchSpan: 8,
  467. searchRange: true,
  468. search: true,
  469. searchDefaultTime: ["00:00:00", "23:59:59"],
  470. format: "yyyy-MM-dd",
  471. valueFormat: "yyyy-MM-dd HH:mm:ss",
  472. overHidden: true
  473. }, {
  474. label: "供应商",
  475. prop: "corpName",
  476. searchSpan: 8,
  477. search: true,
  478. overHidden: true
  479. }, {
  480. label: "交货日期",
  481. prop: "plannedDeliveryDate",
  482. searchProp: "plannedDeliveryDateList",
  483. width: 100,
  484. type: "date",
  485. searchSpan: 8,
  486. searchRange: true,
  487. search: true,
  488. searchDefaultTime: ["00:00:00", "23:59:59"],
  489. format: "yyyy-MM-dd",
  490. valueFormat: "yyyy-MM-dd HH:mm:ss",
  491. overHidden: true
  492. }, {
  493. label: "采购员",
  494. prop: "carry",
  495. overHidden: true
  496. }, {
  497. label: "产品名称",
  498. prop: "cname",
  499. overHidden: true
  500. }, {
  501. label: "产品编号",
  502. prop: "code",
  503. overHidden: true
  504. }, {
  505. label: "产品类别",
  506. prop: "priceCategory",
  507. overHidden: true
  508. }, {
  509. label: "产品型号",
  510. prop: "itemType",
  511. overHidden: true
  512. }, {
  513. label: "数量",
  514. prop: "orderQuantity"
  515. }, {
  516. label: "已采购数",
  517. prop: "purchaseQuantity",
  518. overHidden: true
  519. }, {
  520. label: "待采数",
  521. prop: "actualQuantity",
  522. overHidden: true
  523. }, {
  524. label: "螺纹",
  525. prop: "remarksOne",
  526. overHidden: true
  527. }, {
  528. label: "介质",
  529. prop: "customTwo",
  530. overHidden: true
  531. }, {
  532. label: "颜色",
  533. prop: "customThree",
  534. overHidden: true
  535. }, {
  536. label: "电压",
  537. prop: "customFour",
  538. overHidden: true
  539. }, {
  540. label: "显示全部",
  541. prop: "showAll",
  542. searchSpan: 8,
  543. searchOrder: 2,
  544. overHidden: true,
  545. type: "select",
  546. clearable: false,
  547. search: true,
  548. hide: true,
  549. showColumn: false,
  550. dicData: [{
  551. label: '需采购',
  552. value: 0
  553. }, {
  554. label: '已采购',
  555. value: 1
  556. }],
  557. searchValue: 0
  558. }]
  559. },
  560. dialogVisible: false,
  561. itemOption:{},
  562. itemOptionList: {
  563. align: "center",
  564. header: true,
  565. addBtn:false,
  566. border: true,
  567. menu: false,
  568. refreshBtn:false,
  569. column: [
  570. {
  571. label: "产品类别",
  572. prop: "priceCategory",
  573. width: 140,
  574. overHidden: true
  575. },
  576. {
  577. label: "产品名称",
  578. prop: "cname",
  579. width: 240,
  580. overHidden: true
  581. },
  582. {
  583. label: "产品描述",
  584. prop: "itemDescription",
  585. width: 240,
  586. overHidden: true
  587. },
  588. {
  589. label: "配件描述",
  590. prop: "partsDescribe",
  591. width: 240,
  592. overHidden: true
  593. },
  594. {
  595. label: "配件价格描述",
  596. prop: "partsPriceDescribe",
  597. width: 240,
  598. overHidden: true
  599. },
  600. {
  601. label: "数量",
  602. prop: "orderQuantity",
  603. width: 100,
  604. overHidden: true
  605. },
  606. {
  607. label: "单价",
  608. prop: "price",
  609. width: 100,
  610. overHidden: true
  611. },
  612. {
  613. label: "金额",
  614. prop: "amount",
  615. width: 100,
  616. overHidden: true
  617. }
  618. ]
  619. },
  620. form: {},
  621. option: {},
  622. parentId: 0,
  623. dataList: [],
  624. page: {
  625. pageSize: 20,
  626. currentPage: 1,
  627. total: 0,
  628. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  629. },
  630. totalTwo: 0,
  631. show: true,
  632. detailData: {},
  633. loading: false,
  634. selectionList: []
  635. };
  636. },
  637. components: { detailPage, reportDialog },
  638. async created() {
  639. this.option = await this.getColumnData(this.getColumnName(2), option);
  640. this.dialogOption = await this.getColumnData(this.getColumnName(2.1), this.dialogOptionList);
  641. this.itemOption = await this.getColumnData(this.getColumnName(2.2), this.itemOptionList);
  642. this.getWorkDicts("payment_term").then(res => {
  643. this.findObject(this.option.column, "paymentType").dicData = res.data.data;
  644. });
  645. gainUser().then(res => {
  646. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  647. });
  648. this.option.height = window.innerHeight - 210;
  649. this.listBYStatusfun() // 获取待采购数据
  650. },
  651. filters: {
  652. IntegerFormat(num) {
  653. return IntegerFormat(num);
  654. }
  655. },
  656. activated() {
  657. if (this.$route.query.check) {
  658. this.detailData = {
  659. check: this.$route.query.check,
  660. id: this.$route.query.check.billId
  661. };
  662. this.show = false;
  663. this.$store.commit("IN_CG_STATUS");
  664. }
  665. },
  666. methods: {
  667. // 获取待采购数据
  668. listBYStatusfun(){
  669. listBYStatus().then(res => {
  670. for (let item of res.data.data) {
  671. // 公司
  672. companyDetail(item.belongToCorpId).then(re=>{
  673. item.belongToCorpName = re.data.data.cname
  674. })
  675. // 用户
  676. nameUser(item.createUser).then(re=>{
  677. item.createUserName = re.data.data.name
  678. })
  679. }
  680. this.procureData = res.data.data
  681. this.treeData = res.data.data
  682. });
  683. },
  684. // 获取待采购弹窗列表数据
  685. procureViewfun(row){
  686. this.procurelistData = []
  687. this.procureOnLoad(row.id)
  688. this.procureVisible = true;
  689. },
  690. outExport() {
  691. let config = { params: { ...this.params } }
  692. if (config.params) {
  693. for (const propName of Object.keys(config.params)) {
  694. const value = config.params[propName];
  695. if (value !== null && typeof (value) !== "undefined") {
  696. if (value instanceof Array) {
  697. for (const key of Object.keys(value)) {
  698. let params = propName + '[' + key + ']';
  699. config.params[params] = value[key]
  700. }
  701. delete config.params[propName]
  702. }
  703. }
  704. }
  705. }
  706. const routeData = this.$router.resolve({
  707. path: '/api/blade-purchase-sales/exportOrder/listXSExport', //跳转目标窗口的地址
  708. query: {
  709. ...config.params //括号内是要传递给新窗口的参数
  710. }
  711. })
  712. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  713. },
  714. nodeClick(data) {
  715. this.params.pid = data.id
  716. this.dialogPage.currentPage = 1;
  717. this.dialogOnLoad(this.dialogPage);
  718. },
  719. removeStagList(row, index) {
  720. this.goodsListSave.splice(row.$index, 1);
  721. },
  722. searchCriteriaSwitch(type) {
  723. if (type) {
  724. this.option.height = this.option.height - 139;
  725. } else {
  726. this.option.height = this.option.height + 139;
  727. }
  728. this.$refs.crud.getTableHeight();
  729. },
  730. cellStyle() {
  731. return "padding:0;height:40px;";
  732. },
  733. //删除列表后面的删除按钮触发触发(row, index, done)
  734. rowDel(row, index, done) {
  735. this.$confirm("确定删除数据?", {
  736. confirmButtonText: "确定",
  737. cancelButtonText: "取消",
  738. type: "warning"
  739. }).then(() => {
  740. remove(row.id).then(res => {
  741. if (res.data.code == 200) {
  742. this.$message({
  743. type: "success",
  744. message: "删除成功!"
  745. });
  746. this.onLoad(this.page, this.search);
  747. }
  748. });
  749. });
  750. },
  751. selectionChange(list) {
  752. this.selectionList = list;
  753. },
  754. // 采购任务弹窗增加多选
  755. dialogSelectionChange(list){
  756. this.goodsListSave = list
  757. },
  758. //行展开数据
  759. expandChange(row) {
  760. if (!row.itemData) {
  761. getGoodsInfo({ id: row.id, tradeType: "CK" })
  762. .then(res => {
  763. this.dataList[row.$index].itemData = res.data.data;
  764. })
  765. .finally(() => {
  766. this.dataList[row.$index].itemLoading = false;
  767. });
  768. }
  769. },
  770. copyDoc() {
  771. this.selectionList.forEach(e => {
  772. this.detailData = {
  773. id: e.id,
  774. status: "copy"
  775. };
  776. this.show = false;
  777. });
  778. },
  779. copyOrder(id) {
  780. this.show = true;
  781. this.detailData = {
  782. id: id,
  783. status: "copy"
  784. };
  785. this.$nextTick(() => {
  786. this.show = false;
  787. });
  788. },
  789. editOpen(row, status) {
  790. this.detailData = {
  791. id: row.id,
  792. status: status
  793. };
  794. this.show = false;
  795. },
  796. //点击搜索按钮触发
  797. searchChange(params, done) {
  798. if (params.businesDate) {
  799. params.businesStartDate = params.businesDate[0];
  800. params.businesEndDate = params.businesDate[1];
  801. }
  802. if (params.requiredDeliveryDate) {
  803. params.requiredDeliveryStartDate = params.requiredDeliveryDate[0];
  804. params.requiredDeliveryEndDate = params.requiredDeliveryDate[1];
  805. }
  806. delete params.businesDate;
  807. delete params.requiredDeliveryDate;
  808. this.page.currentPage = 1;
  809. this.onLoad(this.page, params);
  810. done();
  811. },
  812. currentChange(val) {
  813. this.page.currentPage = val;
  814. },
  815. sizeChange(val) {
  816. this.page.currentPage = 1;
  817. this.page.pageSize = val;
  818. },
  819. // 标签页切换
  820. tabHandle(data) {
  821. if (data.name == 'searchList') {
  822. this.dialogData = this.goodsListShow;
  823. this.dialogPage.total = this.totalTwo
  824. } else if (data.name == 'importStaging') {
  825. this.goodsListShow = this.dialogData;
  826. this.dialogData = this.goodsListSave;
  827. this.totalTwo = this.dialogPage.total
  828. this.dialogPage.total = 0
  829. }
  830. },
  831. // 采购任务弹窗列表选择按钮
  832. importStagList(row, index) {
  833. this.goodsListSave.push(row);
  834. },
  835. // 采购任务弹窗列表刷新
  836. refreshChangeTwo() {
  837. this.dialogOnLoad(this.page);
  838. },
  839. searchChangeTwo(params, done) {
  840. done()
  841. if (!this.params.pid && !this.params.billNo) {
  842. return this.$message.error("请选择左边单号或输入销售单号")
  843. } else {
  844. this.dialogOnLoad(this.page);
  845. }
  846. },
  847. searchReset() {
  848. this.avueTree = !this.avueTree
  849. this.params.showAll = 0
  850. this.$refs.singleTable.setCurrentRow([]);
  851. this.dialogData = []
  852. },
  853. //自定义列保存
  854. async saveColumnTwo(ref, option, optionBack, code) {
  855. /**
  856. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  857. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  858. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  859. */
  860. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  861. if (inSave) {
  862. this.$message.success("保存成功");
  863. //关闭窗口
  864. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  865. }
  866. },
  867. //自定义列重置
  868. async resetColumnTwo(ref, option, optionBack, code) {
  869. this[option] = this[optionBack];
  870. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  871. if (inSave) {
  872. this.$message.success("重置成功");
  873. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  874. }
  875. },
  876. openReport() {
  877. this.switchDialog = !this.switchDialog;
  878. },
  879. onClose(val) {
  880. this.switchDialog = val;
  881. },
  882. confirmImport() {
  883. let ids = this.goodsListSave.map(item => {
  884. return item.id
  885. })
  886. const loading = this.$loading({
  887. lock: true,
  888. text: '加载中',
  889. spinner: 'el-icon-loading',
  890. background: 'rgba(255,255,255,0.7)'
  891. });
  892. generatePurchaseBill(this.goodsListSave).then(res => {
  893. this.$message.success("导入成功")
  894. console.log(res,629)
  895. for(let item of res.data.data.orderItemsList) {
  896. getGoods(1,10,null,{cname:item.cname}).then(res=>{
  897. item.price = res.data.data.records[0].displayPrice
  898. })
  899. }
  900. this.detailData = {
  901. form: res.data.data
  902. };
  903. loading.close()
  904. this.procureVisible = false // 待采购弹窗关闭
  905. this.dialogVisible = false // 采购任务弹窗关闭
  906. this.activeName = "searchList"
  907. setTimeout(() => {
  908. this.show = false;
  909. }, 200);
  910. }).catch(() => {
  911. loading.close()
  912. })
  913. },
  914. // 采购任务列表获取数据
  915. dialogOnLoad(page, params) {
  916. this.dialogLoading = true;
  917. params = {
  918. ...params,
  919. size: page.pageSize,
  920. current: page.currentPage,
  921. ...this.params
  922. }
  923. if (this.params.pid || this.params.billNo) {
  924. listXS(params).then(res => {
  925. this.dialogLoading = false
  926. this.dialogData = res.data.data
  927. // this.dialogPage.total = res.data.data.total
  928. })
  929. }
  930. },
  931. // 待采购列表获取数据
  932. procureOnLoad(id) {
  933. let params = {
  934. size: 20,
  935. current: 1,
  936. showAll: 0,
  937. pid:id
  938. }
  939. listXS(params).then(res => {
  940. this.procurelistData = res.data.data
  941. })
  942. },
  943. onLoad(page, params) {
  944. if (this.search.businesDate && this.search.businesDate.length > 0) {
  945. params = {
  946. ...params,
  947. orderStartDate: this.search.businesDate[0],
  948. orderEndDate: this.search.businesDate[1]
  949. };
  950. delete params.businesDate;
  951. }
  952. if (this.search.requiredDeliveryDate && this.search.requiredDeliveryDate.length > 0) {
  953. params = {
  954. ...params,
  955. requiredDeliveryStartDate: this.search.requiredDeliveryDate[0],
  956. requiredDeliveryEndDate: this.search.requiredDeliveryDate[1]
  957. };
  958. delete params.requiredDeliveryDate
  959. }
  960. this.loading = true;
  961. this.dataList.forEach(item => {
  962. this.$refs.crud.toggleRowExpansion(item, false);
  963. });
  964. getList(page.currentPage, page.pageSize, params)
  965. .then(res => {
  966. if (res.data.data.records) {
  967. res.data.data.records.forEach(e => {
  968. e.itemLoading = true;
  969. });
  970. }
  971. this.dataList = res.data.data.records ? res.data.data.records : [];
  972. this.page.total = res.data.data.total;
  973. })
  974. .finally(() => {
  975. this.loading = false;
  976. });
  977. },
  978. refreshChange() {
  979. this.onLoad(this.page, this.search);
  980. },
  981. newAdd(type) {
  982. this.detailData = {
  983. pageType: type
  984. };
  985. this.show = false;
  986. },
  987. goBack() {
  988. this.detailData = this.$options.data().detailData;
  989. this.show = true;
  990. this.onLoad(this.page, this.search);
  991. },
  992. async saveColumn() {
  993. const inSave = await this.saveColumnData(
  994. this.getColumnName(2),
  995. this.option
  996. );
  997. if (inSave) {
  998. this.$nextTick(() => {
  999. this.$refs.crud.doLayout();
  1000. });
  1001. this.$message.success("保存成功");
  1002. //关闭窗口
  1003. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1004. }
  1005. },
  1006. async resetColumn() {
  1007. this.option = option;
  1008. const inSave = await this.delColumnData(this.getColumnName(2), option);
  1009. if (inSave) {
  1010. this.$nextTick(() => {
  1011. this.$refs.crud.doLayout();
  1012. });
  1013. this.$message.success("重置成功");
  1014. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1015. }
  1016. },
  1017. handleCurrentChange(val) {
  1018. console.log(val)
  1019. // this.currentRow = val;
  1020. this.params.pid = val.id
  1021. this.dialogPage.currentPage = 1;
  1022. this.dialogOnLoad(this.dialogPage);
  1023. }
  1024. },
  1025. watch: {
  1026. option: function () {
  1027. this.search.businesDate = defaultDate();
  1028. },
  1029. dialogVisible: function () {
  1030. this.goodsListShow = []
  1031. this.goodsListSave = []
  1032. this.totalTwo = 0
  1033. this.dialogData = []
  1034. listBYStatus({}).then(res => {
  1035. this.treeData = res.data.data
  1036. });
  1037. this.dialogOnLoad(this.page);
  1038. }
  1039. }
  1040. };
  1041. </script>
  1042. <style scoped>
  1043. ::v-deep .select-component {
  1044. display: flex;
  1045. }
  1046. .page-crad ::v-deep .basic-container__card {
  1047. height: 94.2vh;
  1048. }
  1049. .itemTable ::v-deep .el-table {
  1050. margin-left: 50px;
  1051. width: 100%;
  1052. }
  1053. </style>