|
|
@@ -6,31 +6,14 @@
|
|
|
<tr>
|
|
|
<td class="doc-label">研发项目名称</td>
|
|
|
<td class="doc-input">
|
|
|
- <el-select
|
|
|
- v-model="formData.xmId"
|
|
|
- filterable
|
|
|
- remote
|
|
|
- reserve-keyword
|
|
|
- placeholder="请输入关键词"
|
|
|
- :remote-method="remoteMethod"
|
|
|
- :loading="loading"
|
|
|
- style="width: 100%;"
|
|
|
- @change="handleProjectChange"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in projectList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.xmmc"
|
|
|
- :value="item.id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ <project-select v-model="currProjectId" @change="handleProjectChange" :disabled="disabled"></project-select>
|
|
|
</td>
|
|
|
<td class="doc-label">研发项目编号</td>
|
|
|
<td class="doc-input">{{ selProject.xmbh }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="doc-label">项目负责人</td>
|
|
|
- <td class="doc-input">{{ selProject.xmfzr }} </td>
|
|
|
+ <td class="doc-input">{{ selProject.xmfzrxm }} </td>
|
|
|
<td class="doc-label">项目申请单位</td>
|
|
|
<td class="doc-input">{{ selProject.xmsqdw }}</td>
|
|
|
</tr>
|
|
|
@@ -43,16 +26,17 @@
|
|
|
placeholder="请选择"
|
|
|
:dic="changeTypeList"
|
|
|
style="width: 100%"
|
|
|
+ :disabled="disabled"
|
|
|
></avue-select>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<td class="doc-label">变更前</td>
|
|
|
- <td class="doc-input">{{ selProject[formData.zdmc] }}</td>
|
|
|
+ <td class="doc-input">{{ selProject[formData.zdmc == 'xmfzr' ? 'xmfzrxm' : formData.zdmc] }}</td>
|
|
|
<td class="doc-label">变更后</td>
|
|
|
<td class="doc-input">
|
|
|
- <el-input v-if="formData.zdmc === 'xmmc'" placeholder="请输入项目名称" v-model="formData.bghdz" />
|
|
|
+ <el-input v-if="formData.zdmc === 'xmmc'" placeholder="请输入项目名称" v-model="formData.bghdz" :disabled="disabled" />
|
|
|
<el-date-picker
|
|
|
v-if="'xmkssj,xmjssj'.indexOf(formData.zdmc) > -1"
|
|
|
v-model="formData.bghdz"
|
|
|
@@ -60,14 +44,23 @@
|
|
|
value-format="yyyy-MM-dd"
|
|
|
placeholder="请选择日期"
|
|
|
style="width: 100%"
|
|
|
+ :disabled="disabled"
|
|
|
></el-date-picker>
|
|
|
+ <avue-select
|
|
|
+ v-if="formData.zdmc === 'xmfzr'"
|
|
|
+ v-model="formData.bghdz"
|
|
|
+ placeholder="请选择"
|
|
|
+ :dic="fzrList"
|
|
|
+ style="width: 100%"
|
|
|
+ :disabled="disabled"
|
|
|
+ ></avue-select>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<td class="doc-label">变更原因说明</td>
|
|
|
<td class="doc-input" colspan="3">
|
|
|
- <el-input v-model="formData.bgyy" type="textarea" :rows="3" />
|
|
|
+ <el-input v-model="formData.bgyy" type="textarea" :rows="3" :disabled="disabled" />
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
@@ -75,11 +68,12 @@
|
|
|
<td class="doc-label">变更生效时间</td>
|
|
|
<td class="doc-input" colspan="3">
|
|
|
<el-date-picker
|
|
|
- v-model="formData.bzsxssj"
|
|
|
+ v-model="formData.bgsxsj"
|
|
|
format="yyyy年MM月dd日"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
placeholder="请选择日期"
|
|
|
style="width: 100%"
|
|
|
+ :disabled="disabled"
|
|
|
></el-date-picker>
|
|
|
</td>
|
|
|
</tr>
|
|
|
@@ -89,22 +83,24 @@
|
|
|
<td class="doc-input" colspan="3" style="text-align: left;">
|
|
|
<avue-upload
|
|
|
action="/api/kd-resource/oss/endpoint/put-file"
|
|
|
+ dataType="object"
|
|
|
:props-http="{
|
|
|
url: 'link',
|
|
|
- name: 'name',
|
|
|
+ name: 'originalName',
|
|
|
res: 'data',
|
|
|
}"
|
|
|
type="upload"
|
|
|
v-model="formData.attachment"
|
|
|
style="margin: 14px 0 14px 12px;"
|
|
|
+ :disabled="disabled"
|
|
|
></avue-upload>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
|
|
|
- <div class="btn-wrap" style="text-align: center; margin-top: 30px;">
|
|
|
- <el-button style="width: 160px;" @click="handleSaveBtn">重置</el-button>
|
|
|
+ <div v-if="!disabled" class="btn-wrap" style="text-align: center; margin-top: 30px;">
|
|
|
+ <el-button style="width: 160px;" @click="handleResetBtn">重置</el-button>
|
|
|
<el-button type="primary" style="width: 160px;" @click="handleSaveBtn">保存</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -112,29 +108,67 @@
|
|
|
|
|
|
<script>
|
|
|
import { getDictionary } from "@/api/system/dictbiz";
|
|
|
-import { getList as getProjectList } from "@/api/projectManage/projectList";
|
|
|
-import { add } from "@/api/projectManage/change";
|
|
|
+import { getList as getTechnicanRosterList } from "@/api/basicResource/technicianRoster";
|
|
|
+import { save } from "@/api/projectManage/change";
|
|
|
import moment from "moment";
|
|
|
+import projectSelect from "@/components/project-select";
|
|
|
|
|
|
export default {
|
|
|
props: {
|
|
|
- xmId: [String, Number]
|
|
|
+ projectId: [String, Number],
|
|
|
+ data: Object,
|
|
|
+ disabled: {
|
|
|
+ type: Boolean,
|
|
|
+ type: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ projectSelect
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ currProjectId: '',
|
|
|
formData: {},
|
|
|
-
|
|
|
changeTypeList: [],
|
|
|
-
|
|
|
loading: false,
|
|
|
- projectList: [],
|
|
|
selProject: {},
|
|
|
+
|
|
|
+ fzrList: [],
|
|
|
};
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ "formData.zdmc"(newVal) {
|
|
|
+ if (newVal == 'xmfzr') {
|
|
|
+ this.getTechnicanRosterListFunc(moment(this.selProject.xmkssj).format('yyyyMM'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.getDictList("xm_biangeng_field", "changeTypeList");
|
|
|
+ this.currProjectId = this.projectId;
|
|
|
+
|
|
|
+ if (this.data && Object.keys(this.data)) {
|
|
|
+ this.formData = {
|
|
|
+ ...this.data,
|
|
|
+ };
|
|
|
+ let attachment = this.formData.attachment;
|
|
|
+
|
|
|
+ this.formData.attachment = JSON.parse(attachment)
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ * 获取人员花名册
|
|
|
+ */
|
|
|
+ getTechnicanRosterListFunc(yearAndMonth) {
|
|
|
+ getTechnicanRosterList(1, 99999, { yearAndMonth }).then(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ this.fzrList = res.data.data.records.map(item => {
|
|
|
+ return { label: item.name, value: item.id };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
getDictList(code, toListKey) {
|
|
|
getDictionary({ code }).then((res) => {
|
|
|
this[toListKey] = res.data.data.map((item) => {
|
|
|
@@ -142,34 +176,18 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- remoteMethod(query) {
|
|
|
- if (query !== '') {
|
|
|
- this.loading = true;
|
|
|
- setTimeout(() => {
|
|
|
- this.loading = false;
|
|
|
- getProjectList(1, 99999, { xmmc: query }).then(({ data }) => {
|
|
|
- if (data.success) {
|
|
|
- this.projectList = data.data.records;
|
|
|
- }
|
|
|
- })
|
|
|
- }, 200);
|
|
|
- } else {
|
|
|
- this.projectList = [];
|
|
|
- }
|
|
|
- },
|
|
|
- handleProjectChange(val) {
|
|
|
- let currPro = this.projectList.find(item => item.id === val);
|
|
|
- this.selProject = currPro;
|
|
|
+ handleProjectChange(data) {
|
|
|
+ this.selProject = data;
|
|
|
},
|
|
|
validForm() {
|
|
|
let errorText = '';
|
|
|
- if (!this.formData.xmId) {
|
|
|
+ if (!this.currProjectId) {
|
|
|
errorText = '请选择变更的项目';
|
|
|
} else if (!this.formData.zdmc) {
|
|
|
errorText = '请选择变更类型';
|
|
|
} else if (!this.formData.bgyy) {
|
|
|
errorText = '请输入变更原因';
|
|
|
- } else if (!this.formData.bzsxssj) {
|
|
|
+ } else if (!this.formData.bgsxsj) {
|
|
|
errorText = '请选择变更生效时间';
|
|
|
} else if (!this.formData.bghdz) {
|
|
|
errorText = '请输入变更后的信息';
|
|
|
@@ -177,6 +195,9 @@ export default {
|
|
|
|
|
|
return errorText;
|
|
|
},
|
|
|
+ handleResetBtn() {
|
|
|
+ this.formData = {};
|
|
|
+ },
|
|
|
handleSaveBtn() {
|
|
|
let errorText = this.validForm();
|
|
|
if (errorText) {
|
|
|
@@ -184,10 +205,22 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- this.addOrUpdate(params);
|
|
|
+ const params = {
|
|
|
+ ...this.formData,
|
|
|
+ bgqdz: this.selProject[this.formData.zdmc],
|
|
|
+ attachment: JSON.stringify(this.formData.attachment),
|
|
|
+ xmId: this.currProjectId
|
|
|
+ };
|
|
|
+
|
|
|
+ this.saveData(params);
|
|
|
},
|
|
|
- addOrUpdate(params) {
|
|
|
- console.log(params)
|
|
|
+ saveData(params) {
|
|
|
+ save(params).then(({ data }) => {
|
|
|
+ if (data.code == 200) {
|
|
|
+ this.$message.success("保存成功!");
|
|
|
+ this.$emit("success");
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
};
|