|
|
@@ -6,21 +6,12 @@
|
|
|
v-model="form"
|
|
|
:page.sync="page"
|
|
|
:before-open="handleBeforeOpen"
|
|
|
+ :before-close="handleBeforeClose"
|
|
|
:permission="permissionList"
|
|
|
>
|
|
|
<template slot="menuLeft">
|
|
|
<el-button
|
|
|
v-if="!isSelAnnual"
|
|
|
- type="danger"
|
|
|
- size="small"
|
|
|
- icon="el-icon-delete"
|
|
|
- plain
|
|
|
- @click="handleDelete"
|
|
|
- >
|
|
|
- 删 除
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- v-if="!isSelAnnual"
|
|
|
type="success"
|
|
|
size="small"
|
|
|
plain
|
|
|
@@ -54,10 +45,13 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <template slot-scope="{row}" slot="menu">
|
|
|
- <el-button v-if="[1,2].indexOf(row.status) > -1" type="text" size="mini" @click="handleChangeStatus(row, 0)">恢复</el-button>
|
|
|
- <el-button v-if="row.status === 0" type="text" size="mini" @click="handleChangeStatus(row, 1)">停用</el-button>
|
|
|
- <el-button v-if="row.status === 0" type="text" size="mini" @click="handleChangeStatus(row, 2)">已足额折旧</el-button>
|
|
|
+ <template slot-scope="{row, index, size}" slot="menu">
|
|
|
+ <el-button v-if="!isSelAnnual && [0,1].indexOf(row.status) > -1" type="text" :size="size" icon="el-icon-edit" @click="handleEdit(row, index)">编辑</el-button>
|
|
|
+ <el-button type="text" :size="size" icon="el-icon-delete" @click="rowDel(row, index)">删除</el-button>
|
|
|
+ <el-button v-if="!isSelAnnual && row.status === 0" type="text" :size="size" @click="handleChangeStatus(row, 3)">改造</el-button>
|
|
|
+ <el-button v-if="!isSelAnnual && row.status === 0" type="text" :size="size" @click="handleChangeStatus(row, 1)">停用</el-button>
|
|
|
+ <el-button v-if="!isSelAnnual && row.status === 0" type="text" :size="size" @click="handleChangeStatus(row, 4)">资产处置</el-button>
|
|
|
+ <el-button v-if="!isSelAnnual && [1,3].indexOf(row.status) > -1" type="text" :size="size" @click="handleRecover(row)">恢复</el-button>
|
|
|
</template>
|
|
|
|
|
|
<template slot="gl" slot-scope="{row}">
|
|
|
@@ -131,6 +125,10 @@ export default window.$crudCommon({
|
|
|
},
|
|
|
isSelAnnual: false, // 是否选择全年
|
|
|
|
|
|
+ isRecover: false, // 是否为恢复面板
|
|
|
+
|
|
|
+ modifyBeforeForm: {}, // 修改前数据
|
|
|
+
|
|
|
wideTableColumns: [],
|
|
|
printTitle: "",
|
|
|
};
|
|
|
@@ -173,20 +171,72 @@ export default window.$crudCommon({
|
|
|
this.option = { ...newOption };
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleEdit(row) {
|
|
|
+ this.$refs.crud.rowEdit(row);
|
|
|
+ },
|
|
|
+ handleRecover(row) {
|
|
|
+ this.$refs.crud.rowEdit(row);
|
|
|
+ this.isRecover = true;
|
|
|
+ },
|
|
|
+ handleBeforeOpen(done) {
|
|
|
+ this.modifyBeforeForm = JSON.parse(JSON.stringify(this.form));
|
|
|
+ done();
|
|
|
+ },
|
|
|
+ handleBeforeClose(done) {
|
|
|
+ this.isRecover = false;
|
|
|
+ done();
|
|
|
+ },
|
|
|
getFormData() {
|
|
|
let jcz = new Decimal(this.form.jcz || 0).div(new Decimal(100));
|
|
|
return { ...this.form, jcz: Number(jcz), yearAndMonth: this.params.yearAndMonth };
|
|
|
},
|
|
|
+ rowUpdate(row, index, done, loading) {
|
|
|
+
|
|
|
+ delete this.form.params;
|
|
|
+ let updateParams = this.getFormData();
|
|
|
+ let func = this.isRecover ? this.api.recover : this.api.update;
|
|
|
+
|
|
|
+ const callback = () => {
|
|
|
+ func(updateParams).then((data) => {
|
|
|
+ this.getList();
|
|
|
+ if (this.updateAfter) {
|
|
|
+ this.updateAfter(data);
|
|
|
+ } else {
|
|
|
+ this.$message.success(this.isRecover ? '恢复成功' : '更新成功');
|
|
|
+ }
|
|
|
+ done();
|
|
|
+ }).catch(() => {
|
|
|
+ loading();
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ let confirmText = "确认更新吗?";
|
|
|
+ if (updateParams.sysm - updateParams.ysysm == 0) {
|
|
|
+ confirmText = "当前使用寿命减去使用月数小于或者等于0,点击更新后资产的状态将设置为【已足额折旧】,是否确认更新?";
|
|
|
+ } else if (updateParams.kssj != this.modifyBeforeForm.kssj) {
|
|
|
+ confirmText = "开始时间已更新,请检查资产其他关联数值是否需要同步调整!是否确认更新?";
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$confirm(confirmText, "提示", {
|
|
|
+ confirmButtonText: '更新',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ callback();
|
|
|
+ }).catch(() => {
|
|
|
+ loading();
|
|
|
+ })
|
|
|
+ },
|
|
|
handleImport() {
|
|
|
let excelParams = { yearAndMonth: this.params.yearAndMonth };
|
|
|
- this.$refs.uploadExcelDialog.open('/api//kd-scientific/asset/import', excelParams);
|
|
|
+ this.$refs.uploadExcelDialog.open('/api/kd-scientific/asset/import', excelParams);
|
|
|
},
|
|
|
uploadAfter() {
|
|
|
this.page.currentPage = 1;
|
|
|
this.getList(this.page);
|
|
|
},
|
|
|
handleExport() {
|
|
|
- exportBloByPost(`/api//kd-scientific/asset/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
+ exportBloByPost(`/api/kd-scientific/asset/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
downloadXls(res.data, `科研资产清单${this.params.yearAndMonth}.xlsx`);
|
|
|
});
|
|
|
},
|
|
|
@@ -209,12 +259,12 @@ export default window.$crudCommon({
|
|
|
},
|
|
|
handleChangeStatus(rowData, status) {
|
|
|
let msgText = '';
|
|
|
- if (status === 0) {
|
|
|
- msgText = `确认恢复资产“${rowData.zcmc}”吗?`
|
|
|
- } else if (status === 1) {
|
|
|
+ if (status === 1) {
|
|
|
msgText = `确认停用资产“${rowData.zcmc}”吗?`
|
|
|
- } else if (status === 2) {
|
|
|
- msgText = `确认将资产“${rowData.zcmc}”设置为已足额折旧吗?`
|
|
|
+ } else if (status === 3) {
|
|
|
+ msgText = `确认将资产“${rowData.zcmc}”进行改造吗?`
|
|
|
+ } else if (status === 4) {
|
|
|
+ msgText = `确认处置资产“${rowData.zcmc}”吗?`
|
|
|
}
|
|
|
|
|
|
this.$confirm(msgText, "提示", {
|
|
|
@@ -222,8 +272,9 @@ export default window.$crudCommon({
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
}).then(() => {
|
|
|
- const params = { ...rowData, status };
|
|
|
- this.api.update(params).then(({ data }) => {
|
|
|
+ let jcz = new Decimal(rowData.jcz || 0).div(new Decimal(100));
|
|
|
+ const params = { ...rowData, jcz, status };
|
|
|
+ this.api.updateStatus(params).then(({ data }) => {
|
|
|
if (data.success) {
|
|
|
this.$message.success("操作成功!");
|
|
|
this.getList(this.page);
|