edit.vue 29 KB

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