|
@@ -1,15 +1,71 @@
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
<view class="title"> 新增项目 </view>
|
|
|
- <view class="list"> </view>
|
|
|
-
|
|
|
+ <uni-forms :modelValue="formData" label-position="left" class="form">
|
|
|
+ <uni-forms-item label="项目名称">
|
|
|
+ <uni-easyinput
|
|
|
+ type="text"
|
|
|
+ v-model="formData.project_name"
|
|
|
+ class="input"
|
|
|
+ />
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="项目类别">
|
|
|
+ <picker
|
|
|
+ @change="selectChangeType"
|
|
|
+ :range="typeList"
|
|
|
+ :range-key="'name'"
|
|
|
+ >
|
|
|
+ <view class="select">
|
|
|
+ {{
|
|
|
+ formData.type_id &&
|
|
|
+ typeList.find((item) => item.id == formData.type_id).name
|
|
|
+ }}
|
|
|
+ </view>
|
|
|
+ </picker>
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="流程">
|
|
|
+ <picker disabled>
|
|
|
+ <view class="select">
|
|
|
+ {{
|
|
|
+ formData.type_id &&
|
|
|
+ (formData.type_id == 7 ? "研发立项" : "销售立项")
|
|
|
+ }}
|
|
|
+ </view>
|
|
|
+ </picker>
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="行业名称" v-show="formData.type_id != 7">
|
|
|
+ <picker
|
|
|
+ @change="selectChangeIndustry"
|
|
|
+ :range="industryList"
|
|
|
+ :range-key="'name'"
|
|
|
+ >
|
|
|
+ <view class="select">
|
|
|
+ {{
|
|
|
+ formData.industry_id &&
|
|
|
+ industryList.find((item) => item.id == formData.industry_id).name
|
|
|
+ }}
|
|
|
+ </view>
|
|
|
+ </picker>
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="项目地区" v-show="formData.type_id != 7">
|
|
|
+ <picker> <view class="select"></view></picker>
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="项目简称" v-show="formData.type_id != 7">
|
|
|
+ <uni-easyinput type="text" v-model="formData.name" class="input" />
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="项目期数" v-show="formData.type_id != 7">
|
|
|
+ <picker @change="selectChangeVersion" :range="versionList">
|
|
|
+ <view class="select">
|
|
|
+ {{ versionList[this.formData.version - 1] }}
|
|
|
+ </view>
|
|
|
+ </picker>
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="项目编号" v-show="formData.type_id != 7">
|
|
|
+ </uni-forms-item>
|
|
|
+ </uni-forms>
|
|
|
<view class="group">
|
|
|
<button @click="onHandleSubmit(0)" class="commit">取消</button>
|
|
|
- <button
|
|
|
- @click="onHandleSubmit(1)"
|
|
|
- type="primary"
|
|
|
- class="commit"
|
|
|
- >
|
|
|
+ <button @click="onHandleSubmit(1)" type="primary" class="commit">
|
|
|
确定
|
|
|
</button>
|
|
|
</view>
|
|
@@ -17,24 +73,73 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { queryProjectType, queryIndustry } from "@/services/project";
|
|
|
import { mapState } from "vuex";
|
|
|
+const versionList = ["一期", "二期", "三期", "四期", "五期"];
|
|
|
export default {
|
|
|
data() {
|
|
|
- return { project_id: 0 };
|
|
|
+ return {
|
|
|
+ formData: {
|
|
|
+ project_name: null,
|
|
|
+ type_id: null,
|
|
|
+ flow_id: null,
|
|
|
+ industry_id: null,
|
|
|
+ location: null,
|
|
|
+ name: null,
|
|
|
+ version: null,
|
|
|
+ code: null,
|
|
|
+ },
|
|
|
+ project_id: 0,
|
|
|
+
|
|
|
+ typeList: [],
|
|
|
+ industryList: [],
|
|
|
+ versionList,
|
|
|
+ };
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(["currentProject"]),
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
this.project_id = options.project_id;
|
|
|
+ this.init(options);
|
|
|
},
|
|
|
methods: {
|
|
|
onHandleSubmit(value) {
|
|
|
- if (value) console.log("提交成功");
|
|
|
+ if (value) console.log(this.formData);
|
|
|
uni.navigateTo({
|
|
|
url: "./list",
|
|
|
});
|
|
|
},
|
|
|
+ async init(options) {
|
|
|
+ if (options.project_id) {
|
|
|
+ this.formData.project_name = this.currentProject.project_name;
|
|
|
+ this.formData.type_id = this.currentProject.type_id;
|
|
|
+ this.formData.flow_id = this.currentProject.flow_id;
|
|
|
+ if (this.currentProject.type_id != 7) {
|
|
|
+ this.formData.industry_id = this.currentProject.industry_id;
|
|
|
+ this.formData.location = this.currentProject.location;
|
|
|
+ this.formData.name = this.currentProject.name;
|
|
|
+ this.formData.code = this.currentProject.project_full_code;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let res;
|
|
|
+ res = await queryProjectType();
|
|
|
+ this.typeList = res.data;
|
|
|
+ res = await queryIndustry();
|
|
|
+ this.industryList = res.data;
|
|
|
+ },
|
|
|
+ selectChangeType(e) {
|
|
|
+ let item = this.typeList[e.target.value];
|
|
|
+ this.formData.type_id = item.id;
|
|
|
+ item.id == 7 ? (this.formData.flow_id = 1) : (this.formData.flow_id = 4);
|
|
|
+ },
|
|
|
+ selectChangeIndustry(e) {
|
|
|
+ let item = this.industryList[e.target.value];
|
|
|
+ this.formData.industry_id = item.id;
|
|
|
+ },
|
|
|
+ selectChangeVersion(e) {
|
|
|
+ this.formData.version = e.target.value + 1;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -50,24 +155,20 @@ export default {
|
|
|
background: #f8f8f8;
|
|
|
font: 24px bold;
|
|
|
}
|
|
|
-.list {
|
|
|
- margin-left: 10%;
|
|
|
+.form {
|
|
|
+ margin: 20px 10% 0 10%;
|
|
|
width: 100%;
|
|
|
}
|
|
|
-.detail {
|
|
|
+.input {
|
|
|
+ border: 1px solid #666;
|
|
|
+}
|
|
|
+.select {
|
|
|
width: 100%;
|
|
|
- padding: 15px 0;
|
|
|
- font-size: 18px;
|
|
|
- display: flex;
|
|
|
- justify-items: space-between;
|
|
|
- .subTitle {
|
|
|
- width: 30%;
|
|
|
- }
|
|
|
- .detailContent {
|
|
|
- width: 70%;
|
|
|
- }
|
|
|
+ height: 72rpx;
|
|
|
+ line-height: 70rpx;
|
|
|
+ border: 1px solid #666;
|
|
|
+ padding-left: 20rpx;
|
|
|
}
|
|
|
-
|
|
|
.group {
|
|
|
width: 100%;
|
|
|
display: flex;
|