소스 검색

按钮loading修改

cz 2 년 전
부모
커밋
eb6f5e2879

+ 12 - 9
src/views/iot/base/equipment/index.vue

@@ -313,15 +313,18 @@ const submitForm = () => {
   console.log(byform.value);
   byform.value.handleSubmit((valid) => {
     submitLoading.value = true;
-    proxy.post("/tdaDevice/" + modalType.value, formData.data).then((res) => {
-      ElMessage({
-        message: modalType.value == "add" ? "添加成功" : "编辑成功",
-        type: "success",
-      });
-      dialogVisible.value = false;
-      submitLoading.value = false;
-      getList();
-    });
+    proxy.post("/tdaDevice/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => (submitLoading.value = false)
+    );
   });
 };
 

+ 12 - 9
src/views/iot/base/loT/index.vue

@@ -297,15 +297,18 @@ const submitForm = () => {
   console.log(byform.value);
   byform.value.handleSubmit((valid) => {
     submitLoading.value = true;
-    proxy.post("/tdaConfig/" + modalType.value, formData.data).then((res) => {
-      ElMessage({
-        message: modalType.value == "add" ? "添加成功" : "编辑成功",
-        type: "success",
-      });
-      dialogVisible.value = false;
-      submitLoading.value = false;
-      getList();
-    });
+    proxy.post("/tdaConfig/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => (submitLoading.value = false)
+    );
   });
 };
 

+ 13 - 10
src/views/iot/base/product/index.vue

@@ -270,7 +270,7 @@ const openModal = () => {
   dialogVisible.value = true;
   modalType.value = "add";
   formData.data = {
-    protocolType: "MQTT",
+    protocolType: "HTTP",
     dataFormat: "JSON",
   };
 };
@@ -314,15 +314,18 @@ const submitForm = () => {
   byform.value.handleSubmit((valid) => {
     submitLoading.value = true;
 
-    proxy.post("/tdaProduct/" + modalType.value, formData.data).then((res) => {
-      ElMessage({
-        message: modalType.value == "add" ? "添加成功" : "编辑成功",
-        type: "success",
-      });
-      dialogVisible.value = false;
-      submitLoading.value = false;
-      getList();
-    });
+    proxy.post("/tdaProduct/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => (submitLoading.value = false)
+    );
   });
 };
 

+ 5 - 4
src/views/iot/base/trade/index.vue

