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

菜单,个人档案

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