客户端产品匹配

This commit is contained in:
cxc
2022-10-27 13:39:36 +08:00
parent 88e3b00298
commit 652ce4c9d3
36 changed files with 2438 additions and 396 deletions

View File

@ -109,13 +109,19 @@
</div>
</template>
<script setup>
import { insertDemand } from "@/api/admin/enterprise";
// import { insertDemand } from "@/api/admin/enterprise";
import {
insertDemand,
getDemand,
updateDemand,
} from "@/api/admin/enterprise/demand";
import CityOptions from "@/views/components/CityOptions";
import { ElMessage } from "element-plus";
import { onActivated } from "vue";
import { useRouter } from "vue-router";
import { useRoute, useRouter } from "vue-router";
const router = useRouter();
const route = useRoute();
const data = reactive({
form: {
check: [],
@ -169,16 +175,14 @@ const submitForm = () => {
formRef.value.validate(async (valid) => {
const cityFormValid = cityFormRef.value.validateForm(); // 城市
if (valid && cityFormValid) {
console.log(form.value);
if (form.value.id != undefined) {
// updatePost(form.value).then((response) => {
// proxy.$modal.msgSuccess("修改成功");
// proxy.$router.go(-1);
// });
await updateDemand(form.value);
ElMessage.success("修改成功");
router.back();
} else {
await insertDemand(form.value);
ElMessage.success("新增服务需求成功");
router.go(-1);
router.back();
}
}
});
@ -198,5 +202,11 @@ function addCheck() {
}
}
onActivated(() => {});
onActivated(() => {
if (route.query.id) {
getDemand({ id: route.query.id }).then((resp) => {
form.value = resp.data;
});
}
});
</script>