Commit 51a1beff authored by 刘殿昕's avatar 刘殿昕

菜单,个人档案

parent d152b930
...@@ -46,11 +46,7 @@ ...@@ -46,11 +46,7 @@
<button v-else class="btn btn_act2" @click="nodePosition(1)"> <button v-else class="btn btn_act2" @click="nodePosition(1)">
<i class="el-icon-bottom"></i>&nbsp;下移 <i class="el-icon-bottom"></i>&nbsp;下移
</button> </button>
<button <button v-if="mcHold&&ymHold" class="btn btn_act1" @click="saveNode()">
v-if="mcHold&&ymHold"
class="btn btn_act1"
@click="saveNode()"
>
<i class="el-icon-check"></i>&nbsp;保存 <i class="el-icon-check"></i>&nbsp;保存
</button> </button>
<button v-else class="btn btn_dis"> <button v-else class="btn btn_dis">
...@@ -108,6 +104,7 @@ ...@@ -108,6 +104,7 @@
</template> </template>
<script> <script>
import helper from "@/services/helper.js";
export default { export default {
data() { data() {
var validateMenuName = (rule, value, callback) => { var validateMenuName = (rule, value, callback) => {
...@@ -172,15 +169,7 @@ export default { ...@@ -172,15 +169,7 @@ export default {
create_user: "", create_user: "",
create_date: "" create_date: ""
}, },
formYs: { formStaged: [],
menu_name: "",
visit_url: "",
team_name: "",
detail: "",
menu_order: "",
create_user: "",
create_date: ""
},
formContrast: { formContrast: {
menu_name: "", menu_name: "",
visit_url: "", visit_url: "",
...@@ -203,7 +192,8 @@ export default { ...@@ -203,7 +192,8 @@ export default {
mcHold: false, mcHold: false,
ymHold: false, ymHold: false,
reset: false, reset: false,
newI: 0 newI: 0,
helper: helper
}; };
}, },
watch: { watch: {
...@@ -220,6 +210,22 @@ export default { ...@@ -220,6 +210,22 @@ export default {
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1;
}, },
nodeClick(data, node) { nodeClick(data, node) {
console.log(this.nodeId, this.formDetail);
if (this.nodeId.indexOf("new") > -1) {
let result = this.formStaged.some(item => {
if (item.id == this.nodeId) {
return true;
}
});
if (result) {
this.formStaged.forEach(item => {
if (item.id == this.nodeId) {
item.data = this.formDetail;
}
});
}
this.formStaged.push({ id: this.nodeId, data: this.formDetail });
}
this.nodeId = data.menu_id; this.nodeId = data.menu_id;
if (node.previousSibling != undefined) { if (node.previousSibling != undefined) {
this.previousSibling = true; this.previousSibling = true;
...@@ -233,7 +239,11 @@ export default { ...@@ -233,7 +239,11 @@ export default {
} }
let cid = String(data.menu_id); let cid = String(data.menu_id);
if (cid.indexOf("new") > -1) { if (cid.indexOf("new") > -1) {
this.formDetail = this.formYs; this.formStaged.forEach(item => {
if (item.id == cid) {
this.formDetail = item.data;
}
});
} else { } else {
let query = { let query = {
id: this.nodeId id: this.nodeId
...@@ -241,6 +251,9 @@ export default { ...@@ -241,6 +251,9 @@ export default {
this.$api.authority.getMenu(query).then(response => { this.$api.authority.getMenu(query).then(response => {
if (response.data.success == 1) { if (response.data.success == 1) {
this.formDetail = response.data.data; this.formDetail = response.data.data;
this.formDetail.create_date = helper.dateStringTransform(
this.formDetail.create_date
);
this.formContrast = response.data.data; this.formContrast = response.data.data;
} else { } else {
this.ruleFormIcon.username = false; this.ruleFormIcon.username = false;
...@@ -262,19 +275,35 @@ export default { ...@@ -262,19 +275,35 @@ export default {
this.$refs.tree.append(newChild, this.nodeId); this.$refs.tree.append(newChild, this.nodeId);
this.$refs.tree.setCurrentKey(newChild.menu_id); this.$refs.tree.setCurrentKey(newChild.menu_id);
let node = this.$refs.tree.getNode(newChild.menu_id); let node = this.$refs.tree.getNode(newChild.menu_id);
console.log(node); this.$api.user.getNowUser().then(response => {
this.nodeClick(newChild, node); if (response.data.success == 1) {
this.formDetail.create_user = response.data.data.user_name;
} else {
console.log(response.data.errMsg);
}
});
this.formDetail.menu_order = node.parent.childNodes.length; this.formDetail.menu_order = node.parent.childNodes.length;
this.formDetail.menu_name = newChild.menu_name; this.formDetail.menu_name = newChild.menu_name;
this.formDetail.create_date = helper.dateFormat(
"YYYY-mm-dd HH:MM:SS",
new Date()
);
this.formDetail.detail = "";
this.formDetail.team_name = "";
this.formDetail.visit_url = "";
this.mcHold = true; this.mcHold = true;
this.nodeClick(newChild, node);
}, },
resetForm() { resetForm() {
this.formDetail = this.formContrast; this.formDetail = this.formContrast;
}, },
getTree() { getTree() {
this.$api.authority.getMenuList().then(response => { this.$api.authority.getMenuList().then(response => {
console.log(response); if (response.data.success == 1) {
this.treeData = response.data.data; this.treeData = response.data.data;
} else {
console.log(response.data.errMsg);
}
}); });
}, },
saveNode() { saveNode() {
...@@ -284,7 +313,9 @@ export default { ...@@ -284,7 +313,9 @@ export default {
menu_name: this.formDetail.menu_name, menu_name: this.formDetail.menu_name,
detail: this.formDetail.detail, detail: this.formDetail.detail,
visit_url: this.formDetail.visit_url, visit_url: this.formDetail.visit_url,
team_name: this.formDetail.team_name team_name: this.formDetail.team_name,
issystem: 1,
menu_order: this.formDetail.menu_order
}; };
if (this.nodeId.substring(0, 3) == "new") { if (this.nodeId.substring(0, 3) == "new") {
let node = this.$refs.tree.getNode(this.nodeId); let node = this.$refs.tree.getNode(this.nodeId);
...@@ -322,9 +353,9 @@ export default { ...@@ -322,9 +353,9 @@ export default {
this.$api.authority.delMenu(params).then(response => { this.$api.authority.delMenu(params).then(response => {
if (response.data.success == 1) { if (response.data.success == 1) {
this.message({ this.message({
message: "删除菜单成功", message: "删除菜单成功",
type: "success" type: "success"
}); });
this.getTree(); this.getTree();
} else { } else {
console.log(response.data.errMsg); console.log(response.data.errMsg);
...@@ -353,6 +384,10 @@ export default { ...@@ -353,6 +384,10 @@ export default {
console.log(params); console.log(params);
this.$api.authority.positionMenu(params).then(response => { this.$api.authority.positionMenu(params).then(response => {
if (response.data.success == 1) { if (response.data.success == 1) {
this.message({
message: "更新菜单成功",
type: "success"
});
this.getTree(); this.getTree();
} else { } else {
console.log(response.data.errMsg); console.log(response.data.errMsg);
......
...@@ -256,7 +256,6 @@ export default { ...@@ -256,7 +256,6 @@ export default {
getNewList(val) { getNewList(val) {
console.log(val); console.log(val);
this.imgList[0] = val.url; this.imgList[0] = val.url;
console.log(this.imgList);
}, },
previous() {}, previous() {},
registe() {}, registe() {},
......
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