details.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <div class="form">
  3. <van-nav-bar :title="'生产订单详情'" :left-text="$t('common.back')" left-arrow @click-left="onClickLeft">
  4. </van-nav-bar>
  5. <testForm v-model="formData.data" :formOption="formOption" :formConfig="formConfig" :rules="rules" @onSubmit="onSubmit" ref="formDom"></testForm>
  6. </div>
  7. </template>
  8. <script setup>
  9. import { ref, reactive, getCurrentInstance, onMounted } from "vue";
  10. import { showSuccessToast, showFailToast } from "vant";
  11. import { useRoute } from "vue-router";
  12. import testForm from "@/components/testForm/index.vue";
  13. const proxy = getCurrentInstance().proxy;
  14. const route = useRoute();
  15. const formDom = ref(null);
  16. const formData = reactive({
  17. data: {},
  18. });
  19. const rules = {
  20. contractId: [
  21. {
  22. required: true,
  23. message: proxy.t("claim.contractCanNotBeEmpty"),
  24. },
  25. ],
  26. money: [
  27. {
  28. required: true,
  29. message: proxy.t("claim.relatedAmountCanNotBeEmpty"),
  30. },
  31. ],
  32. };
  33. const formOption = reactive({
  34. readonly: true, //用于控制整个表单是否只读
  35. disabled: false,
  36. labelAlign: "top",
  37. scroll: true,
  38. labelWidth: "62pk",
  39. submitBtnText: proxy.t("common.submit"),
  40. hiddenSubmitBtn: true,
  41. btnConfig: {
  42. isNeed: false,
  43. listTitle: "产品生产进度",
  44. prop: "produceOrderDetailList",
  45. plain: true,
  46. listConfig: [
  47. {
  48. type: "input",
  49. itemType: "text",
  50. label: "产品编码",
  51. prop: "productCode",
  52. },
  53. {
  54. type: "input",
  55. itemType: "text",
  56. label: "产品名称",
  57. prop: "productName",
  58. },
  59. {
  60. type: "input",
  61. itemType: "text",
  62. label: "产品数量",
  63. prop: "quantity",
  64. },
  65. {
  66. type: "input",
  67. itemType: "text",
  68. label: "完成数量",
  69. prop: "finishQuantity",
  70. },
  71. ],
  72. clickFn: () => {},
  73. },
  74. });
  75. const statusData = ref([
  76. {
  77. label: "未开始",
  78. value: "0",
  79. },
  80. {
  81. label: "进行中",
  82. value: "1",
  83. },
  84. {
  85. label: "已完成",
  86. value: "2",
  87. },
  88. ]);
  89. const contractProdTag = ref([]);
  90. const getDict = () => {
  91. proxy.getDictOne(["contract_prod_tag"]).then((res) => {
  92. contractProdTag.value = res["contract_prod_tag"].data.map((x) => ({
  93. label: x.dictValue,
  94. value: x.dictKey,
  95. }));
  96. formData.data.produceStatusName = proxy.dictValueLabel(
  97. formData.data.produceStatus,
  98. statusData.value
  99. );
  100. if (formData.data.prodTag) {
  101. formData.data.prodTagName = "";
  102. formData.data.prodTags = formData.data.prodTag.split(",");
  103. if (formData.data.prodTags && formData.data.prodTags.length > 0) {
  104. formData.data.prodTags.map((x, index) => {
  105. formData.data.prodTagName +=
  106. " " + proxy.dictValueLabel(x, contractProdTag.value);
  107. });
  108. }
  109. }
  110. });
  111. };
  112. const formConfig = reactive([
  113. {
  114. type: "input",
  115. label: "生产公司",
  116. prop: "companyName",
  117. itemType: "text",
  118. readonly: true,
  119. },
  120. {
  121. type: "input",
  122. label: "订单号",
  123. prop: "code",
  124. itemType: "text",
  125. readonly: true,
  126. },
  127. {
  128. type: "input",
  129. label: "下单时间",
  130. prop: "createTime",
  131. itemType: "text",
  132. readonly: true,
  133. },
  134. {
  135. type: "input",
  136. label: "交期",
  137. prop: "deliveryPeriod",
  138. itemType: "text",
  139. readonly: true,
  140. },
  141. {
  142. type: "input",
  143. label: "投产时间",
  144. prop: "produceTime",
  145. itemType: "text",
  146. readonly: true,
  147. },
  148. {
  149. type: "input",
  150. label: "生产状态",
  151. prop: "produceStatusName",
  152. itemType: "text",
  153. readonly: true,
  154. },
  155. {
  156. type: "input",
  157. label: "生产指示",
  158. prop: "prodTagName",
  159. itemType: "text",
  160. readonly: true,
  161. },
  162. ]);
  163. const onClickLeft = () => history.back();
  164. onMounted(() => {
  165. if (route.query && route.query.data) {
  166. formData.data = JSON.parse(route.query.data);
  167. getDict();
  168. }
  169. });
  170. </script>
  171. <style lang="scss" scoped>
  172. </style>