cz hace 10 meses
padre
commit
7d87372175

+ 3 - 1
src/components/common-list.vue

@@ -11,7 +11,9 @@
         </p>
         <div class="center-content" style="line-height: 24px" @click="listCk(i)">
           <div v-for="j in config" :key="j.prop" style="display: flex">
-            <span style="min-width:80px;">{{ j.label }}:</span>
+            <span style="min-width:80px;">
+              <span v-if="j.label">{{ j.label }}:</span>
+            </span>
             <span v-if="j.type && j.type === 'slot'" style="flex: 1;">
               <slot :name="j.slotName" :row="i">
                 {{ j.slotName }}插槽占位符

+ 4 - 3
src/views/MES/productionReport/add.vue

@@ -162,9 +162,6 @@ const onConfirm = ({ selectedOptions }) => {
 const onClickLeft = () => history.back();
 
 const onSubmit = () => {
-  if (Number(submitData.value.quantity) < 1) {
-    return showFailToast("报工数量不能为0");
-  }
   if (formData.value.reportLock == "1") {
     return showFailToast("已锁定不可报工!");
     // if (
@@ -173,6 +170,9 @@ const onSubmit = () => {
     //   return showFailToast("报工数量不可大于结存数量");
     // }
   } else {
+    if (Number(submitData.value.quantity) < 1) {
+      return showFailToast("报工数量不能为0");
+    }
     // if (Number(submitData.value.quantity) > Number(formData.value.quantity)) {
     //   return showFailToast("报工数量不可大于生产总量");
     // }
@@ -215,6 +215,7 @@ const onSubmit = () => {
       });
   }
 };
+
 const getDetail = () => {
   proxy
     .post("/produceOrderDetail/detail", {

+ 35 - 2
src/views/MES/reportDetail/index.vue

@@ -8,7 +8,13 @@
     <van-pull-refresh v-model="loading" @refresh="onRefresh">
       <div class="list">
         <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="onLoad" style="margin-bottom: 60px">
-          <commonList :data="listData" :config="listConfig" :showMore="false"></commonList>
+          <commonList :data="listData" :config="listConfig" :showMore="false">
+            <template #btn="{ row }">
+              <div style="width:100%;text-align:right">
+                <van-button type="danger" size="small" style="margin-right:10px" @click="toDelete(row)">删除</van-button>
+              </div>
+            </template>
+          </commonList>
         </van-list>
       </div>
     </van-pull-refresh>
@@ -22,6 +28,8 @@
 import { ref, getCurrentInstance, onMounted, nextTick } from "vue";
 import commonList from "@/components/common-list.vue";
 import { useRoute } from "vue-router";
+import { showSuccessToast, showConfirmDialog } from "vant";
+
 const loading = ref(false);
 const route = useRoute();
 const req = ref({
@@ -75,6 +83,11 @@ const listConfig = ref([
     label: "产品名称",
     prop: "productName",
   },
+  {
+    type: "slot",
+    label: "",
+    slotName: "btn",
+  },
 ]);
 const onRefresh = () => {
   req.value.pageNum = 1;
@@ -107,7 +120,7 @@ proxy.uploadDdRightBtn(onClickRight, proxy.t("common.add"));
 const getList = (type) => {
   loading.value = true;
   proxy
-    .post("/productionReportingDetail/page", req.value)
+    .post("/productionReporting/page", req.value)
     .then((res) => {
       // const data = res.data.rows.map((x) => ({
       //   ...x,
@@ -196,6 +209,26 @@ const handleSend = () => {
     });
   }, 1000 * 10);
 };
+
+const toDelete = (row) => {
+  showConfirmDialog({
+    title: "提示",
+    message: `您确定删除该数据吗?`,
+  })
+    .then(() => {
+      proxy
+        .post("/productionReporting/delete", {
+          id: row.id,
+        })
+        .then((res) => {
+          showSuccessToast("操作成功");
+          onRefresh();
+        });
+    })
+    .catch(() => {
+      return;
+    });
+};
 </script>
 
 <style lang="scss" scoped>