Skip to content

Commit

Permalink
公文,处理掉待办文件后的返回列表页,作优化 #686
Browse files Browse the repository at this point in the history
  • Loading branch information
tujiajun committed Apr 22, 2024
1 parent 05fb6eb commit 87e539b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"listName": "inbox",
"rowClassNameExpr": "<%=(data.is_read === false && (!data.clientIds || data.clientIds.length == 0 || !data.clientIds.includes(data._id))) ? 'unread-instance' : '' %>",
"rebuildOn": "\\${flowId || categoryId}",
"adaptor": "if (api.body.self.listName == \"inbox\") {\n _.each(payload.data.rows, function (item, index) {\n if (item.type == 'cc') {\n item.instance_name += '(传阅)';\n }\n if (item.instance__expand.values) {\n const form_fields = api.body.self.form_fields;\n _.each(item.instance__expand.values, function (field, field_code) {\n const form_field = _.find(form_fields, { code: field_code });\n if (form_field && form_field.type == \"group\") {\n if (form_field.is_multiselect) {\n item.instance__expand.values[field_code] = field && field.length > 0 ? _.map(field, 'fullname').toString() : \"\";\n } else {\n item.instance__expand.values[field_code] = field ? field.fullname : \"\";\n }\n } else if (form_field && form_field.type == \"user\") {\n if (form_field.is_multiselect) {\n item.instance__expand.values[field_code] = field && field.length > 0 ? _.map(field, 'name').toString() : \"\";\n } else {\n item.instance__expand.values[field_code] = field ? field.name : \"\";\n }\n }\n })\n }\n })\n}\n",
"adaptor": "const isSearch = _.some(_.keys(api.body.self), key => key.includes('__keywords') || key.includes('__searchable__'));\nif(payload.data.count==0 && !isSearch){\n const searchParams = new URLSearchParams(window.location.search);\n const flowId = searchParams.get(\"flowId\");\n const categoryId = searchParams.get(\"categoryId\");\n const pathname = window.location.pathname;\n if(flowId || categoryId){\n window.FlowRouter.go(pathname + \"?additionalFilters=&flowId=&categoryId=\");\n }\n // if(flowId) {\n // window.FlowRouter.go(pathname + \"?additionalFilters=['category','=','\" + categoryId +\"']&flowId=&categoryId=\" + categoryId);\n // }else if(categoryId) {\n // window.FlowRouter.go(pathname + \"?additionalFilters=&flowId=&categoryId=\");\n // }\n};\nif (api.body.self.listName == \"inbox\") {\n _.each(payload.data.rows, function (item, index) {\n if (item.type == 'cc') {\n item.instance_name += '(传阅)';\n }\n if (item.instance__expand.values) {\n const form_fields = api.body.self.form_fields;\n _.each(item.instance__expand.values, function (field, field_code) {\n const form_field = _.find(form_fields, { code: field_code });\n if (form_field && form_field.type == \"group\") {\n if (form_field.is_multiselect) {\n item.instance__expand.values[field_code] = field && field.length > 0 ? _.map(field, 'fullname').toString() : \"\";\n } else {\n item.instance__expand.values[field_code] = field ? field.fullname : \"\";\n }\n } else if (form_field && form_field.type == \"user\") {\n if (form_field.is_multiselect) {\n item.instance__expand.values[field_code] = field && field.length > 0 ? _.map(field, 'name').toString() : \"\";\n } else {\n item.instance__expand.values[field_code] = field ? field.name : \"\";\n }\n }\n })\n }\n })\n}\n",
"crudDataFilter": "if (data && data.flowId && (data.listName == 'inbox' || 'monitor') && window.innerWidth > 768) {\r\n var api = {\r\n url: \"${context.rootUrl}/graphql\",\r\n method: \"post\",\r\n dataType: \"json\",\r\n data: {\r\n \"query\": '{flow: flows__findOne(id:\"' + data.flowId + '\"){form__expand{current}}}'\r\n },\r\n headers: {\r\n Authorization:\r\n \"Bearer ${context.tenantId},${context.authToken}\",\r\n },\r\n };\r\n return env.fetcher(api).then((result) => {\r\n if (result.data && result.data.flow && result.data.flow.form__expand.current.fields && result.data.flow.form__expand.current.fields.length > 0) {\r\n let fields = result.data.flow.form__expand.current.fields;\r\n fields.forEach(function (field) {\r\n if (field.is_list_display) {\r\n crud.columns.push({\r\n \"name\": \"instance__expand.values.\" + field.code,\r\n \"label\": field.name || field.code,\r\n \"width\": \"unset\",\r\n \"type\": \"text\",\r\n \"className\": \" whitespace-nowrap\",\r\n \"static\": true,\r\n \"options\": null\r\n });\r\n }\r\n })\r\n let schemaApiService = SteedosUI.getRef('steedosPageObjectControl').parent.getComponentById(\"instance_tasks_list_service\");\r\n schemaApiService && schemaApiService.setData({ form_fields: fields, isFlowDataDone: true });\r\n crud.api.sendOn = \"this.isFlowDataDone\";\r\n }\r\n return crud;\r\n });\r\n} else {\r\n let schemaApiService = SteedosUI.getRef('steedosPageObjectControl').parent.getComponentById(\"instance_tasks_list_service\");\r\n schemaApiService && schemaApiService.setData({ isFlowDataDone: true });\r\n crud.api.sendOn = \"this.isFlowDataDone\"; if(data.display == 'split'){Object.assign(crud, {\"onEvent\":{\"rowClick\":{\"actions\":[{\"actionType\":\"custom\",\"script\":\"const clientIds = event.data.clientIds || []; clientIds.push(event.data.item._id);doAction({actionType: 'setValue', componentId: 'service_listview_instance_tasks', args: {value: {clientIds: clientIds}}})\"}]}},\"id\":\"u:af8bd61b2b28\"});} ; \r\n return crud;\r\n}\r\n"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ const getCategoriesInbox = async (userSession, req, currentUrl) => {
let categoryBadge = 0;
const flowGroups = lodash.groupBy(v, 'flow_name');
const flows = [];
const categoryValue = `/app/${appId}/instance_tasks/grid/inbox?additionalFilters=['category', '=', ${v[0].category?"'" + v[0].category + "'":v[0].category}]&flowId=&categoryId=${v[0].category}`;
const categoryValue = `/app/${appId}/instance_tasks/grid/inbox?additionalFilters=['category','=',${v[0].category?"'" + v[0].category + "'":v[0].category}]&flowId=&categoryId=${v[0].category}`;
let categoryIsUnfolded = false;
lodash.each(flowGroups, (v2, k2)=>{
const flowValue = `/app/${appId}/instance_tasks/grid/inbox?additionalFilters=['flow', '=', '${v2[0].flow}']&flowId=${v2[0].flow}&categoryId=${v[0].category}`;
const flowValue = `/app/${appId}/instance_tasks/grid/inbox?additionalFilters=['flow','=','${v2[0].flow}']&flowId=${v2[0].flow}&categoryId=${v[0].category}`;
let flowIsUnfolded = false;
if(currentUrl == flowValue){
flowIsUnfolded = true;
Expand Down Expand Up @@ -199,10 +199,10 @@ const getCategoriesMonitor = async (userSession, req, currentUrl) => {
lodash.each(categoryGroups, (v, k) => {
const flowGroups = lodash.groupBy(v, 'name');
const flows = [];
const categoryValue = `/app/${appId}/instances/grid/monitor?additionalFilters=['category', '=', ${v[0].category__expand?"'" + v[0].category__expand._id + "'":null}]&flowId=&categoryId=${v[0].category__expand && v[0].category__expand._id}`;
const categoryValue = `/app/${appId}/instances/grid/monitor?additionalFilters=['category','=',${v[0].category__expand?"'" + v[0].category__expand._id + "'":null}]&flowId=&categoryId=${v[0].category__expand && v[0].category__expand._id}`;
let categoryIsUnfolded = false;
lodash.each(flowGroups, (v2, k2) => {
const flowValue = `/app/${appId}/instances/grid/monitor?additionalFilters=['flow', '=', '${v2[0]._id}']&flowId=${v2[0]._id}&categoryId=${v[0].category__expand && v[0].category__expand._id}`;
const flowValue = `/app/${appId}/instances/grid/monitor?additionalFilters=['flow','=','${v2[0]._id}']&flowId=${v2[0]._id}&categoryId=${v[0].category__expand && v[0].category__expand._id}`;
let flowIsUnfolded = false;
if(currentUrl == flowValue){
flowIsUnfolded = true;
Expand Down

1 comment on commit 87e539b

@tujiajun
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Task]: 公文,处理掉待办文件后的返回列表页,作优化 #6763

Please sign in to comment.