|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="apply-form">
|
|
|
+ <div class="apply-form" v-loading="loading">
|
|
|
<h3 class="page-title">科德集团</h3>
|
|
|
|
|
|
<h3 class="page-title" style="margin-bottom: 10px;">{{ getDocTile }}</h3>
|
|
|
@@ -18,32 +18,21 @@
|
|
|
<td class="doc-input">
|
|
|
<el-input v-model="formData.xmmc" placeholder="请输入项目名称" />
|
|
|
</td>
|
|
|
- <td class="doc-label">项目申请单位</td>
|
|
|
+ <td class="doc-label">项目编号</td>
|
|
|
<td class="doc-input">
|
|
|
<el-input
|
|
|
- v-model="formData.xmsqdw"
|
|
|
- placeholder="请选择项目申请单位"
|
|
|
+ v-model="formData.xmbh"
|
|
|
+ placeholder="请输入项目编号"
|
|
|
/>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td class="doc-label">项目负责人</td>
|
|
|
- <td class="doc-input">
|
|
|
- <avue-select
|
|
|
- v-model="formData.xmfzr"
|
|
|
- placeholder="请选择"
|
|
|
- :dic="fzrList"
|
|
|
- style="width: 100%"
|
|
|
- ></avue-select>
|
|
|
- </td>
|
|
|
- <td class="doc-label">研究类型</td>
|
|
|
- <td class="doc-input">
|
|
|
- <avue-select
|
|
|
- v-model="formData.yjlx"
|
|
|
- placeholder="请选择"
|
|
|
- :dic="studyTypeList"
|
|
|
- style="width: 100%"
|
|
|
- ></avue-select>
|
|
|
+ <td class="doc-label">项目申请单位</td>
|
|
|
+ <td colspan="3">
|
|
|
+ <el-input
|
|
|
+ v-model="formData.xmsqdw"
|
|
|
+ placeholder="请选择项目申请单位"
|
|
|
+ />
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
@@ -69,6 +58,26 @@
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
+ <td class="doc-label">项目负责人</td>
|
|
|
+ <td class="doc-input">
|
|
|
+ <avue-select
|
|
|
+ v-model="formData.xmfzr"
|
|
|
+ placeholder="请选择"
|
|
|
+ :dic="fzrList"
|
|
|
+ style="width: 100%"
|
|
|
+ ></avue-select>
|
|
|
+ </td>
|
|
|
+ <td class="doc-label">研究类型</td>
|
|
|
+ <td class="doc-input">
|
|
|
+ <avue-select
|
|
|
+ v-model="formData.yjlx"
|
|
|
+ placeholder="请选择"
|
|
|
+ :dic="studyTypeList"
|
|
|
+ style="width: 100%"
|
|
|
+ ></avue-select>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
<td class="doc-label">项目来源</td>
|
|
|
<td class="doc-input">
|
|
|
<avue-select
|
|
|
@@ -113,7 +122,7 @@
|
|
|
<tr>
|
|
|
<td class="doc-label">项目预算总额(万元)</td>
|
|
|
<td class="doc-input">
|
|
|
- {{ budgetAmount }}
|
|
|
+ <el-input-number v-model="formData.xmysze" type="number" :min="0" controls-position="right" />
|
|
|
</td>
|
|
|
<td class="doc-label">其中</td>
|
|
|
<td class="doc-input">
|
|
|
@@ -121,7 +130,7 @@
|
|
|
<div class="year-list-item" v-for="year of yearList" :key="year" :style="{ height: yearList.length == 1 ? '51px' : '32px', lineHeight: yearList.length == 1 ? '51px' : '32px' }">
|
|
|
<div class="year" >{{ year }}</div>
|
|
|
<div class="year-input">
|
|
|
- <input v-model="formData[year]" type="number" />
|
|
|
+ <input v-model="formData[year]" type="number" :class="{ 'red': budgetIsExceed }" @input="handleYearInput" style="padding: 0 6px;" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -130,7 +139,20 @@
|
|
|
</tbody>
|
|
|
</table>
|
|
|
|
|
|
- <avue-form v-model="formData" :option="option" style="margin-top: 30px; padding: 0;"></avue-form>
|
|
|
+ <avue-form v-model="formData" :option="option" style="margin-top: 30px; padding: 0;">
|
|
|
+ <template slot="lxpwLabel">
|
|
|
+ <label>立项批文</label>
|
|
|
+ <el-link type="primary" style="position: absolute; left: 220px; z-index: 1;">下载模板</el-link>
|
|
|
+ </template>
|
|
|
+ <template slot="lxbgLabel">
|
|
|
+ <label>立项报告</label>
|
|
|
+ <el-link type="primary" style="position: absolute; left: 220px; z-index: 1;">下载模板</el-link>
|
|
|
+ </template>
|
|
|
+ <template slot="qtzlLabel">
|
|
|
+ <label>其他资料</label>
|
|
|
+ <el-link type="primary" style="position: absolute; left: 220px; z-index: 1;">下载模板</el-link>
|
|
|
+ </template>
|
|
|
+ </avue-form>
|
|
|
<p class="tip">注:可一次上传多个相关文件(文档、表格、图片等)。 支持格式:DOC, PDF, Excel, PNG, JPG, PPT 等。 请确保文件内容清晰有效。</p>
|
|
|
|
|
|
<div class="btn-wrap" style="text-align: center;">
|
|
|
@@ -142,19 +164,22 @@
|
|
|
<script>
|
|
|
import { getDictionary } from "@/api/system/dictbiz";
|
|
|
import { getList as getTechnicanRosterList } from "@/api/basicResource/technicianRoster";
|
|
|
-import { add, update } from "@/api/projectManage/projectList";
|
|
|
+import { add, update, getDetail } from "@/api/projectManage/projectList";
|
|
|
import moment from "moment";
|
|
|
import { deepClone } from "@/util/util";
|
|
|
|
|
|
export default {
|
|
|
+ props: {
|
|
|
+ projectId: [String, Number]
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ loading: false,
|
|
|
formData: {},
|
|
|
|
|
|
- // 项目预算总额
|
|
|
- budgetAmount: 0,
|
|
|
-
|
|
|
yearList: [],
|
|
|
+ // 预算是否超出
|
|
|
+ budgetIsExceed: false,
|
|
|
|
|
|
// 项目负责人列表
|
|
|
fzrList: [],
|
|
|
@@ -241,6 +266,9 @@ export default {
|
|
|
},
|
|
|
'formData.xmjssj'(newVal) {
|
|
|
this.yearList = this.getDateRangeYear(this.formData.xmkssj, newVal);
|
|
|
+ },
|
|
|
+ 'formData.xmysze'(newVal) {
|
|
|
+ this.calcBudgetIsExceed(newVal);
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -273,8 +301,36 @@ export default {
|
|
|
this.getDictList("implementation_format", "implementFormatList");
|
|
|
this.getDictList("expected_outcome_form", "expectedOutComeFormList");
|
|
|
this.getDictList("economic_objectives", "economicObjectivesList");
|
|
|
+ if (this.projectId) {
|
|
|
+ this.getProjectDetail(this.projectId);
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
+ getProjectDetail(xmId) {
|
|
|
+ this.loading = true;
|
|
|
+ getDetail({ id: xmId }).then(({ data }) => {
|
|
|
+ this.loading = false;
|
|
|
+ console.log(data)
|
|
|
+ if (data.code == 200) {
|
|
|
+ let beanData = { ...data.data };
|
|
|
+ console.log(beanData)
|
|
|
+ beanData.xmfzr = String(beanData.xmfzr || '');
|
|
|
+ beanData.yqcgxs = beanData.yqcgxs.split(",");
|
|
|
+ beanData.xmjsjjmb = beanData.xmjsjjmb.split(",");
|
|
|
+ beanData.lxpw = beanData.lxpw ? JSON.parse(beanData.lxpw) : [];
|
|
|
+ beanData.lxbg = beanData.lxbg ? JSON.parse(beanData.lxbg) : [];
|
|
|
+ beanData.qtzl = beanData.qtzl ? JSON.parse(beanData.qtzl) : [];
|
|
|
+ beanData.xmyszemx = beanData.xmyszemx ? JSON.parse(beanData.xmyszemx) : [];
|
|
|
+ beanData.xmyszemx.forEach(item => {
|
|
|
+ beanData[item.year] = item.amount;
|
|
|
+ });
|
|
|
+ console.log(beanData)
|
|
|
+ this.formData = { ...beanData };
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
getDateRangeYear(sDate, eDate) {
|
|
|
let yearArr = [];
|
|
|
if (sDate && eDate) {
|
|
|
@@ -295,6 +351,28 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ handleYearInput(e) {
|
|
|
+ this.calcBudgetIsExceed(this.formData.xmysze);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 计算是否超出预算
|
|
|
+ * @param total 预算总额
|
|
|
+ */
|
|
|
+ calcBudgetIsExceed(total) {
|
|
|
+ let yearTotal = 0;
|
|
|
+ let projectBudget = Number(total || 0);
|
|
|
+
|
|
|
+ this.yearList.forEach(year => {
|
|
|
+ let num = Number(this.formData[year] || 0);
|
|
|
+ yearTotal += num;
|
|
|
+ });
|
|
|
+
|
|
|
+ if (yearTotal > projectBudget) {
|
|
|
+ this.budgetIsExceed = true;
|
|
|
+ } else {
|
|
|
+ this.budgetIsExceed = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 获取人员花名册
|
|
|
*/
|
|
|
@@ -308,18 +386,23 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
validForm() {
|
|
|
- console.log(!this.formData.lxpw)
|
|
|
let errorText = '';
|
|
|
if (!this.formData.xmmc) {
|
|
|
errorText = '请输入项目名称';
|
|
|
} else if (/技改|技术改造|推广|打样|翻新|产业化|生产线|改造|年产|示范/g.test(this.formData.xmmc)) {
|
|
|
errorText = '研发项目名称,不符合统计部门的命名要求';
|
|
|
+ } else if (!this.formData.xmbh) {
|
|
|
+ errorText = '请输入项目编号'
|
|
|
+ } else if (!this.formData.yjlx) {
|
|
|
+ errorText = '请选择研究类型'
|
|
|
} else if (!this.formData.xmfzr) {
|
|
|
errorText = '请选择项目负责人';
|
|
|
} else if (!this.formData.xmkssj) {
|
|
|
errorText = '请选择项目开始时间';
|
|
|
} else if (!this.formData.xmjssj) {
|
|
|
errorText = '请选择项目结束时间';
|
|
|
+ } else if (!this.formData.xmysze) {
|
|
|
+ errorText = '请输入项目预算总额';
|
|
|
} else if (!this.formData.lxpw.length) {
|
|
|
errorText = '请上传立项批文!';
|
|
|
} else if (!this.formData.lxbg.length) {
|
|
|
@@ -347,23 +430,32 @@ export default {
|
|
|
let params = deepClone(this.formData);
|
|
|
params.yqcgxs = params.yqcgxs ? params.yqcgxs.join(',') : '';
|
|
|
params.xmjsjjmb = params.xmjsjjmb ? params.xmjsjjmb.join(',') : '';
|
|
|
- params.lxbg = params.lxbg ? params.lxbg.map(item => item.value).join(',') : '';
|
|
|
- params.lxpw = params.lxpw ? params.lxpw.map(item => item.value).join(',') : '';
|
|
|
- params.qtzl = params.qtzl ? params.qtzl.map(item => item.value).join(',') : '';
|
|
|
+ params.lxbg = JSON.stringify(params.lxbg);
|
|
|
+ params.lxpw = JSON.stringify(params.lxpw);
|
|
|
+ params.qtzl = JSON.stringify(params.qtzl);
|
|
|
let yearAmountList = [];
|
|
|
this.yearList.forEach(year => {
|
|
|
yearAmountList.push({ year: Number(year), amount: params[year] || 0 });
|
|
|
delete params[year];
|
|
|
});
|
|
|
- params.yearAmountList = yearAmountList;
|
|
|
+ params.xmyszemx = JSON.stringify(yearAmountList);
|
|
|
|
|
|
- console.log(params)
|
|
|
- // this.addOrUpdate(params);
|
|
|
+ this.addOrUpdate(params);
|
|
|
},
|
|
|
addOrUpdate(params) {
|
|
|
let func = params.id ? update : add;
|
|
|
- add(params).then(res => {
|
|
|
-
|
|
|
+ this.loading = true;
|
|
|
+ func(params).then(({ data }) => {
|
|
|
+ this.loading = false;
|
|
|
+ if (data.code == 200) {
|
|
|
+ if (!params.id) {
|
|
|
+ this.$emit('success', data.data);
|
|
|
+ this.formData.id = data.data.xmId;
|
|
|
+ }
|
|
|
+ this.$message.success(params.id ? '修改成功!' : '保存成功!');
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.loading = false;
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
@@ -432,6 +524,10 @@ tr td {
|
|
|
|
|
|
}
|
|
|
|
|
|
+.red {
|
|
|
+ color: red;
|
|
|
+}
|
|
|
+
|
|
|
.tip {
|
|
|
position: relative;
|
|
|
top: 0;
|