diff --git a/src/components/GanttComponent.vue b/src/components/GanttComponent.vue
index cc6b0865..ea640031 100644
--- a/src/components/GanttComponent.vue
+++ b/src/components/GanttComponent.vue
@@ -122,7 +122,15 @@ export default {
obj.state = item.state;
obj.start = item.start_date;
obj.start_date = item.start_date;
- obj.duration = 1;
+ let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
+ let firstDate = new Date(item.start_date);
+ let secondDate = new Date(item.end_date);
+ let timeDiff = Math.abs(
+ secondDate.getTime() - firstDate.getTime()
+ );
+ let daysDiff = Math.ceil(timeDiff / oneDay);
+ console.log("daysDiff", daysDiff + 1);
+ obj.duration = daysDiff + 1;
obj.progress = item.count_real / item.count;
obj.count = item.count;
obj.count_ok = item.count_ok;
diff --git a/src/views/pm/mtask_drawer.vue b/src/views/pm/mtask_drawer.vue
index a59c5853..8ebbf455 100644
--- a/src/views/pm/mtask_drawer.vue
+++ b/src/views/pm/mtask_drawer.vue
@@ -1,132 +1,194 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ state_[scope.row.state] }}
-
-
- {{ state_[scope.row.state] }}
-
-
-
-
-
- 编辑
-
- 编辑
-
-
-
-
-
-
-
-
-
-
-
-
- {{form.number}}
-
-
-
-
- {{form.mgroup_name}}
-
-
-
-
- {{form.start_date}}
-
-
-
-
-
-
-
-
-
-
-
- 确定
- 取消
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.start_date }}
+ {{ scope.row.start_date }} —
+ {{ scope.row.end_date }}
+
+
+
+
+
+
+ {{ state_[scope.row.state] }}
+
+
+ {{ state_[scope.row.state] }}
+
+
+
+
+
+ 编辑
+
+ 编辑
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ form.number }}
+
+
+
+
+ {{ form.mgroup_name }}
+
+
+
+
+ {{ form.start_date }}
+
+
+
+
+
+
+
+
+
+
+
+ 确定
+ 取消
+
+
\ No newline at end of file
+ emits: ["closed"],
+ props: {
+ utaskId: { type: String, default: "" },
+ },
+ data() {
+ return {
+ visible: false,
+ apiObj: null,
+ paramsObj: {},
+ form: {},
+ state_: {
+ 10: "创建中",
+ 14: "已分解",
+ 20: "已下达",
+ 30: "生产中",
+ 40: "已提交",
+ },
+ isSaveing: false,
+ dialogVisible: false,
+ };
+ },
+ mounted() {},
+ methods: {
+ handleMtaskQuery() {
+ this.$refs.drawer_table.queryData(this.paramsObj);
+ },
+ open() {
+ this.visible = true;
+ this.paramsObj.utask = this.utaskId;
+ this.apiObj = this.$API.pm.mtask.list;
+ return this;
+ },
+ table_edit(row) {
+ this.form = Object.assign(row, this.form);
+ this.dialogVisible = true;
+ },
+ updateMtaskSubmit() {
+ this.$refs.dialogForm.validate(async (valid) => {
+ if (valid) {
+ this.isSaveing = true;
+ this.$API.pm.mtask.update
+ .req(this.form.id, this.form)
+ .then((res) => {
+ this.isSaveing = false;
+ this.dialogVisible = false;
+ })
+ .catch((err) => {
+ this.isSaveing = false;
+ });
+ } else {
+ }
+ });
+ },
+ },
+};
+