confirm.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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. multiple:true,
  188. name: "Select",
  189. value: "",
  190. optionName: "title",
  191. optionValue: "title",
  192. serverName: "url_number",
  193. option: this.url_number_list,
  194. },
  195. {
  196. title: "完工状态",
  197. name: "Select",
  198. value: "",
  199. serverName: "produce",
  200. option: [
  201. { label: "未完工", value: 1 },
  202. { label: "已完工", value: 3 },
  203. ],
  204. },
  205. {
  206. title: "工序状态",
  207. name: "Select",
  208. value: "",
  209. serverName: "rework_state",
  210. option: [
  211. { label: "返工", value: 1 },
  212. { label: "正常", value: 0 },
  213. ],
  214. },
  215. {
  216. title: "派工时间",
  217. name: "Input",
  218. start_server: "start_time",
  219. end_server: "end_time",
  220. start_value: "",
  221. end_value: "",
  222. isDate: true,
  223. start_placeholder: "开始日期",
  224. end_placeholder: "结束日期",
  225. },
  226. ]
  227. },
  228. },
  229. methods: {
  230. finish_Ok(){
  231. if(!this.finish_nickname){
  232. this.$Message.warning('请选择班组')
  233. }else{
  234. this.postData({...this.params_data,team_id:this.finish_nickname},1)
  235. }
  236. },
  237. search(row){
  238. row.start_time = row.start_time?new Date(row.start_time).getTime().toString().split('').splice(0,10).join(''):'';
  239. row.end_time =row.end_time? new Date(row.end_time).getTime().toString().split('').splice(0,10).join(''):'';
  240. Object.assign(row, this.$route.query);
  241. row.page_size = this.pageSize;
  242. row.page_index = this.pageIndex;
  243. this.proxyObj = row;
  244. this.axios("/api/orders_dispatch_produce_list", { params: row }).then(
  245. (res) => {
  246. if (res.code == 200) {
  247. this.tableData = res.data.list;
  248. this.logList = res.data.detail;
  249. this.total = res.data.total;
  250. // this.produce_type_list =res.data.basic_title;
  251. // this.produces = res.data.procedure_title;
  252. // this.users = res.data.username
  253. }
  254. }
  255. );
  256. },
  257. init(row) {
  258. this.pageIndex = 1;
  259. row.page_size = this.pageSize;
  260. row.page_index = this.pageIndex;
  261. Object.assign(row, this.$route.query);
  262. this.proxyObj = row;
  263. this.getData(row);
  264. },
  265. back() {
  266. this.$router.go(-1);
  267. },
  268. getData(row) {
  269. row.page_size = this.pageSize;
  270. row.page_index = this.pageIndex;
  271. this.axios("/api/orders_dispatch_produce_list", { params: row }).then(
  272. (res) => {
  273. if (res.code == 200) {
  274. this.tableData = res.data.list;
  275. this.logList = res.data.detail;
  276. this.total = res.data.total;
  277. this.produce_type_list =res.data.basic_title;
  278. this.produces = res.data.procedure_title;
  279. this.users = res.data.username;
  280. let data =[];
  281. res.data.url_number_list.map(v=>{
  282. let obj={};
  283. obj.title = v;
  284. data.push(obj)
  285. })
  286. this.url_number_list = data
  287. }
  288. }
  289. );
  290. },
  291. postData(data, type) {
  292. let url =
  293. type == 1 ? "/api/orders_dispatch_confirm" : "/api/orders_plan_cancer";
  294. this.axios.post(url, data).then((res) => {
  295. if (res.code == 200) {
  296. this.$Message.success(res.msg);
  297. this.getData({...this.$route.query,...this.proxyObj});
  298. }
  299. });
  300. },
  301. finish(row, type) {
  302. if (!row || row.length < 1) {
  303. return this.$Message.warning("请至少选择一项");
  304. }
  305. let params = {
  306. order_no: Array.isArray(row)
  307. ? row.reduce(
  308. (pre, cur, n) =>
  309. `${pre}${cur.order_no}${n == row.length - 1 ? "" : ","}`,
  310. ""
  311. )
  312. : row.order_no,
  313. produce_id: Array.isArray(row)
  314. ? row.reduce(
  315. (pre, cur, n) =>
  316. `${pre}${cur.produce_id}${n == row.length - 1 ? "" : ","}`,
  317. ""
  318. )
  319. : row.produce_id,
  320. produce_time: Array.isArray(row)
  321. ? row.reduce(
  322. (pre, cur, n) =>
  323. `${pre}${cur.produce_time}${n == row.length - 1 ? "" : ","}`,
  324. ""
  325. )
  326. : row.produce_time,
  327. };
  328. this.finish_modal = true;
  329. this.params_data = params;
  330. },
  331. selectTable(e) {
  332. this.selectIds = e;
  333. },
  334. changePage(e) {
  335. this.pageIndex = e;
  336. this.proxyObj.page_index = this.pageIndex;
  337. this.getData(this.proxyObj);
  338. },
  339. changeSize(e) {
  340. this.pageSize = e;
  341. this.proxyObj.page_size = this.page_size;
  342. this.getData(this.proxyObj);
  343. },
  344. goDetial(row) {
  345. this.$router.push({
  346. path: "/cms/productionorderlist/dispatchlist/details",
  347. query: {
  348. order_no: this.$route.query.order_no,
  349. produce_id: row.produce_id,
  350. produce_time: row.produce_time,
  351. },
  352. });
  353. },
  354. goOriginalPage(row) {
  355. this.$router.push({
  356. path: "/cms/rawmateria/index",
  357. query: {
  358. order_no: row.order_no,
  359. type: 9,
  360. residential_name: row.residential_name,
  361. produce_id: row.produce_id,
  362. produce_time: row.produce_time,
  363. },
  364. });
  365. },
  366. },
  367. };
  368. </script>
  369. <style lang="scss" scoped>
  370. .log-list {
  371. display: flex;
  372. flex-wrap: wrap;
  373. padding: 10px 0;
  374. }
  375. </style>