Commit 603bc8b1 authored by renjintao's avatar renjintao

edit

parent fe3dbe01
...@@ -52,25 +52,13 @@ export default { ...@@ -52,25 +52,13 @@ export default {
titles: this.title titles: this.title
}; };
}, },
disalbe: {
// 0 启用 1 禁用 2权限不足
type: Number,
default: 0,
},
},
data() {
return {
text: "",
css: "detail",
};
},
created() { created() {
var oprates = { var oprates = {
detail: "查看", detail: "查看",
edit: "编辑", edit: "编辑",
add: "添加", add: "添加",
delete: "删除", delete: "删除",
remove: "删除", remove: "删除"
}; };
if (oprates[this.oprate]) { if (oprates[this.oprate]) {
...@@ -81,76 +69,58 @@ data() { ...@@ -81,76 +69,58 @@ data() {
} else if (this.type == "icon") { } else if (this.type == "icon") {
this.css = "icon"; this.css = "icon";
} }
if (this.disalbe) {
this.css = "disable" },
mounted() {
if (this.disable) {
this.colors = "#ccc";
this.titles = ''
} }
}, },
methods: { methods: {
handler() { handler() {
if (this.disalbe == 0) { if (!this.disable) {
if (this.oprate == "delete" || this.oprate == "remove") { if (this.oprate == "delete" || this.oprate == "remove") {
this.$Modal.confirm({ this.$Modal.confirm({
title: this.title, title: this.title,
content: "<p>" + this.msg + "</p>", content: "<p>" + this.msg + "</p>",
onOk: () => { onOk: () => {
this.$emit("click", event); this.$emit("click", event);
}, }
}); });
} else { } else {
this.$emit("click", event); this.$emit("click", event);
} }
}
}
},
watch: {
v() {},
disable(v) {
if (v) {
this.colors = "#ccc";
this.titles = '';
} else {
this.colors = this.color;
this.titles = this.title;
}, }
mounted() { this.disable = v
},
if (this.disable) { color(v) {
this.colors = "#ccc"; if (v && v != '') {
this.titles = '' this.colors = v
} }
},
methods: {
handler() {
if (!this.disable) {
if (this.oprate == "delete" || this.oprate == "remove") {
this.$Modal.confirm({
title: this.title,
content: "<p>" + this.msg + "</p>",
onOk: () => {
this.$emit("click", event);
}
});
} else {
this.$emit("click", event);
}
}
}
},
watch: {
v() {},
disable(v) {
if (v) {
this.colors = "#ccc";
this.titles = '';
} else {
this.colors = this.color;
this.titles = this.title;
}
this.disable = v
},
color(v) {
if (v && v != '') {
this.colors = v
}
}, },
title(v) { title(v) {
if (v && v != '') { if (v && v != '') {
this.titles = v this.titles = v
} }
}, },
}, },
}; };
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -158,13 +158,12 @@ export default { ...@@ -158,13 +158,12 @@ export default {
}, },
}, },
{ {
attrs: { icon: "md-arrow-dropright-circle", key: "type",
type: "icon", width: 90,
title: "派发", title: this.l("type"),
oprate: "edit", align: "left",
disalbe:1, high: true,
}, code: "mes.project_plan.Type",
on: { click: () => this.copy(params.row.id) },
}, },
{ {
key: "title", key: "title",
...@@ -175,15 +174,19 @@ export default { ...@@ -175,15 +174,19 @@ export default {
high: true, high: true,
}, },
{ {
attrs: { icon: "md-create", key: "status",
type: "icon", title: this.l("status"),
title: "编辑", align: "left",
oprate: "edit", }, high: true,
on: { click: () => this.edit(params.row.id) }, code: "mes.project_plan.Status",
} },
), {
h( key: "startDate",
"op", title: this.l("startDate"),
align: "left",
high: true,
type: "date"
},
{ {
key: "endDate", key: "endDate",
title: this.l("endDate"), title: this.l("endDate"),
......
...@@ -349,105 +349,45 @@ export default { ...@@ -349,105 +349,45 @@ export default {
this.detail = () => import('./add') this.detail = () => import('./add')
this.modal = true; this.modal = true;
}, },
productSearch(id, item, planIds) {
this.planId = item.selected ? id : '';
this.planIdsCur = item.selected ? planIds : []
let where = {
planId: {
op: "In",
value: item.selected ? planIds : []
},
projectId: {
op: "Equal",
value: this.$route.params.id
},
};
this.$refs.grid.reload(where);
},
updatepart(valId, valStatus) {
let params = {
id: valId,
status: valStatus,
}
Api.updatepart(params).then(r => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success('操作成功')
} else {
this.$Message.error('操作失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('操作失败')
console.warn(err)
})
},
},
mounted() {
console.log(this);
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.title = "新增";
this.fullScreen = false;
this.detail = () => import("./add");
this.modal = true;
},
highSearch() { highSearch() {
this.curId = 0; this.curId = 0;
this.title = "高级搜索"; this.title = "高级搜索";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import("./search"); this.detail = () => import('./search')
this.modal = true; this.modal = true;
}, },
copy(id) { copy(id) {
this.curId = id; this.curId = id;
this.title = "克隆"; this.title = "克隆";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import("./add"); this.detail = () => import('./add')
this.modal = true; this.modal = true;
}, },
view(id) { view(id) {
this.curId = id; this.curId = id;
this.title = "详情"; this.title = "详情";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import("./detail"); this.detail = () => import('./detail')
this.modal = true; this.modal = true;
}, },
edit(id) { edit(id) {
this.curId = id; this.curId = id;
this.title = "编辑"; this.title = "编辑";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import("./edit"); this.detail = () => import('./edit')
this.modal = true; this.modal = true;
}, },
remove(id) { remove(id) {
Api.delete(id).then((r) => { Api.delete(id).then((r) => {
if (r.success) { if (r.success) {
this.$refs.grid.load(); this.$refs.grid.load();
this.$Message.success("删除成功"); this.$Message.success('删除成功')
} }
}); })
}, },
cancel() { cancel() {
this.curId = 0; this.curId = 0;
this.modal = false; this.modal = false
}, },
onHide() { onHide() {
// this.$Message.info("收起左侧树") // this.$Message.info("收起左侧树")
...@@ -457,59 +397,62 @@ export default { ...@@ -457,59 +397,62 @@ export default {
//this.$Message.info("展开左侧树") //this.$Message.info("展开左侧树")
this.showMenu = true; this.showMenu = true;
}, },
productSearch(id, item, productIds, ids) { productSearch(id, item, planIds) {
this.planId = item.selected ? id : '';
this.planIdsCur = item.selected ? planIds : []
let where = { let where = {
bomId: { planId: {
op: "In", op: "In",
value: ids, value: item.selected ? planIds : []
},
projectId: {
op: "Equal",
value: this.$route.params.id
}, },
}; };
this.$refs.grid.reload(where); this.$refs.grid.reload(where);
}, },
updatestatus(valId, valStatus) { updatepart(valId, valStatus) {
let params = { let params = {
id: valId, id: valId,
status: valStatus, status: valStatus,
detail: "", }
}; Api.updatepart(params).then(r => {
Api.updatestatus(params) if (r.success) {
.then((r) => { this.$refs.grid.load();
if (r.success) { this.$Message.success('操作成功')
this.$refs.grid.load(); } else {
this.$Message.success("操作成功"); this.$Message.error('操作失败')
} else { }
this.$Message.error("操作失败"); }).catch(err => {
} this.disabled = false;
}) this.$Message.error('操作失败')
.catch((err) => { console.warn(err)
this.disabled = false; })
this.$Message.error("操作失败");
console.warn(err);
});
}, },
onSelect(val) { onSelect(val) {
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch)
}, },
viewRecord(id) { viewRecord(id) {
this.curId = id; this.curId = id;
this.title = "查看记录"; this.title = "查看记录";
this.fullScreen = true; this.fullScreen = true;
this.detail = () => import("./detail"); this.detail = () => import('./detail')
this.modal = true; this.modal = true;
}, },
addRecord(id) { addRecord(id) {
this.curId = id; this.curId = id;
this.title = "新增记录"; this.title = "新增记录";
this.fullScreen = true; this.fullScreen = true;
this.detail = () => import("../record/add"); this.detail = () => import('../record/add')
this.modal = true; this.modal = true;
}, },
l(key) { l(key) {
let vkey = "project_task" + "." + key; let vkey = "project_task" + "." + key;
return this.$t(vkey) || key; return this.$t(vkey) || key
}, }
}, }
}; }
</script> </script>
<style lang="less"> <style lang="less">
......
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