edit.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  1. <template>
  2. <div>
  3. <Toptitle :title="$route.query.type == 1 ? '新增请购单' : '请购单详情'">
  4. <slot name="titleButton">
  5. <Button @click="goBack" type="primary" ghost style="margin-right: 10px"
  6. >返回</Button
  7. >
  8. <Button
  9. @click="postData"
  10. type="primary"
  11. v-show="!isCheck"
  12. ghost
  13. style="margin-right: 10px"
  14. >确定</Button
  15. >
  16. </slot>
  17. </Toptitle>
  18. <div class="content_topform">
  19. <Form :label-width="90" :model="searchData">
  20. <FormItem label="项目名称:">
  21. <Input
  22. type="text"
  23. size="small"
  24. v-show="!isCheck"
  25. v-model="searchData.residential_name"
  26. style="width: 200px; margin-top: 6px"
  27. placeholder="项目名称"
  28. >
  29. <span
  30. slot="append"
  31. style="cursor: pointer"
  32. @click="showProjectModal = true"
  33. >选择</span
  34. >
  35. </Input>
  36. <span v-show="isCheck">{{ searchData.residential_name }}</span>
  37. </FormItem>
  38. <FormItem label="请购类型:">
  39. <Select
  40. v-model="searchData.type_id"
  41. size="small"
  42. clearable
  43. v-show="!isCheck"
  44. filterable
  45. label-in-value
  46. style="width: 200px"
  47. >
  48. <Option
  49. v-for="sitem in purchaseTypeList"
  50. :key="sitem.id"
  51. :label="sitem.title"
  52. :value="sitem.id"
  53. >
  54. </Option>
  55. </Select>
  56. <span
  57. v-for="item in purchaseTypeList"
  58. :key="item.id"
  59. v-show="item.id == searchData.type_id && isCheck"
  60. >{{ item.title }}</span
  61. >
  62. </FormItem>
  63. <FormItem label="单据号:">
  64. <Input
  65. type="text"
  66. size="small"
  67. v-show="!isCheck"
  68. v-model="searchData.purchase_order_apply_no"
  69. readonly
  70. style="width: 200px"
  71. placeholder="自动生成"
  72. >
  73. </Input>
  74. <span v-show="isCheck">{{ searchData.purchase_order_apply_no }}</span>
  75. </FormItem>
  76. <FormItem label="制单时间:">
  77. <DatePicker
  78. type="date"
  79. v-show="!isCheck"
  80. size="small"
  81. style="width: 200px"
  82. placeholder="年/月/日"
  83. v-model="searchData.time"
  84. ></DatePicker>
  85. <span v-show="isCheck">{{ func.replaceDate(searchData.time) }}</span>
  86. </FormItem>
  87. <FormItem label="备注">
  88. <Input
  89. type="textarea"
  90. v-show="!isCheck"
  91. size="small"
  92. v-model="searchData.remark"
  93. style="width: 200px"
  94. placeholder="备注"
  95. >
  96. </Input>
  97. <span v-show="isCheck">{{ searchData.remark }}</span>
  98. </FormItem>
  99. </Form>
  100. </div>
  101. <div class="content_table">
  102. <div class="content_table_btn">
  103. <span>请购清单</span>
  104. <Button
  105. @click="showModal = true"
  106. type="primary"
  107. v-show="!isCheck"
  108. size="small"
  109. style="margin-left: 10px"
  110. >选择物料</Button
  111. >
  112. </div>
  113. <Table :columns="tableColumns" border :data="tableData">
  114. <template slot="materiel_specs" slot-scope="{ row }">
  115. <div>
  116. {{ row.long ? row.long : 0 }}*{{ row.width ? row.width : 0 }}*{{
  117. row.high ? row.high : 0
  118. }}
  119. </div>
  120. </template>
  121. <template slot="materiel_sort" slot-scope="{ index }">
  122. <Input
  123. type="text"
  124. v-show="!isCheck"
  125. size="small"
  126. v-model="tableData[index].type_title"
  127. placeholder="数量"
  128. >
  129. </Input>
  130. <span v-show="isCheck">{{ tableData[index].type_title }}</span>
  131. </template>
  132. <template slot="materiel_name" slot-scope="{ index }">
  133. <Input
  134. type="text"
  135. v-show="!isCheck"
  136. size="small"
  137. v-model="tableData[index].title"
  138. placeholder="数量"
  139. >
  140. </Input>
  141. <span v-show="isCheck">{{ tableData[index].title }}</span>
  142. </template>
  143. <template slot="numberSet" slot-scope="{row , index }">
  144. <Tooltip
  145. placement="left"
  146. @on-popper-show="handleToolShow(index, row)"
  147. >
  148. <div slot="content">
  149. <div>
  150. <div v-for="(_item,_index) in warehouse" :key="_index">
  151. {{_item.warehouse_title}}:{{_item.num}}
  152. </div>
  153. </div>
  154. </div>
  155. <Input
  156. type="text"
  157. v-show="!isCheck"
  158. size="small"
  159. v-model="tableData[index].num"
  160. placeholder="数量"
  161. >
  162. </Input>
  163. <span v-show="isCheck">{{ tableData[index].num }}</span>
  164. </Tooltip>
  165. </template>
  166. <template slot="arrive_timeSet" slot-scope="{ index }">
  167. <DatePicker
  168. type="date"
  169. size="small"
  170. transfer
  171. v-show="!isCheck"
  172. placeholder="年/月/日"
  173. v-model="tableData[index].time"
  174. ></DatePicker>
  175. <span v-show="isCheck">{{
  176. func.replaceDate(tableData[index].time)
  177. }}</span>
  178. </template>
  179. <template slot="supply_idSet" slot-scope="{ index }">
  180. <Select
  181. v-model="tableData[index].supply_id"
  182. size="small"
  183. clearable
  184. transfer
  185. v-show="!isCheck"
  186. filterable
  187. label-in-value
  188. >
  189. <Option
  190. v-for="sitem in suppliersList"
  191. :key="sitem.id"
  192. :label="sitem.title"
  193. :value="sitem.id"
  194. >
  195. </Option>
  196. </Select>
  197. <span
  198. v-for="item in suppliersList"
  199. :key="item.id"
  200. v-show="item.id == tableData[index].supply_id && isCheck"
  201. >{{ item.title }}</span>
  202. </template>
  203. <template slot="setSlot" slot-scope="{ row, index }">
  204. <a
  205. style="margin: 0 5px"
  206. :disabled="row.state == 0"
  207. v-show="!isCheck"
  208. @click="handleSet(1, row, index)"
  209. >删除</a>
  210. </template>
  211. </Table>
  212. </div>
  213. <Modal
  214. v-model="showModal"
  215. title="选择物料"
  216. width="80"
  217. @on-ok="handleSelect"
  218. @on-cancel="showModal = false"
  219. >
  220. <div class="modal_content">
  221. <div class="modal_content_left">
  222. <Tree
  223. :data="modalData.treeData"
  224. children-key="list"
  225. style="width: 100%"
  226. @on-select-change="handleTreeSlect"
  227. class="demo-tree-render"
  228. ></Tree>
  229. </div>
  230. <div class="modal_content_center">
  231. <div class="modal_content_center_top">
  232. <div>
  233. <span>物料名称:</span>
  234. <Input
  235. type="text"
  236. v-model="modalData.title"
  237. placeholder="请输入物料名称"
  238. />
  239. </div>
  240. <Button @click="initModal()" type="primary" style="margin: 0 10px"
  241. >搜索</Button
  242. >
  243. </div>
  244. <div class="modal_content_center_body">
  245. <Table
  246. :columns="modalTableColumns"
  247. height="520"
  248. border
  249. ref="modelTable"
  250. @on-select-all="handleSelectionAll"
  251. @on-select-all-cancel="handleSelectionAllCancel"
  252. @on-select="handleSelection"
  253. @on-select-cancel="handleSelectionCancel"
  254. :loading="modalTableLoading"
  255. :data="modalData.tableData"
  256. >
  257. </Table>
  258. <div class="modal_content_center_footer">
  259. <Page
  260. :page-size-opts="[10, 20, 30, 40, 100]"
  261. @on-page-size-change="changeModalSize"
  262. @on-change="changeModalPage"
  263. :current="modal_page_index"
  264. show-total
  265. :total="modal_total"
  266. show-sizer
  267. :page-size="modal_page_size"
  268. />
  269. </div>
  270. </div>
  271. </div>
  272. <div class="modal_content_right">
  273. <span>已选</span>
  274. <Table
  275. :columns="selectedColumns"
  276. max-height="500"
  277. border
  278. :data="modalData.selectedData"
  279. >
  280. <template slot="selectedSetSlot" slot-scope="{ row, index }">
  281. <a
  282. style="margin: 0 5px; color: red"
  283. @click="handleSelectedDele(row, index)"
  284. >删除</a
  285. >
  286. </template>
  287. </Table>
  288. </div>
  289. </div>
  290. </Modal>
  291. <Modal
  292. v-model="showProjectModal"
  293. title="选择项目"
  294. width="80"
  295. @on-ok="handleProjectSelect"
  296. @on-cancel="showProjectModal = false"
  297. >
  298. <div class="modal_content">
  299. <div class="modal_content_center">
  300. <div class="modal_content_center_top">
  301. <span>项目名称:</span>
  302. <Input
  303. type="text"
  304. v-model="modalProjectData.title"
  305. style="width: 180px"
  306. placeholder="请输入物料名称"
  307. />
  308. <Button
  309. @click="initProjectModal()"
  310. type="primary"
  311. style="margin: 0 10px"
  312. >搜索</Button
  313. >
  314. </div>
  315. <div class="modal_content_center_body">
  316. <Table
  317. :columns="modalProjectTableColumns"
  318. height="520"
  319. border
  320. :loading="modalProjectTableLoading"
  321. :data="modalProjectData.tableData"
  322. >
  323. <template slot="basicTypeSet" slot-scope="{ row }">
  324. <div>
  325. <span
  326. v-for="item in warningList"
  327. :key="item.id"
  328. :style="{ color: item.color }"
  329. v-show="item.id == row.warning_state"
  330. >{{ item.title }}</span
  331. >
  332. </div>
  333. </template>
  334. </Table>
  335. <div class="modal_content_center_footer">
  336. <Page
  337. :page-size-opts="[10, 20, 30, 40, 100]"
  338. @on-page-size-change="changeProjectModalSize"
  339. @on-change="changeProjectModalPage"
  340. :current="modal_project_page_index"
  341. show-total
  342. :total="modal_project_total"
  343. show-sizer
  344. :page-size="modal_project_page_size"
  345. />
  346. </div>
  347. </div>
  348. </div>
  349. </div>
  350. </Modal>
  351. </div>
  352. </template>
  353. <script>
  354. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  355. // 例如:import 《组件名称》 from '《组件路径》';
  356. export default {
  357. name: "",
  358. components: {},
  359. props: {},
  360. // import引入的组件需要注入到对象中才能使用
  361. data() {
  362. // 这里存放数据
  363. return {
  364. searchData: {
  365. type_id: "",
  366. time: null,
  367. remark: "",
  368. },
  369. purchaseTypeList: [],
  370. tableColumns: [
  371. {
  372. title: "物料分类",
  373. key: "type_title",
  374. align: "center",
  375. minWidth: 120,
  376. slot: "materiel_sort",
  377. },
  378. {
  379. title: "物料名称",
  380. key: "title",
  381. align: "center",
  382. minWidth: 140,
  383. slot: "materiel_name",
  384. },
  385. {
  386. title: "物料规格",
  387. key: "model",
  388. align: "center",
  389. minWidth: 100,
  390. // render: (h, params) => {
  391. // const { row } = params
  392. // let text = `${row.long ? row.long : 0}*${row.width ? row.width : 0}*${row.high ? row.high : 0}`
  393. // return h('span', {
  394. // }, text)
  395. // },
  396. slot: "materiel_specs",
  397. },
  398. { title: "计量单位", key: "unit", align: "center", minWidth: 100 },
  399. {
  400. title: "请购数量",
  401. key: "num",
  402. align: "center",
  403. minWidth: 100,
  404. slot: "numberSet",
  405. },
  406. {
  407. title: "预计到货时间",
  408. key: "time",
  409. align: "center",
  410. minWidth: 180,
  411. slot: "arrive_timeSet",
  412. },
  413. {
  414. title: "建议供应商",
  415. key: "supply_id",
  416. align: "center",
  417. minWidth: 180,
  418. transfer: true,
  419. slot: "supply_idSet",
  420. },
  421. {
  422. title: "操作",
  423. key: "code",
  424. align: "center",
  425. minWidth: 80,
  426. slot: "setSlot",
  427. },
  428. ],
  429. tableData: [],
  430. showModal: false,
  431. showProjectModal: false,
  432. modalData: {
  433. title: "",
  434. tableData: [{}],
  435. selectedData: [],
  436. treeData: [
  437. {
  438. title: "物料分类",
  439. expand: true,
  440. list: [],
  441. render: (h, { root, node, data }) => {
  442. return h(
  443. "span",
  444. {
  445. style: {
  446. display: "inline-block",
  447. width: "100%",
  448. },
  449. },
  450. [
  451. h("span", [
  452. h("Icon", {
  453. props: {
  454. type: "ios-folder-outline",
  455. },
  456. style: {
  457. marginRight: "8px",
  458. },
  459. }),
  460. h("span", data.title),
  461. ]),
  462. h("span", {
  463. style: {
  464. display: "inline-block",
  465. // float: 'right',
  466. marginRight: "32px",
  467. },
  468. }),
  469. ]
  470. );
  471. },
  472. },
  473. ],
  474. },
  475. modalProjectData: {
  476. title: "",
  477. tableData: [{}],
  478. },
  479. suppliersList: [],
  480. selectedColumns: [
  481. { title: "物料名称", key: "title", align: "center", minWidth: 110 },
  482. {
  483. title: "操作",
  484. key: "title",
  485. align: "center",
  486. minWidth: 90,
  487. slot: "selectedSetSlot",
  488. },
  489. ],
  490. modalTableLoading: false,
  491. modalProjectTableLoading: false,
  492. modal_page_index: 1,
  493. modal_page_size: 10,
  494. modal_total: 0,
  495. modal_project_page_index: 1,
  496. modal_project_page_size: 10,
  497. modal_project_total: 0,
  498. modalTableColumns: [
  499. { title: "全选", type: "selection", align: "center", minWidth: 60 },
  500. { title: "物料名称", key: "title", align: "center", minWidth: 110 },
  501. { title: "物料规格", key: "model", align: "center", minWidth: 110 },
  502. { title: "计量单位", key: "unit", align: "center", minWidth: 110 },
  503. ],
  504. currentChoose: {},
  505. modalProjectTableColumns: [
  506. {
  507. title: "选择",
  508. key: "",
  509. align: "center",
  510. minWidth: 60,
  511. render: (h, params) => {
  512. let id = params.row.id;
  513. let flag = false;
  514. if (this.currentChoose.id == id) {
  515. flag = true;
  516. } else {
  517. flag = false;
  518. }
  519. let self = this;
  520. return h("div", [
  521. h("Radio", {
  522. props: {
  523. value: flag,
  524. },
  525. on: {
  526. "on-change": () => {
  527. self.currentChoose = params.row;
  528. },
  529. },
  530. }),
  531. ]);
  532. },
  533. },
  534. {
  535. title: "项目名称",
  536. key: "residential_name",
  537. align: "center",
  538. minWidth: 100,
  539. },
  540. {
  541. title: "紧急程度",
  542. align: "center",
  543. key: "warning_state",
  544. minWidth: 80,
  545. slot: "basicTypeSet",
  546. },
  547. // {
  548. // title: '紧急程度', key: 'state', align: 'center', minWidth: 80,
  549. // render: (h, params) => {
  550. // const { row } = params
  551. // const text = row.state == 1 ? '不急' : row.state == 2 ? '比较急' : row.state == 3 ? '紧急' : '非常急'
  552. // return h('span', {}, text)
  553. // }
  554. // },
  555. {
  556. title: "创建时间",
  557. key: "crt_time",
  558. align: "center",
  559. minWidth: 110,
  560. render: (h, params) => {
  561. const { row } = params;
  562. return h("span", {}, this.func.replaceDate(row.crt_time));
  563. },
  564. },
  565. ],
  566. warehouseTotal: [],
  567. warehouse: '',
  568. isCheck: false,
  569. warningList: [],
  570. };
  571. },
  572. // 生命周期 - 创建完成(可以访问当前this实例)
  573. created() {
  574. this.$route.query.type == 2
  575. ? (this.isCheck = true)
  576. : (this.isCheck = false);
  577. // 获取采购类型
  578. this.axios({ method: "get", url: "/api/basic_purchase_list" })
  579. .then((res) => {
  580. this.purchaseTypeList = res.data.data;
  581. })
  582. .catch((err) => {});
  583. // 获取操作员
  584. // this.axios('/api/user').then(res => this.salesmanList = res.data.data)
  585. // 获取基础物料类型
  586. this.axios({ method: "get", url: "/api/basics_material_index_level" })
  587. .then((res) => {
  588. this.modalData.treeData[0].list = res.data;
  589. })
  590. .catch((err) => {});
  591. // 获取供应商列表
  592. this.axios({ method: "get", url: "/api/supply_list" })
  593. .then((res) => {
  594. this.suppliersList = res.data.data;
  595. })
  596. .catch((err) => {});
  597. // 获取项目列表
  598. // this.axios({ method: 'get', url: '/api/order_index', }).then((res) => {
  599. // this.modalProjectData.tableData = res.data.data
  600. // this.modal_project_total = res.data.total
  601. // }).catch((err) => { });
  602. // 获取紧急程度
  603. this.axios.get("/api/warning_list").then((res) => {
  604. this.warningList = res.data.data;
  605. });
  606. this.initModal();
  607. this.initProjectModal();
  608. },
  609. // 生命周期 - 挂载完成(可以访问DOM元素)
  610. mounted() {
  611. if (this.$route.query.purchase_order_apply_no != "") {
  612. this.initData();
  613. }
  614. },
  615. methods: {
  616. handleToolShow(index, row) {
  617. if (this.warehouse) {
  618. return
  619. } else {
  620. this.axios
  621. .get("/api/warehouse_stock_number", {
  622. params: {
  623. material_id: row.material_id,
  624. material_detail_id: row.material_detail_id,
  625. },
  626. })
  627. .then((res) => {
  628. this.warehouse= res.data
  629. });
  630. }
  631. // this.warehouse.num = this.warehouseTotal[index].num;
  632. // this.warehouse.warehouseName = this.warehouseTotal[index].warehouseName
  633. },
  634. initData() {
  635. this.axios({
  636. method: "get",
  637. url: "/api/purchase_apply_detail",
  638. params: {
  639. purchase_order_apply_no: this.$route.query.purchase_order_apply_no,
  640. },
  641. })
  642. .then((res) => {
  643. this.tableData = res.data.list;
  644. this.searchData = res.data;
  645. this.searchData.time = this.func.replaceDate(res.data.crt_time);
  646. this.tableData.forEach((element) => {
  647. element.time = this.func.replaceDate(element.arrive_time);
  648. element.warehouse_list = []
  649. });
  650. // for (let key in this.tableData) {
  651. // this.axios({
  652. // method: "get",
  653. // url: "/api/warehouse_stock_number",
  654. // params: {
  655. // material_id: this.tableData[key].material_id,
  656. // material_detail_id: this.tableData[key].material_detail_id,
  657. // },
  658. // }).then((res) => {
  659. // res.data.forEach((el) => {
  660. // this.warehouseTotal.push(el);
  661. // });
  662. // });
  663. // }
  664. // console.log(this.warehouseTotal)
  665. })
  666. .catch((err) => {});
  667. },
  668. handleTreeSlect(array, row) {
  669. row.id &&
  670. this.axios({
  671. method: "get",
  672. url: "/api/material_detail_list",
  673. params: {
  674. page_index: this.modal_page_index,
  675. page_size: this.modal_page_size,
  676. m_id: row.id,
  677. },
  678. })
  679. .then((res) => {
  680. this.modal_total = res.data.total;
  681. this.modalData.tableData = res.data.data;
  682. })
  683. .catch((err) => {});
  684. },
  685. handleSet(type, row, index) {
  686. this.tableData.splice(index, 1);
  687. },
  688. handleSelection(selection, row) {
  689. this.modalData.selectedData.push(row);
  690. },
  691. handleSelectionCancel(selection, row) {
  692. this.modalData.selectedData.forEach((element, index) => {
  693. if (element.material_detail_id == row.material_detail_id) {
  694. this.modalData.selectedData.splice(index, 1);
  695. }
  696. });
  697. },
  698. handleSelectionAll(selection) {
  699. this.modalData.selectedData =
  700. this.modalData.selectedData.concat(selection);
  701. },
  702. handleSelectionAllCancel() {
  703. this.modalData.tableData.forEach((element) => {
  704. this.modalData.selectedData = this.modalData.selectedData.filter(
  705. (x) => {
  706. return x.material_detail_id != element.material_detail_id;
  707. }
  708. );
  709. });
  710. },
  711. reselection() {
  712. this.modalData.selectedData.forEach((element) => {
  713. this.modalData.tableData.forEach((ele, idx) => {
  714. if (element.material_detail_id == ele.material_detail_id) {
  715. this.$nextTick(() => {
  716. this.$refs.modelTable.$refs.tbody.objData[idx]._isChecked = true;
  717. this.$forceUpdate();
  718. });
  719. }
  720. });
  721. });
  722. },
  723. changeModalSize(e) {
  724. this.modal_page_size = e;
  725. this.initModal();
  726. },
  727. changeModalPage(e) {
  728. this.modal_page_index = e;
  729. this.initModal();
  730. },
  731. changeProjectModalSize(e) {
  732. this.modal_project_page_size = e;
  733. this.initProjectModal();
  734. },
  735. changeProjectModalPage(e) {
  736. this.modal_project_page_index = e;
  737. this.initProjectModal();
  738. },
  739. handleSelectedDele(row, index) {
  740. this.modalData.selectedData.splice(index, 1);
  741. },
  742. initModal() {
  743. this.axios({
  744. method: "get",
  745. url: "/api/material_detail_list",
  746. params: {
  747. page_index: this.modal_page_index,
  748. page_size: this.modal_page_size,
  749. title: this.modalData.title,
  750. },
  751. })
  752. .then((res) => {
  753. this.modal_total = res.data.total;
  754. this.modalData.tableData = res.data.data;
  755. this.reselection();
  756. })
  757. .catch((err) => {});
  758. },
  759. initProjectModal() {
  760. this.axios({
  761. method: "get",
  762. url: "/api/order_index",
  763. params: {
  764. page_index: this.modal_project_page_index,
  765. page_size: this.modal_project_page_size,
  766. title: this.modalProjectData.title,
  767. },
  768. })
  769. .then((res) => {
  770. this.modal_project_total = res.data.total;
  771. this.modalProjectData.tableData = res.data.data;
  772. })
  773. .catch((err) => {});
  774. },
  775. handleSelect() {
  776. this.modalData.selectedData.forEach((element) => {
  777. element.material_id = element.m_id;
  778. element.type_title = element.m_title;
  779. // element.arrive_time = this.func.replaceDate(element.arrive_time)
  780. element.num = null;
  781. // element.arrive_time = null
  782. element.supply_id = null;
  783. });
  784. // this.tableData = [...this.tableData, ...this.modalData.selectedData]
  785. this.tableData.splice(
  786. this.tableData.length - 1,
  787. 0,
  788. ...this.modalData.selectedData
  789. );
  790. // console.log('this.modalData.selectedData :>> ', this.modalData.selectedData);
  791. },
  792. handleProjectSelect() {
  793. this.searchData.residential_name = this.currentChoose.residential_name;
  794. this.searchData.order_no = this.currentChoose.order_no;
  795. },
  796. goBack() {
  797. this.$router.go(-1);
  798. },
  799. postData() {
  800. this.searchData.crt_time =
  801. parseInt(new Date(this.searchData.time).getTime() / 1000) || "";
  802. this.tableData.forEach((element) => {
  803. element.arrive_time =
  804. parseInt(new Date(element.time).getTime() / 1000) || "";
  805. });
  806. let url;
  807. if (this.$route.query.purchase_order_apply_no == "") {
  808. url = "/api/purchase_apply_add";
  809. } else {
  810. url = "/api/purchase_apply_edit";
  811. }
  812. this.axios({
  813. method: "post",
  814. url,
  815. data: {
  816. ...this.searchData,
  817. list: this.tableData,
  818. },
  819. })
  820. .then((res) => {
  821. this.$Message.success(res.msg);
  822. this.goBack();
  823. })
  824. .catch((err) => {});
  825. },
  826. },
  827. // 监听属性 类似于data概念
  828. computed: {},
  829. // 监控data中的数据变化
  830. watch: {},
  831. beforeCreate() {}, // 生命周期 - 创建之前
  832. beforeMount() {}, // 生命周期 - 挂载之前
  833. beforeUpdate() {}, // 生命周期 - 更新之前
  834. updated() {}, // 生命周期 - 更新之后
  835. beforeDestroy() {}, // 生命周期 - 销毁之前
  836. destroyed() {}, // 生命周期 - 销毁完成
  837. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  838. };
  839. </script>
  840. <style lang='scss' scoped>
  841. .content_topform {
  842. padding-top: 20px;
  843. /deep/.ivu-form {
  844. display: flex;
  845. justify-content: flex-start;
  846. align-items: center;
  847. flex-wrap: wrap;
  848. }
  849. /deep/.ivu-form-item {
  850. display: inline-block;
  851. width: 300px;
  852. }
  853. }
  854. .content_table {
  855. .content_table_btn {
  856. display: flex;
  857. justify-content: flex-start;
  858. align-items: center;
  859. padding-bottom: 20px;
  860. }
  861. }
  862. .modal_content {
  863. display: flex;
  864. justify-content: center;
  865. overflow: hidden;
  866. overflow-y: auto;
  867. .modal_content_left {
  868. }
  869. .modal_content_center {
  870. width: 80%;
  871. border-left: 1px solid #666;
  872. border-right: 1px solid #666;
  873. padding: 0 20px;
  874. .modal_content_center_top {
  875. display: flex;
  876. justify-content: flex-start;
  877. align-items: center;
  878. span {
  879. width: 100px;
  880. }
  881. div {
  882. display: flex;
  883. justify-content: space-around;
  884. align-items: center;
  885. span {
  886. width: 100px;
  887. }
  888. }
  889. .modal_content_center_body {
  890. overflow: hidden;
  891. overflow-y: auto;
  892. height: 500px;
  893. }
  894. }
  895. .modal_content_center_body {
  896. padding-top: 20px;
  897. }
  898. .modal_content_center_footer {
  899. display: flex;
  900. justify-content: center;
  901. padding-top: 20px;
  902. }
  903. }
  904. .modal_content_right {
  905. width: 30%;
  906. padding: 0 20px;
  907. }
  908. }
  909. /deep/ .ivu-table-wrapper {
  910. overflow: visible;
  911. } //穿透iview
  912. </style>