confirm.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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. <Modal
  39. title="设置班组"
  40. v-model="finish_modal"
  41. width="400"
  42. @on-ok="finish_Ok">
  43. <Form>
  44. <FormItem label="完成班组:">
  45. <Select v-model="finish_nickname" style="width:180px">
  46. <Option
  47. :value="item.id"
  48. v-for="(item, index) in nickname_users"
  49. :key="index"
  50. >{{ item.nickname }}</Option
  51. >
  52. </Select>
  53. </FormItem>
  54. </Form>
  55. </Modal>
  56. </div>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. finish_nickname:'',
  63. finish_modal:false,
  64. type: 1,
  65. logList: [{ title: "系统单号", value: "10998765" }],
  66. tableColums: [
  67. { type: "selection", fixed: "left", width: "90", align: "center" },
  68. {
  69. title: "工序分类",
  70. align: "center",
  71. minWidth: 150,
  72. key: "basic_title",
  73. },
  74. {
  75. title: "工序",
  76. align: "center",
  77. minWidth: 150,
  78. key: "procedure_title",
  79. },
  80. {
  81. title: "工序状态",
  82. align: "center",
  83. minWidth: 150,
  84. render: (h, params) =>
  85. h("span", {}, params.row.rework_state == 1 ? "返工" : "正常"),
  86. },
  87. { title: "图号", align: "center", minWidth: 150, key: "url_number" ,ellipsis:'true',tooltip:'true'},
  88. { title: "班组信息", align: "center", minWidth: 150, key: "username" },
  89. {
  90. title: "完工状态",
  91. align: "center",
  92. minWidth: 100,
  93. render: (h, params) =>
  94. h("span", {}, params.row.state == 3 ? "已完工" : "未完工"),
  95. },
  96. {
  97. title: "完工百分比",
  98. align: "center",
  99. minWidth: 120,
  100. render(h, params) {
  101. return h(
  102. "span",
  103. {},
  104. parseInt(params.row.complete_rate * 100) + "%"
  105. );
  106. },
  107. },
  108. {
  109. title: "派工时间",
  110. align: "center",
  111. minWidth: 200,
  112. render: (h, params) =>
  113. h("span", {}, this.func.replaceDate(params.row.produce_time * 1)),
  114. },
  115. {
  116. title: "操作",
  117. align: "center",
  118. slot: "set",
  119. fixed: "right",
  120. width: "250",
  121. },
  122. ],
  123. tableData: [{ residential_name: "dlaskdsad", state: 0, id: 99 }],
  124. pageIndex: 1,
  125. pageSize: 10,
  126. total: 0,
  127. selectIds: [],
  128. proxyObj: { order_no: this.$route.query.order_no },
  129. produces: [],
  130. users: [],
  131. house_list: [],
  132. unit_list: [],
  133. level_list: [],
  134. room_list: [],
  135. product_list: [],
  136. part_list: [],
  137. part_state_list: [],
  138. url_number_list: [],
  139. part_label: [],
  140. produce_type_list: [],
  141. nickname_users:[],
  142. params_data:[]
  143. };
  144. },
  145. created() {
  146. // this.axios("/api/procedure_index").then(
  147. // (res) => (this.produces = res.data.data)
  148. // );
  149. this.axios("/api/employee_list").then((res) => (this.nickname_users = res.data));
  150. },
  151. computed: {
  152. list() {
  153. return [
  154. {
  155. title: "工序分类",
  156. filterable: true,
  157. name: "Select",
  158. value: "",
  159. serverName: "basic_title",
  160. optionName: "title",
  161. optionValue: "id",
  162. option: this.produce_type_list,
  163. },
  164. {
  165. title: "工序",
  166. filterable: true,
  167. name: "Select",
  168. value: "",
  169. serverName: "procedure_title",
  170. optionName: "title",
  171. optionValue: "id",
  172. option: this.produces,
  173. },
  174. {
  175. title: "班组",
  176. filterable: true,
  177. name: "Select",
  178. value: "",
  179. optionName: "title",
  180. optionValue: "title",
  181. serverName: "title",
  182. option: this.users,
  183. },
  184. {
  185. title: "图号",
  186. filterable: true,
  187. name: "Select",
  188. value: "",
  189. optionName: "title",
  190. optionValue: "title",
  191. serverName: "url_number",
  192. option: this.url_number_list,
  193. },
  194. {
  195. title: "完工状态",
  196. name: "Select",
  197. value: "",
  198. serverName: "produce",
  199. option: [
  200. { label: "未完工", value: 1 },
  201. { label: "已完工", value: 3 },
  202. ],
  203. },
  204. {
  205. title: "工序状态",
  206. name: "Select",
  207. value: "",
  208. serverName: "rework_state",
  209. option: [
  210. { label: "返工", value: 1 },
  211. { label: "正常", value: 0 },
  212. ],
  213. },
  214. {
  215. title: "派工时间",
  216. name: "Input",
  217. start_server: "start_time",
  218. end_server: "end_time",
  219. start_value: "",
  220. end_value: "",
  221. isDate: true,
  222. start_placeholder: "开始日期",
  223. end_placeholder: "结束日期",
  224. },
  225. ]
  226. },
  227. },
  228. methods: {
  229. finish_Ok(){
  230. if(!this.finish_nickname){
  231. this.$Message.warning('请选择班组')
  232. }else{
  233. this.postData({...this.params_data,team_id:this.finish_nickname},1)
  234. }
  235. },
  236. search(row){
  237. row.start_time = row.start_time?new Date(row.start_time).getTime().toString().split('').splice(0,10).join(''):'';
  238. row.end_time =row.end_time? new Date(row.end_time).getTime().toString().split('').splice(0,10).join(''):'';
  239. Object.assign(row, this.$route.query);
  240. row.page_size = this.pageSize;
  241. row.page_index = this.pageIndex;
  242. this.proxyObj = row;
  243. this.axios("/api/orders_dispatch_produce_list", { params: row }).then(
  244. (res) => {
  245. if (res.code == 200) {
  246. this.tableData = res.data.list;
  247. this.logList = res.data.detail;
  248. this.total = res.data.total;
  249. // this.produce_type_list =res.data.basic_title;
  250. // this.produces = res.data.procedure_title;
  251. // this.users = res.data.username
  252. }
  253. }
  254. );
  255. },
  256. init(row) {
  257. this.pageIndex = 1;
  258. row.page_size = this.pageSize;
  259. row.page_index = this.pageIndex;
  260. Object.assign(row, this.$route.query);
  261. this.proxyObj = row;
  262. this.getData(row);
  263. },
  264. back() {
  265. this.$router.go(-1);
  266. },
  267. getData(row) {
  268. row.page_size = this.pageSize;
  269. row.page_index = this.pageIndex;
  270. this.axios("/api/orders_dispatch_produce_list", { params: row }).then(
  271. (res) => {
  272. if (res.code == 200) {
  273. this.tableData = res.data.list;
  274. this.logList = res.data.detail;
  275. this.total = res.data.total;
  276. this.produce_type_list =res.data.basic_title;
  277. this.produces = res.data.procedure_title;
  278. this.users = res.data.username;
  279. let data =[];
  280. res.data.url_number_list.map(v=>{
  281. let obj={};
  282. obj.title = v;
  283. data.push(obj)
  284. })
  285. this.url_number_list = data
  286. }
  287. }
  288. );
  289. },
  290. postData(data, type) {
  291. let url =
  292. type == 1 ? "/api/orders_dispatch_confirm" : "/api/orders_plan_cancer";
  293. this.axios.post(url, data).then((res) => {
  294. if (res.code == 200) {
  295. this.$Message.success(res.msg);
  296. this.getData(this.$route.query);
  297. }
  298. });
  299. },
  300. finish(row, type) {
  301. if (!row || row.length < 1) {
  302. return this.$Message.warning("请至少选择一项");
  303. }
  304. let params = {
  305. order_no: Array.isArray(row)
  306. ? row.reduce(
  307. (pre, cur, n) =>
  308. `${pre}${cur.order_no}${n == row.length - 1 ? "" : ","}`,
  309. ""
  310. )
  311. : row.order_no,
  312. produce_id: Array.isArray(row)
  313. ? row.reduce(
  314. (pre, cur, n) =>
  315. `${pre}${cur.produce_id}${n == row.length - 1 ? "" : ","}`,
  316. ""
  317. )
  318. : row.produce_id,
  319. produce_time: Array.isArray(row)
  320. ? row.reduce(
  321. (pre, cur, n) =>
  322. `${pre}${cur.produce_time}${n == row.length - 1 ? "" : ","}`,
  323. ""
  324. )
  325. : row.produce_time,
  326. };
  327. this.finish_modal = true;
  328. this.params_data = params;
  329. },
  330. selectTable(e) {
  331. this.selectIds = e;
  332. },
  333. changePage(e) {
  334. this.pageIndex = e;
  335. this.proxyObj.page_index = this.pageIndex;
  336. this.getData(this.proxyObj);
  337. },
  338. changeSize(e) {
  339. this.pageSize = e;
  340. this.proxyObj.page_size = this.page_size;
  341. this.getData(this.proxyObj);
  342. },
  343. goDetial(row) {
  344. this.$router.push({
  345. path: "/cms/productionorderlist/dispatchlist/details",
  346. query: {
  347. order_no: this.$route.query.order_no,
  348. produce_id: row.produce_id,
  349. produce_time: row.produce_time,
  350. },
  351. });
  352. },
  353. goOriginalPage(row) {
  354. this.$router.push({
  355. path: "/cms/rawmateria/index",
  356. query: {
  357. order_no: row.order_no,
  358. type: 9,
  359. residential_name: row.residential_name,
  360. produce_id: row.produce_id,
  361. produce_time: row.produce_time,
  362. },
  363. });
  364. },
  365. },
  366. };
  367. </script>
  368. <style lang="scss" scoped>
  369. .log-list {
  370. display: flex;
  371. flex-wrap: wrap;
  372. padding: 10px 0;
  373. }
  374. </style>