祥兆质量前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1002 lines
32 KiB

  1. <template>
  2. <div class="mod-config">
  3. <!-- 收藏 -->
  4. <div>
  5. <span @click="favoriteFunction()">
  6. <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
  7. </span>
  8. </div>
  9. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  10. <el-form-item :label="'采购订单号'">
  11. <el-input v-model="searchData.orderNo" clearable style="width: 120px"></el-input>
  12. </el-form-item>
  13. <el-form-item :label="'生产订单号'">
  14. <el-input v-model="searchData.orderRef1" clearable style="width: 120px"></el-input>
  15. </el-form-item>
  16. <el-form-item :label="'工序号'">
  17. <el-input v-model="searchData.orderRef2" clearable style="width: 120px"></el-input>
  18. </el-form-item>
  19. <el-form-item :label="'工序名称:'">
  20. <el-input v-model="searchData.operationDesc" clearable style="width: 120px"></el-input>
  21. </el-form-item>
  22. <!-- <el-form-item label="外协订单领料状态">-->
  23. <!-- <el-select v-model="searchData.outworkorderPartReqStatus" placeholder="请选择外协订单领料状态">-->
  24. <!-- <el-option label="未发料" value="C"></el-option>-->
  25. <!-- <el-option label="全部发料" value="B"></el-option>-->
  26. <!-- <el-option label="部分发料" value="A"></el-option>-->
  27. <!-- </el-select>-->
  28. <!-- </el-form-item>-->
  29. <el-form-item label="状态">
  30. <el-select v-model="searchData.status" placeholder="请选择状态" clearable>
  31. <el-option label="未发货" value="未发货"></el-option>
  32. <el-option label="部分发货" value="部分发货"></el-option>
  33. <el-option label="已发货" value="已发货"></el-option>
  34. <el-option label="已关闭" value="已关闭"></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item :label="'要求送货日期'">
  38. <el-date-picker
  39. style="width: 120px"
  40. v-model="searchData.wantedDelStartDate"
  41. type="date"
  42. value-format="yyyy-MM-dd"
  43. placeholder="选择日期">
  44. </el-date-picker>
  45. -
  46. <el-date-picker
  47. style="width: 120px"
  48. v-model="searchData.wantedDelEndDate"
  49. type="date"
  50. value-format="yyyy-MM-dd"
  51. placeholder="选择日期">
  52. </el-date-picker>
  53. </el-form-item>
  54. <el-form-item label="送货地点" prop="site">
  55. <el-select v-model="searchData.delPoint" clearable placeholder="请选择" style="width: 120px">
  56. <el-option label = "常熟" value = "常熟"></el-option>
  57. <el-option label = "苏州" value = "苏州"></el-option>
  58. <el-option label = "徐州" value = "徐州"></el-option>
  59. </el-select>
  60. </el-form-item>
  61. </el-form>
  62. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  63. <el-form-item>
  64. <span style="cursor: pointer" slot="label" @click="getBaseList(3)"><a herf="#">供应商编码</a></span>
  65. <el-input v-model="searchData.supplierId" placeholder="输入或选择供应商编码"></el-input>
  66. </el-form-item>
  67. <el-form-item label="供应商名称">
  68. <el-input v-model="searchData.supplierName"></el-input>
  69. </el-form-item>
  70. <el-form-item label="物料编码">
  71. <el-input v-model="searchData.partNo"></el-input>
  72. </el-form-item>
  73. <el-form-item label="物料描述">
  74. <el-input v-model="searchData.partDescription"></el-input>
  75. </el-form-item>
  76. <el-form-item>
  77. <span style="cursor: pointer" slot="label" @click="getBaseList(9)"><a herf="#">采购员</a></span>
  78. <el-input v-model="searchData.userName" clearable placeholder="输入或选择采购员" style="width: 120px"></el-input>
  79. </el-form-item>
  80. <el-form-item :label="' '">
  81. <el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
  82. <download-excel
  83. :fields="fields()"
  84. :data="exportData"
  85. type="xls"
  86. :name="exportName"
  87. :header="exportHeader"
  88. :footer="exportFooter"
  89. :fetch="createExportData"
  90. :before-generate="startDownload"
  91. :before-finish="finishDownload"
  92. worksheet="导出信息"
  93. class="el-button el-button--primary el-button--medium">
  94. {{ "导出" }}
  95. </download-excel>
  96. </el-form-item>
  97. </el-form>
  98. <el-table
  99. :height="height"
  100. :data="dataList"
  101. border
  102. style="width: 100%;"
  103. class="custom-table"
  104. >
  105. <el-table-column
  106. v-for="(item, index) in columnList"
  107. :key="index"
  108. :prop="item.columnProp"
  109. :label="item.columnLabel"
  110. :sortable="item.columnSortable"
  111. :header-align="item.headerAlign"
  112. :align="item.align"
  113. :fixed="item.fixed == '' ? false : item.fixed"
  114. :width="item.columnWidth"
  115. >
  116. <template slot-scope="scope">
  117. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  118. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column
  122. fixed="right"
  123. header-align="center"
  124. align="center"
  125. width="100"
  126. label="操作">
  127. <template slot-scope="scope">
  128. <el-link style="cursor: pointer" type="text" size="small" @click="updateModal(scope.row,0)">修改</el-link>
  129. <el-link style="cursor: pointer" type="text" size="small" @click="updateModal(scope.row,1)">取消</el-link>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. <el-pagination
  134. @size-change="sizeChangeHandle"
  135. @current-change="currentChangeHandle"
  136. :current-page="pageIndex"
  137. :page-sizes="[20, 50, 100, 200, 500]"
  138. :page-size="pageSize"
  139. :total="totalPage"
  140. layout="total, sizes, prev, pager, next, jumper"
  141. >
  142. </el-pagination>
  143. <el-dialog title="供应商送货计划修改" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="405px">
  144. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  145. <el-form-item :label="'要求送货日期'" :rules="rules.wantedDelDate">
  146. <el-date-picker
  147. style="width: 120px"
  148. v-model="modalData.WantedDelDate"
  149. type="date"
  150. value-format="yyyy-MM-dd"
  151. placeholder="选择日期">
  152. </el-date-picker>
  153. </el-form-item>
  154. <el-form-item label="送货地点" prop="site" :rules="rules.delPoint">
  155. <el-select v-model="modalData.delPoint" placeholder="请选择" style="width: 120px">
  156. <el-option label = "常熟" value = "常熟"></el-option>
  157. <el-option label = "苏州" value = "苏州"></el-option>
  158. <el-option label = "徐州" value = "徐州"></el-option>
  159. </el-select>
  160. </el-form-item>
  161. <el-form-item label="此次送货数量" prop="deliveryQty" :rules="rules.deliveryQty">
  162. <el-input-number v-model="modalData.deliveryQty" :controls="false" style="width: 100px"></el-input-number>
  163. </el-form-item>
  164. </el-form>
  165. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  166. <el-form-item label="备注" prop="remark">
  167. <el-input v-model="modalData.remark" style="width: 368px"></el-input>
  168. </el-form-item>
  169. </el-form>
  170. <span slot="footer" class="dialog-footer">
  171. <el-button type="primary" @click="saveData">保存</el-button>
  172. <el-button @click="modalFlag = false">取消</el-button>
  173. </span>
  174. </el-dialog>
  175. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  176. <!-- 数据表格部分 -->
  177. <!-- <el-table :data="dataList" border style="width: 100%">-->
  178. <!-- <el-table-column prop="orderNumber" label="订单号" width="150"></el-table-column>-->
  179. <!-- <el-table-column prop="material" label="物料编码" width="150"></el-table-column>-->
  180. <!-- <el-table-column prop="supplier" label="供应商" width="150"></el-table-column>-->
  181. <!-- <el-table-column prop="quantity" label="待送货数量" width="150"></el-table-column>-->
  182. <!-- <el-table-column prop="deliveryQuantity" label="此次送货数量" width="150">-->
  183. <!-- <template slot-scope="scope">-->
  184. <!-- <el-input-->
  185. <!-- v-model.number="scope.row.deliveryQuantity"-->
  186. <!-- :max="scope.row.remainingQuantity"-->
  187. <!-- />-->
  188. <!-- </template>-->
  189. <!-- </el-table-column>-->
  190. <!-- <el-table-column prop="status" label="状态" width="150"></el-table-column>-->
  191. <!-- </el-table>-->
  192. <!-- 汇总部分 -->
  193. <!-- <div class="summary-section">-->
  194. <!-- <h3>汇总</h3>-->
  195. <!-- <p>总待送货数量: {{ totalRemaining }}</p>-->
  196. <!-- <p>此次送货总数量: {{ totalDelivery }}</p>-->
  197. <!-- </div>-->
  198. </div>
  199. </template>
  200. <script>
  201. import {removeUserFavorite, saveUserFavorite, userFavoriteList} from "../../../api/userFavorite";
  202. import {getSiteAndBuByUserName} from "../../../api/qc/qc";
  203. import {
  204. addSupplierDeliveryPlan, autoReservationInitiateHandler,
  205. searchSupplierDeliverySchedule,
  206. updateSupplierDeliveryScheduleDeliveryQty
  207. } from "../../../api/deliverySchedule/supplierDeliverySchedule";
  208. import {searchSupplierDeliveryPlan,updateSupplierDeliveryPlan} from "../../../api/deliverySchedule/supplierDeliveryPlan";
  209. import {getTableDefaultListLanguage, getTableUserListLanguage} from "../../../api/table";
  210. import Chooselist from "../common/Chooselist.vue";
  211. export default {
  212. components: {
  213. Chooselist
  214. },
  215. data() {
  216. return {
  217. // 是否收藏
  218. favorite: false,
  219. // 导出 start
  220. exportData: [],
  221. exportName: "内部供应商送货计划信息" + this.dayjs().format('YYYYMMDDHHmmss'),
  222. exportHeader: ["内部供应商送货计划信息"],
  223. exportFooter: [],
  224. exportList: [],
  225. modalData: {
  226. WantedDelDate: '',
  227. delPoint: '',
  228. deliveryQty: '',
  229. lastDeliveryQty: '',
  230. remark: '',
  231. },
  232. // 导出 end
  233. searchData: {
  234. orderNo: '',
  235. orderRef1: '',
  236. orderRef2: '',
  237. operationDesc: '',
  238. status: '',
  239. wantedDelStartDate: '',
  240. wantedDelEndDate: '',
  241. delPoint: '',
  242. supplierId: '',
  243. supplierName: '',
  244. partNo: '',
  245. partDescription: '',
  246. userName: '',
  247. site: this.$store.state.user.site,
  248. page: 1,
  249. limit: 20,
  250. },
  251. columnList: [
  252. {
  253. userId: this.$store.state.user.name,
  254. functionId: 109002,
  255. serialNumber: '109002TableWantedDelDate',
  256. tableId: "109002Table",
  257. tableName: "内部供应商送货计划信息表",
  258. columnWidth: 120,
  259. columnProp: 'WantedDelDate',
  260. headerAlign: 'center',
  261. align: "center",
  262. columnLabel: '要求送货日期',
  263. columnHidden: false,
  264. columnImage: false,
  265. columnSortable: false,
  266. sortLv: 0,
  267. status: true,
  268. fixed: '',
  269. },
  270. {
  271. userId: this.$store.state.user.name,
  272. functionId: 109002,
  273. serialNumber: '109002TableUserName',
  274. tableId: "109002Table",
  275. tableName: "内部供应商送货计划信息表",
  276. columnWidth: 120,
  277. columnProp: 'userName',
  278. headerAlign: 'center',
  279. align: "center",
  280. columnLabel: '采购员',
  281. columnHidden: false,
  282. columnImage: false,
  283. columnSortable: false,
  284. sortLv: 0,
  285. status: true,
  286. fixed: '',
  287. },
  288. {
  289. userId: this.$store.state.user.name,
  290. functionId: 109002,
  291. serialNumber: '109002TableDelPoint',
  292. tableId: "109002Table",
  293. tableName: "内部供应商送货计划信息表",
  294. columnWidth: 120,
  295. columnProp: 'delPoint',
  296. headerAlign: 'center',
  297. align: "center",
  298. columnLabel: '送货地点',
  299. columnHidden: false,
  300. columnImage: false,
  301. columnSortable: false,
  302. sortLv: 0,
  303. status: true,
  304. fixed: '',
  305. },
  306. {
  307. userId: this.$store.state.user.name,
  308. functionId: 109002,
  309. serialNumber: '109002TableStatus',
  310. tableId: "109002Table",
  311. tableName: "内部供应商送货计划信息表",
  312. columnWidth: 120,
  313. columnProp: 'status',
  314. headerAlign: 'center',
  315. align: "center",
  316. columnLabel: '状态',
  317. columnHidden: false,
  318. columnImage: false,
  319. columnSortable: false,
  320. sortLv: 0,
  321. status: true,
  322. fixed: '',
  323. },
  324. {
  325. userId: this.$store.state.user.name,
  326. functionId: 109002,
  327. serialNumber: '109002TableSupplierId',
  328. tableId: "109002Table",
  329. tableName: "内部供应商送货计划信息表",
  330. columnWidth: 120,
  331. columnProp: 'supplierId',
  332. headerAlign: 'center',
  333. align: "left",
  334. columnLabel: '供应商编码',
  335. columnHidden: false,
  336. columnImage: false,
  337. columnSortable: false,
  338. sortLv: 0,
  339. status: true,
  340. fixed: '',
  341. },
  342. {
  343. userId: this.$store.state.user.name,
  344. functionId: 109002,
  345. serialNumber: '109002TableSupplierName',
  346. tableId: "109002Table",
  347. tableName: "内部供应商送货计划信息表",
  348. columnWidth: 182,
  349. columnProp: 'supplierName',
  350. headerAlign: 'center',
  351. align: "left",
  352. columnLabel: '供应商名称',
  353. columnHidden: false,
  354. columnImage: false,
  355. columnSortable: false,
  356. sortLv: 0,
  357. status: true,
  358. fixed: '',
  359. },
  360. {
  361. userId: this.$store.state.user.name,
  362. functionId: 109002,
  363. serialNumber: '109002TableOrderNo',
  364. tableId: "109002Table",
  365. tableName: "内部供应商送货计划信息表",
  366. columnWidth: 100,
  367. columnProp: 'orderNo',
  368. headerAlign: 'center',
  369. align: "center",
  370. columnLabel: '采购订单号',
  371. columnHidden: false,
  372. columnImage: false,
  373. columnSortable: false,
  374. sortLv: 0,
  375. status: true,
  376. fixed: '',
  377. },
  378. {
  379. userId: this.$store.state.user.name,
  380. functionId: 109002,
  381. serialNumber: '109002TableOrderRef1',
  382. tableId: "109002Table",
  383. tableName: "内部供应商送货计划信息表",
  384. columnWidth: 182,
  385. columnProp: 'orderRef1',
  386. headerAlign: 'center',
  387. align: "left",
  388. columnLabel: '生产订单号',
  389. columnHidden: false,
  390. columnImage: false,
  391. columnSortable: false,
  392. sortLv: 0,
  393. status: true,
  394. fixed: '',
  395. },
  396. {
  397. userId: this.$store.state.user.name,
  398. functionId: 109002,
  399. serialNumber: '109002TableOrderItemNo',
  400. tableId: "109002Table",
  401. tableName: "内部供应商送货计划信息表",
  402. columnWidth: 80,
  403. columnProp: 'orderItemNo',
  404. headerAlign: 'center',
  405. align: "center",
  406. columnLabel: '序号',
  407. columnHidden: false,
  408. columnImage: false,
  409. columnSortable: false,
  410. sortLv: 0,
  411. status: true,
  412. fixed: '',
  413. },
  414. {
  415. userId: this.$store.state.user.name,
  416. functionId: 109002,
  417. serialNumber: '109002TablePartNo',
  418. tableId: "109002Table",
  419. tableName: "内部供应商送货计划信息表",
  420. columnWidth: 182,
  421. columnProp: 'partNo',
  422. headerAlign: 'center',
  423. align: "left",
  424. columnLabel: '物料编码',
  425. columnHidden: false,
  426. columnImage: false,
  427. columnSortable: false,
  428. sortLv: 0,
  429. status: true,
  430. fixed: '',
  431. },
  432. {
  433. userId: this.$store.state.user.name,
  434. functionId: 109002,
  435. serialNumber: '109002TablePartDescription',
  436. tableId: "109002Table",
  437. tableName: "内部供应商送货计划信息表",
  438. columnWidth: 182,
  439. columnProp: 'partDescription',
  440. headerAlign: 'center',
  441. align: "left",
  442. columnLabel: '物料名称',
  443. columnHidden: false,
  444. columnImage: false,
  445. columnSortable: false,
  446. sortLv: 0,
  447. status: true,
  448. fixed: '',
  449. },
  450. {
  451. userId: this.$store.state.user.name,
  452. functionId: 109002,
  453. serialNumber: '109002TableSpec',
  454. tableId: "109002Table",
  455. tableName: "内部供应商送货计划信息表",
  456. columnWidth: 183,
  457. columnProp: 'spec',
  458. headerAlign: 'center',
  459. align: "left",
  460. columnLabel: '规格型号',
  461. columnHidden: false,
  462. columnImage: false,
  463. columnSortable: false,
  464. sortLv: 0,
  465. status: true,
  466. fixed: '',
  467. },
  468. {
  469. userId: this.$store.state.user.name,
  470. functionId: 109002,
  471. serialNumber: '109002TableOrderRef2',
  472. tableId: "109002Table",
  473. tableName: "内部供应商送货计划信息表",
  474. columnWidth: 70,
  475. columnProp: 'orderRef2',
  476. headerAlign: 'center',
  477. align: "center",
  478. columnLabel: '工序号',
  479. columnHidden: false,
  480. columnImage: false,
  481. columnSortable: false,
  482. sortLv: 0,
  483. status: true,
  484. fixed: '',
  485. },
  486. {
  487. userId: this.$store.state.user.name,
  488. functionId: 109002,
  489. serialNumber: '109002TableOperationDesc',
  490. tableId: "109002Table",
  491. tableName: "内部供应商送货计划信息表",
  492. columnWidth: 120,
  493. columnProp: 'operationDesc',
  494. headerAlign: 'center',
  495. align: "left",
  496. columnLabel: '工序名称',
  497. columnHidden: false,
  498. columnImage: false,
  499. columnSortable: false,
  500. sortLv: 0,
  501. status: true,
  502. fixed: '',
  503. },
  504. {
  505. userId: this.$store.state.user.name,
  506. functionId: 109002,
  507. serialNumber: '109002TableLastDeliveryQty',
  508. tableId: "109002Table",
  509. tableName: "内部供应商送货计划信息表",
  510. columnWidth: 120,
  511. columnProp: 'lastDeliveryQty',
  512. headerAlign: 'center',
  513. align: "right",
  514. columnLabel: '上一次的此次送货数量',
  515. columnHidden: false,
  516. columnImage: false,
  517. columnSortable: false,
  518. sortLv: 0,
  519. status: true,
  520. fixed: '',
  521. },
  522. {
  523. userId: this.$store.state.user.name,
  524. functionId: 109002,
  525. serialNumber: '109002TableDeliveryQty',
  526. tableId: "109002Table",
  527. tableName: "内部供应商送货计划信息表",
  528. columnWidth: 120,
  529. columnProp: 'deliveryQty',
  530. headerAlign: 'center',
  531. align: "right",
  532. columnLabel: '此次送货数量',
  533. columnHidden: false,
  534. columnImage: false,
  535. columnSortable: false,
  536. sortLv: 0,
  537. status: true,
  538. fixed: '',
  539. },
  540. {
  541. userId: this.$store.state.user.name,
  542. functionId: 109002,
  543. serialNumber: '109002TableActualDelQty',
  544. tableId: "109002Table",
  545. tableName: "内部供应商送货计划信息表",
  546. columnWidth: 120,
  547. columnProp: 'actualDelQty',
  548. headerAlign: 'center',
  549. align: "right",
  550. columnLabel: '要求送货数量',
  551. columnHidden: false,
  552. columnImage: false,
  553. columnSortable: false,
  554. sortLv: 0,
  555. status: true,
  556. fixed: '',
  557. },
  558. {
  559. userId: this.$store.state.user.name,
  560. functionId: 109002,
  561. serialNumber: '109002TableActualTotalDelQty',
  562. tableId: "109002Table",
  563. tableName: "内部供应商送货计划信息表",
  564. columnWidth: 120,
  565. columnProp: 'actualTotalDelQty',
  566. headerAlign: 'center',
  567. align: "right",
  568. columnLabel: '实际送货数量',
  569. columnHidden: false,
  570. columnImage: false,
  571. columnSortable: false,
  572. sortLv: 0,
  573. status: true,
  574. fixed: '',
  575. },
  576. {
  577. userId: this.$store.state.user.name,
  578. functionId: 109002,
  579. serialNumber: '109002TableActualOntimeDelQty',
  580. tableId: "109002Table",
  581. tableName: "内部供应商送货计划信息表",
  582. columnWidth: 120,
  583. columnProp: 'actualOntimeDelQty',
  584. headerAlign: 'center',
  585. align: "right",
  586. columnLabel: '实际准时送货数量',
  587. columnHidden: false,
  588. columnImage: false,
  589. columnSortable: false,
  590. sortLv: 0,
  591. status: true,
  592. fixed: '',
  593. },
  594. {
  595. userId: this.$store.state.user.name,
  596. functionId: 109002,
  597. serialNumber: '109002TableActualFirstDelDate',
  598. tableId: "109002Table",
  599. tableName: "内部供应商送货计划信息表",
  600. columnWidth: 120,
  601. columnProp: 'actualFirstDelDate',
  602. headerAlign: 'center',
  603. align: "center",
  604. columnLabel: '实际首次送货日期',
  605. columnHidden: false,
  606. columnImage: false,
  607. columnSortable: false,
  608. sortLv: 0,
  609. status: true,
  610. fixed: '',
  611. },
  612. {
  613. userId: this.$store.state.user.name,
  614. functionId: 109002,
  615. serialNumber: '109002TableActualLatestDelDate',
  616. tableId: "109002Table",
  617. tableName: "内部供应商送货计划信息表",
  618. columnWidth: 120,
  619. columnProp: 'actualLatestDelDate',
  620. headerAlign: 'center',
  621. align: "center",
  622. columnLabel: '实际最后送货日期',
  623. columnHidden: false,
  624. columnImage: false,
  625. columnSortable: false,
  626. sortLv: 0,
  627. status: true,
  628. fixed: '',
  629. },
  630. {
  631. userId: this.$store.state.user.name,
  632. functionId: 109002,
  633. serialNumber: '109002TableCreateDate',
  634. tableId: "109002Table",
  635. tableName: "内部供应商送货计划信息表",
  636. columnWidth: 150,
  637. columnProp: 'CreateDate',
  638. headerAlign: 'center',
  639. align: "center",
  640. columnLabel: '创建时间',
  641. columnHidden: false,
  642. columnImage: false,
  643. columnSortable: false,
  644. sortLv: 0,
  645. status: true,
  646. fixed: '',
  647. },
  648. {
  649. userId: this.$store.state.user.name,
  650. functionId: 109002,
  651. serialNumber: '109002TableCreateBy',
  652. tableId: "109002Table",
  653. tableName: "内部供应商送货计划信息表",
  654. columnWidth: 120,
  655. columnProp: 'createBy',
  656. headerAlign: 'center',
  657. align: "center",
  658. columnLabel: '创建人',
  659. columnHidden: false,
  660. columnImage: false,
  661. columnSortable: false,
  662. sortLv: 0,
  663. status: true,
  664. fixed: '',
  665. },
  666. ],
  667. rules: {
  668. wantedDelDate: [
  669. { required: true, message: '要求送货日期不能为空', trigger: 'blur' }
  670. ],
  671. delPoint: [
  672. { required: true, message: '送货地点不能为空', trigger: 'blur' }
  673. ],
  674. allotmentQty: [
  675. { required: true, message: '此次分配的送货数量不能为空', trigger: 'blur' }
  676. ],
  677. deliveryQty: [
  678. { required: true, message: '此次送货数量不能为空', trigger: 'blur' }
  679. ],
  680. },
  681. pageIndex: 1,
  682. pageSize: 20,
  683. totalPage: 0,
  684. height: 200,
  685. dataList: [],
  686. modalFlag: false,
  687. modalDisableFlag: false,
  688. autoReservationFlag: false,
  689. options: [],
  690. userBuList: [],
  691. selectionList:[],
  692. authSearch: false,
  693. authSave: false,
  694. authUpdate: false,
  695. authDelete: false,
  696. menuId: this.$route.meta.menuId,
  697. };
  698. },
  699. mounted () {
  700. this.$nextTick(() => {
  701. this.height = window.innerHeight - 180
  702. })
  703. },
  704. created() {
  705. // 按钮控制
  706. this.getButtonAuthData()
  707. // 获取用户的 site 和 bu
  708. this.getSiteAndBuByUserName()
  709. // 校验用户是否收藏
  710. this.favoriteIsOk()
  711. // 动态列
  712. this.getTableUserColumn(this.$route.meta.menuId+'table',1)
  713. if (!this.authSearch) {
  714. // 获取数据列表
  715. this.getDataList()
  716. }
  717. },
  718. methods: {
  719. // 获取基础数据列表
  720. getBaseList (val) {
  721. this.tagNo = val
  722. this.$nextTick(() => {
  723. let strVal = ''
  724. let conSql = ''
  725. if (val === 3) {
  726. strVal = this.searchData.supplierId
  727. conSql = " and site = '" + this.searchData.site + "'"
  728. this.$refs.baseList.init(val, strVal, conSql)
  729. } else if (val === 9) {
  730. strVal = this.searchData.userName
  731. conSql = " and site = '" + this.searchData.site + "'"
  732. this.$refs.baseList.init(val, strVal, conSql)
  733. }
  734. })
  735. },
  736. // 列表方法的回调
  737. getBaseData (val) {
  738. if (this.tagNo === 3) {
  739. this.searchData.supplierId = val.SupplierID
  740. this.searchData.supplierName = val.SupplierName
  741. } else if (this.tagNo === 9) {
  742. this.searchData.userName = val.EmployeeName
  743. }
  744. },
  745. // 获取用户的bu
  746. getSiteAndBuByUserName () {
  747. let tempData = {
  748. username: this.$store.state.user.name,
  749. }
  750. getSiteAndBuByUserName(tempData).then(({data}) => {
  751. if (data.code === 0) {
  752. this.userBuList = data.rows
  753. }
  754. })
  755. },
  756. // 校验用户是否收藏
  757. favoriteIsOk () {
  758. let userFavorite = {
  759. userId: this.$store.state.user.id,
  760. languageCode: this.$i18n.locale
  761. }
  762. userFavoriteList(userFavorite).then(({data}) => {
  763. for (let i = 0; i < data.list.length; i++) {
  764. if(this.$route.meta.menuId === data.list[i].menuId){
  765. this.favorite = true
  766. }
  767. }
  768. })
  769. },
  770. // 收藏 OR 取消收藏
  771. favoriteFunction () {
  772. let userFavorite = {
  773. userId: this.$store.state.user.id,
  774. functionId: this.$route.meta.menuId,
  775. }
  776. if (this.favorite) {
  777. removeUserFavorite(userFavorite).then(({data}) => {
  778. this.$message.success(data.msg)
  779. this.favorite = false
  780. })
  781. } else {
  782. // 收藏
  783. saveUserFavorite(userFavorite).then(({data}) => {
  784. this.$message.success(data.msg)
  785. this.favorite = true
  786. })
  787. }
  788. },
  789. getDataList() {
  790. this.searchData.limit = this.pageSize
  791. this.searchData.page = this.pageIndex
  792. searchSupplierDeliveryPlan(this.searchData).then(({data}) => {
  793. if (data.code === 0) {
  794. this.dataList = data.page.list
  795. this.pageIndex = data.page.currPage
  796. this.pageSize = data.page.pageSize
  797. this.totalPage = data.page.totalCount
  798. }
  799. })
  800. },
  801. saveData () {
  802. let inData = this.modalData
  803. updateSupplierDeliveryPlan(inData).then(({data}) => {
  804. if (data.code === 0) {
  805. this.modalFlag = false
  806. this.getDataList()
  807. this.$message.success(data.msg)
  808. } else {
  809. this.$message.error(data.msg)
  810. }
  811. })
  812. },
  813. updateModal(row,flag){
  814. if(flag === 0){
  815. this.modalFlag = true
  816. if (row.lastDeliveryQty !== row.deliveryQty && row.deliveryQty > 0) {
  817. row.lastDeliveryQty = row.deliveryQty
  818. }
  819. this.modalData = row
  820. this.modalData.flag = flag
  821. } else if(flag === 1){
  822. this.$confirm('确定关闭该送货计划吗?', '提示', {
  823. confirmButtonText: '确定',
  824. cancelButtonText: '取消',
  825. type: 'warning'
  826. }).then(() => {
  827. this.modalData = row
  828. this.modalData.flag = flag
  829. this.saveData()
  830. }).catch(() => {
  831. this.$message({
  832. type: 'info',
  833. message: '已取消'
  834. });
  835. });
  836. }
  837. },
  838. handleSelectionChange(val) {
  839. this.selectionList = val;
  840. },
  841. // 每页数
  842. sizeChangeHandle (val) {
  843. this.pageSize = val
  844. this.pageIndex = 1
  845. this.getDataList()
  846. },
  847. // 当前页
  848. currentChangeHandle (val) {
  849. this.pageIndex = val
  850. this.getDataList()
  851. },
  852. //导出excel
  853. async createExportData() {
  854. if(this.selectionList.length > 0) {
  855. return this.exportList = this.selectionList
  856. } else {
  857. // 提示
  858. this.$message({
  859. message: '请选择要导出的数据',
  860. type: 'warning'
  861. })
  862. }
  863. },
  864. startDownload() {},
  865. finishDownload() {},
  866. fields () {
  867. let json = "{"
  868. this.columnList.forEach((item, index) => {
  869. if (index == this.columnList.length - 1) {
  870. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  871. } else {
  872. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  873. }
  874. })
  875. json += "}"
  876. let s = eval("(" + json + ")")
  877. return s
  878. },
  879. // 动态列开始 获取 用户保存的 格式列
  880. async getTableUserColumn (tableId, columnId) {
  881. let queryTableUser = {
  882. userId: this.$store.state.user.name,
  883. functionId: this.$route.meta.menuId,
  884. tableId: tableId,
  885. status: true,
  886. languageCode: this.$i18n.locale
  887. }
  888. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  889. if (data.rows.length > 0) {
  890. //this.columnList1 = []
  891. switch (columnId) {
  892. case 1:
  893. this.columnList = data.rows
  894. break;
  895. // case 2:
  896. // this.columnDetailList = data.rows
  897. // break;
  898. // case 3:
  899. // this.columnList2 = data.rows
  900. // break;
  901. // case 4:
  902. // this.columnList3 = data.rows
  903. // break;
  904. }
  905. } else {
  906. this.getColumnList(tableId, columnId)
  907. }
  908. })
  909. },
  910. // 获取 tableDefault 列
  911. async getColumnList (tableId, columnId) {
  912. let queryTable = {
  913. functionId: this.$route.meta.menuId,
  914. tableId: tableId,
  915. languageCode: this.$i18n.locale
  916. }
  917. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  918. if (!data.rows.length == 0) {
  919. switch (columnId) {
  920. case 1:
  921. this.columnList = data.rows
  922. break;
  923. // case 2:
  924. // this.columnDetailList = data.rows
  925. // break;
  926. // case 3:
  927. // this.columnList2 = data.rows
  928. // break;
  929. // case 4:
  930. // this.columnList3 = data.rows
  931. // break;
  932. }
  933. } else {
  934. // this.showDefault = true.
  935. }
  936. })
  937. },
  938. //获取按钮的权限数据
  939. getButtonAuthData () {
  940. let searchFlag = this.isAuth(this.menuId+":search")
  941. let saveFlag = this.isAuth(this.menuId+":save")
  942. let updateFlag = this.isAuth(this.menuId+":update")
  943. let deleteFlag = this.isAuth(this.menuId+":delete")
  944. //处理页面的权限数据
  945. this.authSearch = !searchFlag
  946. this.authSave = !saveFlag
  947. this.authUpdate = !updateFlag
  948. this.authDelete = !deleteFlag
  949. },
  950. },
  951. };
  952. </script>
  953. <style scoped lang="scss">
  954. .custom-table /deep/ .el-table__row {
  955. height: 30px;
  956. line-height: 1.5;
  957. }
  958. .el-input-number /deep/ .el-input__inner {
  959. text-align: right;
  960. padding-right: 5px !important;
  961. }
  962. #delivery-plan {
  963. padding: 20px;
  964. }
  965. .filter-section {
  966. margin-bottom: 20px;
  967. }
  968. .summary-section {
  969. margin-top: 20px;
  970. }
  971. </style>