list.vue 35 KB

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