Compare commits
2 Commits
d47a024058
...
51ba2008ac
| Author | SHA1 | Date | |
|---|---|---|---|
| 51ba2008ac | |||
| 4ae7c5fa9e |
@ -2,6 +2,8 @@
|
||||
<div class="detail-container">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="right"
|
||||
label-width="150px"
|
||||
style="max-height: 60vh; overflow-y: auto; padding-right: 50px"
|
||||
@ -9,37 +11,41 @@
|
||||
<el-form-item label="所属服务站:">
|
||||
<span>{{ yhzData.rawName }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="物资名称:">
|
||||
<el-form-item label="物资名称:" prop="wzmc">
|
||||
<el-input
|
||||
maxlength="20"
|
||||
show-word-limit
|
||||
v-model="form.material.wzmc"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量与单位:">
|
||||
<el-form-item label="数量与单位:" required>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="16">
|
||||
<el-input
|
||||
v-model="form.material.sl"
|
||||
type="number"
|
||||
placeholder="请输入数量"
|
||||
></el-input>
|
||||
<el-form-item prop="sl">
|
||||
<el-input
|
||||
v-model.number="form.material.sl"
|
||||
type="number"
|
||||
placeholder="请输入数量"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-select
|
||||
v-model="form.material.dw"
|
||||
filterable
|
||||
allow-create
|
||||
clearable
|
||||
placeholder="选择单位"
|
||||
>
|
||||
<el-option label="个" value="个"></el-option>
|
||||
<el-option label="包" value="包"></el-option>
|
||||
<el-option label="盒" value="盒"></el-option>
|
||||
<el-option label="桶" value="桶"></el-option>
|
||||
<el-option label="箱" value="箱"></el-option>
|
||||
<el-option label="袋" value="袋"></el-option>
|
||||
</el-select>
|
||||
<el-form-item prop="dw">
|
||||
<el-select
|
||||
v-model="form.material.dw"
|
||||
filterable
|
||||
allow-create
|
||||
clearable
|
||||
placeholder="选择单位"
|
||||
>
|
||||
<el-option label="个" value="个"></el-option>
|
||||
<el-option label="包" value="包"></el-option>
|
||||
<el-option label="盒" value="盒"></el-option>
|
||||
<el-option label="桶" value="桶"></el-option>
|
||||
<el-option label="箱" value="箱"></el-option>
|
||||
<el-option label="袋" value="袋"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
@ -54,7 +60,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ref, computed } from "vue";
|
||||
const formRef = ref(null);
|
||||
defineExpose({ formRef });
|
||||
|
||||
@ -68,6 +74,51 @@ const props = defineProps({
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const rules = computed(() => {
|
||||
return {
|
||||
wzmc: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.material.wzmc) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入物资名称"));
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
sl: [
|
||||
{
|
||||
required: true,
|
||||
type: "number",
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.material.sl) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入数量"));
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
dw: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.material.dw) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请选择或输入单位"));
|
||||
}
|
||||
},
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@ -376,7 +376,7 @@ const getDetailData = async (row) => {
|
||||
|
||||
// 打开新增物资弹窗
|
||||
const openAddModel = () => {
|
||||
if(!yhzid.value){
|
||||
if (!yhzid.value) {
|
||||
ElMessage.error('请先选择养护站');
|
||||
return;
|
||||
}
|
||||
@ -392,25 +392,32 @@ const openAddModel = () => {
|
||||
modelVisible.value = false;
|
||||
};
|
||||
model.onConfirm = async () => {
|
||||
try {
|
||||
console.log('form', toRaw(form))
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yjwz/add',
|
||||
method: 'POST',
|
||||
data: toRaw(form),
|
||||
await dialogRef?.value?.dynamicComponentRef?.formRef
|
||||
.validate()
|
||||
.then(async () => {
|
||||
try {
|
||||
console.log('form', toRaw(form))
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yjwz/add',
|
||||
method: 'POST',
|
||||
data: toRaw(form),
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
ElMessage.success('新增成功');
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
getyhzwzList(qxmc.value, yhzid.value, filterData);
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log('error', error)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
ElMessage.error('请处理表单中的错误项');
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
ElMessage.success('新增成功');
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
getyhzwzList(qxmc.value, yhzid.value, filterData);
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log('error', error)
|
||||
}
|
||||
};
|
||||
model.width = '40%';
|
||||
modelVisible.value = true;
|
||||
|
||||
265
packages/screen/src/views/ServiceStationManagePage/addDialog.vue
Normal file
265
packages/screen/src/views/ServiceStationManagePage/addDialog.vue
Normal file
@ -0,0 +1,265 @@
|
||||
<template>
|
||||
<div class="detail-container">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
label-position="right"
|
||||
label-width="140px"
|
||||
style="max-height: 60vh; overflow-y: auto; padding-right: 50px"
|
||||
:rules="rules"
|
||||
>
|
||||
<el-row>
|
||||
<el-form-item label="所属区县" prop="qxmc">
|
||||
<el-select
|
||||
v-model="qx"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
clearable
|
||||
placeholder="输入区县名称查询"
|
||||
:remote-method="remoteMethod_qx"
|
||||
:loading="loading"
|
||||
@change="handleSelect_qx"
|
||||
value-key="index"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in qxList"
|
||||
:key="index"
|
||||
:label="item.qxmc"
|
||||
:value="item.qxmc"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="服务站名称" prop="mc">
|
||||
<el-input maxlength="20" show-word-limit v-model="form.mc" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="负责人:" prop="fzr">
|
||||
<el-select
|
||||
v-model="ryxx"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
clearable
|
||||
placeholder="输入人员名称 / 联系方式 查询"
|
||||
:remote-method="remoteMethod"
|
||||
:loading="loading"
|
||||
@change="handleSelect"
|
||||
value-key="userId"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in selectOptions"
|
||||
:key="item.userId"
|
||||
:label="item.realName"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="负责人添加经纬度:">
|
||||
<el-select v-model="sfjwd">
|
||||
<el-option label="是" value="是"></el-option>
|
||||
<el-option label="否" value="否"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="sfjwd === '否'">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="站点经度:" prop="jd">
|
||||
<el-input v-model="form.jd" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="站点纬度:" prop="wd">
|
||||
<el-input v-model="form.wd" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch, computed } from "vue";
|
||||
import { request } from "@/utils/request";
|
||||
const formRef = ref(null);
|
||||
defineExpose({ formRef });
|
||||
|
||||
const props = defineProps({
|
||||
form: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
const sfjwd = ref("是");
|
||||
const qx = ref("");
|
||||
const ryxx = ref("");
|
||||
const loading = ref(false);
|
||||
const selectOptions = ref([]);
|
||||
const qxList = ref([]);
|
||||
|
||||
// 根据用户信息 查询角色列表
|
||||
const getUserList = async (key) => {
|
||||
try {
|
||||
const keyword = key;
|
||||
let url = "";
|
||||
if (keyword) {
|
||||
url = `/snow-ops-platform/yhzry/getUserByKey?key=${keyword}`;
|
||||
} else {
|
||||
url = `/snow-ops-platform/yhzry/getUserByKey?key=`;
|
||||
}
|
||||
const res = await request({
|
||||
url: url,
|
||||
method: "GET",
|
||||
});
|
||||
if (res.code === "00000") {
|
||||
return res.data;
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
// 选择人员筛选
|
||||
const remoteMethod = async (query) => {
|
||||
if (query === "") {
|
||||
selectOptions.value = [];
|
||||
return [];
|
||||
}
|
||||
loading.value = true;
|
||||
const res = await getUserList(query);
|
||||
if (res) {
|
||||
selectOptions.value = res;
|
||||
}
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
// 根据区县名称 查询区县列表
|
||||
const getQxList = async (key) => {
|
||||
try {
|
||||
const keyword = key;
|
||||
let url = "";
|
||||
if (keyword) {
|
||||
url = `/snow-ops-platform/district/listDistricts?qxmc=${keyword}`;
|
||||
} else {
|
||||
url = `/snow-ops-platform/district/listDistricts?qxmc=`;
|
||||
}
|
||||
const res = await request({
|
||||
url: url,
|
||||
method: "GET",
|
||||
});
|
||||
if (res.code === "00000") {
|
||||
return res.data;
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
// 选择区县筛选
|
||||
const remoteMethod_qx = async (query) => {
|
||||
loading.value = true;
|
||||
const res = await getQxList(query);
|
||||
if (res) {
|
||||
qxList.value = res;
|
||||
}
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
// 选择区县
|
||||
const handleSelect_qx = (value) => {
|
||||
props.form.qxmc = value;
|
||||
};
|
||||
|
||||
// 选择人员
|
||||
const handleSelect = (value) => {
|
||||
console.log("value", value);
|
||||
props.form.fzrXm = value.realName;
|
||||
props.form.fzrSjhm = value.phone;
|
||||
props.form.fzrUserId = value.userId;
|
||||
};
|
||||
|
||||
const rules = computed(() => {
|
||||
return {
|
||||
mc: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.mc) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入服务站名称"));
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
qxmc: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.qxmc) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请选择所属区县"));
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
fzr: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.fzrUserId && props.form.fzrXm && props.form.fzrSjhm) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请选择负责人"));
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
jd: [
|
||||
{
|
||||
required: sfjwd.value === "否",
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.jd) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入站点经度"));
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
wd: [
|
||||
{
|
||||
required: sfjwd.value === "否",
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.wd) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入站点纬度"));
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@ -2,6 +2,8 @@
|
||||
<div class="detail-container">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="right"
|
||||
label-width="150px"
|
||||
style="max-height: 60vh; overflow-y: auto; padding-right: 50px"
|
||||
@ -9,37 +11,41 @@
|
||||
<el-form-item label="所属服务站:">
|
||||
<span>{{ basicData.mc }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="物资名称:">
|
||||
<el-form-item label="物资名称:" prop="wzmc">
|
||||
<el-input
|
||||
maxlength="20"
|
||||
show-word-limit
|
||||
v-model="form.material.wzmc"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量与单位:">
|
||||
<el-form-item label="数量与单位:" required>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="16">
|
||||
<el-input
|
||||
v-model="form.material.sl"
|
||||
type="number"
|
||||
placeholder="请输入数量"
|
||||
></el-input>
|
||||
<el-form-item prop="sl">
|
||||
<el-input
|
||||
v-model.number="form.material.sl"
|
||||
type="number"
|
||||
placeholder="请输入数量"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-select
|
||||
v-model="form.material.dw"
|
||||
filterable
|
||||
allow-create
|
||||
clearable
|
||||
placeholder="选择单位"
|
||||
>
|
||||
<el-option label="个" value="个"></el-option>
|
||||
<el-option label="包" value="包"></el-option>
|
||||
<el-option label="盒" value="盒"></el-option>
|
||||
<el-option label="桶" value="桶"></el-option>
|
||||
<el-option label="箱" value="箱"></el-option>
|
||||
<el-option label="袋" value="袋"></el-option>
|
||||
</el-select>
|
||||
<el-form-item prop="dw">
|
||||
<el-select
|
||||
v-model="form.material.dw"
|
||||
filterable
|
||||
allow-create
|
||||
clearable
|
||||
placeholder="选择单位"
|
||||
>
|
||||
<el-option label="个" value="个"></el-option>
|
||||
<el-option label="包" value="包"></el-option>
|
||||
<el-option label="盒" value="盒"></el-option>
|
||||
<el-option label="桶" value="桶"></el-option>
|
||||
<el-option label="箱" value="箱"></el-option>
|
||||
<el-option label="袋" value="袋"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
@ -54,7 +60,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ref, computed } from "vue";
|
||||
const formRef = ref(null);
|
||||
defineExpose({ formRef });
|
||||
|
||||
@ -63,11 +69,56 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
basicData:{
|
||||
basicData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
// 表单校验规则
|
||||
const rules = computed(() => {
|
||||
return {
|
||||
wzmc: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.material.wzmc) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入物资名称"));
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
sl: [
|
||||
{
|
||||
required: true,
|
||||
type: "number",
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.material.sl) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入数量"));
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
dw: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.material.dw) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请选择或输入单位"));
|
||||
}
|
||||
},
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -2,16 +2,19 @@
|
||||
<div class="detail-container">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="right"
|
||||
label-width="150px"
|
||||
style="max-height: 60vh; overflow-y: auto; padding-right: 50px"
|
||||
>
|
||||
<el-form-item label="负责人:">
|
||||
<el-form-item label="负责人:" prop="fzr">
|
||||
<el-select
|
||||
v-model="ryxx"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
clearable
|
||||
placeholder="输入人员名称 / 联系方式 查询"
|
||||
:remote-method="remoteMethod"
|
||||
:loading="loading"
|
||||
@ -27,21 +30,24 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人添加经纬度:">
|
||||
<el-select v-model="form.sfjwd">
|
||||
<el-select v-model="sfjwd">
|
||||
<el-option label="是" value="是"></el-option>
|
||||
<el-option label="否" value="否"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="站点经纬度:">
|
||||
<el-input v-model="form.jwd" />
|
||||
<el-form-item v-if="sfjwd === '否'" label="站点经度:" prop="jd">
|
||||
<el-input v-model="form.jd" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="sfjwd === '否'" label="站点纬度:" prop="wd">
|
||||
<el-input v-model="form.wd" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { ref, onMounted, watch, computed } from "vue";
|
||||
import { request } from "@/utils/request";
|
||||
const formRef = ref(null);
|
||||
defineExpose({ formRef });
|
||||
@ -53,6 +59,7 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const sfjwd = ref("是");
|
||||
const ryxx = ref("");
|
||||
const loading = ref(false);
|
||||
const selectOptions = ref([]);
|
||||
@ -103,8 +110,37 @@ const handleSelect = (value) => {
|
||||
props.form.userId = value.userId;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
props.form.yhzid = props.yhzdata.id;
|
||||
// 表单校验规则
|
||||
const rules = computed(() => {
|
||||
return {
|
||||
fzr: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (props.form.userId && props.form.sjhm && props.form.xm) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请选择负责人"));
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
jd: [
|
||||
{
|
||||
required: sfjwd.value === "否",
|
||||
message: "请输入站点经度",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
wd: [
|
||||
{
|
||||
required: sfjwd.value === "否",
|
||||
message: "请输入站点纬度",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -241,7 +241,7 @@ const getPeopleList = async () => {
|
||||
const data = {
|
||||
pageNum: pagination.current,
|
||||
pageSize: pagination.pageSize,
|
||||
yhzid: Number(props.basicData.id),
|
||||
yhzid: props.basicData.id,
|
||||
};
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/yhzry/list",
|
||||
@ -333,8 +333,8 @@ const INIT_FORM_people = {
|
||||
yhzid: props.basicData.id,
|
||||
sjhm: "",
|
||||
xm: "",
|
||||
sfjwd: "",
|
||||
jwd: "",
|
||||
jd: "",
|
||||
wd: "",
|
||||
};
|
||||
const materialForm = reactive({});
|
||||
const INIT_FORM_material = {
|
||||
@ -381,6 +381,7 @@ const INIT_FORM_equipment = {
|
||||
fsfw: "",
|
||||
yhzid: props.basicData.id,
|
||||
};
|
||||
const dialogRef = ref(null);
|
||||
const modelVisible = ref(false);
|
||||
const model = reactive({
|
||||
title: "",
|
||||
@ -442,44 +443,58 @@ const handleAdd = () => {
|
||||
|
||||
// 新增负责人
|
||||
const handleAddPeopleConfirm = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/yhzry/add",
|
||||
method: "post",
|
||||
data: toRaw(peopleForm.value),
|
||||
await dialogRef?.value?.dynamicComponentRef?.formRef
|
||||
.validate()
|
||||
.then(async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/yhzry/add",
|
||||
method: "post",
|
||||
data: toRaw(peopleForm),
|
||||
});
|
||||
if (res.code === "00000") {
|
||||
ElMessage.success("新增成功");
|
||||
modelVisible.value = false;
|
||||
getPeopleList();
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
ElMessage.error(error.message);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
ElMessage.error("请处理表单中的错误项");
|
||||
});
|
||||
if (res.code === "00000") {
|
||||
ElMessage.success("新增成功");
|
||||
modelVisible.value = false;
|
||||
getPeopleList();
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
ElMessage.error(error.message);
|
||||
}
|
||||
};
|
||||
|
||||
// 新增物资
|
||||
const handleAddMaterialConfirm = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/yjwz/add",
|
||||
method: "post",
|
||||
data: toRaw(materialForm),
|
||||
await dialogRef?.value?.dynamicComponentRef?.formRef
|
||||
.validate()
|
||||
.then(async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/yjwz/add",
|
||||
method: "post",
|
||||
data: toRaw(materialForm),
|
||||
});
|
||||
if (res.code === "00000") {
|
||||
ElMessage.success("新增成功");
|
||||
modelVisible.value = false;
|
||||
getMaterialList();
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
ElMessage.error(error.message);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
ElMessage.error("请处理表单中的错误项");
|
||||
});
|
||||
if (res.code === "00000") {
|
||||
ElMessage.success("新增成功");
|
||||
modelVisible.value = false;
|
||||
getMaterialList();
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
ElMessage.error(error.message);
|
||||
}
|
||||
};
|
||||
|
||||
// 新增设备
|
||||
|
||||
@ -2,6 +2,7 @@ import { h, ref, onMounted, reactive, watch, toRaw, nextTick } from "vue";
|
||||
import { request } from "@/utils/request";
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import DetailDrawer from "./detailDrawer.vue";
|
||||
import AddDialog from "./addDialog.vue";
|
||||
|
||||
const tableData = ref([]); // 表格数据
|
||||
const filterData = reactive({
|
||||
@ -16,8 +17,19 @@ const model = reactive({
|
||||
props: {},
|
||||
onCancel: null,
|
||||
onConfirm: null,
|
||||
width: '',
|
||||
}); // 弹窗内容
|
||||
const form = reactive({});
|
||||
const form = reactive({
|
||||
});
|
||||
const INIT_FORM = {
|
||||
qxmc: "",
|
||||
mc: "",
|
||||
fzrXm: "",
|
||||
fzrSjhm: "",
|
||||
fzrUserId: "",
|
||||
jd: "",
|
||||
wd: "",
|
||||
};
|
||||
const drawer = reactive({
|
||||
title: '',
|
||||
content: null,
|
||||
@ -113,9 +125,49 @@ const getYhzDetail = async (row) => {
|
||||
|
||||
// 打开新增养护站弹窗
|
||||
const openAddDialog = () => {
|
||||
|
||||
console.log('新增',)
|
||||
model.title = '新增养护站';
|
||||
Object.assign(form, INIT_FORM);
|
||||
model.props = {
|
||||
form: form,
|
||||
};
|
||||
model.content = AddDialog;
|
||||
model.onCancel = () => {
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
};
|
||||
model.onConfirm = async () => {
|
||||
dialogType.value = '';
|
||||
await dialogRef?.value?.dynamicComponentRef?.formRef.validate().then(() => {
|
||||
addYHZ();
|
||||
})
|
||||
.catch((err) => {
|
||||
ElMessage.error('请处理表单中的错误项');
|
||||
});
|
||||
};
|
||||
model.width = "50%"
|
||||
modelVisible.value = true;
|
||||
};
|
||||
|
||||
// 新增养护站
|
||||
const addYHZ = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/yhz/add",
|
||||
method: "POST",
|
||||
data: form,
|
||||
});
|
||||
if (res.code === "00000") {
|
||||
ElMessage.success("新增成功");
|
||||
modelVisible.value = false;
|
||||
getTableData();
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message || "新增失败");
|
||||
}
|
||||
};
|
||||
|
||||
export default () => {
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user