|
@@ -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>
|