index.vue 5.9 KB

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