list.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088
  1. <template>
  2. <div>
  3. <FullPage
  4. title="家装订单列表"
  5. :list="set_list"
  6. @init="init"
  7. :loading="loading"
  8. @searchData="init"
  9. @changePage="changePage"
  10. @changeSize="changeSize"
  11. @selectTable="selectTable"
  12. :tableColums="computedTable"
  13. :tableData="tableData"
  14. :max-height="500"
  15. :page_index="page_index"
  16. :showPage="false"
  17. :total="total"
  18. >
  19. <div slot="titleButton" style="display: flex">
  20. <Upload
  21. name="your_file"
  22. :show-upload-list="false"
  23. :headers="headers"
  24. :on-error="uploadError"
  25. :on-success="uploadSuccess"
  26. :action="$store.state.ip + '/api/orders_import'"
  27. >
  28. <Button
  29. v-if="persimissionData['批量导入'] || persimissionData.all"
  30. type="success"
  31. ghost
  32. icon="md-exit"
  33. style="margin-right: 10px"
  34. >批量导入</Button
  35. >
  36. </Upload>
  37. <Button
  38. v-if="persimissionData['批量导出'] || persimissionData.all"
  39. @click="exportData"
  40. type="warning"
  41. ghost
  42. style="margin-right: 10px"
  43. icon="md-return-left"
  44. >批量导出</Button
  45. >
  46. <Button
  47. v-if="persimissionData['批量下测量'] || persimissionData.all"
  48. type="primary"
  49. style="margin-right: 10px"
  50. @click="openLower(selectIds, '测量', 'orders_set_measure')"
  51. ghost
  52. >批量下测量</Button
  53. >
  54. <Button
  55. v-if="persimissionData['批量下生产'] || persimissionData.all"
  56. type="primary"
  57. @click="openLower(selectIds, '生产', 'order_oa_people')"
  58. ghost
  59. >批量下生产</Button
  60. >
  61. </div>
  62. <div slot="navButton" style="display: flex">
  63. <!-- v-if="persimissionData['排序设置'] || persimissionData.all" -->
  64. <Button
  65. @click="handleSortSet"
  66. type="primary"
  67. style="margin-right: 10px"
  68. ghost
  69. icon="ios-cog"
  70. >排序设置</Button
  71. >
  72. <Button
  73. v-if="persimissionData['表头设置'] || persimissionData.all"
  74. @click="setupTableHeader"
  75. type="primary"
  76. style="margin-right: 10px"
  77. ghost
  78. icon="ios-cog"
  79. >设置</Button
  80. >
  81. <Button
  82. v-if="persimissionData['新增订单'] || persimissionData.all"
  83. @click="addOrder(1)"
  84. type="primary"
  85. ghost
  86. icon="ios-add"
  87. >新增订单</Button
  88. >
  89. </div>
  90. <template slot="basicTypeSet" slot-scope="{ row }">
  91. <div>
  92. <span
  93. v-for="item in warningList"
  94. :key="item.id"
  95. :style="{ color: item.color }"
  96. v-show="item.id == row.warning_state"
  97. >{{ item.title }}</span
  98. >
  99. </div>
  100. </template>
  101. <template slot="set" slot-scope="{ row }">
  102. <div>
  103. <a
  104. v-if="persimissionData['收款'] || persimissionData.all"
  105. @click="handleOpenCharge(row, '收款', 'orders_set_measure')"
  106. style="margin: 0 5px"
  107. >收款</a
  108. >
  109. <a
  110. v-if="persimissionData['下生产'] || persimissionData.all"
  111. @click="openLower(row, '生产', 'order_oa_people')"
  112. style="margin: 0 5px"
  113. >下生产</a
  114. >
  115. <a
  116. v-if="
  117. (persimissionData['编辑'] || persimissionData.all) &&
  118. row.state == 0
  119. "
  120. style="margin: 0 5px"
  121. @click="addOrder(2, row)"
  122. >编辑</a
  123. >
  124. <a
  125. v-if="persimissionData['详情'] || persimissionData.all"
  126. style="margin: 0 5px"
  127. @click="addOrder(3, row)"
  128. >详情</a
  129. >
  130. <a
  131. v-if="
  132. (persimissionData['删除'] || persimissionData.all) &&
  133. row.state == 0
  134. "
  135. style="margin: 0 5px"
  136. @click="delItems(row)"
  137. >删除</a
  138. >
  139. </div>
  140. </template>
  141. <template slot="pageSlot">
  142. <div class="pageSlotStyle">
  143. <Page
  144. :page-size-opts="[10, 20, 30, 40, 100, 1000]"
  145. @on-page-size-change="changeSize"
  146. @on-change="changePage"
  147. :current="page_index"
  148. show-total
  149. :total="total"
  150. show-sizer
  151. :page-size="page_size"
  152. />
  153. </div>
  154. </template>
  155. </FullPage>
  156. <Modal
  157. v-model="chargeModal"
  158. title="收款"
  159. @on-ok="handleChargeModalOk"
  160. @on-cancel="chargeModal = false"
  161. >
  162. <div>
  163. <Form :model="chargeModalForm" :label-width="80">
  164. <FormItem label="收款项目:">
  165. <Input
  166. type="text"
  167. v-model="chargeModalForm.title"
  168. placeholder="请输入收款项目"
  169. />
  170. </FormItem>
  171. <FormItem label="收款金额:">
  172. <Input
  173. type="text"
  174. v-model="chargeModalForm.price"
  175. placeholder="请输入收款金额"
  176. />
  177. </FormItem>
  178. <FormItem label="备注:">
  179. <Input
  180. type="text"
  181. v-model="chargeModalForm.remark"
  182. placeholder="请输入备注"
  183. />
  184. </FormItem>
  185. </Form>
  186. <Table
  187. :columns="modalChargeTablecolumns"
  188. border
  189. :data="modalChargeTableData"
  190. ></Table>
  191. </div>
  192. </Modal>
  193. <Modal
  194. v-model="showModal"
  195. title="设置"
  196. @on-ok="handleModalOk"
  197. @on-cancel="showModal = false"
  198. >
  199. <div class="modal_content">
  200. <Tabs
  201. value="name1"
  202. style="max-height: 700px; overflow: hidden; overflow-y: auto"
  203. >
  204. <TabPane label="表单设置" name="name1">
  205. <Table
  206. :columns="formModalColumns"
  207. border
  208. draggable
  209. @on-drag-drop="(a, b) => onDragDrop(a, b, formModalTableData, 1)"
  210. :data="formModalTableData"
  211. ></Table>
  212. </TabPane>
  213. <TabPane label="表头设置" name="name2">
  214. <Table
  215. :columns="tableModalColumns"
  216. border
  217. draggable
  218. @on-drag-drop="(a, b) => onDragDrop(a, b, tableModalTableData, 2)"
  219. :data="tableModalTableData"
  220. ></Table>
  221. </TabPane>
  222. </Tabs>
  223. </div>
  224. </Modal>
  225. <!-- 排序设置弹窗 -->
  226. <Modal v-model="showSortModal" title="排序设置" width="650">
  227. <div>
  228. <Form
  229. :label-width="80"
  230. inline
  231. v-for="(_item, _index) in sortList"
  232. :key="_index"
  233. >
  234. <FormItem :label="'关键字' + (_index + 1)">
  235. <Select filterable clearable transfer v-model="_item.value">
  236. <Option
  237. v-for="item of headerList"
  238. :key="item.key"
  239. :label="item.title"
  240. :value="item.key"
  241. ></Option>
  242. </Select>
  243. </FormItem>
  244. <FormItem label="排序方式">
  245. <Select
  246. style="width:150px"
  247. filterable
  248. clearable
  249. transfer
  250. v-model="_item.sort"
  251. >
  252. <Option label="升序" :value="1"></Option>
  253. <Option label="降序" :value="2"></Option>
  254. </Select>
  255. </FormItem>
  256. <FormItem :label-width="10">
  257. <Icon
  258. @click="
  259. handleSortListChange(sortList, 0, _index, {
  260. sort: null,
  261. level: sortList.length + 1,
  262. value: '',
  263. })
  264. "
  265. style="'margin:0 10px"
  266. size="20"
  267. type="ios-add"
  268. />
  269. <Icon
  270. @click="handleSortListChange(sortList, 1, _index, null)"
  271. v-show="sortList.length > 1"
  272. style="'margin:0 10px"
  273. size="20"
  274. type="ios-remove"
  275. />
  276. </FormItem>
  277. </Form>
  278. </div>
  279. <div slot="footer">
  280. <Button
  281. @click="showSortModal = false"
  282. type="primary"
  283. style="margin-right: 10px"
  284. >取消</Button
  285. >
  286. <Button
  287. @click="handleConfirmSort"
  288. type="primary"
  289. style="margin-right: 10px"
  290. >确定</Button
  291. >
  292. </div>
  293. </Modal>
  294. </div>
  295. </template>
  296. <script>
  297. import { mapState } from "vuex";
  298. export default {
  299. data() {
  300. return {
  301. tableColums: [
  302. {
  303. type: "selection",
  304. align: "center",
  305. key: "selection",
  306. minWidth: 100,
  307. fixed: "left",
  308. title: "全选",
  309. },
  310. { title: "订单编号", align: "center", key: "order_no", minWidth: 200 },
  311. {
  312. title: "项目名称",
  313. align: "center",
  314. key: "residential_name",
  315. minWidth: 200,
  316. },
  317. { title: "业务员", align: "center", key: "nickname", minWidth: 150 },
  318. {
  319. title: "客户姓名",
  320. align: "center",
  321. key: "client_name",
  322. minWidth: 150,
  323. },
  324. { title: "客户地址", align: "center", key: "address", minWidth: 200 },
  325. { title: "审核人", align: "center", key: "crt_name", minWidth: 150 },
  326. {
  327. title: "紧急程度",
  328. align: "center",
  329. key: "warning_state",
  330. minWidth: 100,
  331. slot: "basicTypeSet",
  332. },
  333. {
  334. title: "产品总价",
  335. align: "center",
  336. key: "predict_price",
  337. minWidth: 120,
  338. },
  339. { title: "折扣金额", align: "center", key: "fax_price", minWidth: 120 },
  340. {
  341. title: "订单金额",
  342. align: "center",
  343. key: "price",
  344. minWidth: 120,
  345. render(h, params) {
  346. return h(
  347. "span",
  348. {},
  349. (params.row.predict_price - params.row.fax_price).toFixed(2)
  350. );
  351. },
  352. },
  353. { title: "已收款", align: "center", key: "get_money", minWidth: 120 },
  354. {
  355. title: "未收款",
  356. align: "center",
  357. key: "unget_money",
  358. minWidth: 120,
  359. render(h, params) {
  360. return h(
  361. "span",
  362. {},
  363. params.row.predict_price - params.row.get_money
  364. );
  365. },
  366. },
  367. {
  368. title: "备注",
  369. align: "center",
  370. key: "remark",
  371. minWidth: 100,
  372. tooltip: true,
  373. },
  374. {
  375. title: "订单开始日期",
  376. align: "center",
  377. minWidth: 180,
  378. key: "start_time",
  379. render: (h, params) =>
  380. h("span", {}, this.func.replaceDate(params.row.start_time, 1)),
  381. },
  382. {
  383. title: "订单交付日期",
  384. align: "center",
  385. minWidth: 180,
  386. key: "end_time",
  387. render: (h, params) =>
  388. h("span", {}, this.func.replaceDate(params.row.end_time, 1)),
  389. },
  390. {
  391. title: "生产进度",
  392. align: "center",
  393. key: "complete_rate",
  394. minWidth: 180,
  395. render(h, params) {
  396. return h(
  397. "span",
  398. {},
  399. parseInt(params.row.complete_rate * 100) + "%"
  400. );
  401. },
  402. },
  403. {
  404. title: "订单状态",
  405. align: "center",
  406. key: "state",
  407. minWidth: 150,
  408. render: (h, params) =>
  409. h(
  410. "span",
  411. {},
  412. params.row.state == 0
  413. ? "全部"
  414. : params.row.state == 1
  415. ? "测量未审核"
  416. : params.row.state == 2
  417. ? "测量审核中"
  418. : params.row.state == 3
  419. ? "测量通过"
  420. : params.row.state == 4
  421. ? "生产未审核"
  422. : params.row.state == 5
  423. ? "生产审核中"
  424. : params.row.state == 6
  425. ? "生产通过"
  426. : params.row.state == 7
  427. ? "到生产计划"
  428. : params.row.state == 8
  429. ? "派工"
  430. : params.row.state == 9
  431. ? "包装"
  432. : params.row.state == 10
  433. ? "发货"
  434. : "安装"
  435. ),
  436. },
  437. {
  438. title: "订单创建时间",
  439. align: "center",
  440. minWidth: 180,
  441. key: "crt_time",
  442. render: (h, params) =>
  443. h("span", {}, this.func.replaceDate(params.row.crt_time)),
  444. },
  445. // {
  446. // title: '预估交付日期', align: 'center', minWidth: 200, key: 'predict_time',
  447. // render: (h, params) => h('span', {}, this.func.replaceDate(params.row.predict_time, 1))
  448. // },
  449. {
  450. title: "操作",
  451. align: "center",
  452. key: "set",
  453. slot: "set",
  454. fixed: "right",
  455. minWidth: 220,
  456. },
  457. ],
  458. modalChargeTablecolumns: [
  459. { title: "收款项目", align: "center", key: "title" },
  460. { title: "收款金额", align: "center", key: "price" },
  461. {
  462. title: "收款时间",
  463. align: "center",
  464. key: "crt_time",
  465. render: (h, params) =>
  466. h("span", {}, this.func.replaceDate(params.row.crt_time)),
  467. },
  468. { title: "收款备注", align: "center", key: "remark" },
  469. ],
  470. modalChargeTableData: [],
  471. tableData: [],
  472. page_index: 1,
  473. page_size: 10,
  474. total: 0,
  475. show_lower: false,
  476. postInfo: {
  477. //下测量数据
  478. order_no: "",
  479. start_time: "",
  480. end_time: "",
  481. user_id: null,
  482. },
  483. users: [],
  484. selectIds: null,
  485. loading: false,
  486. proxyObj: {},
  487. headers: { Authorization: localStorage.getItem("token") },
  488. showModal: false,
  489. formModalColumns: [
  490. {
  491. title: "是否展示",
  492. align: "center",
  493. key: "is_show",
  494. minWidth: 60,
  495. render: (h, params) => {
  496. const { index } = params;
  497. const currentRow = JSON.parse(
  498. JSON.stringify(this.formModalTableData[index])
  499. );
  500. return h("Checkbox", {
  501. props: {
  502. value: currentRow.is_show,
  503. },
  504. on: {
  505. "on-change": (e) => {
  506. currentRow.is_show = e;
  507. this.formModalTableData.splice(index, 1, currentRow);
  508. },
  509. },
  510. });
  511. },
  512. },
  513. {
  514. title: "字段名",
  515. align: "center",
  516. key: "value",
  517. minWidth: 100,
  518. },
  519. {
  520. title: "展示名称",
  521. align: "center",
  522. key: "title",
  523. minWidth: 100,
  524. render: (h, params) => {
  525. const { index } = params;
  526. const currentRow = JSON.parse(
  527. JSON.stringify(this.formModalTableData[index])
  528. );
  529. return h("Input", {
  530. props: {
  531. value: currentRow.title,
  532. type: "text",
  533. },
  534. on: {
  535. "on-change": (e) => {
  536. currentRow.title = e.target.value;
  537. this.formModalTableData.splice(index, 1, currentRow);
  538. },
  539. },
  540. });
  541. },
  542. },
  543. ],
  544. formModalTableData: [
  545. {
  546. is_show: true,
  547. key: "order_no",
  548. value: "订单编号",
  549. title: "订单编号",
  550. },
  551. {
  552. is_show: true,
  553. key: "residential_name",
  554. value: "项目名称",
  555. title: "项目名称",
  556. },
  557. {
  558. is_show: true,
  559. key: "client_name",
  560. value: "客户姓名",
  561. title: "客户姓名",
  562. },
  563. { is_show: true, key: "address", value: "客户地址", title: "客户地址" },
  564. { is_show: true, key: "salesman", value: "业务员", title: "业务员" },
  565. { is_show: true, key: "state", value: "订单状态", title: "订单状态" },
  566. {
  567. is_show: true,
  568. key: "warning_state",
  569. value: "紧急程度",
  570. title: "紧急程度",
  571. },
  572. ],
  573. formSet: [],
  574. tableModalColumns: [
  575. {
  576. title: "是否展示",
  577. align: "center",
  578. key: "is_show",
  579. minWidth: 60,
  580. render: (h, params) => {
  581. const { index } = params;
  582. const currentRow = JSON.parse(
  583. JSON.stringify(this.tableModalTableData[index])
  584. );
  585. return h("Checkbox", {
  586. props: {
  587. value: currentRow.is_show,
  588. },
  589. on: {
  590. "on-change": (e) => {
  591. currentRow.is_show = e;
  592. this.tableModalTableData.splice(index, 1, currentRow);
  593. },
  594. },
  595. });
  596. },
  597. },
  598. {
  599. title: "字段名",
  600. align: "center",
  601. key: "value",
  602. minWidth: 100,
  603. },
  604. {
  605. title: "展示名称",
  606. align: "center",
  607. key: "title",
  608. minWidth: 100,
  609. render: (h, params) => {
  610. const { index } = params;
  611. const currentRow = JSON.parse(
  612. JSON.stringify(this.tableModalTableData[index])
  613. );
  614. return h("Input", {
  615. props: {
  616. value: currentRow.title,
  617. type: "text",
  618. disabled: currentRow.title == "全选" ? true : false,
  619. },
  620. on: {
  621. "on-change": (e) => {
  622. currentRow.title = e.target.value;
  623. this.tableModalTableData.splice(index, 1, currentRow);
  624. },
  625. },
  626. });
  627. },
  628. },
  629. ],
  630. sub_formModalTableData: [],
  631. tableModalTableData: [
  632. { is_show: true, key: "selection", value: "全选", title: "全选" },
  633. {
  634. is_show: true,
  635. key: "order_no",
  636. value: "订单编号",
  637. title: "订单编号",
  638. },
  639. {
  640. is_show: true,
  641. key: "residential_name",
  642. value: "项目名称",
  643. title: "项目名称",
  644. },
  645. { is_show: true, key: "nickname", value: "业务员", title: "业务员" },
  646. {
  647. is_show: true,
  648. key: "client_name",
  649. value: "客户姓名",
  650. title: "客户姓名",
  651. },
  652. { is_show: true, key: "address", value: "客户地址", title: "客户地址" },
  653. { is_show: true, key: "crt_name", value: "审核人", title: "审核人" },
  654. {
  655. is_show: true,
  656. key: "warning_state",
  657. value: "紧急程度",
  658. title: "紧急程度",
  659. },
  660. {
  661. is_show: true,
  662. key: "predict_price",
  663. value: "产品总价",
  664. title: "产品总价",
  665. },
  666. {
  667. is_show: true,
  668. key: "fax_price",
  669. value: "折扣金额",
  670. title: "折扣金额",
  671. },
  672. { is_show: true, key: "price", value: "订单金额", title: "订单金额" },
  673. { is_show: true, key: "get_money", value: "已收款", title: "已收款" },
  674. { is_show: true, key: "unget_money", value: "未收款", title: "未收款" },
  675. { is_show: true, key: "remark", value: "备注", title: "备注" },
  676. {
  677. is_show: true,
  678. key: "start_time",
  679. value: "订单开始日期",
  680. title: "订单开始日期",
  681. },
  682. {
  683. is_show: true,
  684. key: "end_time",
  685. value: "订单交付日期",
  686. title: "订单交付日期",
  687. },
  688. {
  689. is_show: true,
  690. key: "complete_rate",
  691. value: "生产进度",
  692. title: "生产进度",
  693. },
  694. { is_show: true, key: "state", value: "订单状态", title: "订单状态" },
  695. {
  696. is_show: true,
  697. key: "crt_time",
  698. value: "订单创建时间",
  699. title: "订单创建时间",
  700. },
  701. { is_show: true, key: "set", value: "操作", title: "操作" },
  702. ],
  703. sub_tableModalTableData: [],
  704. tableSet: [],
  705. currencyPageId: null,
  706. chargeModal: false,
  707. chargeModalForm: {
  708. order_no: null,
  709. title: null,
  710. price: null,
  711. remark: null,
  712. },
  713. warningList: [],
  714. showSortModal: false,
  715. sortList: [{ sort: null, level: 1, value: "" }],
  716. headerList: [],
  717. };
  718. },
  719. computed: {
  720. ...mapState(["persimissionData"]),
  721. set_list() {
  722. if (this.sub_formModalTableData.length < 1) {
  723. this.list;
  724. }
  725. return this.func.computedForm(this.sub_formModalTableData, this.list);
  726. },
  727. list() {
  728. return [
  729. {
  730. title: "订单编号",
  731. name: "Input",
  732. placeholder: "请输入订单编号",
  733. value: "",
  734. serverName: "order_no",
  735. },
  736. {
  737. title: "项目名称",
  738. name: "Input",
  739. placeholder: "请输入项目名称",
  740. value: "",
  741. serverName: "residential_name",
  742. },
  743. {
  744. title: "客户姓名",
  745. name: "Input",
  746. placeholder: "请输入客户姓名",
  747. value: "",
  748. serverName: "client_name",
  749. },
  750. {
  751. title: "客户地址",
  752. name: "Input",
  753. placeholder: "请输入客户地址",
  754. value: "",
  755. serverName: "address",
  756. },
  757. {
  758. title: "业务员",
  759. name: "Select",
  760. placeholder: "请输入业务员",
  761. filterable: true,
  762. value: "",
  763. serverName: "salesman",
  764. optionName: "nickname",
  765. optionValue: "id",
  766. option: this.users,
  767. },
  768. {
  769. title: "订单状态",
  770. name: "Select",
  771. placeholder: "请选择订单状态",
  772. serverName: "state",
  773. value: "",
  774. option: [
  775. { label: "全部", value: 0 },
  776. { label: "测量未审核", value: 1 },
  777. { label: "测量审核中", value: 2 },
  778. { label: "测量通过", value: 3 },
  779. { label: "生产未审核", value: 4 },
  780. { label: "生产审核中", value: 5 },
  781. { label: "生产通过", value: 6 },
  782. { label: "到生产计划", value: 7 },
  783. { label: "派工", value: 8 },
  784. { label: "包装", value: 9 },
  785. { label: "发货", value: 10 },
  786. { label: "安装", value: 11 },
  787. ],
  788. },
  789. {
  790. title: "紧急程度",
  791. name: "Select",
  792. placeholder: "请选择紧急程度",
  793. optionName: "title",
  794. optionValue: "id",
  795. serverName: "warning_state",
  796. value: "",
  797. option: this.warningList,
  798. },
  799. {
  800. title: "制单人",
  801. name: "Select",
  802. placeholder: "请选择制单人",
  803. filterable: true,
  804. value: "",
  805. serverName: "crt_name",
  806. optionName: "nickname",
  807. optionValue: "id",
  808. option: this.users,
  809. },
  810. ];
  811. },
  812. computedTable() {
  813. if (this.sub_tableModalTableData.length < 1) {
  814. return this.tableColums;
  815. }
  816. return this.func.computedHeader(
  817. this.sub_tableModalTableData,
  818. this.tableColums
  819. );
  820. },
  821. },
  822. watch: {
  823. computedTable() {
  824. if (this.computedTable[0].title == "全选") {
  825. this.headerList = JSON.parse(JSON.stringify(this.computedTable));
  826. this.headerList.splice(0, 1);
  827. } else {
  828. this.headerList = this.computedTable;
  829. }
  830. },
  831. },
  832. created() {
  833. // 获取紧急程度
  834. this.axios.get("/api/warning_list").then((res) => {
  835. this.warningList = res.data.data;
  836. });
  837. this.axios("/api/user", { params: { type: 1 } }).then(
  838. (res) => (this.users = res.data.data)
  839. );
  840. // this.$store.state.navgationData[0].sub[0].sub[0]
  841. this.currencyPageId = this.$store.state.navgationData[0].sub[0].sub[0].id;
  842. },
  843. beforeRouteLeave(to, from, next) {
  844. if (to.path != "/cms/ordermannage/businessorderlist/edit") {
  845. this.$route.meta.keepAlive = false;
  846. } else {
  847. this.$route.meta.keepAlive = true;
  848. }
  849. next();
  850. },
  851. methods: {
  852. init(row) {
  853. this.page_index = 1;
  854. row.page_index = this.page_index;
  855. row.page_size = this.page_size;
  856. this.proxyObj = row;
  857. this.getData(row);
  858. },
  859. getData(row) {
  860. this.loading = true;
  861. this.axios("/api/order_list_new", { params: row }).then((res) => {
  862. if (res.code == 200) {
  863. this.loading = false;
  864. if (!res.data.data) {
  865. return this.$Message.error("列表数据返回格式不正确");
  866. }
  867. this.tableData = res.data.data;
  868. this.total = res.data.total;
  869. this.tableModalTableData =
  870. res.data.tableSet.tableSet.length < 1
  871. ? this.tableModalTableData
  872. : res.data.tableSet.tableSet;
  873. this.formModalTableData =
  874. res.data.tableSet.formSet.length < 1
  875. ? this.formModalTableData
  876. : res.data.tableSet.formSet;
  877. this.sub_formModalTableData = JSON.parse(
  878. JSON.stringify(this.formModalTableData)
  879. );
  880. this.sub_tableModalTableData = JSON.parse(
  881. JSON.stringify(this.tableModalTableData)
  882. );
  883. }
  884. });
  885. },
  886. changePage(e) {
  887. this.page_index = e;
  888. this.proxyObj.page_index = this.page_index;
  889. this.getData(this.proxyObj);
  890. },
  891. changeSize(e) {
  892. this.page_size = e;
  893. this.proxyObj.page_size = this.page_size;
  894. this.getData(this.proxyObj);
  895. },
  896. addOrder(n, row) {
  897. let order_no = row ? row.order_no : "";
  898. this.$router.push({
  899. path:
  900. this.$store.state.userInfo.is_agent == 1
  901. ? "/cms/ordermannage/businessorderlist/agentorder"
  902. : "/cms/ordermannage/businessorderlist/edit",
  903. query: {
  904. type: n,
  905. order_no,
  906. },
  907. });
  908. },
  909. handleChargeModalOk() {
  910. this.axios
  911. .post("/api/order_price_add", { ...this.chargeModalForm })
  912. .then((res) => {
  913. if (res.code == 200) {
  914. this.$Message.success(res.msg);
  915. this.chargeModal = false;
  916. }
  917. });
  918. },
  919. handleOpenCharge(row) {
  920. this.chargeModalForm.order_no = row.order_no;
  921. this.chargeModalForm.title = "";
  922. this.chargeModalForm.price = "";
  923. this.chargeModalForm.remark = "";
  924. this.axios
  925. .get("/api/order_price", { params: { order_no: row.order_no } })
  926. .then((res) => {
  927. this.modalChargeTableData = res.data;
  928. this.chargeModal = true;
  929. this.init(this.proxyObj);
  930. });
  931. },
  932. openLower(row, title, url) {
  933. if (!row) {
  934. return this.$Message.warning("请至少选择一项");
  935. }
  936. this.postInfo.order_no = Array.isArray(row)
  937. ? row.join(",")
  938. : row.order_no;
  939. this.dowmMeasurement({
  940. url,
  941. title,
  942. params: this.postInfo,
  943. then: () => {
  944. this.selectIds = [];
  945. this.postInfo = {};
  946. this.getData(this.proxyObj);
  947. },
  948. cancel: () => {
  949. this.postInfo = {};
  950. },
  951. });
  952. },
  953. selectTable(e) {
  954. let result = [];
  955. e.map((v) => result.push(v.order_no));
  956. this.selectIds = result;
  957. },
  958. delItems(row) {
  959. this.confirmDelete({
  960. content: "确认删除么?",
  961. then: () => {
  962. this.axios
  963. .post("/api/order_del", { order_no: row.order_no, state: 0 })
  964. .then((res) => {
  965. if (res.code == 200) {
  966. this.$Message.success(res.msg);
  967. this.getData(this.proxyObj);
  968. }
  969. });
  970. },
  971. });
  972. },
  973. async exportData() {
  974. const res = await this.axios("/api/orders_export", {
  975. params: { ...this.proxyObj },
  976. });
  977. if (res.code == 200) {
  978. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  979. location.href = url;
  980. }
  981. },
  982. uploadSuccess(res) {
  983. if (res.code == 200) {
  984. this.$Message.success(res.msg || "上传成功");
  985. } else {
  986. this.$Message.warning(res.msg || "上传失败");
  987. }
  988. this.getData(this.proxyObj);
  989. },
  990. uploadError(err) {
  991. this.$Message.error(err.msg || "上传失败");
  992. },
  993. setupTableHeader() {
  994. this.showModal = true;
  995. return;
  996. },
  997. handleSortSet() {
  998. this.showSortModal = true;
  999. },
  1000. handleSortListChange(arr, type, index, obj) {
  1001. if (obj) {
  1002. arr.splice(index + 1, type, obj);
  1003. } else {
  1004. arr.splice(index, type);
  1005. }
  1006. },
  1007. handleConfirmSort() {
  1008. this.loading = true;
  1009. this.axios("/api/order_list_new", {
  1010. params: { ...this.proxyObj, sortList: this.sortList },
  1011. }).then((res) => {
  1012. if (res.code == 200) {
  1013. this.loading = false;
  1014. if (!res.data.data) {
  1015. return this.$Message.error("列表数据返回格式不正确");
  1016. }
  1017. this.tableData = res.data.data;
  1018. this.total = res.data.total;
  1019. this.tableModalTableData =
  1020. res.data.tableSet.tableSet.length < 1
  1021. ? this.tableModalTableData
  1022. : res.data.tableSet.tableSet;
  1023. this.formModalTableData =
  1024. res.data.tableSet.formSet.length < 1
  1025. ? this.formModalTableData
  1026. : res.data.tableSet.formSet;
  1027. this.sub_formModalTableData = JSON.parse(
  1028. JSON.stringify(this.formModalTableData)
  1029. );
  1030. this.sub_tableModalTableData = JSON.parse(
  1031. JSON.stringify(this.tableModalTableData)
  1032. );
  1033. }
  1034. });
  1035. },
  1036. onDragDrop(a, b, table, type) {
  1037. if (type == 2 && (a == 0 || b == 0)) {
  1038. return this.$Message.warning("全选位置不可变");
  1039. }
  1040. table.splice(b, 0, ...table.splice(a, 1));
  1041. },
  1042. handleModalOk() {
  1043. this.formModalTableData.forEach((element, index) => {
  1044. element.sort = index;
  1045. });
  1046. this.tableModalTableData.forEach((element, index) => {
  1047. element.sort = index;
  1048. });
  1049. this.axios({
  1050. method: "post",
  1051. url: "/api/update/table",
  1052. data: {
  1053. id: this.currencyPageId,
  1054. result: {
  1055. formSet: this.formModalTableData,
  1056. tableSet: this.tableModalTableData,
  1057. },
  1058. },
  1059. })
  1060. .then((res) => {
  1061. this.$Message.success(res.msg);
  1062. this.init(this.proxyObj);
  1063. })
  1064. .catch((err) => {});
  1065. },
  1066. },
  1067. };
  1068. </script>
  1069. <style lang="scss" scoped>
  1070. .pageSlotStyle {
  1071. display: flex;
  1072. justify-content: center;
  1073. margin-top: 40px;
  1074. }
  1075. .modal_content {
  1076. display: flex;
  1077. justify-content: center;
  1078. // width: 500px;
  1079. }
  1080. /deep/.ivu-tabs-nav-scroll {
  1081. display: flex;
  1082. justify-content: center;
  1083. }
  1084. </style>