confirm.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div>
  3. <FullPage
  4. title="查看详情"
  5. :list="list"
  6. @init="init"
  7. @searchData="search"
  8. :logList="logList"
  9. @selectTable="selectTable"
  10. @changePage="changePage"
  11. @changeSize="changeSize"
  12. :tableColums="tableColums"
  13. :tableData="tableData"
  14. :pageIndex="pageIndex"
  15. :pageSize="pageSize"
  16. :total="total"
  17. >
  18. <div slot="titleButton">
  19. <Button @click="back" style="margin-right:10px;">返回</Button>
  20. <Button @click="finish(selectIds, 1)" type="success" ghost
  21. >批量完成</Button
  22. >
  23. </div>
  24. <template slot="set" slot-scope="{ row }">
  25. <div>
  26. <a class="map-margin" @click="goOriginalPage(row)">原材料预算</a>
  27. <a
  28. v-if="row.state != 3"
  29. class="map-margin"
  30. style="color:#32C800"
  31. @click="finish(row, 1)"
  32. >完成</a
  33. >
  34. <a class="map-margin" @click="goDetial(row, 1)">查看详情</a>
  35. </div>
  36. </template>
  37. </FullPage>
  38. </div>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. type: 1,
  45. logList: [{ title: "系统单号", value: "10998765" }],
  46. tableColums: [
  47. { type: "selection", fixed: "left", width: "90", align: "center" },
  48. {
  49. title: "工序分类",
  50. align: "center",
  51. minWidth: 150,
  52. key: "basic_title",
  53. },
  54. {
  55. title: "工序",
  56. align: "center",
  57. minWidth: 150,
  58. key: "procedure_title",
  59. },
  60. {
  61. title: "工序状态",
  62. align: "center",
  63. minWidth: 150,
  64. render: (h, params) =>
  65. h("span", {}, params.row.rework_state == 1 ? "返工" : "正常"),
  66. },
  67. { title: "班组信息", align: "center", minWidth: 150, key: "username" },
  68. {
  69. title: "完工状态",
  70. align: "center",
  71. minWidth: 100,
  72. render: (h, params) =>
  73. h("span", {}, params.row.state == 3 ? "已完工" : "未完工"),
  74. },
  75. {
  76. title: "完工百分比",
  77. align: "center",
  78. minWidth: 120,
  79. render(h, params) {
  80. return h(
  81. "span",
  82. {},
  83. parseInt(params.row.complete_rate * 100) + "%"
  84. );
  85. },
  86. },
  87. {
  88. title: "派工时间",
  89. align: "center",
  90. minWidth: 200,
  91. render: (h, params) =>
  92. h("span", {}, this.func.replaceDate(params.row.produce_time * 1)),
  93. },
  94. {
  95. title: "操作",
  96. align: "center",
  97. slot: "set",
  98. fixed: "right",
  99. width: "250",
  100. },
  101. ],
  102. tableData: [{ residential_name: "dlaskdsad", state: 0, id: 99 }],
  103. pageIndex: 1,
  104. pageSize: 10,
  105. total: 0,
  106. selectIds: [],
  107. proxyObj: { order_no: this.$route.query.order_no },
  108. produces: [],
  109. users: [],
  110. house_list: [],
  111. unit_list: [],
  112. level_list: [],
  113. room_list: [],
  114. product_list: [],
  115. part_list: [],
  116. part_state_list: [],
  117. url_number_list: [],
  118. part_label: [],
  119. produce_type_list: [],
  120. };
  121. },
  122. created() {
  123. // this.axios("/api/procedure_index").then(
  124. // (res) => (this.produces = res.data.data)
  125. // );
  126. // this.axios("/api/employee_list").then((res) => (this.users = res.data));
  127. },
  128. computed: {
  129. list() {
  130. return [
  131. {
  132. title: "工序分类",
  133. filterable: true,
  134. name: "Select",
  135. value: "",
  136. serverName: "basic_title",
  137. optionName: "title",
  138. optionValue: "id",
  139. option: this.produce_type_list,
  140. },
  141. {
  142. title: "工序",
  143. filterable: true,
  144. name: "Select",
  145. value: "",
  146. serverName: "procedure_title",
  147. optionName: "title",
  148. optionValue: "id",
  149. option: this.produces,
  150. },
  151. {
  152. title: "班组",
  153. filterable: true,
  154. name: "Select",
  155. value: "",
  156. optionName: "title",
  157. optionValue: "title",
  158. serverName: "title",
  159. option: this.users,
  160. },
  161. {
  162. title: "完工状态",
  163. name: "Select",
  164. value: "",
  165. serverName: "produce",
  166. option: [
  167. { label: "未完工", value: 1 },
  168. { label: "已完工", value: 3 },
  169. ],
  170. },
  171. {
  172. title: "工序状态",
  173. name: "Select",
  174. value: "",
  175. serverName: "rework_state",
  176. option: [
  177. { label: "返工", value: 1 },
  178. { label: "正常", value: 0 },
  179. ],
  180. },
  181. {
  182. title: "派工时间",
  183. name: "Input",
  184. start_server: "start_time",
  185. end_server: "end_time",
  186. start_value: "",
  187. end_value: "",
  188. isDate: true,
  189. start_placeholder: "开始日期",
  190. end_placeholder: "结束日期",
  191. },
  192. ]
  193. },
  194. },
  195. methods: {
  196. search(row){
  197. row.start_time = row.start_time?new Date(row.start_time).getTime().toString().split('').splice(0,10).join(''):'';
  198. row.end_time =row.end_time? new Date(row.end_time).getTime().toString().split('').splice(0,10).join(''):'';
  199. Object.assign(row, this.$route.query);
  200. row.page_size = this.pageSize;
  201. row.page_index = this.pageIndex;
  202. this.axios("/api/orders_dispatch_produce_list", { params: row }).then(
  203. (res) => {
  204. if (res.code == 200) {
  205. this.tableData = res.data.list;
  206. this.logList = res.data.detail;
  207. this.total = res.data.total;
  208. // this.produce_type_list =res.data.basic_title;
  209. // this.produces = res.data.procedure_title;
  210. // this.users = res.data.username
  211. }
  212. }
  213. );
  214. },
  215. init(row) {
  216. this.pageIndex = 1;
  217. row.page_size = this.pageSize;
  218. row.page_index = this.pageIndex;
  219. Object.assign(row, this.$route.query);
  220. this.getData(row);
  221. },
  222. back() {
  223. this.$router.go(-1);
  224. },
  225. getData(row) {
  226. row.page_size = this.pageSize;
  227. row.page_index = this.pageIndex;
  228. this.axios("/api/orders_dispatch_produce_list", { params: row }).then(
  229. (res) => {
  230. if (res.code == 200) {
  231. this.tableData = res.data.list;
  232. this.logList = res.data.detail;
  233. this.total = res.data.total;
  234. this.produce_type_list =res.data.basic_title;
  235. this.produces = res.data.procedure_title;
  236. this.users = res.data.username
  237. }
  238. }
  239. );
  240. },
  241. postData(data, type) {
  242. let url =
  243. type == 1 ? "/api/orders_dispatch_confirm" : "/api/orders_plan_cancer";
  244. this.axios.post(url, data).then((res) => {
  245. if (res.code == 200) {
  246. this.$Message.success(res.msg);
  247. this.getData(this.$route.query);
  248. }
  249. });
  250. },
  251. finish(row, type) {
  252. if (!row || row.length < 1) {
  253. return this.$Message.warning("请至少选择一项");
  254. }
  255. let params = {
  256. order_no: Array.isArray(row)
  257. ? row.reduce(
  258. (pre, cur, n) =>
  259. `${pre}${cur.order_no}${n == row.length - 1 ? "" : ","}`,
  260. ""
  261. )
  262. : row.order_no,
  263. produce_id: Array.isArray(row)
  264. ? row.reduce(
  265. (pre, cur, n) =>
  266. `${pre}${cur.produce_id}${n == row.length - 1 ? "" : ","}`,
  267. ""
  268. )
  269. : row.produce_id,
  270. produce_time: Array.isArray(row)
  271. ? row.reduce(
  272. (pre, cur, n) =>
  273. `${pre}${cur.produce_time}${n == row.length - 1 ? "" : ","}`,
  274. ""
  275. )
  276. : row.produce_time,
  277. };
  278. this.confirmDelete({
  279. content: "是否手动操作此订单生产完成",
  280. title: "生产完成",
  281. type: "primary",
  282. then: () => {
  283. this.postData(params, type);
  284. },
  285. cancel: () => {},
  286. });
  287. },
  288. selectTable(e) {
  289. this.selectIds = e;
  290. },
  291. changePage(e) {
  292. this.pageIndex = e;
  293. this.proxyObj.page_index = this.pageIndex;
  294. this.getData(this.proxyObj);
  295. },
  296. changeSize(e) {
  297. this.pageSize = e;
  298. this.proxyObj.page_size = this.page_size;
  299. this.getData(this.proxyObj);
  300. },
  301. goDetial(row) {
  302. this.$router.push({
  303. path: "/cms/productionorderlist/dispatchlist/details",
  304. query: {
  305. order_no: this.$route.query.order_no,
  306. produce_id: row.produce_id,
  307. produce_time: row.produce_time,
  308. },
  309. });
  310. },
  311. goOriginalPage(row) {
  312. this.$router.push({
  313. path: "/cms/rawmateria/index",
  314. query: {
  315. order_no: row.order_no,
  316. type: 9,
  317. residential_name: row.residential_name,
  318. produce_id: row.produce_id,
  319. produce_time: row.produce_time,
  320. },
  321. });
  322. },
  323. },
  324. };
  325. </script>
  326. <style lang="scss" scoped>
  327. .log-list {
  328. display: flex;
  329. flex-wrap: wrap;
  330. padding: 10px 0;
  331. }
  332. </style>