detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. <template>
  2. <div class="BidSystemProductDeOrderEdit">
  3. <Toptitle title="拆单页">
  4. <slot name="titleButton">
  5. <Button
  6. @click="handleFinish(0)"
  7. type="primary"
  8. style="margin-right: 10px"
  9. >取消完成</Button
  10. >
  11. <Button
  12. @click="handleFinish(1)"
  13. type="primary"
  14. style="margin-right: 10px"
  15. >完成</Button
  16. >
  17. <Button
  18. @click="showSupModal = true"
  19. type="primary"
  20. style="margin-right:10px;"
  21. >项目辅料</Button
  22. >
  23. <Button
  24. @click="goback()"
  25. type="primary"
  26. ghost
  27. style="margin-right:10px;"
  28. >返回</Button
  29. >
  30. <!-- <Button
  31. @click="postData()"
  32. type="primary"
  33. ghost
  34. style="margin-right:10px;"
  35. >保存</Button
  36. > -->
  37. </slot>
  38. </Toptitle>
  39. <div class="top_search_info">
  40. <Form inline :label-width="100">
  41. <FormItem label="产品名称:">
  42. <Input
  43. type="text"
  44. size="small"
  45. clearable
  46. v-model="searchData.title"
  47. placeholder="请输入产品名称"
  48. />
  49. </FormItem>
  50. <FormItem label="图号:">
  51. <Input
  52. type="text"
  53. size="small"
  54. clearable
  55. v-model="searchData.url_number"
  56. style="width: 150px"
  57. placeholder="请输入图号"
  58. />
  59. </FormItem>
  60. <FormItem label="是否完成:">
  61. <Select
  62. v-model="searchData.status"
  63. size="small"
  64. clearable
  65. filterable
  66. style="width: 150px"
  67. >
  68. <Option label="是" :value="1"></Option>
  69. <Option label="否" :value="0"></Option>
  70. </Select>
  71. </FormItem>
  72. <FormItem label="是否下生产:">
  73. <Select
  74. v-model="searchData.sub_state"
  75. size="small"
  76. clearable
  77. filterable
  78. style="width: 150px"
  79. >
  80. <Option label="是" :value="2"></Option>
  81. <Option label="否" :value="1"></Option>
  82. </Select>
  83. </FormItem>
  84. <FormItem>
  85. <Button
  86. size="small"
  87. type="primary"
  88. @click="
  89. initData(
  90. formData.order_no,
  91. formData.orders_area_product_detail_id
  92. )
  93. "
  94. >搜索</Button
  95. >
  96. </FormItem>
  97. </Form>
  98. </div>
  99. <div class="top_search">
  100. <div><span>订单号:</span>{{ formData.order_no }}</div>
  101. <div><span>项目名称:</span>{{ formData.residential_name }}</div>
  102. <div><span>客户姓名:</span>{{ formData.client_name }}</div>
  103. <div>
  104. <span>紧急程度:</span
  105. ><span
  106. v-for="_item in warningList"
  107. :key="_item.id"
  108. v-show="_item.id == formData.warning_state"
  109. >{{ _item.title }}</span
  110. >
  111. </div>
  112. <div>
  113. <span>收款:</span>{{ formData.pay_state == 1 ? "已收款" : "未收款" }}
  114. </div>
  115. <div><span>详细地址:</span>{{ formData.address }}</div>
  116. <div><span>手机号:</span>{{ formData.mobile }}</div>
  117. <div>
  118. <span>开始日期:</span>{{ func.replaceDate(formData.start_time) }}
  119. </div>
  120. <div><span>交付日期:</span>{{ func.replaceDate(formData.end_time) }}</div>
  121. <div>
  122. <span>业务员:</span>
  123. <span
  124. v-for="item in salesmanList"
  125. :key="item.id"
  126. v-show="formData.salesman == item.id"
  127. >{{ formData.salesman }}</span
  128. >
  129. </div>
  130. <!-- <div><span>订单类型:</span>{{formData.renovation_type==1?"工装":"家装"}}</div> -->
  131. <div><span>备注:</span>{{ formData.remark }}</div>
  132. </div>
  133. <div class="addArea">
  134. <div class="addAreaTable">
  135. <Table
  136. :columns="tableColumns"
  137. :data="formData.detail"
  138. border
  139. @on-selection-change="changeSelection"
  140. >
  141. <template slot="set" slot-scope="{ row, index }">
  142. <a
  143. :disabled="row.explode_status != 0"
  144. style="margin:0 5px"
  145. @click="handleSet(row, index, 1)"
  146. >拆单</a
  147. >
  148. <a style="margin:0 5px" @click="handleSet(row, index, 2)">详情</a>
  149. </template>
  150. </Table>
  151. </div>
  152. </div>
  153. <!-- 项目辅料弹窗 -->
  154. <Modal title="项目辅料" v-model="showSupModal" :width="400">
  155. <div>
  156. <div class="supModalBtn">
  157. <!-- <Button @click="handleAddSup" type="primary">新增</Button> -->
  158. </div>
  159. <Table :columns="supTableColumns" :data="supTableData" border>
  160. <template slot="combine" slot-scope="{ index }">
  161. <Select
  162. v-model="supTableData[index].id"
  163. @on-change="handlechange"
  164. transfer
  165. size="small"
  166. >
  167. <Option
  168. v-for="item in combineList"
  169. :value="item.id"
  170. :key="item.id"
  171. :label="item.title"
  172. ></Option>
  173. </Select>
  174. </template>
  175. <template slot="supSet" slot-scope="{ row, index }">
  176. <a
  177. style="margin: 0 5px; color: red"
  178. v-show="$route.query.type != 3"
  179. @click="handleSupSet(row, index)"
  180. >删除</a
  181. >
  182. </template>
  183. </Table>
  184. </div>
  185. <div class="modal-footer" slot="footer">
  186. <Button @click="showSupModal = false">取消</Button>
  187. <Button type="primary" @click="showSupModal = false">确认</Button>
  188. </div>
  189. </Modal>
  190. </div>
  191. </template>
  192. <script>
  193. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  194. // 例如:import 《组件名称》 from '《组件路径》';
  195. export default {
  196. name: "BidSystemProductDeOrderEdit",
  197. components: {},
  198. props: {},
  199. // import引入的组件需要注入到对象中才能使用
  200. data() {
  201. // 这里存放数据
  202. return {
  203. selection_check: "",
  204. detail_id: [],
  205. showSupModal: false,
  206. showPDTModal: false,
  207. formData: {
  208. order_no: "",
  209. orders_area_product_detail_id: "",
  210. residential_name: "",
  211. client_name: "",
  212. address: "",
  213. mobile: "",
  214. pay_state: "",
  215. warning_state: "",
  216. salesman: "",
  217. remark: "",
  218. //区域列表
  219. area: [
  220. {
  221. num: "",
  222. title: "",
  223. unit: "",
  224. quantity: "",
  225. house_type: "",
  226. remark: "",
  227. order_no: "",
  228. product: [
  229. // {
  230. // title:'',
  231. // num:'',
  232. // measure:'',
  233. // process_property:'',
  234. // url:'',
  235. // url_number:'',
  236. // remark:''
  237. // }
  238. ],
  239. },
  240. ],
  241. },
  242. product: [{}],
  243. searchData: {},
  244. tableColumns: [
  245. {
  246. type: "selection",
  247. width: 60,
  248. align: "center",
  249. },
  250. {
  251. title: "序号",
  252. type: "index",
  253. align: "center",
  254. minWidth: 80,
  255. resizable: true,
  256. },
  257. {
  258. title: "产品名称",
  259. key: "title",
  260. align: "center",
  261. minWidth: 120,
  262. resizable: true,
  263. },
  264. {
  265. title: "计量单位",
  266. key: "unit",
  267. align: "center",
  268. minWidth: 100,
  269. resizable: true,
  270. },
  271. {
  272. title: "图号",
  273. key: "url_number",
  274. align: "center",
  275. minWidth: 80,
  276. resizable: true,
  277. },
  278. {
  279. title: "数量",
  280. key: "num",
  281. align: "center",
  282. minWidth: 80,
  283. resizable: true,
  284. },
  285. {
  286. title: "规格",
  287. key: "measure",
  288. align: "center",
  289. minWidth: 140,
  290. resizable: true,
  291. },
  292. {
  293. title: "工艺属性",
  294. key: "process_property",
  295. align: "center",
  296. minWidth: 140,
  297. resizable: true,
  298. tooltip: true,
  299. },
  300. {
  301. title: "图纸",
  302. key: "url",
  303. align: "center",
  304. resizable: true,
  305. minWidth: 80,
  306. render: (h, params) => {
  307. const { row } = params;
  308. return h(
  309. "div",
  310. row.url.map((item, index) => {
  311. return h("img", {
  312. attrs: {
  313. src: this.$store.state.ip + item,
  314. style:
  315. "max-width:50px;max-height:50px;position:relative;top:3px;",
  316. },
  317. on: {
  318. click: (e) => {
  319. // this.axios('/api/orders_img', { params: { id: row.id, type: 1 } }).then(res => {
  320. // if (res.code == 200) {
  321. // row.imgs = res.data
  322. let list = [];
  323. row.url.forEach((el) => {
  324. list.push({ img_url: el });
  325. });
  326. this.$previewImg({
  327. list,
  328. baseUrl: this.$store.state.ip,
  329. baseImgField: "img_url",
  330. baseTitleField: "",
  331. });
  332. // }
  333. // })
  334. },
  335. },
  336. });
  337. })
  338. );
  339. },
  340. },
  341. {
  342. title: "左右式",
  343. key: "left_right_mode",
  344. align: "center",
  345. resizable: true,
  346. minWidth: 80,
  347. render: (h, params) => {
  348. const { row } = params;
  349. return h(
  350. "span",
  351. {},
  352. row.left_right_mode == 1
  353. ? "左式"
  354. : row.left_right_mode == 2
  355. ? "右式"
  356. : "无"
  357. );
  358. },
  359. },
  360. {
  361. title: "拆单状态",
  362. key: "status",
  363. align: "center",
  364. resizable: true,
  365. minWidth: 80,
  366. render: (h, params) => {
  367. const { row } = params;
  368. return h("span", {}, row.explode_status == 0 ? "未完成" : "已完成");
  369. },
  370. },
  371. {
  372. title: "是否下生产",
  373. key: "",
  374. align: "center",
  375. resizable: true,
  376. width: 80,
  377. render: (h, params) => {
  378. return h("span", {}, params.row.status == 0 ? "否" : "是");
  379. },
  380. },
  381. {
  382. title: "操作",
  383. key: "name",
  384. align: "center",
  385. width: "120",
  386. slot: "set",
  387. minWidth: 80,
  388. // fixed: "right",
  389. resizable: true,
  390. },
  391. ],
  392. //产品分类列表
  393. PDTTypeList: [],
  394. //业务员列表
  395. salesmanList: [],
  396. warningList: [],
  397. supTableColumns: [
  398. { title: "序号", type: "index", align: "center", minWidth: 100 },
  399. {
  400. title: "辅料名称",
  401. key: "title",
  402. align: "center",
  403. slot: "combine",
  404. minWidth: 150,
  405. },
  406. { title: "操作", align: "center", slot: "supSet", minWidth: 100 },
  407. ],
  408. supTableData: [], //项目辅料→辅料名称列表
  409. combineList: [], //项目辅料列表
  410. };
  411. },
  412. // 生命周期 - 创建完成(可以访问当前this实例)
  413. created() {
  414. // 获取项目辅料列表
  415. this.axios("/api/material_combination").then((res) => {
  416. this.combineList = res.data.data;
  417. });
  418. // 2编辑 3详情 4变更 5变更记录
  419. this.$route.query.type == 3 ? (this.isChecked = true) : "";
  420. this.$route.query.order_no
  421. ? (this.formData.order_no = this.$route.query.order_no)
  422. : "";
  423. this.$route.query.orders_area_product_detail_id
  424. ? (this.formData.orders_area_product_detail_id = this.$route.query.orders_area_product_detail_id)
  425. : "";
  426. // 获取紧急程度
  427. this.axios.get("/api/warning_list").then((res) => {
  428. this.warningList = res.data.data;
  429. });
  430. // 获取项目辅料
  431. // this.axios
  432. // .get("/api/todo", { params: { order_no: this.formData.order_no } })
  433. // .then((res) => {
  434. // this.supTableData = res.data
  435. // });
  436. },
  437. // 生命周期 - 挂载完成(可以访问DOM元素)
  438. mounted() {
  439. this.axios("/api/user").then((res) => (this.salesmanList = res.data.data));
  440. this.axios("/api/parts_product_list").then((res) => {
  441. this.PDTTypeList = res.data;
  442. });
  443. this.initData(
  444. this.formData.order_no,
  445. this.formData.orders_area_product_detail_id
  446. );
  447. },
  448. methods: {
  449. changeSelection(e) {
  450. this.selection_check = e;
  451. e.forEach((item) => {
  452. this.detail_id.push(item.id);
  453. });
  454. },
  455. handleFinish(status) {
  456. if (this.selection_check.length == 0) {
  457. this.$Message.warning("请选择数据");
  458. } else {
  459. this.$Modal.confirm({
  460. title: "确认完成?",
  461. // content: "此操作确认后不可恢复,请确认!",
  462. onOk: () => {
  463. this.axios({
  464. method: "post",
  465. url: "/api/order_area_product_status",
  466. data: {
  467. status,
  468. orders_area_product_detail_id: this.detail_id,
  469. },
  470. }).then((res) => {
  471. if (res.code == 200) {
  472. this.$Message.success(res.msg);
  473. this.initData(
  474. this.formData.order_no,
  475. this.formData.orders_area_product_detail_id
  476. );
  477. }
  478. });
  479. },
  480. onCancel: () => {
  481. console.log(this.$refs.selection);
  482. },
  483. });
  484. }
  485. },
  486. //项目辅料新增
  487. handleAddSup() {
  488. this.supTableData.push({ id: "" });
  489. },
  490. //项目辅料删除
  491. handleSupSet(row, index) {
  492. this.supTableData.splice(index, 1);
  493. },
  494. handlechange(val) {
  495. console.log("val :>> ", val);
  496. },
  497. initData(order_no, orders_area_product_detail_id) {
  498. this.axios({
  499. method: "get",
  500. url: "/api/order_area_explode",
  501. params: {
  502. order_no,
  503. oa_id: this.$route.query.oa_id,
  504. ...this.searchData,
  505. },
  506. }).then((res) => {
  507. this.formData = res.data;
  508. this.supTableData = res.data.ext;
  509. // this.formData.list.forEach((element) => {
  510. // element.product.forEach((el, index) => {
  511. // el.index = index + 1;
  512. // });
  513. // });
  514. });
  515. },
  516. // 1拆单 2详情
  517. handleSet(row, index, type) {
  518. this.$router.push({
  519. path: "/cms/BidSystem/ProductDeOrder/deorderdetail",
  520. query: {
  521. type,
  522. order_no: this.$route.query.order_no,
  523. oa_id: this.$route.query.oa_id,
  524. orders_area_product_detail_id: row.id,
  525. },
  526. });
  527. },
  528. postData() {
  529. this.axios({
  530. method: "post",
  531. url: "/api/order_area_add",
  532. data: {
  533. ...this.formData,
  534. },
  535. }).then((res) => {
  536. this.$Message.success(res.msg);
  537. });
  538. },
  539. goback() {
  540. this.$router.go(-1);
  541. },
  542. },
  543. // 监听属性 类似于data概念
  544. computed: {},
  545. // 监控data中的数据变化
  546. watch: {},
  547. beforeCreate() {}, // 生命周期 - 创建之前
  548. beforeMount() {}, // 生命周期 - 挂载之前
  549. beforeUpdate() {}, // 生命周期 - 更新之前
  550. updated() {}, // 生命周期 - 更新之后
  551. beforeDestroy() {}, // 生命周期 - 销毁之前
  552. destroyed() {}, // 生命周期 - 销毁完成
  553. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  554. };
  555. </script>
  556. <style lang="scss" scoped>
  557. .BidSystemProductDeOrderEdit {
  558. overflow: hidden;
  559. overflow-y: auto;
  560. .top_search {
  561. display: flex;
  562. justify-content: flex-start;
  563. align-items: center;
  564. flex-wrap: wrap;
  565. width: 100%;
  566. padding: 10px 0;
  567. font-size: 14px;
  568. div {
  569. width: 200px;
  570. padding: 5px;
  571. }
  572. }
  573. .addArea {
  574. .addAreaTable {
  575. padding: 20px 0;
  576. }
  577. position: relative;
  578. padding: 15px;
  579. margin-bottom: 30px;
  580. border-radius: 5px;
  581. box-shadow: 1px 1px 5px 1px #999;
  582. .addAreaBtn {
  583. position: absolute;
  584. right: 20px;
  585. top: 20px;
  586. }
  587. /deep/ .ivu-form-item {
  588. display: inline-block;
  589. width: 220px;
  590. }
  591. }
  592. }
  593. .supModalBtn {
  594. display: flex;
  595. justify-content: flex-end;
  596. margin-bottom: 10px;
  597. }
  598. </style>