@@ -282,9 +282,8 @@ const submitForm = () => {
   byform.value.handleSubmit((valid) => {
     submitLoading.value = true;
 
-    proxy
-      .post("/tdaApplication/" + modalType.value, formData.data)
-      .then((res) => {
+    proxy.post("/tdaApplication/" + modalType.value, formData.data).then(
+      (res) => {
         ElMessage({
           message: modalType.value == "add" ? "添加成功" : "编辑成功",
           type: "success",
@@ -292,7 +291,9 @@ const submitForm = () => {
         dialogVisible.value = false;
         submitLoading.value = false;
         getList();
-      });
+      },
+      (err) => (submitLoading.value = false)
+    );
   });
 };
 

+ 18 - 15
src/views/production/factory/farm/index.vue

@@ -81,7 +81,7 @@ const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
     label: "车间类型",
-    prop: "flowStatus",
+    prop: "type",
     data: [
       {
         label: "审核中",
@@ -120,14 +120,14 @@ const config = computed(() => {
     {
       attrs: {
         label: "负责人",
-        prop: "endPoint",
+        prop: "personLiableId",
         width: 100,
       },
     },
     {
       attrs: {
         label: "车间说明",
-        prop: "accessKeyId",
+        prop: "remarks",
       },
     },
 
@@ -171,7 +171,7 @@ const config = computed(() => {
               ).then(() => {
                 // 删除
                 proxy
-                  .post("/tdaConfig/delete", {
+                  .post("/workshop/delete", {
                     id: row.id,
                   })
                   .then((res) => {
@@ -244,7 +244,7 @@ const formConfig = computed(() => {
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy.post("/tdaConfig/page", sourceList.value.pagination).then((message) => {
+  proxy.post("/workshop/page", sourceList.value.pagination).then((message) => {
     console.log(message);
     sourceList.value.data = message.rows;
     sourceList.value.pagination.total = message.total;
@@ -263,21 +263,24 @@ const submitForm = () => {
   console.log(byform.value);
   byform.value.handleSubmit((valid) => {
     submitLoading.value = true;
-    proxy.post("/tdaConfig/" + modalType.value, formData.data).then((res) => {
-      ElMessage({
-        message: modalType.value == "add" ? "添加成功" : "编辑成功",
-        type: "success",
-      });
-      dialogVisible.value = false;
-      submitLoading.value = false;
-      getList();
-    });
+    proxy.post("/workshop/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => (submitLoading.value = false)
+    );
   });
 };
 
 const getDtl = (row) => {
   modalType = "edit";
-  proxy.post("/tdaConfig/detail", { id: row.id }).then((res) => {
+  proxy.post("/workshop/detail", { id: row.id }).then((res) => {
     formData.data = res;
     console.log(formData);
     dialogVisible.value = true;

+ 41 - 69
src/views/production/factory/line/index.vue

@@ -84,39 +84,13 @@ const selectConfig = computed(() => {
   return [
     {
       label: "车间",
-      prop: "flowStatus",
-      data: [
-        {
-          label: "审核中",
-          value: "1",
-        },
-        {
-          label: "审核通过",
-          value: "2",
-        },
-        {
-          label: "审核不通过",
-          value: "3",
-        },
-      ],
+      prop: "workshopId",
+      data: [],
     },
     {
       label: "产线类型",
-      prop: "flowStatus",
-      data: [
-        {
-          label: "审核中",
-          value: "1",
-        },
-        {
-          label: "审核通过",
-          value: "2",
-        },
-        {
-          label: "审核不通过",
-          value: "3",
-        },
-      ],
+      prop: "type",
+      data: [],
     },
   ];
 });
@@ -125,7 +99,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "车间名称",
-        prop: "type",
+        prop: "workshopId",
         width: 120,
         render(type) {
           return "华为";
@@ -135,28 +109,28 @@ const config = computed(() => {
     {
       attrs: {
         label: "产线类型",
-        prop: "name",
+        prop: "type",
         width: 150,
       },
     },
     {
       attrs: {
         label: "产线名称",
-        prop: "endPoint",
+        prop: "name",
         width: 100,
       },
     },
     {
       attrs: {
         label: "负责人",
-        prop: "endPoint",
+        prop: "personLiableId",
         width: 100,
       },
     },
     {
       attrs: {
         label: "产线说明",
-        prop: "accessKeyId",
+        prop: "remarks",
       },
     },
 
@@ -200,7 +174,7 @@ const config = computed(() => {
               ).then(() => {
                 // 删除
                 proxy
-                  .post("/tdaConfig/delete", {
+                  .post("/assemblyLine/delete", {
                     id: row.id,
                   })
                   .then((res) => {
@@ -221,9 +195,8 @@ const config = computed(() => {
 
 let formData = reactive({
   data: {
-    type: "1",
+    type: "",
   },
-  treeData: [],
 });
 const formOption = reactive({
   inline: true,
@@ -237,33 +210,33 @@ const formConfig = computed(() => {
   return [
     {
       type: "select",
-      prop: "name",
+      prop: "workshopId",
       label: "车间名称",
       required: true,
       data: [],
     },
     {
       type: "select",
-      prop: "name",
+      prop: "type",
       label: "产线类型",
       required: true,
       data: [],
     },
     {
       type: "input",
-      prop: "aa",
+      prop: "name",
       label: "产线名称",
       required: true,
     },
     {
       type: "select",
-      prop: "name",
+      prop: "personLiableId",
       label: "负责人",
       data: [],
     },
     {
       type: "input",
-      prop: "secretAccessKey",
+      prop: "remarks",
       label: "产线说明",
       itemType: "textarea",
     },
@@ -272,53 +245,52 @@ const formConfig = computed(() => {
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy.post("/tdaConfig/page", sourceList.value.pagination).then((message) => {
-    console.log(message);
-    sourceList.value.data = message.rows;
-    sourceList.value.pagination.total = message.total;
-    setTimeout(() => {
-      loading.value = false;
-    }, 200);
-  });
+  proxy
+    .post("/assemblyLine/page", sourceList.value.pagination)
+    .then((message) => {
+      console.log(message);
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
 };
 const openModal = () => {
   dialogVisible.value = true;
   modalType.value = "add";
   formData.data = {};
 };
-const selection = ref({
-  data: [],
-});
-const select = (_selection, row) => {
-  selection.value.data = _selection;
-  console.log(_selection.length);
-};
+
 const submitForm = () => {
   console.log(byform.value);
   byform.value.handleSubmit((valid) => {
     submitLoading.value = true;
-    proxy.post("/tdaConfig/" + modalType.value, formData.data).then((res) => {
-      ElMessage({
-        message: modalType.value == "add" ? "添加成功" : "编辑成功",
-        type: "success",
-      });
-      dialogVisible.value = false;
-      submitLoading.value = false;
-      getList();
-    });
+    proxy.post("/assemblyLine/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => (submitLoading.value = false)
+    );
   });
 };
 
 const getDtl = (row) => {
   modalType = "edit";
-  proxy.post("/tdaConfig/detail", { id: row.id }).then((res) => {
+  proxy.post("/assemblyLine/detail", { id: row.id }).then((res) => {
     formData.data = res;
     console.log(formData);
     dialogVisible.value = true;
   });
 };
 
-// getList();
+getList();
 </script>
   
 <style lang="scss" scoped>