|
@@ -9,7 +9,6 @@
|
|
|
*/
|
|
|
|
|
|
const auditConst = require('../const/audit').material;
|
|
|
-
|
|
|
module.exports = app => {
|
|
|
class Material extends app.BaseService {
|
|
|
/**
|
|
@@ -174,6 +173,9 @@ module.exports = app => {
|
|
|
async deleteMaterial(id) {
|
|
|
const transaction = await this.db.beginTransaction();
|
|
|
try {
|
|
|
+ // 删除文件
|
|
|
+ const attList = await this.ctx.service.materialFile.getAllMaterialFiles(this.ctx.tender.id, id);
|
|
|
+ await this.ctx.helper.delFiles(attList);
|
|
|
await transaction.delete(this.ctx.service.materialAudit.tableName, { mid: id });
|
|
|
await transaction.delete(this.ctx.service.materialBills.tableName, { mid: id });
|
|
|
await transaction.delete(this.ctx.service.materialList.tableName, { mid: id });
|
|
@@ -192,9 +194,6 @@ module.exports = app => {
|
|
|
}
|
|
|
await transaction.delete(this.tableName, { id });
|
|
|
await transaction.commit();
|
|
|
- // 删除期第一个参数不用传,第二个为期数
|
|
|
- const attList = await this.ctx.service.materialFile.getAllMaterialFiles('', id);
|
|
|
- await this.ctx.helper.delFiles(attList);
|
|
|
return true;
|
|
|
} catch (err) {
|
|
|
await transaction.rollback();
|