list.vue 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271
  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. client_name_list:[],
  511. address_list:[],
  512. tableData: [],
  513. page_index: 1,
  514. page_size: 10,
  515. total: 0,
  516. show_lower: false,
  517. postInfo: {
  518. //下测量数据
  519. order_no: "",
  520. start_time: "",
  521. end_time: "",
  522. user_id: null,
  523. },
  524. users: [],
  525. selectIds: null,
  526. loading: false,
  527. proxyObj: {},
  528. headers: { Authorization: localStorage.getItem("token") },
  529. showModal: false,
  530. formModalColumns: [
  531. {
  532. title: "是否展示",
  533. align: "center",
  534. key: "is_show",
  535. minWidth: 60,
  536. render: (h, params) => {
  537. const { index } = params;
  538. const currentRow = JSON.parse(
  539. JSON.stringify(this.formModalTableData[index])
  540. );
  541. return h("Checkbox", {
  542. props: {
  543. value: currentRow.is_show,
  544. },
  545. on: {
  546. "on-change": (e) => {
  547. currentRow.is_show = e;
  548. this.formModalTableData.splice(index, 1, currentRow);
  549. },
  550. },
  551. });
  552. },
  553. },
  554. {
  555. title: "字段名",
  556. align: "center",
  557. key: "value",
  558. minWidth: 100,
  559. },
  560. {
  561. title: "展示名称",
  562. align: "center",
  563. key: "title",
  564. minWidth: 100,
  565. render: (h, params) => {
  566. const { index } = params;
  567. const currentRow = JSON.parse(
  568. JSON.stringify(this.formModalTableData[index])
  569. );
  570. return h("Input", {
  571. props: {
  572. value: currentRow.title,
  573. type: "text",
  574. },
  575. on: {
  576. "on-change": (e) => {
  577. currentRow.title = e.target.value;
  578. this.formModalTableData.splice(index, 1, currentRow);
  579. },
  580. },
  581. });
  582. },
  583. },
  584. ],
  585. formModalTableData: [
  586. {
  587. is_show: true,
  588. key: "order_no",
  589. value: "订单编号",
  590. title: "订单编号",
  591. },
  592. {
  593. is_show: true,
  594. key: "residential_name",
  595. value: "项目名称",
  596. title: "项目名称",
  597. },
  598. {
  599. is_show: true,
  600. key: "client_name",
  601. value: "客户姓名",
  602. title: "客户姓名",
  603. },
  604. { is_show: true, key: "address", value: "客户地址", title: "客户地址" },
  605. { is_show: true, key: "salesman", value: "业务员", title: "业务员" },
  606. { is_show: true, key: "state", value: "订单状态", title: "订单状态" },
  607. { is_show: true, key: "crt_id", value: "制单人", title: "制单人" },
  608. {
  609. is_show: true,
  610. key: "leading_name",
  611. value: "负责人",
  612. title: "负责人",
  613. },
  614. {
  615. is_show: true,
  616. key: "warning_state",
  617. value: "紧急程度",
  618. title: "紧急程度",
  619. },
  620. {
  621. is_show: true,
  622. key: "",
  623. value: "订单创建时间",
  624. title: "订单创建时间",
  625. },
  626. ],
  627. formSet: [],
  628. tableModalColumns: [
  629. {
  630. title: "是否展示",
  631. align: "center",
  632. key: "is_show",
  633. minWidth: 60,
  634. render: (h, params) => {
  635. const { index } = params;
  636. const currentRow = JSON.parse(
  637. JSON.stringify(this.tableModalTableData[index])
  638. );
  639. return h("Checkbox", {
  640. props: {
  641. value: currentRow.is_show,
  642. },
  643. on: {
  644. "on-change": (e) => {
  645. currentRow.is_show = e;
  646. this.tableModalTableData.splice(index, 1, currentRow);
  647. },
  648. },
  649. });
  650. },
  651. },
  652. {
  653. title: "字段名",
  654. align: "center",
  655. key: "value",
  656. minWidth: 100,
  657. },
  658. {
  659. title: "展示名称",
  660. align: "center",
  661. key: "title",
  662. minWidth: 100,
  663. render: (h, params) => {
  664. const { index } = params;
  665. const currentRow = JSON.parse(
  666. JSON.stringify(this.tableModalTableData[index])
  667. );
  668. return h("Input", {
  669. props: {
  670. value: currentRow.title,
  671. type: "text",
  672. disabled: currentRow.title == "全选" ? true : false,
  673. },
  674. on: {
  675. "on-change": (e) => {
  676. currentRow.title = e.target.value;
  677. this.tableModalTableData.splice(index, 1, currentRow);
  678. },
  679. },
  680. });
  681. },
  682. },
  683. ],
  684. sub_formModalTableData: [],
  685. tableModalTableData: [
  686. { is_show: true, key: "selection", value: "全选", title: "全选" },
  687. {
  688. is_show: true,
  689. key: "order_no",
  690. value: "订单编号",
  691. title: "订单编号",
  692. },
  693. {
  694. is_show: true,
  695. key: "residential_name",
  696. value: "项目名称",
  697. title: "项目名称",
  698. },
  699. { is_show: true, key: "nickname", value: "业务员", title: "业务员" },
  700. {
  701. is_show: true,
  702. key: "client_name",
  703. value: "客户姓名",
  704. title: "客户姓名",
  705. },
  706. { is_show: true, key: "address", value: "客户地址", title: "客户地址" },
  707. {
  708. is_show: true,
  709. key: "leading_name",
  710. value: "负责人",
  711. title: "负责人",
  712. },
  713. {
  714. is_show: true,
  715. key: "warning_state",
  716. value: "紧急程度",
  717. title: "紧急程度",
  718. },
  719. {
  720. is_show: true,
  721. key: "predict_price",
  722. value: "产品总价",
  723. title: "产品总价",
  724. },
  725. {
  726. is_show: true,
  727. key: "fax_price",
  728. value: "折扣金额",
  729. title: "折扣金额",
  730. },
  731. { is_show: true, key: "price", value: "订单金额", title: "订单金额" },
  732. { is_show: true, key: "get_money", value: "已收款", title: "已收款" },
  733. { is_show: true, key: "unget_money", value: "未收款", title: "未收款" },
  734. { is_show: true, key: "remark", value: "备注", title: "备注" },
  735. {
  736. is_show: true,
  737. key: "start_time",
  738. value: "订单开始日期",
  739. title: "订单开始日期",
  740. },
  741. {
  742. is_show: true,
  743. key: "end_time",
  744. value: "订单交付日期",
  745. title: "订单交付日期",
  746. },
  747. {
  748. is_show: true,
  749. key: "complete_rate",
  750. value: "生产进度",
  751. title: "生产进度",
  752. },
  753. { is_show: true, key: "state", value: "订单状态", title: "订单状态" },
  754. { is_show: true, key: "crt_name", value: "制单人", title: "制单人" },
  755. {
  756. is_show: true,
  757. key: "crt_time",
  758. value: "订单创建时间",
  759. title: "订单创建时间",
  760. },
  761. { is_show: true, key: "set", value: "操作", title: "操作" },
  762. ],
  763. sub_tableModalTableData: [],
  764. tableSet: [],
  765. currencyPageId: null,
  766. chargeModal: false,
  767. chargeModalForm: {
  768. order_no: null,
  769. title: null,
  770. price: null,
  771. remark: null,
  772. },
  773. warningList: [],
  774. showSortModal: false,
  775. sortList: [{ sort: null, level: 1, value: "" }],
  776. headerList: [],
  777. leadingList: [],
  778. };
  779. },
  780. computed: {
  781. ...mapState(["persimissionData"]),
  782. set_list() {
  783. if (this.sub_formModalTableData.length < 1) {
  784. this.list;
  785. }
  786. return this.func.computedForm(this.sub_formModalTableData, this.list);
  787. },
  788. list() {
  789. return [
  790. {
  791. title: "订单编号",
  792. name: "Input",
  793. placeholder: "请输入订单编号",
  794. value: "",
  795. serverName: "order_no",
  796. },
  797. {
  798. title: "项目名称",
  799. name: "Input",
  800. placeholder: "请输入项目名称",
  801. value: "",
  802. serverName: "residential_name",
  803. },
  804. {
  805. title: "客户姓名",
  806. name: "Select",
  807. placeholder: "请输入客户姓名",
  808. filterable: true,
  809. value: "",
  810. serverName: "client_name",
  811. optionName: "client_name",
  812. optionValue: "client_name",
  813. option: this.client_name_list,
  814. },
  815. {
  816. title: "客户地址",
  817. name: "Select",
  818. placeholder: "请输入客户地址",
  819. filterable: true,
  820. value: "",
  821. serverName: "address",
  822. optionName: "address",
  823. optionValue: "address",
  824. option: this.address_list,
  825. },
  826. {
  827. title: "业务员",
  828. name: "Select",
  829. placeholder: "请输入业务员",
  830. filterable: true,
  831. value: "",
  832. serverName: "salesman",
  833. optionName: "nickname",
  834. optionValue: "nickname",
  835. option: this.users,
  836. },
  837. {
  838. title: "订单状态",
  839. name: "Select",
  840. placeholder: "请选择订单状态",
  841. serverName: "state",
  842. value: "",
  843. option: [
  844. { label: "全部", value: 0 },
  845. { label: "测量未审核", value: 1 },
  846. { label: "测量审核中", value: 2 },
  847. { label: "测量通过", value: 3 },
  848. { label: "生产中", value: 4 },
  849. { label: "生产审核中", value: 5 },
  850. { label: "生产通过", value: 6 },
  851. { label: "到生产计划", value: 7 },
  852. { label: "派工", value: 8 },
  853. { label: "包装", value: 9 },
  854. { label: "发货", value: 10 },
  855. { label: "安装", value: 11 },
  856. ],
  857. },
  858. {
  859. title: "紧急程度",
  860. name: "Select",
  861. placeholder: "请选择紧急程度",
  862. optionName: "title",
  863. optionValue: "id",
  864. serverName: "warning_state",
  865. value: "",
  866. option: this.warningList,
  867. },
  868. {
  869. title: "制单人",
  870. name: "Select",
  871. placeholder: "请选择制单人",
  872. filterable: true,
  873. value: "",
  874. serverName: "crt_id",
  875. optionName: "nickname",
  876. optionValue: "id",
  877. option: this.users,
  878. },
  879. {
  880. title: "负责人",
  881. name: "Select",
  882. placeholder: "请选择负责人",
  883. filterable: true,
  884. value: "",
  885. serverName: "leading_name",
  886. optionName: "leading_name",
  887. optionValue: "leading_name",
  888. option: this.leadingList,
  889. },
  890. {
  891. title: "订单创建时间",
  892. start_server: "start_time",
  893. end_server: "end_time",
  894. name: "Input",
  895. start_value: "",
  896. end_value: "",
  897. isDate: true,
  898. start_placeholder: "开始日期",
  899. end_placeholder: "结束日期",
  900. },
  901. ];
  902. },
  903. computedTable() {
  904. if (this.sub_tableModalTableData.length < 1) {
  905. return this.tableColums;
  906. }
  907. return this.func.computedHeader(
  908. this.sub_tableModalTableData,
  909. this.tableColums
  910. );
  911. },
  912. },
  913. watch: {
  914. computedTable() {
  915. if (this.computedTable[0].title == "全选") {
  916. this.headerList = JSON.parse(JSON.stringify(this.computedTable));
  917. this.headerList.splice(0, 1);
  918. } else {
  919. this.headerList = this.computedTable;
  920. }
  921. },
  922. },
  923. created() {
  924. // 获取紧急程度
  925. this.axios.get("/api/warning_list").then((res) => {
  926. this.warningList = res.data.data;
  927. });
  928. // 获取负责人
  929. this.axios.get("/api/custom__detail_list").then((res) => {
  930. this.leadingList = res.data;
  931. });
  932. this.axios("/api/user", { params: { type: 1 } }).then(
  933. (res) => (this.users = res.data.data)
  934. );
  935. // this.$store.state.navgationData[0].sub[0].sub[0]
  936. this.currencyPageId = this.$store.state.navgationData[0].sub[0].sub[0].id;
  937. },
  938. beforeRouteLeave(to, from, next) {
  939. if (to.path != "/cms/ordermannage/businessorderlist/edit") {
  940. this.$route.meta.keepAlive = false;
  941. } else {
  942. this.$route.meta.keepAlive = true;
  943. }
  944. next();
  945. },
  946. beforeRouteEnter(to, from, next) {
  947. next((vm) => {
  948. vm.getData(vm.proxyObj);
  949. });
  950. },
  951. methods: {
  952. init(row) {
  953. this.page_index = 1;
  954. row.page_index = this.page_index;
  955. row.page_size = this.page_size;
  956. this.proxyObj = row;
  957. this.getData(row);
  958. },
  959. getData(row) {
  960. this.loading = true;
  961. this.axios("/api/order_list_new", {
  962. params: { ...row },
  963. }).then((res) => {
  964. if (res.code == 200) {
  965. this.loading = false;
  966. if (!res.data.data) {
  967. return this.$Message.error("列表数据返回格式不正确");
  968. }
  969. this.tableData = res.data.data;
  970. this.total = res.data.total;
  971. this.handleSetHeader(res);
  972. for(let i = 0;i<res.data.address.length;i++){
  973. this.address_list.push({address:res.data.address[i]})
  974. }
  975. for(let i = 0;i<res.data.client_name.length;i++){
  976. this.client_name_list.push({client_name:res.data.client_name[i]})
  977. }
  978. }
  979. });
  980. },
  981. handleSetHeader(res) {
  982. this.tableModalTableData =
  983. res.data.tableSet.tableSet.length < 1
  984. ? this.tableModalTableData
  985. : res.data.tableSet.tableSet;
  986. this.formModalTableData =
  987. res.data.tableSet.formSet.length < 1
  988. ? this.formModalTableData
  989. : res.data.tableSet.formSet;
  990. this.sub_formModalTableData = JSON.parse(
  991. JSON.stringify(this.formModalTableData)
  992. );
  993. this.sub_tableModalTableData = JSON.parse(
  994. JSON.stringify(this.tableModalTableData)
  995. );
  996. },
  997. changePage(e) {
  998. this.page_index = e;
  999. this.proxyObj.page_index = this.page_index;
  1000. const sortList = this.sortList.filter((item) => item.sort);
  1001. this.proxyObj.sortList = sortList;
  1002. this.getData(this.proxyObj);
  1003. },
  1004. changeSize(e) {
  1005. this.page_size = e;
  1006. this.proxyObj.page_size = this.page_size;
  1007. const sortList = this.sortList.filter((item) => item.sort);
  1008. this.proxyObj.sortList = sortList;
  1009. this.getData(this.proxyObj);
  1010. },
  1011. addOrder(n, row) {
  1012. let order_no = row ? row.order_no : "";
  1013. this.$router.push({
  1014. path:
  1015. this.$store.state.userInfo.is_agent == 1
  1016. ? "/cms/ordermannage/businessorderlist/agentorder"
  1017. : "/cms/ordermannage/businessorderlist/edit",
  1018. query: {
  1019. type: n,
  1020. order_no,
  1021. },
  1022. });
  1023. },
  1024. handleChargeModalOk() {
  1025. this.axios
  1026. .post("/api/order_price_add", { ...this.chargeModalForm })
  1027. .then((res) => {
  1028. if (res.code == 200) {
  1029. this.$Message.success(res.msg);
  1030. this.chargeModal = false;
  1031. }
  1032. });
  1033. },
  1034. handleOrderCopy(row) {
  1035. this.axios
  1036. .post("/api/support_order_copy", { order_no: row.order_no })
  1037. .then((res) => {
  1038. if (res.code == 200) {
  1039. this.init(this.proxyObj);
  1040. }
  1041. });
  1042. },
  1043. handleOpenCharge(row) {
  1044. this.chargeModalForm.order_no = row.order_no;
  1045. this.chargeModalForm.title = "";
  1046. this.chargeModalForm.price = "";
  1047. this.chargeModalForm.remark = "";
  1048. this.axios
  1049. .get("/api/order_price", { params: { order_no: row.order_no } })
  1050. .then((res) => {
  1051. this.modalChargeTableData = res.data;
  1052. this.chargeModal = true;
  1053. this.init(this.proxyObj);
  1054. });
  1055. },
  1056. openLower(row, title, url) {
  1057. console.log("row :>> ", row);
  1058. if (!row) {
  1059. return this.$Message.warning("请至少选择一项");
  1060. }
  1061. this.postInfo.order_no = Array.isArray(row)
  1062. ? row.join(",")
  1063. : row.order_no;
  1064. if(title==="测量"){ this.$Modal.confirm({
  1065. title: "批量下测量",
  1066. content: "确定下测量?",
  1067. onOk: () => {
  1068. this.axios({
  1069. method: "post",
  1070. url,
  1071. data: {
  1072. order_no: this.postInfo.order_no,
  1073. },
  1074. }).then((res) => {
  1075. if (res.code == 200) {
  1076. this.$Message.success(res.msg);
  1077. this.getData(this.proxyObj);
  1078. }
  1079. });
  1080. },
  1081. onCancel: () => {},
  1082. });}
  1083. else{
  1084. this.$Modal.confirm({
  1085. title: "批量下生产",
  1086. content: "确定下生产?",
  1087. onOk: () => {
  1088. this.axios({
  1089. method: "post",
  1090. url,
  1091. data: {
  1092. order_no: this.postInfo.order_no,
  1093. },
  1094. }).then((res) => {
  1095. if (res.code == 200) {
  1096. this.$Message.success(res.msg);
  1097. this.getData(this.proxyObj);
  1098. }
  1099. });
  1100. },
  1101. onCancel: () => {},
  1102. });}
  1103. // this.dowmMeasurement({
  1104. // url,
  1105. // title,
  1106. // params: this.postInfo,
  1107. // then: () => {
  1108. // this.selectIds = [];
  1109. // this.postInfo = {};
  1110. // this.getData(this.proxyObj);
  1111. // },
  1112. // cancel: () => {
  1113. // this.postInfo = {};
  1114. // },
  1115. // });
  1116. },
  1117. selectTable(e) {
  1118. let result = [];
  1119. e.map((v) => result.push(v.order_no));
  1120. this.selectIds = result;
  1121. },
  1122. delItems(row) {
  1123. this.confirmDelete({
  1124. content: "确认删除么?",
  1125. then: () => {
  1126. this.axios
  1127. .post("/api/order_del", { order_no: row.order_no, state: 0 })
  1128. .then((res) => {
  1129. if (res.code == 200) {
  1130. this.$Message.success(res.msg);
  1131. this.getData(this.proxyObj);
  1132. }
  1133. });
  1134. },
  1135. });
  1136. },
  1137. handleForceDele() {
  1138. if (this.selectIds && this.selectIds.length > 0) {
  1139. const p_list = this.selectIds.map((item) => {
  1140. return this.axios.post("/api/support_order_del", { order_no: item });
  1141. });
  1142. Promise.all(p_list).then((list) => {
  1143. this.init(this.proxyObj);
  1144. });
  1145. } else {
  1146. this.$Message.warning("请选择数据");
  1147. }
  1148. },
  1149. async exportData() {
  1150. const res = await this.axios("/api/orders_export", {
  1151. params: { ...this.proxyObj },
  1152. });
  1153. if (res.code == 200) {
  1154. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  1155. location.href = url;
  1156. }
  1157. },
  1158. uploadSuccess(res) {
  1159. if (res.code == 200) {
  1160. this.$Message.success(res.msg || "上传成功");
  1161. } else {
  1162. this.$Message.warning(res.msg || "上传失败");
  1163. }
  1164. this.getData(this.proxyObj);
  1165. },
  1166. uploadError(err) {
  1167. this.$Message.error(err.msg || "上传失败");
  1168. },
  1169. setupTableHeader() {
  1170. this.showModal = true;
  1171. return;
  1172. },
  1173. handleSortSet() {
  1174. this.showSortModal = true;
  1175. },
  1176. handleSortListChange(arr, type, index, obj) {
  1177. if (obj) {
  1178. arr.splice(index + 1, type, obj);
  1179. } else {
  1180. arr.splice(index, type);
  1181. }
  1182. },
  1183. handleConfirmSort() {
  1184. if (
  1185. this.sortList.length > 1 ||
  1186. (this.sortList.length == 1 && this.sortList[0].sort)
  1187. ) {
  1188. this.loading = true;
  1189. this.axios("/api/order_list_new", {
  1190. params: { ...this.proxyObj, sortList: this.sortList },
  1191. }).then((res) => {
  1192. if (res.code == 200) {
  1193. this.loading = false;
  1194. if (!res.data.data) {
  1195. return this.$Message.error("列表数据返回格式不正确");
  1196. }
  1197. this.tableData = res.data.data;
  1198. this.total = res.data.total;
  1199. this.showSortModal = false;
  1200. // this.tableModalTableData =
  1201. // res.data.tableSet.tableSet.length < 1
  1202. // ? this.tableModalTableData
  1203. // : res.data.tableSet.tableSet;
  1204. // this.formModalTableData =
  1205. // res.data.tableSet.formSet.length < 1
  1206. // ? this.formModalTableData
  1207. // : res.data.tableSet.formSet;
  1208. // this.sub_formModalTableData = JSON.parse(
  1209. // JSON.stringify(this.formModalTableData)
  1210. // );
  1211. // this.sub_tableModalTableData = JSON.parse(
  1212. // JSON.stringify(this.tableModalTableData)
  1213. // );
  1214. }
  1215. });
  1216. } else {
  1217. this.showSortModal = false;
  1218. }
  1219. },
  1220. onDragDrop(a, b, table, type) {
  1221. if (type == 2 && (a == 0 || b == 0)) {
  1222. return this.$Message.warning("全选位置不可变");
  1223. }
  1224. table.splice(b, 0, ...table.splice(a, 1));
  1225. },
  1226. handleModalOk() {
  1227. this.formModalTableData.forEach((element, index) => {
  1228. element.sort = index;
  1229. });
  1230. this.tableModalTableData.forEach((element, index) => {
  1231. element.sort = index;
  1232. });
  1233. this.axios({
  1234. method: "post",
  1235. url: "/api/update/table",
  1236. data: {
  1237. id: this.currencyPageId,
  1238. result: {
  1239. formSet: this.formModalTableData,
  1240. tableSet: this.tableModalTableData,
  1241. },
  1242. },
  1243. }).then((res) => {
  1244. this.$Message.success(res.msg);
  1245. this.init(this.proxyObj);
  1246. });
  1247. },
  1248. },
  1249. };
  1250. </script>
  1251. <style lang="scss" scoped>
  1252. .pageSlotStyle {
  1253. display: flex;
  1254. justify-content: center;
  1255. margin-top: 40px;
  1256. }
  1257. .modal_content {
  1258. display: flex;
  1259. justify-content: center;
  1260. // width: 500px;
  1261. }
  1262. /deep/.ivu-tabs-nav-scroll {
  1263. display: flex;
  1264. justify-content: center;
  1265. }
  1266. </style>