You can't and should not.
A sub-task is part of a story - how can something be complete when part of it is not? By definition it's not finished if part of it still needs doing.
If you genuinely have a done story with sub-tasks that are not done, then your sub-tasks are clearly not part of the story and should be stories or belong to the story they are actually part of.
Basically, your question is screaming "my data and/or process is wrong"
Basically you can do that manually from the UI by changing the status to "Done" or "Closed" - depending on which status you have on your workflow. The question here is why complete the story first before any sub_task is done? As sub_task are broken task of a parent Issue. So, if you're going towards that angle, then do not use sub_task and simply just have stories alone. However if it is a one off thing, Jira doesn't restrict how your usage goes into account. it allows you to perform such action at will.
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events