list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  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.is_click == 0"
  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: "explode_status",
  213. minWidth: 100,
  214. render: (h, params) =>
  215. h(
  216. "span",
  217. {},
  218. // params.row.explode_status == 0
  219. // ? "待审核"
  220. params.row.explode_status == 0
  221. ? "未拆单"
  222. : params.row.explode_status == 1
  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. oa_id: row.oa_id,
  330. },
  331. });
  332. break;
  333. case 3:
  334. this.$router.push({
  335. path: "/cms/measurementordermannage/edit",
  336. query: {
  337. type,
  338. order_no: row.order_no,
  339. oa_id: row.oa_id,
  340. editType: 1,
  341. // orders_area_product_detail_id:row.id
  342. },
  343. });
  344. break;
  345. case 4:
  346. this.$Modal.confirm({
  347. title: "确认删除?",
  348. content: "此操作确认后不可恢复,请确认!",
  349. onOk: () => {
  350. this.axios({
  351. method: "get",
  352. url: "/api/order_area_del",
  353. params: {
  354. order_no: row.order_no,
  355. sub_status: 2,
  356. },
  357. })
  358. .then((res) => {
  359. this.$Message.success(res.msg);
  360. this.getData(this.proxyObj);
  361. })
  362. },
  363. onCancel: () => {},
  364. });
  365. break;
  366. case 5:
  367. this.$router.push({
  368. path: "/cms/BidSystem/ProductDeOrder/budget",
  369. query: {
  370. type,
  371. order_no: row.order_no,
  372. },
  373. });
  374. break;
  375. }
  376. },
  377. init(row) {
  378. this.page_index = 1;
  379. // 2拆单 换接口 弃用
  380. // row.sub_status = 2;
  381. if (!row.explode_status&&row.explode_status!=0) {
  382. row.explode_status = 99
  383. }
  384. row.page_index = this.page_index;
  385. row.page_size = this.page_size;
  386. this.proxyObj = row;
  387. this.getData(row);
  388. },
  389. getData(row) {
  390. this.loading = true;
  391. this.axios("/api/order_area_explode_list", { params: row }).then((res) => {
  392. this.loading = false;
  393. this.tableData = res.data.data;
  394. this.total = res.data.total;
  395. this.tableheaders = res.data.tableSet || [];
  396. });
  397. },
  398. changePage(e) {
  399. this.page_index = e;
  400. this.proxyObj.page_index = this.page_index;
  401. this.getData(this.proxyObj);
  402. },
  403. changeSize(e) {
  404. this.page_size = e;
  405. this.proxyObj.page_size = this.page_size;
  406. this.getData(this.proxyObj);
  407. },
  408. async exportData() {
  409. const res = await this.axios("/api/production_export", {
  410. params: { ...this.proxyObj },
  411. });
  412. if (res.code == 200) {
  413. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  414. location.href = url;
  415. }
  416. },
  417. uploadSuccess(res) {
  418. if (res.code == 200) {
  419. this.$Message.success(res.msg || "上传成功");
  420. } else {
  421. this.$Message.warning(res.msg || "上传失败");
  422. }
  423. this.getData(this.proxyObj);
  424. },
  425. uploadError(err) {
  426. this.$Message.error(err.msg || "上传失败");
  427. },
  428. selectTable(e) {
  429. this.selects = e;
  430. },
  431. },
  432. // 监听属性 类似于data概念
  433. computed: {
  434. set_list() {
  435. return [
  436. {
  437. title: "订单编号",
  438. serverName: "order_no",
  439. name: "Input",
  440. value: "",
  441. placeholder: "请输入订单号",
  442. },
  443. {
  444. title: "项目名称",
  445. name: "Input",
  446. placeholder: "请输入",
  447. value: "",
  448. serverName: "residential_name",
  449. },
  450. {
  451. title: "客户昵称",
  452. name: "Input",
  453. placeholder: "请输入",
  454. value: "",
  455. serverName: "client_name",
  456. },
  457. {
  458. title: "手机号",
  459. name: "Input",
  460. placeholder: "请输入",
  461. value: "",
  462. serverName: "mobile",
  463. },
  464. {
  465. title: "拆单状态",
  466. name: "Select",
  467. placeholder: "请选择",
  468. serverName: "explode_status",
  469. value: 99,
  470. option: [
  471. //{ label: "待审核", value: 0 },
  472. { label: "未拆单", value: 0 },
  473. { label: "拆单中", value: 1 },
  474. { label: "拆单完成", value: 2 },
  475. ],
  476. },
  477. {
  478. title: "紧急程度",
  479. name: "Select",
  480. serverName: "warning_state",
  481. placeholder: "请选择",
  482. value: "",
  483. optionName: "title",
  484. optionValue: "id",
  485. option: this.warningList,
  486. },
  487. ];
  488. },
  489. },
  490. // 监控data中的数据变化
  491. watch: {},
  492. beforeCreate() {}, // 生命周期 - 创建之前
  493. beforeMount() {}, // 生命周期 - 挂载之前
  494. beforeUpdate() {}, // 生命周期 - 更新之前
  495. updated() {}, // 生命周期 - 更新之后
  496. beforeDestroy() {}, // 生命周期 - 销毁之前
  497. destroyed() {}, // 生命周期 - 销毁完成
  498. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  499. };
  500. </script>
  501. <style lang="scss" scoped>
  502. .pageSlotStyle {
  503. display: flex;
  504. justify-content: center;
  505. margin-top: 40px;
  506. }
  507. .process_modal {
  508. display: flex;
  509. justify-content: center;
  510. align-items: center;
  511. padding: 10px;
  512. }
  513. </style>