edit.vue 27 KB

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