|
@@ -35,13 +35,13 @@
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
<uni-forms-item label="子类">
|
|
<uni-forms-item label="子类">
|
|
<ld-select
|
|
<ld-select
|
|
- :list="currentType.children"
|
|
|
|
|
|
+ :list="subTypeList"
|
|
placeholder="请选择子类"
|
|
placeholder="请选择子类"
|
|
class="select"
|
|
class="select"
|
|
v-model="formData.subTypeId"
|
|
v-model="formData.subTypeId"
|
|
labelKey="name"
|
|
labelKey="name"
|
|
valueKey="id"
|
|
valueKey="id"
|
|
- :disabled="currentType.id == 2 || currentType.id == 35"
|
|
|
|
|
|
+ :disabled="currentType.id == 2"
|
|
@change="onChangeSubType"
|
|
@change="onChangeSubType"
|
|
/>
|
|
/>
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
@@ -58,7 +58,7 @@
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import comboxSearch from "@/components/cuihai-combox/cuihai-combox";
|
|
import comboxSearch from "@/components/cuihai-combox/cuihai-combox";
|
|
-import { addWorkHours, queryProject } from "@/services/workload";
|
|
|
|
|
|
+import { addWorkHours, queryProject, queryWorkType } from "@/services/workload";
|
|
import { mapState } from "vuex";
|
|
import { mapState } from "vuex";
|
|
export default {
|
|
export default {
|
|
components: { comboxSearch },
|
|
components: { comboxSearch },
|
|
@@ -84,6 +84,7 @@ export default {
|
|
currentType: {},
|
|
currentType: {},
|
|
currentSubType: {},
|
|
currentSubType: {},
|
|
project: [],
|
|
project: [],
|
|
|
|
+ subTypeList: [],
|
|
day: "",
|
|
day: "",
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -96,6 +97,11 @@ export default {
|
|
data = await queryProject({ stage: value });
|
|
data = await queryProject({ stage: value });
|
|
this.project = data;
|
|
this.project = data;
|
|
},
|
|
},
|
|
|
|
+ async getSubType(params) {
|
|
|
|
+ let res = {};
|
|
|
|
+ res = await queryWorkType(params);
|
|
|
|
+ this.subTypeList = res.data;
|
|
|
|
+ },
|
|
async submit() {
|
|
async submit() {
|
|
let type = this.currentType;
|
|
let type = this.currentType;
|
|
let subType = this.currentSubType;
|
|
let subType = this.currentSubType;
|
|
@@ -131,47 +137,48 @@ export default {
|
|
close() {
|
|
close() {
|
|
uni.navigateBack();
|
|
uni.navigateBack();
|
|
},
|
|
},
|
|
- onChangeType(value) {
|
|
|
|
|
|
+ async onChangeType(value) {
|
|
let item = this.typeList.find((t) => t.id == value);
|
|
let item = this.typeList.find((t) => t.id == value);
|
|
|
|
+ this.formData = {
|
|
|
|
+ typeId: value,
|
|
|
|
+ projectId: null,
|
|
|
|
+ subTypeId: null,
|
|
|
|
+ };
|
|
|
|
+ this.currentType = item;
|
|
|
|
+ this.currentSubType = {};
|
|
|
|
+ this.projectName = "";
|
|
if (!item.type) {
|
|
if (!item.type) {
|
|
this.getProject(value);
|
|
this.getProject(value);
|
|
- }
|
|
|
|
- this.projectName = "";
|
|
|
|
- if (value == 33 || value == 35) {
|
|
|
|
- this.formData = {
|
|
|
|
- typeId: value,
|
|
|
|
- projectId: null,
|
|
|
|
- subTypeId: item.children[0].id,
|
|
|
|
- };
|
|
|
|
- this.currentType = item;
|
|
|
|
- this.onChangeSubType(item.children[0].id);
|
|
|
|
} else {
|
|
} else {
|
|
- this.formData = {
|
|
|
|
- typeId: value,
|
|
|
|
- projectId: null,
|
|
|
|
- subTypeId: null,
|
|
|
|
- };
|
|
|
|
- this.currentType = item;
|
|
|
|
- this.currentSubType = {};
|
|
|
|
|
|
+ await this.getSubType({ parent_id: item.id });
|
|
|
|
+ if (value == 33) {
|
|
|
|
+ this.onChangeSubType(this.subTypeList[0].id);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- onChangeProject(index) {
|
|
|
|
|
|
+ async onChangeProject(index) {
|
|
let project = this.projectList[index];
|
|
let project = this.projectList[index];
|
|
this.formData.projectId = project.ID;
|
|
this.formData.projectId = project.ID;
|
|
this.projectName = project.fullName;
|
|
this.projectName = project.fullName;
|
|
|
|
+ await this.getSubType({
|
|
|
|
+ parent_id: this.currentType.id,
|
|
|
|
+ project_id: project.ID,
|
|
|
|
+ });
|
|
|
|
+ if (this.currentType.id == 35) {
|
|
|
|
+ this.onChangeSubType(this.subTypeList[0].id);
|
|
|
|
+ }
|
|
if (this.currentType.id == 2) {
|
|
if (this.currentType.id == 2) {
|
|
- let subList = this.currentType.children;
|
|
|
|
if (index == 0) {
|
|
if (index == 0) {
|
|
- this.onChangeSubType(subList[0].id);
|
|
|
|
|
|
+ this.onChangeSubType(this.subTypeList[0].id);
|
|
} else {
|
|
} else {
|
|
- this.onChangeSubType(subList[1].id);
|
|
|
|
|
|
+ this.onChangeSubType(this.subTypeList[1].id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onChangeSubType(value) {
|
|
onChangeSubType(value) {
|
|
this.formData.subTypeId = value;
|
|
this.formData.subTypeId = value;
|
|
this.currentSubType =
|
|
this.currentSubType =
|
|
- this.currentType.children.find((item) => item.id == value) || {};
|
|
|
|
|
|
+ this.subTypeList.find((item) => item.id == value) || {};
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|