|
@@ -3,7 +3,7 @@
|
|
|
<div style="margin-top: 6px;">
|
|
<div style="margin-top: 6px;">
|
|
|
<el-form :inline="true">
|
|
<el-form :inline="true">
|
|
|
<el-form-item label="研发项目名称">
|
|
<el-form-item label="研发项目名称">
|
|
|
- <project-select v-model="currProjectId" @change="handleProjectChange"></project-select>
|
|
|
|
|
|
|
+ <project-select v-model="params.xmId" @change="handleProjectChange"></project-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="研发项目编号">
|
|
<el-form-item label="研发项目编号">
|
|
|
{{ selProject.xmbh }}
|
|
{{ selProject.xmbh }}
|
|
@@ -50,6 +50,10 @@
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<print-table-btn @click="printTable" />
|
|
<print-table-btn @click="printTable" />
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+
|
|
|
|
|
+ <template slot="zcbm" slot-scope="scope">
|
|
|
|
|
+ <span>{{ scope.row.zcmc }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
|
|
|
</avue-crud>
|
|
</avue-crud>
|
|
|
|
|
|
|
@@ -72,6 +76,8 @@ import UploadExcelDialog from "@/components/upload-excel-dialog";
|
|
|
import projectSelect from "@/components/project-select";
|
|
import projectSelect from "@/components/project-select";
|
|
|
import {getToken} from "@/util/auth";
|
|
import {getToken} from "@/util/auth";
|
|
|
import {downloadXls} from "@/util/util";
|
|
import {downloadXls} from "@/util/util";
|
|
|
|
|
+import moment from "moment";
|
|
|
|
|
+import Decimal from "decimal.js";
|
|
|
|
|
|
|
|
|
|
|
|
|
export default window.$crudCommon({
|
|
export default window.$crudCommon({
|
|
@@ -84,27 +90,28 @@ export default window.$crudCommon({
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- currProjectId: '',
|
|
|
|
|
|
|
+ params: {
|
|
|
|
|
+ xmId: ''
|
|
|
|
|
+ },
|
|
|
selProject: {},
|
|
selProject: {},
|
|
|
|
|
|
|
|
wideTableColumns: [],
|
|
wideTableColumns: [],
|
|
|
printTitle: "",
|
|
printTitle: "",
|
|
|
|
|
+
|
|
|
|
|
+ currZcObj: {},
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
- this.currProjectId = this.projectId;
|
|
|
|
|
|
|
+ this.params.xmId = this.projectId;
|
|
|
this.option.height = window.innerHeight - 340;
|
|
this.option.height = window.innerHeight - 340;
|
|
|
|
|
|
|
|
let newOption = { ...this.option };
|
|
let newOption = { ...this.option };
|
|
|
// 姓名下拉框,设置监听事件
|
|
// 姓名下拉框,设置监听事件
|
|
|
newOption.column.forEach(item => {
|
|
newOption.column.forEach(item => {
|
|
|
- if (item.prop == "zcmc") {
|
|
|
|
|
|
|
+ if (item.prop == "zcbm") {
|
|
|
item.change = ({ item }) => {
|
|
item.change = ({ item }) => {
|
|
|
if (!!item) {
|
|
if (!!item) {
|
|
|
- this.form = {
|
|
|
|
|
- ...this.form,
|
|
|
|
|
- ytxe: item.zcyz,
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ this.currZcObj = item;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -112,18 +119,67 @@ export default window.$crudCommon({
|
|
|
this.option = { ...newOption };
|
|
this.option = { ...newOption };
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- handleProjectChange(data) {
|
|
|
|
|
- this.selProject = data;
|
|
|
|
|
|
|
+ validCustom() {
|
|
|
|
|
+ const { sysm, ysysm } = this.currZcObj;
|
|
|
|
|
+ const { xmkssj, xmjssj } = this.selProject
|
|
|
|
|
+ let sm = sysm - ysysm;
|
|
|
|
|
+ if (this.form.zzsc > sm) {
|
|
|
|
|
+ this.$message.warning(`设备剩余寿命为${sm}月,在项目的工作时长不能大于设备寿命!`);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (xmkssj && xmjssj) {
|
|
|
|
|
+ let monthDiff = moment(xmjssj).diff(moment(xmkssj), 'months', true).toFixed(0);
|
|
|
|
|
+ if (this.form.zzsc > monthDiff) {
|
|
|
|
|
+ this.$message.warning(`项目周期为${monthDiff}月,在项目的工作时长不能大于项目周期!`);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ },
|
|
|
|
|
+ addBefore(loading, callback) {
|
|
|
|
|
+ if (!this.validCustom()) {
|
|
|
|
|
+ loading();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ callback && callback();
|
|
|
|
|
+ },
|
|
|
|
|
+ updateBefore(loading, callback) {
|
|
|
|
|
+ if (!this.validCustom()) {
|
|
|
|
|
+ loading();
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ callback && callback();
|
|
|
},
|
|
},
|
|
|
handleBeforeOpen(done) {
|
|
handleBeforeOpen(done) {
|
|
|
- this.option.column.forEach(item => {
|
|
|
|
|
- if (item.prop == "zcmc") {
|
|
|
|
|
- item.dicUrl = '/api/kd-scientific/zc/page';
|
|
|
|
|
- item.dicQuery.yearAndMonth = '202507';
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (!this.params.xmId) {
|
|
|
|
|
+ this.$message.warning("请选择项目!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.currZcObj = {};
|
|
|
|
|
+ // this.option.column.forEach(item => {
|
|
|
|
|
+ // let yearAndMonth = this.selProject.xmkssj || new Date();
|
|
|
|
|
+ // if (item.prop == "zcbm") {
|
|
|
|
|
+ // item.dicUrl = '/api/kd-scientific/zc/simple/list';
|
|
|
|
|
+ // item.dicQuery.yearAndMonth = moment(yearAndMonth).format("yyyyMM");
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
done();
|
|
done();
|
|
|
},
|
|
},
|
|
|
|
|
+ getList() {
|
|
|
|
|
+ if (!this.params.xmId) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.loadData();
|
|
|
|
|
+ },
|
|
|
|
|
+ getFormData() {
|
|
|
|
|
+ return { ...this.form, xmId: this.params.xmId }
|
|
|
|
|
+ },
|
|
|
|
|
+ handleProjectChange(data) {
|
|
|
|
|
+ this.selProject = data;
|
|
|
|
|
+ this.page.currentPage = 1;
|
|
|
|
|
+ this.getList(this.page);
|
|
|
|
|
+ },
|
|
|
handleImport() {
|
|
handleImport() {
|
|
|
this.$refs.uploadExcelDialog.open('/api/kd-scientific/ys-wxzctxfy/import');
|
|
this.$refs.uploadExcelDialog.open('/api/kd-scientific/ys-wxzctxfy/import');
|
|
|
},
|
|
},
|
|
@@ -133,7 +189,7 @@ export default window.$crudCommon({
|
|
|
},
|
|
},
|
|
|
handleExport() {
|
|
handleExport() {
|
|
|
exportBloByPost(`/api/kd-scientific/ys-wxzctxfy/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
exportBloByPost(`/api/kd-scientific/ys-wxzctxfy/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
- downloadXls(res.data, `无形资产摊销费用.xlsx`);
|
|
|
|
|
|
|
+ downloadXls(res.data, `${this.selProject.xmmc}无形资产摊销费用.xlsx`);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
@@ -142,7 +198,7 @@ export default window.$crudCommon({
|
|
|
*/
|
|
*/
|
|
|
printTable(isLandscape) {
|
|
printTable(isLandscape) {
|
|
|
this.wideTableColumns = this.$refs.crud.columnOption;
|
|
this.wideTableColumns = this.$refs.crud.columnOption;
|
|
|
- this.printTitle = `无形资产摊销费用`;
|
|
|
|
|
|
|
+ this.printTitle = `${this.selProject.xmmc}无形资产摊销费用`;
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
this.$refs.printWideTable.printTable(isLandscape);
|
|
this.$refs.printWideTable.printTable(isLandscape);
|
|
|
})
|
|
})
|
|
@@ -152,6 +208,16 @@ export default window.$crudCommon({
|
|
|
// 模块路径
|
|
// 模块路径
|
|
|
name: 'projectManage/wxzctxCost',
|
|
name: 'projectManage/wxzctxCost',
|
|
|
res: ({ data }) => {
|
|
res: ({ data }) => {
|
|
|
|
|
+ data.records = data.records.map(item => {
|
|
|
|
|
+ item.zcmc = item.zcEntity ? item.zcEntity.zcmc : '';
|
|
|
|
|
+ item.zcbm = item.zcEntity ? item.zcEntity.zcbm : '';
|
|
|
|
|
+ item.ytxe = (item.zcEntity ? item.zcEntity.ytxe : 0).toFixed(2);
|
|
|
|
|
+
|
|
|
|
|
+ let zzscD = new Decimal(item.zzsc || 0); // 工作时长
|
|
|
|
|
+ let yzjeD = new Decimal(item.ytxe || 0); // 摊销额
|
|
|
|
|
+ item.yshj = zzscD.mul(yzjeD).toFixed(2);
|
|
|
|
|
+ return item;
|
|
|
|
|
+ });
|
|
|
return data;
|
|
return data;
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|