Commit c1450025 authored by “yiyousong”'s avatar “yiyousong”

pref:修改项目是否收费

parent 7533a921
...@@ -10,33 +10,13 @@ ...@@ -10,33 +10,13 @@
<a-row :gutter="[8, 20]" type="flex" justify="start"> <a-row :gutter="[8, 20]" type="flex" justify="start">
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="是否收费"> <a-form-model-item label="是否收费">
<a-radio-group v-model="isRates"> <a-radio-group v-model="isRates" @change="chagneRates">
<a-radio :value="false"></a-radio> <a-radio :value="false"></a-radio>
<a-radio :value="true"></a-radio> <a-radio :value="true"></a-radio>
</a-radio-group> </a-radio-group>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<!-- <a-row :gutter="[8, 20]" type="flex" justify="start">
<a-col :span="24">
<a-form-model-item label="所属事项" prop="matterId">
<a-select
:disabled="isRates"
allowClear
@select="handleSelect"
v-model="formData.matterId"
placeholder="请选择所属事项"
>
<a-select-option
v-for="v in matterList"
:key="v.id"
:value="v.matterId"
>{{ v.matterName }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-col>
</a-row> -->
<a-row :gutter="[8, 20]" type="flex" justify="start"> <a-row :gutter="[8, 20]" type="flex" justify="start">
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="费用(元)" prop="content"> <a-form-model-item label="费用(元)" prop="content">
...@@ -71,17 +51,19 @@ ...@@ -71,17 +51,19 @@
</template> </template>
<script> <script>
import { addMattercharges } from "@/services/matter"; import {
addMattercharges,
getMattercharges,
delMattercharges,
} from "@/services/matter";
import local from "@/utils/local"; import local from "@/utils/local";
export default { export default {
data() { data() {
return { return {
isRates: true, isRates: false,
siteId: "", siteId: "",
matterList: [], matterList: [],
formData: { formData: {
matterId: undefined, // 事项id
matterName: "", // 事项名称
content: "", // 收费标准 content: "", // 收费标准
source: 1, // 事项来源(0.政务网,1.自定义) source: 1, // 事项来源(0.政务网,1.自定义)
}, },
...@@ -89,27 +71,31 @@ export default { ...@@ -89,27 +71,31 @@ export default {
content: [ content: [
{ required: true, message: "费用不能为空", trigger: "change" }, { required: true, message: "费用不能为空", trigger: "change" },
], ],
matterId: [
{ required: true, message: "所属事项不能为空", trigger: "change" },
],
}, },
}; };
}, },
created() { created() {
// this.getSiteMatterList(); this.getMattercharges();
}, },
methods: { methods: {
// 获取站点事项列表 // 获取收费列表
// async getSiteMatterList() { async getMattercharges() {
// this.siteId = this.$route.query.siteId; if (!local.getLocal("matter")) return;
// let res = await getSiteMatterList({ siteId: this.siteId }); let res = await getMattercharges({
// this.matterList = res.data.data.data; page: 1,
// }, size: -1,
// // 事项下拉选择 matterId: local.getLocal("matter").id,
// handleSelect(val, node) { matterName: local.getLocal("matter").matterName,
// let { text } = node.componentOptions.children[0]; });
// this.formData.matterName = text; if (res.data.code === 1 && res.data.data.data.length) {
// }, this.formData = res.data.data.data[0];
this.isRates = false;
} else {
Object.assign(this.formData, this.$options.data().formData);
this.isRates = true;
}
},
// 获取收费标准
onSubmit() { onSubmit() {
if (local.getLocal("matter")) { if (local.getLocal("matter")) {
this.$refs.formData.validate(async (valid) => { this.$refs.formData.validate(async (valid) => {
...@@ -122,9 +108,7 @@ export default { ...@@ -122,9 +108,7 @@ export default {
let { code, msg } = res.data; let { code, msg } = res.data;
if (code === 1) { if (code === 1) {
this.$message.success(msg); this.$message.success(msg);
this.isRates = true; this.getMattercharges();
} else {
this.$message.error(msg);
} }
} }
}); });
...@@ -132,6 +116,18 @@ export default { ...@@ -132,6 +116,18 @@ export default {
this.$message.warning("请先新增基本信息"); this.$message.warning("请先新增基本信息");
} }
}, },
async chagneRates() {
if (this.isRates && this.formData.id) {
let res = await delMattercharges({ id: this.formData.id });
let { code, msg } = res.data;
if (code === 1) {
this.$message.success(msg);
this.getMattercharges();
}
} else if (this.isRates) {
this.$refs.formData.resetFields();
}
},
handleReset() { handleReset() {
this.$refs.formData.resetFields(); this.$refs.formData.resetFields();
}, },
......
...@@ -161,3 +161,11 @@ export async function delMatterflowlimit(data) { ...@@ -161,3 +161,11 @@ export async function delMatterflowlimit(data) {
export async function addMattercharges(data) { export async function addMattercharges(data) {
return request(mattercharges.save, METHOD.POST, data); return request(mattercharges.save, METHOD.POST, data);
} }
// 获取收费标准
export async function getMattercharges(data) {
return request(mattercharges.list, METHOD.POST, data);
}
// 删除收费标准
export async function delMattercharges(data) {
return request(mattercharges.delete, METHOD.GET, data);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment