list.vue 14 KB

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