|
@@ -48,12 +48,22 @@ module.exports = app => {
|
|
|
// 数据规则
|
|
|
const rule = ctx.service.project.rule('saveInfo');
|
|
|
const jsValidator = await this.jsValidator.convert(rule).build();
|
|
|
-
|
|
|
+ const officeName = officeList[salesmanData.office];
|
|
|
+ var date = new Date(projectData.create_time*1000);//如果date为10位不需要乘1000
|
|
|
+ var Y = date.getFullYear() + '-';
|
|
|
+ var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
|
|
|
+ var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
|
|
|
+ var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
|
|
|
+ var m = (date.getMinutes() <10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
|
|
|
+ var s = (date.getSeconds() <10 ? '0' + date.getSeconds() : date.getSeconds());
|
|
|
+ const dateStr = Y+M+D+h+m+s;
|
|
|
const renderData = {
|
|
|
projectData,
|
|
|
salesmanData,
|
|
|
+ officeName,
|
|
|
officeList,
|
|
|
jsValidator,
|
|
|
+ dateStr
|
|
|
};
|
|
|
await this.layout('setting/info.ejs', renderData);
|
|
|
} catch (error) {
|
|
@@ -247,6 +257,34 @@ module.exports = app => {
|
|
|
ctx.body = {err: 1, msg: err.toString(), data: null};
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /** update porject info
|
|
|
+ * @author wangfeng
|
|
|
+ * @date 2018-10-12 15:48:05
|
|
|
+ * @param ctx
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ async updateinfo(ctx){
|
|
|
+ try {
|
|
|
+ const projectId = ctx.params.id;
|
|
|
+ const responseData = {
|
|
|
+ err: 0, msg: '', data: null,
|
|
|
+ }
|
|
|
+ const conditionData = {
|
|
|
+ id:projectId
|
|
|
+ }
|
|
|
+ const data = ctx.request.body;
|
|
|
+ const result = await ctx.service.project.update(data, conditionData);
|
|
|
+ if (!result) {
|
|
|
+ throw '提交数据失败'
|
|
|
+ }
|
|
|
+
|
|
|
+ ctx.redirect('/setting/info');
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err);
|
|
|
+ ctx.body = {err: 1, msg: err.toString(), data: null};
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return SettingController;
|