index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="pageIndexClass">
  3. <div>
  4. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
  5. :selectConfig="selectConfig" :action-list="[
  6. ]" @get-list="getList">
  7. <template #list="{ item }">
  8. <div style="width:100%">
  9. <span v-for="(product ,index) in item.produceOrderDetailList" style="margin-right:15px">
  10. <el-popover placement="top-start" :width="300" trigger="hover">
  11. <div>
  12. <div>产品编码:{{product.productCode}}</div>
  13. <div>产品名称:{{product.productName}}</div>
  14. <div>产品尺寸:{{product.productLength}}cm*{{product.productWidth}}cm*{{product.productHeight}}cm</div>
  15. </div>
  16. <template #reference>
  17. <el-progress type="circle" :percentage="(Number(product.finishQuantity) / Number(product.quantity))*100" width="60"
  18. :status="(Number(product.finishQuantity) / Number(product.quantity))*100 == 100 ? 'success' : ''" />
  19. </template>
  20. </el-popover>
  21. </span>
  22. </div>
  23. </template>
  24. </byTable>
  25. </div>
  26. <el-dialog :title="modalType == 'add' ? '添加店铺' : '编辑店铺'" v-model="dialogVisible" width="500px" destroy-on-close>
  27. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
  28. </byForm>
  29. <template #footer>
  30. <el-button @click="dialogVisible = false" size="defualt">取 消</el-button>
  31. <el-button type="primary" @click="submitForm()" size="defualt" :loading="submitLoading">
  32. 确 定
  33. </el-button>
  34. </template>
  35. </el-dialog>
  36. </div>
  37. </template>
  38. <script setup>
  39. import byTable from "@/components/byTable/index";
  40. import byForm from "@/components/byForm/index";
  41. const { proxy } = getCurrentInstance();
  42. const loading = ref(false);
  43. const submitLoading = ref(false);
  44. const sourceList = ref({
  45. data: [],
  46. pagination: {
  47. total: 3,
  48. pageNum: 1,
  49. pageSize: 10,
  50. keyword: "",
  51. },
  52. });
  53. const treeData = ref([]);
  54. const dialogVisible = ref(false);
  55. const modalType = ref("add");
  56. const statusData = ref([
  57. {
  58. label: "未开始",
  59. value: "0",
  60. },
  61. {
  62. label: "进行中",
  63. value: "1",
  64. },
  65. {
  66. label: "已完成",
  67. value: "2",
  68. },
  69. ]);
  70. const selectConfig = computed(() => [
  71. {
  72. label: "生产状态",
  73. prop: "produceStatus",
  74. data: statusData.value,
  75. },
  76. {
  77. type: "time",
  78. label: "交期",
  79. placeholder: "开始日期",
  80. prop: "staDeliveryPeriod",
  81. placeholderOne: "结束日期",
  82. propOne: "endDeliveryPeriod",
  83. },
  84. {
  85. type: "time",
  86. label: "下单日期",
  87. placeholder: "开始日期",
  88. prop: "beginTime",
  89. placeholderOne: "结束日期",
  90. propOne: "endTime",
  91. },
  92. ]);
  93. const config = computed(() => {
  94. return [
  95. {
  96. attrs: {
  97. label: "订单号",
  98. prop: "code",
  99. width: 150,
  100. },
  101. },
  102. {
  103. attrs: {
  104. label: "下单时间",
  105. prop: "createTime",
  106. width: 160,
  107. },
  108. },
  109. {
  110. attrs: {
  111. label: "交期",
  112. prop: "deliveryPeriod",
  113. width: 160,
  114. },
  115. },
  116. {
  117. attrs: {
  118. label: "生产状态",
  119. prop: "produceStatus",
  120. width: 120,
  121. },
  122. render(val) {
  123. return proxy.dictValueLabel(val, statusData.value);
  124. },
  125. },
  126. {
  127. attrs: {
  128. slot: "list",
  129. label: "产品生产进度",
  130. // prop: "name",
  131. },
  132. },
  133. // {
  134. // attrs: {
  135. // label: "操作",
  136. // width: "100",
  137. // align: "center",
  138. // fixed: "right",
  139. // },
  140. // renderHTML(row) {
  141. // return [
  142. // {
  143. // attrs: {
  144. // label: "完成订单",
  145. // type: "primary",
  146. // text: true,
  147. // },
  148. // el: "button",
  149. // click() {
  150. // getDtl(row);
  151. // },
  152. // },
  153. // ];
  154. // },
  155. // },
  156. ];
  157. });
  158. const formData = reactive({
  159. data: {},
  160. });
  161. const formOption = reactive({
  162. inline: true,
  163. labelWidth: 100,
  164. itemWidth: 100,
  165. });
  166. const formDom = ref(null);
  167. const formConfig = computed(() => {
  168. return [
  169. {
  170. type: "input",
  171. prop: "code",
  172. label: "店铺编号",
  173. itemWidth: 100,
  174. disabled: false,
  175. },
  176. {
  177. type: "input",
  178. prop: "name",
  179. label: "店铺名称",
  180. itemWidth: 100,
  181. disabled: false,
  182. },
  183. {
  184. type: "treeSelect",
  185. prop: "deptId",
  186. label: "负责部门",
  187. data: treeData.value,
  188. propsTreeLabel: "deptName",
  189. propsTreeValue: "deptId",
  190. itemWidth: 100,
  191. disabled: false,
  192. },
  193. ];
  194. });
  195. const rules = ref({
  196. deptId: [{ required: true, message: "请选择负责部门", trigger: "change" }],
  197. name: [{ required: true, message: "请输入店铺名称", trigger: "blur" }],
  198. code: [{ required: true, message: "请输入店铺编号", trigger: "blur" }],
  199. });
  200. const getList = async (req) => {
  201. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  202. loading.value = true;
  203. proxy.post("/produceOrder/page", sourceList.value.pagination).then((res) => {
  204. sourceList.value.data = res.rows;
  205. sourceList.value.pagination.total = res.total;
  206. setTimeout(() => {
  207. loading.value = false;
  208. }, 200);
  209. });
  210. };
  211. const openModal = () => {
  212. dialogVisible.value = true;
  213. modalType.value = "add";
  214. formData.data = {
  215. definition: "2",
  216. fileList: [],
  217. };
  218. if (currencyData.value && currencyData.value.length > 0) {
  219. formData.data.currency = currencyData.value[0].dictKey;
  220. formData.data.costCurrency = currencyData.value[0].dictKey;
  221. }
  222. };
  223. const submitForm = () => {
  224. formDom.value.handleSubmit((valid) => {
  225. submitLoading.value = true;
  226. proxy.post("/shopInfo/" + modalType.value, formData.data).then(
  227. (res) => {
  228. proxy.msgTip("操作成功", 1);
  229. dialogVisible.value = false;
  230. submitLoading.value = false;
  231. getList();
  232. },
  233. (err) => {
  234. submitLoading.value = false;
  235. }
  236. );
  237. });
  238. };
  239. const getDtl = (row) => {
  240. modalType.value = "edit";
  241. proxy.post("/shopInfo/detail", { id: row.id }).then((res) => {
  242. formData.data = res;
  243. dialogVisible.value = true;
  244. });
  245. };
  246. getList();
  247. </script>
  248. <style lang="scss" scoped>
  249. ::v-deep(.el-progress__text) {
  250. font-size: 14px !important;
  251. }
  252. .content {
  253. padding: 20px;
  254. }
  255. </style>