index.vue 43 KB

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