list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <template>
  2. <div class="BidsList">
  3. <FullPage
  4. title="生产拆单列表"
  5. :list="set_list"
  6. @init="init"
  7. :loading="loading"
  8. @searchData="init"
  9. @selectTable="selectTable"
  10. @changePage="changePage"
  11. @changeSize="changeSize"
  12. :tableColums="tableColums"
  13. :showPage="false"
  14. :tableData="tableData"
  15. :page_index="page_index"
  16. :total="total"
  17. >
  18. <div slot="titleButton" style="display: flex">
  19. <Upload
  20. name="your_file"
  21. :show-upload-list="false"
  22. :headers="headers"
  23. :on-error="uploadError"
  24. :on-success="uploadSuccess"
  25. :action="$store.state.ip + '/api/measure_orders_import'"
  26. >
  27. <Button type="success" ghost icon="md-exit" style="margin-right: 10px"
  28. >导入</Button
  29. >
  30. </Upload>
  31. <Button
  32. @click="exportData"
  33. type="warning"
  34. ghost
  35. icon="md-return-left"
  36. style="margin-right: 10px"
  37. >导出</Button
  38. >
  39. <Button
  40. @click="gopage()"
  41. type="primary"
  42. ghost
  43. style="margin-right: 10px"
  44. >新增</Button
  45. >
  46. </div>
  47. <!-- <div slot='navButton'
  48. style="display:flex;">
  49. <Button v-if='persimissionData["表头设置"]||persimissionData.all'
  50. @click="setupTableHeader"
  51. type="primary"
  52. ghost
  53. icon='ios-cog'>表头设置</Button>
  54. </div> -->
  55. <template slot="basicTypeSet" slot-scope="{ row }">
  56. <div>
  57. <span
  58. v-for="item in warningList"
  59. :key="item.id"
  60. :style="{ color: item.color }"
  61. v-show="item.id == row.warning_state"
  62. >{{ item.title }}</span
  63. >
  64. </div>
  65. </template>
  66. <template slot="set" slot-scope="{ row, index }">
  67. <div>
  68. <a
  69. style="margin: 0 5px"
  70. :disabled="row.is_click == 0"
  71. @click="handleSet(row, index, 1)"
  72. >下生产</a
  73. >
  74. <a
  75. style="margin: 0 5px"
  76. :disabled="row.sub_status == 3"
  77. @click="handleSet(row, index, 2)"
  78. >拆单</a
  79. >
  80. <a
  81. style="margin: 0 5px"
  82. :disabled="row.sub_status == 3"
  83. @click="handleSet(row, index, 2)"
  84. >变更</a
  85. >
  86. <a style="margin: 0 5px" @click="handleSet(row, index, 3)">详情</a>
  87. <a
  88. style="margin: 0 5px;"
  89. :disabled="row.sub_status != 2"
  90. :style="row.sub_status != 2 ? 'margin: 0 5px;' : 'margin: 0 5px;'"
  91. @click="handleSet(row, index, 4)"
  92. >删除</a
  93. >
  94. <a
  95. style="margin: 0 5px"
  96. :disabled="row.sub_status != 2"
  97. @click="handleSet(row, index, 5)"
  98. >成本预算</a
  99. >
  100. </div>
  101. </template>
  102. <template slot="pageSlot">
  103. <div class="pageSlotStyle">
  104. <Page
  105. :page-size-opts="[10, 20, 30, 40, 100, 1000]"
  106. @on-page-size-change="changeSize"
  107. @on-change="changePage"
  108. :current="page_index"
  109. show-total
  110. :total="total"
  111. show-sizer
  112. :page-size="page_size"
  113. />
  114. </div>
  115. </template>
  116. </FullPage>
  117. <Modal v-model="processModal" title="下生产">
  118. <div>
  119. <div class="process_modal">
  120. <span>生产人员:</span>
  121. <Select v-model="process_man" style="width: 150px">
  122. <Option
  123. v-for="item in processManList"
  124. :key="item.id"
  125. :label="item.nickname"
  126. :value="item.id"
  127. ></Option>
  128. </Select>
  129. </div>
  130. <div class="process_modal">
  131. <span>选择时间:</span>
  132. <DatePicker
  133. type="date"
  134. v-model="process_start_time"
  135. placeholder="年/月/日"
  136. style="width: 150px"
  137. ></DatePicker>
  138. <DatePicker
  139. type="date"
  140. v-model="process_end_time"
  141. placeholder="年/月/日"
  142. style="width: 150px"
  143. ></DatePicker>
  144. </div>
  145. </div>
  146. <div slot="footer">
  147. <Button
  148. @click="processModal = false"
  149. type="primary"
  150. ghost
  151. style="margin-right: 10px"
  152. >取消</Button
  153. >
  154. <Button
  155. @click="handleProcess"
  156. type="primary"
  157. style="margin-right: 10px"
  158. :disabled="process_control"
  159. >确定</Button
  160. >
  161. </div>
  162. </Modal>
  163. </div>
  164. </template>
  165. <script>
  166. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  167. // 例如:import 《组件名称》 from '《组件路径》';
  168. export default {
  169. name: "BidSystemContractList",
  170. data() {
  171. // 这里存放数据
  172. return {
  173. process_control: false,
  174. tableColums: [
  175. {
  176. type: "selection",
  177. align: "center",
  178. key: "selection",
  179. minWidth: 100,
  180. fixed: "left",
  181. title: "全选",
  182. },
  183. { title: "订单号", align: "center", key: "order_no", minWidth: 150 },
  184. {
  185. title: "项目名称",
  186. align: "center",
  187. key: "residential_name",
  188. minWidth: 120,
  189. },
  190. { title: "详细地址", align: "center", key: "address", minWidth: 200 },
  191. // {
  192. // title: '订单类型', align: 'center', key: 'renovation_type', minWidth: 100,
  193. // render: (h, params) => h('span', {}, params.row.renovation_type == 1 ? '工装' : '家装')
  194. // },
  195. {
  196. title: "客户姓名",
  197. align: "center",
  198. key: "client_name",
  199. minWidth: 120,
  200. },
  201. { title: "手机号", align: "center", key: "mobile", minWidth: 150 },
  202. {
  203. title: "紧急程度",
  204. align: "center",
  205. key: "warning_state",
  206. minWidth: 100,
  207. slot: "basicTypeSet",
  208. },
  209. {
  210. title: "收款",
  211. align: "center",
  212. key: "pay_state",
  213. minWidth: 80,
  214. render: (h, params) =>
  215. h("span", {}, params.row.pay_state == 1 ? "是" : "否"),
  216. },
  217. { title: "业务员", align: "center", key: "salesman", minWidth: 100 },
  218. {
  219. title: "开始日期",
  220. align: "center",
  221. key: "start_time",
  222. minWidth: 150,
  223. render: (h, params) =>
  224. h("span", {}, this.func.replaceDateNoHMS(params.row.start_time)),
  225. },
  226. {
  227. title: "交付日期",
  228. align: "center",
  229. key: "end_time",
  230. minWidth: 150,
  231. render: (h, params) =>
  232. h("span", {}, this.func.replaceDateNoHMS(params.row.end_time)),
  233. },
  234. {
  235. title: "拆单状态",
  236. align: "center",
  237. key: "explode_status",
  238. minWidth: 100,
  239. render: (h, params) =>
  240. h(
  241. "span",
  242. {},
  243. // params.row.explode_status == 0
  244. // ? "待审核"
  245. params.row.explode_status == 0
  246. ? "未拆单"
  247. : params.row.explode_status == 1
  248. ? "拆单中"
  249. : "拆单完成"
  250. ),
  251. },
  252. {
  253. title: "下单日期",
  254. align: "center",
  255. key: "crt_time",
  256. minWidth: 150,
  257. render: (h, params) =>
  258. h("span", {}, this.func.replaceDateNoHMS(params.row.crt_time)),
  259. },
  260. {
  261. title: "操作",
  262. align: "center",
  263. key: "set",
  264. slot: "set",
  265. fixed: "right",
  266. minWidth: 320,
  267. },
  268. ],
  269. tableData: [],
  270. page_index: 1,
  271. page_size: 10,
  272. total: 0,
  273. loading: false,
  274. proxyObj: {},
  275. headers: { Authorization: localStorage.getItem("token") },
  276. selects: [],
  277. processModal: false,
  278. process_man: "",
  279. processManList: [],
  280. process_start_time: "",
  281. process_end_time: "",
  282. order_no: "",
  283. warningList: [],
  284. };
  285. },
  286. // 生命周期 - 创建完成(可以访问当前this实例)
  287. created() {
  288. this.axios("/api/user").then(
  289. (res) => (this.processManList = res.data.data)
  290. );
  291. // 获取紧急程度
  292. this.axios.get("/api/warning_list").then((res) => {
  293. this.warningList = res.data.data;
  294. });
  295. },
  296. // 生命周期 - 挂载完成(可以访问DOM元素)
  297. mounted() {},
  298. methods: {
  299. gopage() {
  300. this.$router.push({
  301. path: "/cms/BidSystem/ProductDeOrder/infodetail",
  302. query: {
  303. type: 6,
  304. },
  305. });
  306. },
  307. handleProcess() {
  308. this.process_control = true;
  309. this.axios({
  310. method: "get",
  311. url: "/api/order_area_pull",
  312. params: {
  313. order_no: this.order_no,
  314. sub_status: 3,
  315. process_man: this.process_man,
  316. process_start_time: this.func.replaceDateNoHMS(
  317. this.process_start_time
  318. ),
  319. process_end_time: this.func.replaceDateNoHMS(this.process_end_time),
  320. },
  321. }).then((res) => {
  322. if (res.code == 200) {
  323. this.$Message.success(res.msg);
  324. this.getData(this.proxyObj);
  325. this.processModal = false;
  326. }
  327. setTimeout(() => {
  328. this.process_control = false;
  329. }, 500);
  330. });
  331. },
  332. // 1下生产 2拆单 3详情 4删除 5成本预算
  333. handleSet(row, index, type) {
  334. switch (type) {
  335. case 1:
  336. this.process_man = "";
  337. this.process_start_time = "";
  338. this.process_end_time = "";
  339. this.processModal = true;
  340. this.order_no = row.order_no;
  341. // this.$Modal.confirm({
  342. // title: '确认下生产?',
  343. // content: '确认后订单将下至生产,请确认!',
  344. // onOk: () => {
  345. // this.axios({
  346. // method: 'get',
  347. // url: '/api/order_area_pull',
  348. // params: {
  349. // order_no: row.order_no,
  350. // sub_status: 2
  351. // }
  352. // }).then((res) => {
  353. // this.$Message.success(res.msg)
  354. // this.getData(this.proxyObj)
  355. // }).catch((err) => {});
  356. // },
  357. // onCancel: () => { }
  358. // })
  359. break;
  360. case 2:
  361. this.$router.push({
  362. path: "/cms/BidSystem/ProductDeOrder/detail",
  363. query: {
  364. type,
  365. order_no: row.order_no,
  366. oa_id: row.oa_id,
  367. },
  368. });
  369. break;
  370. case 3:
  371. this.$router.push({
  372. path: "/cms/BidSystem/ProductDeOrder/infodetail",
  373. query: {
  374. type,
  375. order_no: row.order_no,
  376. oa_id: row.oa_id,
  377. editType: 1,
  378. // orders_area_product_detail_id:row.id
  379. },
  380. });
  381. break;
  382. case 4:
  383. this.$Modal.confirm({
  384. title: "确认删除?",
  385. content: "此操作确认后不可恢复,请确认!",
  386. onOk: () => {
  387. this.axios({
  388. method: "get",
  389. url: "/api/order_area_del",
  390. params: {
  391. order_no: row.order_no,
  392. sub_status: 2,
  393. },
  394. }).then((res) => {
  395. this.$Message.success(res.msg);
  396. this.getData(this.proxyObj);
  397. });
  398. },
  399. onCancel: () => {},
  400. });
  401. break;
  402. case 5:
  403. this.$router.push({
  404. path: "/cms/BidSystem/ProductDeOrder/budget",
  405. query: {
  406. type,
  407. order_no: row.order_no,
  408. },
  409. });
  410. break;
  411. }
  412. },
  413. init(row) {
  414. this.page_index = 1;
  415. // 2拆单 换接口 弃用
  416. // row.sub_status = 2;
  417. if (!row.explode_status && row.explode_status != 0) {
  418. row.explode_status = 99;
  419. }
  420. row.page_index = this.page_index;
  421. row.page_size = this.page_size;
  422. this.proxyObj = row;
  423. this.getData(row);
  424. },
  425. getData(row) {
  426. this.loading = true;
  427. this.axios("/api/order_area_explode_list", { params: row }).then(
  428. (res) => {
  429. this.loading = false;
  430. this.tableData = res.data.data;
  431. this.total = res.data.total;
  432. this.tableheaders = res.data.tableSet || [];
  433. }
  434. );
  435. },
  436. changePage(e) {
  437. this.page_index = e;
  438. this.proxyObj.page_index = this.page_index;
  439. this.getData(this.proxyObj);
  440. },
  441. changeSize(e) {
  442. this.page_size = e;
  443. this.proxyObj.page_size = this.page_size;
  444. this.getData(this.proxyObj);
  445. },
  446. async exportData() {
  447. const res = await this.axios("/api/production_export", {
  448. params: { ...this.proxyObj },
  449. });
  450. if (res.code == 200) {
  451. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  452. location.href = url;
  453. }
  454. },
  455. uploadSuccess(res) {
  456. if (res.code == 200) {
  457. this.$Message.success(res.msg || "上传成功");
  458. } else {
  459. this.$Message.warning(res.msg || "上传失败");
  460. }
  461. this.getData(this.proxyObj);
  462. },
  463. uploadError(err) {
  464. this.$Message.error(err.msg || "上传失败");
  465. },
  466. selectTable(e) {
  467. this.selects = e;
  468. },
  469. },
  470. // 监听属性 类似于data概念
  471. computed: {
  472. set_list() {
  473. return [
  474. {
  475. title: "订单编号",
  476. serverName: "order_no",
  477. name: "Input",
  478. value: "",
  479. placeholder: "请输入订单号",
  480. },
  481. {
  482. title: "项目名称",
  483. name: "Input",
  484. placeholder: "请输入",
  485. value: "",
  486. serverName: "residential_name",
  487. },
  488. {
  489. title: "客户昵称",
  490. name: "Input",
  491. placeholder: "请输入",
  492. value: "",
  493. serverName: "client_name",
  494. },
  495. {
  496. title: "手机号",
  497. name: "Input",
  498. placeholder: "请输入",
  499. value: "",
  500. serverName: "mobile",
  501. },
  502. {
  503. title: "拆单状态",
  504. name: "Select",
  505. placeholder: "请选择",
  506. serverName: "explode_status",
  507. value: 99,
  508. option: [
  509. //{ label: "待审核", value: 0 },
  510. { label: "未拆单", value: 0 },
  511. { label: "拆单中", value: 1 },
  512. { label: "拆单完成", value: 2 },
  513. ],
  514. },
  515. {
  516. title: "紧急程度",
  517. name: "Select",
  518. serverName: "warning_state",
  519. placeholder: "请选择",
  520. value: "",
  521. optionName: "title",
  522. optionValue: "id",
  523. option: this.warningList,
  524. },
  525. ];
  526. },
  527. },
  528. // 监控data中的数据变化
  529. watch: {},
  530. beforeCreate() {}, // 生命周期 - 创建之前
  531. beforeMount() {}, // 生命周期 - 挂载之前
  532. beforeUpdate() {}, // 生命周期 - 更新之前
  533. updated() {}, // 生命周期 - 更新之后
  534. beforeDestroy() {}, // 生命周期 - 销毁之前
  535. destroyed() {}, // 生命周期 - 销毁完成
  536. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  537. };
  538. </script>
  539. <style lang="scss" scoped>
  540. .pageSlotStyle {
  541. display: flex;
  542. justify-content: center;
  543. margin-top: 40px;
  544. }
  545. .process_modal {
  546. display: flex;
  547. justify-content: center;
  548. align-items: center;
  549. padding: 10px;
  550. }
  551. </style>