Commit c6976609385f482e189ea14e5f520e71737c625b

Authored by ly525
1 parent b73391c1

update formDetails to formRecords

back-end/h5-api/api/work/controllers/Work.js
@@ -44,14 +44,14 @@ module.exports = { @@ -44,14 +44,14 @@ module.exports = {
44 44
45 // learn the query from: https://github.com/strapi/foodadvisor/blob/master/api/api/restaurant/controllers/Restaurant.js#L40 45 // learn the query from: https://github.com/strapi/foodadvisor/blob/master/api/api/restaurant/controllers/Restaurant.js#L40
46 // eslint-disable-next-line no-undef 46 // eslint-disable-next-line no-undef
47 - let formDetails = await Workform.query(qb => { 47 + let formRecords = await Workform.query(qb => {
48 qb.where('work', '=', work.id); 48 qb.where('work', '=', work.id);
49 }).fetchAll(); 49 }).fetchAll();
50 - formDetails = formDetails.toJSON(); 50 + formRecords = formRecords.toJSON();
51 51
52 const uuidMap2Name = getUuidMap2Name(work); 52 const uuidMap2Name = getUuidMap2Name(work);
53 // eslint-disable-next-line require-atomic-updates 53 // eslint-disable-next-line require-atomic-updates
54 - return ctx.body = { uuidMap2Name, formDetails }; 54 + return ctx.body = { uuidMap2Name, formRecords };
55 }, 55 },
56 setAsTemplate: async (ctx) => { 56 setAsTemplate: async (ctx) => {
57 let work = await strapi.services.work.findOne(ctx.params); 57 let work = await strapi.services.work.findOne(ctx.params);
front-end/h5/src/store/modules/editor.js
@@ -12,7 +12,7 @@ const state = { @@ -12,7 +12,7 @@ const state = {
12 editingElementEditorConfig: null, 12 editingElementEditorConfig: null,
13 formDetailOfWork: { 13 formDetailOfWork: {
14 uuidMap2Name: {}, 14 uuidMap2Name: {},
15 - formDetails: [] 15 + formRecords: []
16 }, 16 },
17 workTemplates: [] 17 workTemplates: []
18 } 18 }
front-end/h5/src/store/modules/work.js
@@ -97,7 +97,7 @@ export const actions = { @@ -97,7 +97,7 @@ export const actions = {
97 "1565596393441": "姓名", 97 "1565596393441": "姓名",
98 "1565596397671": "学校" 98 "1565596397671": "学校"
99 }, 99 },
100 - "formDetails": [ 100 + "formRecords": [
101 { 101 {
102 "id": 3, 102 "id": 3,
103 "form": { 103 "form": {
front-end/h5/src/views/work-manager/form-stat/detail.vue
@@ -38,7 +38,7 @@ export default { @@ -38,7 +38,7 @@ export default {
38 /** 38 /**
39 * rows demo: [{"title":"姓名","key":"1565596393441"},{"title":"学校","key":"1565596397671"}] 39 * rows demo: [{"title":"姓名","key":"1565596393441"},{"title":"学校","key":"1565596397671"}]
40 * 40 *
41 - * formDetails example: <[{ 41 + * formRecords example: <[{
42 "id": 4, 42 "id": 4,
43 "form": { 43 "form": {
44 "1565595388440": "ddd", 44 "1565595388440": "ddd",
@@ -50,8 +50,8 @@ export default { @@ -50,8 +50,8 @@ export default {
50 }]> 50 }]>
51 */ 51 */
52 rows () { 52 rows () {
53 - const { formDetails, uuidMap2Name } = this.formDetailOfWork  
54 - const rows = formDetails.map(({ form, id }) => { 53 + const { formRecords, uuidMap2Name } = this.formDetailOfWork
  54 + const rows = formRecords.map(({ form, id }) => {
55 const row = {} 55 const row = {}
56 Object.entries(form).forEach(([uuid, inputValue = '-']) => { 56 Object.entries(form).forEach(([uuid, inputValue = '-']) => {
57 if (uuidMap2Name[uuid]) { 57 if (uuidMap2Name[uuid]) {