Commit 4fd4e7b6 authored by “yiyousong”'s avatar “yiyousong”

pref:添加站点事项编辑

parent aa92220f
......@@ -16,12 +16,8 @@
class="select-department"
placeholder="事项来源"
>
<a-select-option :value="0">
一体化添加
</a-select-option>
<a-select-option :value="1">
手动添加
</a-select-option>
<a-select-option :value="0"> 一体化添加 </a-select-option>
<a-select-option :value="1"> 手动添加 </a-select-option>
</a-select>
<a-input-search
v-model="searchLeftVal"
......@@ -86,7 +82,7 @@
<span v-else-if="text.onlineToTheSceneNum">{{
text.onlineToTheSceneNum
}}</span>
<span v-else>--</span>
<span v-else>0</span>
</template>
<!-- 操作 -->
<template slot="action" slot-scope="text">
......@@ -95,7 +91,7 @@
href="javascript:;"
v-if="text.source == 1"
class="edit"
@click="handleEdit(text.matterId)"
@click="handleSiteEdit(text)"
>编辑</a
>
<a
......@@ -127,12 +123,8 @@
class="select-department"
placeholder="事项来源"
>
<a-select-option :value="0">
一体化事项
</a-select-option>
<a-select-option :value="1">
自建事项
</a-select-option>
<a-select-option :value="0"> 一体化事项 </a-select-option>
<a-select-option :value="1"> 自建事项 </a-select-option>
</a-select>
<a-input-search
v-model="searchRightVal"
......@@ -213,6 +205,12 @@
</a-table>
</div>
</div>
<!-- 编辑站点事项 -->
<EditSiteMatter
ref="EditSiteMatter"
:formVisible.sync="formVisible"
@editSuccess="getMatterSiteData"
></EditSiteMatter>
</div>
</template>
......@@ -225,6 +223,7 @@ import {
delMatter,
} from "@/services/matter";
import { getBusinessMatterList, delBusinessMatter } from "@/services/business";
import EditSiteMatter from "../group/EditSiteMatter.vue";
// import { getDeptList } from "@/services/dept";
import local from "@/utils/local";
import { mapMutations } from "vuex";
......@@ -295,6 +294,9 @@ const rightColumns = [
];
export default {
components: {
EditSiteMatter,
},
data() {
return {
leftColumns,
......@@ -323,6 +325,7 @@ export default {
onlineToTheSceneNum: "", // 网办到现场次数
searchLeftVal: "", // 站点事项搜索
searchRightVal: "", // 一体化事项搜索
formVisible: false,
};
},
created() {
......@@ -559,7 +562,7 @@ export default {
}
}
},
// 编辑
// 编辑基础事项
handleEdit(matterId) {
this.$router.push({
path: "/business/synopsis",
......@@ -569,6 +572,12 @@ export default {
},
});
},
// 编辑站点事项
handleSiteEdit(row) {
this.formVisible = true;
this.$refs.EditSiteMatter.onEdit(row);
console.log(row);
},
},
};
</script>
......
<template>
<a-modal
title="编辑站点事项"
@ok="handleOk"
:visible="Visible"
@cancel="handleClose"
:maskClosable="false"
destroyOnClose
>
<a-form-model
:model="form"
:label-col="labelCol"
:wrapper-col="wrapperCol"
ref="formData"
:rules="rules"
>
<a-form-model-item label="部门名称" prop="matterName">
<a-input v-model="form.matterName" placeholder="请输入事项名称" />
</a-form-model-item>
<a-form-model-item label="所属部门" prop="deptId">
<a-select
showSearch
v-model="curDpt"
optionFilterProp="label"
placeholder="请选择部门"
labelInValue
@change="changeDpt"
>
<a-select-option
v-for="v in deptData"
:key="v.id"
:value="v.id"
:label="v.name"
>
{{ v.name }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-form-model>
</a-modal>
</template>
<script>
import local from "@/utils/local";
import { getDeptList } from "@/services/dept";
import { addSitematter } from "@/services/matter";
export default {
data() {
return {
labelCol: { span: 4 },
wrapperCol: { span: 20 },
siteId: local.getLocal("siteId"),
curDpt: undefined, // 选中部门
deptData: [],
form: {
matterName: "",
deptName: "",
deptId: "",
},
rules: {
matterName: [
{ required: true, message: "请输入事项名称", trigger: "blur" },
],
deptId: [{ required: true, message: "请选择部门", trigger: "change" }],
},
};
},
props: {
formVisible: {
type: Boolean,
default: false,
},
},
computed: {
Visible: {
get() {
return this.formVisible;
},
set(val) {
this.$emit("update:formVisible", val);
},
},
},
created() {
this.getDeptListData();
},
methods: {
// 获取部门列表
async getDeptListData() {
let res = await getDeptList({ siteId: this.siteId, page: 1, size: -1 });
let { code, data } = res.data;
if (code === 1) {
this.deptData = data.data;
}
},
// 切换部门
changeDpt(info) {
this.form.deptId = info.key;
this.form.deptName = info.label;
},
// 编辑
onEdit(data) {
this.form = { ...data };
this.curDpt = {
key: this.form.deptId,
label: this.form.deptName,
};
},
// 保存
handleOk() {
this.$refs.formData.validate(async (valid) => {
if (valid) {
let res = await addSitematter(this.form);
let { code, msg } = res.data;
if (code === 1) {
this.$message.success(msg);
this.$emit("editSuccess");
this.handleClose();
}
}
});
},
// 关闭
handleClose() {
this.$refs.formData.resetFields();
this.Visible = false;
},
},
};
</script>
<style lang="less" scoped>
.ant-form-item {
margin-bottom: 15px;
}
/deep/.ant-form-explain {
position: absolute;
}
</style>
\ No newline at end of file
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