Commit 603bc8b1 authored by renjintao's avatar renjintao

edit

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